UNPKG

@xeedware/cognito-jwt

Version:

AWS Cognito AccessToken and IdToken classes.

62 lines (61 loc) 1.48 kB
import { JsonWebToken } from './JsonWebToken'; import { VerifyOptions } from 'jsonwebtoken'; export interface AccessTokenPayload { aud?: string; exp?: number; iat?: number; iss?: string; jti?: string; nbf?: number; sub?: string; } /** @class */ export declare class AccessToken extends JsonWebToken { /** * Constructs a new CognitoJwtToken object * @param token The JWT token. * @param {string} [pem] * @param {VerifyOptions} [options] */ constructor(token: string, pem?: string, options?: VerifyOptions); /** * Get the JWT payload * @returns {AccessTokenPayload} */ getAccessTokenPayload(): AccessTokenPayload; /** * Get the issuer. * @returns {string} */ get iss(): string; /** * Get the subject. * @returns {string} */ get sub(): string; /** * Get the intended audience. * @returns {string} */ get aud(): string; /** * Get the expiration datetime (seconds since the Epoch). * @returns {number} */ get exp(): number; /** * Get the datetime this access token should not be used until (seconds since the Epoch). * @returns {number} */ get nbf(): number; /** * Get the datetime the token was issued (seconds since the Epoch). * @returns {number} */ get iat(): number; /** * Get the JWT ID. * @returns {string} */ get jti(): string; }