@absolutejs/auth 0.80.1 → 0.81.0
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 +14 -0
- package/changelog.json +27 -0
- package/dist/credentials/api.d.ts +214 -0
- package/dist/credentials/emailVerification.d.ts +189 -1
- package/dist/credentials/integration.d.ts +3 -0
- package/dist/credentials/login.d.ts +208 -1
- package/dist/credentials/passwordReset.d.ts +197 -1
- package/dist/credentials/register.d.ts +198 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +64 -32
- package/dist/index.js.map +10 -9
- package/dist/manifest.js +53 -2
- package/dist/manifest.js.map +5 -4
- package/dist/manifest.json +25 -1
- package/dist/server.d.ts +1 -0
- package/dist/server.js +64 -32
- package/dist/server.js.map +10 -9
- package/docs/PERSISTENT-CREDENTIALS.md +29 -1
- package/package.json +4 -3
|
@@ -95,9 +95,37 @@ Important API details:
|
|
|
95
95
|
- Keep `prepare: false` on the migration client only. Application queries need
|
|
96
96
|
Bun's default prepared mode to encode JSON session data correctly.
|
|
97
97
|
- The built-in sign-out route is `DELETE /oauth2/signout`.
|
|
98
|
-
- Use `createAuthContext<Customer>()` from `/server` to read typed authenticated
|
|
98
|
+
- Use `createAuthContext<Customer>({ authSessionStore: sessions })` from `/server` to read typed authenticated
|
|
99
99
|
users. Business APIs must check the session server-side and scope records to
|
|
100
100
|
that user. Do not implement a second password or cookie system.
|
|
101
101
|
- Preserve cookie headers when exposing a narrow typed JSON wrapper around the
|
|
102
102
|
package's configurable credential routes. Never store session tokens in browser
|
|
103
103
|
localStorage. Browser business requests belong in typed Eden + React Query.
|
|
104
|
+
|
|
105
|
+
## Typed credential routes (0.81.0+)
|
|
106
|
+
|
|
107
|
+
Use `createCredentialsApi` from `@absolutejs/auth/server` for fixed, directly
|
|
108
|
+
Eden-typed login, registration, verification and password-reset routes. Supply
|
|
109
|
+
application-owned credentials callbacks, cookie policy and a durable session
|
|
110
|
+
store. Mount this subapp instead of the `credentials` block on `auth`; keep
|
|
111
|
+
`auth` for OAuth/sign-out. No forwarding wrappers are needed.
|
|
112
|
+
|
|
113
|
+
The manifest tool `get_credentials_integration` returns the exact integration
|
|
114
|
+
source and required bindings. `credentialsConfiguration` is your application
|
|
115
|
+
module, not a package export: it supplies `authSessionStore`, `credentialStore`,
|
|
116
|
+
`getUserByEmail`, `onCreateCredentialUser`, and real `onSendEmail` delivery.
|
|
117
|
+
Configure trusted origins, verification and password policy. Never invent these
|
|
118
|
+
bindings, substitute in-memory production storage, or silently disable delivery.
|
|
119
|
+
|
|
120
|
+
Browser code imports only `typeof credentialsApi` and creates
|
|
121
|
+
`treaty<typeof credentialsApi>(origin)`. Call `client.auth.login.post(...)` in a
|
|
122
|
+
React Query `mutationFn`. Inspect errors and preserve `mfa_required` and
|
|
123
|
+
`verification_required` flows: a successful HTTP response does not always mean
|
|
124
|
+
an authenticated session.
|
|
125
|
+
|
|
126
|
+
For protected business routes use `createAuthContext({ authSessionStore })`,
|
|
127
|
+
read `absoluteAuthStatus.user`, return `status(401, { error: 'Sign in required' })`
|
|
128
|
+
when absent, and scope database access to that user. Export the narrow business
|
|
129
|
+
subapp type for its own Eden client inside React Query. A compiler pass is
|
|
130
|
+
necessary, but real signup, login, reset, authorization and persistence tests
|
|
131
|
+
are still required.
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.81.0",
|
|
3
3
|
"name": "@absolutejs/auth",
|
|
4
4
|
"description": "An authorization library for absolutejs",
|
|
5
5
|
"repository": {
|
|
@@ -24,9 +24,10 @@
|
|
|
24
24
|
"lint": "absolute eslint",
|
|
25
25
|
"typecheck": "absolute typecheck",
|
|
26
26
|
"verify-package": "absolute-manifest verify-package",
|
|
27
|
-
"check:package": "bun run typecheck && bun run lint && bun run test && bun run build && bun run verify-package && absolute-changelog check",
|
|
27
|
+
"check:package": "bun run typecheck && bun run typecheck:credentials && bun run lint && bun run test && bun run build && bun run verify-package && absolute-changelog check",
|
|
28
28
|
"release": "bun run format && bun run check:package && npm publish",
|
|
29
|
-
"prepublishOnly": "bun run check:package"
|
|
29
|
+
"prepublishOnly": "bun run check:package",
|
|
30
|
+
"typecheck:credentials": "tsc --project tsconfig.credentials.json"
|
|
30
31
|
},
|
|
31
32
|
"keywords": [
|
|
32
33
|
"authorization",
|