Documents for @litert/jwt / Algorithms/Eddsa / EddsaJwaVerifier
Class: EddsaJwaVerifier
Defined in: src/lib/Algorithms/Eddsa.ts:183
The EdDSA signature validator implementation for JWT.
This validator class checks if the signature is valid. It neither parses the JWT, nor validates the JWT token claims.
Example
import * as LibJWT from '@litert/jwt';
const validator = new LibJWT.EddsaJwaVerifier({
publicKey: '-----BEGIN PUBLIC KEY-----\n...',
});
const info = LibJWT.parse(token); // Signature is not verified here.
console.log(info.header);
console.log(info.payload);
if (!validator.validate(info)) {
throw new Error('Invalid signature.');
}Implements
Constructors
Constructor
new EddsaJwaVerifier(
opts):EddsaJwaVerifier
Defined in: src/lib/Algorithms/Eddsa.ts:209
Parameters
opts
Returns
EddsaJwaVerifier
Properties
checkAlgClaim
checkAlgClaim:
boolean
Defined in: src/lib/Algorithms/Eddsa.ts:202
Whether to check the alg claim in the JWT header if it is present.
digestType
readonlydigestType:EDigestType
Defined in: src/lib/Algorithms/Eddsa.ts:207
The digest type to use for verification.
family
readonlyfamily:ESigningAlgoFamily=cL.ESigningAlgoFamily.EDDSA
Defined in: src/lib/Algorithms/Eddsa.ts:190
The signing algorithm family.
jwa
readonlyjwa:ESigningJwa=cL.ESigningJwa.EDDSA
Defined in: src/lib/Algorithms/Eddsa.ts:195
The JWA algorithm name.
name
readonlyname:string
Defined in: src/lib/Algorithms/Eddsa.ts:185
The name of the validator.
When using with the JwtVerifier class, this name can be used to identify which validator failed.
Implementation of
Methods
validate()
validate(
data):void
Defined in: src/lib/Algorithms/Eddsa.ts:221
Validate the provided parse result of a JWT, checking if the JWT is valid.
Parameters
data
Returns
void
Throws
If validation failed or an error occurred inside.