@@ -0,0 +1,3 @@
|
||||
export * from './passport-async-options.interface'
|
||||
export * from './passport-options.interface'
|
||||
export * from './token.interface'
|
||||
@@ -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']
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export interface PassportOptions {
|
||||
secretKey: string
|
||||
}
|
||||
@@ -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