This commit is contained in:
3
lib/interfaces/index.ts
Normal file
3
lib/interfaces/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './passport-async-options.interface'
|
||||
export * from './passport-options.interface'
|
||||
export * from './token.interface'
|
||||
8
lib/interfaces/passport-async-options.interface.ts
Normal file
8
lib/interfaces/passport-async-options.interface.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { FactoryProvider, ModuleMetadata } from '@nestjs/common'
|
||||
|
||||
import { PassportOptions } from './passport-options.interface'
|
||||
|
||||
export interface PassportAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
||||
useFactory: (...args: any[]) => Promise<PassportOptions> | PassportOptions
|
||||
inject?: FactoryProvider['inject']
|
||||
}
|
||||
3
lib/interfaces/passport-options.interface.ts
Normal file
3
lib/interfaces/passport-options.interface.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export interface PassportOptions {
|
||||
secretKey: string
|
||||
}
|
||||
13
lib/interfaces/token.interface.ts
Normal file
13
lib/interfaces/token.interface.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export interface TokenPayload {
|
||||
sub: string
|
||||
}
|
||||
|
||||
// роли храним в токене
|
||||
export interface TokenRolePayload {
|
||||
id: string | number
|
||||
name: string
|
||||
}
|
||||
|
||||
export type VerifyResult =
|
||||
| { valid: true; userId: string; jti: string; role: TokenRolePayload }
|
||||
| { valid: false; reason: string }
|
||||
Reference in New Issue
Block a user