@revealui/auth 0.4.3 → 0.4.4

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
@@ -1,3 +1,11 @@
1
+ ---
2
+ title: "@revealui/auth"
3
+ description: "Session-based authentication for RevealUI - database-backed sessions, rate limiting, brute force protection, and password reset."
4
+ visibility: public
5
+ status: verified
6
+ audience: user
7
+ ---
8
+
1
9
  # @revealui/auth
2
10
 
3
11
  Session-based authentication for RevealUI - database-backed sessions, rate limiting, brute force protection, and password reset.
@@ -28,6 +28,19 @@ export declare function createStorage(): Storage;
28
28
  * Reset global storage (for testing)
29
29
  */
30
30
  export declare function resetStorage(): void;
31
+ /**
32
+ * Override the global storage instance (for testing).
33
+ *
34
+ * Lets a test pin a specific backend — e.g. {@link InMemoryStorage} — so the
35
+ * rate-limit/brute-force logic runs against in-process state instead of the
36
+ * shared `DatabaseStorage` singleton. The DB-backed integration suite runs
37
+ * single-threaded with `isolate: false`, so a shared Postgres-backed store
38
+ * under contention can intermittently drop a write (manifesting as e.g. "not
39
+ * locked after 5 attempts"); pinning InMemoryStorage removes that I/O entirely.
40
+ * Pair with {@link resetStorage} in teardown so later code re-derives the real
41
+ * backend.
42
+ */
43
+ export declare function setStorage(storage: Storage): void;
31
44
  export { DatabaseStorage } from './database.js';
32
45
  export { InMemoryStorage } from './in-memory.js';
33
46
  export type { Storage } from './interface.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/storage/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAI9C;;GAEG;AACH,wBAAgB,UAAU,IAAI,OAAO,CA6CpC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAevC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/storage/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAI9C;;GAEG;AACH,wBAAgB,UAAU,IAAI,OAAO,CA6CpC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAevC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAEjD;AAED,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC"}
@@ -89,6 +89,21 @@ export function createStorage() {
89
89
  export function resetStorage() {
90
90
  globalStorage = null;
91
91
  }
92
+ /**
93
+ * Override the global storage instance (for testing).
94
+ *
95
+ * Lets a test pin a specific backend — e.g. {@link InMemoryStorage} — so the
96
+ * rate-limit/brute-force logic runs against in-process state instead of the
97
+ * shared `DatabaseStorage` singleton. The DB-backed integration suite runs
98
+ * single-threaded with `isolate: false`, so a shared Postgres-backed store
99
+ * under contention can intermittently drop a write (manifesting as e.g. "not
100
+ * locked after 5 attempts"); pinning InMemoryStorage removes that I/O entirely.
101
+ * Pair with {@link resetStorage} in teardown so later code re-derives the real
102
+ * backend.
103
+ */
104
+ export function setStorage(storage) {
105
+ globalStorage = storage;
106
+ }
92
107
  export { DatabaseStorage } from './database.js';
93
108
  // Export storage implementations
94
109
  export { InMemoryStorage } from './in-memory.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revealui/auth",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "Database-backed session auth for Hono and Next.js — bcrypt, OAuth, brute-force protection, rate limiting, password reset. Ships with RevealUI.",
5
5
  "keywords": [
6
6
  "auth",
@@ -10,26 +10,26 @@
10
10
  ],
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
- "@simplewebauthn/server": "^13.3.0",
13
+ "@simplewebauthn/server": "^13.3.1",
14
14
  "bcryptjs": "^3.0.3",
15
15
  "drizzle-orm": "^0.45.2",
16
16
  "zod": "^4.4.3",
17
- "@revealui/config": "0.4.1",
18
- "@revealui/contracts": "0.6.0",
19
- "@revealui/core": "0.9.0",
20
- "@revealui/db": "0.7.0",
21
- "@revealui/security": "0.4.0"
17
+ "@revealui/config": "0.4.2",
18
+ "@revealui/contracts": "0.6.1",
19
+ "@revealui/core": "0.10.0",
20
+ "@revealui/db": "0.7.1",
21
+ "@revealui/security": "0.4.1"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@simplewebauthn/browser": "^13.3.0",
25
25
  "@testing-library/react": "^16.3.2",
26
- "@types/node": "^25.6.0",
27
- "@types/react": "^19.2.15",
28
- "@vitest/coverage-v8": "^4.1.5",
29
- "happy-dom": "^20.9.0",
30
- "react": "^19.2.6",
26
+ "@types/node": "^25.9.1",
27
+ "@types/react": "^19.2.17",
28
+ "@vitest/coverage-v8": "^4.1.8",
29
+ "happy-dom": "^20.10.2",
30
+ "react": "^19.2.7",
31
31
  "typescript": "^6.0.3",
32
- "vitest": "^4.1.5",
32
+ "vitest": "^4.1.8",
33
33
  "@revealui/dev": "0.1.0"
34
34
  },
35
35
  "engines": {