@kevisual/auth 1.0.5-alpha.1 → 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/bun.config.ts +20 -0
- package/package.json +18 -50
- package/readme.md +45 -18
- package/src/auth.ts +123 -0
- package/src/generate.ts +39 -0
- package/src/index.ts +1 -6
- package/src/jwks/common.ts +8 -0
- package/src/jwks/create.ts +23 -0
- package/src/jwks/get.ts +22 -0
- package/src/router.ts +2 -0
- package/test/create.ts +38 -0
- package/dist/create-token.d.ts +0 -18
- package/dist/create-token.js +0 -6339
- package/dist/index.d.ts +0 -49
- package/dist/index.js +0 -7506
- package/dist/proxy.d.ts +0 -41
- package/dist/proxy.js +0 -98
- package/dist/salt.d.ts +0 -22
- package/dist/salt.js +0 -1130
- package/src/create-token.ts +0 -29
- package/src/proxy.ts +0 -115
- package/src/route.ts +0 -44
- package/src/salt.ts +0 -32
package/dist/index.d.ts
DELETED
|
@@ -1,49 +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
|
-
declare const checkToken: (token: string, secret: string) => Promise<jwt.Jwt>;
|
|
38
|
-
|
|
39
|
-
type CreateAuthRouteOptions = {
|
|
40
|
-
secret: string;
|
|
41
|
-
app?: any;
|
|
42
|
-
addToApp?: boolean;
|
|
43
|
-
};
|
|
44
|
-
declare const createAuthRoute: ({ secret, app, addToApp }: CreateAuthRouteOptions) => {
|
|
45
|
-
route: any;
|
|
46
|
-
authRouteFn: (ctx: any) => Promise<void>;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export { checkPwd, checkToken, createAuthRoute, createToken, cryptPwd, getRandomSalt };
|