Skip to content

Commit

Permalink
fix: Signature is already included inside a signed JWT, so including …
Browse files Browse the repository at this point in the history
…the challenge as it is is the right thing to do.
  • Loading branch information
elribonazo committed Apr 25, 2024
1 parent e9b9fda commit 3f1b4c3
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/pollux/Pollux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,7 @@ export default class Pollux implements IPollux {
if (!nonce || typeof nonce !== "string") {
throw new InvalidVerifyCredentialError(jws, `Invalid Submission, ${descriptorItem.path} does not contain a nonce in its payload with a valid signature for '${challenge}'`);
}
const signatureHex = nonce as string;
const signatureValid = await this.castor.verifySignature(
DID.fromString(issuer),
Buffer.from(challenge),
Buffer.from(signatureHex, 'hex')
);
if (!signatureValid) {
if (nonce !== challenge) {
throw new InvalidVerifyCredentialError(jws, `Invalid Submission, ${descriptorItem.path} does not contain valid signature for '${challenge}'`);
}
}
Expand Down

0 comments on commit 3f1b4c3

Please sign in to comment.