Creating cached verified with allowEmbeddedKey does not work
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) {
// ...
});
Could you please provide an example JWS that fails?
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.
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.