virgil-sdk
Version:
Virgil Security Services SDK
46 lines (45 loc) • 1.24 kB
TypeScript
import { IPublicKey, IAccessTokenSigner } from '../types';
import { Jwt } from './Jwt';
/**
* {@link JwtVerifier} initialization options.
*/
export interface IJwtVerifierOptions {
/**
* Object used to verify signatures of tokens.
*/
accessTokenSigner: IAccessTokenSigner;
/**
* API Public Key from Virgil Dashboard to be used to verify signatures
* of tokens.
*/
apiPublicKey: IPublicKey;
/**
* ID of the API Key from Virgil Dashboard.
*/
apiKeyId: string;
}
/**
* Class responsible for verification of JWTs.
*/
export declare class JwtVerifier {
/**
* @see {@link IJwtVerifierOptions.accessTokenSigner}
*/
readonly accessTokenSigner: IAccessTokenSigner;
/**
* @see {@link IJwtVerifierOptions.apiPublicKey}
*/
readonly apiPublicKey: IPublicKey;
/**
* @see {@link IJwtVerifierOptions.apiKeyId}
*/
readonly apiKeyId: string;
constructor(options: IJwtVerifierOptions);
/**
* Verifies the validity of the given JWT.
* @param {Jwt} token - The JWT to verify.
* @returns {boolean}
*/
verifyToken(token: Jwt): boolean;
private allFieldsAreCorrect;
}