2025-01-02 12:13:27 +08:00
|
|
|
declare module '@gm5/jwt' {
|
2025-01-06 10:52:59 +08:00
|
|
|
//
|
2025-01-02 12:13:27 +08:00
|
|
|
interface JwtConfig {
|
2025-01-06 10:52:59 +08:00
|
|
|
secret: string
|
2025-01-02 12:13:27 +08:00
|
|
|
ttl?: number
|
|
|
|
level?: number
|
|
|
|
}
|
|
|
|
|
2025-01-06 10:52:59 +08:00
|
|
|
interface JwtInstance {
|
|
|
|
ttl: number
|
|
|
|
sign(data: object, secret: string): string
|
|
|
|
verify(token: string, secret: string): object | false
|
2025-01-02 12:13:27 +08:00
|
|
|
}
|
|
|
|
|
2025-01-06 10:52:59 +08:00
|
|
|
interface JwtModule {
|
|
|
|
name: 'jwt'
|
|
|
|
install(conf?: JwtConfig): JwtInstance
|
|
|
|
}
|
2025-01-02 12:13:27 +08:00
|
|
|
|
2025-01-06 10:52:59 +08:00
|
|
|
export function createJwt(): JwtModule
|
2025-01-02 12:13:27 +08:00
|
|
|
}
|