@withjoy/sdk-js
Version:
Joy Javascript SDK
37 lines (36 loc) • 966 B
TypeScript
/**
* A class to manage and deal with JWT Tokens
* @param token - a String containing the signed jwt token
* @constructor
*/
export declare class JWT {
private _token;
constructor(token: string);
/**
* Generate a valid jwt token, generally for testing
*/
static fromPayloadOptionsAndSecret(payload: any, options: any, secret: any): JWT;
/**
* Get the internal token
* @returns {.qs.id_token|*|id_token}
*/
token(): string;
/**
* Decode the jwt contents
* @returns {object}
*/
decode(): any;
/***
* Verify this signed token
* @param secret - Buffer containing the secret
* @param options - {issuer or audiance}
* @param callback (err, dataObj)
* @returns {*}
*/
verify(secret: any, options: any, callback?: any): any;
/**
* Gets the seconds remaining on this token before it expires
* @returns {number}
*/
timeLeft(): number;
}