import { IPrivateKey, IAccessTokenSigner } from '../types'; import { IExtraData } from '../Cards/ICard'; import { Jwt } from './Jwt'; /** * {@link JwtGenerator} initialization options. */ export interface IJwtGeneratorOptions { /** * API Private key from Virgil Dashboard to be used to generate * signatures of tokens. */ apiKey: IPrivateKey; /** * ID of the API Key from Virgil Dashboard. */ apiKeyId: string; /** * Application ID from Virgil Dashboard. This will be the value of the * `Issuer` field in generated tokens. */ appId: string; /** * Object used to generate signatures of tokens. */ accessTokenSigner: IAccessTokenSigner; /** * Time to live in milliseconds of the tokens created by this generator. * Optional. Default is `20 * 60 * 1000` (20 minutes). */ millisecondsToLive?: number; } /** * Class responsible for JWT generation. */ export declare class JwtGenerator { /** * @see {@link IJwtGeneratorOptions.appId} */ readonly appId: string; /** * @see {@link IJwtGeneratorOptions.apiKey} */ readonly apiKey: IPrivateKey; /** * @see {@link IJwtGeneratorOptions.apiKeyId} */ readonly apiKeyId: string; /** * @see {@link IJwtGeneratorOptions.accessTokenSigner} */ readonly accessTokenSigner: IAccessTokenSigner; /** * @see {@link IJwtGeneratorOptions.millisecondsToLive} */ readonly millisecondsToLive: number; constructor(options: IJwtGeneratorOptions); /** * Generates a token with the given identity as the subject and optional * additional data. * @param {string} identity - Identity to be associated with JWT (i.e. * the Subject). * @param {IExtraData} ada - Additional data to be encoded in the JWT. * @returns {Jwt} */ generateToken(identity: string, ada?: IExtraData): Jwt; }