@zudojs/auth 0.1.0 → 0.1.1
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/README.md +22 -8
- package/dist/.tsbuildinfo +1 -1
- package/dist/authPassword/authPassword.core.d.ts +6 -2
- package/dist/authPassword/authPassword.core.d.ts.map +1 -1
- package/dist/authPassword/authPassword.core.js +69 -18
- package/dist/authPassword/authPassword.core.js.map +1 -1
- package/dist/authProvider/authProvider.core.d.ts +6 -1
- package/dist/authProvider/authProvider.core.d.ts.map +1 -1
- package/dist/authProvider/authProvider.core.js +29 -15
- package/dist/authProvider/authProvider.core.js.map +1 -1
- package/dist/authSession/authSession.core.d.ts.map +1 -1
- package/dist/authSession/authSession.core.js +21 -2
- package/dist/authSession/authSession.core.js.map +1 -1
- package/dist/authToken/authToken.core.d.ts.map +1 -1
- package/dist/authToken/authToken.core.js +4 -3
- package/dist/authToken/authToken.core.js.map +1 -1
- package/dist/authToken/authToken.revocation.d.ts +17 -0
- package/dist/authToken/authToken.revocation.d.ts.map +1 -0
- package/dist/authToken/authToken.revocation.js +36 -0
- package/dist/authToken/authToken.revocation.js.map +1 -0
- package/dist/authToken/authToken.signing.d.ts +2 -1
- package/dist/authToken/authToken.signing.d.ts.map +1 -1
- package/dist/authToken/authToken.signing.js +23 -19
- package/dist/authToken/authToken.signing.js.map +1 -1
- package/dist/authToken/index.d.ts +1 -0
- package/dist/authToken/index.d.ts.map +1 -1
- package/dist/authToken/index.js +1 -0
- package/dist/authToken/index.js.map +1 -1
- package/dist/authTypes/authToken.type.d.ts +19 -0
- package/dist/authTypes/authToken.type.d.ts.map +1 -1
- package/dist/authTypes/index.d.ts +1 -1
- package/dist/authTypes/index.d.ts.map +1 -1
- package/dist/authTypes/index.js.map +1 -1
- package/dist/authUtils/authUtils.helper.js +1 -1
- package/dist/authUtils/authUtils.helper.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,14 +11,28 @@ npm install @zudojs/auth
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
import {
|
|
15
|
+
createTokenPair,
|
|
16
|
+
verifyAccessToken,
|
|
17
|
+
createMemorySessionStore,
|
|
18
|
+
hashPassword,
|
|
19
|
+
verifyPassword,
|
|
20
|
+
type TokenConfig,
|
|
21
|
+
} from "@zudojs/auth";
|
|
22
|
+
|
|
23
|
+
const tokenConfig: TokenConfig = {
|
|
24
|
+
accessSecret: process.env.JWT_ACCESS_SECRET!,
|
|
25
|
+
refreshSecret: process.env.JWT_REFRESH_SECRET!,
|
|
26
|
+
accessTtl: 900, // seconds (15 minutes)
|
|
27
|
+
refreshTtl: 604_800, // seconds (7 days)
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const tokens = createTokenPair(user.id, tokenConfig, { roles: user.roles });
|
|
31
|
+
const result = verifyAccessToken(tokens.accessToken, tokenConfig);
|
|
32
|
+
|
|
33
|
+
const sessionStore = createMemorySessionStore();
|
|
34
|
+
const hash = await hashPassword("plain-text-password");
|
|
35
|
+
const ok = await verifyPassword("plain-text-password", hash);
|
|
22
36
|
```
|
|
23
37
|
|
|
24
38
|
## Features
|