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