+ Hardware Security Not Available +
++ Your device doesn't support hardware-backed security keys + required for identity verification. Please use a device with + hardware security support or try the pre-verification option. +
+Your verification was a success
You can now continue on to create your eName
Old eVault Found
++ We found an existing eVault associated with your + identity. You can claim it back to continue + using your account. +
+Your verification failed due to the reason
{$reason}
@@ -278,7 +387,9 @@ onMount(() => { color="primary" >{$status === "approved" ? "Continue" - : "Retry"} {/if} diff --git a/infrastructure/evault-provisioner/src/config/database.ts b/infrastructure/evault-provisioner/src/config/database.ts index 2ae7b03c..44b2a807 100644 --- a/infrastructure/evault-provisioner/src/config/database.ts +++ b/infrastructure/evault-provisioner/src/config/database.ts @@ -8,7 +8,7 @@ dotenv.config({ path: join(__dirname, "../../../../.env") }) export const AppDataSource = new DataSource({ type: "postgres", - url: process.env.PROVISIONER_DATABASE_URL || "postgresql://postgres:postgres@localhost:5432/evault", + url: process.env.PROVISIONER_DATABASE_URL || "postgresql://postgres:postgres@localhost:5432/provisioner", logging: process.env.NODE_ENV !== "production", entities: [Verification], migrations: [join(__dirname, "../migrations/*.{ts,js}")], diff --git a/infrastructure/evault-provisioner/src/controllers/VerificationController.ts b/infrastructure/evault-provisioner/src/controllers/VerificationController.ts index 4f59fac7..30b91b66 100644 --- a/infrastructure/evault-provisioner/src/controllers/VerificationController.ts +++ b/infrastructure/evault-provisioner/src/controllers/VerificationController.ts @@ -118,6 +118,7 @@ export class VerificationController { // Create new verification app.post("/verification", async (req: Request, res: Response) => { + console.log("creating new session") const { referenceId } = req.body; if (referenceId) { @@ -193,9 +194,11 @@ export class VerificationController { const body = req.body; console.log(body); const id = body.vendorData; + let w3id: string | null = null const verification = await this.verificationService.findById(id); + console.log("ID", id) if (!verification) { return res .status(404) @@ -227,10 +230,10 @@ export class VerificationController { }); console.log("matched", verificationMatch); if (verificationMatch) { - approved = false; - status = "declined"; + status = "duplicate"; reason = "Document already used to create an eVault"; + w3id = verificationMatch.linkedEName } } console.log(body.data.verification.document); @@ -248,6 +251,7 @@ export class VerificationController { eventEmitter.emit(id, { reason, status, + w3id, person: body.data.verification.person ?? null, document: body.data.verification.document, }); diff --git a/infrastructure/evault-provisioner/src/entities/Verification.ts b/infrastructure/evault-provisioner/src/entities/Verification.ts index 7b258309..a9cfcb88 100644 --- a/infrastructure/evault-provisioner/src/entities/Verification.ts +++ b/infrastructure/evault-provisioner/src/entities/Verification.ts @@ -29,6 +29,9 @@ export class Verification { @Column({ default: false }) consumed!: boolean; + @Column({ nullable: true }) + linkedEName!: string; + @CreateDateColumn() createdAt!: Date; diff --git a/infrastructure/evault-provisioner/src/index.ts b/infrastructure/evault-provisioner/src/index.ts index 5673a9db..80a02c29 100644 --- a/infrastructure/evault-provisioner/src/index.ts +++ b/infrastructure/evault-provisioner/src/index.ts @@ -127,6 +127,7 @@ app.post( "This verification ID has already been used" ); } + await verificationService.findByIdAndUpdate(verificationId, { linkedEName: w3id }); const evaultId = await new W3IDBuilder().withGlobal(true).build(); const uri = await provisionEVault( w3id, diff --git a/infrastructure/evault-provisioner/src/migrations/1758389959600-migration.ts b/infrastructure/evault-provisioner/src/migrations/1758389959600-migration.ts new file mode 100644 index 00000000..2dac460d --- /dev/null +++ b/infrastructure/evault-provisioner/src/migrations/1758389959600-migration.ts @@ -0,0 +1,14 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class Migration1758389959600 implements MigrationInterface { + name = 'Migration1758389959600' + + public async up(queryRunner: QueryRunner): Promise