@furystack/security 6.0.17 → 6.0.19

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.
Files changed (2) hide show
  1. package/README.md +36 -1
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -1,3 +1,38 @@
1
1
  # @furystack/security
2
2
 
3
- > Password management, authentication, authorization related stuff for FuryStack
3
+ Password management, authentication, and authorization utilities for FuryStack
4
+
5
+ ## Usage Examples
6
+
7
+ ### Setup a password policy
8
+
9
+ ```ts
10
+ import { usePasswordPolicy } from '@furystack/security'
11
+
12
+ usePasswordPolicy(injector, {
13
+ passwordComplexityRules: [createMinLengthComplexityRule(8), createMaxLengthComplexityRule(64)],
14
+ passwordExpirationDays: 90,
15
+ resetTokenExpirationSeconds: 3600,
16
+ })
17
+ ```
18
+
19
+ ### Check if a user's password is valid
20
+
21
+ ```ts
22
+ const authenticator = injector.getInstance(PasswordAuthenticator)
23
+
24
+ const userName = 'john_doe'
25
+ const plainPassword = 'SecureP@ssw0rd!'
26
+
27
+ const checkResult = await authenticator.checkPasswordForUser(userName, plainPassword)
28
+
29
+ if (checkResult.isValid) {
30
+ return 'Hooray! Password is valid.'
31
+ }
32
+ if (checkResult.reason === 'badUsernameOrPassword') {
33
+ return 'Invalid username or password.'
34
+ }
35
+ if (checkResult.reason === 'passwordExpired') {
36
+ return 'Password has expired. Please reset it.'
37
+ }
38
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@furystack/security",
3
- "version": "6.0.17",
3
+ "version": "6.0.19",
4
4
  "description": "Security, password management and authorization related stuff for FuryStack",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -35,14 +35,14 @@
35
35
  "url": "https://github.com/furystack/furystack/issues"
36
36
  },
37
37
  "dependencies": {
38
- "@furystack/core": "^15.0.17",
39
- "@furystack/inject": "^12.0.14"
38
+ "@furystack/core": "^15.0.19",
39
+ "@furystack/inject": "^12.0.16"
40
40
  },
41
41
  "homepage": "https://github.com/furystack/furystack",
42
42
  "devDependencies": {
43
- "@furystack/utils": "^8.0.13",
44
- "@types/node": "^22.14.1",
43
+ "@furystack/utils": "^8.0.15",
44
+ "@types/node": "^22.15.30",
45
45
  "typescript": "^5.8.3",
46
- "vitest": "^3.1.2"
46
+ "vitest": "^3.2.2"
47
47
  }
48
48
  }