Class: JWTVerifier
Defined in: jwt.ts:245
Verifies quantum-safe-py-compatible JWTs.
The algorithm is fixed by the public key: a token whose header names another algorithm is refused. The constructor's issuer and audience apply to every token verified; the per-token options of JWTVerifier.verify are merged over the constructor's options.
Constructors
Constructor
new JWTVerifier(
publicKey,options?):JWTVerifier
Defined in: jwt.ts:259
Creates a verifier for publicKey, using a hybrid verifier when the algorithm name contains +.
Parameters
publicKey
The signer's public key.
options?
JwtVerifierOptions = {}
Required issuer and audience, and whether the tokens were signed hedged (default true).
Returns
JWTVerifier
Throws
if publicKey is not a PublicKey.
Throws
if the key's algorithm is not a supported signature algorithm.
Properties
algorithm
readonlyalgorithm:SignatureAlgorithm
Defined in: jwt.ts:247
The signature algorithm of the public key; tokens must name it in their header.
Methods
verify()
verify(
token,options?):JwtClaims
Defined in: jwt.ts:281
Verifies the signature, then the exp/nbf/iss/aud claims, and returns the claims.
The signature part must be canonical unpadded base64url. exp and nbf are checked with a 30-second tolerance.
Parameters
token
string
The compact token.
options?
JwtVerifyOptions = {}
The signing context (default the bytes of "jwt"), which must equal the one used to sign, and per-token claim checks.
Returns
The payload claims.
Throws
for an invalid signature or failed claim check (no detail, by design).
Throws
if the token is structurally malformed.
Throws
if the header alg differs from the key's algorithm.