jwt/index.d.ts

22 lines
400 B
TypeScript

declare module '@gm5/jwt' {
//
interface JwtConfig {
secret: string
ttl?: number
level?: number
}
interface JwtInstance {
ttl: number
sign(data: object, secret: string): string
verify(token: string, secret: string): object | false
}
interface JwtModule {
name: 'jwt'
install(conf?: JwtConfig): JwtInstance
}
export function createJwt(): JwtModule
}
json web token
JavaScript 100%