@dbx-tools/auth 0.6.163 → 0.6.167

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/README.md CHANGED
@@ -1,50 +1,38 @@
1
- # `@dbx-tools/auth`
1
+ # @dbx-tools/auth
2
2
 
3
- Passwordless authentication runtime built on Better Auth, email OTP, passkeys,
4
- and caller-provided identity policy and delivery.
5
-
6
- Key features:
7
-
8
- - Better Auth ownership of users, sessions, OTP lifecycle, rate limits, and
9
- passkey credentials;
10
- - session-required passkey enrollment and discoverable passkey login;
11
- - POST and browser-redirect logout routes with a same-origin destination;
12
- - caller-provided `authorizeIdentity`, email sender, secret, origin, and
13
- database;
14
- - native AppKit Lakebase pool or local SQLite storage;
15
- - programmatic Better Auth migrations under advisory or file locks.
16
-
17
- ## Relationship To Native AppKit
18
-
19
- Use the Databricks Apps front door and AppKit execution context when traffic
20
- arrives through the platform. Use this package for a public tunnel or another
21
- route that bypasses that identity-aware proxy and therefore needs its own
22
- passwordless session. A passkey session proves the configured identity only; it
23
- does not mint a Databricks OBO access token.
3
+ Generated Node bindings for [provider-neutral Rust authentication](../../../rs/auth).
4
+ This is outbound OAuth, not the incoming [`@dbx-tools/auth-gate`](../auth-gate).
24
5
 
25
6
  ```ts
26
- import { auth, storage } from "@dbx-tools/auth";
27
-
28
- const database = await storage.createAuthStorage({ storage: "sqlite" });
29
- const runtime = await auth.createPasswordlessAuth({
30
- storage: database,
31
- baseURL: "http://localhost:8000",
32
- appName: "My app",
33
- secret: process.env.AUTH_SECRET!,
34
- logoutRedirectPath: "/",
35
- sessionTtlSeconds: 2_592_000,
36
- codeTtlSeconds: 600,
37
- maxAttempts: 5,
38
- authorizeIdentity: (email) => email.endsWith("@example.com"),
39
- sendCode: async (email, code) => sendEmail(email, code),
40
- });
7
+ import { createProviderAuth, ProviderOptions, OAuthGrant } from "@dbx-tools/auth";
8
+
9
+ const auth = await createProviderAuth(
10
+ ProviderOptions.create({
11
+ provider: "example",
12
+ tokenEndpoint: "https://identity.example.com/oauth/token",
13
+ clientId: process.env.OAUTH_CLIENT_ID!,
14
+ clientSecret: process.env.OAUTH_CLIENT_SECRET!,
15
+ grant: OAuthGrant.ClientCredentials,
16
+ scopes: ["read"],
17
+ }),
18
+ );
19
+ const token = await auth.token(false);
41
20
  ```
42
21
 
43
- `POST <basePath>/logout` returns `{ ok, redirectTo }`; `GET` clears the same
44
- session and redirects with status `303`. The redirect defaults to `/` and is
45
- restricted to a same-origin path.
46
-
47
- ## Modules
48
-
49
- - `auth` - Better Auth runtime and compatibility routes;
50
- - `storage` - Lakebase/SQLite selection and migration locking.
22
+ Omit `profile` for providers without profiles. `fileLayout` selects one shared
23
+ file or a separate file per provider/profile/sorted-scope identity. `cacheDir`
24
+ overrides the file location. Rust owns storage, locking, refresh, and browser
25
+ authorization; the TypeScript API is generated, not copied.
26
+
27
+ Both `ProviderOptions.auth` and `DatabricksAuthOptions.auth` accept the same
28
+ `AuthOptions` exported here. For example,
29
+ `auth: AuthOptions.create({ lockTimeoutSeconds: 10n })` overrides only the lock
30
+ timeout. Omit `auth` to use Rust defaults. Move former top-level timeout and
31
+ `callbackImageSrc` fields into this record; see the
32
+ [shared options guide](../../../rs/auth/README.md#shared-options-and-provider-implementations).
33
+
34
+ Use `StorageAdapter` for custom persistence. Wrap it with `createStorageHandle`
35
+ before passing it to either `createProviderAuthWithStorage` or
36
+ `@dbx-tools/databricks-auth`'s `createPersistentAuthWithStorage`. No Postgres client is bundled.
37
+ The standard package root exports generated contracts and `uniffiModule`, the
38
+ generator-owned converter table used by dependent bindings.
package/index.ts CHANGED
@@ -3,7 +3,6 @@
3
3
  // Hand edits are overwritten on the next watch; this file is read-only.
4
4
 
5
5
  export const PACKAGE_IDENTIFIER = "@dbx-tools/auth";
6
- export * as auth from "./src/auth.ts";
7
- export * as storage from "./src/storage.ts";
8
- export type { AuthorizeIdentity, AuthEmailOptions, PasswordlessAuthOptions, PasswordlessAuthRuntime } from "./src/auth.ts";
9
- export type { AuthStorageMode, AuthStorageConfig, ResolvedAuthStorageConfig, AuthDatabase, AuthStorage } from "./src/storage.ts";
6
+ export * as bindings from "./src/bindings.ts";
7
+ export { uniffiModule } from "./src/bindings.ts";
8
+ export * from "./exports.ts";