@codemem/core 0.49.0-beta.1 → 0.49.0-beta.3
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/dist/better-sqlite-coordinator-store.d.ts +21 -2
- package/dist/better-sqlite-coordinator-store.d.ts.map +1 -1
- package/dist/coordinator-account-change-authority.d.ts +56 -0
- package/dist/coordinator-account-change-authority.d.ts.map +1 -0
- package/dist/coordinator-account-change-decision.d.ts +141 -0
- package/dist/coordinator-account-change-decision.d.ts.map +1 -0
- package/dist/coordinator-account-change-http-test-fixtures.d.ts +3 -1
- package/dist/coordinator-account-change-http-test-fixtures.d.ts.map +1 -1
- package/dist/coordinator-account-change-original-sql-test-fixtures.d.ts +61 -0
- package/dist/coordinator-account-change-original-sql-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-account-change.d.ts +7 -1
- package/dist/coordinator-account-change.d.ts.map +1 -1
- package/dist/coordinator-account-connection-link.d.ts +1 -1
- package/dist/coordinator-account-connection-link.d.ts.map +1 -1
- package/dist/coordinator-account-connection-schema.d.ts +31 -0
- package/dist/coordinator-account-connection-schema.d.ts.map +1 -1
- package/dist/coordinator-account-connection-session.d.ts +9 -0
- package/dist/coordinator-account-connection-session.d.ts.map +1 -1
- package/dist/coordinator-account-historical-revoke-original-sql-test-fixtures.d.ts +7 -0
- package/dist/coordinator-account-historical-revoke-original-sql-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-account-historical-revoke.d.ts +8 -2
- package/dist/coordinator-account-historical-revoke.d.ts.map +1 -1
- package/dist/coordinator-account-link-status-client.d.ts +4 -0
- package/dist/coordinator-account-link-status-client.d.ts.map +1 -1
- package/dist/coordinator-account-link-status.d.ts.map +1 -1
- package/dist/coordinator-account-schema-sqlite-test-fixtures.d.ts +58 -0
- package/dist/coordinator-account-schema-sqlite-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-account-schema-test-fixtures.d.ts +20 -0
- package/dist/coordinator-account-schema-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-api.d.ts.map +1 -1
- package/dist/coordinator-auth-browser-owner-purpose-test-harness.d.ts.map +1 -1
- package/dist/coordinator-auth-browser-transaction-test-fixtures.d.ts.map +1 -1
- package/dist/coordinator-auth-browser-transaction.d.ts.map +1 -1
- package/dist/coordinator-auth-controller-consistency-test-fixtures.d.ts +5 -1
- package/dist/coordinator-auth-controller-consistency-test-fixtures.d.ts.map +1 -1
- package/dist/coordinator-auth-controller-history.d.ts +0 -1
- package/dist/coordinator-auth-controller-history.d.ts.map +1 -1
- package/dist/coordinator-auth-controller-original-sql-test-fixtures.d.ts +41 -0
- package/dist/coordinator-auth-controller-original-sql-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-auth-controller-owner.d.ts +0 -6
- package/dist/coordinator-auth-controller-owner.d.ts.map +1 -1
- package/dist/coordinator-auth-controller-race-test-fixtures.d.ts +38 -0
- package/dist/coordinator-auth-controller-race-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-auth-controller-read-set.d.ts +47 -0
- package/dist/coordinator-auth-controller-read-set.d.ts.map +1 -0
- package/dist/coordinator-auth-controller-stages-original-sql-test-fixtures.d.ts +8 -0
- package/dist/coordinator-auth-controller-stages-original-sql-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-auth-controller.d.ts +1 -21
- package/dist/coordinator-auth-controller.d.ts.map +1 -1
- package/dist/coordinator-auth-device-claim-eligibility.d.ts +51 -2
- package/dist/coordinator-auth-device-claim-eligibility.d.ts.map +1 -1
- package/dist/coordinator-auth-historical-store-test-fixture.d.ts +2 -0
- package/dist/coordinator-auth-historical-store-test-fixture.d.ts.map +1 -1
- package/dist/coordinator-auth-legacy-assignment.d.ts +4 -2
- package/dist/coordinator-auth-legacy-assignment.d.ts.map +1 -1
- package/dist/coordinator-auth-link-authority-upgrade.d.ts +5 -0
- package/dist/coordinator-auth-link-authority-upgrade.d.ts.map +1 -1
- package/dist/coordinator-auth-link-maintenance-fixtures.d.ts +2 -2
- package/dist/coordinator-auth-link-maintenance-fixtures.d.ts.map +1 -1
- package/dist/coordinator-auth-link-provenance.d.ts.map +1 -1
- package/dist/coordinator-auth-link-revocation-test-harness.d.ts.map +1 -1
- package/dist/coordinator-auth-link-test-fixtures.d.ts +26 -4
- package/dist/coordinator-auth-link-test-fixtures.d.ts.map +1 -1
- package/dist/coordinator-auth-link.d.ts +5 -0
- package/dist/coordinator-auth-link.d.ts.map +1 -1
- package/dist/coordinator-auth-read-set.d.ts +99 -0
- package/dist/coordinator-auth-read-set.d.ts.map +1 -0
- package/dist/coordinator-auth-schema-stage.d.ts +36 -0
- package/dist/coordinator-auth-schema-stage.d.ts.map +1 -0
- package/dist/coordinator-auth-schema.d.ts.map +1 -1
- package/dist/coordinator-auth-session.d.ts.map +1 -1
- package/dist/coordinator-auth-store-test-fixtures.d.ts +12 -0
- package/dist/coordinator-auth-store-test-fixtures.d.ts.map +1 -1
- package/dist/coordinator-controller-revocation-test-harness.d.ts.map +1 -1
- package/dist/coordinator-d1-schema-inventory.d.ts +10 -0
- package/dist/coordinator-d1-schema-inventory.d.ts.map +1 -0
- package/dist/coordinator-device-claim-binding-contract.d.ts +37 -0
- package/dist/coordinator-device-claim-binding-contract.d.ts.map +1 -0
- package/dist/coordinator-device-claim-binding-reuse.d.ts +23 -0
- package/dist/coordinator-device-claim-binding-reuse.d.ts.map +1 -0
- package/dist/coordinator-device-claim-binding-sql.d.ts +40 -0
- package/dist/coordinator-device-claim-binding-sql.d.ts.map +1 -0
- package/dist/coordinator-device-claim-binding.d.ts +21 -0
- package/dist/coordinator-device-claim-binding.d.ts.map +1 -0
- package/dist/coordinator-device-ownership-evidence-original-sql-test-fixtures.d.ts +88 -0
- package/dist/coordinator-device-ownership-evidence-original-sql-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-device-ownership-evidence-queries.d.ts +4 -14
- package/dist/coordinator-device-ownership-evidence-queries.d.ts.map +1 -1
- package/dist/coordinator-device-ownership-evidence-test-fixtures.d.ts +10 -0
- package/dist/coordinator-device-ownership-evidence-test-fixtures.d.ts.map +1 -1
- package/dist/coordinator-device-ownership-evidence.d.ts +11 -3
- package/dist/coordinator-device-ownership-evidence.d.ts.map +1 -1
- package/dist/coordinator-device-rebind-ceremony.d.ts +2 -1
- package/dist/coordinator-device-rebind-ceremony.d.ts.map +1 -1
- package/dist/coordinator-device-rebind-commit.d.ts.map +1 -1
- package/dist/coordinator-device-rebind-proof.d.ts +1 -0
- package/dist/coordinator-device-rebind-proof.d.ts.map +1 -1
- package/dist/coordinator-device-rebind-schema.d.ts +4 -3
- package/dist/coordinator-device-rebind-schema.d.ts.map +1 -1
- package/dist/coordinator-device-rebind-test-fixtures.d.ts.map +1 -1
- package/dist/coordinator-device-self-bind-authority.d.ts +29 -0
- package/dist/coordinator-device-self-bind-authority.d.ts.map +1 -0
- package/dist/coordinator-device-self-bind-decision.d.ts +84 -0
- package/dist/coordinator-device-self-bind-decision.d.ts.map +1 -0
- package/dist/coordinator-device-self-bind-original-sql-test-fixtures.d.ts +17 -0
- package/dist/coordinator-device-self-bind-original-sql-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-device-self-bind-test-fixtures.d.ts +114 -0
- package/dist/coordinator-device-self-bind-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-device-setup-client.d.ts +26 -0
- package/dist/coordinator-device-setup-client.d.ts.map +1 -0
- package/dist/coordinator-device-setup-http.d.ts +9 -0
- package/dist/coordinator-device-setup-http.d.ts.map +1 -0
- package/dist/coordinator-history-sql-equivalence-test-fixtures.d.ts +6 -2
- package/dist/coordinator-history-sql-equivalence-test-fixtures.d.ts.map +1 -1
- package/dist/coordinator-legacy-completion-owner-proof-original-sql-test-fixtures.d.ts +77 -0
- package/dist/coordinator-legacy-completion-owner-proof-original-sql-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-legacy-completion-owner-proof-test-fixtures.d.ts +46 -0
- package/dist/coordinator-legacy-completion-owner-proof-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-legacy-completion-owner-proof.d.ts +19 -2
- package/dist/coordinator-legacy-completion-owner-proof.d.ts.map +1 -1
- package/dist/coordinator-legacy-owner-compatibility.d.ts +23 -0
- package/dist/coordinator-legacy-owner-compatibility.d.ts.map +1 -1
- package/dist/coordinator-legacy-owner-resolution-commit-original-sql-test-fixtures.d.ts +63 -0
- package/dist/coordinator-legacy-owner-resolution-commit-original-sql-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-legacy-owner-resolution-commit-test-fixtures.d.ts +3 -1
- package/dist/coordinator-legacy-owner-resolution-commit-test-fixtures.d.ts.map +1 -1
- package/dist/coordinator-legacy-owner-resolution-commit.d.ts.map +1 -1
- package/dist/coordinator-owner-enrollment-commit.d.ts.map +1 -1
- package/dist/coordinator-owner-enrollment-historical-test-fixture.d.ts +2 -0
- package/dist/coordinator-owner-enrollment-historical-test-fixture.d.ts.map +1 -1
- package/dist/coordinator-owner-enrollment-start-test-fixtures.d.ts.map +1 -1
- package/dist/coordinator-owner-negative-consistency.d.ts +11 -17
- package/dist/coordinator-owner-negative-consistency.d.ts.map +1 -1
- package/dist/coordinator-owner-negative-original-sql-test-fixtures.d.ts +44 -0
- package/dist/coordinator-owner-negative-original-sql-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-owner-negative-race-test-fixtures.d.ts +26 -0
- package/dist/coordinator-owner-negative-race-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-owner-negative-read-set.d.ts +43 -0
- package/dist/coordinator-owner-negative-read-set.d.ts.map +1 -0
- package/dist/coordinator-owner-negative-reads.d.ts +32 -0
- package/dist/coordinator-owner-negative-reads.d.ts.map +1 -0
- package/dist/coordinator-owner-producer-original-sql-test-fixtures.d.ts +26 -0
- package/dist/coordinator-owner-producer-original-sql-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-owner-resolution-review-test-fixtures.d.ts +1 -0
- package/dist/coordinator-owner-resolution-review-test-fixtures.d.ts.map +1 -1
- package/dist/coordinator-owner-resolution-review.d.ts +1 -0
- package/dist/coordinator-owner-resolution-review.d.ts.map +1 -1
- package/dist/coordinator-producer-negative-owner-test-fixtures.d.ts +8 -2
- package/dist/coordinator-producer-negative-owner-test-fixtures.d.ts.map +1 -1
- package/dist/coordinator-recipient-negative-race-test-fixtures.d.ts +54 -0
- package/dist/coordinator-recipient-negative-race-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-recipient-owner-consistency.d.ts +4 -5
- package/dist/coordinator-recipient-owner-consistency.d.ts.map +1 -1
- package/dist/coordinator-recipient-owner-original-sql-test-fixtures.d.ts +30 -0
- package/dist/coordinator-recipient-owner-original-sql-test-fixtures.d.ts.map +1 -0
- package/dist/coordinator-resolved-account-owner-status-query.d.ts +4 -1
- package/dist/coordinator-resolved-account-owner-status-query.d.ts.map +1 -1
- package/dist/coordinator-resolved-account-owner-status-test-fixtures.d.ts +1 -0
- package/dist/coordinator-resolved-account-owner-status-test-fixtures.d.ts.map +1 -1
- package/dist/coordinator-resolved-account-owner-status.d.ts +2 -0
- package/dist/coordinator-resolved-account-owner-status.d.ts.map +1 -1
- package/dist/{coordinator-runtime-Bdad5KeL.js → coordinator-runtime-BXJQAKFD.js} +3 -3
- package/dist/{coordinator-runtime-Bdad5KeL.js.map → coordinator-runtime-BXJQAKFD.js.map} +1 -1
- package/dist/coordinator-sql-compare.d.ts +22 -0
- package/dist/coordinator-sql-compare.d.ts.map +1 -0
- package/dist/d1-coordinator-store.d.ts +16 -1
- package/dist/d1-coordinator-store.d.ts.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9048 -8412
- package/dist/index.js.map +1 -1
- package/dist/ingest-events.d.ts.map +1 -1
- package/dist/ingest-pipeline.d.ts +38 -2
- package/dist/ingest-pipeline.d.ts.map +1 -1
- package/dist/internal/cloudflare-coordinator.js +1079 -1074
- package/dist/internal/cloudflare-coordinator.js.map +1 -1
- package/dist/internal/relay-runtime.js +2 -2
- package/dist/linked-legacy-setup-test-fixtures.d.ts +71 -0
- package/dist/linked-legacy-setup-test-fixtures.d.ts.map +1 -0
- package/dist/operational-status.d.ts +3 -0
- package/dist/operational-status.d.ts.map +1 -1
- package/dist/{owner-enrollment-start-DgToUaFZ.js → owner-enrollment-start-BFyBKWvZ.js} +2731 -2315
- package/dist/owner-enrollment-start-BFyBKWvZ.js.map +1 -0
- package/dist/owner-enrollment-start.d.ts.map +1 -1
- package/dist/owner-qualified-consumer-access-test-harness.d.ts.map +1 -1
- package/dist/owner-qualified-consumer-adversarial-test-harness.d.ts +1 -1
- package/dist/owner-qualified-consumer-adversarial-test-harness.d.ts.map +1 -1
- package/dist/owner-qualified-consumer-test-harness.d.ts +3 -0
- package/dist/owner-qualified-consumer-test-harness.d.ts.map +1 -1
- package/dist/owner-qualified-headless-test-harness.d.ts +1 -1
- package/dist/owner-qualified-headless-test-harness.d.ts.map +1 -1
- package/dist/project-scope-settings.d.ts.map +1 -1
- package/dist/raw-event-flush.d.ts.map +1 -1
- package/dist/relay-admission-table-keys-test-fixtures.d.ts +2 -1
- package/dist/relay-admission-table-keys-test-fixtures.d.ts.map +1 -1
- package/dist/{relay-peer-client-DdhDwDFz.js → relay-peer-client-DrTb2oZt.js} +2650 -2627
- package/dist/relay-peer-client-DrTb2oZt.js.map +1 -0
- package/dist/{sync-auth-constants-WKqJ9CX5.js → sync-auth-constants-BVzVfSmn.js} +4476 -3521
- package/dist/sync-auth-constants-BVzVfSmn.js.map +1 -0
- package/dist/{sync-reachability-pass-CSg85Qmd.js → sync-reachability-pass-CUe5bK61.js} +12 -12
- package/dist/{sync-reachability-pass-CSg85Qmd.js.map → sync-reachability-pass-CUe5bK61.js.map} +1 -1
- package/dist/sync-reachability-pass-D9cA54fj.js +2 -0
- package/package.json +3 -3
- package/dist/owner-enrollment-start-DgToUaFZ.js.map +0 -1
- package/dist/relay-peer-client-DdhDwDFz.js.map +0 -1
- package/dist/sync-auth-constants-WKqJ9CX5.js.map +0 -1
- package/dist/sync-reachability-pass-CQe7nZnN.js +0 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AuthLinkBackend, AuthLinkStatement } from "./coordinator-auth-link.js";
|
|
2
2
|
import type { CoordinatorAuthLinkConfig, CoordinatorAuthLinkSigner } from "./coordinator-auth-link-contract.js";
|
|
3
|
+
import type { AuthRead } from "./coordinator-auth-read-set.js";
|
|
3
4
|
export interface CoordinatorDeviceClaimReadinessInput {
|
|
4
5
|
/** The authenticated enrollment and the caller's pinned current local Identity. */
|
|
5
6
|
signer: CoordinatorAuthLinkSigner;
|
|
@@ -14,12 +15,34 @@ export type CoordinatorDeviceClaimReadiness = {
|
|
|
14
15
|
} | {
|
|
15
16
|
kind: "unavailable";
|
|
16
17
|
};
|
|
17
|
-
/**
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Read-set form of the key list: one JSON string per distinct stored text key, in key
|
|
20
|
+
* order. Its guard keeps the rule of AUTH_DEVICE_CLAIM_CURRENT_SUBJECT_COMPATIBLE_SQL:
|
|
21
|
+
* no stored key may be outside the list that was classified. A key that disappears
|
|
22
|
+
* leaves the classification valid, so it does not abort the write.
|
|
23
|
+
*/
|
|
24
|
+
export declare const AUTH_DEVICE_CLAIM_KEYS_READ: AuthRead;
|
|
25
|
+
/** Shared by readiness and INSERT/transition guards; 15 inputs bound once.
|
|
26
|
+
* Predicates read the key lists with json_each(p.same_keys) and json_each(p.key_snapshot)
|
|
27
|
+
* instead of the two key CTEs. SQLite 3.54.0 and 3.54.1 (production D1) refuse a statement
|
|
28
|
+
* that resolves a CTE name after about 100 table references, and each CTE reference counts
|
|
29
|
+
* every table in its body again.
|
|
30
|
+
*/
|
|
31
|
+
export declare const AUTH_DEVICE_CLAIM_INPUT_SQL = "WITH claim_input(\n coordinator_id, identity_id, group_id, device_id, public_key, fingerprint, key_id,\n now_ms, now_iso, attempt_id, issuer, revision, key_snapshot, same_keys, assignment_snapshot\n) AS (VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?))";
|
|
32
|
+
/** The same 15 inputs as one FROM row, for statements that must not use WITH. */
|
|
33
|
+
export declare const AUTH_DEVICE_CLAIM_INPUT_ROW_SQL = "(SELECT ? AS coordinator_id, ? AS identity_id, ? AS group_id,\n ? AS device_id, ? AS public_key, ? AS fingerprint, ? AS key_id, ? AS now_ms, ? AS now_iso, ? AS attempt_id,\n ? AS issuer, ? AS revision, ? AS key_snapshot, ? AS same_keys, ? AS assignment_snapshot)";
|
|
19
34
|
/** Current requester contradictions and captured-assignment staleness deny access. */
|
|
20
35
|
export declare const AUTH_DEVICE_CLAIM_CURRENT_SUBJECT_COMPATIBLE_SQL: string;
|
|
36
|
+
/** Negative setup checks shared by first-link admission and legacy completion.
|
|
37
|
+
* p comes from AUTH_DEVICE_CLAIM_INPUT_SQL. Existing exact D/K/X
|
|
38
|
+
* ownership is compatible here. The producer decides whether to reuse it.
|
|
39
|
+
* This predicate never supplies positive authority or first-link absence rules.
|
|
40
|
+
*/
|
|
41
|
+
export declare const AUTH_DEVICE_CLAIM_BINDING_STRUCTURE_SQL = "(\n (SELECT count(*) FROM enrolled_devices e WHERE e.device_id=p.device_id) BETWEEN 1 AND 50\n AND NOT EXISTS (SELECT 1 FROM enrolled_devices e WHERE e.device_id=p.device_id\n AND (e.public_key<>p.public_key OR e.fingerprint<>p.fingerprint OR (e.identity_id IS NOT NULL AND e.identity_id<>p.identity_id)))\n AND NOT EXISTS (SELECT 1 FROM enrolled_devices e,json_each(p.same_keys) k WHERE e.public_key=k.value AND e.device_id<>p.device_id)\n ) AND (\n NOT EXISTS (SELECT 1 FROM coordinator_device_ownership_bindings b WHERE (b.device_id=p.device_id OR b.key_id=p.key_id)\n AND (b.device_id<>p.device_id OR b.key_id<>p.key_id OR b.identity_id<>p.identity_id OR b.coordinator_id<>p.coordinator_id))\n ) AND (\n NOT EXISTS (SELECT 1 FROM coordinator_owner_enrollment_attempts o WHERE o.coordinator_id=p.coordinator_id\n AND o.state IN ('pending','browser_claimed','oidc_verified','confirmed') AND o.expires_at_ms>p.now_ms\n AND (o.device_id=p.device_id OR o.key_id=p.key_id))\n AND NOT EXISTS (SELECT 1 FROM coordinator_device_rebind_attempts r WHERE r.coordinator_id=p.coordinator_id\n AND r.state IN ('pending','browser_claimed','oidc_verified','confirmed') AND r.expires_at_ms>p.now_ms\n AND (r.device_id=p.device_id OR r.key_id=p.key_id))\n AND NOT EXISTS (SELECT 1 FROM coordinator_auth_link_attempts a WHERE a.coordinator_id=p.coordinator_id\n AND a.state IN ('pending','browser_claimed','oidc_verified','confirmed') AND a.expires_at_ms>p.now_ms\n AND a.identity_id<>p.identity_id AND (a.device_id=p.device_id OR a.public_key IN (SELECT value FROM json_each(p.same_keys))))\n )";
|
|
21
42
|
/** A shared reader's own attestations are current checks, not historical origin pins. */
|
|
22
43
|
export declare const AUTH_DEVICE_CLAIM_REQUESTER_ATTESTATION_COMPATIBLE_SQL: string;
|
|
44
|
+
/** Alias i: an invite that was consumed and not revoked before its consumption. */
|
|
45
|
+
export declare const AUTH_DEVICE_CLAIM_INVITE_CONSUMED_SQL = "(i.consumed_at IS NOT NULL AND i.consumed_at <> '' AND (i.revoked_at IS NULL OR i.revoked_at > i.consumed_at))";
|
|
23
46
|
/** Consumed assignments survive removal/re-enrollment and later token revocation. */
|
|
24
47
|
export declare const AUTH_DEVICE_CLAIM_REQUESTER_INVITE_COMPATIBLE_SQL: string;
|
|
25
48
|
/** A completed other-Identity binding remains a contradiction without its old controller. */
|
|
@@ -42,6 +65,32 @@ interface CapturedClaimEligibility {
|
|
|
42
65
|
values: AuthLinkStatement["values"];
|
|
43
66
|
connectionSession: boolean;
|
|
44
67
|
}
|
|
68
|
+
/** A validated claim request with the canonical ID and raw bytes of its key. */
|
|
69
|
+
export interface DeviceClaimSubject {
|
|
70
|
+
config: CoordinatorAuthLinkConfig;
|
|
71
|
+
signer: CoordinatorAuthLinkSigner;
|
|
72
|
+
identityId: string;
|
|
73
|
+
attemptId: string | null;
|
|
74
|
+
keyId: string;
|
|
75
|
+
keyBlob: Uint8Array;
|
|
76
|
+
}
|
|
77
|
+
/** Validates the request and configuration and derives the key ID. Reads nothing. */
|
|
78
|
+
export declare function captureDeviceClaimSubject(input: CoordinatorDeviceClaimReadinessInput, config: CoordinatorAuthLinkConfig): Promise<DeviceClaimSubject | null>;
|
|
79
|
+
/** The three inputs of AUTH_LEGACY_ASSIGNMENT_CAPTURE_SQL for this subject. */
|
|
80
|
+
export declare function deviceClaimAssignmentInputs(subject: Pick<DeviceClaimSubject, "config" | "signer">): AuthLinkStatement["values"];
|
|
81
|
+
export interface DeviceClaimKeyFacts {
|
|
82
|
+
/** Every stored text key. */
|
|
83
|
+
keys: string[];
|
|
84
|
+
/** The stored text forms of the subject's own key. */
|
|
85
|
+
aliases: string[];
|
|
86
|
+
/** The legacy assignment this device relies on, or null when it has none. */
|
|
87
|
+
assignmentSnapshot: string | null;
|
|
88
|
+
}
|
|
89
|
+
/** Classifies the stored keys and the stored legacy assignment for the subject. */
|
|
90
|
+
export declare function deriveDeviceClaimKeyFacts(subject: DeviceClaimSubject, stored: {
|
|
91
|
+
keys: unknown;
|
|
92
|
+
assignment: string | null | undefined;
|
|
93
|
+
}): DeviceClaimKeyFacts;
|
|
45
94
|
/** Capture only server-derived key metadata; a later writer must include the SQL guard. */
|
|
46
95
|
export declare function captureDeviceClaimEligibility(backend: Pick<AuthLinkBackend, "first">, input: CoordinatorDeviceClaimReadinessInput, config: CoordinatorAuthLinkConfig, now: number): Promise<CapturedClaimEligibility | null>;
|
|
47
96
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator-auth-device-claim-eligibility.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-device-claim-eligibility.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EACX,yBAAyB,EACzB,yBAAyB,EACzB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"coordinator-auth-device-claim-eligibility.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-device-claim-eligibility.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EACX,yBAAyB,EACzB,yBAAyB,EACzB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAW/D,MAAM,WAAW,oCAAoC;IACpD,mFAAmF;IACnF,MAAM,EAAE,yBAAyB,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,MAAM,+BAA+B,GACxC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,cAAc,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACnE;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AAS3B;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,QASzC,CAAC;AAMF;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,sQAGoB,CAAC;AAE7D,iFAAiF;AACjF,eAAO,MAAM,+BAA+B,2QAE8C,CAAC;AAO3F,sFAAsF;AACtF,eAAO,MAAM,gDAAgD,QAS2B,CAAC;AAEzF;;;;GAIG;AACH,eAAO,MAAM,uCAAuC,gjDAkBjD,CAAC;AAEJ,yFAAyF;AACzF,eAAO,MAAM,sDAAsD,QAGA,CAAC;AAmBpE,mFAAmF;AACnF,eAAO,MAAM,qCAAqC,mHAAiB,CAAC;AAIpE,qFAAqF;AACrF,eAAO,MAAM,iDAAiD,QAIqB,CAAC;AAEpF,6FAA6F;AAC7F,eAAO,MAAM,+CAA+C,QAOiD,CAAC;AAqB9G,eAAO,MAAM,uCAAuC,QAE3B,CAAC;AAC1B;;;;G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,CAAC,eAAe,EAAE,OAAO,CAAC,EACvC,KAAK,EAAE,oCAAoC,EAC3C,MAAM,EAAE,yBAAyB,EACjC,GAAG,EAAE,MAAM,GACT,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAgC1C"}
|
|
@@ -6,6 +6,8 @@ export declare function historicalCallerMigrationNames(available: readonly strin
|
|
|
6
6
|
export declare function setupHistoricalStore(backend: Backend, options: {
|
|
7
7
|
history: HistoricalAccountOptions;
|
|
8
8
|
authClock?: () => number;
|
|
9
|
+
/** SQLite only: `v2` leaves the file as a V2 release opened it, without account management. */
|
|
10
|
+
accountSchema?: "current" | "v2";
|
|
9
11
|
}): Fixture & {
|
|
10
12
|
history: HistoricalAccountPins;
|
|
11
13
|
close(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator-auth-historical-store-test-fixture.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-historical-store-test-fixture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coordinator-auth-historical-store-test-fixture.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-historical-store-test-fixture.ts"],"names":[],"mappings":"AASA,OAAO,EACN,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAE1B,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,OAAO,EAGZ,MAAM,2CAA2C,CAAC;AA2CnD,2FAA2F;AAC3F,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,CAmB9F;AAED,oFAAoF;AACpF,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE;IACR,OAAO,EAAE,wBAAwB,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC;IACzB,+FAA+F;IAC/F,aAAa,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CACjC,GACC,OAAO,GAAG;IAAE,OAAO,EAAE,qBAAqB,CAAC;IAAC,KAAK,IAAI,IAAI,CAAA;CAAE,CAyC7D"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { CoordinatorAuthLinkSigner } from "./coordinator-auth-link-contract.js";
|
|
2
2
|
export declare const AUTH_LEGACY_ASSIGNMENT_CAPTURE_SQL = "SELECT json_object(\n 'group_id', group_id, 'candidate_ref', candidate_ref, 'manifest_version', manifest_version,\n 'completed_at', completed_at, 'manifest_json',\n CASE WHEN length(CAST(manifest_json AS BLOB)) <= ? THEN manifest_json ELSE NULL END)\n FROM coordinator_legacy_team_completions WHERE group_id = ? AND candidate_ref = ?";
|
|
3
|
+
/** Read-set form of the capture: the same object as one `row`, with the same three inputs. */
|
|
4
|
+
export declare const AUTH_LEGACY_ASSIGNMENT_READ_SQL = "SELECT row FROM (SELECT (SELECT json_object(\n 'group_id', group_id, 'candidate_ref', candidate_ref, 'manifest_version', manifest_version,\n 'completed_at', completed_at, 'manifest_json',\n CASE WHEN length(CAST(manifest_json AS BLOB)) <= ? THEN manifest_json ELSE NULL END)\n FROM coordinator_legacy_team_completions WHERE group_id = ? AND candidate_ref = ?) AS row)\n WHERE row IS NOT NULL";
|
|
3
5
|
/** A capture is not authority: every consumer must recheck it inside its statement. */
|
|
4
6
|
export declare function captureCurrentLegacyAssignment(snapshot: string | null | undefined, input: {
|
|
5
7
|
coordinatorId: string;
|
|
@@ -7,6 +9,6 @@ export declare function captureCurrentLegacyAssignment(snapshot: string | null |
|
|
|
7
9
|
signer: CoordinatorAuthLinkSigner;
|
|
8
10
|
distinctKeys: string[];
|
|
9
11
|
}): string | null;
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const AUTH_CURRENT_LEGACY_ASSIGNMENT_SQL
|
|
12
|
+
export declare const AUTH_CURRENT_LEGACY_ASSIGNMENT_ROWS_SQL: string;
|
|
13
|
+
export declare const AUTH_CURRENT_LEGACY_ASSIGNMENT_SQL: string;
|
|
12
14
|
//# sourceMappingURL=coordinator-auth-legacy-assignment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator-auth-legacy-assignment.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-legacy-assignment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAkBrF,eAAO,MAAM,kCAAkC,kVAIoC,CAAC;AAEpF,uFAAuF;AACvF,wBAAgB,8BAA8B,CAC7C,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,KAAK,EAAE;IACN,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,yBAAyB,CAAC;IAClC,YAAY,EAAE,MAAM,EAAE,CAAC;CACvB,GACC,MAAM,GAAG,IAAI,CA+Bf;
|
|
1
|
+
{"version":3,"file":"coordinator-auth-legacy-assignment.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-legacy-assignment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAkBrF,eAAO,MAAM,kCAAkC,kVAIoC,CAAC;AAEpF,8FAA8F;AAC9F,eAAO,MAAM,+BAA+B,4YACrB,CAAC;AAExB,uFAAuF;AACvF,wBAAgB,8BAA8B,CAC7C,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,KAAK,EAAE;IACN,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,yBAAyB,CAAC;IAClC,YAAY,EAAE,MAAM,EAAE,CAAC;CACvB,GACC,MAAM,GAAG,IAAI,CA+Bf;AAQD,eAAO,MAAM,uCAAuC,QAoBkB,CAAC;AAEvE,eAAO,MAAM,kCAAkC,QAAyE,CAAC"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { Database } from "better-sqlite3";
|
|
2
|
+
/**
|
|
3
|
+
* Read-only: 1 when the authority tables have exactly the legacy schema the cutover
|
|
4
|
+
* starts from. The cutover itself still validates every row before it changes anything.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AUTH_LINK_LEGACY_AUTHORITY_SCHEMA_SQL: string;
|
|
2
7
|
/**
|
|
3
8
|
* Exact D1 batch statements, deliberately outside the auto-discovered migration
|
|
4
9
|
* directory. No BEGIN/COMMIT or FK toggle. All assertions and comparisons precede
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator-auth-link-authority-upgrade.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-link-authority-upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"coordinator-auth-link-authority-upgrade.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-link-authority-upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAyM/C;;;GAGG;AACH,eAAO,MAAM,qCAAqC,QAAyI,CAAC;AA6G5L;;;;;;;;GAQG;AACH,eAAO,MAAM,+BAA+B,QAQ3C,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,sCAAsC,mBAMjD,CAAC;AAEH,eAAO,MAAM,+BAA+B,QAE1B,CAAC;AAEnB,uGAAuG;AACvG,wBAAgB,8BAA8B,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAEjE"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { CoordinatorAuthLinkSigner } from "./coordinator-auth-link-contract.js";
|
|
2
2
|
import { type LinkFixture } from "./coordinator-auth-link-test-fixtures.js";
|
|
3
3
|
export declare function numberedAttempt(n: number, actor?: {
|
|
4
|
-
groupId: string;
|
|
5
|
-
deviceId: string;
|
|
6
4
|
publicKey: string;
|
|
7
5
|
fingerprint: string;
|
|
6
|
+
groupId: string;
|
|
7
|
+
deviceId: string;
|
|
8
8
|
}): import("./coordinator-auth-link-contract.js").CoordinatorAuthLinkCreateInput;
|
|
9
9
|
export declare function digest(n: number): string;
|
|
10
10
|
export declare function actor(f: LinkFixture, suffix: string, identityId?: string, coordinatorId?: string): Promise<CoordinatorAuthLinkSigner>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator-auth-link-maintenance-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-link-maintenance-fixtures.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAEN,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"coordinator-auth-link-maintenance-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-link-maintenance-fixtures.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAEN,KAAK,WAAW,EAMhB,MAAM,0CAA0C,CAAC;AAGlD,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK;;;;;CAAS,gFAExD;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,UAE/B;AAED,wBAAsB,KAAK,CAC1B,CAAC,EAAE,WAAW,EACd,MAAM,EAAE,MAAM,EACd,UAAU,SAAe,EACzB,aAAa,SAAsB,GACjC,OAAO,CAAC,yBAAyB,CAAC,CAmBpC;AAID,wBAAgB,UAAU,CACzB,CAAC,EAAE,WAAW,EACd,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACvC,MAAM,SAAM,QAyBZ;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,QAIzD;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,WAAW,eASrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator-auth-link-provenance.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-link-provenance.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB,QAA6L,CAAC;AAMhO;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE;IACrD,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC;IACjB,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,MAAM,CAOT;
|
|
1
|
+
{"version":3,"file":"coordinator-auth-link-provenance.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-link-provenance.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB,QAA6L,CAAC;AAMhO;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE;IACrD,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC;IACjB,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,MAAM,CAOT;AAiCD,oFAAoF;AACpF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,GAAG,MAAM,CAG7D;AA+BD,wBAAgB,4BAA4B,CAC3C,IAAI,EAAE,GAAG,EACT,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACrC,MAAM,CAGR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator-auth-link-revocation-test-harness.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-link-revocation-test-harness.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coordinator-auth-link-revocation-test-harness.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-link-revocation-test-harness.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAE,GAAG,EAAO,MAAM,0CAA0C,CAAC;AAEpE,OAAO,EAEN,KAAK,iBAAiB,EACtB,MAAM,iDAAiD,CAAC;AAGzD,OAAO,EACN,kBAAkB,EAClB,KAAK,cAAc,EAEnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,GAAG,EAAE,CAAC;AACf,eAAO,MAAM,oBAAoB,YAChC,iCAAiC,EACjC,gCAAgC,EAChC,gCAAgC,EAChC,0CAA0C,EAC1C,gCAAgC,EAChC,kBAAkB,EAClB,QAAQ,CACC,CAAC;AACX,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AACxE,KAAK,IAAI,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AACtF,KAAK,OAAO,GAAG,CAAC,CAAC,EAAE,qBAAqB,EAAE,IAAI,EAAE,IAAI,KAAK,wBAAwB,CAAC;AAElF,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC;;GAK5E;AACD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAgHrD,wBAAgB,kCAAkC,CAAC,IAAI,EAAE,IAAI,QAS5D;AAyVD,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,MAAM,sBA0CpF;AACD,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,QA+BxE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { browserProofConfig, consumeSigninProof, startBrowserProof, } from "./coordinator-auth-browser-proof-test-fixtures.js";
|
|
2
2
|
import type { CoordinatorAuthLinkConfig as Config, CoordinatorAuthLinkCreateInput as CreateInput, CoordinatorAuthLinkFinalizeInput as FinalizeInput, CoordinatorAuthLinkRequester as Requester } from "./coordinator-auth-link-contract.js";
|
|
3
|
-
import { type Backend, type Fixture } from "./coordinator-auth-store-test-fixtures.js";
|
|
3
|
+
import { type Backend, type Fixture, review } from "./coordinator-auth-store-test-fixtures.js";
|
|
4
4
|
export declare const PURPOSE: "coordinator-account-link-v1";
|
|
5
5
|
export declare const TTL = 600000;
|
|
6
6
|
export declare const NOW = 1791028800000;
|
|
@@ -11,11 +11,25 @@ export type LinkFixture = Fixture & {
|
|
|
11
11
|
};
|
|
12
12
|
export type Test = ReturnType<typeof backendTest>;
|
|
13
13
|
export declare const cfg: Config;
|
|
14
|
+
export declare const deviceKey: {
|
|
15
|
+
publicKey: string;
|
|
16
|
+
fingerprint: string;
|
|
17
|
+
};
|
|
18
|
+
/** A second real device key, for a device of another Identity. */
|
|
19
|
+
export declare const otherDeviceKey: {
|
|
20
|
+
publicKey: string;
|
|
21
|
+
fingerprint: string;
|
|
22
|
+
};
|
|
23
|
+
/** A deterministic real ssh-ed25519 public key and its fingerprint. */
|
|
24
|
+
export declare function realEd25519Key(seed: number): {
|
|
25
|
+
publicKey: string;
|
|
26
|
+
fingerprint: string;
|
|
27
|
+
};
|
|
14
28
|
export declare const signer: {
|
|
15
|
-
groupId: string;
|
|
16
|
-
deviceId: string;
|
|
17
29
|
publicKey: string;
|
|
18
30
|
fingerprint: string;
|
|
31
|
+
groupId: string;
|
|
32
|
+
deviceId: string;
|
|
19
33
|
};
|
|
20
34
|
export declare const browserHash: string;
|
|
21
35
|
export declare const completionHash: string;
|
|
@@ -31,6 +45,8 @@ export declare function status(state: string, attemptId?: string): {
|
|
|
31
45
|
export declare function rows(f: Fixture, table: (typeof TABLES)[number]): Record<string, unknown>[];
|
|
32
46
|
export declare function snapshot(f: Fixture): Record<string, unknown>[][];
|
|
33
47
|
export declare function setIdentity(f: Fixture, identity: string | null): void;
|
|
48
|
+
/** A controller review of the fixture's signer: its real device key. */
|
|
49
|
+
export declare function signerReview(overrides?: Parameters<typeof review>[0]): ReturnType<typeof review>;
|
|
34
50
|
export declare function authorize(f: LinkFixture): Promise<void>;
|
|
35
51
|
export declare function advance(f: LinkFixture, state: string, input?: CreateInput, hash?: string, options?: {
|
|
36
52
|
subject?: string;
|
|
@@ -43,7 +59,13 @@ export declare function transition(f: LinkFixture, stage: Stage, config?: Config
|
|
|
43
59
|
kind: "applied" | "existing";
|
|
44
60
|
status: import("./coordinator-auth-link-contract.js").CoordinatorAuthLinkStatus;
|
|
45
61
|
}>;
|
|
46
|
-
|
|
62
|
+
/**
|
|
63
|
+
* `accountSchema: "v2"` opens coordinators on the V2 schema earlier releases left, for
|
|
64
|
+
* tests whose seeds model rows written before the account extension and then install it.
|
|
65
|
+
*/
|
|
66
|
+
export declare function backendTest(backend: Backend, options?: {
|
|
67
|
+
accountSchema?: "current" | "v2";
|
|
68
|
+
}): import("vitest").TestAPI<{
|
|
47
69
|
fixture: LinkFixture;
|
|
48
70
|
}>;
|
|
49
71
|
//# sourceMappingURL=coordinator-auth-link-test-fixtures.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator-auth-link-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-link-test-fixtures.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coordinator-auth-link-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-link-test-fixtures.ts"],"names":[],"mappings":"AASA,OAAO,EACN,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,GACjB,MAAM,mDAAmD,CAAC;AAE3D,OAAO,KAAK,EACX,yBAAyB,IAAI,MAAM,EACnC,8BAA8B,IAAI,WAAW,EAC7C,gCAAgC,IAAI,aAAa,EACjD,4BAA4B,IAAI,SAAS,EACzC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACN,KAAK,OAAO,EAEZ,KAAK,OAAO,EACZ,MAAM,EAEN,MA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
24
24
|
first<T>(statement: AuthLinkStatement): Promise<T | null>;
|
|
25
25
|
all?<T>(statement: AuthLinkStatement): Promise<T[]>;
|
|
26
|
+
/** Runs read statements in one round trip and returns each statement's rows. */
|
|
27
|
+
readBatch?<T>(statements: AuthLinkStatement[]): Promise<T[][]>;
|
|
26
28
|
run(statement: AuthLinkStatement): Promise<number>;
|
|
27
29
|
/** Atomic execution; production backends return each statement's native change count. */
|
|
28
30
|
batch(statements: AuthLinkStatement[]): Promise<unknown>;
|
|
@@ -70,6 +72,8 @@ export declare class AuthLinkOperations implements CoordinatorAuthLinkStore {
|
|
|
70
72
|
private retryContinuation;
|
|
71
73
|
private captureDevice;
|
|
72
74
|
private createDeviceAttempt;
|
|
75
|
+
/** Whether the attested INSERT's own source, authority and admission predicates hold. */
|
|
76
|
+
private wouldAdmitCreation;
|
|
73
77
|
private diagnoseCreateAdmission;
|
|
74
78
|
private readOwnerReservation;
|
|
75
79
|
private createRetry;
|
|
@@ -110,6 +114,7 @@ export declare class AuthLinkOperations implements CoordinatorAuthLinkStore {
|
|
|
110
114
|
finalizeHeadlessAuthLinkAttempt(input: CoordinatorAuthLinkHeadlessFinalizeInput, config: CoordinatorAuthLinkConfig): Promise<CoordinatorAuthLinkResult>;
|
|
111
115
|
private finalizeWithMode;
|
|
112
116
|
private finalizeDevice;
|
|
117
|
+
private prepareFirstClaimBinding;
|
|
113
118
|
private finalizeSource;
|
|
114
119
|
private deviceReceipt;
|
|
115
120
|
private finalizeReceipt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator-auth-link.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-link.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAgBxF,OAAO,EAWN,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EAEpC,KAAK,4B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AAyB,CAAC,CAWpC;YACa,gBAAgB;YA2ChB,cAAc;YAmDd,wBAAwB;YA6BxB,cAAc;YAQd,aAAa;YA2Bb,eAAe;CAqC7B"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { AuthLinkBackend, AuthLinkStatement } from "./coordinator-auth-link.js";
|
|
2
|
+
/**
|
|
3
|
+
* Read-set validation for coordinator authorization.
|
|
4
|
+
*
|
|
5
|
+
* D1 has no interactive transactions, so a decision cannot read, decide and write under
|
|
6
|
+
* one lock. A decision instead works in three steps:
|
|
7
|
+
*
|
|
8
|
+
* 1. Read the facts with small plain queries ({@link readSnapshot}).
|
|
9
|
+
* 2. Decide in TypeScript from those rows alone.
|
|
10
|
+
* 3. Write in one atomic batch whose first statements re-run every read and abort the
|
|
11
|
+
* batch unless each read still supports the decision ({@link writeGuarded}).
|
|
12
|
+
*
|
|
13
|
+
* The decision is void unless its guards run in the batch that writes.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* One fact query. It returns one JSON value per row in a column named `row`, usually
|
|
17
|
+
* `json_object(...) AS row`. It needs an explicit ORDER BY so the same rows always give
|
|
18
|
+
* the same text. Write it without a WITH clause: production D1 refuses large statements
|
|
19
|
+
* that resolve WITH names, and the guard embeds the read a second time.
|
|
20
|
+
*
|
|
21
|
+
* A read may compute a 0/1 verdict in SQL, such as `'proven', EXISTS (...)`, when a
|
|
22
|
+
* proof joins several tables and its NULL handling is easier to keep exact in SQL. The
|
|
23
|
+
* guard re-runs the whole read, so the verdict is evaluated again inside the winning
|
|
24
|
+
* batch and a changed verdict aborts it.
|
|
25
|
+
*/
|
|
26
|
+
export interface AuthRead extends AuthLinkStatement {
|
|
27
|
+
/**
|
|
28
|
+
* Replaces the default guard, which requires the read to return byte-identical rows.
|
|
29
|
+
* Use it only when the decision survives some changes to those rows, for example a
|
|
30
|
+
* list that may lose entries but must not gain any. It receives the JSON array text
|
|
31
|
+
* of the rows that were read, and returns a statement with exactly one value: 1 while
|
|
32
|
+
* the decision still holds.
|
|
33
|
+
*/
|
|
34
|
+
holds?: (seenRows: string) => AuthLinkStatement;
|
|
35
|
+
}
|
|
36
|
+
/** The caller states the row shape of its own reads; the rows come from its SQL. */
|
|
37
|
+
type RowsByName = Record<string, unknown[]>;
|
|
38
|
+
export interface AuthReadSnapshot<Rows extends RowsByName> {
|
|
39
|
+
/** Parsed rows of each read. */
|
|
40
|
+
rows: Rows;
|
|
41
|
+
/** One statement per read. Each aborts its batch when the read no longer holds. */
|
|
42
|
+
guards: Record<keyof Rows, AuthLinkStatement>;
|
|
43
|
+
}
|
|
44
|
+
export type GuardedWriteResult =
|
|
45
|
+
/** Every guard held and every write assertion passed. */
|
|
46
|
+
"committed"
|
|
47
|
+
/** A read no longer supports the decision. Nothing was written. */
|
|
48
|
+
| "changed"
|
|
49
|
+
/** A write changed an unexpected number of rows. Nothing was written. */
|
|
50
|
+
| "unmatched";
|
|
51
|
+
declare const abortWhenChanged: (condition: AuthLinkStatement) => AuthLinkStatement;
|
|
52
|
+
/**
|
|
53
|
+
* A guard from a caller's own SQL condition, for reads whose rows are compared another
|
|
54
|
+
* way than the default guard does. It aborts its batch, as a changed read does, unless
|
|
55
|
+
* the condition is true.
|
|
56
|
+
*/
|
|
57
|
+
export declare const snapshotGuard: typeof abortWhenChanged;
|
|
58
|
+
export interface ReadSnapshotOptions {
|
|
59
|
+
/**
|
|
60
|
+
* Builds each guard from its condition instead of the default guard, whose failure
|
|
61
|
+
* {@link writeGuarded} reports as "changed". For a batch that must fail its own way,
|
|
62
|
+
* or must check the read only when another condition of that batch holds.
|
|
63
|
+
*/
|
|
64
|
+
guard?: (condition: AuthLinkStatement) => AuthLinkStatement;
|
|
65
|
+
}
|
|
66
|
+
/** Follows a write in the batch. Aborts unless that write changed exactly `expected` rows. */
|
|
67
|
+
export declare function changedRows(expected?: number): AuthLinkStatement;
|
|
68
|
+
type RowReader = Pick<AuthLinkBackend, "first" | "readBatch">;
|
|
69
|
+
/** Runs the named reads and returns their rows with the guards that pin them. */
|
|
70
|
+
export declare function readSnapshot<Rows extends RowsByName>(backend: RowReader, reads: Record<keyof Rows, AuthRead>, options?: ReadSnapshotOptions): Promise<AuthReadSnapshot<Rows>>;
|
|
71
|
+
/** Whether an error is a default guard's refusal: a read no longer holds. */
|
|
72
|
+
export declare function isSnapshotChanged(error: unknown): boolean;
|
|
73
|
+
/** A backend whose reads can run together as one snapshot. */
|
|
74
|
+
export type AtomicReader = Required<Pick<AuthLinkBackend, "readBatch">>;
|
|
75
|
+
/**
|
|
76
|
+
* Types a store backend's read batch as required. Every store backend has one. A
|
|
77
|
+
* backend without it refuses each read batch instead of reading one statement at a
|
|
78
|
+
* time, which would check the guards at different moments.
|
|
79
|
+
*/
|
|
80
|
+
export declare function requireReadBatch<B extends Pick<AuthLinkBackend, "readBatch">>(backend: B): Omit<B, "readBatch"> & AtomicReader;
|
|
81
|
+
/**
|
|
82
|
+
* Runs the guards and then `statement` as one read batch, and returns the statement's
|
|
83
|
+
* first row. `changed` when a guard no longer holds.
|
|
84
|
+
*/
|
|
85
|
+
export declare function readAfterGuards<T>(backend: AtomicReader, guards: readonly AuthLinkStatement[], statement: AuthLinkStatement): Promise<{
|
|
86
|
+
changed: true;
|
|
87
|
+
} | {
|
|
88
|
+
changed: false;
|
|
89
|
+
row: T | null;
|
|
90
|
+
}>;
|
|
91
|
+
/** Whether every guard still holds, checked together in one read batch. */
|
|
92
|
+
export declare function guardsHold(backend: AtomicReader, guards: readonly AuthLinkStatement[]): Promise<boolean>;
|
|
93
|
+
/**
|
|
94
|
+
* Runs the guards and then the writes as one atomic batch. Any other error propagates,
|
|
95
|
+
* so an unknown outcome is never reported as a refusal.
|
|
96
|
+
*/
|
|
97
|
+
export declare function writeGuarded(backend: Pick<AuthLinkBackend, "batch">, guards: readonly AuthLinkStatement[], writes: readonly AuthLinkStatement[]): Promise<GuardedWriteResult>;
|
|
98
|
+
export {};
|
|
99
|
+
//# sourceMappingURL=coordinator-auth-read-set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
3
|
+
* Coordinator auth schema stages that numbered D1 migrations move between, in order:
|
|
4
|
+
* 0045 cuts the legacy authority tables over to V2, 0046 adds the prior account
|
|
5
|
+
* extension, and 0047 adds device unlink, which makes the extension current.
|
|
6
|
+
*/
|
|
7
|
+
export declare const COORDINATOR_AUTH_STAGE_MIGRATIONS: Readonly<{
|
|
8
|
+
authorityCutover: "0045_cut_over_auth_link_authority.sql";
|
|
9
|
+
accountConnections: "0046_add_account_connections.sql";
|
|
10
|
+
accountUnlink: "0047_add_account_unlink.sql";
|
|
11
|
+
}>;
|
|
12
|
+
export type CoordinatorAuthSchemaStage = "legacy" | "v2" | "prior_extension" | "current" | "unknown";
|
|
13
|
+
/** Migrations whose changes a database at each recognized stage already contains. */
|
|
14
|
+
export declare const COORDINATOR_AUTH_STAGE_APPLIED: Readonly<Record<Exclude<CoordinatorAuthSchemaStage, "unknown">, readonly string[]>>;
|
|
15
|
+
/**
|
|
16
|
+
* Read-only diagnosis of the auth schema stage. Every query reads sqlite_master or
|
|
17
|
+
* checks rows; nothing is written. Anything partial, extra or unrecognized is `unknown`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function readCoordinatorAuthSchemaStage(backend: Pick<AuthLinkBackend, "first">): Promise<CoordinatorAuthSchemaStage>;
|
|
20
|
+
/** Every numbered migration, from 0001, that a database at `stage` already contains. */
|
|
21
|
+
export declare function coordinatorD1BaselineMigrations(stage: "v2" | "prior_extension" | "current"): readonly string[];
|
|
22
|
+
/**
|
|
23
|
+
* One explicit statement that records, in Wrangler's existing `d1_migrations` ledger, every
|
|
24
|
+
* numbered migration from 0001 through `stage`. It re-checks auth-stage readiness and the
|
|
25
|
+
* remaining table and column names in the same statement. Failed checks write nothing
|
|
26
|
+
* (or fail to compile), and names already recorded are skipped. A missing ledger
|
|
27
|
+
* fails with `no such table: d1_migrations`. Nothing runs it automatically.
|
|
28
|
+
*/
|
|
29
|
+
export declare function coordinatorAuthStageBaselineSql(stage: "v2" | "prior_extension" | "current", ledger?: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Exact text of the numbered D1 migrations, generated from the same statements the
|
|
32
|
+
* SQLite coordinator runs. Each one first checks its starting schema and aborts before
|
|
33
|
+
* any change on anything else; Wrangler records it only when the whole file succeeds.
|
|
34
|
+
*/
|
|
35
|
+
export declare const COORDINATOR_AUTH_STAGE_MIGRATION_SQL: Readonly<Record<string, string>>;
|
|
36
|
+
//# sourceMappingURL=coordinator-auth-schema-stage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator-auth-schema-stage.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-schema-stage.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAUlE;;;;GAIG;AACH,eAAO,MAAM,iCAAiC;;;;EAI5C,CAAC;AACH,MAAM,MAAM,0BAA0B,GACnC,QAAQ,GACR,IAAI,GACJ,iBAAiB,GACjB,SAAS,GACT,SAAS,CAAC;AAEb,qFAAqF;AACrF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CACpD,MAAM,CAAC,OAAO,CAAC,0BAA0B,EAAE,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC,CASxE,CAAC;AAEH;;;GAGG;AACH,wBAAsB,8BAA8B,CACnD,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,GACrC,OAAO,CAAC,0BAA0B,CAAC,CAerC;AAgBD,wFAAwF;AACxF,wBAAgB,+BAA+B,CAC9C,KAAK,EAAE,IAAI,GAAG,iBAAiB,GAAG,SAAS,GACzC,SAAS,MAAM,EAAE,CAGnB;AAYD;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC9C,KAAK,EAAE,IAAI,GAAG,iBAAiB,GAAG,SAAS,EAC3C,MAAM,SAAkB,GACtB,MAAM,CAGR;AAKD;;;;GAIG;AACH,eAAO,MAAM,oCAAoC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAwBjF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator-auth-schema.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-schema.ts"],"names":[],"mappings":"AAQA,OAAO,EACN,2BAA2B,EAC3B,4BAA4B,EAC5B,yCAAyC,GACzC,MAAM,4CAA4C,CAAC;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,4BAA4B,CAAC;AAQrF,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,yBAAyB,QAA+B,CAAC;AAEtE,MAAM,WAAW,0BAA0B;IAC1C,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAED,wBAAsB,2BAA2B,CAChD,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,EACvC,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACrC,OAAO,CAAC,IAAI,CAAC,CAIf;
|
|
1
|
+
{"version":3,"file":"coordinator-auth-schema.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-schema.ts"],"names":[],"mappings":"AAQA,OAAO,EACN,2BAA2B,EAC3B,4BAA4B,EAC5B,yCAAyC,GACzC,MAAM,4CAA4C,CAAC;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,4BAA4B,CAAC;AAQrF,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,yBAAyB,QAA+B,CAAC;AAEtE,MAAM,WAAW,0BAA0B;IAC1C,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAED,wBAAsB,2BAA2B,CAChD,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,EACvC,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACrC,OAAO,CAAC,IAAI,CAAC,CAIf;AAiBD,qFAAqF;AACrF,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tB,KAAK,EAAE,2BAA2B,GAChC,OAAO,CAAC,mCAAmC,CAAC,CAW9C;IACD,0FAA0F;IACpF,qBAAqB,CAC1B,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,EACzB,KAAK,EAAE,2BAA2B,GAChC,OAAO,CAAC,sCAAsC,CAAC,CAkCjD;CACD"}
|
|
@@ -17,9 +17,21 @@ export declare function sqliteD1(db: SqliteDatabase, hooks?: {
|
|
|
17
17
|
values: readonly unknown[];
|
|
18
18
|
}[]) => void;
|
|
19
19
|
}): D1DatabaseLike;
|
|
20
|
+
/** Where the Worker schema's V2 prefix ends and account management begins. */
|
|
21
|
+
export declare const WORKER_SCHEMA_ACCOUNT_MARKER = "-- Account management (migrations 0046 and 0047)";
|
|
22
|
+
/**
|
|
23
|
+
* The fresh Worker schema, or with `accountSchema: "v2"` its prefix: the V2 schema a
|
|
24
|
+
* D1 coordinator had before migrations 0046 and 0047.
|
|
25
|
+
*/
|
|
26
|
+
export declare function workerSchemaSql(accountSchema?: "current" | "v2"): string;
|
|
27
|
+
/**
|
|
28
|
+
* A store on the current schema, or with `accountSchema: "v2"` on the V2 schema earlier
|
|
29
|
+
* releases left (a SQLite file opened as existing, or the Worker schema's V2 prefix).
|
|
30
|
+
*/
|
|
20
31
|
export declare function setupStore(backend: Backend, options?: {
|
|
21
32
|
authClock?: () => number;
|
|
22
33
|
databasePath?: string;
|
|
34
|
+
accountSchema?: "current" | "v2";
|
|
23
35
|
}): Fixture;
|
|
24
36
|
export declare function review(overrides?: Partial<CoordinatorAuthControllerReviewInput>): CoordinatorAuthControllerReviewInput;
|
|
25
37
|
export declare function enroll(store: Store, input?: CoordinatorAuthControllerReviewInput): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator-auth-store-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-auth-store-test-fixtures.ts"],"names":[],"mappings":"AAEA,OAAiB,EAAE,KAAK,QAAQ,IAAI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ACH,wBAAgB,eAAe,CAAC,aAAa,GAAE,SAAS,GAAG,IAAgB,GAAG,MAAM,CAOnF;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACzB,OAAO,EAAE,OAAO,EAChB,OAAO,GAAE;IACR,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CAC5B,GACJ,OAAO,CAgBT;AAED,wBAAgB,MAAM,CACrB,SAAS,GAAE,OAAO,CAAC,oCAAoC,CAAM,GAC3D,oCAAoC,CAatC;AAED,wBAAsB,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,uCAAW,iBAO1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator-controller-revocation-test-harness.d.ts","sourceRoot":"","sources":["../src/coordinator-controller-revocation-test-harness.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coordinator-controller-revocation-test-harness.d.ts","sourceRoot":"","sources":["../src/coordinator-controller-revocation-test-harness.ts"],"names":[],"mappings":"AAUA,OAAO,EAEN,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,MAAM,iDAAiD,CAAC;AAGzD,OAAO,EACN,kBAAkB,EAClB,KAAK,cAAc,EAEnB,MAAM,2BAA2B,CAAC;AAEnC,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC3D,KAAK,IAAI,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAC7C,KAAK,OAAO,GAAG,CAAC,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,KAAK,kBAAkB,CAAC;AACxE,eAAO,MAAM,gBAAgB,UAS5B,CAAC;AA6BF,wBAAgB,oCAAoC,CAAC,IAAI,EAAE,cAAc,QAMxE;AAwND,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,sBAyCjE;AACD,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,QAIvF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Numbered D1 migrations and all V2 table and column names, pinned so the
|
|
3
|
+
* D1 ledger baseline needs no migration directory at run time. Tests compare both against
|
|
4
|
+
* the migration files. Generated from a database built from 0001 through 0045;
|
|
5
|
+
* 0046 and 0047 add columns and objects checked by the auth-stage readiness queries.
|
|
6
|
+
*/
|
|
7
|
+
export declare const COORDINATOR_D1_MIGRATION_NAMES: readonly string[];
|
|
8
|
+
/** Every V2 table and column, including auth tables, required by every baseline stage. */
|
|
9
|
+
export declare const COORDINATOR_D1_BASE_INVENTORY: Readonly<Record<string, readonly string[]>>;
|
|
10
|
+
//# sourceMappingURL=coordinator-d1-schema-inventory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator-d1-schema-inventory.d.ts","sourceRoot":"","sources":["../src/coordinator-d1-schema-inventory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,EAAE,SAAS,MAAM,EAiD1D,CAAC;AAEH,0FAA0F;AAC1F,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAuhBnF,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CoordinatorAuthLinkSigner } from "./coordinator-auth-link-contract.js";
|
|
2
|
+
export interface DeviceClaimBindingInput {
|
|
3
|
+
/** Authenticated by the signed-device boundary, never copied from a request body. */
|
|
4
|
+
signer: CoordinatorAuthLinkSigner;
|
|
5
|
+
/** Assertion of the unchanged current/default Identity. The committed claim is authority. */
|
|
6
|
+
currentIdentityId: string;
|
|
7
|
+
}
|
|
8
|
+
export interface DeviceClaimBindingReceipt {
|
|
9
|
+
bindingId: string;
|
|
10
|
+
claimId: string;
|
|
11
|
+
coordinatorId: string;
|
|
12
|
+
deviceId: string;
|
|
13
|
+
keyId: string;
|
|
14
|
+
identityId: string;
|
|
15
|
+
enrollmentCount: number;
|
|
16
|
+
boundAt: string;
|
|
17
|
+
}
|
|
18
|
+
export type DeviceClaimBindingReadiness = {
|
|
19
|
+
kind: "ready";
|
|
20
|
+
} | {
|
|
21
|
+
kind: "complete";
|
|
22
|
+
receipt: DeviceClaimBindingReceipt;
|
|
23
|
+
} | {
|
|
24
|
+
kind: "requires_review";
|
|
25
|
+
};
|
|
26
|
+
export type DeviceClaimBindingResult = Exclude<DeviceClaimBindingReadiness, {
|
|
27
|
+
kind: "ready";
|
|
28
|
+
}> | {
|
|
29
|
+
kind: "completed";
|
|
30
|
+
receipt: DeviceClaimBindingReceipt;
|
|
31
|
+
};
|
|
32
|
+
export declare function captureDeviceClaimBindingInput(value: unknown): DeviceClaimBindingInput | null;
|
|
33
|
+
/** Recognize only the trigger-independent batch assertion. Ordinary malformed
|
|
34
|
+
* JSON, constraint failures and I/O errors retain their original unknown outcome.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isDeviceClaimBindingConflict(error: unknown): boolean;
|
|
37
|
+
//# sourceMappingURL=coordinator-device-claim-binding-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator-device-claim-binding-contract.d.ts","sourceRoot":"","sources":["../src/coordinator-device-claim-binding-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAGrF,MAAM,WAAW,uBAAuB;IACvC,qFAAqF;IACrF,MAAM,EAAE,yBAAyB,CAAC;IAClC,6FAA6F;IAC7F,iBAAiB,EAAE,MAAM,CAAC;CAC1B;AACD,MAAM,WAAW,yBAAyB;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,MAAM,2BAA2B,GACpC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,yBAAyB,CAAA;CAAE,GACxD;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,CAAC;AAC/B,MAAM,MAAM,wBAAwB,GACjC,OAAO,CAAC,2BAA2B,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,GACvD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,yBAAyB,CAAA;CAAE,CAAC;AAE7D,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,uBAAuB,GAAG,IAAI,CAK7F;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAYpE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AuthLinkBackend, AuthLinkStatement } from "./coordinator-auth-link.js";
|
|
2
|
+
import type { DeviceClaimBindingInput } from "./coordinator-device-claim-binding-contract.js";
|
|
3
|
+
import type { PreparedDeviceClaimBinding } from "./coordinator-device-claim-binding-sql.js";
|
|
4
|
+
export interface ExistingFirstLinkBinding {
|
|
5
|
+
device_id: string;
|
|
6
|
+
key_id: string;
|
|
7
|
+
identity_id: string;
|
|
8
|
+
coordinator_id: string;
|
|
9
|
+
binding_id: string;
|
|
10
|
+
provenance: "owner_enrollment" | "reviewed_legacy_migration";
|
|
11
|
+
source_ref: string;
|
|
12
|
+
bound_at: string;
|
|
13
|
+
}
|
|
14
|
+
/** Missing means mint. Null means contradictory ownership, never authority. */
|
|
15
|
+
export declare function readExistingFirstLinkBinding(backend: AuthLinkBackend, input: DeviceClaimBindingInput, coordinatorId: string, keyId: string): Promise<ExistingFirstLinkBinding | null | undefined>;
|
|
16
|
+
export declare function existingFirstLinkBindingPin(binding: ExistingFirstLinkBinding): AuthLinkStatement;
|
|
17
|
+
/** A failing projection runs before table triggers, including RAISE(IGNORE). */
|
|
18
|
+
export declare function assertPredicate(predicate: AuthLinkStatement): AuthLinkStatement;
|
|
19
|
+
/** Existing positive ownership keeps its original receipt/provenance. Only this
|
|
20
|
+
* device's NULL enrollment fields may change after the claim's winning writes.
|
|
21
|
+
*/
|
|
22
|
+
export declare function reuseFirstLinkBindingStatements(plan: PreparedDeviceClaimBinding, binding: ExistingFirstLinkBinding): AuthLinkStatement[];
|
|
23
|
+
//# sourceMappingURL=coordinator-device-claim-binding-reuse.d.ts.map
|