@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,178 @@
1
+ /**
2
+ * The toolkit's public surface — identical on Node and in the browser.
3
+ *
4
+ * Both entry points (`verify-node.ts`, `verify-web.ts`) re-export this module, so
5
+ * an integrator gets the same API on either runtime and code written against one
6
+ * runs on the other.
7
+ *
8
+ * ## What is here, and what is not
9
+ *
10
+ * The rule is **complete operations, never loose primitives**. Everything below
11
+ * is something a caller can use without being able to reach a wrong answer that
12
+ * still looks right. Deliberately NOT exported:
13
+ *
14
+ * - `computeMerkleRoot` / `computeLeafHash` / `generateInclusionProof` — the
15
+ * pieces of the HOLDER-KEYSET fold (`holder-keyset.merkle-sha3-256/1`).
16
+ * Exposing them invites hand-rolling that tree, and no public operation
17
+ * needs them.
18
+ *
19
+ * The collection fold (`collectionLeafHash` / `collectionNodeHash` /
20
+ * `collectionMerkleRoot`) IS exported, and that is a deliberate exception.
21
+ * Because `subject.collection/1` §7.4 places the per-leaf commitments INSIDE the
22
+ * signed certificate, a holder of the certificate can derive an inclusion proof for any
23
+ * element from `leaves[]` alone — no issuer round-trip, no separately delivered
24
+ * proof file. Deriving it is not hand-rolling a tree: the inputs are signed. The
25
+ * verdict still comes from `verifyCollectionInclusion`, which is fail-closed.
26
+ * - `verifyEd25519Signature` / `verifyEcdsaP256Signature` /
27
+ * `verifyMlDsa65Signature` — single components of a composite signature.
28
+ * `ecdsa-p256.ts` says it outright: a component MUST NOT be used as a
29
+ * signature-verdict API on its own. A composite is valid only through
30
+ * `verifyComposite` (the AND of all components), so only that is exported —
31
+ * exporting the components would be handing out a way to accept a signature
32
+ * whose post-quantum half was stripped.
33
+ * - `derivePseudonym`, the `assert*Precondition` helpers, the crypto provider
34
+ * internals — implementation detail with no standalone meaning.
35
+ *
36
+ * Nothing here can produce a signature. The toolkit evaluates artifacts under
37
+ * public rules and holds no secrets; the crypto provider interface exposes
38
+ * hashing and signature *verification* only.
39
+ */
40
+ export { verify } from "./verify.js";
41
+ /**
42
+ * Required by the spec: a conforming toolkit MUST expose an element-level
43
+ * inclusion operation — given ONE declared leaf, its inclusion proof, and the
44
+ * collection's declared root and cardinality, confirm membership WITHOUT the
45
+ * rest of the collection.
46
+ *
47
+ * A positive result reconstructs the identical root the whole-set construction
48
+ * computes, and is fail-closed under the failure conditions of
49
+ * `collection.merkle-sha3-256/1`.
50
+ */
51
+ export { verifyCollectionInclusion, collectionLeafHash, collectionNodeHash, collectionMerkleRoot, COLLECTION_MERKLE_SCHEME, } from "./crypto/collection-merkle.js";
52
+ export type { CollectionInclusionProof, CollectionInclusionResult, } from "./crypto/collection-merkle.js";
53
+ /**
54
+ * The same question from the certificate alone (verifier-toolkit/1 §8.4.2): the
55
+ * leaves are signed inside the certificate, so ONE leaf value is enough. The
56
+ * certificate is verified under the Issued route first, the declared leaves
57
+ * must fold to the declared root, every declared leaf profile is tried, and a
58
+ * value that repeats is reported at every position it occupies.
59
+ */
60
+ export { verifyCollectionElementFromCertificate } from "./issued/verify-collection-element.js";
61
+ export type { CollectionElementOutcome, CollectionElementMatch, CollectionElementResult, CollectionElementOptions, } from "./issued/verify-collection-element.js";
62
+ /**
63
+ * SHA3-256, the digest under every commitment in the spec.
64
+ *
65
+ * This is what lets a caller compute a commitment where the material already is
66
+ * — in a browser, over a local file — instead of sending the material anywhere.
67
+ */
68
+ export { digestHexBytes, digestHexText, digestHexStream, digestBytes, } from "./crypto/digest.js";
69
+ /**
70
+ * Canonical bytes for a subject under its declared profile, and the profiles the
71
+ * toolkit supports. Needed to build a correct verification input: the profile
72
+ * alone defines canonicalization, and material must be delivered byte-exact
73
+ * (no normalizing, re-encoding, or BOM-stripping by the caller).
74
+ */
75
+ export { canonicalBytesForSubject, SUBJECT_BINARY, isOpaqueByteProfile, OPAQUE_BYTE_PROFILES, SUBJECT_TEXT, SUBJECT_EMAIL, SUBJECT_COLLECTION, SUBJECT_AI_DECISION, SUPPORTED_SUBJECT_PROFILES, } from "./crypto/canonical-subject.js";
76
+ /**
77
+ * JCS (RFC 8785) canonicalization — the byte form every signature in the stack
78
+ * is computed over. Exported so a caller can reproduce a signed view exactly.
79
+ */
80
+ export { jcsCanonicalizeBytes, jcsCanonicalizeString } from "./crypto/jcs.js";
81
+ /**
82
+ * Strict JSON parsing: RFC 8259, and no object repeats a member name at any
83
+ * depth. Artifacts read from a path are parsed this way. An artifact passed in
84
+ * memory has already been parsed by the caller, and a parser that kept one of
85
+ * two duplicates has already lost them; parse such artifacts with this function
86
+ * so a duplicate fails closed instead of being evaluated.
87
+ */
88
+ export { strictJsonParse, StrictJsonError } from "./input/strict-json.js";
89
+ /**
90
+ * Consistency of a certificate with the declared context it names, under
91
+ * CCVP/1 — an OPTIONAL plane reported beside the verdict, never part of it.
92
+ *
93
+ * Takes the target certificate and the candidate context snapshot certificates
94
+ * themselves. Each one is verified under the Issued route; each snapshot's
95
+ * issuer is derived from its signature (`signer.id` plus the composite key
96
+ * fingerprint), never from a field it carries. No outcome changes what
97
+ * `verify()` returns, and `consistency-match` is not endorsement, trust or a
98
+ * step toward Independent: it says the issuance aligned with one declared
99
+ * context, and nothing else.
100
+ */
101
+ export { verifyConsistency } from "./consistency/verify-consistency.js";
102
+ export type { ConsistencyOutcome, ConsistencyResult, ConsistencyNamespace, SelectedSnapshot, } from "./consistency/verify-consistency.js";
103
+ /**
104
+ * Composite signature verification — the AND of every declared component.
105
+ *
106
+ * This is the ONLY signature entry point exported, by design: a composite is
107
+ * valid only when all its components verify, so a caller cannot accidentally
108
+ * accept one whose post-quantum component was stripped or corrupted.
109
+ */
110
+ export { verifyComposite, compositeMPrime, COMPOSITE_DOMAIN_PREFIX, PROFILE_P256_MLDSA65, PROFILE_ED25519_MLDSA65, ALG_ECDSA_P256, ALG_ED25519, ALG_MLDSA65, } from "./crypto/composite.js";
111
+ export type { ComponentSignature, CompositeSignatureWire, CompositePublicKeys, CompositeVerifyResult, } from "./crypto/composite.js";
112
+ /**
113
+ * The production profile, and the ONLY one this package exports.
114
+ *
115
+ * Its `system_root_fingerprint`, issuance and settlement account are the
116
+ * published XRPL mainnet values of `rules/2026-01`, and its corpus commitment
117
+ * for `rules/2026-01` is the `subtree_root` of the corpus proof that certifies
118
+ * that rules text. A rules version whose corpus proof is pending carries
119
+ * `<pending-corpus-proof>` instead, and the rules check rejects it, so
120
+ * production verification fails closed BY DESIGN for it. Writing a concrete
121
+ * value before its source exists is a fail-OPEN bug, not a fix.
122
+ *
123
+ * WHY THE TEST PROFILES ARE NOT EXPORTED
124
+ *
125
+ * `getEnvConfig` and `getConformanceConfig` live in `harness/`, which the
126
+ * test suite and the conformance runner import directly and which the published
127
+ * package does not contain (the CLI takes a profile as a file, `--test-config`,
128
+ * instead). That is a product boundary rather than a safety measure.
129
+ *
130
+ * Safety is not the reason: `production_verification` already reports which
131
+ * regime produced a result, and it compares the ENTIRE config against the
132
+ * published profile, so a test verdict cannot be relabelled as production. The
133
+ * reason is scope. These helpers exist to drive a test harness, and once a
134
+ * function is in the public API someone integrates with it — after which
135
+ * withdrawing it stops being housekeeping and starts being a breaking change.
136
+ *
137
+ * Verifying against a test network is a sandbox concern, outside this package's
138
+ * scope. Adding them later is easy; removing them after someone depends on them
139
+ * is not.
140
+ */
141
+ export { getCertcryptConfig } from "./config/default.js";
142
+ /**
143
+ * The digest a registry entry pins as `foundation_payload_digest`:
144
+ * SHA3-256(JCS(unsigned statement payload)) of a `system-foundation/1`
145
+ * statement (its Section 9). For a deployment that configures its own bootstrap
146
+ * statement; `verify()` computes and compares it itself.
147
+ */
148
+ export { foundationPayloadDigest } from "./foundation/verify-foundation.js";
149
+ /**
150
+ * Rules-text authenticity (`rules-domain/1` §13.3): whether a set of documents is
151
+ * the exact ruleset a corpus proof certifies, and whether that proof is the one
152
+ * this configuration carries. Says nothing about whether the rules are right.
153
+ */
154
+ export { verifyCertifiedFiles, verifyRulesCorpus } from "./rules/verify-corpus.js";
155
+ export type { CertifiedFile, CertifiedFilesResult } from "./rules/verify-corpus.js";
156
+ export type { RulesCorpusDocument, RulesCorpusResult } from "./rules/verify-corpus.js";
157
+ /**
158
+ * Which conformance vectors THIS build passed.
159
+ *
160
+ * The toolkit's own version (from `package.json`) says which code ran;
161
+ * `CONFORMANCE_VECTORS_VERSION` says what that code was held to. A report that
162
+ * offers reproducibility needs both, and neither substitutes for the other.
163
+ *
164
+ * `null` means the suite has not been run against this build — a local build
165
+ * without the conformance checkout, or a build whose suite failed. Callers MUST
166
+ * render nothing in that case. Reading the `VERSION` of a conformance checkout
167
+ * directly and displaying it instead would republish a number the displaying
168
+ * code never verified, which is the claim this constant exists to make honest.
169
+ */
170
+ export { CONFORMANCE_VECTORS_VERSION, CONFORMANCE_FIXTURES_PASSED, } from "./conformance/attestation.js";
171
+ /**
172
+ * Initialize the ML-DSA-65 backend. NOT optional to a verdict: ML-DSA-65 is the
173
+ * post-quantum floor of every composite signature, so until this has resolved
174
+ * successfully every verification returns UNSUPPORTED rather than a verdict.
175
+ * Call once at startup.
176
+ */
177
+ export { initMlDsa65 } from "./crypto/ml-dsa.js";
178
+ export * from "./types/index.js";
@@ -0,0 +1,182 @@
1
+ /**
2
+ * The toolkit's public surface — identical on Node and in the browser.
3
+ *
4
+ * Both entry points (`verify-node.ts`, `verify-web.ts`) re-export this module, so
5
+ * an integrator gets the same API on either runtime and code written against one
6
+ * runs on the other.
7
+ *
8
+ * ## What is here, and what is not
9
+ *
10
+ * The rule is **complete operations, never loose primitives**. Everything below
11
+ * is something a caller can use without being able to reach a wrong answer that
12
+ * still looks right. Deliberately NOT exported:
13
+ *
14
+ * - `computeMerkleRoot` / `computeLeafHash` / `generateInclusionProof` — the
15
+ * pieces of the HOLDER-KEYSET fold (`holder-keyset.merkle-sha3-256/1`).
16
+ * Exposing them invites hand-rolling that tree, and no public operation
17
+ * needs them.
18
+ *
19
+ * The collection fold (`collectionLeafHash` / `collectionNodeHash` /
20
+ * `collectionMerkleRoot`) IS exported, and that is a deliberate exception.
21
+ * Because `subject.collection/1` §7.4 places the per-leaf commitments INSIDE the
22
+ * signed certificate, a holder of the certificate can derive an inclusion proof for any
23
+ * element from `leaves[]` alone — no issuer round-trip, no separately delivered
24
+ * proof file. Deriving it is not hand-rolling a tree: the inputs are signed. The
25
+ * verdict still comes from `verifyCollectionInclusion`, which is fail-closed.
26
+ * - `verifyEd25519Signature` / `verifyEcdsaP256Signature` /
27
+ * `verifyMlDsa65Signature` — single components of a composite signature.
28
+ * `ecdsa-p256.ts` says it outright: a component MUST NOT be used as a
29
+ * signature-verdict API on its own. A composite is valid only through
30
+ * `verifyComposite` (the AND of all components), so only that is exported —
31
+ * exporting the components would be handing out a way to accept a signature
32
+ * whose post-quantum half was stripped.
33
+ * - `derivePseudonym`, the `assert*Precondition` helpers, the crypto provider
34
+ * internals — implementation detail with no standalone meaning.
35
+ *
36
+ * Nothing here can produce a signature. The toolkit evaluates artifacts under
37
+ * public rules and holds no secrets; the crypto provider interface exposes
38
+ * hashing and signature *verification* only.
39
+ */
40
+ // ── The verdict ─────────────────────────────────────────────────────────────
41
+ export { verify } from "./verify.js";
42
+ // ── Element-level inclusion (verifier-toolkit/1) ─────────────────────
43
+ /**
44
+ * Required by the spec: a conforming toolkit MUST expose an element-level
45
+ * inclusion operation — given ONE declared leaf, its inclusion proof, and the
46
+ * collection's declared root and cardinality, confirm membership WITHOUT the
47
+ * rest of the collection.
48
+ *
49
+ * A positive result reconstructs the identical root the whole-set construction
50
+ * computes, and is fail-closed under the failure conditions of
51
+ * `collection.merkle-sha3-256/1`.
52
+ */
53
+ export { verifyCollectionInclusion, collectionLeafHash, collectionNodeHash, collectionMerkleRoot, COLLECTION_MERKLE_SCHEME, } from "./crypto/collection-merkle.js";
54
+ /**
55
+ * The same question from the certificate alone (verifier-toolkit/1 §8.4.2): the
56
+ * leaves are signed inside the certificate, so ONE leaf value is enough. The
57
+ * certificate is verified under the Issued route first, the declared leaves
58
+ * must fold to the declared root, every declared leaf profile is tried, and a
59
+ * value that repeats is reported at every position it occupies.
60
+ */
61
+ export { verifyCollectionElementFromCertificate } from "./issued/verify-collection-element.js";
62
+ // ── Commitment recomputation ───────────────────────────────────────
63
+ /**
64
+ * SHA3-256, the digest under every commitment in the spec.
65
+ *
66
+ * This is what lets a caller compute a commitment where the material already is
67
+ * — in a browser, over a local file — instead of sending the material anywhere.
68
+ */
69
+ export { digestHexBytes, digestHexText, digestHexStream, digestBytes, } from "./crypto/digest.js";
70
+ /**
71
+ * Canonical bytes for a subject under its declared profile, and the profiles the
72
+ * toolkit supports. Needed to build a correct verification input: the profile
73
+ * alone defines canonicalization, and material must be delivered byte-exact
74
+ * (no normalizing, re-encoding, or BOM-stripping by the caller).
75
+ */
76
+ export { canonicalBytesForSubject, SUBJECT_BINARY, isOpaqueByteProfile, OPAQUE_BYTE_PROFILES, SUBJECT_TEXT, SUBJECT_EMAIL, SUBJECT_COLLECTION, SUBJECT_AI_DECISION, SUPPORTED_SUBJECT_PROFILES, } from "./crypto/canonical-subject.js";
77
+ /**
78
+ * JCS (RFC 8785) canonicalization — the byte form every signature in the stack
79
+ * is computed over. Exported so a caller can reproduce a signed view exactly.
80
+ */
81
+ export { jcsCanonicalizeBytes, jcsCanonicalizeString } from "./crypto/jcs.js";
82
+ /**
83
+ * Strict JSON parsing: RFC 8259, and no object repeats a member name at any
84
+ * depth. Artifacts read from a path are parsed this way. An artifact passed in
85
+ * memory has already been parsed by the caller, and a parser that kept one of
86
+ * two duplicates has already lost them; parse such artifacts with this function
87
+ * so a duplicate fails closed instead of being evaluated.
88
+ */
89
+ export { strictJsonParse, StrictJsonError } from "./input/strict-json.js";
90
+ // ── Consistency (CCVP/1, optional plane) ────────────────────────────────────
91
+ /**
92
+ * Consistency of a certificate with the declared context it names, under
93
+ * CCVP/1 — an OPTIONAL plane reported beside the verdict, never part of it.
94
+ *
95
+ * Takes the target certificate and the candidate context snapshot certificates
96
+ * themselves. Each one is verified under the Issued route; each snapshot's
97
+ * issuer is derived from its signature (`signer.id` plus the composite key
98
+ * fingerprint), never from a field it carries. No outcome changes what
99
+ * `verify()` returns, and `consistency-match` is not endorsement, trust or a
100
+ * step toward Independent: it says the issuance aligned with one declared
101
+ * context, and nothing else.
102
+ */
103
+ export { verifyConsistency } from "./consistency/verify-consistency.js";
104
+ // ── Composite signatures ────────────────────────────────────────────────────
105
+ /**
106
+ * Composite signature verification — the AND of every declared component.
107
+ *
108
+ * This is the ONLY signature entry point exported, by design: a composite is
109
+ * valid only when all its components verify, so a caller cannot accidentally
110
+ * accept one whose post-quantum component was stripped or corrupted.
111
+ */
112
+ export { verifyComposite, compositeMPrime, COMPOSITE_DOMAIN_PREFIX, PROFILE_P256_MLDSA65, PROFILE_ED25519_MLDSA65, ALG_ECDSA_P256, ALG_ED25519, ALG_MLDSA65, } from "./crypto/composite.js";
113
+ // ── System-domain configuration ─────────────────────────────────────────────
114
+ /**
115
+ * The production profile, and the ONLY one this package exports.
116
+ *
117
+ * Its `system_root_fingerprint`, issuance and settlement account are the
118
+ * published XRPL mainnet values of `rules/2026-01`, and its corpus commitment
119
+ * for `rules/2026-01` is the `subtree_root` of the corpus proof that certifies
120
+ * that rules text. A rules version whose corpus proof is pending carries
121
+ * `<pending-corpus-proof>` instead, and the rules check rejects it, so
122
+ * production verification fails closed BY DESIGN for it. Writing a concrete
123
+ * value before its source exists is a fail-OPEN bug, not a fix.
124
+ *
125
+ * WHY THE TEST PROFILES ARE NOT EXPORTED
126
+ *
127
+ * `getEnvConfig` and `getConformanceConfig` live in `harness/`, which the
128
+ * test suite and the conformance runner import directly and which the published
129
+ * package does not contain (the CLI takes a profile as a file, `--test-config`,
130
+ * instead). That is a product boundary rather than a safety measure.
131
+ *
132
+ * Safety is not the reason: `production_verification` already reports which
133
+ * regime produced a result, and it compares the ENTIRE config against the
134
+ * published profile, so a test verdict cannot be relabelled as production. The
135
+ * reason is scope. These helpers exist to drive a test harness, and once a
136
+ * function is in the public API someone integrates with it — after which
137
+ * withdrawing it stops being housekeeping and starts being a breaking change.
138
+ *
139
+ * Verifying against a test network is a sandbox concern, outside this package's
140
+ * scope. Adding them later is easy; removing them after someone depends on them
141
+ * is not.
142
+ */
143
+ export { getCertcryptConfig } from "./config/default.js";
144
+ /**
145
+ * The digest a registry entry pins as `foundation_payload_digest`:
146
+ * SHA3-256(JCS(unsigned statement payload)) of a `system-foundation/1`
147
+ * statement (its Section 9). For a deployment that configures its own bootstrap
148
+ * statement; `verify()` computes and compares it itself.
149
+ */
150
+ export { foundationPayloadDigest } from "./foundation/verify-foundation.js";
151
+ /**
152
+ * Rules-text authenticity (`rules-domain/1` §13.3): whether a set of documents is
153
+ * the exact ruleset a corpus proof certifies, and whether that proof is the one
154
+ * this configuration carries. Says nothing about whether the rules are right.
155
+ */
156
+ export { verifyCertifiedFiles, verifyRulesCorpus } from "./rules/verify-corpus.js";
157
+ // ── Conformance attestation ─────────────────────────────────────────────────
158
+ /**
159
+ * Which conformance vectors THIS build passed.
160
+ *
161
+ * The toolkit's own version (from `package.json`) says which code ran;
162
+ * `CONFORMANCE_VECTORS_VERSION` says what that code was held to. A report that
163
+ * offers reproducibility needs both, and neither substitutes for the other.
164
+ *
165
+ * `null` means the suite has not been run against this build — a local build
166
+ * without the conformance checkout, or a build whose suite failed. Callers MUST
167
+ * render nothing in that case. Reading the `VERSION` of a conformance checkout
168
+ * directly and displaying it instead would republish a number the displaying
169
+ * code never verified, which is the claim this constant exists to make honest.
170
+ */
171
+ export { CONFORMANCE_VECTORS_VERSION, CONFORMANCE_FIXTURES_PASSED, } from "./conformance/attestation.js";
172
+ // ── Post-quantum runtime ────────────────────────────────────────────────────
173
+ /**
174
+ * Initialize the ML-DSA-65 backend. NOT optional to a verdict: ML-DSA-65 is the
175
+ * post-quantum floor of every composite signature, so until this has resolved
176
+ * successfully every verification returns UNSUPPORTED rather than a verdict.
177
+ * Call once at startup.
178
+ */
179
+ export { initMlDsa65 } from "./crypto/ml-dsa.js";
180
+ // ── Types ───────────────────────────────────────────────────────────────────
181
+ export * from "./types/index.js";
182
+ //# sourceMappingURL=public-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../../core/public-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,+EAA+E;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,wEAAwE;AAExE;;;;;;;;;GASG;AACH,OAAO,EACL,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AAMvC;;;;;;GAMG;AACH,OAAO,EAAE,sCAAsC,EAAE,MAAM,uCAAuC,CAAC;AAQ/F,sEAAsE;AAEtE;;;;;GAKG;AACH,OAAO,EACL,cAAc,EACd,aAAa,EACb,eAAe,EACf,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,OAAO,EACL,wBAAwB,EACxB,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AAEvC;;;GAGG;AACH,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE9E;;;;;;GAMG;AACH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE1E,+EAA+E;AAE/E;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAQxE,+EAA+E;AAE/E;;;;;;GAMG;AACH,OAAO,EACL,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,WAAW,EACX,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAQ/B,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;GAKG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E;;;;GAIG;AACH,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAInF,+EAA+E;AAE/E;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,8BAA8B,CAAC;AAEtC,+EAA+E;AAE/E;;;;;GAKG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,+EAA+E;AAE/E,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,92 @@
1
+ import type { VerifierRequest, VerifierResult, PqcVerificationResult, ResolvedTarget, CheckId, CheckResult, CheckFailureClassification, DiagnosticLevel, NodeAttestation } from "../types/index.js";
2
+ export declare class ResultBuilder {
3
+ private readonly request;
4
+ private resolvedTarget;
5
+ private checks;
6
+ private missingArtifacts;
7
+ private diagnosticsList;
8
+ private earlyExit;
9
+ private _productionVerification;
10
+ private _settlementProfileId;
11
+ private _subtreeRoot;
12
+ private _settlementRef;
13
+ private _batchRoot;
14
+ private _batchIndex;
15
+ private _batchSize;
16
+ private _foundationProfileId;
17
+ private _foundationStatementId;
18
+ private _foundationPublicationRef;
19
+ private _attestedNode;
20
+ private _subjectScope;
21
+ private _pqcResult;
22
+ private _completeMaterialPerformed;
23
+ private _completeMaterialPassed;
24
+ constructor(request: VerifierRequest);
25
+ setResolvedTarget(target: ResolvedTarget): void;
26
+ /** Record the proof's node attestation; reported only on INDEPENDENT_VALID. */
27
+ setAttestedNode(attestation: NodeAttestation | null): void;
28
+ setLineage(lineage: {
29
+ settlement_profile_id?: string;
30
+ subtree_root?: string;
31
+ settlement_ref?: string;
32
+ batch_root?: string;
33
+ batch_index?: string;
34
+ batch_size?: string;
35
+ }): void;
36
+ setFoundationLineage(lineage: {
37
+ foundation_profile_id?: string;
38
+ foundation_statement_id?: string;
39
+ foundation_publication_ref?: string;
40
+ }): void;
41
+ setPqcResult(result: PqcVerificationResult): void;
42
+ /**
43
+ * Record the per-subject verdict scope from the base certificate's anchor
44
+ * subjects, in order. Only `subject.collection/1` declares its elements
45
+ * (`opaque: false`); every other profile is a single opaque subject whose
46
+ * internal contents the proof does NOT cover. Called once the base certificate
47
+ * is parsed. Makes an `INDEPENDENT_VALID` over an opaque subject (e.g. a ZIP as
48
+ * `subject.binary/1`) distinguishable, in the result, from one over a declared
49
+ * collection — closing the "container covers its children" over-read.
50
+ */
51
+ setSubjectScope(subjectProfiles: string[]): void;
52
+ /** Record that the complete-verification-against-material plane ran, and
53
+ * its outcome. Called by verify-original-material when material is delivered. */
54
+ setCompleteMaterialResult(performed: boolean, passed: boolean): void;
55
+ addCheck(result: CheckResult): void;
56
+ pass(checkId: CheckId, message?: string): void;
57
+ fail<C extends CheckId>(checkId: C, classification: CheckFailureClassification<C>, message?: string): void;
58
+ addMissingArtifact(artifactName: string): void;
59
+ addDiagnostic(level: DiagnosticLevel, message: string, checkId?: CheckId): void;
60
+ hasFailure(): boolean;
61
+ /** True when the named check has run and failed. */
62
+ hasFailed(checkId: CheckId): boolean;
63
+ /**
64
+ * Returns the current check count. Used to create a checkpoint so that
65
+ * downstream logic can detect failures added after a certain point
66
+ * without being affected by earlier failures (e.g., Issued UNSUPPORTED
67
+ * should not prevent Independent checks from running).
68
+ */
69
+ checkpoint(): number;
70
+ /**
71
+ * Returns true if any check added after the given checkpoint failed.
72
+ */
73
+ hasFailureSince(checkpoint: number): boolean;
74
+ markEarlyExit(): void;
75
+ /**
76
+ * Mark that verification ran under a configuration other than the published
77
+ * production profile. Surfaced as `production_verification: false` so a
78
+ * *_VALID result cannot be mistaken for a verdict about the production domain.
79
+ */
80
+ markNonProductionVerification(): void;
81
+ build(): VerifierResult;
82
+ private requiredIndependentChecks;
83
+ /**
84
+ * Derive certcrypt_lineage block from existing checks and fields.
85
+ * No new verification logic — purely a projection of already-validated state.
86
+ */
87
+ private deriveCertcryptLineage;
88
+ private deriveFailureCode;
89
+ private extractSystemId;
90
+ private extractSystemRootIdentifier;
91
+ private extractRulesVersion;
92
+ }