Skip to content

Commit

Permalink
chore: useMultipleVPs select by sub
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Nov 3, 2024
1 parent c8f2689 commit 7b38b18
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/PEX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,29 +402,27 @@ export class PEX {

if (jwtCredentials.length > 0) {
const subjects = new Set<string>();
// const verificationMethods = new Set<string>();
// const verificationMethods = new Set<string>();

for (const credential of jwtCredentials) {
const decodedCredential = CredentialMapper.isJwtEncoded(credential)
? (CredentialMapper.decodeVerifiableCredential(credential) as JwtDecodedVerifiableCredential)
: (credential as JwtDecodedVerifiableCredential);

const subject =
decodedCredential.sub ||
(decodedCredential.vc && decodedCredential.sub);
const subject = decodedCredential.sub || (decodedCredential.vc && decodedCredential.sub);
if (subject) {
subjects.add(subject);
}

/*
/*
const vcProof = decodedCredential.proof ?? decodedCredential.vc.proof;
const proofs = Array.isArray(vcProof) ? vcProof : [vcProof];
proofs.filter((proof: IProof) => proof.verificationMethod).forEach((proof: IProof) => verificationMethods.add(proof.verificationMethod));
*/
}

// If there's more than one unique subject or verification method, we can't allow multiple VCs in a single presentation
if (subjects.size > 1 ) {
if (subjects.size > 1) {
return false;
}
}
Expand Down

0 comments on commit 7b38b18

Please sign in to comment.