Skip to content

Commit

Permalink
Added catch for jwt.verify and jwkForSignature errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Ault committed Nov 12, 2019
1 parent 0902d48 commit 7dba945
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ module.exports = function(sig, options, callback) {
}).then(({ decoded, trusted, jwk }) => {
if (!decoded) return [ false, false ];
return [ trusted, jwt.verify(sig, jwk2pem(jwk)) ];

// And signal the callback with any thrown errors, or (trusted, clientRegistration) if no errors
}).catch(err => {
info('jwku.jwkForSignatureAsync or jwt.verify threw an error, it was: ', err);
return [false, false];
// And signal the callback with any thrown errors, or (trusted, clientRegistration) if no errors
}).nodeify(callback, { spread: true });

};
Expand Down

0 comments on commit 7dba945

Please sign in to comment.