@certcrypt/verifier-toolkit 0.0.0-stage → 1.0.1

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.

Potentially problematic release.


This version of @certcrypt/verifier-toolkit might be problematic. Click here for more details.

Files changed (221) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/LICENSE +178 -0
  3. package/README.md +563 -2
  4. package/SECURITY.md +77 -0
  5. package/dist/cli/certcrypt-verify.d.ts +2 -0
  6. package/dist/cli/certcrypt-verify.js +174 -0
  7. package/dist/cli/certcrypt-verify.js.map +1 -0
  8. package/dist/core/config/certcrypt-foundation.d.ts +13 -0
  9. package/dist/core/config/certcrypt-foundation.js +123 -0
  10. package/dist/core/config/certcrypt-foundation.js.map +1 -0
  11. package/dist/core/config/default.d.ts +47 -0
  12. package/dist/core/config/default.js +93 -0
  13. package/dist/core/config/default.js.map +1 -0
  14. package/dist/core/config/test-keys.d.ts +40 -0
  15. package/dist/core/config/test-keys.js +41 -0
  16. package/dist/core/config/test-keys.js.map +1 -0
  17. package/dist/core/conformance/attestation.d.ts +4 -0
  18. package/dist/core/conformance/attestation.js +4 -0
  19. package/dist/core/conformance/attestation.js.map +1 -0
  20. package/dist/core/consistency/verify-consistency.d.ts +92 -0
  21. package/dist/core/consistency/verify-consistency.js +353 -0
  22. package/dist/core/consistency/verify-consistency.js.map +1 -0
  23. package/dist/core/crypto/canonical-json.d.ts +14 -0
  24. package/dist/core/crypto/canonical-json.js +13 -0
  25. package/dist/core/crypto/canonical-json.js.map +1 -0
  26. package/dist/core/crypto/canonical-subject.d.ts +76 -0
  27. package/dist/core/crypto/canonical-subject.js +248 -0
  28. package/dist/core/crypto/canonical-subject.js.map +1 -0
  29. package/dist/core/crypto/collection-merkle.d.ts +91 -0
  30. package/dist/core/crypto/collection-merkle.js +243 -0
  31. package/dist/core/crypto/collection-merkle.js.map +1 -0
  32. package/dist/core/crypto/composite.d.ts +73 -0
  33. package/dist/core/crypto/composite.js +206 -0
  34. package/dist/core/crypto/composite.js.map +1 -0
  35. package/dist/core/crypto/digest.d.ts +18 -0
  36. package/dist/core/crypto/digest.js +37 -0
  37. package/dist/core/crypto/digest.js.map +1 -0
  38. package/dist/core/crypto/ecdsa-p256.d.ts +12 -0
  39. package/dist/core/crypto/ecdsa-p256.js +70 -0
  40. package/dist/core/crypto/ecdsa-p256.js.map +1 -0
  41. package/dist/core/crypto/ed25519.d.ts +10 -0
  42. package/dist/core/crypto/ed25519.js +28 -0
  43. package/dist/core/crypto/ed25519.js.map +1 -0
  44. package/dist/core/crypto/holder-keyset.d.ts +23 -0
  45. package/dist/core/crypto/holder-keyset.js +64 -0
  46. package/dist/core/crypto/holder-keyset.js.map +1 -0
  47. package/dist/core/crypto/jcs.d.ts +9 -0
  48. package/dist/core/crypto/jcs.js +59 -0
  49. package/dist/core/crypto/jcs.js.map +1 -0
  50. package/dist/core/crypto/merkle.d.ts +34 -0
  51. package/dist/core/crypto/merkle.js +147 -0
  52. package/dist/core/crypto/merkle.js.map +1 -0
  53. package/dist/core/crypto/ml-dsa.d.ts +25 -0
  54. package/dist/core/crypto/ml-dsa.js +104 -0
  55. package/dist/core/crypto/ml-dsa.js.map +1 -0
  56. package/dist/core/crypto/provider/bytes.d.ts +31 -0
  57. package/dist/core/crypto/provider/bytes.js +106 -0
  58. package/dist/core/crypto/provider/bytes.js.map +1 -0
  59. package/dist/core/crypto/provider/index.d.ts +45 -0
  60. package/dist/core/crypto/provider/index.js +60 -0
  61. package/dist/core/crypto/provider/index.js.map +1 -0
  62. package/dist/core/crypto/provider/node.d.ts +2 -0
  63. package/dist/core/crypto/provider/node.js +96 -0
  64. package/dist/core/crypto/provider/node.js.map +1 -0
  65. package/dist/core/crypto/provider/register-node.d.ts +11 -0
  66. package/dist/core/crypto/provider/register-node.js +16 -0
  67. package/dist/core/crypto/provider/register-node.js.map +1 -0
  68. package/dist/core/crypto/provider/types.d.ts +77 -0
  69. package/dist/core/crypto/provider/types.js +16 -0
  70. package/dist/core/crypto/provider/types.js.map +1 -0
  71. package/dist/core/crypto/provider/web.d.ts +2 -0
  72. package/dist/core/crypto/provider/web.js +122 -0
  73. package/dist/core/crypto/provider/web.js.map +1 -0
  74. package/dist/core/crypto/pseudonym.d.ts +25 -0
  75. package/dist/core/crypto/pseudonym.js +37 -0
  76. package/dist/core/crypto/pseudonym.js.map +1 -0
  77. package/dist/core/crypto/subject-json-preconditions.d.ts +47 -0
  78. package/dist/core/crypto/subject-json-preconditions.js +373 -0
  79. package/dist/core/crypto/subject-json-preconditions.js.map +1 -0
  80. package/dist/core/domain/verify-domain.d.ts +13 -0
  81. package/dist/core/domain/verify-domain.js +39 -0
  82. package/dist/core/domain/verify-domain.js.map +1 -0
  83. package/dist/core/foundation/anti-equivocation.d.ts +87 -0
  84. package/dist/core/foundation/anti-equivocation.js +0 -0
  85. package/dist/core/foundation/anti-equivocation.js.map +1 -0
  86. package/dist/core/foundation/verify-foundation.d.ts +36 -0
  87. package/dist/core/foundation/verify-foundation.js +559 -0
  88. package/dist/core/foundation/verify-foundation.js.map +1 -0
  89. package/dist/core/independent/anti-replay.d.ts +15 -0
  90. package/dist/core/independent/anti-replay.js +27 -0
  91. package/dist/core/independent/anti-replay.js.map +1 -0
  92. package/dist/core/independent/anti-splicing.d.ts +16 -0
  93. package/dist/core/independent/anti-splicing.js +54 -0
  94. package/dist/core/independent/anti-splicing.js.map +1 -0
  95. package/dist/core/independent/capacity-binding.d.ts +26 -0
  96. package/dist/core/independent/capacity-binding.js +57 -0
  97. package/dist/core/independent/capacity-binding.js.map +1 -0
  98. package/dist/core/independent/capacity-evidence.d.ts +38 -0
  99. package/dist/core/independent/capacity-evidence.js +286 -0
  100. package/dist/core/independent/capacity-evidence.js.map +1 -0
  101. package/dist/core/independent/effective-units.d.ts +42 -0
  102. package/dist/core/independent/effective-units.js +147 -0
  103. package/dist/core/independent/effective-units.js.map +1 -0
  104. package/dist/core/independent/issuance-participation.d.ts +13 -0
  105. package/dist/core/independent/issuance-participation.js +24 -0
  106. package/dist/core/independent/issuance-participation.js.map +1 -0
  107. package/dist/core/independent/leaf-binding.d.ts +5 -0
  108. package/dist/core/independent/leaf-binding.js +135 -0
  109. package/dist/core/independent/leaf-binding.js.map +1 -0
  110. package/dist/core/independent/operator-recognition-registry.d.ts +33 -0
  111. package/dist/core/independent/operator-recognition-registry.js +116 -0
  112. package/dist/core/independent/operator-recognition-registry.js.map +1 -0
  113. package/dist/core/independent/proof-structure.d.ts +8 -0
  114. package/dist/core/independent/proof-structure.js +167 -0
  115. package/dist/core/independent/proof-structure.js.map +1 -0
  116. package/dist/core/independent/proof-views.d.ts +26 -0
  117. package/dist/core/independent/proof-views.js +58 -0
  118. package/dist/core/independent/proof-views.js.map +1 -0
  119. package/dist/core/independent/settlement.d.ts +18 -0
  120. package/dist/core/independent/settlement.js +548 -0
  121. package/dist/core/independent/settlement.js.map +1 -0
  122. package/dist/core/independent/verify-independent.d.ts +30 -0
  123. package/dist/core/independent/verify-independent.js +123 -0
  124. package/dist/core/independent/verify-independent.js.map +1 -0
  125. package/dist/core/independent/verify-operator-recognition.d.ts +26 -0
  126. package/dist/core/independent/verify-operator-recognition.js +60 -0
  127. package/dist/core/independent/verify-operator-recognition.js.map +1 -0
  128. package/dist/core/independent/verify-proof-signature.d.ts +20 -0
  129. package/dist/core/independent/verify-proof-signature.js +97 -0
  130. package/dist/core/independent/verify-proof-signature.js.map +1 -0
  131. package/dist/core/input/fs-bridge.d.ts +30 -0
  132. package/dist/core/input/fs-bridge.js +35 -0
  133. package/dist/core/input/fs-bridge.js.map +1 -0
  134. package/dist/core/input/load-artifacts.d.ts +2 -0
  135. package/dist/core/input/load-artifacts.js +80 -0
  136. package/dist/core/input/load-artifacts.js.map +1 -0
  137. package/dist/core/input/load-original-material.d.ts +11 -0
  138. package/dist/core/input/load-original-material.js +126 -0
  139. package/dist/core/input/load-original-material.js.map +1 -0
  140. package/dist/core/input/register-node-fs.d.ts +1 -0
  141. package/dist/core/input/register-node-fs.js +24 -0
  142. package/dist/core/input/register-node-fs.js.map +1 -0
  143. package/dist/core/input/resolve-target.d.ts +16 -0
  144. package/dist/core/input/resolve-target.js +43 -0
  145. package/dist/core/input/resolve-target.js.map +1 -0
  146. package/dist/core/input/strict-json.d.ts +25 -0
  147. package/dist/core/input/strict-json.js +167 -0
  148. package/dist/core/input/strict-json.js.map +1 -0
  149. package/dist/core/input/validate.d.ts +7 -0
  150. package/dist/core/input/validate.js +83 -0
  151. package/dist/core/input/validate.js.map +1 -0
  152. package/dist/core/issued/verify-collection-element.d.ts +66 -0
  153. package/dist/core/issued/verify-collection-element.js +137 -0
  154. package/dist/core/issued/verify-collection-element.js.map +1 -0
  155. package/dist/core/issued/verify-issued.d.ts +15 -0
  156. package/dist/core/issued/verify-issued.js +361 -0
  157. package/dist/core/issued/verify-issued.js.map +1 -0
  158. package/dist/core/issued/verify-original-material.d.ts +35 -0
  159. package/dist/core/issued/verify-original-material.js +418 -0
  160. package/dist/core/issued/verify-original-material.js.map +1 -0
  161. package/dist/core/package/verify-package.d.ts +34 -0
  162. package/dist/core/package/verify-package.js +109 -0
  163. package/dist/core/package/verify-package.js.map +1 -0
  164. package/dist/core/public-api.d.ts +178 -0
  165. package/dist/core/public-api.js +182 -0
  166. package/dist/core/public-api.js.map +1 -0
  167. package/dist/core/result/builder.d.ts +92 -0
  168. package/dist/core/result/builder.js +408 -0
  169. package/dist/core/result/builder.js.map +1 -0
  170. package/dist/core/rules/verify-corpus.d.ts +88 -0
  171. package/dist/core/rules/verify-corpus.js +165 -0
  172. package/dist/core/rules/verify-corpus.js.map +1 -0
  173. package/dist/core/rules/verify-rules.d.ts +14 -0
  174. package/dist/core/rules/verify-rules.js +62 -0
  175. package/dist/core/rules/verify-rules.js.map +1 -0
  176. package/dist/core/testing/validate-against-schema.d.ts +31 -0
  177. package/dist/core/testing/validate-against-schema.js +93 -0
  178. package/dist/core/testing/validate-against-schema.js.map +1 -0
  179. package/dist/core/types/artifacts.d.ts +224 -0
  180. package/dist/core/types/artifacts.js +2 -0
  181. package/dist/core/types/artifacts.js.map +1 -0
  182. package/dist/core/types/capacity-evidence.d.ts +85 -0
  183. package/dist/core/types/capacity-evidence.js +51 -0
  184. package/dist/core/types/capacity-evidence.js.map +1 -0
  185. package/dist/core/types/check.d.ts +61 -0
  186. package/dist/core/types/check.js +2 -0
  187. package/dist/core/types/check.js.map +1 -0
  188. package/dist/core/types/config.d.ts +97 -0
  189. package/dist/core/types/config.js +2 -0
  190. package/dist/core/types/config.js.map +1 -0
  191. package/dist/core/types/foundation.d.ts +121 -0
  192. package/dist/core/types/foundation.js +25 -0
  193. package/dist/core/types/foundation.js.map +1 -0
  194. package/dist/core/types/index.d.ts +9 -0
  195. package/dist/core/types/index.js +2 -0
  196. package/dist/core/types/index.js.map +1 -0
  197. package/dist/core/types/operator-recognition.d.ts +71 -0
  198. package/dist/core/types/operator-recognition.js +24 -0
  199. package/dist/core/types/operator-recognition.js.map +1 -0
  200. package/dist/core/types/proof.d.ts +94 -0
  201. package/dist/core/types/proof.js +2 -0
  202. package/dist/core/types/proof.js.map +1 -0
  203. package/dist/core/types/request.d.ts +59 -0
  204. package/dist/core/types/request.js +2 -0
  205. package/dist/core/types/request.js.map +1 -0
  206. package/dist/core/types/result.d.ts +164 -0
  207. package/dist/core/types/result.js +2 -0
  208. package/dist/core/types/result.js.map +1 -0
  209. package/dist/core/types/settlement-material.d.ts +130 -0
  210. package/dist/core/types/settlement-material.js +2 -0
  211. package/dist/core/types/settlement-material.js.map +1 -0
  212. package/dist/core/verify-node.d.ts +14 -0
  213. package/dist/core/verify-node.js +17 -0
  214. package/dist/core/verify-node.js.map +1 -0
  215. package/dist/core/verify-web.d.ts +1 -0
  216. package/dist/core/verify-web.js +25 -0
  217. package/dist/core/verify-web.js.map +1 -0
  218. package/dist/core/verify.d.ts +18 -0
  219. package/dist/core/verify.js +183 -0
  220. package/dist/core/verify.js.map +1 -0
  221. package/package.json +71 -4
@@ -0,0 +1,548 @@
1
+ import { level1BindingSigningBytes } from "../types/capacity-evidence.js";
2
+ import { parseCommitmentInstant } from "./capacity-evidence.js";
3
+ import { digestHexBytes } from "../crypto/digest.js";
4
+ import { canonicalJsonBytes } from "../crypto/canonical-json.js";
5
+ import { computeLeafHash, verifyInclusionProof } from "../crypto/merkle.js";
6
+ /**
7
+ * Every field the manifest shares with the anchored preimage, derived from the
8
+ * two types: the mapped type requires exactly one entry per shared key, so a
9
+ * field added to both types fails to compile until it is listed here, and a
10
+ * listed field that stops being shared fails as an excess property. Order is
11
+ * the preimage's member order, so the first divergence reported is stable.
12
+ */
13
+ const MANIFEST_ANCHORED_FIELD_SET = {
14
+ system_id: true,
15
+ rules_version: true,
16
+ settlement_profile_id: true,
17
+ batch_id: true,
18
+ window_id: true,
19
+ leaf_count: true,
20
+ total_quantity: true,
21
+ settlement_root: true,
22
+ };
23
+ export const MANIFEST_ANCHORED_FIELDS = Object.keys(MANIFEST_ANCHORED_FIELD_SET);
24
+ // XRPL settles with a `Payment` back to the token's own issuer: paying an MPT to
25
+ // its issuer destroys that amount, which is how supply ceases to exist on this
26
+ // substrate.
27
+ const REQUIRED_PROFILE = "settlement.aggregated.xrpl/1";
28
+ // The public substrate that witnesses finality under that profile: every
29
+ // finality witness of the proof names it (settlement.aggregated.xrpl/1 §11.3).
30
+ const REQUIRED_SUBSTRATE = "xrpl";
31
+ /**
32
+ * Parse a settlement-action `quantity` string as a canonical `CERT,2` amount
33
+ * and return its numeric portion (e.g. `"10.00 CERT"` -> `"10.00"`).
34
+ *
35
+ * The settlement amount is `CERT,2` — exactly two decimal places — and it
36
+ * must be strictly positive. A loose `endsWith(" CERT")` + `split(" ")[0]`
37
+ * would accept `"abc CERT"`, `"-1.00 CERT"`, `"0 CERT"`, `"1 CERT"`,
38
+ * `"1.000 CERT"`, or a leading-zero `"01.00 CERT"` — any of which lets the
39
+ * action diverge from the amount the settlement actually destroys (an amount
40
+ * <= 0 or with non-`CERT,2` precision is never a valid settlement). This is the
41
+ * exact grammar the reference producer emits and every conformant verifier
42
+ * enforces:
43
+ *
44
+ * `<int> "." <frac> " " "CERT"`
45
+ * - `<int>`: one or more ASCII digits, no leading zeros unless the lone `0`
46
+ * - `<frac>`: EXACTLY two ASCII digits
47
+ * - decoded value strictly greater than zero
48
+ *
49
+ * Returns `{ numeric }` on success or `{ error }` with a parity message.
50
+ */
51
+ function parseCert2Quantity(quantity, symbol) {
52
+ const suffix = ` ${symbol}`;
53
+ if (!quantity.endsWith(suffix)) {
54
+ return {
55
+ error: `quantity "${quantity}" is not a canonical ${symbol} asset (expected "<int>.<2-decimals> ${symbol}")`,
56
+ };
57
+ }
58
+ const numeric = quantity.slice(0, quantity.length - suffix.length);
59
+ const dot = numeric.indexOf(".");
60
+ if (dot < 0) {
61
+ return {
62
+ error: `quantity "${quantity}" has no decimal point; ${symbol} is a 2-decimal asset (expected exactly 2 fractional digits)`,
63
+ };
64
+ }
65
+ const intPart = numeric.slice(0, dot);
66
+ const fracPart = numeric.slice(dot + 1);
67
+ // Integer part: non-empty, all ASCII digits, no leading zeros (a lone "0" is
68
+ // the only allowed zero-prefixed form).
69
+ if (intPart.length === 0 || !/^[0-9]+$/.test(intPart)) {
70
+ return { error: `quantity "${quantity}" has a non-numeric integer part` };
71
+ }
72
+ if (intPart.length > 1 && intPart.startsWith("0")) {
73
+ return {
74
+ error: `quantity "${quantity}" integer part "${intPart}" is not canonical (leading zero)`,
75
+ };
76
+ }
77
+ // Fractional part: EXACTLY two ASCII digits (CERT,2 precision).
78
+ if (fracPart.length !== 2 || !/^[0-9]{2}$/.test(fracPart)) {
79
+ return {
80
+ error: `quantity "${quantity}" must have exactly 2 fractional digits (${symbol},2)`,
81
+ };
82
+ }
83
+ // Strictly positive: reject "0.00 CERT" (a no-op burn).
84
+ if (/^0+$/.test(intPart) && fracPart === "00") {
85
+ return { error: `quantity "${quantity}" is not strictly positive` };
86
+ }
87
+ return { numeric };
88
+ }
89
+ /**
90
+ * Verify settlement under settlement.aggregated.xrpl/1.
91
+ *
92
+ * Checks: SETTLEMENT_REF_VALID, FINALITY_SUFFICIENT, CAPACITY_BINDING_VALID,
93
+ * CAPACITY_NOT_RECONSTRUCTED, INCLUSION_PROOF_VALID,
94
+ * AGGREGATED_INTERPRETATION_UNIQUE
95
+ *
96
+ * Follows settlement.aggregated.xrpl/1 section 13 validation procedure.
97
+ */
98
+ export function verifySettlement(proof, material, capacityEvidence, config, builder) {
99
+ // Step 1 — Validate profile selection
100
+ if (proof.settlement.profile_id !== REQUIRED_PROFILE) {
101
+ builder.fail("SETTLEMENT_REF_VALID", "REJECTED", `settlement_profile_id must be "${REQUIRED_PROFILE}", got "${proof.settlement.profile_id}"`);
102
+ return;
103
+ }
104
+ // Every finality witness names the profile's substrate. A witness of another
105
+ // substrate is not one the rules domain admits.
106
+ for (const w of proof.settlement.finality_proofs) {
107
+ if (w.substrate !== REQUIRED_SUBSTRATE) {
108
+ builder.fail("SETTLEMENT_REF_VALID", "REJECTED", `finality witness substrate "${w.substrate}" is not "${REQUIRED_SUBSTRATE}", the substrate of ${REQUIRED_PROFILE}`);
109
+ return;
110
+ }
111
+ }
112
+ // Settlement material presence
113
+ if (!material) {
114
+ builder.fail("SETTLEMENT_REF_VALID", "INCOMPLETE", "settlement_material is absent");
115
+ builder.addMissingArtifact("settlement_material");
116
+ return;
117
+ }
118
+ // Profile coherence in material
119
+ if (material.settlement_profile_id !== REQUIRED_PROFILE) {
120
+ builder.fail("SETTLEMENT_REF_VALID", "REJECTED", `settlement_material.settlement_profile_id must be "${REQUIRED_PROFILE}", got "${material.settlement_profile_id}"`);
121
+ return;
122
+ }
123
+ // Step 2 — settlement reference coherence
124
+ if (proof.settlement_ref !== proof.settlement.ref) {
125
+ builder.fail("SETTLEMENT_REF_VALID", "REJECTED", `settlement_ref mismatch: top-level="${proof.settlement_ref}" vs settlement.ref="${proof.settlement.ref}"`);
126
+ return;
127
+ }
128
+ // Step 3 — Settlement action shape
129
+ const action = material.settlement_action;
130
+ if (!action) {
131
+ builder.fail("SETTLEMENT_REF_VALID", "INCOMPLETE", "settlement_action is absent");
132
+ builder.addMissingArtifact("settlement_action");
133
+ return;
134
+ }
135
+ // chain_id validation per rules-domain/1
136
+ if (action.chain_id !== config.xrpl_chain_id) {
137
+ builder.fail("SETTLEMENT_REF_VALID", "REJECTED", `settlement_action.chain_id="${action.chain_id}" does not match required="${config.xrpl_chain_id}"`);
138
+ return;
139
+ }
140
+ // XRPL has no sub-position inside a transaction: action_ordinal is always "0"
141
+ // (settlement.aggregated.xrpl/1 §8.1). Checked on its own, not only through the
142
+ // settlement_ref binding, so material whose ref and action agree on another
143
+ // value is still rejected.
144
+ if (action.action_ordinal !== "0") {
145
+ builder.fail("SETTLEMENT_REF_VALID", "INDEPENDENT_INVALID", `settlement_action.action_ordinal="${action.action_ordinal}" must be "0" under this profile`);
146
+ return;
147
+ }
148
+ // The settlement destroys supply by paying the MPT back to its own issuer;
149
+ // `contract` names the ISSUANCE (XRPL has no contract accounts) and `name` is
150
+ // the transaction type. Paying the MPT back to its own issuer is what destroys
151
+ // supply: there is no sink account to validate.
152
+ // The settlement MUST debit the aggregate settlement account, never an issuer's
153
+ // own. This is what keeps the ledger from revealing WHICH issuer certified:
154
+ // every settlement in a window comes from the same account, so an observer sees
155
+ // one aggregate burn and cannot attribute it.
156
+ //
157
+ // Checked OFFLINE against the account the rules domain publishes — which is the
158
+ // strongest form available without the ledger, and catches material that
159
+ // declares a foreign account. An online verifier must additionally confirm the
160
+ // real transaction's sender matches, since material can declare anything.
161
+ //
162
+ // An EMPTY configured account is not "no constraint" — it is a configuration
163
+ // that cannot express one, and accepting under it would admit a settlement
164
+ // debited from an issuer's own account. That is the exact thing this check
165
+ // exists to prevent, so it FAILS rather than skipping.
166
+ //
167
+ // A placeholder `system_root_fingerprint` or `xrpl_mpt_issuance_id` (a
168
+ // deployment whose keys do not exist yet) fails closed by never matching real
169
+ // material; an unset account has to be rejected explicitly, because an empty
170
+ // string silently compares as "anything goes".
171
+ if (config.xrpl_settlement_account === "") {
172
+ builder.fail("CAPACITY_BINDING_VALID", "INDEPENDENT_INVALID", "no settlement account is configured for this rules domain, so the " +
173
+ "settlement's originating account cannot be checked. Verification fails " +
174
+ "closed rather than accepting a settlement debited from anywhere.");
175
+ return;
176
+ }
177
+ if (action.from !== config.xrpl_settlement_account) {
178
+ builder.fail("CAPACITY_BINDING_VALID", "INDEPENDENT_INVALID", `settlement_action.from="${action.from}" is not the aggregate settlement ` +
179
+ `account="${config.xrpl_settlement_account}"`);
180
+ return;
181
+ }
182
+ if (action.contract !== config.xrpl_mpt_issuance_id) {
183
+ builder.fail("CAPACITY_BINDING_VALID", "INDEPENDENT_INVALID", `settlement_action.contract="${action.contract}" does not match required="${config.xrpl_mpt_issuance_id}"`);
184
+ return;
185
+ }
186
+ if (action.name !== config.xrpl_action_name) {
187
+ builder.fail("CAPACITY_BINDING_VALID", "INDEPENDENT_INVALID", `settlement_action.name="${action.name}" does not match required="${config.xrpl_action_name}"`);
188
+ return;
189
+ }
190
+ // Parse the action quantity as a canonical CERT,2 asset (strictly positive,
191
+ // exactly 2 decimals, symbol "CERT") — not a loose suffix match. The numeric
192
+ // portion is reused below in CAPACITY_BINDING_VALID against the ccp, over the
193
+ // SAME canonical bytes every conforming verifier compares.
194
+ const parsedQty = parseCert2Quantity(action.quantity, config.xrpl_token_symbol);
195
+ if ("error" in parsedQty) {
196
+ builder.fail("CAPACITY_BINDING_VALID", "INDEPENDENT_INVALID", parsedQty.error);
197
+ return;
198
+ }
199
+ const actionQty = parsedQty.numeric;
200
+ builder.pass("SETTLEMENT_REF_VALID");
201
+ // Step 4 — Batch binding memo
202
+ // settlement-material/1 §9: one authorization-bridge per distinct resolved authorization in
203
+ // the leaf. Require at least one; the batch_binding_preimage is batch-level, so
204
+ // every entry MUST carry the identical one (the memo binds the whole batch).
205
+ const bridges = material.authorization_bridge_proofs;
206
+ if (!Array.isArray(bridges) || bridges.length === 0) {
207
+ builder.fail("CAPACITY_NOT_RECONSTRUCTED", "INCOMPLETE", "authorization_bridge_proofs is absent or empty");
208
+ builder.addMissingArtifact("authorization_bridge_proofs");
209
+ return;
210
+ }
211
+ const bbp = bridges[0].batch_binding_preimage;
212
+ if (!bbp) {
213
+ builder.fail("CAPACITY_NOT_RECONSTRUCTED", "INCOMPLETE", "batch_binding_preimage is absent");
214
+ builder.addMissingArtifact("batch_binding_preimage");
215
+ return;
216
+ }
217
+ // Every bridge must agree on the batch-level binding (one memo per batch).
218
+ const bbpJson = JSON.stringify(bbp);
219
+ for (const b of bridges) {
220
+ if (!b.batch_binding_preimage || JSON.stringify(b.batch_binding_preimage) !== bbpJson) {
221
+ builder.fail("CAPACITY_NOT_RECONSTRUCTED", "INDEPENDENT_INVALID", "authorization_bridge_proofs disagree on batch_binding_preimage (must be one batch-level binding)");
222
+ return;
223
+ }
224
+ }
225
+ // Build canonical BatchBindingPreimage JSON
226
+ const bbpBytes = canonicalJsonBytes([
227
+ ["v", bbp.v],
228
+ ["system_id", bbp.system_id],
229
+ ["rules_version", bbp.rules_version],
230
+ ["settlement_profile_id", bbp.settlement_profile_id],
231
+ ["batch_id", bbp.batch_id],
232
+ ["window_id", bbp.window_id],
233
+ ["leaf_count", bbp.leaf_count],
234
+ ["total_quantity", bbp.total_quantity],
235
+ ["settlement_root", bbp.settlement_root],
236
+ ]);
237
+ const batchBindingDigest = digestHexBytes(bbpBytes);
238
+ const expectedMemo = `${config.xrpl_memo_prefix}${batchBindingDigest}`;
239
+ if (action.memo !== expectedMemo) {
240
+ builder.fail("CAPACITY_NOT_RECONSTRUCTED", "INDEPENDENT_INVALID", `Batch binding memo mismatch: expected="${expectedMemo}", got="${action.memo}"`);
241
+ return;
242
+ }
243
+ // Step 4b — Bind the SIGNED settlement_ref to the settlement material.
244
+ // settlement_ref is part of the proof's signed view, so its segments are
245
+ // authenticated; settlement_action and batch_binding_preimage are NOT signed.
246
+ // Parse the ref (chain_id:trx_id:action_ordinal:batch_id:window_id) and require
247
+ // each segment to equal the corresponding material field, so the material
248
+ // cannot diverge from what the system domain actually signed (e.g. swapping
249
+ // trx_id / action_ordinal in an otherwise-valid package).
250
+ const refSegments = proof.settlement_ref.split(":");
251
+ if (refSegments.length !== 5) {
252
+ builder.fail("SETTLEMENT_REF_VALID", "REJECTED", `settlement_ref must have 5 colon-separated segments (chain_id:trx_id:action_ordinal:batch_id:window_id), got ${refSegments.length}`);
253
+ return;
254
+ }
255
+ const [refChainId, refTrxId, refActionOrdinal, refBatchId, refWindowId] = refSegments;
256
+ const refBindings = [
257
+ ["chain_id", refChainId, action.chain_id],
258
+ ["trx_id", refTrxId, action.trx_id],
259
+ ["action_ordinal", refActionOrdinal, action.action_ordinal],
260
+ ["batch_id", refBatchId, bbp.batch_id],
261
+ ["window_id", refWindowId, bbp.window_id],
262
+ ];
263
+ for (const [field, fromRef, fromMaterial] of refBindings) {
264
+ if (fromRef !== fromMaterial) {
265
+ builder.fail("SETTLEMENT_REF_VALID", "INDEPENDENT_INVALID", `signed settlement_ref ${field}="${fromRef}" does not match settlement material "${fromMaterial}"`);
266
+ return;
267
+ }
268
+ }
269
+ // Step 5 — Settlement root — recompute from leaf. The leaf=subtree leaf anchors
270
+ // to `subtree_root`, carried in `submission_assignment_proof`.
271
+ const assignment = material.submission_assignment_proof;
272
+ if (!assignment || !assignment.leaf_preimage) {
273
+ builder.fail("INCLUSION_PROOF_VALID", "INCOMPLETE", "submission_assignment_proof or leaf_preimage is absent");
274
+ builder.addMissingArtifact("submission_assignment_proof");
275
+ return;
276
+ }
277
+ const lp = assignment.leaf_preimage;
278
+ // The leaf-bound value the proof anchors and the assignment carries.
279
+ const proofLeafValue = proof.subtree_root;
280
+ const leafBoundValue = lp.subtree_root;
281
+ const assignmentBoundValue = assignment.subtree_root;
282
+ if (leafBoundValue === undefined) {
283
+ builder.fail("INCLUSION_PROOF_VALID", "INCOMPLETE", "leaf_preimage.subtree_root is absent");
284
+ return;
285
+ }
286
+ // Build canonical LeafPreimage JSON in canonical field order.
287
+ const leafBytes = canonicalJsonBytes([
288
+ ["v", lp.v],
289
+ ["system_id", lp.system_id],
290
+ ["rules_version", lp.rules_version],
291
+ ["settlement_profile_id", lp.settlement_profile_id],
292
+ ["batch_id", lp.batch_id],
293
+ ["leaf_index", lp.leaf_index],
294
+ ["subtree_root", leafBoundValue],
295
+ ["cost_commitment", lp.cost_commitment],
296
+ ["consumed_quantity", lp.consumed_quantity],
297
+ ]);
298
+ const computedLeafHash = computeLeafHash(leafBytes);
299
+ const bap = assignment;
300
+ // Verify leaf hash matches declared
301
+ if (bap.leaf_hash !== computedLeafHash) {
302
+ builder.fail("INCLUSION_PROOF_VALID", "INDEPENDENT_INVALID", `Leaf hash mismatch: computed="${computedLeafHash}", declared="${bap.leaf_hash}"`);
303
+ return;
304
+ }
305
+ // Verify inclusion proof. The tree width is the anchored leaf_count (the
306
+ // batch_binding_preimage is bound by the memo); proof.batch.size is outside the
307
+ // proof's signed view and is accepted only when it repeats that value.
308
+ const canonicalUint = /^(0|[1-9][0-9]{0,8})$/;
309
+ const leafIndex = canonicalUint.test(bap.leaf_index) ? Number(bap.leaf_index) : NaN;
310
+ const treeSize = canonicalUint.test(bbp.leaf_count) ? Number(bbp.leaf_count) : NaN;
311
+ if (isNaN(leafIndex) || isNaN(treeSize) || treeSize <= 0) {
312
+ builder.fail("INCLUSION_PROOF_VALID", "REJECTED", `Invalid leaf_index=${bap.leaf_index} or leaf_count=${bbp.leaf_count}`);
313
+ return;
314
+ }
315
+ if (proof.batch.size !== bbp.leaf_count || leafIndex >= treeSize) {
316
+ builder.fail("INCLUSION_PROOF_VALID", "INDEPENDENT_INVALID", `batch.size=${proof.batch.size} and leaf_index=${bap.leaf_index} must fit the anchored leaf_count=${bbp.leaf_count}`);
317
+ return;
318
+ }
319
+ const inclusionValid = verifyInclusionProof(computedLeafHash, leafIndex, bap.sibling_hashes, proof.batch.root, treeSize);
320
+ if (!inclusionValid) {
321
+ builder.fail("INCLUSION_PROOF_VALID", "INDEPENDENT_INVALID", "Inclusion proof does not verify: computed root does not match batch.root");
322
+ return;
323
+ }
324
+ builder.pass("INCLUSION_PROOF_VALID");
325
+ // Settlement root consistency. The coherence is three-way (settlement.binding/1
326
+ // §6; independence.proof/1 §10.13.1), so material without a batch_manifest cannot
327
+ // establish it: fail closed as incomplete instead of dereferencing nothing.
328
+ const manifest = material.batch_manifest;
329
+ if (manifest === undefined || manifest === null) {
330
+ builder.fail("AGGREGATED_INTERPRETATION_UNIQUE", "INCOMPLETE", "batch_manifest is absent");
331
+ builder.addMissingArtifact("batch_manifest");
332
+ return;
333
+ }
334
+ if (manifest.settlement_root !== proof.batch.root ||
335
+ bbp.settlement_root !== proof.batch.root) {
336
+ builder.fail("AGGREGATED_INTERPRETATION_UNIQUE", "INDEPENDENT_INVALID", "settlement_root is not consistent across batch_manifest, batch_binding_preimage, and proof.batch.root");
337
+ return;
338
+ }
339
+ // Step 6 — Leaf assignment: the leaf-bound value (subtree_root) must be consistent
340
+ // across the assignment proof, the leaf preimage, and the proof anchor.
341
+ if (assignmentBoundValue !== proofLeafValue) {
342
+ builder.fail("AGGREGATED_INTERPRETATION_UNIQUE", "INDEPENDENT_INVALID", `assignment_proof.subtree_root="${assignmentBoundValue}" does not match proof="${proofLeafValue}"`);
343
+ return;
344
+ }
345
+ if (leafBoundValue !== proofLeafValue) {
346
+ builder.fail("AGGREGATED_INTERPRETATION_UNIQUE", "INDEPENDENT_INVALID", `leaf_preimage.subtree_root="${leafBoundValue}" does not match proof="${proofLeafValue}"`);
347
+ return;
348
+ }
349
+ if (bap.leaf_index !== proof.batch.index) {
350
+ builder.fail("AGGREGATED_INTERPRETATION_UNIQUE", "INDEPENDENT_INVALID", `leaf_index mismatch: bap="${bap.leaf_index}" vs batch.index="${proof.batch.index}"`);
351
+ return;
352
+ }
353
+ builder.pass("AGGREGATED_INTERPRETATION_UNIQUE");
354
+ // Step 7 — Authorization bridge (zero-data): the bridge must derive from the
355
+ // RESOLVED authorization artifact, not restate a cleartext scope. Under the
356
+ // zero-data profile the resolved authorization IS the system-domain Level-1
357
+ // authorization the capacity evidence carries and capacity-binding re-verifies.
358
+ // So `resolved_authorization_digest` MUST equal SHA3-256 of that evidence's
359
+ // `level1_binding` signing bytes — binding the settlement to the exact
360
+ // authorization the evidence proved, without any correlating issuer_scope.
361
+ if (!capacityEvidence) {
362
+ builder.fail("CAPACITY_NOT_RECONSTRUCTED", "INCOMPLETE", "no capacity evidence to anchor the authorization bridge to");
363
+ builder.addMissingArtifact("capacity_evidence");
364
+ return;
365
+ }
366
+ const expectedAuthDigest = digestHexBytes(level1BindingSigningBytes(capacityEvidence.projected_authorization.level1_binding));
367
+ // settlement-material/1 §9: select the bridge for the authorization THIS evidence proves.
368
+ // A leaf may carry commitments under different Level-1 authorizations; the
369
+ // verdict for this commitment must reconstruct ITS authorization, not the
370
+ // leaf's first one. Require exactly the matching bridge to be present.
371
+ const matchingBridge = bridges.find((b) => b.resolved_authorization_digest === expectedAuthDigest);
372
+ if (!matchingBridge) {
373
+ builder.fail("CAPACITY_NOT_RECONSTRUCTED", "INDEPENDENT_INVALID", `no authorization_bridge_proof derives from this evidence's resolved ` +
374
+ `authorization: SHA3(level1_binding)="${expectedAuthDigest}" not found among ` +
375
+ `${bridges.length} bridge(s)`);
376
+ return;
377
+ }
378
+ builder.pass("CAPACITY_NOT_RECONSTRUCTED");
379
+ // Step 8 — Capacity consumption
380
+ const ccp = material.capacity_consumption_proof;
381
+ if (!ccp) {
382
+ builder.fail("CAPACITY_BINDING_VALID", "INCOMPLETE", "capacity_consumption_proof is absent");
383
+ builder.addMissingArtifact("capacity_consumption_proof");
384
+ return;
385
+ }
386
+ // `actionQty` is the canonical numeric portion validated by
387
+ // `parseCert2Quantity` above ("10.00 CERT" -> "10.00").
388
+ if (ccp.total_quantity !== actionQty) {
389
+ builder.fail("CAPACITY_BINDING_VALID", "INDEPENDENT_INVALID", `total_quantity mismatch: ccp="${ccp.total_quantity}" vs action="${actionQty}"`);
390
+ return;
391
+ }
392
+ // The quantity the batch must have burned is the one ANCHORED on-chain: the
393
+ // `total_quantity` of `batch_binding_preimage`, whose digest the memo check of
394
+ // step 4 has already bound to the settlement transaction (settlement.binding/1
395
+ // §5). `batch_manifest` is unsigned, unanchored material: its copy of the total
396
+ // is only accepted when it repeats the anchored value, and it is never the
397
+ // reference. Comparing against it instead would let material anchor one total,
398
+ // burn a smaller one, and restate the manifest to match the burn.
399
+ if (ccp.total_quantity !== bbp.total_quantity) {
400
+ builder.fail("CAPACITY_BINDING_VALID", "INDEPENDENT_INVALID", `total_quantity mismatch: burned ccp="${ccp.total_quantity}" vs anchored ` +
401
+ `batch_binding_preimage="${bbp.total_quantity}"`);
402
+ return;
403
+ }
404
+ // Every field `batch_manifest` restates from `batch_binding_preimage` must
405
+ // repeat the anchored value (settlement.aggregated.xrpl/1 §10.1;
406
+ // settlement.binding/1 §6). The memo anchors the preimage; nothing anchors or
407
+ // signs the manifest, so its copies are accepted only when they agree and are
408
+ // never the reference. The signed settlement_ref (step 4b) binds the
409
+ // PREIMAGE's batch_id and window_id, not the manifest's. `manifest` is present
410
+ // here: its absence failed closed at the settlement root consistency check.
411
+ for (const field of MANIFEST_ANCHORED_FIELDS) {
412
+ if (manifest[field] !== bbp[field]) {
413
+ builder.fail("CAPACITY_BINDING_VALID", "INDEPENDENT_INVALID", `${field} mismatch: batch_manifest="${manifest[field]}" vs anchored ` +
414
+ `batch_binding_preimage="${bbp[field]}"`);
415
+ return;
416
+ }
417
+ }
418
+ if (ccp.leaf_quantity !== lp.consumed_quantity) {
419
+ builder.fail("CAPACITY_BINDING_VALID", "INDEPENDENT_INVALID", `leaf_quantity mismatch: ccp="${ccp.leaf_quantity}" vs leaf="${lp.consumed_quantity}"`);
420
+ return;
421
+ }
422
+ // No `sink_account`: the payment returns the MPT to its issuance, which
423
+ // destroys it. There is no destination to name.
424
+ if (ccp.token_contract !== config.xrpl_mpt_issuance_id) {
425
+ builder.fail("CAPACITY_BINDING_VALID", "INDEPENDENT_INVALID", `token_contract mismatch: ccp="${ccp.token_contract}" vs config="${config.xrpl_mpt_issuance_id}"`);
426
+ return;
427
+ }
428
+ if (ccp.token_symbol !== config.xrpl_token_symbol) {
429
+ builder.fail("CAPACITY_BINDING_VALID", "INDEPENDENT_INVALID", `token_symbol mismatch: ccp="${ccp.token_symbol}" vs config="${config.xrpl_token_symbol}"`);
430
+ return;
431
+ }
432
+ builder.pass("CAPACITY_BINDING_VALID");
433
+ // Step 9 — Finality
434
+ const fp = material.finality_proof;
435
+ if (!fp) {
436
+ builder.fail("FINALITY_SUFFICIENT", "INCOMPLETE", "finality_proof is absent");
437
+ builder.addMissingArtifact("finality_proof");
438
+ return;
439
+ }
440
+ // Canonical non-negative decimal only (settlement.aggregated.xrpl/1 §11.3):
441
+ // parseInt would accept "12abc", "+5" or "007" and evaluate a value the
442
+ // material never stated.
443
+ const canonical = (s) => typeof s === "string" && /^(0|[1-9][0-9]*)$/.test(s);
444
+ const blockNum = canonical(fp.block_num) ? Number(fp.block_num) : NaN;
445
+ const libNum = canonical(fp.last_irreversible_block_num)
446
+ ? Number(fp.last_irreversible_block_num)
447
+ : NaN;
448
+ if (isNaN(blockNum) || isNaN(libNum)) {
449
+ builder.fail("FINALITY_SUFFICIENT", "REJECTED", `Invalid block_num="${fp.block_num}" or last_irreversible_block_num="${fp.last_irreversible_block_num}"`);
450
+ return;
451
+ }
452
+ if (libNum < blockNum) {
453
+ builder.fail("FINALITY_SUFFICIENT", "INDEPENDENT_INVALID", `Insufficient finality: last_irreversible_block_num=${libNum} < block_num=${blockNum}`);
454
+ return;
455
+ }
456
+ if (!fp.block_id || fp.block_id.length === 0) {
457
+ builder.fail("FINALITY_SUFFICIENT", "REJECTED", "finality_proof.block_id is missing or empty");
458
+ return;
459
+ }
460
+ if (!fp.last_irreversible_block_id ||
461
+ fp.last_irreversible_block_id.length === 0) {
462
+ builder.fail("FINALITY_SUFFICIENT", "REJECTED", "finality_proof.last_irreversible_block_id is missing or empty");
463
+ return;
464
+ }
465
+ // Check confirmation_level across the finality witnesses (a list; ALL present
466
+ // witnesses must be irreversible).
467
+ const witnesses = proof.settlement.finality_proofs;
468
+ if (!Array.isArray(witnesses) || witnesses.length === 0) {
469
+ builder.fail("FINALITY_SUFFICIENT", "REJECTED", "settlement.finality_proofs is missing or empty");
470
+ return;
471
+ }
472
+ for (const w of witnesses) {
473
+ if (w.confirmation_level !== "irreversible") {
474
+ builder.fail("FINALITY_SUFFICIENT", "INDEPENDENT_INVALID", `finality witness (substrate="${w.substrate}") confirmation_level="${w.confirmation_level}" is not "irreversible"`);
475
+ return;
476
+ }
477
+ // The witness is a projection of the settlement material, which is
478
+ // authoritative (independence.proof/1 §10.6): a witness naming another
479
+ // ledger or another close time than the material is an incoherent proof.
480
+ if (w.block_height !== fp.block_num || w.timestamp !== fp.block_timestamp) {
481
+ builder.fail("FINALITY_SUFFICIENT", "REJECTED", `finality witness (block_height="${w.block_height}", timestamp="${w.timestamp}") ` +
482
+ `does not match the settlement material (block_num="${fp.block_num}", ` +
483
+ `block_timestamp="${fp.block_timestamp}")`);
484
+ return;
485
+ }
486
+ }
487
+ builder.pass("FINALITY_SUFFICIENT");
488
+ // Commitment TTL: the signed expiry window MUST match the rules-domain TTL
489
+ // (rules/2026-01), so an issuer cannot inflate its own window (e.g. emit
490
+ // issued_at=today, expires_at=2100). expires_at MUST equal issued_at +
491
+ // commitment_ttl_seconds exactly. Both timestamps are inside the signed
492
+ // projected_commitment; the TTL comes from public rules. Fail-closed:
493
+ // without this the block_timestamp ≤ expires_at check below is toothless
494
+ // (a forged far-future expires_at would always pass it).
495
+ if (capacityEvidence) {
496
+ const issuedAt = parseCommitmentInstant(capacityEvidence.projected_commitment.issued_at);
497
+ const expiresAtTtl = parseCommitmentInstant(capacityEvidence.projected_commitment.expires_at);
498
+ if (issuedAt === null || expiresAtTtl === null) {
499
+ builder.fail("COMMITMENT_TTL_VALID", "REJECTED", `issued_at="${capacityEvidence.projected_commitment.issued_at}" or ` +
500
+ `expires_at="${capacityEvidence.projected_commitment.expires_at}" is not ` +
501
+ `RFC 3339 UTC with whole seconds`);
502
+ return;
503
+ }
504
+ const expectedExpires = issuedAt + config.commitment_ttl_seconds * 1000;
505
+ if (expiresAtTtl !== expectedExpires) {
506
+ builder.fail("COMMITMENT_TTL_VALID", "INDEPENDENT_INVALID", `expires_at=${capacityEvidence.projected_commitment.expires_at} does not equal ` +
507
+ `issued_at + commitment_ttl_seconds (${config.commitment_ttl_seconds}s); ` +
508
+ `the issuer's window does not match the rules-domain TTL`);
509
+ return;
510
+ }
511
+ builder.pass("COMMITMENT_TTL_VALID");
512
+ }
513
+ // No-retroactivity, reanchored to the substrate: the capacity
514
+ // consumption's irreversible block time MUST NOT be after the capacity
515
+ // commitment's `expires_at` (settlement.binding/1 §9). The verdict's "when"
516
+ // is the block, NOT CERTCRYPT's clock: no CERTCRYPT-sealed timestamp takes
517
+ // part in this check.
518
+ if (capacityEvidence) {
519
+ const blockTs = Date.parse(fp.block_timestamp);
520
+ const expiresAt = parseCommitmentInstant(capacityEvidence.projected_commitment.expires_at);
521
+ if (isNaN(blockTs) || expiresAt === null) {
522
+ builder.fail("SETTLEMENT_NOT_RETROACTIVE", "REJECTED", `unparseable block_timestamp="${fp.block_timestamp}" or expires_at="${capacityEvidence.projected_commitment.expires_at}"`);
523
+ return;
524
+ }
525
+ if (blockTs > expiresAt) {
526
+ builder.fail("SETTLEMENT_NOT_RETROACTIVE", "INDEPENDENT_INVALID", `settlement block_timestamp=${fp.block_timestamp} is after the capacity commitment expires_at=${capacityEvidence.projected_commitment.expires_at}`);
527
+ return;
528
+ }
529
+ builder.pass("SETTLEMENT_NOT_RETROACTIVE");
530
+ }
531
+ // Coherence material
532
+ const cm = material.coherence_material;
533
+ if (cm) {
534
+ if (cm.system_id !== proof.system_id) {
535
+ builder.fail("AGGREGATED_INTERPRETATION_UNIQUE", "INDEPENDENT_INVALID", `coherence_material.system_id="${cm.system_id}" does not match proof="${proof.system_id}"`);
536
+ return;
537
+ }
538
+ if (cm.rules_version !== proof.rules_version) {
539
+ builder.fail("AGGREGATED_INTERPRETATION_UNIQUE", "INDEPENDENT_INVALID", `coherence_material.rules_version="${cm.rules_version}" does not match proof="${proof.rules_version}"`);
540
+ return;
541
+ }
542
+ if (cm.settlement_profile_id !== proof.settlement.profile_id) {
543
+ builder.fail("AGGREGATED_INTERPRETATION_UNIQUE", "INDEPENDENT_INVALID", `coherence_material.settlement_profile_id="${cm.settlement_profile_id}" does not match proof="${proof.settlement.profile_id}"`);
544
+ return;
545
+ }
546
+ }
547
+ }
548
+ //# sourceMappingURL=settlement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settlement.js","sourceRoot":"","sources":["../../../core/independent/settlement.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAK5E;;;;;;GAMG;AACH,MAAM,2BAA2B,GAA2C;IAC1E,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,IAAI;IACnB,qBAAqB,EAAE,IAAI;IAC3B,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,IAAI;IAChB,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,IAAI;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,IAAI,CACjD,2BAA2B,CACQ,CAAC;AAEtC,iFAAiF;AACjF,+EAA+E;AAC/E,aAAa;AACb,MAAM,gBAAgB,GAAG,8BAA8B,CAAC;AACxD,yEAAyE;AACzE,+EAA+E;AAC/E,MAAM,kBAAkB,GAAG,MAAM,C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OAAO;QACT,CAAC;QACD,IAAI,EAAE,CAAC,qBAAqB,KAAK,KAAK,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;YAC7D,OAAO,CAAC,IAAI,CACV,kCAAkC,EAClC,qBAAqB,EACrB,6CAA6C,EAAE,CAAC,qBAAqB,2BAA2B,KAAK,CAAC,UAAU,CAAC,UAAU,GAAG,CAC/H,CAAC;YACF,OAAO;QACT,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { LoadedArtifacts, SystemDomainConfig } from "../types/index.js";
2
+ import { ResultBuilder } from "../result/builder.js";
3
+ /**
4
+ * Verify the Independent path.
5
+ *
6
+ * Per verifier-toolkit/1 section 11.2:
7
+ * This runs AFTER verifyIssued has already been called (step 3).
8
+ *
9
+ * Validation sequence (verifier-toolkit/1 §11.2; independence.proof/1 §12):
10
+ * 1. Proof structure
11
+ * 2. System domain attribution
12
+ * 3. Rules domain selection
13
+ * 4. Leaf binding
14
+ * 5. Capacity-evidence binding — before settlement, as independence.proof/1
15
+ * §9 and §12.5 require: the settlement fixes a consumption whose
16
+ * authorization must first be shown legitimate
17
+ * 6. Settlement (ref, finality, capacity, inclusion, aggregated interpretation)
18
+ * 7. Issuance-time participation
19
+ * 8. Proof signature (mandatory; authenticates the signed view, node
20
+ * attestation included)
21
+ * 9. Anti-replay
22
+ * 10. Anti-splicing
23
+ * 11. Effective-units binding
24
+ *
25
+ * Short-circuit only on Independent-specific failures (via checkpoint),
26
+ * NOT on prior Issued failures like UNSUPPORTED for signature verification.
27
+ * This ensures the full Independent baseline runs and populates diagnostics
28
+ * even when Issued checks have a non-blocking failure.
29
+ */
30
+ export declare function verifyIndependent(artifacts: LoadedArtifacts, config: SystemDomainConfig, builder: ResultBuilder): void;