Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/dcd 28 sales demo cleanup #24

Merged
merged 29 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c99e971
add clarity partners logo to QR
mike-parkhill Apr 24, 2024
87c1e4a
added get wallet page
mike-parkhill Apr 24, 2024
a5f9a26
fix centering of clarity partners logo under QR code
mike-parkhill Apr 24, 2024
28c0b6d
update dprint and fix format errors
mike-parkhill Apr 26, 2024
2ffd45d
update lock files
mike-parkhill Apr 26, 2024
74c5a8a
wip: adding verified badge to pre-filled input fields
mike-parkhill Apr 30, 2024
954f9fb
ux changes for check-badge
mike-parkhill May 1, 2024
0491888
fix undefined errors on address form
mike-parkhill May 1, 2024
219eca2
use same checkmark for filled fields as for verified credentials
mike-parkhill May 2, 2024
3f0d379
remove console.log entries
mike-parkhill May 3, 2024
eefa668
added download script for proof requests
mike-parkhill May 6, 2024
3fdec79
download ecosystem
mike-parkhill May 6, 2024
b357ffe
download participants and schemas
mike-parkhill May 6, 2024
0ce7e75
download participants and linked schema info
mike-parkhill May 8, 2024
8fc45d1
wip - setup-certs
mike-parkhill May 8, 2024
2c2cc1d
populate dids and profiles for ecosystem
mike-parkhill May 13, 2024
4f02f49
invite participants to ecosystem
mike-parkhill May 14, 2024
4328dcc
add proof templates
mike-parkhill May 14, 2024
ef7a676
all elements of the ecosystem are populated, but issuance is failing …
mike-parkhill May 15, 2024
989144e
add issuer DIDs to env.new
mike-parkhill May 16, 2024
f5b1f30
link proof templates to the right DIDs
mike-parkhill May 16, 2024
aa58ed5
updated readme for configuring Certs dependencies
mike-parkhill May 16, 2024
fb798fd
fix tabs in download script
mike-parkhill May 17, 2024
ff1cc29
fix undefined applicant error
mike-parkhill May 17, 2024
5ab3fb7
fixed spacing in loan form
mike-parkhill May 20, 2024
c7815f5
Readme updates and tidied up sample eco-system files
mike-parkhill May 23, 2024
5490392
ignore all .env files
mike-parkhill May 24, 2024
5bb0891
fix getWallet URL to make sure it's https
mike-parkhill May 24, 2024
730968e
Merge branch 'main' into fix/DCD-28_sales_demo_cleanup
mike-parkhill May 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,36 +114,33 @@ The `QrCodeAuthentication` component manages QR code authentication flow. It ren

### 🔑 Configuration

To configure the project, set up environment variables. Copy the `.env.example` file to a new file named `.env` and fill in the variables:
### 🛠️ Installation

- `NEXT_PUBLIC_DOCK_API_URL`: URL to the Dock API, set to the testnet endpoint.
- `DOCK_API_TOKEN`: Your API token for authenticating with the Dock API.
- `DOCK_API_DID`: The DID to use for the issuer. You can generate a DID [here](https://certs.dock.io/dids).
- `NEXT_PUBLIC_SERVER_URL`: The URL of your server, defaulting to `http://localhost:3000` for local development.

### Proof-Request Template IDs and Organization Profiles
1. Clone the repo: `git clone <repo_url>`
2. Install dependencies: `npm install` or `yarn`

Create these IDs from [Certs Dock](https://certs.dock.io/). Fill in the template IDs and issuer IDs for your proof requests and organization profiles. These are crucial for the functioning of your verifiable credentials within the demo.
### Configuring Certs Dependencies

Ensure all these configurations are set properly in your `.env` file before running the project to ensure smooth operation and connectivity to the necessary services.
Running this project depends on having an ecosystem, organizational profiles, and proof request templates configured properly in Certs. You can set these up automatically by using the [setup-certs](./scripts/setup-certs.mjs) command.

### 🛠️ Installation and Deployment
1. Configure the `.env` file by setting the following variables
* DOCK_API_KEY - sign into [Certs](https://certs.dock.io/) and generate a test environment key from `Developer -> API Keys`
* DOCK_API_URL=DOCK_API_URL="https://api-testnet.dock.io"
2. Run `yarn setup-certs`
3. This will generate a `.env.new` file populated with the environment variables you need to run the project. Copy this over the `.env` file

1. Clone the repo: `git clone <repo_url>`
2. Install dependencies: `npm install` or `yarn`
3. Start the project: `npm start` or `yarn dev`

## 🧪 Testing the Project Workflow

Before starting, remember to get the Dock Wallet mobile app, with the biometric service plugin enabled, is required. The Dock Wallet app is available on PlayStore or AppStore.

The demo workflow consists of going through the KYC process filling the formularies and scanning each QR code to get authenticated and test the organizations ecosystems.

It's based on 3 ecosystems:
It's based on an ecosystem called, "Clarity Partners". The ecosystem contains the following organizations:

**Quotient:** Get BankId and Credit Score credentials and Apply for an auto loan.
**Quotient Credit Union:** Create BankId and Credit Score credentials and Apply for an auto loan.

**Equinet:** Revoke Credit Score credential and issue a new one.
**Equinet:** Create and revoke Credit Score credential and issue a new one.

**Urbanscape:** Apply for an apartment providing your BankId and Credit Score credentials.

Expand Down
1 change: 0 additions & 1 deletion components/ui/form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const useFormField = () => {
if (!fieldContext) {
throw new Error('useFormField should be used within <FormField>');
}
console.log(`fieldContext: ${JSON.stringify(fieldContext)}`);

const { id } = itemContext;

Expand Down
1 change: 0 additions & 1 deletion components/ui/input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const Input = React.forwardRef(({ className, type, data, ...props }, ref) => (
{...props} />

{data?.isVerified && verifiedBadge}
{console.log(`${JSON.stringify(props)} - data: ${JSON.stringify(data)} - ref: ${JSON.stringify(ref)}`)}
</div>
));

Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"start": "next start",
"lint": "next lint",
"format": "dprint fmt && next lint --fix",
"format-check": "dprint check && next lint"
"format-check": "dprint check && next lint",
"download": "node --env-file=.env scripts/download-ecosystem.mjs",
"setup-certs": "node --env-file=.env scripts/setup-certs.mjs"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.4.2",
Expand Down
141 changes: 141 additions & 0 deletions scripts/download-ecosystem.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import axios from 'axios';
import fs from 'node:fs/promises';
import { scrubForFilename } from './helpers.mjs';

const axiosHeaders = {
headers: {
'DOCK-API-TOKEN': `${process.env.DOCK_API_TOKEN}`,
},
};

const templatesToDownload = [{
templateId: process.env.NEXT_PUBLIC_BANK_IDENDITY_TEMPLATE_ID,
name: 'BANK_IDENDITY_TEMPLATE_ID'
},
{
templateId: process.env.NEXT_PUBLIC_FORSUR_PROOF_TEMPLATE_ID,
name: 'FORSUR_PROOF_TEMPLATE_ID'
},
{
templateId: process.env.NEXT_PUBLIC_FORSUR_VERIFICATION_PROOF_TEMPLATE_ID,
name: 'FORSUR_VERIFICATION_PROOF_TEMPLATE_ID'
},
{
templateId: process.env.NEXT_PUBLIC_QUOTIENT_LOAN_PROOF_TEMPLATE_ID,
name: 'QUOTIENT_LOAN_PROOF_TEMPLATE_ID'
},
{
templateId: process.env.NEXT_PUBLIC_URBANSCAPE_BANKBIO_TEMPLATE_ID,
name: 'URBANSCAPE_BANKBIO_TEMPLATE_ID'
},
{
templateId: process.env.NEXT_PUBLIC_URBANSCAPE_CREDITSCORE_TEMPLATE_ID,
name: 'URBANSCAPE_CREDITSCORE_TEMPLATE_ID'
},
];

export async function downloadEcosystems() {
console.log('--- Downloading ecosystems from Certs ---');

const ecosystemsUrl = `${process.env.DOCK_API_URL}/trust-registries/`;
const ecosystemsResponse = await axios.get(ecosystemsUrl, axiosHeaders);
gasher marked this conversation as resolved.
Show resolved Hide resolved

ecosystemsResponse.data.map(async (ecosystem) => {
try {
console.log(`\tDownloading ecosystem: ${ecosystem.name}`);
const filename = scrubForFilename(ecosystem.slug);
const folder = `scripts/ecosystem-requests/${filename}`;
await fs.mkdir(folder);
await fs.writeFile(`${folder}/${filename}.json`, JSON.stringify(ecosystem, null, '\t'));

const participantsFolder = `${folder}/participants`;
await fs.mkdir(participantsFolder);
await downloadParticipants(ecosystem.id, participantsFolder);

const schemasFolder = `${folder}/schemas`;
await fs.mkdir(schemasFolder);
await downloadSchemas(ecosystem.id, schemasFolder);

const proofTemplatesFolder = `${folder}/proof-templates`;
await fs.mkdir(proofTemplatesFolder);
await downloadProofRequestTemplates(ecosystem.id, proofTemplatesFolder);
} catch (error) {
console.log(error);
}
});
}

async function downloadParticipants(ecosystemId, folder) {
console.log('\t--- Downloading participants ---');

const ecosystemsUrl = `${process.env.DOCK_API_URL}/trust-registries/${ecosystemId}/participants`;
const ecosystemsResponse = await axios.get(ecosystemsUrl, axiosHeaders);

ecosystemsResponse.data.list.map(async (participant) => {
try {
console.log(`\t\tDownloading participant: ${participant.name}`);
const filename = scrubForFilename(participant.name);
await fs.writeFile(`${folder}/${filename}.json`, JSON.stringify(participant, null, '\t'));
} catch (error) {
console.log(error);
}
});
}

async function downloadSchemas(ecosystemId, folder) {
console.log('\t--- Downloading schemas ---');

const ecosystemsUrl = `${process.env.DOCK_API_URL}/trust-registries/${ecosystemId}/schemas`;
const ecosystemsResponse = await axios.get(ecosystemsUrl, axiosHeaders);

ecosystemsResponse.data.list.map(async (schema) => {
try {
console.log(`\t\tDownloading schema: ${schema.name}`);
const filename = scrubForFilename(schema.name);
await fs.writeFile(`${folder}/${filename}.json`, JSON.stringify(schema, null, '\t'));
} catch (error) {
console.log(error);
}
});
}

async function downloadProofRequestTemplates(ecosystemId, folder) {
console.log('\t--- Downloading proof request templates ---');

const ecosystemsUrl = `${process.env.DOCK_API_URL}/trust-registries/${ecosystemId}/proof-templates`;
const ecosystemsResponse = await axios.get(ecosystemsUrl, axiosHeaders);

ecosystemsResponse.data.list.map(async (proofTemplate) => {
try {
console.log(`\t\tDownloading proof request template: ${proofTemplate.name}`);
const filename = scrubForFilename(proofTemplate.name);
await fs.writeFile(`${folder}/${filename}.json`, JSON.stringify(proofTemplate, null, '\t'));
} catch (error) {
console.log(error);
}
});
}

export function downloadProofRequests() {
console.log('--- Downloading proof request templates from Certs ---');

const proofTemplateUrl = `${process.env.DOCK_API_URL}/proof-templates/`;

templatesToDownload.map(async (template) => {
try {
console.log(`Downloading proof request template: ${template.name}`);
const templateUrl = `${proofTemplateUrl}${template.templateId}`;
const templateResponse = await axios.get(templateUrl, axiosHeaders);
await fs.writeFile(`scripts/proof-requests/${template.name}.json`, JSON.stringify(templateResponse.data, null, '\t'));
} catch (error) {
console.log(error);
}
});
}

if (!process.env.DOCK_API_TOKEN) {
throw new Error("Please configure the DOCK_API_TOKEN setting in the project's .env file.");
}

downloadEcosystems();
// downloadProofRequests();
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"convener": "",
"convenerName": "",
"convenerLogoUrl": "",
"isOwner": true,
"name": "clarity partners",
"description": "The privacy conscious ecosystem of partners using Identity Clarity KYC products.",
"logoUrl": "https://img.dock.io/fc8f5f86299f5bebceb45caf32ea77b2",
"ecosystemUrl": "https://bank-demo.dock.io/partners",
"governanceFramework": "Issuers in the clarity partners ecosystem commit to following the processes defined by Identity Clarity in order to ensure that the proper level of assurance is met for each credential type.\n\nVerifiers in the clarity partners ecosystem commit to only rely upon participating credentials for their intended purpose. They are solely responsible for their use of the credentials and have no claims upon the issuer or Identity Clarity except under the terms of a separate agreement, if any.\n\nAll participants in the clarity partners ecosystem commit to following the Identity Clarity privacy policy governing consumer data.\n\nFailure to follow these policies will result in removal from the ecosystem.",
"governanceFrameworkVersion": "1.0.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"id": "168784d8-daa2-469d-9884-995326be65dc",
"userId": 14988,
"name": "EquiNET",
"description": "EquiNet is the credit bureau.",
"did": "did:dock:5CKsfvaE68mvRhdn3dDXG4KpWzuvaUNdBbiu6sFUuPK9rw66",
"logoUrl": "https://img.dock.io/9f327cafda3be5f0cff0da2df44c55da",
"infoUrl": "https://bank-demo.dock.io/partners/equinet",
"status": "active",
"role": "issuer",
"issuerSchemas": [
"https://schema.dock.io/EquiNetCreditScore-V2-1706975901761.json"
],
"verifierSchemas": [],
"created": "2024-02-28T05:06:18.573Z",
"suspendedAt": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"id": "68f985cb-e21d-4631-9fe0-e1e21d897540",
"userId": 14988,
"name": "Forsur",
"description": "Forsur is the biometric provider.",
"did": "did:dock:5HLbQLSmirNuZVRsdWKbsgdajw9QTGzSFJABSVzMT5EBj5sb",
"logoUrl": "https://img.dock.io/80f154126a78bba321b413c3ffb8d4a7",
"infoUrl": "https://bank-demo.dock.io/partners/forsur",
"status": "active",
"role": "verifier+issuer",
"issuerSchemas": [
"https://schema.dock.io/ForSurBiometricCheck-V4-1709846734949.json",
"https://schema.dock.io/ForSurBiometricEnrollment-V4-1709846932138.json"
],
"verifierSchemas": [
"https://schema.dock.io/ForSurBiometricCheck-V4-1709846734949.json",
"https://schema.dock.io/ForSurBiometricEnrollment-V4-1709846932138.json"
],
"created": "2024-02-28T05:09:06.660Z",
"suspendedAt": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"id": "63fd622d-15e5-4567-a6e3-bb70c16fe411",
"userId": 14988,
"name": "Quotient Credit Union",
"description": "Quotient is our credit union",
"did": "did:dock:5HKkVpaciu1RArV13E7ig3i84JtiMTcwoXoHPZ8VMrBUYJ4w",
"logoUrl": "https://img.dock.io/06d78272268c606a172d5fd1cd559b46",
"infoUrl": "https://bank-demo.dock.io/partners/quotient",
"status": "active",
"role": "verifier+issuer",
"issuerSchemas": [
"https://schema.dock.io/QuotientBankIdentityWBiometrics-V2-1706990529964.json"
],
"verifierSchemas": [
"https://schema.dock.io/ForSurBiometricCheck-V4-1709846734949.json",
"https://schema.dock.io/QuotientBankIdentityWBiometrics-V2-1706990529964.json"
],
"created": "2024-02-28T05:08:10.130Z",
"suspendedAt": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"id": "ddec925c-5436-4751-8f47-3c0a43827dde",
"userId": 14988,
"name": "UrbanScape - Apartment Living",
"description": "UrbanScape is the apartment company offering upscale rentals.",
"did": "did:dock:5FCe8GacpjqyVYoUR6zQpydiS1hSpqhdJfLknnLYhjzrUYCH",
"logoUrl": "https://img.dock.io/425dbd0968a99b01edc33055a845d692",
"infoUrl": "https://bank-demo.dock.io/partners/urbanscape",
"status": "active",
"role": "verifier",
"issuerSchemas": [],
"verifierSchemas": [
"https://schema.dock.io/EquiNetCreditScore-V2-1706975901761.json",
"https://schema.dock.io/ForSurBiometricCheck-V4-1709846734949.json",
"https://schema.dock.io/QuotientBankIdentityWBiometrics-V2-1706990529964.json"
],
"created": "2024-02-28T05:04:28.691Z",
"suspendedAt": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[
{
"name": "UrbanScape - Apartment Living",
"description": "UrbanScape is the apartment company offering upscale rentals.",
"logo": "https://img.dock.io/425dbd0968a99b01edc33055a845d692",
"type": "dock",
"isParticipant": true,
"proofRequests": [
"URBANSCAPE_BANKBIO_TEMPLATE_ID",
"URBANSCAPE_CREDITSCORE_TEMPLATE_ID"
]
},
{
"name": "EquiNET",
"description": "EquiNet is the credit bureau.",
"logo": "https://img.dock.io/9f327cafda3be5f0cff0da2df44c55da",
"type": "dock",
"isParticipant": true,
"isIssuer": true,
"envVar": "NEXT_PUBLIC_EQUINET_ISSUER_ID",
"proofRequests": []
},
{
"name": "Forsur",
"description": "Forsur is the biometric provider.",
"logo": "https://img.dock.io/80f154126a78bba321b413c3ffb8d4a7",
"type": "dock",
"isParticipant": true,
"isIssuer": true,
"envVar": "NEXT_PUBLIC_FORSUR_ISSUER_ID",
"proofRequests": [
"FORSUR_PROOF_TEMPLATE_ID",
"FORSUR_VERIFICATION_PROOF_TEMPLATE_ID"
]
},
{
"name": "IdentityClarity",
"description": "IdentityClarity is the KYC provider.",
"logo": "https://img.dock.io/cd7a8a1ff8dd97b0c816cb152107eb9d",
"type": "dock",
"isConvener": true
},
{
"name": "Quotient Credit Union",
"description": "Quotient is our credit union",
"logo": "https://img.dock.io/06d78272268c606a172d5fd1cd559b46",
"type": "dock",
"isParticipant": true,
"isIssuer": true,
"envVar": "NEXT_PUBLIC_QUOTIENT_ISSUER_ID",
"proofRequests": [
"QUOTIENT_LOAN_PROOF_TEMPLATE_ID",
"BANK_IDENDITY_TEMPLATE_ID"
]
}
]
Loading
Loading