@ne1410s/xprest
Version:
RESTful express core library
21 lines (20 loc) • 715 B
TypeScript
import { JwtToken } from './jwt-token';
/** A host for issuing json web tokens. */
export declare class JwtIssuer {
private issuer;
private secret;
private minutes;
/** Initialises a new instance. */
constructor(issuer: string, secret: string, minutes?: number);
/** Issues a token containing the supplied payload. */
issue<T extends JwtToken>(payload: T): string;
/** Parses the contents of a (valid) token. */
parseValid<T extends JwtToken>(token: string): T;
/** Parses the contents of a token. */
private parseRaw;
/** Prepares payload according to current time and instance config. */
private preparePayload;
}
export interface IToken {
token: string;
}