@bitakit/better-auth 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Majid Vesal
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,56 @@
1
+ # @bitakit/better-auth
2
+
3
+ Optionales Foundation-Plugin für einen bereits konfigurierten Better-Auth-Client.
4
+ `betterAuthPlugin(client, { signOut? })` liefert ein normales Plugin für die Foundation-Liste.
5
+ Es stellt den allgemeinen `authService` bereit: Sitzung, Änderungen und Abmelden.
6
+
7
+ Die Foundation übernimmt Beobachtung und Cleanup. Der Client und die Serverkonfiguration
8
+ bleiben beim Host. Die Basis-Anbindung implementiert keine Anmeldeoberfläche; Organisationen und E-Mail-Hooks
9
+ sind separate optionale Einstiegspunkte desselben Pakets. Es darf nicht als vollständiges Auth-Setup
10
+ oder Ersatz für serverseitige Rechteprüfungen verstanden werden.
11
+
12
+ ## Organisationsanbindung
13
+
14
+ `@bitakit/better-auth/organizations` exportiert `betterAuthOrganizations(client)`.
15
+ Es implementiert den allgemeinen Organisationsvertrag mit den SDK-Methoden des bereits
16
+ konfigurierten Organization-Clients, einschließlich paginierter Mitgliederlisten.
17
+ Die UI kommt optional aus `@bitakit/organizations/react`.
18
+
19
+ Die aktuelle UI-Berechtigungsprojektion unterstützt die Standardrollen owner/admin/member.
20
+ Ein deaktiviertes Mitglied wird beim Laden abgewiesen. Eigene Rollen benötigen eine
21
+ angepasste Fähigkeitenprojektion. Backend-Policies und Suspension-Hooks bleiben Pflicht;
22
+ der Client-Adapter ist keine Sicherheitsgrenze. Eine bestehende Web-App wird nicht automatisch migriert.
23
+
24
+ ## E-Mail (Server)
25
+
26
+ `@bitakit/better-auth/email` exportiert `betterAuthEmail(emailService, { invitationURL })`.
27
+ Das liefert die Better-Auth-Callbacks `sendVerificationEmail`, `sendResetPassword` und
28
+ `sendInvitationEmail`. Die ersten beiden gehören in die jeweiligen Auth-Optionen,
29
+ der dritte in die Organization-Plugin-Konfiguration. Der Host bestimmt seine echte
30
+ Einladungsroute. Texte sind derzeit deutsche Standardtexte; für andere Templates können
31
+ Host-Callbacks denselben E-Mail-Service direkt verwenden.
32
+
33
+ Die Callbacks hängen ausschließlich vom allgemeinen E-Mail-Vertrag ab, nicht von Nodemailer.
34
+ Sie werden nicht automatisch in eine bereits erzeugte Server-Auth-Instanz injiziert.
35
+
36
+ ### Organisationsverwaltung
37
+
38
+ `betterAuthOrganizations(client)` unterstützt native Erstellung mit anschließendem Aktivieren, Profiländerung, Logo, Website-Metadata und Löschen. Die vorhandenen serverseitigen Better-Auth-Regeln gelten weiterhin. Optional können explizite Server-Erweiterungen diese Operationen übernehmen. `sessionOrganizationBackend(client, authenticated, signedOut)` trennt einen ausdrücklich lokalen Demo-Einstieg von echten Konten; Fehler des echten Backends werden nie mit Demo-Daten beantwortet. Host-Apps komponieren nur die Adapter, die Logik bleibt im Paket. Ohne Einladungserweiterung gilt die serverseitige Standardlaufzeit; Mitgliedssperren benötigen eine explizite Erweiterung.
39
+
40
+ ## Standard browser client
41
+
42
+ `createBetterAuthClient` from `@bitakit/better-auth/client` creates the shared browser client with organization/teams, multi-session, API key, and two-factor extensions. These are client capabilities, not server activation: the server must configure the matching native extensions. Native client options such as baseURL are supported; plugins supplied to this helper append additional client extensions. Use the native createAuthClient and existing betterAuthPlugin directly for a different preset.
43
+
44
+ The main headless adapter entry remains separate from this browser-only subpath.
45
+
46
+ ## Shared client navigation
47
+
48
+ Pass application-owned `paths: { signIn, afterSignIn, afterSignOut }` as the second
49
+ argument to `betterAuthPlugin`. An optional `signIn(options)` delegates a native login
50
+ flow; without it, `useAuth().signIn()` opens the configured application login page.
51
+ The existing `signOut` override remains supported. Use the shared UI hook for configured
52
+ post-logout navigation; avoid also redirecting inside the override.
53
+
54
+ See the [client authentication guide](../core/docs/auth.md) for configuration,
55
+ `AuthBoundary`, safe return destinations and a provider adapter template. These additions
56
+ are workspace APIs pending release. Native server configuration and login UI remain external.