UNPKG

@xeedware/cognito-jwt

Version:

AWS Cognito AccessToken and IdToken classes.

91 lines (90 loc) 2.13 kB
import { IdToken, IdTokenPayload } from './IdToken'; import { VerifyOptions } from 'jsonwebtoken'; export interface CognitoIdTokenPayload extends IdTokenPayload { aud?: string; auth_time?: number; 'cognito:groups'?: string[]; 'cognito:username'?: string; exp?: number; event_id?: string; iss?: string; iat?: number; scope?: string; token_use?: string; } /** @class */ export declare class CognitoIdToken extends IdToken { protected pem?: string; /** * Constructs a new CognitoJwtToken object * @param {string} token The JWT token. * @param {string} [pem] * @param {VerifyOptions} [options] */ constructor(token: string, pem?: string, options?: VerifyOptions); /** * Get the JWT payload * @returns {CognitoIdTokenPayload} */ getCognitoIdTokenPayload(): CognitoIdTokenPayload; /** * Audience * @returns {string} */ get aud(): string; /** * Authorization Time * @returns {number} */ get auth_time(): number; /** * Cognito user pool groups to which authenticated user belongs. * @returns {string[]} */ get cognito_groups(): string[]; /** * Cognito user pool username * @returns {string} */ get cognito_username(): string; /** * Event ID * @returns {string} */ get event_id(): string; /** * Expiration (in number of seconds since the Epoch). * @returns {number} */ get exp(): number; /** * Issuer * @returns {string} */ get iss(): string; /** * Issued At (in number of seconds since the Epoch). * @returns {number} */ get iat(): number; /** * Intended scope. * @returns {string} */ get scope(): string; /** * Intended token use. * * @deprecated since version 1.2.0. * Will be deleted in version 2.0.0. * Use token_use instead. * * @returns {string} */ get tokenUse(): string; /** * Intended token use. * @returns {string} */ get token_use(): string; }