28 lines
539 B
TypeScript
28 lines
539 B
TypeScript
|
import Request from '@gm5/request'
|
||
|
import Response from '@gm5/response'
|
||
|
|
||
|
declare module '@gm5/jwt' {
|
||
|
interface JwtConfig {
|
||
|
ttl?: number
|
||
|
level?: number
|
||
|
secret: string
|
||
|
}
|
||
|
|
||
|
interface JwtModule {
|
||
|
name: string
|
||
|
install(conf?: JwtConfig): {
|
||
|
ttl: number
|
||
|
sign(data: object, secret: string): string
|
||
|
verify(token: string, secret: string): object | false
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export const JwtModule: JwtModule
|
||
|
|
||
|
export function createJwt(): (
|
||
|
req: Request,
|
||
|
res: Response,
|
||
|
next: () => void
|
||
|
) => void
|
||
|
}
|