@revealui/auth 0.3.4 → 0.3.5
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
CHANGED
|
@@ -90,6 +90,20 @@ pnpm typecheck
|
|
|
90
90
|
pnpm test
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
+
## When to Use This
|
|
94
|
+
|
|
95
|
+
- You need session-based auth with database-backed sessions for a RevealUI app
|
|
96
|
+
- You want built-in brute force protection and rate limiting without external services
|
|
97
|
+
- You need React hooks for client-side session management (`useSession`, `useSignIn`, `useSignOut`)
|
|
98
|
+
- **Not** for OAuth-only flows — use a dedicated OAuth provider and wire tokens through this package
|
|
99
|
+
- **Not** for stateless JWT auth — this package uses database sessions by design
|
|
100
|
+
|
|
101
|
+
## JOSHUA Alignment
|
|
102
|
+
|
|
103
|
+
- **Sovereign**: Sessions live in your PostgreSQL database, not a third-party auth service
|
|
104
|
+
- **Hermetic**: HTTP-only, SameSite cookies and SHA-256 token hashing prevent cross-boundary leaks
|
|
105
|
+
- **Justifiable**: Every security layer (bcrypt, progressive lockout, rate limiting) exists because the threat model demands it
|
|
106
|
+
|
|
93
107
|
## Related
|
|
94
108
|
|
|
95
109
|
- [Core Package](../core/README.md) — CMS engine (uses auth for access control)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password-validation.d.ts","sourceRoot":"","sources":["../../src/server/password-validation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"password-validation.d.ts","sourceRoot":"","sources":["../../src/server/password-validation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,wBAAwB,CA2BnF;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE1E"}
|
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Password strength validation and requirements.
|
|
5
5
|
*/
|
|
6
|
+
/** Check if any character in the string falls within the given char code range (inclusive) */
|
|
7
|
+
function hasCharInRange(str, low, high) {
|
|
8
|
+
for (let i = 0; i < str.length; i++) {
|
|
9
|
+
const code = str.charCodeAt(i);
|
|
10
|
+
if (code >= low && code <= high)
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
6
15
|
/**
|
|
7
16
|
* Validates password strength
|
|
8
17
|
*
|
|
@@ -17,19 +26,15 @@ export function validatePasswordStrength(password) {
|
|
|
17
26
|
if (password.length > 128) {
|
|
18
27
|
errors.push('Password must be less than 128 characters');
|
|
19
28
|
}
|
|
20
|
-
if (
|
|
29
|
+
if (!hasCharInRange(password, 97, 122)) {
|
|
21
30
|
errors.push('Password must contain at least one lowercase letter');
|
|
22
31
|
}
|
|
23
|
-
if (
|
|
32
|
+
if (!hasCharInRange(password, 65, 90)) {
|
|
24
33
|
errors.push('Password must contain at least one uppercase letter');
|
|
25
34
|
}
|
|
26
|
-
if (
|
|
35
|
+
if (!hasCharInRange(password, 48, 57)) {
|
|
27
36
|
errors.push('Password must contain at least one number');
|
|
28
37
|
}
|
|
29
|
-
// Optional: special characters (not too strict)
|
|
30
|
-
// if (!/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(password)) {
|
|
31
|
-
// errors.push('Password must contain at least one special character')
|
|
32
|
-
// }
|
|
33
38
|
return {
|
|
34
39
|
valid: errors.length === 0,
|
|
35
40
|
errors,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revealui/auth",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "Authentication system for RevealUI - database-backed sessions with Better Auth patterns",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auth",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"bcryptjs": "^3.0.3",
|
|
15
15
|
"drizzle-orm": "^0.45.2",
|
|
16
16
|
"zod": "^4.3.6",
|
|
17
|
-
"@revealui/
|
|
18
|
-
"@revealui/
|
|
19
|
-
"@revealui/
|
|
20
|
-
"@revealui/
|
|
17
|
+
"@revealui/config": "0.3.1",
|
|
18
|
+
"@revealui/contracts": "1.3.4",
|
|
19
|
+
"@revealui/core": "0.5.3",
|
|
20
|
+
"@revealui/db": "0.3.4"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@simplewebauthn/browser": "^13.3.0",
|