1 |
|
2 | import { ModuleMetadata, 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 | 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;
|
15 | verifyOptions?: jwt.VerifyOptions;
|
16 | }
|
17 | export interface JwtOptionsFactory {
|
18 | createJwtOptions(): Promise<JwtModuleOptions> | JwtModuleOptions;
|
19 | }
|
20 | export interface JwtModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
21 | useExisting?: Type<JwtOptionsFactory>;
|
22 | useClass?: Type<JwtOptionsFactory>;
|
23 | useFactory?: (...args: any[]) => Promise<JwtModuleOptions> | JwtModuleOptions;
|
24 | inject?: any[];
|
25 | }
|
26 | export interface JwtSignOptions extends jwt.SignOptions {
|
27 | secret?: string | Buffer;
|
28 | privateKey?: jwt.Secret;
|
29 | }
|
30 | export interface JwtVerifyOptions extends jwt.VerifyOptions {
|
31 | secret?: string | Buffer;
|
32 | publicKey?: string | Buffer;
|
33 | }
|