@bitakit/better-auth 0.2.2 → 0.2.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/AGENTS.md ADDED
@@ -0,0 +1,43 @@
1
+ # @bitakit/better-auth — guide for agents
2
+
3
+ > For agents building an app with this package (it ships in `node_modules/@bitakit/better-auth`).
4
+ > To change the package itself, follow the repository's own AGENTS.md instead.
5
+
6
+ Connects an existing Better Auth client to BitaKit: it provides the shared `auth` service
7
+ (session snapshot, changes, sign-out) that every plugin reads. It has no UI (that is
8
+ `@bitakit/better-auth-ui`) and is no server permission check.
9
+
10
+ ## Setup an app has
11
+
12
+ - The client arrives through the `betterAuthClient` contract, provided once by the app:
13
+
14
+ ```ts
15
+ // src/services/better-auth-client.ts
16
+ import { defineService } from '@bitakit/core';
17
+ import { betterAuthClient } from '@bitakit/better-auth';
18
+ import { authClient } from '../lib/auth-client';
19
+
20
+ export default defineService(() => ({ client: authClient }), { provides: betterAuthClient });
21
+ ```
22
+
23
+ Keep the `{ client }` wrapper; without the service, startup fails with a named error.
24
+
25
+ - Options in `src/configs/better-auth.ts`: `paths` (`signIn`, `afterSignIn`, `afterSignOut`),
26
+ optional `signIn`/`signOut` overrides.
27
+ - `createBetterAuthClient` (`./client`) creates the standard browser client with organization,
28
+ multi-session, API key and two-factor client extensions; the server must enable the same.
29
+
30
+ ## Use it
31
+
32
+ - Read the session with `useAuth()` from `@bitakit/ui` or `getService(services, authService)`;
33
+ check `app.has('auth')` when it is optional.
34
+ - Organizations: `betterAuthOrganizations(client)` (`./organizations`) is the backend for
35
+ `@bitakit/organizations`, provided as `organizationBackend`.
36
+ - E-mail: `betterAuthEmail(emailService, { invitationURL })` (`./email`) gives the server
37
+ callbacks for verification, reset and invitation mail on the `@bitakit/email` contract.
38
+
39
+ ## Rules
40
+
41
+ - Authorization happens on the server (Better Auth access control and the app's routes); the
42
+ client session and an active organization ID prove nothing.
43
+ - Do not build a second session store or login flow; keep Better Auth's native APIs.
package/README.md CHANGED
@@ -42,7 +42,7 @@ Manual composition passes the same options and provides the client through
42
42
  `createRuntime(config, { services: { [betterAuthClient]: { client: authClient } } })`, the
43
43
  `BitaKitRuntimeProvider` `services` prop or any plugin service with `provides: betterAuthClient`.
44
44
 
45
- See the [client authentication guide](../../apps/docs/content/docs/reference/authentication.mdx) for `AuthBoundary`, safe return
45
+ See the [client authentication guide](https://github.com/mvavesal/bitakit/blob/main/apps/docs/content/docs/reference/authentication.mdx) for `AuthBoundary`, safe return
46
46
  destinations and a provider adapter template.
47
47
 
48
48
  ## Organizations
package/dist/client.d.ts CHANGED
@@ -562,6 +562,7 @@ declare const standardPlugins: () => readonly [{
562
562
  } & Omit<import("better-auth").BetterAuthRateLimitOptions, "enabled" | "window" | "max" | "storage">;
563
563
  adapter: import("better-auth").DBAdapter<import("better-auth").BetterAuthOptions>;
564
564
  checkSchema?: import("@better-auth/core/db/internal").SchemaCheck | undefined;
565
+ explicitSchemaCheck?: import("@better-auth/core/db/internal").SchemaCheck | undefined;
565
566
  internalAdapter: import("better-auth").InternalAdapter<import("better-auth").BetterAuthOptions>;
566
567
  createAuthCookie: (cookieName: string, overrideAttributes?: Partial<import("better-call").CookieOptions> | undefined) => import("better-auth").BetterAuthCookie;
567
568
  secret: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitakit/better-auth",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "bitakit": {
6
6
  "plugin": "./plugin",
@@ -9,7 +9,8 @@
9
9
  "sideEffects": false,
10
10
  "files": [
11
11
  "dist",
12
- "README.md"
12
+ "README.md",
13
+ "AGENTS.md"
13
14
  ],
14
15
  "exports": {
15
16
  ".": {
@@ -69,7 +70,7 @@
69
70
  "license": "MIT",
70
71
  "repository": {
71
72
  "type": "git",
72
- "url": "git+https://github.com/mvavesal/bitakit.git",
73
+ "url": "git+https://github.com/mvavesal/bitakit-integrations.git",
73
74
  "directory": "packages/better-auth"
74
75
  },
75
76
  "publishConfig": {