1 | import { ModuleMetadata, Provider, Type } from '@nestjs/common';
|
2 | import * as jwt from 'jsonwebtoken';
|
3 | export declare enum JwtSecretRequestType {
|
4 | SIGN = 0,
|
5 | VERIFY = 1
|
6 | }
|
7 | export interface JwtModuleOptions {
|
8 | global?: boolean;
|
9 | signOptions?: jwt.SignOptions;
|
10 | secret?: string | Buffer;
|
11 | publicKey?: string | Buffer;
|
12 | privateKey?: jwt.Secret;
|
13 | secretOrPrivateKey?: jwt.Secret;
|
14 | secretOrKeyProvider?: (requestType: JwtSecretRequestType, tokenOrPayload: string | object | Buffer, options?: jwt.VerifyOptions | jwt.SignOptions) => jwt.Secret | Promise<jwt.Secret>;
|
15 | verifyOptions?: jwt.VerifyOptions;
|
16 | }
|
17 | export interface JwtOptionsFactory {
|
18 | createJwtOptions(): Promise<JwtModuleOptions> | JwtModuleOptions;
|
19 | }
|
20 | export interface JwtModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
21 | global?: boolean;
|
22 | useExisting?: Type<JwtOptionsFactory>;
|
23 | useClass?: Type<JwtOptionsFactory>;
|
24 | useFactory?: (...args: any[]) => Promise<JwtModuleOptions> | JwtModuleOptions;
|
25 | inject?: any[];
|
26 | extraProviders?: Provider[];
|
27 | }
|
28 | export interface JwtSignOptions extends jwt.SignOptions {
|
29 | secret?: string | Buffer;
|
30 | privateKey?: jwt.Secret;
|
31 | }
|
32 | export interface JwtVerifyOptions extends jwt.VerifyOptions {
|
33 | secret?: string | Buffer;
|
34 | publicKey?: string | Buffer;
|
35 | }
|
36 | export type GetSecretKeyResult = string | Buffer | jwt.Secret;
|