Skip to content

Commit

Permalink
Fix revocation bug and some minor tweaks to spelling, etc. (#19)
Browse files Browse the repository at this point in the history
* fix path to issued VC id
* fix bank account address state mapping issue
* make bank id values match driver license
* fix typo and add empty option for Suffix field
* remove terive reference
  • Loading branch information
mike-parkhill authored Mar 8, 2024
1 parent cd97a41 commit b618910
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 36 deletions.
25 changes: 12 additions & 13 deletions _credentials/quotient.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { v4 as uuidv4 } from "uuid";
import { dockUrl } from "utils/constants";
import { v4 as uuidv4 } from 'uuid';
import { dockUrl } from 'utils/constants';

export function createBankIdCredential({
receiverDid,
Expand All @@ -8,27 +8,26 @@ export function createBankIdCredential({
receiverAddress,
biometricData
}) {

console.log("Creating Quotient Bank Identity Credential for:", receiverDid);
console.log('Creating Quotient Bank Identity Credential for:', receiverDid);

const credentialPayload = {
url: `${dockUrl}/credentials`,
body: {
anchor: false,
algorithm: "dockbbs+",
algorithm: 'dockbbs+',
distribute: true,
credential: {
id: `https://creds-testnet.dock.io/${uuidv4()}`,
name: "Quotient - Bank Identity",
name: 'Quotient - Bank Identity',
description: "The \"Quotient - Bank Identity\" schema provides a secure and standardized format for representing key aspects of an individual's bank identity.",
type: [
"VerifiableCredential",
"QuotientBankIdentity"
'VerifiableCredential',
'QuotientBankIdentity'
],
issuer: {
name: "Quotient Credit Union",
description: "Quotient is our credit union",
logo: "https://img.dock.io/06d78272268c606a172d5fd1cd559b46",
name: 'Quotient Credit Union',
description: 'Quotient is our credit union',
logo: 'https://img.dock.io/06d78272268c606a172d5fd1cd559b46',
id: process.env.NEXT_PUBLIC_QUOTIENT_ISSUER_ID
},
subject: {
Expand All @@ -37,7 +36,7 @@ export function createBankIdCredential({
address: receiverAddress.address,
city: receiverAddress.city,
zip: receiverAddress.zip,
city: receiverAddress.state,
state: receiverAddress.state,
account_number: `ABC${uuidv4()}`,
biometric: biometricData
}
Expand All @@ -46,7 +45,7 @@ export function createBankIdCredential({
};

if (recipientEmail && recipientEmail.length > 2 && validateEmail(recipientEmail)) {
credentialPayload.recipientEmail = recipientEmail
credentialPayload.recipientEmail = recipientEmail;
}

return credentialPayload;
Expand Down
5 changes: 3 additions & 2 deletions components/forms/form-field-id.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ const FormFieldNameAndBirthday = ({ control, dob = false }) => (
</SelectTrigger>
</FormControl>
<SelectContent>
<SelectItem disabled={field.value === 'Junior'} value={'Junior'}>Junior</SelectItem>
<SelectItem disabled={field.value === 'Senior'} value={'Senior'}>Senior</SelectItem>
<SelectItem value={' '}>Select one</SelectItem>
<SelectItem value={'Junior'}>Junior</SelectItem>
<SelectItem value={'Senior'}>Senior</SelectItem>
</SelectContent>
</Select>
<FormMessage />
Expand Down
8 changes: 4 additions & 4 deletions data/bankFormValues.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ const DEFAULT_BANK_FORM_VALUES = {
firstName: 'Euan',
middleName: '',
lastName: 'Miller',
suffix: 'Senior',
dob: new Date('1985-02-15'), // Date Of Birthday
streetAddress: 'Wallstreet 10',
suffix: '',
dob: new Date('1987-11-22'), // Date Of Birthday
streetAddress: '123 Sample Street',
suite: '',
zipCode: '01234',
city: 'Sacramento',
Expand All @@ -17,4 +17,4 @@ const DEFAULT_BANK_FORM_VALUES = {
webcamPic: '',
};

export default DEFAULT_BANK_FORM_VALUES
export default DEFAULT_BANK_FORM_VALUES;
16 changes: 8 additions & 8 deletions data/qrcode-text-data.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
const qrCodeVerificationData = {
LOAN: {
title: "Instant approval by authenticating with your mobile banking app and providing the needed credentials including a validated credit score over 700.",
qrText: "Scan the QR code below with your terive mobile banking app.",
title: 'Instant approval by authenticating with your mobile banking app and providing the needed credentials including a validated credit score over 700.',
qrText: 'Scan the QR code below with your Quotient mobile banking app.',
qrTextAfter: null
},
BANK: {
title: null,
qrText: "Scan this QR code with your mobile bank app to log in the app and receive these benefits.",
qrTextAfter: "You will be required to provide a biometric on your mobile device in order to receive these credentials."
qrText: 'Scan this QR code with your mobile bank app to log in the app and receive these benefits.',
qrTextAfter: 'You will be required to provide a biometric on your mobile device in order to receive these credentials.'
},
URBAN_BANKBIO: {
title: null,
qrText: "Automate approval by using your mobile banking app to complete this form with verified information. Approval guaranteed with a credit score over 600.",
qrText: 'Automate approval by using your mobile banking app to complete this form with verified information. Approval guaranteed with a credit score over 600.',
qrTextAfter: null
},
URBAN_CREDITSCORE: {
title: null,
qrText: "Scan QR code with you mobile app to see if you qualify for a waived deposit.",
qrText: 'Scan QR code with your mobile app to see if you qualify for a waived deposit.',
qrTextAfter: null
},

}
};

export default qrCodeVerificationData;
export default qrCodeVerificationData;
2 changes: 1 addition & 1 deletion pages/org/quotient/loan.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const DEFAULT_FORM_VALUES = {
price: '28999',
firstName: '',
lastName: '',
suffix: 'He',
suffix: '',
streetAddress: '',
suite: '15',
zipCode: '',
Expand Down
16 changes: 8 additions & 8 deletions utils/issue-crendentials.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
import { toast } from 'sonner';
import { createRegistry } from './dock-registries';
import { createCredential } from './dock-credentials';
import { waitForJobCompletion } from './dock-jobs';
import { toast } from 'sonner';

export const issueRevokableCredential = async (credential, setRevokableCredential, isRevocable) => {

const credentialPayload = credential;
const _credential = credentialPayload.credential;

let registry = null;
if (isRevocable) {
const type = credentialPayload.algorithm === 'dockbbs+' ? 'DockVBAccumulator2022' : 'StatusList2021Entry';
//CREATING REGISTRY
// CREATING REGISTRY
registry = await createRegistry(_credential.issuer.id, type);
//WAITING FOR REGISTRY JOB CONFIRMATION
// WAITING FOR REGISTRY JOB CONFIRMATION
await waitForJobCompletion(registry.id);
}

//SIGNING CREDENTIAL
// SIGNING CREDENTIAL
const signed = await createCredential(registry?.data?.id, credentialPayload);

if (isRevocable) {
console.log(signed);
setRevokableCredential({
registryId: registry.data.id,
credentialId: signed.id,
credentialId: signed.data.id,
userDid: _credential.subject.id
});
console.log('setting Revokable credential set in localStorage');
}

toast.success(`Issued ${_credential.name} credential`, { duration: 10000 })
return signed;
toast.success(`Issued ${_credential.name} credential`, { duration: 10000 });
return signed.data;
};

0 comments on commit b618910

Please sign in to comment.