@docsxai/engine 0.3.0-rc.2 → 0.3.0-rc.5
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 +45 -35
- package/dist/atomic-write.d.ts +19 -0
- package/dist/atomic-write.js +127 -0
- package/dist/auth/api-login.d.ts +9 -51
- package/dist/auth/api-login.js +3 -3
- package/dist/auth/browser-session.js +1 -1
- package/dist/auth/cookie-jar.d.ts +4 -4
- package/dist/auth/cookie-jar.js +4 -4
- package/dist/auth/email-otp.d.ts +11 -147
- package/dist/auth/email-otp.js +4 -4
- package/dist/auth/http-basic.js +1 -1
- package/dist/auth/index.js +3 -3
- package/dist/auth/jwt-injection.d.ts +7 -131
- package/dist/auth/jwt-injection.js +5 -5
- package/dist/auth/manual-capture.d.ts +3 -3
- package/dist/auth/manual-capture.js +2 -2
- package/dist/auth/mtls.d.ts +1 -6
- package/dist/auth/mtls.js +1 -1
- package/dist/auth/pat-header.d.ts +1 -9
- package/dist/auth/pat-header.js +1 -1
- package/dist/auth/storage-state-cache.d.ts +16 -6
- package/dist/auth/storage-state-cache.js +65 -15
- package/dist/auth/test-backdoor.d.ts +2 -13
- package/dist/auth/test-backdoor.js +3 -3
- package/dist/auth/totp.d.ts +1 -1
- package/dist/auth/totp.js +4 -4
- package/dist/auth/types.d.ts +3 -3
- package/dist/auth/types.js +4 -4
- package/dist/auth/ui-form.d.ts +24 -153
- package/dist/auth/ui-form.js +3 -3
- package/dist/auth/webauthn.d.ts +7 -67
- package/dist/auth/webauthn.js +3 -3
- package/dist/auth.js +1 -1
- package/dist/backend-client-contracts.d.ts +1 -1
- package/dist/backend-client-contracts.js +2 -2
- package/dist/backend-client-oauth-login.js +1 -1
- package/dist/backend-client-state-cache.d.ts +2 -2
- package/dist/backend-client-state-cache.js +8 -8
- package/dist/backend-client-token.js +5 -5
- package/dist/backend-client-transport.d.ts +2 -2
- package/dist/backend-client-transport.js +3 -3
- package/dist/backend-client.js +6 -6
- package/dist/browser-build.d.ts +6 -0
- package/dist/browser-build.js +12 -0
- package/dist/browser-launch-error.d.ts +18 -0
- package/dist/browser-launch-error.js +63 -0
- package/dist/browser-wait.d.ts +7 -0
- package/dist/browser-wait.js +12 -0
- package/dist/calibrate.d.ts +6 -2
- package/dist/calibrate.js +20 -13
- package/dist/cli-backend-errors.d.ts +5 -0
- package/dist/cli-backend-errors.js +28 -6
- package/dist/cli-commands-auth.d.ts +1 -0
- package/dist/cli-commands-auth.js +114 -0
- package/dist/cli-commands-authoring.d.ts +0 -1
- package/dist/cli-commands-authoring.js +124 -101
- package/dist/cli-commands-backend.d.ts +1 -1
- package/dist/cli-commands-backend.js +76 -21
- package/dist/cli-commands-docpack.d.ts +3 -1
- package/dist/cli-commands-docpack.js +145 -39
- package/dist/cli-commands-init.d.ts +1 -0
- package/dist/cli-commands-init.js +100 -0
- package/dist/cli-commands-pack.d.ts +1 -1
- package/dist/cli-commands-pack.js +6 -4
- package/dist/cli-commands-session.d.ts +1 -3
- package/dist/cli-commands-session.js +109 -180
- package/dist/cli-commands-site.d.ts +2 -0
- package/dist/cli-commands-site.js +77 -0
- package/dist/cli-commands-style.d.ts +1 -0
- package/dist/cli-commands-style.js +85 -0
- package/dist/cli-flags.d.ts +18 -0
- package/dist/cli-flags.js +77 -0
- package/dist/cli-help.d.ts +30 -0
- package/dist/cli-help.js +174 -0
- package/dist/cli-messages.d.ts +35 -0
- package/dist/cli-messages.js +104 -0
- package/dist/cli-node-guard.d.ts +1 -0
- package/dist/cli-node-guard.js +8 -0
- package/dist/cli-retired.js +6 -0
- package/dist/cli-run-stale.d.ts +2 -0
- package/dist/cli-run-stale.js +13 -0
- package/dist/cli-run-summary.js +7 -3
- package/dist/cli-shared.d.ts +30 -1
- package/dist/cli-shared.js +112 -12
- package/dist/cli-unexpected.d.ts +16 -0
- package/dist/cli-unexpected.js +76 -0
- package/dist/cli-usage.d.ts +1 -1
- package/dist/cli-usage.js +116 -66
- package/dist/cli-value-flags.d.ts +8 -0
- package/dist/cli-value-flags.js +34 -0
- package/dist/cli-version.d.ts +6 -0
- package/dist/cli-version.js +25 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +46 -20
- package/dist/deprecation.d.ts +2 -0
- package/dist/deprecation.js +2 -0
- package/dist/device-scale-factor.d.ts +14 -0
- package/dist/device-scale-factor.js +38 -0
- package/dist/diagnose.js +14 -13
- package/dist/diff-compute.js +22 -8
- package/dist/diff-report.js +3 -3
- package/dist/diff-types.js +1 -1
- package/dist/diff.js +3 -3
- package/dist/doc-pack-io.js +62 -47
- package/dist/doc-pack.d.ts +567 -3487
- package/dist/doc-pack.js +47 -33
- package/dist/doctor-checks-config.d.ts +12 -0
- package/dist/doctor-checks-config.js +229 -0
- package/dist/doctor-checks-plugins.js +2 -2
- package/dist/doctor-checks-site.d.ts +3 -0
- package/dist/doctor-checks-site.js +21 -0
- package/dist/doctor-checks.d.ts +13 -2
- package/dist/doctor-checks.js +95 -79
- package/dist/doctor-next.d.ts +5 -0
- package/dist/doctor-next.js +52 -0
- package/dist/doctor.d.ts +36 -2
- package/dist/doctor.js +88 -29
- package/dist/environment-spec.d.ts +36 -44
- package/dist/environment-spec.js +31 -3
- package/dist/export/adf.d.ts +1 -1
- package/dist/export/adf.js +16 -27
- package/dist/export/playwright-test.d.ts +1 -1
- package/dist/export/playwright-test.js +13 -15
- package/dist/flow-file.d.ts +1 -1
- package/dist/flow-file.js +22 -4
- package/dist/flow-halt.d.ts +1 -1
- package/dist/flow-halt.js +15 -3
- package/dist/flow-lint.d.ts +3 -1
- package/dist/flow-lint.js +39 -26
- package/dist/flow-matrix-lint.js +2 -2
- package/dist/flow-runtime.d.ts +17 -6
- package/dist/flow-runtime.js +48 -17
- package/dist/flow-success.js +4 -4
- package/dist/flow-tree.js +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/main-module.d.ts +1 -0
- package/dist/main-module.js +17 -0
- package/dist/matrix-spec.d.ts +33 -106
- package/dist/matrix-spec.js +12 -3
- package/dist/node-floor.d.ts +4 -0
- package/dist/node-floor.js +14 -0
- package/dist/obstacles.js +1 -1
- package/dist/open-in-browser.d.ts +22 -0
- package/dist/open-in-browser.js +37 -0
- package/dist/playwright-driver.d.ts +8 -12
- package/dist/playwright-driver.js +75 -70
- package/dist/playwright-instrumented-browser.d.ts +10 -7
- package/dist/playwright-instrumented-browser.js +35 -12
- package/dist/plugins/load.d.ts +1 -1
- package/dist/plugins/load.js +4 -4
- package/dist/plugins/lock.js +11 -8
- package/dist/plugins/manifest.d.ts +16 -35
- package/dist/plugins/manifest.js +5 -5
- package/dist/plugins/plan.d.ts +3 -3
- package/dist/plugins/plan.js +14 -14
- package/dist/plugins/registry.d.ts +1 -1
- package/dist/plugins/registry.js +1 -1
- package/dist/plugins/runtime.js +3 -3
- package/dist/plugins/types.d.ts +1 -1
- package/dist/plugins-cli.js +36 -28
- package/dist/posix-path.d.ts +2 -0
- package/dist/posix-path.js +7 -0
- package/dist/redact.js +2 -2
- package/dist/run-flows.d.ts +7 -0
- package/dist/run-flows.js +75 -27
- package/dist/style.d.ts +2 -2
- package/dist/style.js +13 -11
- package/dist/verify-determinism.js +2 -1
- package/dist/verify-next-step.d.ts +2 -0
- package/dist/verify-next-step.js +24 -0
- package/dist/verify-report.js +3 -2
- package/dist/viewer-bin.d.ts +9 -3
- package/dist/viewer-bin.js +35 -12
- package/dist/workspace-templates.d.ts +15 -0
- package/dist/workspace-templates.js +88 -0
- package/dist/workspace.d.ts +78 -5
- package/dist/workspace.js +47 -28
- package/dist/zip.d.ts +1 -1
- package/dist/zip.js +23 -6
- package/package.json +6 -6
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// Local storageState cache (`.auth/<role>.json`)
|
|
1
|
+
// Local storageState cache (`.auth/<role>.json`), used by expensive strategies (manual-capture, ui-form, ...).
|
|
2
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
2
3
|
import { promises as fs } from "node:fs";
|
|
3
4
|
import { z } from "zod";
|
|
4
5
|
import { BackendStateCache, resolveBackendToken } from "../backend-client.js";
|
|
@@ -31,6 +32,37 @@ function ttlToMs(ttl) {
|
|
|
31
32
|
return n;
|
|
32
33
|
}
|
|
33
34
|
}
|
|
35
|
+
/** Files in `.auth/` that hold something other than a role's session. */
|
|
36
|
+
const RESERVED_AUTH_FILES = new Set(["backend-token"]);
|
|
37
|
+
/**
|
|
38
|
+
* The file name (under `.auth/`) that holds a role's session. A role made of safe characters keeps
|
|
39
|
+
* its own name. Any other role gets its unsafe characters replaced and a short hash of the exact
|
|
40
|
+
* role appended, so `a/b` and `a_b` never share a file, and no role lands on the OAuth token file.
|
|
41
|
+
*/
|
|
42
|
+
export function storageStateFileName(role) {
|
|
43
|
+
const safe = role.replace(/[^A-Za-z0-9_.-]/g, "_");
|
|
44
|
+
if (safe === role && !RESERVED_AUTH_FILES.has(role))
|
|
45
|
+
return `${role}.json`;
|
|
46
|
+
const hash = createHash("sha256").update(role).digest("hex").slice(0, 8);
|
|
47
|
+
return `${safe}-${hash}.json`;
|
|
48
|
+
}
|
|
49
|
+
/** True when the role's file in `<dir>` exists but is not a cached session (not JSON, or the wrong shape). */
|
|
50
|
+
export async function cachedSessionIsCorrupt(dir, role) {
|
|
51
|
+
let text;
|
|
52
|
+
try {
|
|
53
|
+
text = await fs.readFile(new LocalStorageStateCache(dir).filePath(role), "utf8");
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
CachedStateSchema.parse(JSON.parse(text));
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
34
66
|
export class LocalStorageStateCache {
|
|
35
67
|
dir;
|
|
36
68
|
/** @param dir the `.auth/` directory (relative paths resolved against cwd). */
|
|
@@ -38,20 +70,25 @@ export class LocalStorageStateCache {
|
|
|
38
70
|
this.dir = dir;
|
|
39
71
|
}
|
|
40
72
|
fileName(role) {
|
|
41
|
-
|
|
42
|
-
const safe = role.replace(/[^A-Za-z0-9_.-]/g, "_");
|
|
43
|
-
return `${safe}.json`;
|
|
73
|
+
return storageStateFileName(role);
|
|
44
74
|
}
|
|
45
75
|
file(role) {
|
|
46
76
|
return resolveWorkspacePath(this.dir, this.fileName(role));
|
|
47
77
|
}
|
|
78
|
+
/** The path of the cache file for `role`. */
|
|
79
|
+
filePath(role) {
|
|
80
|
+
return this.file(role);
|
|
81
|
+
}
|
|
48
82
|
/** Return the cached state for a role if present and not past its expiry; otherwise `null`. */
|
|
49
83
|
async load(role, now = Date.now()) {
|
|
50
84
|
let text;
|
|
51
85
|
try {
|
|
52
86
|
text = await fs.readFile(this.file(role), "utf8");
|
|
53
87
|
}
|
|
54
|
-
catch {
|
|
88
|
+
catch (e) {
|
|
89
|
+
// A file where `.auth/` should be is a broken workspace, not a missing session.
|
|
90
|
+
if (e.code === "ENOTDIR")
|
|
91
|
+
throw e;
|
|
55
92
|
return null;
|
|
56
93
|
}
|
|
57
94
|
let parsed;
|
|
@@ -67,13 +104,13 @@ export class LocalStorageStateCache {
|
|
|
67
104
|
}
|
|
68
105
|
/**
|
|
69
106
|
* Persist a captured session and compute its expiry, in priority order:
|
|
70
|
-
* 1. **The app's auth cookie
|
|
107
|
+
* 1. **The app's auth cookie**, if `auth_cookie` (descriptor or override) names a cookie that's in the
|
|
71
108
|
* captured jar with a real (non-session) expiry, that expiry *is* the bound. This is the right answer;
|
|
72
|
-
* the host agent identifies which cookie it is (it's on the app's domain, long-lived
|
|
109
|
+
* the host agent identifies which cookie it is (it's on the app's domain, long-lived, not an ephemeral
|
|
73
110
|
* IdP scratch cookie). Why not just `min(cookie.expires)`? An interactive SSO login drops scratch cookies
|
|
74
111
|
* that expire seconds out, so the min ≈ now and the session would be born expired.
|
|
75
|
-
* 2. **`ttl
|
|
76
|
-
* 3. **`session` / default
|
|
112
|
+
* 2. **`ttl`**, a duration (`1h`, `30m`, ms) → `now + ttl`. The fallback when no `auth_cookie` is set/found.
|
|
113
|
+
* 3. **`session` / default**, the strategy's reported `expiresAt` if plausibly in the future, else +1h.
|
|
77
114
|
* Returns the computed `expiresAt` and a human-readable `source`.
|
|
78
115
|
*/
|
|
79
116
|
async save(role, result, roleAuth, now = Date.now(), opts = {}) {
|
|
@@ -90,7 +127,7 @@ export class LocalStorageStateCache {
|
|
|
90
127
|
}
|
|
91
128
|
else if (authCookieName) {
|
|
92
129
|
expiresAt = typeof ttlMs === "number" ? now + ttlMs : now + 3_600_000;
|
|
93
|
-
source = `ttl (fallback
|
|
130
|
+
source = `ttl (fallback: auth-cookie "${authCookieName}" not in the jar or has no expiry)`;
|
|
94
131
|
}
|
|
95
132
|
else if (typeof ttlMs === "number") {
|
|
96
133
|
expiresAt = now + ttlMs;
|
|
@@ -102,13 +139,26 @@ export class LocalStorageStateCache {
|
|
|
102
139
|
source = reported ? "strategy-reported expiresAt" : "1h default";
|
|
103
140
|
}
|
|
104
141
|
if (expiresAt <= now) {
|
|
105
|
-
throw new AuthStrategyConfigError(`computed cache expiry (${new Date(expiresAt).toISOString()}, from ${source}) is not in the future
|
|
142
|
+
throw new AuthStrategyConfigError(`computed cache expiry (${new Date(expiresAt).toISOString()}, from ${source}) is not in the future; refusing to cache a dead session`);
|
|
106
143
|
}
|
|
107
144
|
const entry = { storageState: result.storageState, writtenAt: now, expiresAt };
|
|
108
145
|
await fs.mkdir(resolveWorkspacePath(this.dir), { recursive: true });
|
|
109
|
-
// Role names are operator-influenced
|
|
146
|
+
// Role names are operator-influenced, resolve with the symlink-aware variant before writing.
|
|
110
147
|
const target = await resolveWorkspacePathReal(this.dir, this.fileName(role));
|
|
111
|
-
|
|
148
|
+
// The jar holds live session cookies: a fresh owner-only file renamed over the old one, so an
|
|
149
|
+
// older group-readable copy never holds the new cookies.
|
|
150
|
+
const tmp = `${target}.${process.pid}.${randomBytes(4).toString("hex")}.tmp`;
|
|
151
|
+
try {
|
|
152
|
+
await fs.writeFile(tmp, JSON.stringify(entry, null, 2) + "\n", {
|
|
153
|
+
encoding: "utf8",
|
|
154
|
+
mode: 0o600,
|
|
155
|
+
flag: "wx",
|
|
156
|
+
});
|
|
157
|
+
await fs.rename(tmp, target);
|
|
158
|
+
}
|
|
159
|
+
finally {
|
|
160
|
+
await fs.rm(tmp, { force: true });
|
|
161
|
+
}
|
|
112
162
|
return { expiresAt, source };
|
|
113
163
|
}
|
|
114
164
|
async clear(role) {
|
|
@@ -118,14 +168,14 @@ export class LocalStorageStateCache {
|
|
|
118
168
|
/**
|
|
119
169
|
* Pick the state cache for a role. `store: local` (the default) caches under `<workspace>/.auth/`.
|
|
120
170
|
* `store: backend` relays AES-256-GCM envelopes through the backend (encrypted client-side; the
|
|
121
|
-
* backend never sees plaintext)
|
|
171
|
+
* backend never sees plaintext), it needs a workspace that has been pushed (`backend_url` +
|
|
122
172
|
* `backend_workspace_id` in `.docsxai.json`) and `DOCSX_CACHE_KEY`.
|
|
123
173
|
*/
|
|
124
174
|
export async function resolveStateCache(roleAuth, workspaceDir) {
|
|
125
175
|
if (roleAuth.cache.store === "backend") {
|
|
126
176
|
const cfg = await loadWorkspaceConfig(workspaceDir);
|
|
127
177
|
if (!cfg?.backend_url || !cfg.backend_workspace_id) {
|
|
128
|
-
throw new AuthStrategyConfigError("cache.store: backend needs a backend-bound workspace
|
|
178
|
+
throw new AuthStrategyConfigError("cache.store: backend needs a backend-bound workspace: run `docsxai push` first (backend_url + backend_workspace_id in .docsxai.json)");
|
|
129
179
|
}
|
|
130
180
|
const cacheKey = process.env.DOCSX_CACHE_KEY;
|
|
131
181
|
if (!cacheKey) {
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type AuthContext, type AuthResult, type AuthStrategy } from "./types.js";
|
|
3
3
|
export declare const TestBackdoorOptions: z.ZodObject<{
|
|
4
|
-
/** Backdoor endpoint; resolved against the target's base URL when relative. */
|
|
5
4
|
url: z.ZodString;
|
|
6
|
-
|
|
7
|
-
user_id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
8
|
-
/** Cookie that proves the backdoor worked. Optional; any Set-Cookie + non-4xx passes without it. */
|
|
5
|
+
user_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
9
6
|
success_cookie: z.ZodOptional<z.ZodString>;
|
|
10
|
-
},
|
|
11
|
-
url: string;
|
|
12
|
-
user_id?: string | number | undefined;
|
|
13
|
-
success_cookie?: string | undefined;
|
|
14
|
-
}, {
|
|
15
|
-
url: string;
|
|
16
|
-
user_id?: string | number | undefined;
|
|
17
|
-
success_cookie?: string | undefined;
|
|
18
|
-
}>;
|
|
7
|
+
}, z.core.$strict>;
|
|
19
8
|
export type TestBackdoorOptions = z.infer<typeof TestBackdoorOptions>;
|
|
20
9
|
export declare class TestBackdoorStrategy implements AuthStrategy {
|
|
21
10
|
private readonly fetchImpl;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// `test-backdoor
|
|
1
|
+
// `test-backdoor`: POST a shared secret to a test-only login endpoint the target app exposes in
|
|
2
2
|
// non-production builds, and keep the session cookies it sets. The unattended-execution answer
|
|
3
3
|
// when the app team can ship a backdoor route; the secret lives in env, never in the descriptor.
|
|
4
4
|
import { z } from "zod";
|
|
@@ -36,13 +36,13 @@ export class TestBackdoorStrategy {
|
|
|
36
36
|
}),
|
|
37
37
|
}, { fetchImpl: this.fetchImpl });
|
|
38
38
|
if (result.status >= 400) {
|
|
39
|
-
throw new AuthStrategyConfigError(`test-backdoor: ${url.href} answered ${result.status} (secret: ${maskSecret(secret)}
|
|
39
|
+
throw new AuthStrategyConfigError(`test-backdoor: ${url.href} answered ${result.status} (secret: ${maskSecret(secret)}, value not shown)`);
|
|
40
40
|
}
|
|
41
41
|
if (opts.success_cookie && !result.jar.has(opts.success_cookie)) {
|
|
42
42
|
throw new AuthStrategyConfigError(`test-backdoor: expected cookie "${opts.success_cookie}" was not set by ${url.href}`);
|
|
43
43
|
}
|
|
44
44
|
if (result.jar.cookies().length === 0) {
|
|
45
|
-
throw new AuthStrategyConfigError(`test-backdoor: ${url.href} answered ${result.status} but set no cookies
|
|
45
|
+
throw new AuthStrategyConfigError(`test-backdoor: ${url.href} answered ${result.status} but set no cookies, so there is nothing to capture`);
|
|
46
46
|
}
|
|
47
47
|
const storageState = result.jar.toStorageState();
|
|
48
48
|
const expiresAt = jarAuthExpiry(storageState, opts.success_cookie);
|
package/dist/auth/totp.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare function verifyTotp(code: string, secret: string | Uint8Array, op
|
|
|
31
31
|
}): boolean;
|
|
32
32
|
/**
|
|
33
33
|
* The standalone `totp` catalogue entry. A TOTP is one field of an interactive login, not a whole
|
|
34
|
-
* scheme
|
|
34
|
+
* scheme: authenticating with it alone is a config error that points at the composition.
|
|
35
35
|
*/
|
|
36
36
|
export declare class TotpStrategy implements AuthStrategy {
|
|
37
37
|
readonly name: "totp";
|
package/dist/auth/totp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Dep-free RFC 6238 TOTP (over RFC 4226 HOTP) with `node:crypto`.
|
|
2
2
|
//
|
|
3
|
-
// `totp` is not a standalone login scheme
|
|
4
|
-
// login
|
|
3
|
+
// `totp` is not a standalone login scheme, a one-time code is one *field* of an interactive
|
|
4
|
+
// login: so the catalogue entry composes `ui-form` (set `options.totp` there). The primitives
|
|
5
5
|
// are exported for that hook, for fixture servers, and for future CLI/MCP surfacing.
|
|
6
6
|
import { createHmac } from "node:crypto";
|
|
7
7
|
import { AuthStrategyConfigError, } from "./types.js";
|
|
@@ -96,12 +96,12 @@ export function verifyTotp(code, secret, opts = {}) {
|
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* The standalone `totp` catalogue entry. A TOTP is one field of an interactive login, not a whole
|
|
99
|
-
* scheme
|
|
99
|
+
* scheme: authenticating with it alone is a config error that points at the composition.
|
|
100
100
|
*/
|
|
101
101
|
export class TotpStrategy {
|
|
102
102
|
name = "totp";
|
|
103
103
|
authenticate(_ctx) {
|
|
104
|
-
throw new AuthStrategyConfigError("strategy `totp` is not a standalone login
|
|
104
|
+
throw new AuthStrategyConfigError("strategy `totp` is not a standalone login: use strategy `ui-form` with " +
|
|
105
105
|
"options.totp: { secret_env: <ENV-VAR NAME>, otp_selector: <css>, submit_selector?: <css> }; " +
|
|
106
106
|
"the TOTP primitives (generateTotp / verifyTotp) are exported for direct use");
|
|
107
107
|
}
|
package/dist/auth/types.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export interface StorageState {
|
|
|
21
21
|
}
|
|
22
22
|
/** One captured cookie in a {@link StorageState} jar. */
|
|
23
23
|
export type StorageStateCookie = StorageState["cookies"][number];
|
|
24
|
-
/** An empty jar
|
|
24
|
+
/** An empty jar, for strategies whose "auth" is connection-level, not storage-level. */
|
|
25
25
|
export declare function emptyStorageState(): StorageState;
|
|
26
26
|
/**
|
|
27
27
|
* Connection-level auth a strategy asks the browser context to carry. Produced by strategies whose
|
|
@@ -76,11 +76,11 @@ export declare class AuthStrategyConfigError extends Error {
|
|
|
76
76
|
}
|
|
77
77
|
/** Validate a strategy's `options` record against its schema; config errors name the offending key, never values. */
|
|
78
78
|
export declare function parseStrategyOptions<S extends z.ZodTypeAny>(strategy: string, schema: S, options: Record<string, unknown>): z.infer<S>;
|
|
79
|
-
/** Mask a secret for logs / error messages
|
|
79
|
+
/** Mask a secret for logs / error messages, the value itself must never surface. */
|
|
80
80
|
export declare function maskSecret(value: string | undefined): "<SET>" | "<UNSET>";
|
|
81
81
|
/** Render a `{{key}}` template against a variable map. Unknown keys are left intact. */
|
|
82
82
|
export declare function renderTemplate(template: string, vars: Record<string, string>): string;
|
|
83
83
|
/** The earliest non-session cookie expiry (epoch ms), or `undefined` if all cookies are session cookies. */
|
|
84
84
|
export declare function earliestCookieExpiry(state: StorageState): number | undefined;
|
|
85
|
-
/** Expiry (epoch ms) of the cookie named `name` in `state
|
|
85
|
+
/** Expiry (epoch ms) of the cookie named `name` in `state`, the latest if there are several; `undefined` if absent or a session cookie (`expires <= 0`). */
|
|
86
86
|
export declare function cookieExpiryByName(state: StorageState, name: string): number | undefined;
|
package/dist/auth/types.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Shared auth-layer types and StorageState helpers.
|
|
2
2
|
//
|
|
3
|
-
// Every strategy produces a `storageState` (cookies + localStorage + sessionStorage)
|
|
3
|
+
// Every strategy produces a `storageState` (cookies + localStorage + sessionStorage), the
|
|
4
4
|
// universal artifact every auth scheme reduces to. Execution consumes it via Playwright's
|
|
5
5
|
// `setup`-project + `dependencies` mechanism (auth-agnostic for the rest of the suite).
|
|
6
|
-
/** An empty jar
|
|
6
|
+
/** An empty jar, for strategies whose "auth" is connection-level, not storage-level. */
|
|
7
7
|
export function emptyStorageState() {
|
|
8
8
|
return { cookies: [], origins: [] };
|
|
9
9
|
}
|
|
@@ -32,7 +32,7 @@ export function parseStrategyOptions(strategy, schema, options) {
|
|
|
32
32
|
}
|
|
33
33
|
return r.data;
|
|
34
34
|
}
|
|
35
|
-
/** Mask a secret for logs / error messages
|
|
35
|
+
/** Mask a secret for logs / error messages, the value itself must never surface. */
|
|
36
36
|
export function maskSecret(value) {
|
|
37
37
|
return value ? "<SET>" : "<UNSET>";
|
|
38
38
|
}
|
|
@@ -48,7 +48,7 @@ export function earliestCookieExpiry(state) {
|
|
|
48
48
|
.map((e) => e * 1000); // Playwright cookie `expires` is seconds since epoch (or -1 for session)
|
|
49
49
|
return expiries.length ? Math.min(...expiries) : undefined;
|
|
50
50
|
}
|
|
51
|
-
/** Expiry (epoch ms) of the cookie named `name` in `state
|
|
51
|
+
/** Expiry (epoch ms) of the cookie named `name` in `state`, the latest if there are several; `undefined` if absent or a session cookie (`expires <= 0`). */
|
|
52
52
|
export function cookieExpiryByName(state, name) {
|
|
53
53
|
const expiries = state.cookies
|
|
54
54
|
.filter((c) => c.name === name && typeof c.expires === "number" && c.expires > 0)
|
package/dist/auth/ui-form.d.ts
CHANGED
|
@@ -3,19 +3,13 @@ import { type AuthPage, type AuthPageLauncher } from "./browser-session.js";
|
|
|
3
3
|
import { type AuthContext, type AuthResult, type AuthStrategy } from "./types.js";
|
|
4
4
|
/** One pre-login step (cookie banner, locale picker) shared by the browser-driving strategies. */
|
|
5
5
|
export declare const PreStep: z.ZodObject<{
|
|
6
|
-
action: z.ZodEnum<
|
|
6
|
+
action: z.ZodEnum<{
|
|
7
|
+
fill: "fill";
|
|
8
|
+
click: "click";
|
|
9
|
+
}>;
|
|
7
10
|
selector: z.ZodString;
|
|
8
|
-
/** Env var *name* holding the fill value (required for `fill`). */
|
|
9
11
|
value_env: z.ZodOptional<z.ZodString>;
|
|
10
|
-
},
|
|
11
|
-
selector: string;
|
|
12
|
-
action: "fill" | "click";
|
|
13
|
-
value_env?: string | undefined;
|
|
14
|
-
}, {
|
|
15
|
-
selector: string;
|
|
16
|
-
action: "fill" | "click";
|
|
17
|
-
value_env?: string | undefined;
|
|
18
|
-
}>;
|
|
12
|
+
}, z.core.$strict>;
|
|
19
13
|
export type PreStep = z.infer<typeof PreStep>;
|
|
20
14
|
/** Read a required env var by *name*; missing/empty → config error that never echoes a value. */
|
|
21
15
|
export declare function requireEnvVar(strategy: string, what: string, varName: string, env: NodeJS.ProcessEnv): string;
|
|
@@ -24,169 +18,46 @@ export declare function resolvePreStepValues(strategy: string, steps: PreStep[],
|
|
|
24
18
|
/** Execute pre-login steps in order (`values` from {@link resolvePreStepValues}, index-aligned). */
|
|
25
19
|
export declare function runPreSteps(page: AuthPage, steps: PreStep[], values: string[]): Promise<void>;
|
|
26
20
|
export declare const UiFormTotpOptions: z.ZodObject<{
|
|
27
|
-
/** Env var *name* holding the base32 TOTP secret. */
|
|
28
21
|
secret_env: z.ZodString;
|
|
29
22
|
otp_selector: z.ZodString;
|
|
30
23
|
submit_selector: z.ZodOptional<z.ZodString>;
|
|
31
|
-
digits: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<6>, z.ZodLiteral<8>]>>;
|
|
24
|
+
digits: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<6>, z.ZodLiteral<8>]>>;
|
|
32
25
|
period: z.ZodDefault<z.ZodNumber>;
|
|
33
|
-
algorithm: z.ZodDefault<z.ZodEnum<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
secret_env: string;
|
|
39
|
-
otp_selector: string;
|
|
40
|
-
submit_selector?: string | undefined;
|
|
41
|
-
}, {
|
|
42
|
-
secret_env: string;
|
|
43
|
-
otp_selector: string;
|
|
44
|
-
digits?: 8 | 6 | undefined;
|
|
45
|
-
period?: number | undefined;
|
|
46
|
-
algorithm?: "sha1" | "sha256" | undefined;
|
|
47
|
-
submit_selector?: string | undefined;
|
|
48
|
-
}>;
|
|
26
|
+
algorithm: z.ZodDefault<z.ZodEnum<{
|
|
27
|
+
sha1: "sha1";
|
|
28
|
+
sha256: "sha256";
|
|
29
|
+
}>>;
|
|
30
|
+
}, z.core.$strict>;
|
|
49
31
|
export type UiFormTotpOptions = z.infer<typeof UiFormTotpOptions>;
|
|
50
|
-
export declare const UiFormOptions: z.
|
|
51
|
-
/** Login page; resolved against the target's base URL when relative. */
|
|
32
|
+
export declare const UiFormOptions: z.ZodObject<{
|
|
52
33
|
login_url: z.ZodString;
|
|
53
34
|
username_selector: z.ZodString;
|
|
54
35
|
password_selector: z.ZodString;
|
|
55
36
|
submit_selector: z.ZodString;
|
|
56
|
-
/** Logged-in marker: a selector that appears… */
|
|
57
37
|
success_selector: z.ZodOptional<z.ZodString>;
|
|
58
|
-
/** …or a regex (source) the post-login URL matches. One of the two is required. */
|
|
59
38
|
url_matches: z.ZodOptional<z.ZodString>;
|
|
60
|
-
/** Per-wait timeout. Default 15000. */
|
|
61
39
|
timeout_ms: z.ZodDefault<z.ZodNumber>;
|
|
62
40
|
ignore_https_errors: z.ZodDefault<z.ZodBoolean>;
|
|
63
|
-
/** Pre-login chrome (cookie banners, locale pickers): clicked / filled before the form. */
|
|
64
41
|
pre_steps: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
65
|
-
action: z.ZodEnum<
|
|
42
|
+
action: z.ZodEnum<{
|
|
43
|
+
fill: "fill";
|
|
44
|
+
click: "click";
|
|
45
|
+
}>;
|
|
66
46
|
selector: z.ZodString;
|
|
67
|
-
/** Env var *name* holding the fill value (required for `fill`). */
|
|
68
47
|
value_env: z.ZodOptional<z.ZodString>;
|
|
69
|
-
},
|
|
70
|
-
selector: string;
|
|
71
|
-
action: "fill" | "click";
|
|
72
|
-
value_env?: string | undefined;
|
|
73
|
-
}, {
|
|
74
|
-
selector: string;
|
|
75
|
-
action: "fill" | "click";
|
|
76
|
-
value_env?: string | undefined;
|
|
77
|
-
}>, "many">>;
|
|
48
|
+
}, z.core.$strict>>>;
|
|
78
49
|
totp: z.ZodOptional<z.ZodObject<{
|
|
79
|
-
/** Env var *name* holding the base32 TOTP secret. */
|
|
80
50
|
secret_env: z.ZodString;
|
|
81
51
|
otp_selector: z.ZodString;
|
|
82
52
|
submit_selector: z.ZodOptional<z.ZodString>;
|
|
83
|
-
digits: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<6>, z.ZodLiteral<8>]>>;
|
|
53
|
+
digits: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<6>, z.ZodLiteral<8>]>>;
|
|
84
54
|
period: z.ZodDefault<z.ZodNumber>;
|
|
85
|
-
algorithm: z.ZodDefault<z.ZodEnum<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
otp_selector: string;
|
|
92
|
-
submit_selector?: string | undefined;
|
|
93
|
-
}, {
|
|
94
|
-
secret_env: string;
|
|
95
|
-
otp_selector: string;
|
|
96
|
-
digits?: 8 | 6 | undefined;
|
|
97
|
-
period?: number | undefined;
|
|
98
|
-
algorithm?: "sha1" | "sha256" | undefined;
|
|
99
|
-
submit_selector?: string | undefined;
|
|
100
|
-
}>>;
|
|
101
|
-
}, "strict", z.ZodTypeAny, {
|
|
102
|
-
timeout_ms: number;
|
|
103
|
-
login_url: string;
|
|
104
|
-
ignore_https_errors: boolean;
|
|
105
|
-
submit_selector: string;
|
|
106
|
-
username_selector: string;
|
|
107
|
-
password_selector: string;
|
|
108
|
-
pre_steps: {
|
|
109
|
-
selector: string;
|
|
110
|
-
action: "fill" | "click";
|
|
111
|
-
value_env?: string | undefined;
|
|
112
|
-
}[];
|
|
113
|
-
url_matches?: string | undefined;
|
|
114
|
-
totp?: {
|
|
115
|
-
digits: 8 | 6;
|
|
116
|
-
period: number;
|
|
117
|
-
algorithm: "sha1" | "sha256";
|
|
118
|
-
secret_env: string;
|
|
119
|
-
otp_selector: string;
|
|
120
|
-
submit_selector?: string | undefined;
|
|
121
|
-
} | undefined;
|
|
122
|
-
success_selector?: string | undefined;
|
|
123
|
-
}, {
|
|
124
|
-
login_url: string;
|
|
125
|
-
submit_selector: string;
|
|
126
|
-
username_selector: string;
|
|
127
|
-
password_selector: string;
|
|
128
|
-
timeout_ms?: number | undefined;
|
|
129
|
-
url_matches?: string | undefined;
|
|
130
|
-
totp?: {
|
|
131
|
-
secret_env: string;
|
|
132
|
-
otp_selector: string;
|
|
133
|
-
digits?: 8 | 6 | undefined;
|
|
134
|
-
period?: number | undefined;
|
|
135
|
-
algorithm?: "sha1" | "sha256" | undefined;
|
|
136
|
-
submit_selector?: string | undefined;
|
|
137
|
-
} | undefined;
|
|
138
|
-
ignore_https_errors?: boolean | undefined;
|
|
139
|
-
success_selector?: string | undefined;
|
|
140
|
-
pre_steps?: {
|
|
141
|
-
selector: string;
|
|
142
|
-
action: "fill" | "click";
|
|
143
|
-
value_env?: string | undefined;
|
|
144
|
-
}[] | undefined;
|
|
145
|
-
}>, {
|
|
146
|
-
timeout_ms: number;
|
|
147
|
-
login_url: string;
|
|
148
|
-
ignore_https_errors: boolean;
|
|
149
|
-
submit_selector: string;
|
|
150
|
-
username_selector: string;
|
|
151
|
-
password_selector: string;
|
|
152
|
-
pre_steps: {
|
|
153
|
-
selector: string;
|
|
154
|
-
action: "fill" | "click";
|
|
155
|
-
value_env?: string | undefined;
|
|
156
|
-
}[];
|
|
157
|
-
url_matches?: string | undefined;
|
|
158
|
-
totp?: {
|
|
159
|
-
digits: 8 | 6;
|
|
160
|
-
period: number;
|
|
161
|
-
algorithm: "sha1" | "sha256";
|
|
162
|
-
secret_env: string;
|
|
163
|
-
otp_selector: string;
|
|
164
|
-
submit_selector?: string | undefined;
|
|
165
|
-
} | undefined;
|
|
166
|
-
success_selector?: string | undefined;
|
|
167
|
-
}, {
|
|
168
|
-
login_url: string;
|
|
169
|
-
submit_selector: string;
|
|
170
|
-
username_selector: string;
|
|
171
|
-
password_selector: string;
|
|
172
|
-
timeout_ms?: number | undefined;
|
|
173
|
-
url_matches?: string | undefined;
|
|
174
|
-
totp?: {
|
|
175
|
-
secret_env: string;
|
|
176
|
-
otp_selector: string;
|
|
177
|
-
digits?: 8 | 6 | undefined;
|
|
178
|
-
period?: number | undefined;
|
|
179
|
-
algorithm?: "sha1" | "sha256" | undefined;
|
|
180
|
-
submit_selector?: string | undefined;
|
|
181
|
-
} | undefined;
|
|
182
|
-
ignore_https_errors?: boolean | undefined;
|
|
183
|
-
success_selector?: string | undefined;
|
|
184
|
-
pre_steps?: {
|
|
185
|
-
selector: string;
|
|
186
|
-
action: "fill" | "click";
|
|
187
|
-
value_env?: string | undefined;
|
|
188
|
-
}[] | undefined;
|
|
189
|
-
}>;
|
|
55
|
+
algorithm: z.ZodDefault<z.ZodEnum<{
|
|
56
|
+
sha1: "sha1";
|
|
57
|
+
sha256: "sha256";
|
|
58
|
+
}>>;
|
|
59
|
+
}, z.core.$strict>>;
|
|
60
|
+
}, z.core.$strict>;
|
|
190
61
|
export type UiFormOptions = z.infer<typeof UiFormOptions>;
|
|
191
62
|
export declare class UiFormStrategy implements AuthStrategy {
|
|
192
63
|
private readonly launcher;
|
package/dist/auth/ui-form.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// `ui-form
|
|
1
|
+
// `ui-form`: drive the app's own login form in a headless Chromium: fill username/password,
|
|
2
2
|
// submit, wait for the logged-in marker, snapshot storageState. `pre_steps` dismiss cookie
|
|
3
3
|
// banners and similar pre-login chrome; `options.totp` hooks an RFC-6238 one-time code in after
|
|
4
4
|
// the password submit (the `totp` catalogue entry composes this strategy).
|
|
@@ -75,7 +75,7 @@ export const UiFormOptions = z
|
|
|
75
75
|
})
|
|
76
76
|
.strict()
|
|
77
77
|
.refine((o) => o.success_selector !== undefined || o.url_matches !== undefined, {
|
|
78
|
-
|
|
78
|
+
error: "one of success_selector or url_matches is required",
|
|
79
79
|
});
|
|
80
80
|
export class UiFormStrategy {
|
|
81
81
|
launcher;
|
|
@@ -148,6 +148,6 @@ export async function waitForLoginSuccess(page, opts, strategy) {
|
|
|
148
148
|
const expected = opts.success_selector !== undefined
|
|
149
149
|
? `success_selector "${opts.success_selector}"`
|
|
150
150
|
: `url matching /${opts.url_matches}/`;
|
|
151
|
-
throw new AuthStrategyConfigError(`${strategy}: login did not reach ${expected} within ${opts.timeout_ms}ms
|
|
151
|
+
throw new AuthStrategyConfigError(`${strategy}: login did not reach ${expected} within ${opts.timeout_ms}ms; check the credential env vars (values not shown) and the selectors`);
|
|
152
152
|
}
|
|
153
153
|
}
|
package/dist/auth/webauthn.d.ts
CHANGED
|
@@ -1,83 +1,23 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type AuthPageLauncher } from "./browser-session.js";
|
|
3
3
|
import { type AuthContext, type AuthResult, type AuthStrategy } from "./types.js";
|
|
4
|
-
export declare const WebauthnOptions: z.
|
|
5
|
-
/** Login page; resolved against the target's base URL when relative. */
|
|
4
|
+
export declare const WebauthnOptions: z.ZodObject<{
|
|
6
5
|
login_url: z.ZodString;
|
|
7
|
-
/** The "Sign in with a passkey" control that starts the WebAuthn ceremony. */
|
|
8
6
|
trigger_selector: z.ZodString;
|
|
9
|
-
/** Username-first flows: filled with the `username` credential before the trigger. */
|
|
10
7
|
username_selector: z.ZodOptional<z.ZodString>;
|
|
11
8
|
success_selector: z.ZodOptional<z.ZodString>;
|
|
12
9
|
url_matches: z.ZodOptional<z.ZodString>;
|
|
13
10
|
timeout_ms: z.ZodDefault<z.ZodNumber>;
|
|
14
11
|
ignore_https_errors: z.ZodDefault<z.ZodBoolean>;
|
|
15
12
|
pre_steps: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
16
|
-
action: z.ZodEnum<
|
|
13
|
+
action: z.ZodEnum<{
|
|
14
|
+
fill: "fill";
|
|
15
|
+
click: "click";
|
|
16
|
+
}>;
|
|
17
17
|
selector: z.ZodString;
|
|
18
18
|
value_env: z.ZodOptional<z.ZodString>;
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
action: "fill" | "click";
|
|
22
|
-
value_env?: string | undefined;
|
|
23
|
-
}, {
|
|
24
|
-
selector: string;
|
|
25
|
-
action: "fill" | "click";
|
|
26
|
-
value_env?: string | undefined;
|
|
27
|
-
}>, "many">>;
|
|
28
|
-
}, "strict", z.ZodTypeAny, {
|
|
29
|
-
timeout_ms: number;
|
|
30
|
-
login_url: string;
|
|
31
|
-
ignore_https_errors: boolean;
|
|
32
|
-
pre_steps: {
|
|
33
|
-
selector: string;
|
|
34
|
-
action: "fill" | "click";
|
|
35
|
-
value_env?: string | undefined;
|
|
36
|
-
}[];
|
|
37
|
-
trigger_selector: string;
|
|
38
|
-
url_matches?: string | undefined;
|
|
39
|
-
username_selector?: string | undefined;
|
|
40
|
-
success_selector?: string | undefined;
|
|
41
|
-
}, {
|
|
42
|
-
login_url: string;
|
|
43
|
-
trigger_selector: string;
|
|
44
|
-
timeout_ms?: number | undefined;
|
|
45
|
-
url_matches?: string | undefined;
|
|
46
|
-
ignore_https_errors?: boolean | undefined;
|
|
47
|
-
username_selector?: string | undefined;
|
|
48
|
-
success_selector?: string | undefined;
|
|
49
|
-
pre_steps?: {
|
|
50
|
-
selector: string;
|
|
51
|
-
action: "fill" | "click";
|
|
52
|
-
value_env?: string | undefined;
|
|
53
|
-
}[] | undefined;
|
|
54
|
-
}>, {
|
|
55
|
-
timeout_ms: number;
|
|
56
|
-
login_url: string;
|
|
57
|
-
ignore_https_errors: boolean;
|
|
58
|
-
pre_steps: {
|
|
59
|
-
selector: string;
|
|
60
|
-
action: "fill" | "click";
|
|
61
|
-
value_env?: string | undefined;
|
|
62
|
-
}[];
|
|
63
|
-
trigger_selector: string;
|
|
64
|
-
url_matches?: string | undefined;
|
|
65
|
-
username_selector?: string | undefined;
|
|
66
|
-
success_selector?: string | undefined;
|
|
67
|
-
}, {
|
|
68
|
-
login_url: string;
|
|
69
|
-
trigger_selector: string;
|
|
70
|
-
timeout_ms?: number | undefined;
|
|
71
|
-
url_matches?: string | undefined;
|
|
72
|
-
ignore_https_errors?: boolean | undefined;
|
|
73
|
-
username_selector?: string | undefined;
|
|
74
|
-
success_selector?: string | undefined;
|
|
75
|
-
pre_steps?: {
|
|
76
|
-
selector: string;
|
|
77
|
-
action: "fill" | "click";
|
|
78
|
-
value_env?: string | undefined;
|
|
79
|
-
}[] | undefined;
|
|
80
|
-
}>;
|
|
19
|
+
}, z.core.$strict>>>;
|
|
20
|
+
}, z.core.$strict>;
|
|
81
21
|
export type WebauthnOptions = z.infer<typeof WebauthnOptions>;
|
|
82
22
|
export declare class WebauthnStrategy implements AuthStrategy {
|
|
83
23
|
private readonly launcher;
|
package/dist/auth/webauthn.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// `webauthn
|
|
1
|
+
// `webauthn`: passkey login through a CDP virtual authenticator. The authenticator is attached
|
|
2
2
|
// *before* navigation (so the login page's `navigator.credentials` sees a platform authenticator
|
|
3
3
|
// from its first feature probe), then the strategy walks the page's own passkey flow: optional
|
|
4
4
|
// username-first fill, click the trigger, wait for the logged-in marker, snapshot storageState.
|
|
5
5
|
//
|
|
6
|
-
// The virtual device is ctap2 / internal / user-verifying with automatic presence simulation
|
|
6
|
+
// The virtual device is ctap2 / internal / user-verifying with automatic presence simulation,
|
|
7
7
|
// the standard headless-CI stand-in for Touch ID-style platform authenticators.
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { launchAuthPage } from "./browser-session.js";
|
|
@@ -26,7 +26,7 @@ export const WebauthnOptions = z
|
|
|
26
26
|
})
|
|
27
27
|
.strict()
|
|
28
28
|
.refine((o) => o.success_selector !== undefined || o.url_matches !== undefined, {
|
|
29
|
-
|
|
29
|
+
error: "one of success_selector or url_matches is required",
|
|
30
30
|
});
|
|
31
31
|
export class WebauthnStrategy {
|
|
32
32
|
launcher;
|
package/dist/auth.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// Target-site auth layer
|
|
1
|
+
// Target-site auth layer, re-export shim. The implementation lives under `auth/`
|
|
2
2
|
// (one module per strategy); existing imports of `./auth.js` keep working unchanged.
|
|
3
3
|
export * from "./auth/index.js";
|
|
@@ -24,7 +24,7 @@ export interface Revision {
|
|
|
24
24
|
author: string;
|
|
25
25
|
created_at: string;
|
|
26
26
|
artifacts: RevisionArtifact[];
|
|
27
|
-
/** True once finalized
|
|
27
|
+
/** True once finalized, artifact PUTs are rejected with 409 from then on. */
|
|
28
28
|
finalized: boolean;
|
|
29
29
|
}
|
|
30
30
|
export interface RunRecord {
|