Skip to content

Commit

Permalink
remove holder from bbs presentation
Browse files Browse the repository at this point in the history
  • Loading branch information
maycon-mello committed Aug 9, 2023
1 parent 3968fe5 commit 9ac6cc9
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/wasm/src/services/credential/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ import {dockService, getDock} from '../dock/service';

const pex: PEX = new PEX();

export function isBBSPlusCredential(credential) {
return (
(typeof credential?.proof?.type === 'string' &&
credential.proof.type.includes('BBS+SignatureDock')) ||
(Array.isArray(credential['@context']) &&
credential['@context'].find(
context => context['bs'] && context['bs'].indexOf('bbs') > -1,

Check warning on line 20 in packages/wasm/src/services/credential/service.js

View workflow job for this annotation

GitHub Actions / lintAndTest

["bs"] is better written in dot notation

Check warning on line 20 in packages/wasm/src/services/credential/service.js

View workflow job for this annotation

GitHub Actions / lintAndTest

["bs"] is better written in dot notation
))
);
}

class CredentialService {
constructor() {
this.name = serviceName;
Expand Down Expand Up @@ -60,10 +71,16 @@ class CredentialService {
validation.createPresentation(params);
const {credentials, keyDoc, challenge, id, domain} = params;
const vp = new VerifiablePresentation(id);
let isBBS;
for (const signedVC of credentials) {
vp.addCredential(signedVC);
isBBS = isBBS || isBBSPlusCredential(signedVC);
}
vp.setHolder(keyDoc.controller);

if (!isBBS) {
vp.setHolder(keyDoc.controller);
}

keyDoc.keypair = keyDocToKeypair(keyDoc, getDock());
return vp.sign(keyDoc, challenge, domain, dockService.resolver);
}
Expand Down

0 comments on commit 9ac6cc9

Please sign in to comment.