packages start...
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
## jwt
|
||||
|
||||
```ts
|
||||
interface JwtPackage {
|
||||
/**
|
||||
* create a jwt signed token string
|
||||
*
|
||||
* @param claims data object
|
||||
* @param options options (secret, validityDuration = expiry in X seconds)
|
||||
*/
|
||||
create(
|
||||
claims: {
|
||||
[key: string]: any
|
||||
},
|
||||
options?: {
|
||||
secret?: string
|
||||
validityDuration?: number
|
||||
}
|
||||
): string
|
||||
|
||||
/**
|
||||
* parse jwt token string
|
||||
*
|
||||
* @param token token string
|
||||
* @param options options (secret)
|
||||
*/
|
||||
parse(
|
||||
token: string,
|
||||
options?: {
|
||||
secret?: string
|
||||
}
|
||||
): {
|
||||
error?: string
|
||||
valid: boolean
|
||||
method: {
|
||||
Name: string
|
||||
Hash: number
|
||||
}
|
||||
header: {
|
||||
alg: string
|
||||
typ: string
|
||||
}
|
||||
claims: {
|
||||
exp?: number
|
||||
[key: string]: any
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user