@dbx-tools/shared-auth 0.9.131 → 0.9.133
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 +47 -25
- package/index.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @dbx-tools/shared-auth
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
Validate passwordless sign-in, passkey, Databricks profile, and resolved-client
|
|
4
|
+
data at browser and server boundaries. The package also provides browser helpers
|
|
5
|
+
for the routes owned by
|
|
6
|
+
[@dbx-tools/auth-gate](../../node/auth-gate).
|
|
7
7
|
|
|
8
|
-
## Read
|
|
8
|
+
## Read authentication status
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
11
|
import { authStatusSchema } from "@dbx-tools/shared-auth";
|
|
12
12
|
|
|
13
|
-
const response = await fetch("/api/auth/status", { credentials: "include" });
|
|
13
|
+
const response = await fetch("/api/email/auth/status", { credentials: "include" });
|
|
14
14
|
const status = authStatusSchema.parse(await response.json());
|
|
15
15
|
|
|
16
16
|
if (status.enabled && !status.authenticated) {
|
|
@@ -21,7 +21,7 @@ if (status.enabled && !status.authenticated) {
|
|
|
21
21
|
Use the request, verification, logout, and status schemas when custom UI or
|
|
22
22
|
transport code calls the auth gate directly.
|
|
23
23
|
|
|
24
|
-
## Build
|
|
24
|
+
## Build a profile selector
|
|
25
25
|
|
|
26
26
|
Profile summaries never include tokens or client secrets. Validate values before
|
|
27
27
|
rendering or persisting a selection:
|
|
@@ -32,33 +32,55 @@ import {
|
|
|
32
32
|
databricksProfileSelectionSchema,
|
|
33
33
|
} from "@dbx-tools/shared-auth";
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
export function selectFirstProfile(input: unknown) {
|
|
36
|
+
const profiles = databricksProfileListSchema.parse(input);
|
|
37
|
+
return databricksProfileSelectionSchema.parse({
|
|
38
|
+
kind: "profile",
|
|
39
|
+
profile: profiles[0]!.name,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
40
42
|
```
|
|
41
43
|
|
|
42
44
|
Use `{ kind: "ambient" }` when the consuming runtime should choose its normal
|
|
43
45
|
Databricks authentication source.
|
|
44
46
|
|
|
45
|
-
## Use
|
|
47
|
+
## Use browser sign-in helpers
|
|
46
48
|
|
|
47
|
-
The `browser` module requests and verifies email OTPs,
|
|
48
|
-
enrollment, manages enrolled passkeys, reads gate
|
|
49
|
-
the server-provided same-origin redirect.
|
|
49
|
+
The `browser` module requests and verifies email one-time passwords (OTPs),
|
|
50
|
+
starts passkey sign-in or enrollment, manages enrolled passkeys, reads gate
|
|
51
|
+
status, and logs out through the server-provided same-origin redirect.
|
|
50
52
|
|
|
51
53
|
```ts
|
|
52
54
|
import { requestEmailOtp, verifyEmailOtp } from "@dbx-tools/shared-auth/browser";
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
export async function requestCode(email: string) {
|
|
57
|
+
return requestEmailOtp(email);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export async function submitCode(email: string, code: string, name: string) {
|
|
61
|
+
return verifyEmailOtp(email, code, name);
|
|
62
|
+
}
|
|
56
63
|
```
|
|
57
64
|
|
|
58
|
-
|
|
65
|
+
Browser helpers use same-origin `/api/email/auth` routes and include the session
|
|
66
|
+
cookie. Email one-time passwords and logout require the auth-gate server routes.
|
|
67
|
+
Passkey operations also require a browser with WebAuthn support. A direct auth
|
|
68
|
+
runtime mounted elsewhere must use the same base path before these helpers can
|
|
69
|
+
call it.
|
|
70
|
+
|
|
71
|
+
## Runtime boundary
|
|
72
|
+
|
|
73
|
+
The Zod schemas and secret-free profile types are safe for shared code. The
|
|
74
|
+
`./browser` subpath performs browser network and WebAuthn operations. This
|
|
75
|
+
package doesn't resolve credentials, mint Databricks tokens, or register server
|
|
76
|
+
routes. Use [@dbx-tools/auth](../../node/auth) for Databricks credential
|
|
77
|
+
resolution and [@dbx-tools/auth-gate](../../node/auth-gate) for passwordless
|
|
78
|
+
server routes.
|
|
79
|
+
|
|
80
|
+
## Package exports
|
|
59
81
|
|
|
60
|
-
- `auth
|
|
61
|
-
- `browser
|
|
62
|
-
- `config
|
|
63
|
-
- `profile
|
|
64
|
-
- `client
|
|
82
|
+
- `auth`: validates passwordless gate requests and responses.
|
|
83
|
+
- `browser`: performs email OTP, passkey, status, and logout operations.
|
|
84
|
+
- `config`: defines Databricks authentication and target values.
|
|
85
|
+
- `profile`: validates secret-free profile lists and selections.
|
|
86
|
+
- `client`: validates resolved, secret-free Databricks client information.
|
package/index.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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/shared-auth";
|
|
6
|
-
export const PACKAGE_VERSION = "0.9.
|
|
6
|
+
export const PACKAGE_VERSION = "0.9.133";
|
|
7
7
|
export * as auth from "./src/auth.ts";
|
|
8
8
|
export * as browser from "./src/browser.ts";
|
|
9
9
|
export * as client from "./src/client.ts";
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const PACKAGE_IDENTIFIER = "@dbx-tools/shared-auth";
|
|
2
|
-
export declare const PACKAGE_VERSION = "0.9.
|
|
2
|
+
export declare const PACKAGE_VERSION = "0.9.133";
|
|
3
3
|
export * as auth from "./src/auth.ts";
|
|
4
4
|
export * as browser from "./src/browser.ts";
|
|
5
5
|
export * as client from "./src/client.ts";
|
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Regenerated from the exporting modules in ./src.
|
|
3
3
|
// Hand edits are overwritten on the next watch; this file is read-only.
|
|
4
4
|
export const PACKAGE_IDENTIFIER = "@dbx-tools/shared-auth";
|
|
5
|
-
export const PACKAGE_VERSION = "0.9.
|
|
5
|
+
export const PACKAGE_VERSION = "0.9.133";
|
|
6
6
|
export * as auth from "./src/auth.js";
|
|
7
7
|
export * as browser from "./src/browser.js";
|
|
8
8
|
export * as client from "./src/client.js";
|
|
@@ -14,4 +14,4 @@ export { RUNTIME_AUTH_TYPE, databricksAuthClientInfoSchema } from "./src/client.
|
|
|
14
14
|
export { AuthType, TargetKind } from "./src/config.js";
|
|
15
15
|
export { authTypeSchema, targetKindSchema } from "./src/config-schema.js";
|
|
16
16
|
export { databricksProfileSummarySchema, databricksProfileListSchema, databricksProfileSelectionSchema } from "./src/profile.js";
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyQ0FBMkM7QUFDM0MsbURBQW1EO0FBQ25ELHdFQUF3RTtBQUV4RSxNQUFNLENBQUMsTUFBTSxrQkFBa0IsR0FBRyx3QkFBd0IsQ0FBQztBQUMzRCxNQUFNLENBQUMsTUFBTSxlQUFlLEdBQUcsU0FBUyxDQUFDO0FBQ3pDLE9BQU8sS0FBSyxJQUFJLE1BQU0sZUFBZSxDQUFDO0FBQ3RDLE9BQU8sS0FBSyxPQUFPLE1BQU0sa0JBQWtCLENBQUM7QUFDNUMsT0FBTyxLQUFLLE1BQU0sTUFBTSxpQkFBaUIsQ0FBQztBQUMxQyxPQUFPLEtBQUssTUFBTSxNQUFNLGlCQUFpQixDQUFDO0FBQzFDLE9BQU8sS0FBSyxZQUFZLE1BQU0sd0JBQXdCLENBQUM7QUFDdkQsT0FBTyxLQUFLLE9BQU8sTUFBTSxrQkFBa0IsQ0FBQztBQUM1QyxPQUFPLEVBQUUsY0F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bWEgfSBmcm9tIFwiLi9zcmMvY29uZmlnLXNjaGVtYS50c1wiO1xuZXhwb3J0IHsgZGF0YWJyaWNrc1Byb2ZpbGVTdW1tYXJ5U2NoZW1hLCBkYXRhYnJpY2tzUHJvZmlsZUxpc3RTY2hlbWEsIGRhdGFicmlja3NQcm9maWxlU2VsZWN0aW9uU2NoZW1hIH0gZnJvbSBcIi4vc3JjL3Byb2ZpbGUudHNcIjtcbmV4cG9ydCB0eXBlIHsgRGF0YWJyaWNrc1Byb2ZpbGVTdW1tYXJ5LCBEYXRhYnJpY2tzUHJvZmlsZUxpc3QsIERhdGFicmlja3NQcm9maWxlU2VsZWN0aW9uIH0gZnJvbSBcIi4vc3JjL3Byb2ZpbGUudHNcIjtcbiJdfQ==
|
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@better-auth/passkey": "1.7.6",
|
|
26
|
-
"@dbx-tools/shared-core": "^0.9.
|
|
26
|
+
"@dbx-tools/shared-core": "^0.9.133",
|
|
27
27
|
"@simplewebauthn/browser": "13.3.0",
|
|
28
28
|
"better-auth": "1.7.6",
|
|
29
29
|
"zod": "4.3.6"
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"./package.json": "./package.json"
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
|
-
"version": "0.9.
|
|
73
|
+
"version": "0.9.133",
|
|
74
74
|
"types": "./lib/index.d.ts",
|
|
75
75
|
"dbxToolsConfig": {
|
|
76
76
|
"tags": [
|