@unvision/jose
Version:
Implementation of the RFCs of the JOSE Working Group.
83 lines (82 loc) • 2.75 kB
TypeScript
/// <reference types="node" />
import { JsonWebTokenClaimValidationOptions } from './jsonwebtoken-claim-validation.options';
import { JsonWebTokenClaimsParameters } from './jsonwebtoken.claims.parameters';
/**
* Implementation of the JSON Web Token Claims Object.
*
* @see https://www.rfc-editor.org/rfc/rfc7519.html#section-4
*/
export declare class JsonWebTokenClaims implements JsonWebTokenClaimsParameters {
/**
* Identifier of the Issuer of the Token.
*/
readonly iss?: string;
/**
* Subject represented by the Token.
*/
readonly sub?: string;
/**
* Identifier of the Audience the Token is intended to.
*/
readonly aud?: string | string[];
/**
* UTC time denoting the Expiration Time of the Token.
*/
readonly exp?: number;
/**
* UTC time denoting the moment when the Token will become valid.
*/
readonly nbf?: number;
/**
* UTC time denoting the moment when the Token was created.
*/
readonly iat?: number;
/**
* Identifier of the Token.
*/
readonly jti?: string;
/**
* Additional Claims.
*/
readonly [claim: string]: any;
/**
* Instantiates a new JSON Web Token Claims for usage with JSON Web Tokens.
*
* @param claims Defines the Claims of the JSON Web Token.
* @param options Validation options for the JSON Web Token Claims.
*/
constructor(claims: JsonWebTokenClaimsParameters, options?: Record<string, JsonWebTokenClaimValidationOptions>);
/**
* Validates the Default JSON Web Token Claims based on the rules of
* {@link https://www.rfc-editor.org/rfc/rfc7519.html#section-4 RFC 7519 Section 4}.
*
* @param claims JSON Web Token Claims.
*/
private validateDefaultClaims;
/**
* Method used when extending **JsonWebTokenClaims** via inheritance.
*
* This method **SHOULD** be implemented by the child class in order to provide validation for custom
* JSON Web Token Claims supported by it.
*
* *Implementation of this method is optional.*
*
* @param claims JSON Web Token Claims.
*/
protected validateCustomClaims?(claims: JsonWebTokenClaimsParameters): void;
/**
* Validates the provided JSON Web Token Claims based on the provided Options.
*
* @param claims JSON Web Token Claims.
* @param options Dictionary used to validate the provided JSON Web Token Claims.
*/
private validateClaimsOptions;
/**
* Returns the Stringified JSON representation of the JSON Web Token Claims.
*/
toString(): string;
/**
* Returns the Buffer version of the Stringified JSON Web Token Claims.
*/
toBuffer(): Buffer;
}