@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.
- package/CHANGELOG.md +72 -0
- package/LICENSE +178 -0
- package/README.md +563 -2
- package/SECURITY.md +77 -0
- package/dist/cli/certcrypt-verify.d.ts +2 -0
- package/dist/cli/certcrypt-verify.js +174 -0
- package/dist/cli/certcrypt-verify.js.map +1 -0
- package/dist/core/config/certcrypt-foundation.d.ts +13 -0
- package/dist/core/config/certcrypt-foundation.js +123 -0
- package/dist/core/config/certcrypt-foundation.js.map +1 -0
- package/dist/core/config/default.d.ts +47 -0
- package/dist/core/config/default.js +93 -0
- package/dist/core/config/default.js.map +1 -0
- package/dist/core/config/test-keys.d.ts +40 -0
- package/dist/core/config/test-keys.js +41 -0
- package/dist/core/config/test-keys.js.map +1 -0
- package/dist/core/conformance/attestation.d.ts +4 -0
- package/dist/core/conformance/attestation.js +4 -0
- package/dist/core/conformance/attestation.js.map +1 -0
- package/dist/core/consistency/verify-consistency.d.ts +92 -0
- package/dist/core/consistency/verify-consistency.js +353 -0
- package/dist/core/consistency/verify-consistency.js.map +1 -0
- package/dist/core/crypto/canonical-json.d.ts +14 -0
- package/dist/core/crypto/canonical-json.js +13 -0
- package/dist/core/crypto/canonical-json.js.map +1 -0
- package/dist/core/crypto/canonical-subject.d.ts +76 -0
- package/dist/core/crypto/canonical-subject.js +248 -0
- package/dist/core/crypto/canonical-subject.js.map +1 -0
- package/dist/core/crypto/collection-merkle.d.ts +91 -0
- package/dist/core/crypto/collection-merkle.js +243 -0
- package/dist/core/crypto/collection-merkle.js.map +1 -0
- package/dist/core/crypto/composite.d.ts +73 -0
- package/dist/core/crypto/composite.js +206 -0
- package/dist/core/crypto/composite.js.map +1 -0
- package/dist/core/crypto/digest.d.ts +18 -0
- package/dist/core/crypto/digest.js +37 -0
- package/dist/core/crypto/digest.js.map +1 -0
- package/dist/core/crypto/ecdsa-p256.d.ts +12 -0
- package/dist/core/crypto/ecdsa-p256.js +70 -0
- package/dist/core/crypto/ecdsa-p256.js.map +1 -0
- package/dist/core/crypto/ed25519.d.ts +10 -0
- package/dist/core/crypto/ed25519.js +28 -0
- package/dist/core/crypto/ed25519.js.map +1 -0
- package/dist/core/crypto/holder-keyset.d.ts +23 -0
- package/dist/core/crypto/holder-keyset.js +64 -0
- package/dist/core/crypto/holder-keyset.js.map +1 -0
- package/dist/core/crypto/jcs.d.ts +9 -0
- package/dist/core/crypto/jcs.js +59 -0
- package/dist/core/crypto/jcs.js.map +1 -0
- package/dist/core/crypto/merkle.d.ts +34 -0
- package/dist/core/crypto/merkle.js +147 -0
- package/dist/core/crypto/merkle.js.map +1 -0
- package/dist/core/crypto/ml-dsa.d.ts +25 -0
- package/dist/core/crypto/ml-dsa.js +104 -0
- package/dist/core/crypto/ml-dsa.js.map +1 -0
- package/dist/core/crypto/provider/bytes.d.ts +31 -0
- package/dist/core/crypto/provider/bytes.js +106 -0
- package/dist/core/crypto/provider/bytes.js.map +1 -0
- package/dist/core/crypto/provider/index.d.ts +45 -0
- package/dist/core/crypto/provider/index.js +60 -0
- package/dist/core/crypto/provider/index.js.map +1 -0
- package/dist/core/crypto/provider/node.d.ts +2 -0
- package/dist/core/crypto/provider/node.js +96 -0
- package/dist/core/crypto/provider/node.js.map +1 -0
- package/dist/core/crypto/provider/register-node.d.ts +11 -0
- package/dist/core/crypto/provider/register-node.js +16 -0
- package/dist/core/crypto/provider/register-node.js.map +1 -0
- package/dist/core/crypto/provider/types.d.ts +77 -0
- package/dist/core/crypto/provider/types.js +16 -0
- package/dist/core/crypto/provider/types.js.map +1 -0
- package/dist/core/crypto/provider/web.d.ts +2 -0
- package/dist/core/crypto/provider/web.js +122 -0
- package/dist/core/crypto/provider/web.js.map +1 -0
- package/dist/core/crypto/pseudonym.d.ts +25 -0
- package/dist/core/crypto/pseudonym.js +37 -0
- package/dist/core/crypto/pseudonym.js.map +1 -0
- package/dist/core/crypto/subject-json-preconditions.d.ts +47 -0
- package/dist/core/crypto/subject-json-preconditions.js +373 -0
- package/dist/core/crypto/subject-json-preconditions.js.map +1 -0
- package/dist/core/domain/verify-domain.d.ts +13 -0
- package/dist/core/domain/verify-domain.js +39 -0
- package/dist/core/domain/verify-domain.js.map +1 -0
- package/dist/core/foundation/anti-equivocation.d.ts +87 -0
- package/dist/core/foundation/anti-equivocation.js +0 -0
- package/dist/core/foundation/anti-equivocation.js.map +1 -0
- package/dist/core/foundation/verify-foundation.d.ts +36 -0
- package/dist/core/foundation/verify-foundation.js +559 -0
- package/dist/core/foundation/verify-foundation.js.map +1 -0
- package/dist/core/independent/anti-replay.d.ts +15 -0
- package/dist/core/independent/anti-replay.js +27 -0
- package/dist/core/independent/anti-replay.js.map +1 -0
- package/dist/core/independent/anti-splicing.d.ts +16 -0
- package/dist/core/independent/anti-splicing.js +54 -0
- package/dist/core/independent/anti-splicing.js.map +1 -0
- package/dist/core/independent/capacity-binding.d.ts +26 -0
- package/dist/core/independent/capacity-binding.js +57 -0
- package/dist/core/independent/capacity-binding.js.map +1 -0
- package/dist/core/independent/capacity-evidence.d.ts +38 -0
- package/dist/core/independent/capacity-evidence.js +286 -0
- package/dist/core/independent/capacity-evidence.js.map +1 -0
- package/dist/core/independent/effective-units.d.ts +42 -0
- package/dist/core/independent/effective-units.js +147 -0
- package/dist/core/independent/effective-units.js.map +1 -0
- package/dist/core/independent/issuance-participation.d.ts +13 -0
- package/dist/core/independent/issuance-participation.js +24 -0
- package/dist/core/independent/issuance-participation.js.map +1 -0
- package/dist/core/independent/leaf-binding.d.ts +5 -0
- package/dist/core/independent/leaf-binding.js +135 -0
- package/dist/core/independent/leaf-binding.js.map +1 -0
- package/dist/core/independent/operator-recognition-registry.d.ts +33 -0
- package/dist/core/independent/operator-recognition-registry.js +116 -0
- package/dist/core/independent/operator-recognition-registry.js.map +1 -0
- package/dist/core/independent/proof-structure.d.ts +8 -0
- package/dist/core/independent/proof-structure.js +167 -0
- package/dist/core/independent/proof-structure.js.map +1 -0
- package/dist/core/independent/proof-views.d.ts +26 -0
- package/dist/core/independent/proof-views.js +58 -0
- package/dist/core/independent/proof-views.js.map +1 -0
- package/dist/core/independent/settlement.d.ts +18 -0
- package/dist/core/independent/settlement.js +548 -0
- package/dist/core/independent/settlement.js.map +1 -0
- package/dist/core/independent/verify-independent.d.ts +30 -0
- package/dist/core/independent/verify-independent.js +123 -0
- package/dist/core/independent/verify-independent.js.map +1 -0
- package/dist/core/independent/verify-operator-recognition.d.ts +26 -0
- package/dist/core/independent/verify-operator-recognition.js +60 -0
- package/dist/core/independent/verify-operator-recognition.js.map +1 -0
- package/dist/core/independent/verify-proof-signature.d.ts +20 -0
- package/dist/core/independent/verify-proof-signature.js +97 -0
- package/dist/core/independent/verify-proof-signature.js.map +1 -0
- package/dist/core/input/fs-bridge.d.ts +30 -0
- package/dist/core/input/fs-bridge.js +35 -0
- package/dist/core/input/fs-bridge.js.map +1 -0
- package/dist/core/input/load-artifacts.d.ts +2 -0
- package/dist/core/input/load-artifacts.js +80 -0
- package/dist/core/input/load-artifacts.js.map +1 -0
- package/dist/core/input/load-original-material.d.ts +11 -0
- package/dist/core/input/load-original-material.js +126 -0
- package/dist/core/input/load-original-material.js.map +1 -0
- package/dist/core/input/register-node-fs.d.ts +1 -0
- package/dist/core/input/register-node-fs.js +24 -0
- package/dist/core/input/register-node-fs.js.map +1 -0
- package/dist/core/input/resolve-target.d.ts +16 -0
- package/dist/core/input/resolve-target.js +43 -0
- package/dist/core/input/resolve-target.js.map +1 -0
- package/dist/core/input/strict-json.d.ts +25 -0
- package/dist/core/input/strict-json.js +167 -0
- package/dist/core/input/strict-json.js.map +1 -0
- package/dist/core/input/validate.d.ts +7 -0
- package/dist/core/input/validate.js +83 -0
- package/dist/core/input/validate.js.map +1 -0
- package/dist/core/issued/verify-collection-element.d.ts +66 -0
- package/dist/core/issued/verify-collection-element.js +137 -0
- package/dist/core/issued/verify-collection-element.js.map +1 -0
- package/dist/core/issued/verify-issued.d.ts +15 -0
- package/dist/core/issued/verify-issued.js +361 -0
- package/dist/core/issued/verify-issued.js.map +1 -0
- package/dist/core/issued/verify-original-material.d.ts +35 -0
- package/dist/core/issued/verify-original-material.js +418 -0
- package/dist/core/issued/verify-original-material.js.map +1 -0
- package/dist/core/package/verify-package.d.ts +34 -0
- package/dist/core/package/verify-package.js +109 -0
- package/dist/core/package/verify-package.js.map +1 -0
- package/dist/core/public-api.d.ts +178 -0
- package/dist/core/public-api.js +182 -0
- package/dist/core/public-api.js.map +1 -0
- package/dist/core/result/builder.d.ts +92 -0
- package/dist/core/result/builder.js +408 -0
- package/dist/core/result/builder.js.map +1 -0
- package/dist/core/rules/verify-corpus.d.ts +88 -0
- package/dist/core/rules/verify-corpus.js +165 -0
- package/dist/core/rules/verify-corpus.js.map +1 -0
- package/dist/core/rules/verify-rules.d.ts +14 -0
- package/dist/core/rules/verify-rules.js +62 -0
- package/dist/core/rules/verify-rules.js.map +1 -0
- package/dist/core/testing/validate-against-schema.d.ts +31 -0
- package/dist/core/testing/validate-against-schema.js +93 -0
- package/dist/core/testing/validate-against-schema.js.map +1 -0
- package/dist/core/types/artifacts.d.ts +224 -0
- package/dist/core/types/artifacts.js +2 -0
- package/dist/core/types/artifacts.js.map +1 -0
- package/dist/core/types/capacity-evidence.d.ts +85 -0
- package/dist/core/types/capacity-evidence.js +51 -0
- package/dist/core/types/capacity-evidence.js.map +1 -0
- package/dist/core/types/check.d.ts +61 -0
- package/dist/core/types/check.js +2 -0
- package/dist/core/types/check.js.map +1 -0
- package/dist/core/types/config.d.ts +97 -0
- package/dist/core/types/config.js +2 -0
- package/dist/core/types/config.js.map +1 -0
- package/dist/core/types/foundation.d.ts +121 -0
- package/dist/core/types/foundation.js +25 -0
- package/dist/core/types/foundation.js.map +1 -0
- package/dist/core/types/index.d.ts +9 -0
- package/dist/core/types/index.js +2 -0
- package/dist/core/types/index.js.map +1 -0
- package/dist/core/types/operator-recognition.d.ts +71 -0
- package/dist/core/types/operator-recognition.js +24 -0
- package/dist/core/types/operator-recognition.js.map +1 -0
- package/dist/core/types/proof.d.ts +94 -0
- package/dist/core/types/proof.js +2 -0
- package/dist/core/types/proof.js.map +1 -0
- package/dist/core/types/request.d.ts +59 -0
- package/dist/core/types/request.js +2 -0
- package/dist/core/types/request.js.map +1 -0
- package/dist/core/types/result.d.ts +164 -0
- package/dist/core/types/result.js +2 -0
- package/dist/core/types/result.js.map +1 -0
- package/dist/core/types/settlement-material.d.ts +130 -0
- package/dist/core/types/settlement-material.js +2 -0
- package/dist/core/types/settlement-material.js.map +1 -0
- package/dist/core/verify-node.d.ts +14 -0
- package/dist/core/verify-node.js +17 -0
- package/dist/core/verify-node.js.map +1 -0
- package/dist/core/verify-web.d.ts +1 -0
- package/dist/core/verify-web.js +25 -0
- package/dist/core/verify-web.js.map +1 -0
- package/dist/core/verify.d.ts +18 -0
- package/dist/core/verify.js +183 -0
- package/dist/core/verify.js.map +1 -0
- package/package.json +71 -4
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { ComponentSignature } from "../crypto/composite.js";
|
|
2
|
+
export interface FinalityContext {
|
|
3
|
+
/** Public, permissionless substrate that witnesses this finality (e.g. "xrpl").
|
|
4
|
+
* NEVER a trusted third party / TSA: finality is witnessed by a public substrate. */
|
|
5
|
+
substrate: string;
|
|
6
|
+
block_height: string;
|
|
7
|
+
/** Irreversible block time of the settlement: the substrate's "when"
|
|
8
|
+
* for the capacity consumption. RFC 3339 UTC. */
|
|
9
|
+
timestamp: string;
|
|
10
|
+
confirmation_level: string;
|
|
11
|
+
}
|
|
12
|
+
export interface Settlement {
|
|
13
|
+
profile_id: string;
|
|
14
|
+
ref: string;
|
|
15
|
+
/** Finality witnesses: a list so a second public substrate is additive
|
|
16
|
+
* later without a version bump. Under settlement.aggregated.xrpl/1: one
|
|
17
|
+
* element (XRPL). */
|
|
18
|
+
finality_proofs: FinalityContext[];
|
|
19
|
+
}
|
|
20
|
+
export interface Batch {
|
|
21
|
+
root: string;
|
|
22
|
+
index: string;
|
|
23
|
+
size: string;
|
|
24
|
+
}
|
|
25
|
+
export interface AntiReplay {
|
|
26
|
+
nonce: string;
|
|
27
|
+
derivation: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Node attestation (independence.proof/1 §10.15): the system domain states,
|
|
31
|
+
* inside the signed view, that the submission carrying this leaf entered through
|
|
32
|
+
* the recognized node `node_id`, whose recognition it checked at `recognized_at`.
|
|
33
|
+
*/
|
|
34
|
+
export interface NodeAttestation {
|
|
35
|
+
/** Stable node identifier: `op:` followed by 22 standard-base64 characters. */
|
|
36
|
+
node_id: string;
|
|
37
|
+
/** RFC 3339 UTC, whole seconds (`YYYY-MM-DDTHH:MM:SSZ`). Not a time seal. */
|
|
38
|
+
recognized_at: string;
|
|
39
|
+
}
|
|
40
|
+
export interface IndependenceProof {
|
|
41
|
+
proof_version: string;
|
|
42
|
+
system_id: string;
|
|
43
|
+
system_root_fingerprint: string;
|
|
44
|
+
rules_version: string;
|
|
45
|
+
/**
|
|
46
|
+
* `SHA3-256(JCS(identity view))`, the identity view being exactly
|
|
47
|
+
* `proof_version`, `system_id`, `rules_version`, `system_root_fingerprint`,
|
|
48
|
+
* `subtree_root`, `closure_time`, `consumed_commitment_ids` and
|
|
49
|
+
* `settlement_ref` (independence.proof/1 §10.3.1). The verifier recomputes it.
|
|
50
|
+
*/
|
|
51
|
+
proof_id: string;
|
|
52
|
+
/**
|
|
53
|
+
* The leaf's bound value under the leaf=subtree model: the Merkle root over
|
|
54
|
+
* the commitments accepted into this settlement leaf. A commitment's
|
|
55
|
+
* `commitment_id` includes against this root (level 1); this root is itself a
|
|
56
|
+
* leaf of the batch tree (level 2).
|
|
57
|
+
*/
|
|
58
|
+
subtree_root: string;
|
|
59
|
+
/** Submission-set close timestamp declared by the issuer side: RFC 3339 UTC,
|
|
60
|
+
* whole seconds. Not a CERTCRYPT time seal. */
|
|
61
|
+
closure_time: string;
|
|
62
|
+
/** Ordered consumed capacity.commitment/1 ids (64 lowercase hex, no duplicates). */
|
|
63
|
+
consumed_commitment_ids: string[];
|
|
64
|
+
/** Canonical settlement reference `chain_id:trx_id:action_ordinal:batch_id:window_id`. */
|
|
65
|
+
settlement_ref: string;
|
|
66
|
+
settlement: Settlement;
|
|
67
|
+
batch: Batch;
|
|
68
|
+
inclusion_proof: string[];
|
|
69
|
+
anti_replay: AntiReplay;
|
|
70
|
+
independence_result: string;
|
|
71
|
+
/** `SHA3-256(JCS(proof with proof_digest = ""))` (independence.proof/1 §10.11). */
|
|
72
|
+
proof_digest: string;
|
|
73
|
+
/** Optional, signed when present (independence.proof/1 §10.15). */
|
|
74
|
+
node_attestation?: NodeAttestation;
|
|
75
|
+
created_at?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Mandatory composite signature (ECDSA P-256 + ML-DSA-65) by the system-domain
|
|
78
|
+
* Level-1 capacity key over the JCS of the signed view
|
|
79
|
+
* (independence.proof/1 §10.13).
|
|
80
|
+
*/
|
|
81
|
+
signature: ProofSignature;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The proof signature object (independence.proof/1 §10.13): a composite
|
|
85
|
+
* (ECDSA P-256 + ML-DSA-65) over the JCS of the signed view.
|
|
86
|
+
*/
|
|
87
|
+
export interface ProofSignature {
|
|
88
|
+
signing_kid: string;
|
|
89
|
+
/** Composite profile id (`alg`), `mode`, and ordered `signatures[]` are
|
|
90
|
+
* flattened in at this level (see CompositeSignatureWire). */
|
|
91
|
+
alg: string;
|
|
92
|
+
mode: string;
|
|
93
|
+
signatures: ComponentSignature[];
|
|
94
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof.js","sourceRoot":"","sources":["../../../core/types/proof.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { BaseCertificate, VerificationPackage, SubjectMaterialMap } from "./artifacts.js";
|
|
2
|
+
import type { IndependenceProof } from "./proof.js";
|
|
3
|
+
import type { SettlementMaterial, CommitmentInclusionProof } from "./settlement-material.js";
|
|
4
|
+
import type { CapacityEvidence } from "./capacity-evidence.js";
|
|
5
|
+
import type { SystemFoundation } from "./foundation.js";
|
|
6
|
+
export type VerificationTargetRequested = "auto" | "issued" | "independent";
|
|
7
|
+
export type InputMode = "package" | "artifact_set";
|
|
8
|
+
export interface VerifierRequest {
|
|
9
|
+
verification_target_requested: VerificationTargetRequested;
|
|
10
|
+
input_mode: InputMode;
|
|
11
|
+
/** The `verification_package`, already parsed. Wins over `..._path`. */
|
|
12
|
+
verification_package?: VerificationPackage;
|
|
13
|
+
/** The signed base certificate, already parsed. Wins over `..._path`. */
|
|
14
|
+
base_certificate?: BaseCertificate;
|
|
15
|
+
/** The `independence_proof`, already parsed. Wins over `..._path`. */
|
|
16
|
+
independence_proof?: IndependenceProof;
|
|
17
|
+
/** Settlement material, already parsed. Wins over `..._path`. */
|
|
18
|
+
settlement_material?: SettlementMaterial;
|
|
19
|
+
/** Capacity evidence, already parsed. Wins over `..._path`. */
|
|
20
|
+
capacity_evidence?: CapacityEvidence;
|
|
21
|
+
/** Per-commitment inclusion proof, already parsed. Wins over `..._path`. */
|
|
22
|
+
commitment_inclusion_proof?: CommitmentInclusionProof;
|
|
23
|
+
/** System foundation, already parsed. Wins over `..._path`. */
|
|
24
|
+
system_foundation?: SystemFoundation;
|
|
25
|
+
/**
|
|
26
|
+
* Subject-material map: zero-based subject index → that subject's
|
|
27
|
+
* material — raw bytes, `{ leaves[] }` for a collection subject,
|
|
28
|
+
* `{ prehashed: true, subject_local_digest_hex }` for a streamed
|
|
29
|
+
* `subject.binary/1`, or `{ record, materials: Map<id, bytes|prehashed> }` for an AI-decision
|
|
30
|
+
* subject. Wins over `original_material_path`.
|
|
31
|
+
*
|
|
32
|
+
* The single-subject case is the common one, so a bare `Uint8Array` is
|
|
33
|
+
* accepted as shorthand for subject 0.
|
|
34
|
+
*/
|
|
35
|
+
original_material?: SubjectMaterialMap | Uint8Array;
|
|
36
|
+
verification_package_path?: string;
|
|
37
|
+
base_certificate_path?: string;
|
|
38
|
+
independence_proof_path?: string;
|
|
39
|
+
/** Accepted by the request schema; this toolkit reads none of these paths. */
|
|
40
|
+
supporting_artifact_paths?: string[];
|
|
41
|
+
original_material_path?: string;
|
|
42
|
+
/** Accepted by the request schema; this toolkit reads none of these paths. */
|
|
43
|
+
system_domain_artifact_paths?: string[];
|
|
44
|
+
/**
|
|
45
|
+
* Accepted by the request schema; this toolkit reads none of these paths. The
|
|
46
|
+
* rules a verification applies come from the profile, never from the request.
|
|
47
|
+
*/
|
|
48
|
+
rules_artifact_paths?: string[];
|
|
49
|
+
settlement_material_path?: string;
|
|
50
|
+
/** Zero-data capacity evidence. Required for `Independent`. */
|
|
51
|
+
capacity_evidence_path?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Per-commitment inclusion proof (`commitment → subtree_root`) for the
|
|
54
|
+
* certificate under verification (leaf=subtree, independence.proof/1).
|
|
55
|
+
* Required for `Independent`.
|
|
56
|
+
*/
|
|
57
|
+
commitment_inclusion_proof_path?: string;
|
|
58
|
+
system_foundation_path?: string;
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../core/types/request.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type { VerificationTargetRequested, InputMode } from "./request.js";
|
|
2
|
+
import type { NodeAttestation } from "./proof.js";
|
|
3
|
+
export type ResultCode = "ISSUED_VALID" | "ISSUED_INVALID" | "INDEPENDENT_VALID" | "INDEPENDENT_INVALID" | "INCOMPLETE" | "UNSUPPORTED" | "REJECTED";
|
|
4
|
+
export type ResolvedTarget = "Issued" | "Independent";
|
|
5
|
+
export type DiagnosticLevel = "info" | "warning" | "error";
|
|
6
|
+
export interface Diagnostic {
|
|
7
|
+
level: DiagnosticLevel;
|
|
8
|
+
message: string;
|
|
9
|
+
check_id?: string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface VerifierResult {
|
|
12
|
+
result_code: ResultCode;
|
|
13
|
+
verification_target_requested: VerificationTargetRequested;
|
|
14
|
+
verification_target_resolved: ResolvedTarget;
|
|
15
|
+
verification_target: ResolvedTarget;
|
|
16
|
+
input_mode: InputMode;
|
|
17
|
+
/**
|
|
18
|
+
* True only when the ENTIRE configuration equals the published production
|
|
19
|
+
* profile: the same system id, root fingerprint,
|
|
20
|
+
* XRPL chain id, MPT issuance, settlement account, token symbol, action name,
|
|
21
|
+
* signature profile, foundation statement id and payload digest, admitted
|
|
22
|
+
* subject profiles, settlement profile, supported rules versions and
|
|
23
|
+
* per-version corpus roots.
|
|
24
|
+
* False for any other configuration (a test domain, a synthetic root). Every
|
|
25
|
+
* signature is verified in both cases; a *_VALID result with this false says
|
|
26
|
+
* the artifacts verify under that other configuration, not under the
|
|
27
|
+
* production domain.
|
|
28
|
+
*
|
|
29
|
+
* It surfaces the regime that produced a result as a boolean a consumer
|
|
30
|
+
* cannot programmatically ignore, rather than only as a text diagnostic.
|
|
31
|
+
*/
|
|
32
|
+
production_verification: boolean;
|
|
33
|
+
domain_valid: boolean;
|
|
34
|
+
rules_domain_valid: boolean;
|
|
35
|
+
issued_valid: boolean;
|
|
36
|
+
independent_valid: boolean;
|
|
37
|
+
proof_complete: boolean;
|
|
38
|
+
complete_verification_against_original_material_performed: boolean;
|
|
39
|
+
complete_verification_against_original_material_passed: boolean;
|
|
40
|
+
failure_reason: string | null;
|
|
41
|
+
failed_check_ids: string[];
|
|
42
|
+
required_artifacts_missing: string[];
|
|
43
|
+
applicable_rules_version: string | null;
|
|
44
|
+
system_id: string | null;
|
|
45
|
+
system_root_identifier: string | null;
|
|
46
|
+
settlement_profile_id: string | null;
|
|
47
|
+
subtree_root: string | null;
|
|
48
|
+
settlement_ref: string | null;
|
|
49
|
+
batch_root: string | null;
|
|
50
|
+
batch_index: string | null;
|
|
51
|
+
batch_size: string | null;
|
|
52
|
+
foundation_profile_id: string | null;
|
|
53
|
+
foundation_statement_id: string | null;
|
|
54
|
+
foundation_publication_ref: string | null;
|
|
55
|
+
/**
|
|
56
|
+
* Per-subject scope of the verdict, in anchor order. Surfaces WHAT the verdict
|
|
57
|
+
* covers so a consumer cannot silently over-read it: a subject submitted as a
|
|
58
|
+
* single opaque input (`opaque: true` — e.g. `subject.binary/1`, an archive or
|
|
59
|
+
* blob) is bound as that one input, and the verdict asserts nothing about any
|
|
60
|
+
* elements contained within it. Coverage of multiple elements individually
|
|
61
|
+
* exists only where the issuer declared them (e.g. `subject.collection/1`,
|
|
62
|
+
* `opaque: false`). Proving a container is not proving its contents; this field
|
|
63
|
+
* makes an `INDEPENDENT_VALID` over an opaque subject distinguishable from one
|
|
64
|
+
* over a declared collection. Null until the base certificate is parsed.
|
|
65
|
+
*/
|
|
66
|
+
subject_scope: SubjectScope[] | null;
|
|
67
|
+
/**
|
|
68
|
+
* The node the proof attests (independence.proof/1 §10.15): the recognized
|
|
69
|
+
* node the submission entered through and the instant its recognition was
|
|
70
|
+
* checked, authenticated by the proof signature. Set only on
|
|
71
|
+
* `INDEPENDENT_VALID`; null otherwise and when the proof carries no
|
|
72
|
+
* attestation. It names a transport, not the issuer, and asserts nothing
|
|
73
|
+
* about the certified content.
|
|
74
|
+
*/
|
|
75
|
+
attested_node: NodeAttestation | null;
|
|
76
|
+
diagnostics: Diagnostic[];
|
|
77
|
+
certcrypt_lineage: CertcryptLineage;
|
|
78
|
+
additional_verifications: AdditionalVerifications;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The scope of the verdict for one subject, in anchor order. `profile` is the
|
|
82
|
+
* declared subject profile (`anchor.subjects[i].profile`, e.g. `subject.binary/1`,
|
|
83
|
+
* `subject.collection/1`). `opaque` is true when the subject is a single opaque
|
|
84
|
+
* input whose internal elements the proof does NOT cover — the verifier never
|
|
85
|
+
* looks inside it. A collection (`opaque: false`) declares its elements, so the
|
|
86
|
+
* verdict covers them at the declared resolution.
|
|
87
|
+
*/
|
|
88
|
+
export interface SubjectScope {
|
|
89
|
+
profile: string;
|
|
90
|
+
opaque: boolean;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Outcomes surfaced separately from the check list — currently the ML-DSA-65
|
|
94
|
+
* component of the base certificate's composite signature. The component itself
|
|
95
|
+
* is normative: it is verified inside BASE_CERTIFICATE_AUTHENTIC, and a
|
|
96
|
+
* certificate whose ML-DSA-65 half is absent, malformed or fails to verify does
|
|
97
|
+
* not pass that check (core/crypto/composite.ts `verifyComposite`, AND semantics;
|
|
98
|
+
* core/issued/verify-issued.ts). Nothing here alters result_code independently of
|
|
99
|
+
* the check it belongs to.
|
|
100
|
+
*/
|
|
101
|
+
export interface AdditionalVerifications {
|
|
102
|
+
pqc_base_certificate_authentic: PqcVerificationResult;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Outcome of the ML-DSA-65 component of the base certificate's composite
|
|
106
|
+
* signature, reported on its own. The component is mandatory (the post-quantum
|
|
107
|
+
* floor): its failure fails BASE_CERTIFICATE_AUTHENTIC. This field reports that
|
|
108
|
+
* outcome separately; it does not make the component optional, and it is not
|
|
109
|
+
* where the verdict is decided.
|
|
110
|
+
*/
|
|
111
|
+
export interface PqcVerificationResult {
|
|
112
|
+
/** True only if PQC verification was actually attempted. */
|
|
113
|
+
performed: boolean;
|
|
114
|
+
/** The PQC algorithm attempted. */
|
|
115
|
+
algorithm: "ML-DSA-65";
|
|
116
|
+
/** True if attempted and passed. False if attempted and failed. Null if not attempted. */
|
|
117
|
+
passed: boolean | null;
|
|
118
|
+
/** Reason for skip or failure. Null if performed and passed. */
|
|
119
|
+
reason: string | null;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Secondary visibility block — projects already-validated CERTCRYPT binding
|
|
123
|
+
* into a compact, consumer-readable form.
|
|
124
|
+
*
|
|
125
|
+
* This block does not introduce new verification logic.
|
|
126
|
+
* It does not add semantic overclaiming.
|
|
127
|
+
* Every boolean and identifier is derived from existing checks and fields.
|
|
128
|
+
*/
|
|
129
|
+
export interface CertcryptLineage {
|
|
130
|
+
/** True only if the verifier established exact CERTCRYPT system-domain binding. */
|
|
131
|
+
certcrypt_domain_bound: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* True only if the independence AXIS holds — every check
|
|
134
|
+
* INDEPENDENT_REQUIRED_CHECKS lists, on a run that resolved to the Independent
|
|
135
|
+
* target. A projection of `independent_valid`, so the two cannot disagree.
|
|
136
|
+
*
|
|
137
|
+
* Deliberately NOT `result_code === "INDEPENDENT_VALID"`: a failure OUTSIDE the
|
|
138
|
+
* axis (notably a partial original-material comparison, which §8.5.1 classifies
|
|
139
|
+
* INCOMPLETE) leaves independence intact and must not clear this.
|
|
140
|
+
*/
|
|
141
|
+
independence_under_certcrypt_rules: boolean;
|
|
142
|
+
/** True only if the verifier established the exact settlement-backed path. */
|
|
143
|
+
settlement_bound: boolean;
|
|
144
|
+
/** True only if the verifier established valid capacity-consumption binding. */
|
|
145
|
+
capacity_consumption_bound: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* True only if the result is structurally tied to the CERTCRYPT domain
|
|
148
|
+
* through settlement-backed independent verification.
|
|
149
|
+
*
|
|
150
|
+
* Conservative: false whenever any of the four bindings above is false — an
|
|
151
|
+
* unsupported profile, a domain mismatch, a missing settlement or a broken
|
|
152
|
+
* capacity binding all clear it. What does NOT clear it is an unfinished
|
|
153
|
+
* original-material comparison: that is completeness, not lineage.
|
|
154
|
+
*/
|
|
155
|
+
history_bound_under_certcrypt: boolean;
|
|
156
|
+
system_id: string | null;
|
|
157
|
+
rules_version: string | null;
|
|
158
|
+
system_root_fingerprint: string | null;
|
|
159
|
+
settlement_profile_id: string | null;
|
|
160
|
+
subtree_root: string | null;
|
|
161
|
+
settlement_ref: string | null;
|
|
162
|
+
foundation_profile_id: string | null;
|
|
163
|
+
foundation_statement_id: string | null;
|
|
164
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../../core/types/result.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export interface SettlementAction {
|
|
2
|
+
from: string;
|
|
3
|
+
quantity: string;
|
|
4
|
+
memo: string;
|
|
5
|
+
contract: string;
|
|
6
|
+
/** Action name the artifact declares. `payment` under
|
|
7
|
+
* settlement.aggregated.xrpl/1: paying an MPT back to its issuer destroys
|
|
8
|
+
* that amount, so there is no `to` account to name. */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Chain ID for settlement_ref resolution per rules-domain/1 */
|
|
11
|
+
chain_id: string;
|
|
12
|
+
/** Transaction ID */
|
|
13
|
+
trx_id: string;
|
|
14
|
+
/** Action ordinal within the transaction */
|
|
15
|
+
action_ordinal: string;
|
|
16
|
+
}
|
|
17
|
+
export interface FinalityProof {
|
|
18
|
+
block_num: string;
|
|
19
|
+
block_id: string;
|
|
20
|
+
last_irreversible_block_num: string;
|
|
21
|
+
last_irreversible_block_id: string;
|
|
22
|
+
/** Irreversible block time of the settlement, RFC 3339 UTC: the
|
|
23
|
+
* substrate's "when" for the capacity consumption — the verdict's time
|
|
24
|
+
* authority, NOT a CERTCRYPT seal. */
|
|
25
|
+
block_timestamp: string;
|
|
26
|
+
}
|
|
27
|
+
export interface BatchManifest {
|
|
28
|
+
batch_id: string;
|
|
29
|
+
window_id: string;
|
|
30
|
+
leaf_count: string;
|
|
31
|
+
total_quantity: string;
|
|
32
|
+
settlement_root: string;
|
|
33
|
+
system_id: string;
|
|
34
|
+
rules_version: string;
|
|
35
|
+
settlement_profile_id: string;
|
|
36
|
+
}
|
|
37
|
+
export interface CapacityConsumptionProof {
|
|
38
|
+
total_quantity: string;
|
|
39
|
+
leaf_quantity: string;
|
|
40
|
+
token_symbol: string;
|
|
41
|
+
token_contract: string;
|
|
42
|
+
}
|
|
43
|
+
export interface LeafPreimage {
|
|
44
|
+
v: "ccab1-leaf";
|
|
45
|
+
system_id: string;
|
|
46
|
+
rules_version: string;
|
|
47
|
+
settlement_profile_id: string;
|
|
48
|
+
batch_id: string;
|
|
49
|
+
leaf_index: string;
|
|
50
|
+
/**
|
|
51
|
+
* Leaf=subtree model: the Merkle root over the commitments accepted into
|
|
52
|
+
* this leaf.
|
|
53
|
+
*/
|
|
54
|
+
subtree_root: string;
|
|
55
|
+
cost_commitment: string;
|
|
56
|
+
consumed_quantity: string;
|
|
57
|
+
}
|
|
58
|
+
export interface BatchBindingPreimage {
|
|
59
|
+
v: "ccab1";
|
|
60
|
+
system_id: string;
|
|
61
|
+
rules_version: string;
|
|
62
|
+
settlement_profile_id: string;
|
|
63
|
+
batch_id: string;
|
|
64
|
+
window_id: string;
|
|
65
|
+
leaf_count: string;
|
|
66
|
+
total_quantity: string;
|
|
67
|
+
settlement_root: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Binds a leaf's `subtree_root` to its place in the batch tree (`subtree_root →
|
|
71
|
+
* settlement_root`). The first inclusion level (`commitment → subtree_root`) is
|
|
72
|
+
* carried per-commitment in `CommitmentInclusionProof`, not here — a leaf's
|
|
73
|
+
* settlement material covers the leaf as a whole, not any single commitment.
|
|
74
|
+
*/
|
|
75
|
+
export interface SubmissionAssignmentProof {
|
|
76
|
+
subtree_root: string;
|
|
77
|
+
leaf_index: string;
|
|
78
|
+
leaf_preimage: LeafPreimage;
|
|
79
|
+
leaf_hash: string;
|
|
80
|
+
sibling_hashes: string[];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* First level of the chained inclusion path: proves one commitment is a leaf of
|
|
84
|
+
* the sub-tree whose root is `subtree_root`. Per-commitment material (one per
|
|
85
|
+
* accepted commitment), delivered alongside the base certificate in the
|
|
86
|
+
* `verification_package` (independence.proof/1).
|
|
87
|
+
*/
|
|
88
|
+
export interface CommitmentInclusionProof {
|
|
89
|
+
commitment_id: string;
|
|
90
|
+
commitment_leaf_hash: string;
|
|
91
|
+
commitment_index: string;
|
|
92
|
+
commitment_siblings: string[];
|
|
93
|
+
subtree_size: string;
|
|
94
|
+
}
|
|
95
|
+
export interface AuthorizationBridgeProof {
|
|
96
|
+
/**
|
|
97
|
+
* SHA3-256 of the resolved Level-1 authorization's signing bytes — the same
|
|
98
|
+
* digest the capacity evidence's `level1_binding` recomputes to. Identifies
|
|
99
|
+
* the authorization without a correlating cleartext `issuer_scope`
|
|
100
|
+
* (zero-data); the verifier cross-checks it against the evidence.
|
|
101
|
+
*/
|
|
102
|
+
resolved_authorization_digest: string;
|
|
103
|
+
cost_commitment: string;
|
|
104
|
+
consumed_quantity: string;
|
|
105
|
+
batch_binding_preimage: BatchBindingPreimage;
|
|
106
|
+
}
|
|
107
|
+
export interface CoherenceMaterial {
|
|
108
|
+
system_id: string;
|
|
109
|
+
rules_version: string;
|
|
110
|
+
settlement_profile_id: string;
|
|
111
|
+
}
|
|
112
|
+
export interface SettlementMaterial {
|
|
113
|
+
settlement_profile_id: string;
|
|
114
|
+
settlement_action: SettlementAction;
|
|
115
|
+
finality_proof: FinalityProof;
|
|
116
|
+
batch_manifest: BatchManifest;
|
|
117
|
+
capacity_consumption_proof: CapacityConsumptionProof;
|
|
118
|
+
/** Leaf=subtree model: leaf bound to `subtree_root`. */
|
|
119
|
+
submission_assignment_proof?: SubmissionAssignmentProof;
|
|
120
|
+
/**
|
|
121
|
+
* One authorization-bridge per DISTINCT resolved authorization present in the
|
|
122
|
+
* leaf (settlement-material/1 §9). A leaf may group commitments under different Level-1
|
|
123
|
+
* authorizations; the verifier selects the bridge whose
|
|
124
|
+
* `resolved_authorization_digest` matches the evidence it is verifying, so every
|
|
125
|
+
* accepted commitment can reconstruct its own authorization. All entries share
|
|
126
|
+
* one `batch_binding_preimage` (the memo is batch-level, one per settlement).
|
|
127
|
+
*/
|
|
128
|
+
authorization_bridge_proofs: AuthorizationBridgeProof[];
|
|
129
|
+
coherence_material: CoherenceMaterial;
|
|
130
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settlement-material.js","sourceRoot":"","sources":["../../../core/types/settlement-material.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node entry point — `verify()` with the `node:crypto` backend installed.
|
|
3
|
+
*
|
|
4
|
+
* This is the entry the CLI, the unit tests and the conformance harness use. The
|
|
5
|
+
* import below is for side effect: it registers the Node backend before any
|
|
6
|
+
* verification runs.
|
|
7
|
+
*
|
|
8
|
+
* Browsers import `@certcrypt/verifier-toolkit/web` (the package root resolves
|
|
9
|
+
* to it under the `browser` condition) and never pull `node:crypto` into the
|
|
10
|
+
* bundle.
|
|
11
|
+
*/
|
|
12
|
+
import "./crypto/provider/register-node.js";
|
|
13
|
+
import "./input/register-node-fs.js";
|
|
14
|
+
export * from "./public-api.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node entry point — `verify()` with the `node:crypto` backend installed.
|
|
3
|
+
*
|
|
4
|
+
* This is the entry the CLI, the unit tests and the conformance harness use. The
|
|
5
|
+
* import below is for side effect: it registers the Node backend before any
|
|
6
|
+
* verification runs.
|
|
7
|
+
*
|
|
8
|
+
* Browsers import `@certcrypt/verifier-toolkit/web` (the package root resolves
|
|
9
|
+
* to it under the `browser` condition) and never pull `node:crypto` into the
|
|
10
|
+
* bundle.
|
|
11
|
+
*/
|
|
12
|
+
import "./crypto/provider/register-node.js";
|
|
13
|
+
import "./input/register-node-fs.js";
|
|
14
|
+
// The same public surface as the browser entry — code written against one runs
|
|
15
|
+
// on the other unchanged.
|
|
16
|
+
export * from "./public-api.js";
|
|
17
|
+
//# sourceMappingURL=verify-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-node.js","sourceRoot":"","sources":["../../core/verify-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,oCAAoC,CAAC;AAC5C,OAAO,6BAA6B,CAAC;AAErC,+EAA+E;AAC/E,0BAA0B;AAC1B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./public-api.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser entry point — `verify()` with the @noble backend.
|
|
3
|
+
*
|
|
4
|
+
* Import this from a browser bundle. Nothing reachable from here imports
|
|
5
|
+
* `node:crypto` or `node:fs`, so no aliasing, polyfilling or `externals` config
|
|
6
|
+
* is needed: the module graph simply never contains a Node built-in.
|
|
7
|
+
*
|
|
8
|
+
* Artifacts must be supplied IN MEMORY (`base_certificate`, `independence_proof`,
|
|
9
|
+
* `original_material`, …) rather than by path — `VerifierRequest` accepts both
|
|
10
|
+
* forms, and the in-memory value wins. The `*_path` fields are Node-only and
|
|
11
|
+
* unreachable here.
|
|
12
|
+
*
|
|
13
|
+
* Why a browser build exists at all: computing an artifact's commitment requires
|
|
14
|
+
* the ORIGINAL MATERIAL. Uploading that to a server would transmit exactly the
|
|
15
|
+
* private content the protocol is designed never to require — so the verifier
|
|
16
|
+
* runs where the material already is, and the material never leaves the machine.
|
|
17
|
+
*/
|
|
18
|
+
import { setCryptoProvider, webProvider } from "./crypto/provider/index.js";
|
|
19
|
+
// Explicit rather than implicit: a bundler that somehow did include the Node
|
|
20
|
+
// entry would otherwise leave the Node backend registered and win the default.
|
|
21
|
+
setCryptoProvider(webProvider);
|
|
22
|
+
// The same public surface as the Node entry — code written against one runs on
|
|
23
|
+
// the other unchanged.
|
|
24
|
+
export * from "./public-api.js";
|
|
25
|
+
//# sourceMappingURL=verify-web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-web.js","sourceRoot":"","sources":["../../core/verify-web.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE5E,6EAA6E;AAC7E,+EAA+E;AAC/E,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAE/B,+EAA+E;AAC/E,uBAAuB;AACvB,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { VerifierRequest, VerifierResult, SystemDomainConfig } from "./types/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Main verification entry point.
|
|
4
|
+
*
|
|
5
|
+
* @param request The verification request
|
|
6
|
+
* @param configOverride Optional config override (test-only). When omitted,
|
|
7
|
+
* uses getCertcryptConfig(), the published production profile.
|
|
8
|
+
*
|
|
9
|
+
* Per verifier-toolkit/1:
|
|
10
|
+
* 1. Validate input
|
|
11
|
+
* 2. Resolve target
|
|
12
|
+
* 3. Validate foundation (if present) — derive system_root_fingerprint
|
|
13
|
+
* 4. Validate package (if package mode)
|
|
14
|
+
* 5. Run Issued checks (always — per section 11.2 step 3)
|
|
15
|
+
* 6. Run Independent checks (if target is Independent)
|
|
16
|
+
* 7. Build and return result
|
|
17
|
+
*/
|
|
18
|
+
export declare function verify(request: VerifierRequest, configOverride?: SystemDomainConfig): VerifierResult;
|