@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.
Files changed (207) hide show
  1. package/dist/better-sqlite-coordinator-store.d.ts +21 -2
  2. package/dist/better-sqlite-coordinator-store.d.ts.map +1 -1
  3. package/dist/coordinator-account-change-authority.d.ts +56 -0
  4. package/dist/coordinator-account-change-authority.d.ts.map +1 -0
  5. package/dist/coordinator-account-change-decision.d.ts +141 -0
  6. package/dist/coordinator-account-change-decision.d.ts.map +1 -0
  7. package/dist/coordinator-account-change-http-test-fixtures.d.ts +3 -1
  8. package/dist/coordinator-account-change-http-test-fixtures.d.ts.map +1 -1
  9. package/dist/coordinator-account-change-original-sql-test-fixtures.d.ts +61 -0
  10. package/dist/coordinator-account-change-original-sql-test-fixtures.d.ts.map +1 -0
  11. package/dist/coordinator-account-change.d.ts +7 -1
  12. package/dist/coordinator-account-change.d.ts.map +1 -1
  13. package/dist/coordinator-account-connection-link.d.ts +1 -1
  14. package/dist/coordinator-account-connection-link.d.ts.map +1 -1
  15. package/dist/coordinator-account-connection-schema.d.ts +31 -0
  16. package/dist/coordinator-account-connection-schema.d.ts.map +1 -1
  17. package/dist/coordinator-account-connection-session.d.ts +9 -0
  18. package/dist/coordinator-account-connection-session.d.ts.map +1 -1
  19. package/dist/coordinator-account-historical-revoke-original-sql-test-fixtures.d.ts +7 -0
  20. package/dist/coordinator-account-historical-revoke-original-sql-test-fixtures.d.ts.map +1 -0
  21. package/dist/coordinator-account-historical-revoke.d.ts +8 -2
  22. package/dist/coordinator-account-historical-revoke.d.ts.map +1 -1
  23. package/dist/coordinator-account-link-status-client.d.ts +4 -0
  24. package/dist/coordinator-account-link-status-client.d.ts.map +1 -1
  25. package/dist/coordinator-account-link-status.d.ts.map +1 -1
  26. package/dist/coordinator-account-schema-sqlite-test-fixtures.d.ts +58 -0
  27. package/dist/coordinator-account-schema-sqlite-test-fixtures.d.ts.map +1 -0
  28. package/dist/coordinator-account-schema-test-fixtures.d.ts +20 -0
  29. package/dist/coordinator-account-schema-test-fixtures.d.ts.map +1 -0
  30. package/dist/coordinator-api.d.ts.map +1 -1
  31. package/dist/coordinator-auth-browser-owner-purpose-test-harness.d.ts.map +1 -1
  32. package/dist/coordinator-auth-browser-transaction-test-fixtures.d.ts.map +1 -1
  33. package/dist/coordinator-auth-browser-transaction.d.ts.map +1 -1
  34. package/dist/coordinator-auth-controller-consistency-test-fixtures.d.ts +5 -1
  35. package/dist/coordinator-auth-controller-consistency-test-fixtures.d.ts.map +1 -1
  36. package/dist/coordinator-auth-controller-history.d.ts +0 -1
  37. package/dist/coordinator-auth-controller-history.d.ts.map +1 -1
  38. package/dist/coordinator-auth-controller-original-sql-test-fixtures.d.ts +41 -0
  39. package/dist/coordinator-auth-controller-original-sql-test-fixtures.d.ts.map +1 -0
  40. package/dist/coordinator-auth-controller-owner.d.ts +0 -6
  41. package/dist/coordinator-auth-controller-owner.d.ts.map +1 -1
  42. package/dist/coordinator-auth-controller-race-test-fixtures.d.ts +38 -0
  43. package/dist/coordinator-auth-controller-race-test-fixtures.d.ts.map +1 -0
  44. package/dist/coordinator-auth-controller-read-set.d.ts +47 -0
  45. package/dist/coordinator-auth-controller-read-set.d.ts.map +1 -0
  46. package/dist/coordinator-auth-controller-stages-original-sql-test-fixtures.d.ts +8 -0
  47. package/dist/coordinator-auth-controller-stages-original-sql-test-fixtures.d.ts.map +1 -0
  48. package/dist/coordinator-auth-controller.d.ts +1 -21
  49. package/dist/coordinator-auth-controller.d.ts.map +1 -1
  50. package/dist/coordinator-auth-device-claim-eligibility.d.ts +51 -2
  51. package/dist/coordinator-auth-device-claim-eligibility.d.ts.map +1 -1
  52. package/dist/coordinator-auth-historical-store-test-fixture.d.ts +2 -0
  53. package/dist/coordinator-auth-historical-store-test-fixture.d.ts.map +1 -1
  54. package/dist/coordinator-auth-legacy-assignment.d.ts +4 -2
  55. package/dist/coordinator-auth-legacy-assignment.d.ts.map +1 -1
  56. package/dist/coordinator-auth-link-authority-upgrade.d.ts +5 -0
  57. package/dist/coordinator-auth-link-authority-upgrade.d.ts.map +1 -1
  58. package/dist/coordinator-auth-link-maintenance-fixtures.d.ts +2 -2
  59. package/dist/coordinator-auth-link-maintenance-fixtures.d.ts.map +1 -1
  60. package/dist/coordinator-auth-link-provenance.d.ts.map +1 -1
  61. package/dist/coordinator-auth-link-revocation-test-harness.d.ts.map +1 -1
  62. package/dist/coordinator-auth-link-test-fixtures.d.ts +26 -4
  63. package/dist/coordinator-auth-link-test-fixtures.d.ts.map +1 -1
  64. package/dist/coordinator-auth-link.d.ts +5 -0
  65. package/dist/coordinator-auth-link.d.ts.map +1 -1
  66. package/dist/coordinator-auth-read-set.d.ts +99 -0
  67. package/dist/coordinator-auth-read-set.d.ts.map +1 -0
  68. package/dist/coordinator-auth-schema-stage.d.ts +36 -0
  69. package/dist/coordinator-auth-schema-stage.d.ts.map +1 -0
  70. package/dist/coordinator-auth-schema.d.ts.map +1 -1
  71. package/dist/coordinator-auth-session.d.ts.map +1 -1
  72. package/dist/coordinator-auth-store-test-fixtures.d.ts +12 -0
  73. package/dist/coordinator-auth-store-test-fixtures.d.ts.map +1 -1
  74. package/dist/coordinator-controller-revocation-test-harness.d.ts.map +1 -1
  75. package/dist/coordinator-d1-schema-inventory.d.ts +10 -0
  76. package/dist/coordinator-d1-schema-inventory.d.ts.map +1 -0
  77. package/dist/coordinator-device-claim-binding-contract.d.ts +37 -0
  78. package/dist/coordinator-device-claim-binding-contract.d.ts.map +1 -0
  79. package/dist/coordinator-device-claim-binding-reuse.d.ts +23 -0
  80. package/dist/coordinator-device-claim-binding-reuse.d.ts.map +1 -0
  81. package/dist/coordinator-device-claim-binding-sql.d.ts +40 -0
  82. package/dist/coordinator-device-claim-binding-sql.d.ts.map +1 -0
  83. package/dist/coordinator-device-claim-binding.d.ts +21 -0
  84. package/dist/coordinator-device-claim-binding.d.ts.map +1 -0
  85. package/dist/coordinator-device-ownership-evidence-original-sql-test-fixtures.d.ts +88 -0
  86. package/dist/coordinator-device-ownership-evidence-original-sql-test-fixtures.d.ts.map +1 -0
  87. package/dist/coordinator-device-ownership-evidence-queries.d.ts +4 -14
  88. package/dist/coordinator-device-ownership-evidence-queries.d.ts.map +1 -1
  89. package/dist/coordinator-device-ownership-evidence-test-fixtures.d.ts +10 -0
  90. package/dist/coordinator-device-ownership-evidence-test-fixtures.d.ts.map +1 -1
  91. package/dist/coordinator-device-ownership-evidence.d.ts +11 -3
  92. package/dist/coordinator-device-ownership-evidence.d.ts.map +1 -1
  93. package/dist/coordinator-device-rebind-ceremony.d.ts +2 -1
  94. package/dist/coordinator-device-rebind-ceremony.d.ts.map +1 -1
  95. package/dist/coordinator-device-rebind-commit.d.ts.map +1 -1
  96. package/dist/coordinator-device-rebind-proof.d.ts +1 -0
  97. package/dist/coordinator-device-rebind-proof.d.ts.map +1 -1
  98. package/dist/coordinator-device-rebind-schema.d.ts +4 -3
  99. package/dist/coordinator-device-rebind-schema.d.ts.map +1 -1
  100. package/dist/coordinator-device-rebind-test-fixtures.d.ts.map +1 -1
  101. package/dist/coordinator-device-self-bind-authority.d.ts +29 -0
  102. package/dist/coordinator-device-self-bind-authority.d.ts.map +1 -0
  103. package/dist/coordinator-device-self-bind-decision.d.ts +84 -0
  104. package/dist/coordinator-device-self-bind-decision.d.ts.map +1 -0
  105. package/dist/coordinator-device-self-bind-original-sql-test-fixtures.d.ts +17 -0
  106. package/dist/coordinator-device-self-bind-original-sql-test-fixtures.d.ts.map +1 -0
  107. package/dist/coordinator-device-self-bind-test-fixtures.d.ts +114 -0
  108. package/dist/coordinator-device-self-bind-test-fixtures.d.ts.map +1 -0
  109. package/dist/coordinator-device-setup-client.d.ts +26 -0
  110. package/dist/coordinator-device-setup-client.d.ts.map +1 -0
  111. package/dist/coordinator-device-setup-http.d.ts +9 -0
  112. package/dist/coordinator-device-setup-http.d.ts.map +1 -0
  113. package/dist/coordinator-history-sql-equivalence-test-fixtures.d.ts +6 -2
  114. package/dist/coordinator-history-sql-equivalence-test-fixtures.d.ts.map +1 -1
  115. package/dist/coordinator-legacy-completion-owner-proof-original-sql-test-fixtures.d.ts +77 -0
  116. package/dist/coordinator-legacy-completion-owner-proof-original-sql-test-fixtures.d.ts.map +1 -0
  117. package/dist/coordinator-legacy-completion-owner-proof-test-fixtures.d.ts +46 -0
  118. package/dist/coordinator-legacy-completion-owner-proof-test-fixtures.d.ts.map +1 -0
  119. package/dist/coordinator-legacy-completion-owner-proof.d.ts +19 -2
  120. package/dist/coordinator-legacy-completion-owner-proof.d.ts.map +1 -1
  121. package/dist/coordinator-legacy-owner-compatibility.d.ts +23 -0
  122. package/dist/coordinator-legacy-owner-compatibility.d.ts.map +1 -1
  123. package/dist/coordinator-legacy-owner-resolution-commit-original-sql-test-fixtures.d.ts +63 -0
  124. package/dist/coordinator-legacy-owner-resolution-commit-original-sql-test-fixtures.d.ts.map +1 -0
  125. package/dist/coordinator-legacy-owner-resolution-commit-test-fixtures.d.ts +3 -1
  126. package/dist/coordinator-legacy-owner-resolution-commit-test-fixtures.d.ts.map +1 -1
  127. package/dist/coordinator-legacy-owner-resolution-commit.d.ts.map +1 -1
  128. package/dist/coordinator-owner-enrollment-commit.d.ts.map +1 -1
  129. package/dist/coordinator-owner-enrollment-historical-test-fixture.d.ts +2 -0
  130. package/dist/coordinator-owner-enrollment-historical-test-fixture.d.ts.map +1 -1
  131. package/dist/coordinator-owner-enrollment-start-test-fixtures.d.ts.map +1 -1
  132. package/dist/coordinator-owner-negative-consistency.d.ts +11 -17
  133. package/dist/coordinator-owner-negative-consistency.d.ts.map +1 -1
  134. package/dist/coordinator-owner-negative-original-sql-test-fixtures.d.ts +44 -0
  135. package/dist/coordinator-owner-negative-original-sql-test-fixtures.d.ts.map +1 -0
  136. package/dist/coordinator-owner-negative-race-test-fixtures.d.ts +26 -0
  137. package/dist/coordinator-owner-negative-race-test-fixtures.d.ts.map +1 -0
  138. package/dist/coordinator-owner-negative-read-set.d.ts +43 -0
  139. package/dist/coordinator-owner-negative-read-set.d.ts.map +1 -0
  140. package/dist/coordinator-owner-negative-reads.d.ts +32 -0
  141. package/dist/coordinator-owner-negative-reads.d.ts.map +1 -0
  142. package/dist/coordinator-owner-producer-original-sql-test-fixtures.d.ts +26 -0
  143. package/dist/coordinator-owner-producer-original-sql-test-fixtures.d.ts.map +1 -0
  144. package/dist/coordinator-owner-resolution-review-test-fixtures.d.ts +1 -0
  145. package/dist/coordinator-owner-resolution-review-test-fixtures.d.ts.map +1 -1
  146. package/dist/coordinator-owner-resolution-review.d.ts +1 -0
  147. package/dist/coordinator-owner-resolution-review.d.ts.map +1 -1
  148. package/dist/coordinator-producer-negative-owner-test-fixtures.d.ts +8 -2
  149. package/dist/coordinator-producer-negative-owner-test-fixtures.d.ts.map +1 -1
  150. package/dist/coordinator-recipient-negative-race-test-fixtures.d.ts +54 -0
  151. package/dist/coordinator-recipient-negative-race-test-fixtures.d.ts.map +1 -0
  152. package/dist/coordinator-recipient-owner-consistency.d.ts +4 -5
  153. package/dist/coordinator-recipient-owner-consistency.d.ts.map +1 -1
  154. package/dist/coordinator-recipient-owner-original-sql-test-fixtures.d.ts +30 -0
  155. package/dist/coordinator-recipient-owner-original-sql-test-fixtures.d.ts.map +1 -0
  156. package/dist/coordinator-resolved-account-owner-status-query.d.ts +4 -1
  157. package/dist/coordinator-resolved-account-owner-status-query.d.ts.map +1 -1
  158. package/dist/coordinator-resolved-account-owner-status-test-fixtures.d.ts +1 -0
  159. package/dist/coordinator-resolved-account-owner-status-test-fixtures.d.ts.map +1 -1
  160. package/dist/coordinator-resolved-account-owner-status.d.ts +2 -0
  161. package/dist/coordinator-resolved-account-owner-status.d.ts.map +1 -1
  162. package/dist/{coordinator-runtime-Bdad5KeL.js → coordinator-runtime-BXJQAKFD.js} +3 -3
  163. package/dist/{coordinator-runtime-Bdad5KeL.js.map → coordinator-runtime-BXJQAKFD.js.map} +1 -1
  164. package/dist/coordinator-sql-compare.d.ts +22 -0
  165. package/dist/coordinator-sql-compare.d.ts.map +1 -0
  166. package/dist/d1-coordinator-store.d.ts +16 -1
  167. package/dist/d1-coordinator-store.d.ts.map +1 -1
  168. package/dist/index.d.ts +4 -1
  169. package/dist/index.d.ts.map +1 -1
  170. package/dist/index.js +9048 -8412
  171. package/dist/index.js.map +1 -1
  172. package/dist/ingest-events.d.ts.map +1 -1
  173. package/dist/ingest-pipeline.d.ts +38 -2
  174. package/dist/ingest-pipeline.d.ts.map +1 -1
  175. package/dist/internal/cloudflare-coordinator.js +1079 -1074
  176. package/dist/internal/cloudflare-coordinator.js.map +1 -1
  177. package/dist/internal/relay-runtime.js +2 -2
  178. package/dist/linked-legacy-setup-test-fixtures.d.ts +71 -0
  179. package/dist/linked-legacy-setup-test-fixtures.d.ts.map +1 -0
  180. package/dist/operational-status.d.ts +3 -0
  181. package/dist/operational-status.d.ts.map +1 -1
  182. package/dist/{owner-enrollment-start-DgToUaFZ.js → owner-enrollment-start-BFyBKWvZ.js} +2731 -2315
  183. package/dist/owner-enrollment-start-BFyBKWvZ.js.map +1 -0
  184. package/dist/owner-enrollment-start.d.ts.map +1 -1
  185. package/dist/owner-qualified-consumer-access-test-harness.d.ts.map +1 -1
  186. package/dist/owner-qualified-consumer-adversarial-test-harness.d.ts +1 -1
  187. package/dist/owner-qualified-consumer-adversarial-test-harness.d.ts.map +1 -1
  188. package/dist/owner-qualified-consumer-test-harness.d.ts +3 -0
  189. package/dist/owner-qualified-consumer-test-harness.d.ts.map +1 -1
  190. package/dist/owner-qualified-headless-test-harness.d.ts +1 -1
  191. package/dist/owner-qualified-headless-test-harness.d.ts.map +1 -1
  192. package/dist/project-scope-settings.d.ts.map +1 -1
  193. package/dist/raw-event-flush.d.ts.map +1 -1
  194. package/dist/relay-admission-table-keys-test-fixtures.d.ts +2 -1
  195. package/dist/relay-admission-table-keys-test-fixtures.d.ts.map +1 -1
  196. package/dist/{relay-peer-client-DdhDwDFz.js → relay-peer-client-DrTb2oZt.js} +2650 -2627
  197. package/dist/relay-peer-client-DrTb2oZt.js.map +1 -0
  198. package/dist/{sync-auth-constants-WKqJ9CX5.js → sync-auth-constants-BVzVfSmn.js} +4476 -3521
  199. package/dist/sync-auth-constants-BVzVfSmn.js.map +1 -0
  200. package/dist/{sync-reachability-pass-CSg85Qmd.js → sync-reachability-pass-CUe5bK61.js} +12 -12
  201. package/dist/{sync-reachability-pass-CSg85Qmd.js.map → sync-reachability-pass-CUe5bK61.js.map} +1 -1
  202. package/dist/sync-reachability-pass-D9cA54fj.js +2 -0
  203. package/package.json +3 -3
  204. package/dist/owner-enrollment-start-DgToUaFZ.js.map +0 -1
  205. package/dist/relay-peer-client-DdhDwDFz.js.map +0 -1
  206. package/dist/sync-auth-constants-WKqJ9CX5.js.map +0 -1
  207. package/dist/sync-reachability-pass-CQe7nZnN.js +0 -2
@@ -0,0 +1,114 @@
1
+ import Database from "better-sqlite3";
2
+ import type { AuthLinkBackend } from "./coordinator-auth-link.js";
3
+ import { type Backend } from "./coordinator-auth-store-test-fixtures.js";
4
+ import { type DeviceRebindAttempt } from "./coordinator-device-rebind-proof.js";
5
+ export declare const SELF_BIND_NOW = 1791028800000;
6
+ /** Original pre-upgrade account genesis, with an independent own controller review.
7
+ * Peer-origin links intentionally have no relationship to that own review.
8
+ */
9
+ export type SelfBindLinkOrigin = "own" | "peer" | "peer_controller";
10
+ export interface SelfBindFixtureOptions {
11
+ accountSchema?: "current" | "v2";
12
+ }
13
+ export declare function selfBindFixture(kind: Backend, origin?: SelfBindLinkOrigin, identityId?: string, options?: SelfBindFixtureOptions): Promise<{
14
+ store: import("./coordinator-auth-store-test-fixtures.js").Store;
15
+ db: Database.Database;
16
+ own: {
17
+ publicKey: string;
18
+ sign: (message: string) => string;
19
+ };
20
+ signer: {
21
+ groupId: string;
22
+ deviceId: string;
23
+ publicKey: string;
24
+ fingerprint: string;
25
+ };
26
+ identityId: string;
27
+ config: {
28
+ coordinatorId: string;
29
+ issuer: string;
30
+ revision: string;
31
+ enabled: boolean;
32
+ redirectUri: string;
33
+ clientId: string;
34
+ clientSecret: string;
35
+ };
36
+ pins: import("./coordinator-auth-historical-test-fixture.js").HistoricalAccountPins;
37
+ backend: AuthLinkBackend;
38
+ account: {
39
+ issuer: string;
40
+ subject: string;
41
+ ok: boolean;
42
+ };
43
+ input: {
44
+ signer: {
45
+ groupId: string;
46
+ deviceId: string;
47
+ publicKey: string;
48
+ fingerprint: string;
49
+ };
50
+ attemptId: string;
51
+ currentIdentityId: string;
52
+ browserStartHash: string;
53
+ reviewDigest: string;
54
+ loopbackRedirect: string;
55
+ };
56
+ steps: (c?: Readonly<{
57
+ claimBrowser: (request: Request, clientKey: string) => Promise<import("./coordinator-device-rebind-ceremony.js").DeviceRebindResult | null>;
58
+ verifyCallback: (request: Request) => Promise<import("./coordinator-device-rebind-ceremony.js").DeviceRebindResult | null>;
59
+ confirm: (request: Request, clientKey: string, commitment: string) => Promise<import("./coordinator-device-rebind-ceremony.js").DeviceRebindResult | null>;
60
+ start: (input: import("./coordinator-device-rebind-ceremony.js").DeviceRebindStart, clientKey: string) => Promise<import("./coordinator-device-rebind-ceremony.js").DeviceRebindResult | null>;
61
+ finalize: (input: {
62
+ attemptId: string;
63
+ signer: import("./coordinator-device-rebind-ceremony.js").DeviceRebindSigner;
64
+ completionSecret: string;
65
+ signature: string;
66
+ }) => Promise<import("./coordinator-device-rebind-ceremony.js").DeviceRebindResult | null>;
67
+ status: (input: {
68
+ attemptId: string;
69
+ signer: import("./coordinator-device-rebind-ceremony.js").DeviceRebindSigner;
70
+ }) => Promise<import("./coordinator-device-rebind-ceremony.js").DeviceRebindResult | null>;
71
+ }>) => {
72
+ start: () => Promise<import("./coordinator-device-rebind-ceremony.js").DeviceRebindResult | null>;
73
+ claim: () => Promise<import("./coordinator-device-rebind-ceremony.js").DeviceRebindResult | null>;
74
+ verify: () => Promise<import("./coordinator-device-rebind-ceremony.js").DeviceRebindResult | null>;
75
+ confirm: () => Promise<import("./coordinator-device-rebind-ceremony.js").DeviceRebindResult | null>;
76
+ };
77
+ makeCeremony: (backend: AuthLinkBackend) => Readonly<{
78
+ claimBrowser: (request: Request, clientKey: string) => Promise<import("./coordinator-device-rebind-ceremony.js").DeviceRebindResult | null>;
79
+ verifyCallback: (request: Request) => Promise<import("./coordinator-device-rebind-ceremony.js").DeviceRebindResult | null>;
80
+ confirm: (request: Request, clientKey: string, commitment: string) => Promise<import("./coordinator-device-rebind-ceremony.js").DeviceRebindResult | null>;
81
+ start: (input: import("./coordinator-device-rebind-ceremony.js").DeviceRebindStart, clientKey: string) => Promise<import("./coordinator-device-rebind-ceremony.js").DeviceRebindResult | null>;
82
+ finalize: (input: {
83
+ attemptId: string;
84
+ signer: import("./coordinator-device-rebind-ceremony.js").DeviceRebindSigner;
85
+ completionSecret: string;
86
+ signature: string;
87
+ }) => Promise<import("./coordinator-device-rebind-ceremony.js").DeviceRebindResult | null>;
88
+ status: (input: {
89
+ attemptId: string;
90
+ signer: import("./coordinator-device-rebind-ceremony.js").DeviceRebindSigner;
91
+ }) => Promise<import("./coordinator-device-rebind-ceremony.js").DeviceRebindResult | null>;
92
+ }>;
93
+ finalizedInput: (row: DeviceRebindAttempt, secret: string) => {
94
+ attemptId: string;
95
+ signer: {
96
+ groupId: string;
97
+ deviceId: string;
98
+ publicKey: string;
99
+ fingerprint: string;
100
+ };
101
+ completionSecret: string;
102
+ signature: string;
103
+ };
104
+ close: () => Promise<void>;
105
+ }>;
106
+ /** Stores a canonical legacy completion of group-a that assigns device-a to its Identity. */
107
+ export declare function assignLegacyCompletion(f: Awaited<ReturnType<typeof selfBindFixture>>): void;
108
+ /**
109
+ * Stores a retained legacy owner resolution for device-a whose original source is the
110
+ * device's own controller review. The self-bind authority then takes the path that
111
+ * reads and classifies ownership evidence, which needs a backend that can read rows.
112
+ */
113
+ export declare function retainOwnReviewOwnership(f: Awaited<ReturnType<typeof selfBindFixture>>): Promise<void>;
114
+ //# sourceMappingURL=coordinator-device-self-bind-test-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator-device-self-bind-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-device-self-bind-test-fixtures.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAQtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EACN,KAAK,OAAO,EAKZ,MAAM,2CAA2C,CAAC;AAInD,OAAO,EACN,KAAK,mBAAmB,EAExB,MAAM,sCAAsC,CAAC;AAa9C,eAAO,MAAM,aAAa,gBAAoB,CAAC;AAU/C;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,MAAM,GAAG,iBAAiB,CAAC;AAkJpE,MAAM,WAAW,sBAAsB;IACtC,aAAa,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CACjC;AAED,wBAAsB,eAAe,CACpC,IAAI,EAAE,OAAO,EACb,MAAM,GAAE,kBAA0B,EAClC,UAAU,SAAmB,EAC7B,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAQL,eAAe;;;;;;;;;;;;;;;;0BA8BjB,mBAAmB,UAAU,MAAM;;;;;;;;;;;;GAmBhE;AAuDD,6FAA6F;AAC7F,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,GAAG,IAAI,CAsC3F;AAED;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC7C,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,GAC5C,OAAO,CAAC,IAAI,CAAC,CA2Bf"}
@@ -0,0 +1,26 @@
1
+ export interface CoordinatorDeviceSetupOptions {
2
+ dbPath: string;
3
+ keysDir?: string;
4
+ coordinatorUrl: string;
5
+ groupId: string;
6
+ currentIdentityId: string;
7
+ fetch?: typeof globalThis.fetch;
8
+ signal?: AbortSignal;
9
+ }
10
+ export type CoordinatorDeviceSetupOutcome = {
11
+ kind: "ready" | "complete" | "requires_review" | "connect_required";
12
+ } | {
13
+ kind: "unsupported";
14
+ cause: "coordinator_upgrade_required";
15
+ } | {
16
+ kind: "unknown";
17
+ cause: "completion_outcome_unknown";
18
+ } | {
19
+ kind: "unavailable";
20
+ cause: "device_unavailable" | "invalid_input" | "coordinator_unreachable" | "invalid_response" | "coordinator_rejected" | "rate_limited" | "coordinator_auth_schema_upgrade_required" | "coordinator_unavailable";
21
+ };
22
+ /** Read status once without attempting completion or changing local state. */
23
+ export declare function readCoordinatorDeviceSetup(options: CoordinatorDeviceSetupOptions): Promise<CoordinatorDeviceSetupOutcome>;
24
+ /** Complete directly. Resolve an ambiguous POST with one GET, never a POST retry. */
25
+ export declare function completeCoordinatorDeviceSetup(options: CoordinatorDeviceSetupOptions): Promise<CoordinatorDeviceSetupOutcome>;
26
+ //# sourceMappingURL=coordinator-device-setup-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator-device-setup-client.d.ts","sourceRoot":"","sources":["../src/coordinator-device-setup-client.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,6BAA6B;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB;AACD,MAAM,MAAM,6BAA6B,GACtC;IAAE,IAAI,EAAE,OAAO,GAAG,UAAU,GAAG,iBAAiB,GAAG,kBAAkB,CAAA;CAAE,GACvE;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,8BAA8B,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,4BAA4B,CAAA;CAAE,GACxD;IACA,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EACF,oBAAoB,GACpB,eAAe,GACf,yBAAyB,GACzB,kBAAkB,GAClB,sBAAsB,GACtB,cAAc,GACd,0CAA0C,GAC1C,yBAAyB,CAAC;CAC5B,CAAC;AAmKL,8EAA8E;AAC9E,wBAAgB,0BAA0B,CACzC,OAAO,EAAE,6BAA6B,GACpC,OAAO,CAAC,6BAA6B,CAAC,CAExC;AAED,qFAAqF;AACrF,wBAAgB,8BAA8B,CAC7C,OAAO,EAAE,6BAA6B,GACpC,OAAO,CAAC,6BAA6B,CAAC,CAExC"}
@@ -0,0 +1,9 @@
1
+ /** Same-Identity completion derives authority from a committed own-device claim. */
2
+ import type { Hono } from "hono";
3
+ import { type DeviceAuthLinkDeps } from "./coordinator-device-auth-link.js";
4
+ export declare const DEVICE_BINDING_PATH = "/v1/auth/device-binding";
5
+ /** Uses the maintained signed admission, including nonce/revocation checks. */
6
+ export declare function registerCoordinatorDeviceSetupRoutes(app: Hono, deps: DeviceAuthLinkDeps & {
7
+ now?: () => number;
8
+ }): void;
9
+ //# sourceMappingURL=coordinator-device-setup-http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator-device-setup-http.d.ts","sourceRoot":"","sources":["../src/coordinator-device-setup-http.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EACN,KAAK,kBAAkB,EAGvB,MAAM,mCAAmC,CAAC;AAO3C,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAmE7D,+EAA+E;AAC/E,wBAAgB,oCAAoC,CACnD,GAAG,EAAE,IAAI,EACT,IAAI,EAAE,kBAAkB,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CAAE,GAC/C,IAAI,CAeN"}
@@ -11,11 +11,15 @@ export declare function captureHistorySql(backend: Backend, input: {
11
11
  }): Promise<{
12
12
  statement: AuthLinkStatement;
13
13
  observedRows: unknown[];
14
+ /**
15
+ * 1 while every guard of the winning batch holds. With `reference`, the history
16
+ * guard uses the frozen selector instead of the live one.
17
+ */
14
18
  current(options?: {
15
19
  reference?: boolean;
16
20
  }): Promise<{
17
21
  current: number;
18
- } | null>;
22
+ }>;
19
23
  }>;
20
24
  export declare function historyCases(statement: AuthLinkStatement): {
21
25
  name: string;
@@ -23,10 +27,10 @@ export declare function historyCases(statement: AuthLinkStatement): {
23
27
  selected: boolean;
24
28
  }[];
25
29
  export declare function compareHistorySql(backend: Backend, statement: AuthLinkStatement): Promise<{
26
- error?: undefined;
27
30
  rows: {
28
31
  row: string;
29
32
  }[];
33
+ error?: undefined;
30
34
  } | {
31
35
  rows?: undefined;
32
36
  error: string;
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator-history-sql-equivalence-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-history-sql-equivalence-test-fixtures.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAOpE,KAAK,OAAO,GAAG;IACd,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACnD,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;CAC1D,CAAC;AAoBF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAsBvD;AAED,wBAAsB,iBAAiB,CACtC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE;;;sBAyB7C;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE;iBAGb,MAAM;;GAMxC;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,iBAAiB;UAYpC,MAAM;SAAO,MAAM;cAAY,OAAO;IA0B1D;AAuDD,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB;;;aAG3C,MAAM;;;;;GAShD"}
1
+ {"version":3,"file":"coordinator-history-sql-equivalence-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-history-sql-equivalence-test-fixtures.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAOpE,KAAK,OAAO,GAAG;IACd,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACnD,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;CAC1D,CAAC;AAoBF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAsBvD;AAED,wBAAsB,iBAAiB,CACtC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE;;;IA0BpE;;;OAGG;sBACoB;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE;;;GAc/C;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,iBAAiB;UAYpC,MAAM;SAAO,MAAM;cAAY,OAAO;IA0B1D;AAuDD,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB;;aAG3C,MAAM;;;;;;GAShD"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Test-only. This file exists only to pin equivalence with the pre-port SQL.
3
+ *
4
+ * Between the markers are, copied verbatim from main at 075d46647 before legacy team
5
+ * completions moved to guarded capture reads: the whole of
6
+ * coordinator-legacy-completion-owner-proof.ts below its imports, and the winning INSERT
7
+ * of BetterSqliteCoordinatorStore.createLegacyTeamCompletion. Only the INSERT was wrapped
8
+ * in a function that binds what the store bound, in the same order; the D1 store sent
9
+ * the same statement with other whitespace. Do not edit the copy to follow later
10
+ * changes; delete this file with
11
+ * coordinator-legacy-completion-owner-proof-equivalence.test.ts.
12
+ */
13
+ import { type ControllerHistoryRecord, type ControllerHistorySnapshot } from "./coordinator-auth-controller-history.js";
14
+ import type { AuthLinkStatement } from "./coordinator-auth-link.js";
15
+ import { type EvidenceRow, type EvidenceRows, type EvidenceSubject } from "./coordinator-device-ownership-evidence-classify.js";
16
+ interface Backend {
17
+ first<T>(statement: AuthLinkStatement): Promise<T | null>;
18
+ all<T>(statement: AuthLinkStatement): Promise<T[]>;
19
+ }
20
+ /** Internal capability, meaningful only to this module's WeakMap. */
21
+ export interface LegacyCompletionOwnerProof {
22
+ readonly version: 1;
23
+ }
24
+ interface Subject extends EvidenceSubject {
25
+ owner: string;
26
+ fragments: string[];
27
+ fingerprints: string[];
28
+ }
29
+ interface ProofSql {
30
+ /** Append after LEGACY_OWNER_INPUT_SQL, which already starts WITH. */
31
+ readonly ctes: string;
32
+ readonly currentSql: string;
33
+ readonly compatibleSql: string;
34
+ /** Bind after the three LEGACY_OWNER_INPUT_SQL values. */
35
+ readonly values: readonly string[];
36
+ }
37
+ /** Internal capture preparation; not exported from the package entrypoint. */
38
+ export declare function prepareCompletionHistory(rows: EvidenceRow[], decode?: (text: string) => unknown): {
39
+ row: EvidenceRow;
40
+ record: ControllerHistoryRecord;
41
+ decode: () => unknown;
42
+ }[];
43
+ /** Internal subject view; canonical validation remains subject-specific. */
44
+ export declare function subjectHistory(rows: EvidenceRows, subject: Subject, keys: Map<string, string>, prepared: ReturnType<typeof prepareCompletionHistory>): ControllerHistorySnapshot;
45
+ /** Read-only capture. No submitted approved-subject list or source reference is accepted.
46
+ * Call only after the stores validate the canonical manifest and its source binding.
47
+ */
48
+ export declare function captureLegacyCompletionOwnerProof(input: {
49
+ backend: Backend;
50
+ groupId: string;
51
+ manifestJson: string;
52
+ keyMetadata: string;
53
+ }): Promise<LegacyCompletionOwnerProof>;
54
+ /** The winning INSERT must use both predicates. A token by itself grants nothing.
55
+ * Keep LEGACY_OWNER_SOURCE_CURRENT_SQL and all ordinary completion checks as well.
56
+ */
57
+ export declare function legacyCompletionOwnerProofSql(proof: LegacyCompletionOwnerProof): ProofSql;
58
+ /** The pre-port INSERT, bound as the store bound it. */
59
+ export declare function originalLegacyCompletionInsertStatement(input: {
60
+ proof: {
61
+ ctes: string;
62
+ currentSql: string;
63
+ compatibleSql: string;
64
+ values: readonly string[];
65
+ };
66
+ groupId: string;
67
+ manifest: {
68
+ candidate_ref: string;
69
+ version: number;
70
+ completed_at: string;
71
+ };
72
+ manifestJson: string;
73
+ coordinatorId: string | null;
74
+ createdAt: string;
75
+ }): AuthLinkStatement;
76
+ export {};
77
+ //# sourceMappingURL=coordinator-legacy-completion-owner-proof-original-sql-test-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator-legacy-completion-owner-proof-original-sql-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-completion-owner-proof-original-sql-test-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAG9B,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAEN,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,eAAe,EAGpB,MAAM,qDAAqD,CAAC;AAsB7D,UAAU,OAAO;IAChB,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC1D,GAAG,CAAC,CAAC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AuC,CAAC,KAAK,EAAE;IAC9D,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC;IAC9F,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3E,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;CAClB,GAAG,iBAAiB,CA+DpB"}
@@ -0,0 +1,46 @@
1
+ import type { LinkFixture } from "./coordinator-auth-link-test-fixtures.js";
2
+ import type { Backend } from "./coordinator-auth-store-test-fixtures.js";
3
+ import type { CoordinatorLegacyTeamCompletionManifestV1 } from "./coordinator-legacy-team-completion.js";
4
+ export declare const futureGroup = "future-completion";
5
+ export declare const completions = "coordinator_legacy_team_completions";
6
+ export declare const resolutions = "coordinator_legacy_owner_resolutions";
7
+ export declare const controllers = "coordinator_auth_controller_attestations";
8
+ export declare function manifest(f: LinkFixture, owner?: string, options?: {
9
+ deviceId?: string;
10
+ publicKey?: string;
11
+ groupId?: string;
12
+ }): CoordinatorLegacyTeamCompletionManifestV1;
13
+ export declare function ordinary(f: LinkFixture): Promise<CoordinatorLegacyTeamCompletionManifestV1>;
14
+ export declare function recovery(f: LinkFixture, kind: Backend): Promise<{
15
+ h: {
16
+ backend: import("./coordinator-auth-link.js").AuthLinkBackend & Required<Pick<import("./coordinator-auth-link.js").AuthLinkBackend, "readBatch">>;
17
+ hooks: {
18
+ beforeBatch?: () => void;
19
+ mapStatement?: (statement: import("./coordinator-auth-link.js").AuthLinkStatement) => import("./coordinator-auth-link.js").AuthLinkStatement;
20
+ afterBatch?: () => void;
21
+ beforeFirst?: (statement: import("./coordinator-auth-link.js").AuthLinkStatement) => void;
22
+ };
23
+ batchCount: () => number;
24
+ resetBatchCount: () => void;
25
+ evidence: import("./coordinator-device-ownership-evidence.js").CoordinatorDeviceOwnershipEvidence;
26
+ };
27
+ result: {
28
+ controller: import("./coordinator-auth-controller.js").CoordinatorAuthControllerAttestation;
29
+ controllerDisposition: "created" | "reused";
30
+ resolution: import("./coordinator-legacy-owner-resolution-metadata.js").LegacyOwnerResolutionRecord;
31
+ resolutionDisposition: "created" | "reused";
32
+ };
33
+ value: CoordinatorLegacyTeamCompletionManifestV1;
34
+ }>;
35
+ export declare const WINNING_INSERT: RegExp;
36
+ export declare const GUARD_MARKER = "auth_snapshot_changed";
37
+ /**
38
+ * Runs `inject` once, just before the winning transaction starts. Both stores write the
39
+ * completion in one transaction the capture's guards lead (the D1 batch is one), so this
40
+ * is the last moment a concurrent write can land. A hook inside it would be rolled back
41
+ * with the batch, or would model an interleaving neither store allows.
42
+ */
43
+ export declare function beforeWinningBatch(f: LinkFixture, inject: () => void): {
44
+ injected: () => boolean;
45
+ };
46
+ //# sourceMappingURL=coordinator-legacy-completion-owner-proof-test-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator-legacy-completion-owner-proof-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-completion-owner-proof-test-fixtures.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AAUzE,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,yCAAyC,CAAC;AAOzG,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAC/C,eAAO,MAAM,WAAW,wCAAwC,CAAC;AACjE,eAAO,MAAM,WAAW,yCAAyC,CAAC;AAClE,eAAO,MAAM,WAAW,6CAA6C,CAAC;AAEtE,wBAAgB,QAAQ,CACvB,CAAC,EAAE,WAAW,EACd,KAAK,SAAe,EACpB,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GACvE,yCAAyC,CA+B3C;AAED,wBAAsB,QAAQ,CAAC,CAAC,EAAE,WAAW,sDAQ5C;AAED,wBAAsB,QAAQ,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;GA8D3D;AAED,eAAO,MAAM,cAAc,QACqD,CAAC;AACjF,eAAO,MAAM,YAAY,0BAA0B,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,IAAI;IAuB3D,QAAQ;EACjB"}
@@ -15,8 +15,14 @@ interface Subject extends EvidenceSubject {
15
15
  fingerprints: string[];
16
16
  }
17
17
  interface ProofSql {
18
+ /**
19
+ * One per capture read. Each re-runs its read and aborts its batch unless the rows are
20
+ * still the captured set. They lead the winning INSERT's batch, and the denial read.
21
+ */
22
+ readonly guards: readonly AuthLinkStatement[];
18
23
  /** Append after LEGACY_OWNER_INPUT_SQL, which already starts WITH. */
19
24
  readonly ctes: string;
25
+ /** "1" once captured; "0" when the capture is unavailable, so nothing can be written. */
20
26
  readonly currentSql: string;
21
27
  readonly compatibleSql: string;
22
28
  /** Bind after the three LEGACY_OWNER_INPUT_SQL values. */
@@ -30,6 +36,16 @@ export declare function prepareCompletionHistory(rows: EvidenceRow[], decode?: (
30
36
  }[];
31
37
  /** Internal subject view; canonical validation remains subject-specific. */
32
38
  export declare function subjectHistory(rows: EvidenceRows, subject: Subject, keys: Map<string, string>, prepared: ReturnType<typeof prepareCompletionHistory>): ControllerHistorySnapshot;
39
+ /**
40
+ * Internal; exported for its tests. Re-runs one read, `prefix` then a SELECT of distinct
41
+ * `row` texts, and aborts its batch unless those rows are exactly `rows`: equal as sorted
42
+ * text, so each original JSON lexeme must match, and none may be added or removed.
43
+ */
44
+ export declare function capturedRowsGuard(read: {
45
+ prefix: string;
46
+ sql: string;
47
+ values: readonly string[];
48
+ }, rows: readonly string[]): AuthLinkStatement;
33
49
  /** Read-only capture. No submitted approved-subject list or source reference is accepted.
34
50
  * Call only after the stores validate the canonical manifest and its source binding.
35
51
  */
@@ -39,8 +55,9 @@ export declare function captureLegacyCompletionOwnerProof(input: {
39
55
  manifestJson: string;
40
56
  keyMetadata: string;
41
57
  }): Promise<LegacyCompletionOwnerProof>;
42
- /** The winning INSERT must use both predicates. A token by itself grants nothing.
43
- * Keep LEGACY_OWNER_SOURCE_CURRENT_SQL and all ordinary completion checks as well.
58
+ /** The winning INSERT must use both predicates, in one batch its guards lead. A token
59
+ * by itself grants nothing. Keep LEGACY_OWNER_SOURCE_CURRENT_SQL and all ordinary
60
+ * completion checks as well.
44
61
  */
45
62
  export declare function legacyCompletionOwnerProofSql(proof: LegacyCompletionOwnerProof): ProofSql;
46
63
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator-legacy-completion-owner-proof.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-completion-owner-proof.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAG9B,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAEN,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,eAAe,EAGpB,MAAM,qDAAqD,CAAC;AAoB7D,UAAU,OAAO;IAChB,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC1D,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;CACnD;AAED,qEAAqE;AACrE,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;CACpB;AAED,UAAU,OAAQ,SAAQ,eAAe;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;CACvB;AAcD,UAAU,QAAQ;IACjB,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAoVD,8EAA8E;AAC9E,wBAAgB,wBAAwB,CACvC,IAAI,EAAE,WAAW,EAAE,EACnB,MAAM,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAoB;;;;IAsB9C;AAED,4EAA4E;AAC5E,wBAAgB,cAAc,CAC7B,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACzB,QAAQ,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,GACnD,yBAAyB,CA8C3B;AAwPD;;GAEG;AACH,wBAAsB,iCAAiC,CAAC,KAAK,EAAE;IAC9D,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAyBtC;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,0BAA0B,GAAG,QAAQ,CAEzF"}
1
+ {"version":3,"file":"coordinator-legacy-completion-owner-proof.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-completion-owner-proof.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,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E,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACzB,QAAQ,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,GACnD,yBAAyB,CA8C3B;AA8HD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAChE,IAAI,EAAE,SAAS,MAAM,EAAE,GACrB,iBAAiB,CAMnB;AAyID;;GAEG;AACH,wBAAsB,iCAAiC,CAAC,KAAK,EAAE;IAC9D,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAwBtC;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,0BAA0B,GAAG,QAAQ,CAEzF"}
@@ -1,3 +1,4 @@
1
+ import type { AuthLinkStatement } from "./coordinator-auth-link.js";
1
2
  import { type CoordinatorLegacyTeamCompletionWriteResult } from "./coordinator-legacy-team-completion.js";
2
3
  /** Both the early replay and the post-INSERT winner retain the canonical row. */
3
4
  export declare function legacyCompletionWriteResult(storedJson: string, requestedJson: string, status: CoordinatorLegacyTeamCompletionWriteResult["status"]): CoordinatorLegacyTeamCompletionWriteResult;
@@ -30,4 +31,26 @@ export declare const LEGACY_OWNER_SOURCE_CURRENT_SQL = "(NOT EXISTS (SELECT 1 FR
30
31
  export declare const LEGACY_OWNER_COMPATIBLE_SQL: string;
31
32
  /** Used only to explain a refused INSERT; this cannot authorize a write. */
32
33
  export declare const LEGACY_OWNER_DENIAL_SQL: string;
34
+ /**
35
+ * The winning completion INSERT. Every ordinary completion check and both owner checks
36
+ * run in it, so they decide at write time; the capture's guards lead its batch. `proof`
37
+ * starts with the three LEGACY_OWNER_INPUT_SQL values.
38
+ */
39
+ export declare function legacyCompletionInsertStatement(input: {
40
+ proof: {
41
+ ctes: string;
42
+ currentSql: string;
43
+ compatibleSql: string;
44
+ values: readonly (string | number | null)[];
45
+ };
46
+ groupId: string;
47
+ manifest: {
48
+ candidate_ref: string;
49
+ version: number;
50
+ completed_at: string;
51
+ };
52
+ manifestJson: string;
53
+ coordinatorId: string | null;
54
+ createdAt: string;
55
+ }): AuthLinkStatement;
33
56
  //# sourceMappingURL=coordinator-legacy-owner-compatibility.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator-legacy-owner-compatibility.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-owner-compatibility.ts"],"names":[],"mappings":"AACA,OAAO,EAIN,KAAK,0CAA0C,EAG/C,MAAM,yCAAyC,CAAC;AAKjD,iFAAiF;AACjF,wBAAgB,2BAA2B,CAC1C,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,0CAA0C,CAAC,QAAQ,CAAC,GAC1D,0CAA0C,CAM5C;AA4BD,uDAAuD;AACvD,eAAO,MAAM,qBAAqB,QAMS,CAAC;AAE5C;;;GAGG;AACH,wBAAsB,sBAAsB,CAC3C,IAAI,EAAE,SAAS;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,EAAE,GACrC,OAAO,CAAC,MAAM,CAAC,CAuBjB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,QAqBjC,CAAC;AAGH,eAAO,MAAM,+BAA+B,4PAGmC,CAAC;AAEhF;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,QAqBtC,CAAC;AAEH,4EAA4E;AAC5E,eAAO,MAAM,uBAAuB,QAGkB,CAAC"}
1
+ {"version":3,"file":"coordinator-legacy-owner-compatibility.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-owner-compatibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE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+ *
4
+ * Between the markers are, copied verbatim from main at 075d46647 before the owner
5
+ * resolution commit moved to read-set guards: the snapshot, owner and resolution stages
6
+ * of coordinator-auth-controller.ts with the statements built on them, and the commit
7
+ * half of coordinator-legacy-owner-resolution-commit.ts. Only the commit's entry point
8
+ * was renamed, and its evidence collector type now names the verbatim pre-port collector.
9
+ * The review capture it reads is imported: it is unchanged since that commit. Its unused
10
+ * `digest` helper was dropped. Do not edit
11
+ * the copy to follow later changes; delete this file with
12
+ * coordinator-legacy-owner-resolution-commit-equivalence.test.ts.
13
+ */
14
+ import type { CoordinatorAuthControllerAttestation, CoordinatorAuthControllerReviewInput } from "./coordinator-auth-controller.js";
15
+ import type { AuthLinkBackend } from "./coordinator-auth-link.js";
16
+ import type { OriginalDeviceOwnershipEvidence } from "./coordinator-device-ownership-evidence-original-sql-test-fixtures.js";
17
+ import { type LegacyOwnerResolutionRecord } from "./coordinator-legacy-owner-resolution-metadata.js";
18
+ /** Pin the actual enrollment used to derive the revocation key across async reads. */
19
+ export declare function authControllerAuthorityValues(source: {
20
+ group_id: string;
21
+ device_id: string;
22
+ public_key: string;
23
+ fingerprint: string;
24
+ identity_id: string | null;
25
+ }, keyId: string | null): (string | null)[];
26
+ export declare const AUTH_CONTROLLER_ENROLLMENT_SQL = "\n\tSELECT e.* FROM enrolled_devices e WHERE e.group_id = ? AND e.device_id = ?";
27
+ export declare const AUTH_CONTROLLER_INSERT_SQL = "\n\t\n\tWITH snapshot(value) AS (SELECT ?), snapshot_invites AS MATERIALIZED (\n\t\tSELECT json_extract(j.value, '$.inviteId') AS invite_id,\n\t\t\tjson_extract(j.value, '$.kind') AS invite_kind,\n\t\t\tjson_extract(j.value, '$.actorId') AS recipient_actor_id,\n\t\t\tjson_extract(j.value, '$.assignedIdentityId') AS assigned_identity_id,\n\t\t\tjson_extract(j.value, '$.targetIdentityId') AS target_identity_id,\n\t\t\tjson_extract(j.value, '$.digest') AS reviewed_preview_digest\n\t\tFROM json_each((SELECT value FROM snapshot), '$.invites') j\n\t), live_invites AS MATERIALIZED (\n\t\tSELECT i.invite_id, i.invite_kind, i.recipient_actor_id, i.assigned_identity_id,\n\t\t\ti.target_identity_id, i.reviewed_preview_digest FROM coordinator_invites i\n\t\tWHERE i.group_id = ? AND i.bound_device_id = ? AND i.bound_public_key = ?\n\t\t\tAND i.bound_fingerprint = ? AND i.revoked_at IS NULL\n\t\t\tAND i.consumed_at IS NOT NULL AND i.consumed_at != ''\n\t\t\tAND i.invite_kind IN ('team_member', 'add_device')\n\t), history_input AS MATERIALIZED (\n SELECT json_extract(value, '$.legacyHistory') AS value FROM snapshot\n), history_key_sources AS NOT MATERIALIZED (\n SELECT public_key, fingerprint FROM enrolled_devices\n UNION\n SELECT a.public_key, a.fingerprint FROM coordinator_auth_controller_attestations a\n CROSS JOIN history_input h\n WHERE a.coordinator_id = json_extract(h.value, '$.coordinatorId')\n), history_rows AS NOT MATERIALIZED (\n SELECT c.*, CASE WHEN json_valid(c.manifest_json) THEN c.manifest_json ELSE '{}' END AS parsed\n FROM coordinator_legacy_team_completions c\n), live_history AS MATERIALIZED (\n SELECT c.group_id, c.candidate_ref, c.manifest_version, c.completed_at, c.created_at,\n CASE WHEN length(CAST(c.manifest_json AS BLOB)) <= 750000 THEN c.manifest_json ELSE NULL END AS manifest_json\n FROM history_rows c CROSS JOIN history_input h\n WHERE h.value IS NOT NULL\n AND (json_extract(c.parsed, '$.coordinator_id') = json_extract(h.value, '$.coordinatorId')\n OR json_extract(c.parsed, '$.coordinator_id') IS NULL)\n AND (EXISTS (\n SELECT 1 FROM json_each(c.parsed, '$.device_decisions') d\n WHERE json_extract(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.device_id') = json_extract(h.value, '$.deviceId')\n OR json_extract(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.key_fingerprint')\n IN (SELECT value FROM json_each(h.value, '$.fingerprints'))\n OR ((d.type <> 'object'\n OR json_type(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.device_id') IS NOT 'text'\n OR json_type(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.key_fingerprint') IS NOT 'text')\n AND (instr(CASE WHEN d.type = 'text' THEN json_quote(d.value) ELSE d.value END,\n json_quote(json_extract(h.value, '$.deviceId'))) > 0\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.fingerprints') f\n WHERE instr(d.value, f.value) > 0)))\n ) OR ((json_valid(c.manifest_json) = 0 OR json_type(c.parsed, '$.device_decisions') IS NOT 'array') AND (\n instr(c.manifest_json, json_quote(json_extract(h.value, '$.deviceId'))) > 0\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.fingerprints') f\n WHERE instr(c.manifest_json, f.value) > 0)\n ))) LIMIT 501\n), snapshot_history AS MATERIALIZED (\n SELECT json_extract(j.value, '$.group_id') AS group_id,\n json_extract(j.value, '$.candidate_ref') AS candidate_ref,\n json_extract(j.value, '$.manifest_version') AS manifest_version,\n json_extract(j.value, '$.completed_at') AS completed_at,\n json_extract(j.value, '$.created_at') AS created_at,\n json_extract(j.value, '$.manifest_json') AS manifest_json\n FROM history_input h, json_each(h.value, '$.records') j\n), snapshot_history_keys AS MATERIALIZED (\n SELECT json_extract(j.value, '$.public_key') AS public_key,\n json_extract(j.value, '$.fingerprint') AS fingerprint\n FROM history_input h, json_each(h.value, '$.keys') j\n), snapshot_discovery_keys AS MATERIALIZED (\n SELECT j.value AS public_key FROM history_input h, json_each(h.value, '$.discoveryKeys') j\n), discovery_lines AS NOT MATERIALIZED (\n SELECT public_key,\n ltrim(replace(replace(replace(replace(replace(public_key,\n char(9), ' '), char(10), ' '), char(11), ' '), char(12), ' '), char(13), ' '), ' ') AS line\n FROM history_key_sources\n), discovery_tails AS NOT MATERIALIZED (\n SELECT public_key, CASE WHEN substr(line, 1, 12) = 'ssh-ed25519 '\n THEN ltrim(substr(line, 13), ' ') ELSE NULL END AS tail FROM discovery_lines\n), discovery_tokens AS NOT MATERIALIZED (\n SELECT public_key, CASE WHEN tail IS NOT NULL\n THEN substr(tail, 1, instr(tail || ' ', ' ') - 1) ELSE NULL END AS token\n FROM discovery_tails\n), live_discovery_keys AS MATERIALIZED (\n SELECT DISTINCT e.public_key FROM discovery_tokens e CROSS JOIN history_input h\n WHERE e.public_key = json_extract(h.value, '$.publicKey')\n OR instr(e.public_key, char(0)) > 0\n OR e.token IS NULL\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.discoveryFragments') f\n WHERE instr(replace(replace(e.token, '-', '+'), '_', '/'), f.value) > 0)\n OR e.token GLOB '*[^A-Za-z0-9+/=_-]*'\n LIMIT 8193\n), live_history_keys AS MATERIALIZED (\n SELECT DISTINCT e.public_key, e.fingerprint FROM history_key_sources e\n WHERE e.public_key IN (SELECT public_key FROM snapshot_history_keys)\n LIMIT 4097\n)\n\tINSERT INTO coordinator_auth_controller_attestations (\n\t\tattestation_id, coordinator_id, identity_id, group_id, device_id, public_key,\n\t\tfingerprint, review_receipt_id, evidence_digest, enrollment_identity_id, revision, created_at, revoked_at\n\t)\n\tSELECT ?, ?, ?, e.group_id, e.device_id, e.public_key, e.fingerprint, ?, ?, e.identity_id, 1, ?, NULL\n\tFROM enrolled_devices e JOIN groups g ON g.group_id = e.group_id\n\tWHERE e.group_id = ? AND e.device_id = ? AND e.enabled = 1 AND g.archived_at IS NULL\n\t\tAND e.public_key = ? AND e.fingerprint = ? AND (e.identity_id IS NULL OR e.identity_id = ?)\n\t\t\n\tAND ((SELECT value FROM snapshot) IS NULL OR (\n\t\te.identity_id IS json_extract((SELECT value FROM snapshot), '$.enrollmentIdentityId')\n\t\tAND (SELECT count(*) FROM live_invites) =\n\t\t\t(SELECT count(*) FROM snapshot_invites)\n\t\tAND NOT EXISTS (\n\t\t\tSELECT * FROM live_invites\n\t\t\tEXCEPT\n\t\t\tSELECT * FROM snapshot_invites\n\t\t)\n\t)) AND (\n (SELECT value FROM history_input) IS NULL OR (\n json_extract((SELECT value FROM history_input), '$.deviceId') = e.device_id\n AND json_extract((SELECT value FROM history_input), '$.publicKey') = e.public_key\n AND json_extract((SELECT value FROM history_input), '$.fingerprint') = e.fingerprint\n AND (SELECT count(*) FROM live_history) = (SELECT count(*) FROM snapshot_history)\n AND NOT EXISTS (SELECT * FROM live_history EXCEPT SELECT * FROM snapshot_history)\n AND NOT EXISTS (SELECT * FROM live_history_keys EXCEPT SELECT * FROM snapshot_history_keys)\n AND NOT EXISTS (SELECT * FROM snapshot_history_keys EXCEPT SELECT * FROM live_history_keys)\n AND NOT EXISTS (SELECT * FROM live_discovery_keys EXCEPT SELECT * FROM snapshot_discovery_keys)\n AND NOT EXISTS (SELECT * FROM snapshot_discovery_keys EXCEPT SELECT * FROM live_discovery_keys)\n ))\n\t\t\n\tAND e.group_id = ? AND e.device_id = ? AND e.public_key = ?\n\tAND e.fingerprint = ? AND e.identity_id IS ?\n\tAND NOT EXISTS (SELECT 1 FROM coordinator_device_revocations WHERE\n\t\t(subject_kind = 'device_id' AND subject_value = ?) OR\n\t\t(subject_kind = 'ed25519_key' AND subject_value = ?))";
28
+ /** Retry eligibility is read atomically with all the same live evidence guards. */
29
+ export declare const AUTH_CONTROLLER_RETRY_ELIGIBLE_SQL = "\n\t\n\tWITH snapshot(value) AS (SELECT ?), snapshot_invites AS MATERIALIZED (\n\t\tSELECT json_extract(j.value, '$.inviteId') AS invite_id,\n\t\t\tjson_extract(j.value, '$.kind') AS invite_kind,\n\t\t\tjson_extract(j.value, '$.actorId') AS recipient_actor_id,\n\t\t\tjson_extract(j.value, '$.assignedIdentityId') AS assigned_identity_id,\n\t\t\tjson_extract(j.value, '$.targetIdentityId') AS target_identity_id,\n\t\t\tjson_extract(j.value, '$.digest') AS reviewed_preview_digest\n\t\tFROM json_each((SELECT value FROM snapshot), '$.invites') j\n\t), live_invites AS MATERIALIZED (\n\t\tSELECT i.invite_id, i.invite_kind, i.recipient_actor_id, i.assigned_identity_id,\n\t\t\ti.target_identity_id, i.reviewed_preview_digest FROM coordinator_invites i\n\t\tWHERE i.group_id = ? AND i.bound_device_id = ? AND i.bound_public_key = ?\n\t\t\tAND i.bound_fingerprint = ? AND i.revoked_at IS NULL\n\t\t\tAND i.consumed_at IS NOT NULL AND i.consumed_at != ''\n\t\t\tAND i.invite_kind IN ('team_member', 'add_device')\n\t), history_input AS MATERIALIZED (\n SELECT json_extract(value, '$.legacyHistory') AS value FROM snapshot\n), history_key_sources AS NOT MATERIALIZED (\n SELECT public_key, fingerprint FROM enrolled_devices\n UNION\n SELECT a.public_key, a.fingerprint FROM coordinator_auth_controller_attestations a\n CROSS JOIN history_input h\n WHERE a.coordinator_id = json_extract(h.value, '$.coordinatorId')\n), history_rows AS NOT MATERIALIZED (\n SELECT c.*, CASE WHEN json_valid(c.manifest_json) THEN c.manifest_json ELSE '{}' END AS parsed\n FROM coordinator_legacy_team_completions c\n), live_history AS MATERIALIZED (\n SELECT c.group_id, c.candidate_ref, c.manifest_version, c.completed_at, c.created_at,\n CASE WHEN length(CAST(c.manifest_json AS BLOB)) <= 750000 THEN c.manifest_json ELSE NULL END AS manifest_json\n FROM history_rows c CROSS JOIN history_input h\n WHERE h.value IS NOT NULL\n AND (json_extract(c.parsed, '$.coordinator_id') = json_extract(h.value, '$.coordinatorId')\n OR json_extract(c.parsed, '$.coordinator_id') IS NULL)\n AND (EXISTS (\n SELECT 1 FROM json_each(c.parsed, '$.device_decisions') d\n WHERE json_extract(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.device_id') = json_extract(h.value, '$.deviceId')\n OR json_extract(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.key_fingerprint')\n IN (SELECT value FROM json_each(h.value, '$.fingerprints'))\n OR ((d.type <> 'object'\n OR json_type(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.device_id') IS NOT 'text'\n OR json_type(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.key_fingerprint') IS NOT 'text')\n AND (instr(CASE WHEN d.type = 'text' THEN json_quote(d.value) ELSE d.value END,\n json_quote(json_extract(h.value, '$.deviceId'))) > 0\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.fingerprints') f\n WHERE instr(d.value, f.value) > 0)))\n ) OR ((json_valid(c.manifest_json) = 0 OR json_type(c.parsed, '$.device_decisions') IS NOT 'array') AND (\n instr(c.manifest_json, json_quote(json_extract(h.value, '$.deviceId'))) > 0\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.fingerprints') f\n WHERE instr(c.manifest_json, f.value) > 0)\n ))) LIMIT 501\n), snapshot_history AS MATERIALIZED (\n SELECT json_extract(j.value, '$.group_id') AS group_id,\n json_extract(j.value, '$.candidate_ref') AS candidate_ref,\n json_extract(j.value, '$.manifest_version') AS manifest_version,\n json_extract(j.value, '$.completed_at') AS completed_at,\n json_extract(j.value, '$.created_at') AS created_at,\n json_extract(j.value, '$.manifest_json') AS manifest_json\n FROM history_input h, json_each(h.value, '$.records') j\n), snapshot_history_keys AS MATERIALIZED (\n SELECT json_extract(j.value, '$.public_key') AS public_key,\n json_extract(j.value, '$.fingerprint') AS fingerprint\n FROM history_input h, json_each(h.value, '$.keys') j\n), snapshot_discovery_keys AS MATERIALIZED (\n SELECT j.value AS public_key FROM history_input h, json_each(h.value, '$.discoveryKeys') j\n), discovery_lines AS NOT MATERIALIZED (\n SELECT public_key,\n ltrim(replace(replace(replace(replace(replace(public_key,\n char(9), ' '), char(10), ' '), char(11), ' '), char(12), ' '), char(13), ' '), ' ') AS line\n FROM history_key_sources\n), discovery_tails AS NOT MATERIALIZED (\n SELECT public_key, CASE WHEN substr(line, 1, 12) = 'ssh-ed25519 '\n THEN ltrim(substr(line, 13), ' ') ELSE NULL END AS tail FROM discovery_lines\n), discovery_tokens AS NOT MATERIALIZED (\n SELECT public_key, CASE WHEN tail IS NOT NULL\n THEN substr(tail, 1, instr(tail || ' ', ' ') - 1) ELSE NULL END AS token\n FROM discovery_tails\n), live_discovery_keys AS MATERIALIZED (\n SELECT DISTINCT e.public_key FROM discovery_tokens e CROSS JOIN history_input h\n WHERE e.public_key = json_extract(h.value, '$.publicKey')\n OR instr(e.public_key, char(0)) > 0\n OR e.token IS NULL\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.discoveryFragments') f\n WHERE instr(replace(replace(e.token, '-', '+'), '_', '/'), f.value) > 0)\n OR e.token GLOB '*[^A-Za-z0-9+/=_-]*'\n LIMIT 8193\n), live_history_keys AS MATERIALIZED (\n SELECT DISTINCT e.public_key, e.fingerprint FROM history_key_sources e\n WHERE e.public_key IN (SELECT public_key FROM snapshot_history_keys)\n LIMIT 4097\n)\n\tSELECT 1 AS eligible FROM enrolled_devices e JOIN groups g ON g.group_id = e.group_id\n\tWHERE e.group_id = ? AND e.device_id = ? AND e.enabled = 1 AND g.archived_at IS NULL\n\t\tAND e.public_key = ? AND e.fingerprint = ? AND (e.identity_id IS NULL OR e.identity_id = ?)\n\t\t\n\tAND ((SELECT value FROM snapshot) IS NULL OR (\n\t\te.identity_id IS json_extract((SELECT value FROM snapshot), '$.enrollmentIdentityId')\n\t\tAND (SELECT count(*) FROM live_invites) =\n\t\t\t(SELECT count(*) FROM snapshot_invites)\n\t\tAND NOT EXISTS (\n\t\t\tSELECT * FROM live_invites\n\t\t\tEXCEPT\n\t\t\tSELECT * FROM snapshot_invites\n\t\t)\n\t)) AND (\n (SELECT value FROM history_input) IS NULL OR (\n json_extract((SELECT value FROM history_input), '$.deviceId') = e.device_id\n AND json_extract((SELECT value FROM history_input), '$.publicKey') = e.public_key\n AND json_extract((SELECT value FROM history_input), '$.fingerprint') = e.fingerprint\n AND (SELECT count(*) FROM live_history) = (SELECT count(*) FROM snapshot_history)\n AND NOT EXISTS (SELECT * FROM live_history EXCEPT SELECT * FROM snapshot_history)\n AND NOT EXISTS (SELECT * FROM live_history_keys EXCEPT SELECT * FROM snapshot_history_keys)\n AND NOT EXISTS (SELECT * FROM snapshot_history_keys EXCEPT SELECT * FROM live_history_keys)\n AND NOT EXISTS (SELECT * FROM live_discovery_keys EXCEPT SELECT * FROM snapshot_discovery_keys)\n AND NOT EXISTS (SELECT * FROM snapshot_discovery_keys EXCEPT SELECT * FROM live_discovery_keys)\n ))\n\t\t\n\tAND e.group_id = ? AND e.device_id = ? AND e.public_key = ?\n\tAND e.fingerprint = ? AND e.identity_id IS ?\n\tAND NOT EXISTS (SELECT 1 FROM coordinator_device_revocations WHERE\n\t\t(subject_kind = 'device_id' AND subject_value = ?) OR\n\t\t(subject_kind = 'ed25519_key' AND subject_value = ?))";
30
+ /** Named builder keeps ordinary exported SQL unchanged and usable without connection tables. */
31
+ export declare function authControllerReviewSql(base: string, input: CoordinatorAuthControllerReviewInput): string;
32
+ /** Internal explicit-resolution path only. The collector must first prove the
33
+ * current label weak; snapshot and authority guards still pin that exact label.
34
+ * Ordinary creation, retries and mutation readers retain their original SQL.
35
+ */
36
+ export declare function authControllerOwnerResolutionSql(mode: "create" | "eligible", input: CoordinatorAuthControllerReviewInput): string;
37
+ /** Keep eligibility proof roots flat when composing a checked batch assertion. */
38
+ export declare function authControllerOwnerResolutionStages(mode: "create" | "eligible", input: CoordinatorAuthControllerReviewInput): {
39
+ ctes: string;
40
+ statement: string;
41
+ };
42
+ export declare function authControllerRetryEligibleValues(input: CoordinatorAuthControllerReviewInput, authority: (string | null)[]): (string | null)[];
43
+ export declare function authControllerInsertValues(input: CoordinatorAuthControllerReviewInput, createdAt: string, authority: (string | null)[]): (string | null)[];
44
+ export declare const AUTH_CONTROLLER_CURRENT_ENROLLMENT_SQL: string;
45
+ export declare const AUTH_CONTROLLER_ACTIVE_SQL = "\n\t\n\tSELECT a.* FROM coordinator_auth_controller_attestations a\n\tJOIN enrolled_devices e ON e.group_id = a.group_id AND e.device_id = a.device_id\n\tJOIN groups g ON g.group_id = a.group_id\n\tWHERE a.coordinator_id = ? AND a.attestation_id = ? AND a.revoked_at IS NULL\n\t\tAND e.enabled = 1 AND g.archived_at IS NULL AND e.public_key = a.public_key\n\t\tAND e.fingerprint = a.fingerprint\n\t\tAND (e.identity_id IS NULL OR e.identity_id = a.identity_id) \n\tAND e.group_id = ? AND e.device_id = ? AND e.public_key = ?\n\tAND e.fingerprint = ? AND e.identity_id IS ?\n\tAND NOT EXISTS (SELECT 1 FROM coordinator_device_revocations WHERE\n\t\t(subject_kind = 'device_id' AND subject_value = ?) OR\n\t\t(subject_kind = 'ed25519_key' AND subject_value = ?))";
46
+ /** D1 retries must return the row checked against live authority in this statement. */
47
+ export declare const AUTH_CONTROLLER_RETRY_ACTIVE_SQL = "\n\t\n\tWITH snapshot(value) AS (SELECT ?), snapshot_invites AS MATERIALIZED (\n\t\tSELECT json_extract(j.value, '$.inviteId') AS invite_id,\n\t\t\tjson_extract(j.value, '$.kind') AS invite_kind,\n\t\t\tjson_extract(j.value, '$.actorId') AS recipient_actor_id,\n\t\t\tjson_extract(j.value, '$.assignedIdentityId') AS assigned_identity_id,\n\t\t\tjson_extract(j.value, '$.targetIdentityId') AS target_identity_id,\n\t\t\tjson_extract(j.value, '$.digest') AS reviewed_preview_digest\n\t\tFROM json_each((SELECT value FROM snapshot), '$.invites') j\n\t), live_invites AS MATERIALIZED (\n\t\tSELECT i.invite_id, i.invite_kind, i.recipient_actor_id, i.assigned_identity_id,\n\t\t\ti.target_identity_id, i.reviewed_preview_digest FROM coordinator_invites i\n\t\tWHERE i.group_id = ? AND i.bound_device_id = ? AND i.bound_public_key = ?\n\t\t\tAND i.bound_fingerprint = ? AND i.revoked_at IS NULL\n\t\t\tAND i.consumed_at IS NOT NULL AND i.consumed_at != ''\n\t\t\tAND i.invite_kind IN ('team_member', 'add_device')\n\t), history_input AS MATERIALIZED (\n SELECT json_extract(value, '$.legacyHistory') AS value FROM snapshot\n), history_key_sources AS NOT MATERIALIZED (\n SELECT public_key, fingerprint FROM enrolled_devices\n UNION\n SELECT a.public_key, a.fingerprint FROM coordinator_auth_controller_attestations a\n CROSS JOIN history_input h\n WHERE a.coordinator_id = json_extract(h.value, '$.coordinatorId')\n), history_rows AS NOT MATERIALIZED (\n SELECT c.*, CASE WHEN json_valid(c.manifest_json) THEN c.manifest_json ELSE '{}' END AS parsed\n FROM coordinator_legacy_team_completions c\n), live_history AS MATERIALIZED (\n SELECT c.group_id, c.candidate_ref, c.manifest_version, c.completed_at, c.created_at,\n CASE WHEN length(CAST(c.manifest_json AS BLOB)) <= 750000 THEN c.manifest_json ELSE NULL END AS manifest_json\n FROM history_rows c CROSS JOIN history_input h\n WHERE h.value IS NOT NULL\n AND (json_extract(c.parsed, '$.coordinator_id') = json_extract(h.value, '$.coordinatorId')\n OR json_extract(c.parsed, '$.coordinator_id') IS NULL)\n AND (EXISTS (\n SELECT 1 FROM json_each(c.parsed, '$.device_decisions') d\n WHERE json_extract(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.device_id') = json_extract(h.value, '$.deviceId')\n OR json_extract(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.key_fingerprint')\n IN (SELECT value FROM json_each(h.value, '$.fingerprints'))\n OR ((d.type <> 'object'\n OR json_type(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.device_id') IS NOT 'text'\n OR json_type(CASE WHEN d.type = 'object' THEN d.value ELSE '{}' END, '$.key_fingerprint') IS NOT 'text')\n AND (instr(CASE WHEN d.type = 'text' THEN json_quote(d.value) ELSE d.value END,\n json_quote(json_extract(h.value, '$.deviceId'))) > 0\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.fingerprints') f\n WHERE instr(d.value, f.value) > 0)))\n ) OR ((json_valid(c.manifest_json) = 0 OR json_type(c.parsed, '$.device_decisions') IS NOT 'array') AND (\n instr(c.manifest_json, json_quote(json_extract(h.value, '$.deviceId'))) > 0\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.fingerprints') f\n WHERE instr(c.manifest_json, f.value) > 0)\n ))) LIMIT 501\n), snapshot_history AS MATERIALIZED (\n SELECT json_extract(j.value, '$.group_id') AS group_id,\n json_extract(j.value, '$.candidate_ref') AS candidate_ref,\n json_extract(j.value, '$.manifest_version') AS manifest_version,\n json_extract(j.value, '$.completed_at') AS completed_at,\n json_extract(j.value, '$.created_at') AS created_at,\n json_extract(j.value, '$.manifest_json') AS manifest_json\n FROM history_input h, json_each(h.value, '$.records') j\n), snapshot_history_keys AS MATERIALIZED (\n SELECT json_extract(j.value, '$.public_key') AS public_key,\n json_extract(j.value, '$.fingerprint') AS fingerprint\n FROM history_input h, json_each(h.value, '$.keys') j\n), snapshot_discovery_keys AS MATERIALIZED (\n SELECT j.value AS public_key FROM history_input h, json_each(h.value, '$.discoveryKeys') j\n), discovery_lines AS NOT MATERIALIZED (\n SELECT public_key,\n ltrim(replace(replace(replace(replace(replace(public_key,\n char(9), ' '), char(10), ' '), char(11), ' '), char(12), ' '), char(13), ' '), ' ') AS line\n FROM history_key_sources\n), discovery_tails AS NOT MATERIALIZED (\n SELECT public_key, CASE WHEN substr(line, 1, 12) = 'ssh-ed25519 '\n THEN ltrim(substr(line, 13), ' ') ELSE NULL END AS tail FROM discovery_lines\n), discovery_tokens AS NOT MATERIALIZED (\n SELECT public_key, CASE WHEN tail IS NOT NULL\n THEN substr(tail, 1, instr(tail || ' ', ' ') - 1) ELSE NULL END AS token\n FROM discovery_tails\n), live_discovery_keys AS MATERIALIZED (\n SELECT DISTINCT e.public_key FROM discovery_tokens e CROSS JOIN history_input h\n WHERE e.public_key = json_extract(h.value, '$.publicKey')\n OR instr(e.public_key, char(0)) > 0\n OR e.token IS NULL\n OR EXISTS (SELECT 1 FROM json_each(h.value, '$.discoveryFragments') f\n WHERE instr(replace(replace(e.token, '-', '+'), '_', '/'), f.value) > 0)\n OR e.token GLOB '*[^A-Za-z0-9+/=_-]*'\n LIMIT 8193\n), live_history_keys AS MATERIALIZED (\n SELECT DISTINCT e.public_key, e.fingerprint FROM history_key_sources e\n WHERE e.public_key IN (SELECT public_key FROM snapshot_history_keys)\n LIMIT 4097\n)\n\t\n\t\n\tSELECT a.* FROM coordinator_auth_controller_attestations a\n\tJOIN enrolled_devices e ON e.group_id = a.group_id AND e.device_id = a.device_id\n\tJOIN groups g ON g.group_id = a.group_id\n\tWHERE a.coordinator_id = ? AND a.attestation_id = ? AND a.revoked_at IS NULL\n\t\tAND e.enabled = 1 AND g.archived_at IS NULL AND e.public_key = a.public_key\n\t\tAND e.fingerprint = a.fingerprint\n\t\tAND (e.identity_id IS NULL OR e.identity_id = a.identity_id) \n\tAND e.group_id = ? AND e.device_id = ? AND e.public_key = ?\n\tAND e.fingerprint = ? AND e.identity_id IS ?\n\tAND NOT EXISTS (SELECT 1 FROM coordinator_device_revocations WHERE\n\t\t(subject_kind = 'device_id' AND subject_value = ?) OR\n\t\t(subject_kind = 'ed25519_key' AND subject_value = ?))\n\t\n\tAND ((SELECT value FROM snapshot) IS NULL OR (\n\t\te.identity_id IS json_extract((SELECT value FROM snapshot), '$.enrollmentIdentityId')\n\t\tAND (SELECT count(*) FROM live_invites) =\n\t\t\t(SELECT count(*) FROM snapshot_invites)\n\t\tAND NOT EXISTS (\n\t\t\tSELECT * FROM live_invites\n\t\t\tEXCEPT\n\t\t\tSELECT * FROM snapshot_invites\n\t\t)\n\t)) AND (\n (SELECT value FROM history_input) IS NULL OR (\n json_extract((SELECT value FROM history_input), '$.deviceId') = e.device_id\n AND json_extract((SELECT value FROM history_input), '$.publicKey') = e.public_key\n AND json_extract((SELECT value FROM history_input), '$.fingerprint') = e.fingerprint\n AND (SELECT count(*) FROM live_history) = (SELECT count(*) FROM snapshot_history)\n AND NOT EXISTS (SELECT * FROM live_history EXCEPT SELECT * FROM snapshot_history)\n AND NOT EXISTS (SELECT * FROM live_history_keys EXCEPT SELECT * FROM snapshot_history_keys)\n AND NOT EXISTS (SELECT * FROM snapshot_history_keys EXCEPT SELECT * FROM live_history_keys)\n AND NOT EXISTS (SELECT * FROM live_discovery_keys EXCEPT SELECT * FROM snapshot_discovery_keys)\n AND NOT EXISTS (SELECT * FROM snapshot_discovery_keys EXCEPT SELECT * FROM live_discovery_keys)\n ))";
48
+ export declare function authControllerRetryActiveValues(input: CoordinatorAuthControllerReviewInput, authority: (string | null)[]): (string | null)[];
49
+ /** Exactly one checked backend batch. A postcommit read failure is a persistence
50
+ * error, never a claim that the successful transaction changed nothing.
51
+ */
52
+ export declare function commitOriginalReviewedOwnerResolution(options: {
53
+ backend: AuthLinkBackend;
54
+ evidence: OriginalDeviceOwnershipEvidence;
55
+ review: unknown;
56
+ now: string;
57
+ }): Promise<{
58
+ controller: CoordinatorAuthControllerAttestation;
59
+ controllerDisposition: "created" | "reused";
60
+ resolution: LegacyOwnerResolutionRecord;
61
+ resolutionDisposition: "created" | "reused";
62
+ }>;
63
+ //# sourceMappingURL=coordinator-legacy-owner-resolution-commit-original-sql-test-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator-legacy-owner-resolution-commit-original-sql-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-owner-resolution-commit-original-sql-test-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACX,oCAAoC,EACpC,oCAAoC,EACpC,MAAM,kCAAkC,CAAC;AAO1C,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,uEAAuE,CAAC;AAM7H,OAAO,EAGN,KAAK,2BAA2B,EAChC,MAAM,mDAAmD,CAAC;AAgD3D,sFAAsF;AACtF,wBAAgB,6BAA6B,CAC5C,MAAM,EAAE;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,EACD,KAAK,EAAE,MAAM,GAAG,IAAI,GAClB,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAUnB;AASD,eAAO,MAAM,8BAA8B,oFACkC,CAAC;AAE9E,eA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BAA+B,CAAC;IAC1C,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACZ;;;;;GA8BA"}
@@ -28,7 +28,7 @@ export interface InternalReviewFixture {
28
28
  }
29
29
  export declare function snapshot(f: LinkFixture, except?: string[]): (string | unknown[])[][];
30
30
  export declare function backendFor(f: LinkFixture, kind: Backend): {
31
- backend: AuthLinkBackend;
31
+ backend: AuthLinkBackend & Required<Pick<AuthLinkBackend, "readBatch">>;
32
32
  hooks: {
33
33
  beforeBatch?: () => void;
34
34
  mapStatement?: (statement: AuthLinkStatement) => AuthLinkStatement;
@@ -48,6 +48,8 @@ export declare function buildReview(f: LinkFixture, options?: {
48
48
  existingController?: CoordinatorAuthControllerAttestation | null;
49
49
  existingResolution?: LegacyOwnerResolutionRecord | null;
50
50
  resolutionId?: string;
51
+ /** Runs after the requester's enrollment label is read, before evidence is collected. */
52
+ afterRequester?: () => void;
51
53
  }): Promise<InternalReviewFixture>;
52
54
  export declare function originalController(f: LinkFixture, groupId?: string, publicKey?: string): Promise<CoordinatorAuthControllerAttestation>;
53
55
  export declare function revoke(f: LinkFixture, subject: "device_id" | "ed25519_key", origin?: boolean): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator-legacy-owner-resolution-commit-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-owner-resolution-commit-test-fixtures.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACX,oCAAoC,EACpC,oCAAoC,EACpC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,KAAK,WAAW,EAAO,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,KAAK,OAAO,EAAoB,MAAM,2CAA2C,CAAC;AAC3F,OAAO,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;AAGhG,OAAO,KAAK,EAAE,2BAA2B,EAAE,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,EACd,OAAO,GAAE;IACR,kBAAkB,CAAC,EAAE,oCAAoC,GAAG,IAAI,CAAC;IACjE,kBAAkB,CAAC,EAAE,2BAA2B,GAAG,IAAI,CAAC;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;CACjB,GACJ,OAAO,CAAC,qBAAqB,CAAC,CAsDhC;AAED,wBAAsB,kBAAkB,CACvC,CAAC,EAAE,WAAW,EACd,OAAO,SAAiB,EACxB,SAAS,SAAmB,iDAkB5B;AAED,wBAAsB,MAAM,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,GAAG,aAAa,EAAE,MAAM,UAAQ,iBAsBhG"}
1
+ {"version":3,"file":"coordinator-legacy-owner-resolution-commit-test-fixtures.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-owner-resolution-commit-test-fixtures.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,oCAAoC,EACpC,oCAAoC,EACpC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,KAAK,WAAW,EAAO,MAAM,0CAA0C,CAAC;AAEjF,OAAO,EAAE,KAAK,OAAO,EAAoB,MAAM,2CAA2C,CAAC;AAC3F,OAAO,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;AAGhG,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mDAAmD,CAAC;AAQrG,eAAO,MAAM,GAAG,QAA8B,CAAC;AAC/C,eAAO,MAAM,MAAM;IAClB,OAAO;IACP,QAAQ;IACR,SAAS;IACT,WAAW;CACX,CAAC;AACF,eAAO,MAAM,eAAe,6CAA6C,CAAC;AAC1E,eAAO,MAAM,eAAe,yCAAyC,CAAC;AAEtE,MAAM,WAAW,qBAAqB;IACrC,gBAAgB,EAAE,oCAAoC,CAAC;IACvD,uBAAuB,EAAE,MAAM,CAAC;IAChC,kBAAkB,EAAE,oCAAoC,GAAG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DAkB5B;AAED,wBAAsB,MAAM,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,GAAG,aAAa,EAAE,MAAM,UAAQ,iBAsBhG"}
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator-legacy-owner-resolution-commit.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-owner-resolution-commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,KAAK,oCAAoC,EACzC,KAAK,oCAAoC,EAGzC,MAAM,kCAAkC,CAAC;AAK1C,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;AAErG,OAAO,EAGN,KAAK,2BAA2B,EAChC,MAAM,mDAAmD,CAAC;AAE3D,MAAM,WAAW,6BAA6B;IAC7C,gBAAgB,EAAE,oCAAoC,CAAC;IACvD,kBAAkB,EAAE,oCAAoC,GAAG,IAAI,CAAC;IAChE,kBAAkB,EAAE,2BAA2B,GAAG,IAAI,CAAC;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB,EAAE,MAAM,CAAC;IAChC,OAAO,EAAE;QACR,OAAO,EAAE,wBAAwB,CAAC;QAClC,KAAK,EAAE,uCAAuC,CAAC;QAC/C,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;KACxB,CAAC;CACF;AA0MD,gFAAgF;AAChF,wBAAgB,oCAAoC,CACnD,KAAK,EAAE,OAAO,GACZ,6BAA6B,GAAG,IAAI,CA+CtC;AA8QD;;GAEG;AACH,wBAAsB,6BAA6B,CAAC,OAAO,EAAE;IAC5D,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,kCAAkC,CAAC;IAC7C,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACZ;;;;;GA8BA"}
1
+ {"version":3,"file":"coordinator-legacy-owner-resolution-commit.d.ts","sourceRoot":"","sources":["../src/coordinator-legacy-owner-resolution-commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,oCAAoC,EACzC,KAAK,oCAAoC,EAGzC,MAAM,kCAAkC,CAAC;AAU1C,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;AAErG,OAAO,EAGN,KAAK,2BAA2B,EAChC,MAAM,mDAAmD,CAAC;AAE3D,MAAM,WAAW,6BAA6B;IAC7C,gBAAgB,EAAE,oCAAoC,CAAC;IACvD,kBAAkB,EAAE,oCAAoC,GAAG,IAAI,CAAC;IAChE,kBAAkB,EAAE,2BAA2B,GAAG,IAAI,CAAC;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB,EAAE,MAAM,CAAC;IAChC,OAAO,EAAE;QACR,OAAO,EAAE,wBAAwB,CAAC;QAClC,KAAK,EAAE,uCAAuC,CAAC;QAC/C,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;KACxB,CAAC;CACF;AA0MD,gFAAgF;AAChF,wBAAgB,oCAAoC,CACnD,KAAK,EAAE,OAAO,GACZ,6BAA6B,GAAG,IAAI,CA+CtC;AA0QD;;GAEG;AACH,wBAAsB,6BAA6B,CAAC,OAAO,EAAE;IAC5D,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,kCAAkC,CAAC;IAC7C,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACZ;;;;;GA8BA"}
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator-owner-enrollment-commit.d.ts","sourceRoot":"","sources":["../src/coordinator-owner-enrollment-commit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,4BAA4B,CAAC;AAMrF,OAAO,EACN,KAAK,qBAAqB,IAAI,YAAY,EAI1C,MAAM,yCAAyC,CAAC;AAQjD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,EAAE,eAAe,CAAC;IACzB,GAAG,EAAE,YAAY,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,OAAO,CAAC,CAyD/F;AAmOD,4GAA4G;AAC5G,wBAAsB,0BAA0B,CAC/C,OAAO,EAAE,eAAe,EACxB,GAAG,EAAE,YAAY,GACf,OAAO,CAAC,OAAO,CAAC,CAelB"}
@@ -3,6 +3,8 @@ import { seedOwnerCallbackGroups } from "./coordinator-owner-enrollment-start-te
3
3
  export interface OwnerAccountHistoryOptions {
4
4
  authority?: "controller_attestation" | "device_claim";
5
5
  defect?: HistoricalAccountDefect;
6
+ /** `v2` keeps the coordinator as a V2 release left it, for tests of that schema. */
7
+ accountSchema?: "current" | "v2";
6
8
  }
7
9
  export declare function ownerStartFixture(options?: OwnerAccountHistoryOptions): import("./coordinator-owner-enrollment-start-test-fixtures.js").OwnerStartFixture;
8
10
  /** Grants are independent historical controller receipts, including in device-claim exclusion tests. */