first commit
Some checks failed
Publish / Publish Job (push) Failing after 37s

This commit is contained in:
Дмитрий
2026-03-27 10:38:23 +03:00
commit be1e21e699
21 changed files with 1002 additions and 0 deletions

3
lib/interfaces/index.ts Normal file
View File

@@ -0,0 +1,3 @@
export * from './passport-async-options.interface'
export * from './passport-options.interface'
export * from './token.interface'

View 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']
}

View File

@@ -0,0 +1,3 @@
export interface PassportOptions {
secretKey: string
}

View 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 }