-
I'm encountering an issue when trying to verify a JWT using the jose library that contains custom header parameters, specifically sigT included in the JWT header and declared inside the crit array. Example header snippet: {
"alg": "RS256",
"sigT": "2025-06-18T13:51:51Z",
"crit": ["sigT"],
"x5c": [ "...certificate data..." ]
} When calling jwtVerify() or flattenedVerify() with the corresponding public key, the verification fails with the error: Extension Header Parameter "sigT" is not recognized I have tried to use the critHandlers option to handle this custom header, but the error persists. Expected behavior: The library should allow custom critical headers like sigT to be recognized and accepted when declared in the crit array, and the verification should succeed if the signature and key are valid. Environment:
const { payload, protectedHeader } = await jwtVerify(token, publicKey, {
critHandlers: {
sigT: (value) => {
// custom validation for sigT
}
}
}); Any advice or fixes would be greatly appreciated. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @rober12
There isn't (and never was in the past) such named option in this or previous
You can acknowledge "recognized" crit extensions using the Since these custom crit headers do not change how the signature verification is performed or how the JWT payload is encoded (like e.g. the b64 extension does) you are expected to finish processing such headers after the invocation of jwtVerify/compactVerify succeeds in your own codepath. |
Beta Was this translation helpful? Give feedback.
Hi @rober12
There isn't (and never was in the past) such named option in this or previous
jose
versions.You can acknowledge "recognized" crit extensions using the
crit
verify option. This takes an object where its property names are the recognized crit header parameter names and its values are booleans - true when the Header Parameter MUST be integrity protected, false when it's irrelevant.Since …