Skip to content

verifyCompactJws ​

verifyCompactJws ​

Verifies a compact JWS.

The caller's algorithms list decides what is accepted; the token's alg only selects among them, and none is always refused as unsigned_token. The tokenType policy is applied before any key is resolved. The key must match the admitted algorithm's RSA hash (at least 2048 bits) or ECDSA curve. ECDSA signatures must be fixed-width raw R || S, with no DER retry. Header members such as jku, jwk, x5u and x5c are never used to find a key. A resolver that throws or returns something other than a result is reported as key_resolution_failed without its message.

Returns a VerifiedJws on success. Failures carry a stable code and never echo the token.

ts
function verifyCompactJws(
	token: string,
	options: VerifyJwsOptions,
): Promise<JoseResult<VerifiedJws, VerifyJwsErrorCode>>

Parameters

Released under the MIT License.