@everystack/auth 0.4.4 → 0.4.6
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/CHANGELOG.md +128 -0
- package/package.json +6 -5
- package/src/api.ts +17 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@everystack/auth` are documented here.
|
|
4
|
+
|
|
5
|
+
Format based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
|
+
|
|
7
|
+
## [0.4.5] - 2026-09-16
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- auto-generated changelogs from conventional commits
|
|
12
|
+
- automate the version-drift check — a manual note is not a gate
|
|
13
|
+
|
|
14
|
+
## [0.4.4] - 2026-08-15
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- compile owner-scoped `manage` to write policies + add `internal` flag for functions
|
|
19
|
+
|
|
20
|
+
## [0.4.3] - 2026-08-12
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- link workspace siblings instead of resolving them from the registry
|
|
25
|
+
- the softDelete guard asked about visibility, not about DELETE
|
|
26
|
+
- close the gate findings — the rule was still one grant short
|
|
27
|
+
|
|
28
|
+
## [0.4.2] - 2026-08-04
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- declare the SECURITY DEFINER functions, so db:reconcile can see them
|
|
33
|
+
- writtenBy: 'functions' must have functions, checked at composition
|
|
34
|
+
|
|
35
|
+
## [0.4.1] - 2026-08-04
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- pin React to a single 19.2.0 across the monorepo
|
|
40
|
+
- guard npm publish on workspace-dep packages; cli 0.3.8
|
|
41
|
+
- republish @everystack/auth as 0.4.0, aligned to model 0.4.x
|
|
42
|
+
- revoke PUBLIC EXECUTE on the seven functions that shipped open
|
|
43
|
+
|
|
44
|
+
## [0.3.1] - 2026-06-30
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
|
|
48
|
+
- token-gated wrapper functions confirm_email + reset_password
|
|
49
|
+
- anon-safe session wrappers sign_in_session + sign_up_session
|
|
50
|
+
- least-priv signin + signup via anon session wrappers
|
|
51
|
+
- least-priv refresh — rotate as anon, read identity via RLS
|
|
52
|
+
- create profile as an invoker insert under RLS, atomically
|
|
53
|
+
- wire least-priv auth — session wrappers, grants, RLS
|
|
54
|
+
- least-priv confirmEmail + resetPassword via token-gated wrappers
|
|
55
|
+
- least-priv changePassword via auth.change_password wrapper
|
|
56
|
+
- forgot-password + signup-confirmation mint on the worker
|
|
57
|
+
- own the seven auth tables as v3 Models
|
|
58
|
+
- export package Modules
|
|
59
|
+
|
|
60
|
+
### Fixed
|
|
61
|
+
|
|
62
|
+
- pin search_path on the core SECURITY DEFINER functions
|
|
63
|
+
- extensionless relative imports (repo convention; Metro resolution)
|
|
64
|
+
- generateAuthGrantsSQL — the generated migration grants its own roles
|
|
65
|
+
|
|
66
|
+
## [0.2.5] - 2026-06-18
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- fail closed on cookie auth without allowedOrigins
|
|
71
|
+
|
|
72
|
+
## [0.2.4] - 2026-06-17
|
|
73
|
+
|
|
74
|
+
### Added
|
|
75
|
+
|
|
76
|
+
- IAM auth for web deploys, replace Sharp layer with SST bundling
|
|
77
|
+
- add DB-backed refresh token rotation
|
|
78
|
+
- add OAuth sign-in with pluggable providers
|
|
79
|
+
- wire RBAC end-to-end from database to admin guard
|
|
80
|
+
- add mode: postgres — pgcrypto auth via postgres.js
|
|
81
|
+
- runtime-agnostic HS256 JWT with conformance vectors
|
|
82
|
+
- SQL twin (pgcrypto) — jwt_sign / jwt_sign_raw / jwt_verify
|
|
83
|
+
- drop jose, native RS256+JWKS OIDC verifier
|
|
84
|
+
- cff generator — verify HS256 JWTs at the edge
|
|
85
|
+
- bcrypt cost 12 password hashing (OWASP-aligned)
|
|
86
|
+
- cookie-based SSR authentication
|
|
87
|
+
- compact CFF verifier + dead code stripping for 10KB budget
|
|
88
|
+
- add plugin architecture for composable Lambda handlers
|
|
89
|
+
- add auth plugin with layered security and client credentials
|
|
90
|
+
- replace publicPaths with requireAuth pattern
|
|
91
|
+
- add @everystack/auth/testing — JWT helpers, role tokens, and test user seeding
|
|
92
|
+
- add CSRF Origin validation, remove sessions alias
|
|
93
|
+
- default Supabase-compatible schema, example app migration, docs
|
|
94
|
+
- add email confirmation, password recovery, and change-password flows
|
|
95
|
+
- product-analytics producer — track() + /track route + auth emitters
|
|
96
|
+
- consolidate drizzle migrations + logging schema updates
|
|
97
|
+
|
|
98
|
+
### Fixed
|
|
99
|
+
|
|
100
|
+
- transactional signup, shared handler factory, drop dead routes
|
|
101
|
+
- normalize bcrypt prefix and strip MIME newlines in SQL functions
|
|
102
|
+
- configurable bcrypt cost, default 10 (OWASP minimum)
|
|
103
|
+
- require crypto module in CFF verifiers, strip routeSite
|
|
104
|
+
- update CFF verifier tests for crypto require
|
|
105
|
+
- resolve 7 high-priority security findings from red team audit
|
|
106
|
+
- resolve 7 medium-priority security findings from red team audit
|
|
107
|
+
- resolve 9 low/medium-priority security findings from red team audit
|
|
108
|
+
- resolve auth test failures and logging build error
|
|
109
|
+
- pin all dependency versions to lockfile-resolved values
|
|
110
|
+
- accept JWT tokens without typ header (RFC 7519 §5.1)
|
|
111
|
+
- worker function discovery and log group resolution for SQS subscribers
|
|
112
|
+
- stamp the app audience on first-party tokens
|
|
113
|
+
- skip edge auth for non-API paths when tableFromPath is enabled
|
|
114
|
+
|
|
115
|
+
### Changed
|
|
116
|
+
|
|
117
|
+
- extract server infra into @expo-stack/server + @expo-stack/auth packages
|
|
118
|
+
- migrate all package schemas to everyschema canonical tables
|
|
119
|
+
- drop type module from all packages, switch Jest to CJS mode
|
|
120
|
+
- consolidate Jest configs into shared base
|
|
121
|
+
- replace sessions STI with dedicated refresh_tokens table
|
|
122
|
+
|
|
123
|
+
### Documentation
|
|
124
|
+
|
|
125
|
+
- rewrite documentation around V1→V2→V3 progressive complexity model
|
|
126
|
+
- update all documentation to reflect full API surface
|
|
127
|
+
- document zero-dep envelope, edge verification, SQL twin
|
|
128
|
+
- prepare documentation for open-source release
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everystack/auth",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "JWT authentication handlers, password hashing, and React auth context",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"author": "Scalable Technology, Inc. <licensing@scalable.technology>",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"src",
|
|
21
|
-
"README.md"
|
|
21
|
+
"README.md",
|
|
22
|
+
"CHANGELOG.md"
|
|
22
23
|
],
|
|
23
24
|
"exports": {
|
|
24
25
|
".": {
|
|
@@ -107,7 +108,7 @@
|
|
|
107
108
|
},
|
|
108
109
|
"dependencies": {
|
|
109
110
|
"bcryptjs": "3.0.3",
|
|
110
|
-
"@everystack/model": "0.4.
|
|
111
|
+
"@everystack/model": "0.4.19"
|
|
111
112
|
},
|
|
112
113
|
"peerDependencies": {
|
|
113
114
|
"@everystack/api": ">=0.1.0",
|
|
@@ -136,8 +137,8 @@
|
|
|
136
137
|
"postgres": "3.4.9",
|
|
137
138
|
"ts-jest": "29.4.9",
|
|
138
139
|
"typescript": "5.9.3",
|
|
139
|
-
"@everystack/
|
|
140
|
-
"@everystack/
|
|
140
|
+
"@everystack/server": "0.4.32",
|
|
141
|
+
"@everystack/api": "0.4.2"
|
|
141
142
|
},
|
|
142
143
|
"scripts": {
|
|
143
144
|
"test": "jest",
|
package/src/api.ts
CHANGED
|
@@ -34,17 +34,32 @@ export async function refreshAuthToken(): Promise<string | null> {
|
|
|
34
34
|
headers: { 'Content-Type': 'application/json' },
|
|
35
35
|
body: JSON.stringify({ refreshToken }),
|
|
36
36
|
});
|
|
37
|
-
if (!res.ok)
|
|
37
|
+
if (!res.ok) {
|
|
38
|
+
// Server rejected the refresh token (expired/revoked/reused) — the session is over.
|
|
39
|
+
clearStoredTokens();
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
38
42
|
const body = await res.json();
|
|
39
43
|
localStorage.setItem(TOKEN_KEY, body.token);
|
|
40
44
|
localStorage.setItem(REFRESH_KEY, body.refreshToken);
|
|
41
45
|
return body.token;
|
|
42
|
-
} catch {
|
|
46
|
+
} catch {
|
|
47
|
+
// Network-level failure (e.g. offline) — the refresh token may still be
|
|
48
|
+
// valid, so don't wipe the session; just fail this attempt.
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
43
51
|
})().finally(() => { activeRefresh = null; });
|
|
44
52
|
|
|
45
53
|
return activeRefresh;
|
|
46
54
|
}
|
|
47
55
|
|
|
56
|
+
function clearStoredTokens(): void {
|
|
57
|
+
try {
|
|
58
|
+
localStorage.removeItem(TOKEN_KEY);
|
|
59
|
+
localStorage.removeItem(REFRESH_KEY);
|
|
60
|
+
} catch {}
|
|
61
|
+
}
|
|
62
|
+
|
|
48
63
|
export const api = createClient({
|
|
49
64
|
baseUrl: '/api',
|
|
50
65
|
getToken: () => {
|