@storyshelf/auth 0.5.3

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 (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +43 -0
  3. package/dist/auth-tables-pg.d.mts +1971 -0
  4. package/dist/auth-tables-pg.mjs +167 -0
  5. package/dist/auth-tables-pg.mjs.map +1 -0
  6. package/dist/auth-tables.d.mts +1092 -0
  7. package/dist/auth-tables.mjs +122 -0
  8. package/dist/auth-tables.mjs.map +1 -0
  9. package/dist/bootstrap.d.mts +15 -0
  10. package/dist/bootstrap.mjs +40 -0
  11. package/dist/bootstrap.mjs.map +1 -0
  12. package/dist/config.d.mts +27 -0
  13. package/dist/config.mjs +204 -0
  14. package/dist/config.mjs.map +1 -0
  15. package/dist/db-bridge.d.mts +20 -0
  16. package/dist/db-bridge.mjs +208 -0
  17. package/dist/db-bridge.mjs.map +1 -0
  18. package/dist/db-values.mjs +41 -0
  19. package/dist/db-values.mjs.map +1 -0
  20. package/dist/db-where.mjs +85 -0
  21. package/dist/db-where.mjs.map +1 -0
  22. package/dist/engine.d.mts +208 -0
  23. package/dist/engine.mjs +444 -0
  24. package/dist/engine.mjs.map +1 -0
  25. package/dist/groups.d.mts +54 -0
  26. package/dist/groups.mjs +129 -0
  27. package/dist/groups.mjs.map +1 -0
  28. package/dist/index.d.mts +18 -0
  29. package/dist/index.mjs +17 -0
  30. package/dist/invites.d.mts +41 -0
  31. package/dist/invites.mjs +225 -0
  32. package/dist/invites.mjs.map +1 -0
  33. package/dist/passkeys.d.mts +21 -0
  34. package/dist/passkeys.mjs +27 -0
  35. package/dist/passkeys.mjs.map +1 -0
  36. package/dist/presets/enterprise.d.mts +24 -0
  37. package/dist/presets/enterprise.mjs +44 -0
  38. package/dist/presets/enterprise.mjs.map +1 -0
  39. package/dist/presets/index.d.mts +5 -0
  40. package/dist/presets/social.d.mts +34 -0
  41. package/dist/presets/social.mjs +60 -0
  42. package/dist/presets/social.mjs.map +1 -0
  43. package/dist/presets/sso.d.mts +72 -0
  44. package/dist/presets/sso.mjs +136 -0
  45. package/dist/presets/sso.mjs.map +1 -0
  46. package/dist/sessions.d.mts +23 -0
  47. package/dist/sessions.mjs +51 -0
  48. package/dist/sessions.mjs.map +1 -0
  49. package/package.json +82 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Siddhant Gupta
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # @storyshelf/auth
2
+
3
+ Better Auth engine for StoryShelf — local accounts, social login, enterprise SSO/SAML, and passkeys. See the [website docs](https://storyshelf.dev) and the [package page](https://github.com/GuptaSiddhant/StoryShelf/tree/main/apps/website/src/content/docs/packages/auth.md) for full guides.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ nub add @storyshelf/auth
9
+ ```
10
+
11
+ Exact pins: `better-auth@1.7.6`, `@better-auth/passkey@1.7.6`, `@better-auth/sso@1.7.6` — see the [Better Auth changelog](https://www.better-auth.com/docs/changelog) and [docs](https://www.better-auth.com/docs).
12
+
13
+ ## Quick start
14
+
15
+ ```ts
16
+ import { createShelfAuth, githubPreset } from "@storyshelf/auth";
17
+
18
+ const shelf = createShelfAuth({
19
+ db: database,
20
+ secret: process.env.SECRET!, // ≥ 32 chars
21
+ baseURL: process.env.PUBLIC_BASE_URL!,
22
+ social: [githubPreset({ clientId: "...", clientSecret: "{env:GITHUB_CLIENT_SECRET}" })],
23
+ passkeys: {},
24
+ });
25
+
26
+ const app = createShelfApp({ database, storage, auth: shelf.adapter });
27
+ // Mounts at /api/auth/* via the Hono integration — https://www.better-auth.com/docs/integrations/hono
28
+ ```
29
+
30
+ - Sessions: Better Auth DB rows under `storyshelf_session` (7-day TTL, `cookieCache` off) — https://www.better-auth.com/docs/concepts/session-management
31
+ - Social/OIDC: https://www.better-auth.com/docs/reference/social-providers, https://www.better-auth.com/docs/plugins/generic-oauth
32
+ - Passkeys: https://www.better-auth.com/docs/plugins/passkey
33
+ - SSO/SAML: https://www.better-auth.com/docs/plugins/sso
34
+
35
+ ## Recipes
36
+
37
+ - `githubPreset`, `gitlabPreset`, `googlePreset`, `entraPreset`, `cognitoPreset`
38
+ - `keycloakPreset`, `oktaPreset`, `auth0Preset`
39
+ - `ssoKeycloakPreset`, `ssoOktaPreset`, `ssoAuth0Preset`, `ssoGooglePreset`, `ssoEntraPreset`, `samlPreset` + `ssoCallbackUrls(baseURL, id)`
40
+ - `issueInvite` / `verifyInvite` / `acceptInvite` (invite-only, re-invite is recovery)
41
+ - `ensurePasswordAdmin`, `resolveAuthOptions` with `{env:NAME}` + `resolveSecrets`
42
+
43
+ See `apps/website/src/content/docs/guides/auth.md` and `apps/website/src/content/docs/concepts/auth.md` for the invite playbook, passkey prerequisites, secrets, and the engine→shelf user mirror.