-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathindex.d.ts
45 lines (44 loc) · 1.43 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { IgnoreOrMatch } from 'egg';
import { SignOptions, SignCallback, VerifyOptions, VerifyCallback } from 'jsonwebtoken';
declare module 'egg' {
interface Application {
jwt: {
/**
* call jsonwebtoken's sign() method
* @param payload datas. datas to be signed
* @param secretOrPrivateKey secret key. string or { key, passphrase }
* @param options jwt options。see more details in https://github.com/auth0/node-jsonwebtoken
* @param callback callback
*/
sign(
payload: string | Buffer | object,
secretOrPrivateKey: string,
options?: SignOptions,
callback?: SignCallback
): string;
/**
* call jsonwebtoken's verify() method
* @param token jwt token.
* @param secretOrPrivateKey secret key。string or { key, passphrase }
* @param options jwt options。see more details in https://github.com/auth0/node-jsonwebtoken
* @param callback callback
*/
verify(token: string, secretOrPrivateKey: string, options?: VerifyOptions, callback?: VerifyCallback): string;
/**
* call jsonwebtoken's decode() method
* @param token jwt token
*/
decode(token: string): string;
};
}
interface EggAppConfig {
jwt: {
secret: string;
enable?: boolean;
sign?: SignOptions;
verify?: VerifyOptions;
ignore?: IgnoreOrMatch;
match?: IgnoreOrMatch;
};
}
}