From 9e2a8efdd36cd9e12e725876d8c7e7f5f2484e12 Mon Sep 17 00:00:00 2001 From: Maycon Date: Fri, 23 Aug 2024 12:47:23 -0300 Subject: [PATCH 1/2] skip signing presentations with kvac credentials --- packages/wasm/src/services/credential/service.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/wasm/src/services/credential/service.ts b/packages/wasm/src/services/credential/service.ts index 345ff423..4c7cdc96 100644 --- a/packages/wasm/src/services/credential/service.ts +++ b/packages/wasm/src/services/credential/service.ts @@ -51,6 +51,10 @@ export function isKvacCredential(credential) { ); } +export function isAnnonyomousCredential(credential) { + return isBBSPlusCredential(credential) || isKvacCredential(credential); +} + class CredentialService { constructor() { this.name = serviceName; @@ -103,19 +107,19 @@ class CredentialService { validation.createPresentation(params); const {credentials, keyDoc, challenge, id, domain} = params; const vp = new VerifiablePresentation(id); - let isBBS; + let shouldSkipSigning = false; for (const signedVC of credentials) { vp.addCredential(signedVC); - isBBS = isBBS || isBBSPlusCredential(signedVC); + shouldSkipSigning = shouldSkipSigning || isAnnonyomousCredential(signedVC); } - if (!isBBS) { + if (!shouldSkipSigning) { vp.setHolder(keyDoc.controller); } keyDoc.keypair = keyDocToKeypair(keyDoc, getDock()); - if (isBBS) { + if (shouldSkipSigning) { return vp.toJSON(); } From 31dfbe0f6458d9d4c008b9411af55d29a523af48 Mon Sep 17 00:00:00 2001 From: Maycon Date: Fri, 23 Aug 2024 12:49:32 -0300 Subject: [PATCH 2/2] fixing typo --- packages/wasm/src/services/credential/service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/wasm/src/services/credential/service.ts b/packages/wasm/src/services/credential/service.ts index 4c7cdc96..cbb4bc2e 100644 --- a/packages/wasm/src/services/credential/service.ts +++ b/packages/wasm/src/services/credential/service.ts @@ -51,7 +51,7 @@ export function isKvacCredential(credential) { ); } -export function isAnnonyomousCredential(credential) { +export function isAnnonymousCredential(credential) { return isBBSPlusCredential(credential) || isKvacCredential(credential); } @@ -110,7 +110,7 @@ class CredentialService { let shouldSkipSigning = false; for (const signedVC of credentials) { vp.addCredential(signedVC); - shouldSkipSigning = shouldSkipSigning || isAnnonyomousCredential(signedVC); + shouldSkipSigning = shouldSkipSigning || isAnnonymousCredential(signedVC); } if (!shouldSkipSigning) {