@kevisual/auth 1.0.5 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts DELETED
@@ -1,55 +0,0 @@
1
- import jwt from 'jsonwebtoken';
2
-
3
- /**
4
- * 生成随机盐
5
- * @returns
6
- */
7
- declare const getRandomSalt: () => string;
8
- /**
9
- * 加密密码
10
- * @param password
11
- * @param salt
12
- * @returns
13
- */
14
- declare const cryptPwd: (password: string, salt?: string) => string;
15
- /**
16
- * Check password
17
- * @param password
18
- * @param salt
19
- * @param md5
20
- * @returns
21
- */
22
- declare const checkPwd: (password: string, salt: string, md5: string) => boolean;
23
-
24
- /**
25
- *
26
- * @param user
27
- * @param secret
28
- *
29
- * @param expiresIn default 7d expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms.js). Eg: 60, "2 days", "10h", "7d"
30
- * @returns
31
- */
32
- declare const createToken: (user: {
33
- id: string;
34
- username: string;
35
- [key: string]: any;
36
- }, secret: string, expiresIn?: string) => Promise<string>;
37
- /**
38
- * check token
39
- * @param token
40
- * @param secret
41
- * @returns
42
- */
43
- declare const checkToken: (token: string, secret: string) => Promise<jwt.Jwt>;
44
-
45
- type CreateAuthRouteOptions = {
46
- secret: string;
47
- app?: any;
48
- addToApp?: boolean;
49
- };
50
- declare const createAuthRoute: ({ secret, app, addToApp }: CreateAuthRouteOptions) => {
51
- route: any;
52
- authRouteFn: (ctx: any) => Promise<void>;
53
- };
54
-
55
- export { checkPwd, checkToken, createAuthRoute, createToken, cryptPwd, getRandomSalt };