node-jose icon indicating copy to clipboard operation
node-jose copied to clipboard

Creating cached verified with allowEmbeddedKey does not work

Open henhal opened this issue 5 years ago • 3 comments

Using node-jose 1.1.3.

According to the documentation, it should be possible to pass the {allowEmbeddedKey: true} option to the verifier constructor rather than in each verify() call:

Alternatively, a cached createVerify() can be configured to allow an embedded key:

var verifier = jose.JWS.createVerify({ allowEmbeddedKey: true });

verifier.verify(input).
         then(function(result) {
           // ...
         });

However, when I try this I simply get Error: no key found. Moving the option to the verify() call works fine:

var verifier = jose.JWS.createVerify();
verifier.verify(input, { allowEmbeddedKey: true }).
         then(function(result) {
           // ...
         });

henhal avatar Mar 04 '20 08:03 henhal

Could you please provide an example JWS that fails?

phish108 avatar Mar 04 '20 10:03 phish108

I have this exact case too - can't really post the JWS here. But it occurs when trying to validate a JWS from Apple app store.

ikb42 avatar Dec 01 '21 09:12 ikb42

Try this:

const verifier = jose.JWS.createVerify(null, { allowEmbeddedKey: true });

verifier.verify(input);

After reading the source code, the option must be injected as the 2nd param.

aaccenture avatar Jul 21 '23 07:07 aaccenture