@agledger/verify-core 2.1.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -18
- package/README.md +869 -53
- package/dist/acknowledgements.d.ts +32 -0
- package/dist/acknowledgements.js +88 -0
- package/dist/anchors.d.ts +349 -0
- package/dist/anchors.js +654 -0
- package/dist/attestation.d.ts +98 -0
- package/dist/attestation.js +145 -0
- package/dist/audit-export.d.ts +404 -29
- package/dist/audit-export.js +547 -28
- package/dist/batch-head.d.ts +28 -0
- package/dist/batch-head.js +169 -0
- package/dist/batch.d.ts +69 -0
- package/dist/batch.js +99 -0
- package/dist/bulk-export.d.ts +161 -0
- package/dist/bulk-export.js +711 -0
- package/dist/cbor-strict.d.ts +9 -0
- package/dist/cbor-strict.js +14 -0
- package/dist/chain.d.ts +221 -31
- package/dist/chain.js +339 -65
- package/dist/claim.d.ts +23 -0
- package/dist/claim.js +100 -0
- package/dist/export-anchors.d.ts +84 -0
- package/dist/export-anchors.js +109 -0
- package/dist/export-evidence.d.ts +90 -0
- package/dist/export-evidence.js +186 -0
- package/dist/export-pages.d.ts +476 -0
- package/dist/export-pages.js +586 -0
- package/dist/failures.d.ts +44 -26
- package/dist/failures.js +81 -31
- package/dist/federation-wire.d.ts +106 -20
- package/dist/federation-wire.js +286 -76
- package/dist/history-seal.d.ts +100 -0
- package/dist/history-seal.js +301 -0
- package/dist/index.d.ts +37 -9
- package/dist/index.js +18 -5
- package/dist/instant.d.ts +1 -1
- package/dist/instant.js +1 -1
- package/dist/key-statements.d.ts +160 -11
- package/dist/key-statements.js +261 -60
- package/dist/ml-dsa-kats.d.ts +18 -0
- package/dist/ml-dsa-kats.js +241 -0
- package/dist/options.js +4 -4
- package/dist/primitives.d.ts +287 -47
- package/dist/primitives.js +673 -101
- package/dist/read-log.d.ts +350 -0
- package/dist/read-log.js +816 -0
- package/dist/schema-chain-export.d.ts +82 -0
- package/dist/schema-chain-export.js +474 -0
- package/dist/walk-anchors.d.ts +115 -0
- package/dist/walk-anchors.js +133 -0
- package/dist/walk-checkpoints.d.ts +125 -0
- package/dist/walk-checkpoints.js +118 -0
- package/package.json +9 -5
package/dist/failures.d.ts
CHANGED
|
@@ -8,81 +8,99 @@
|
|
|
8
8
|
*
|
|
9
9
|
* CHAIN_* per-record (and per-org schema-event) hash-chain entry checks
|
|
10
10
|
* CHECKPOINT_* vault checkpoint cross-check against the live chain
|
|
11
|
-
* TENANT_* org_admin_reads Merkle log + signed tree heads
|
|
11
|
+
* TENANT_* org_admin_reads Merkle log + signed tree heads, their
|
|
12
|
+
* inclusion proofs and witness co-signatures
|
|
12
13
|
* KEY_* the vault key statements themselves (the key registry)
|
|
14
|
+
* BATCH_* entries signed through a batch head (the batched cadence);
|
|
15
|
+
* Server mirrors of `batch_unattested`, `batch_leaf_mismatch`
|
|
16
|
+
* and `batch_head_invalid`
|
|
17
|
+
* HISTORY_* what classical keys signed, held to the history seal an
|
|
18
|
+
* ML-DSA key signed at their retirement
|
|
19
|
+
* EXPORT_* the pages of a cross-record export walk, held to each other,
|
|
20
|
+
* and the read time an export or a page states, held to the
|
|
21
|
+
* signed times of what it holds
|
|
13
22
|
* <bare> input/format-level failures that precede any chain walk
|
|
14
23
|
*
|
|
15
24
|
* Every code carries an actionable next step (`suggestion`) so a result is a
|
|
16
25
|
* directive, not just a verdict.
|
|
17
26
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* integrity check: the signed payload's STRUCTURE
|
|
25
|
-
* no longer matches the canonical projection of the
|
|
26
|
-
* row columns it is bound to. AGLedger never
|
|
27
|
-
* inspects deliverable content.)
|
|
28
|
-
* - CHAIN_SIGNATURE_MISSING_KEY stays for "no key available for this id"; the
|
|
27
|
+
* Codes whose meaning is easy to misread:
|
|
28
|
+
* - CHAIN_PAYLOAD_BINDING_MISMATCH a binding-integrity check: the signed
|
|
29
|
+
* payload's STRUCTURE no longer matches the
|
|
30
|
+
* canonical projection of the row columns it is
|
|
31
|
+
* bound to.
|
|
32
|
+
* - CHAIN_SIGNATURE_MISSING_KEY means "no key available for this id"; the
|
|
29
33
|
* caller-policy case (requireKeyId / out-of-band-
|
|
30
34
|
* only) splits out to CHAIN_KEY_POLICY_VIOLATION so
|
|
31
35
|
* a retired/wrong-key policy hit is alertable apart
|
|
32
36
|
* from a benign missing key.
|
|
33
|
-
* - CHAIN_KEY_EXPIRED
|
|
37
|
+
* - CHAIN_KEY_EXPIRED temporal key-validity: entry written after the
|
|
34
38
|
* signing key's retired_at, or after its
|
|
35
39
|
* distrustedKeys cutoff.
|
|
36
40
|
* - CHAIN_KEY_NOT_YET_ACTIVE entry written before the key's activated_at.
|
|
37
41
|
* Split from CHAIN_KEY_EXPIRED so a consumer is
|
|
38
42
|
* not told "expired" about a key that had not
|
|
39
43
|
* started yet.
|
|
40
|
-
* - CHAIN_EMPTY
|
|
44
|
+
* - CHAIN_EMPTY a chain/vault with nothing to verify is a non-clean
|
|
41
45
|
* verdict, never a silent pass.
|
|
42
46
|
*
|
|
43
|
-
*
|
|
44
|
-
* - CHAIN_ENTRY_UNSIGNED
|
|
47
|
+
* Codes that mirror a Server-side check:
|
|
48
|
+
* - CHAIN_ENTRY_UNSIGNED Server mirror of `signature_missing`: an entry with
|
|
45
49
|
* no signing key id after a signed entry in its
|
|
46
50
|
* chain, or written at or after the earliest
|
|
47
51
|
* activatedAt in the key set. Earlier unsigned
|
|
48
52
|
* entries stay reduced coverage.
|
|
49
|
-
* - CHECKPOINT_UNSIGNED
|
|
53
|
+
* - CHECKPOINT_UNSIGNED Server mirror of `checkpoint_unsigned`: the same
|
|
50
54
|
* instant, applied to an unsigned checkpoint.
|
|
51
55
|
* - TENANT_READ_LEAF_UNSIGNED and TENANT_CHECKPOINT_UNSIGNED the same two
|
|
52
|
-
* rules on the org_admin_reads log (
|
|
56
|
+
* rules on the org_admin_reads log (Server
|
|
53
57
|
* `leaf_signature_missing`, `checkpoint_unsigned`).
|
|
54
|
-
* - CHAIN_SIGNING_KEY_UNANCHORED
|
|
58
|
+
* - CHAIN_SIGNING_KEY_UNANCHORED Server mirror of `signing_key_unanchored`:
|
|
55
59
|
* the entry's key is not linked by signed key
|
|
56
60
|
* statements to a pinned trust anchor. With
|
|
57
61
|
* CHECKPOINT_KEY_UNANCHORED,
|
|
58
62
|
* TENANT_READ_KEY_UNANCHORED and
|
|
59
63
|
* TENANT_CHECKPOINT_KEY_UNANCHORED for the
|
|
60
|
-
*
|
|
64
|
+
* Server's `checkpoint_key_unanchored` and
|
|
61
65
|
* `leaf_key_unanchored`.
|
|
66
|
+
* - CHECKPOINT_KEY_NOT_YET_ACTIVE, CHECKPOINT_KEY_EXPIRED, and the
|
|
67
|
+
* TENANT_READ_KEY_* and TENANT_CHECKPOINT_KEY_* pairs Server mirror of
|
|
68
|
+
* `checkpoint_key_not_yet_active`,
|
|
69
|
+
* `checkpoint_key_expired`, `leaf_key_not_yet_active`
|
|
70
|
+
* and `leaf_key_expired`: a vault checkpoint, a
|
|
71
|
+
* read-log leaf or a read-log tree head written
|
|
72
|
+
* outside its signing key's signed window, by
|
|
73
|
+
* the rule CHAIN_KEY_NOT_YET_ACTIVE and
|
|
74
|
+
* CHAIN_KEY_EXPIRED apply to entries.
|
|
75
|
+
* - CHECKPOINT_ACCOUNTED_ONLY, CHECKPOINT_ACCOUNTED_RUN_EXCEEDED Server mirror
|
|
76
|
+
* of `accounted_checkpoint_only` and
|
|
77
|
+
* `checkpoint_accounted_run_exceeded`: what a
|
|
78
|
+
* chain is left with when the checkpoints a
|
|
79
|
+
* distrustedKeys entry accounts for are set aside.
|
|
62
80
|
* - KEY_STATEMENT_INVALID, KEY_CLOSURE_INVALID, CHAIN_KEY_WINDOW_DRIFT
|
|
63
|
-
*
|
|
81
|
+
* Server mirrors of the key registry findings
|
|
64
82
|
* `key_statement_invalid`, `key_closure_invalid`
|
|
65
83
|
* and `key_window_drift`. They are about the
|
|
66
84
|
* registry, not about any one entry.
|
|
67
85
|
* - CHECKPOINT_CLAIM_MISMATCH, TENANT_READ_CLAIM_MISMATCH,
|
|
68
|
-
* TENANT_CHECKPOINT_CLAIM_MISMATCH
|
|
86
|
+
* TENANT_CHECKPOINT_CLAIM_MISMATCH Server mirrors of the vault's
|
|
69
87
|
* `checkpoint_claim_mismatch` and the read log's
|
|
70
88
|
* `leaf_claim_mismatch` and
|
|
71
89
|
* `checkpoint_claim_mismatch`: the claim signed
|
|
72
90
|
* inside the envelope does not decode, or says
|
|
73
91
|
* something the row's columns do not.
|
|
74
92
|
*
|
|
75
|
-
* Server-side cert re-checks are not mirrored here. The
|
|
93
|
+
* Server-side cert re-checks are not mirrored here. The Server's chain
|
|
76
94
|
* verification also reports `cert_missing`, `cert_actor_drift`,
|
|
77
95
|
* `cert_window_drift`, `cert_expired` and `agent_signature_invalid`, by
|
|
78
96
|
* comparing what an entry sealed in `predicate.on_behalf_of.cert` against the
|
|
79
|
-
*
|
|
80
|
-
*
|
|
97
|
+
* Server's cert record. Neither the export nor the dump carries that
|
|
98
|
+
* record, so an offline verifier cannot reproduce those comparisons, and it
|
|
81
99
|
* does not need to: it trusts only the signed bytes, which already fix the
|
|
82
100
|
* sealed cert id, thumbprint and expiry. The one cert-related check that can
|
|
83
101
|
* run offline is the agent signature, and only when the caller supplies the
|
|
84
102
|
* cert's public key (CHAIN_AGENT_SIGNATURE_INVALID below).
|
|
85
103
|
*/
|
|
86
|
-
export type FailureCode = 'UNSUPPORTED_FORMAT' | 'CHAIN_EMPTY' | 'CHAIN_POSITION_GAP' | 'CHAIN_GENESIS_INVALID' | 'CHAIN_LINK_BROKEN' | 'CHAIN_HASH_MISMATCH' | 'CHAIN_MALFORMED_ENTRY' | 'CHAIN_COSE_DECODE_FAILED' | 'CHAIN_COSE_HEADER_MISMATCH' | 'CHAIN_PAYLOAD_BINDING_MISMATCH' | 'CHAIN_OIDC_ACTOR_MISMATCH' | 'CHAIN_SIGNATURE_INVALID' | 'CHAIN_SIGNATURE_MISSING_KEY' | 'CHAIN_KEY_POLICY_VIOLATION' | 'CHAIN_KEY_EXPIRED' | 'CHAIN_KEY_NOT_YET_ACTIVE' | 'CHAIN_ALG_MISMATCH' | 'CHAIN_UNSUPPORTED_ALGORITHM' | 'CHAIN_SIGNING_KEY_DRIFT' | 'CHAIN_ACTOR_ATTRIBUTION_MISMATCH' | 'CHAIN_AGENT_SIGNATURE_INVALID' | 'CHAIN_FEDERATION_WIRE_INVALID' | 'CHAIN_EVIDENCE_BINDING_MISMATCH' | 'CHAIN_ENTRY_UNSIGNED' | 'CHAIN_SIGNING_KEY_UNANCHORED' | 'CHAIN_KEY_WINDOW_DRIFT' | 'CHECKPOINT_ROW_MISSING' | 'CHECKPOINT_HASH_MISMATCH' | 'CHECKPOINT_SIGNATURE_INVALID' | 'CHECKPOINT_UNSIGNED' | 'CHECKPOINT_KEY_UNANCHORED' | 'CHECKPOINT_CLAIM_MISMATCH' | 'TENANT_READ_LEAF_HASH_MISMATCH' | 'TENANT_READ_LEAF_INDEX_GAP' | 'TENANT_READ_SIGNATURE_INVALID' | 'TENANT_READ_LEAF_UNSIGNED' | 'TENANT_READ_KEY_UNANCHORED' | 'TENANT_READ_CLAIM_MISMATCH' | 'TENANT_CHECKPOINT_LEAF_COUNT_MISMATCH' | 'TENANT_CHECKPOINT_ROOT_MISMATCH' | 'TENANT_CHECKPOINT_SIGNATURE_INVALID' | 'TENANT_CHECKPOINT_UNSIGNED' | 'TENANT_CHECKPOINT_KEY_UNANCHORED' | 'TENANT_CHECKPOINT_CLAIM_MISMATCH' | 'TENANT_CHECKPOINT_FORK' | 'KEY_STATEMENT_INVALID' | 'KEY_CLOSURE_INVALID';
|
|
104
|
+
export type FailureCode = 'UNSUPPORTED_FORMAT' | 'EXPORT_PAGE_CONFLICT' | 'EXPORT_READ_TIME_INVALID' | 'CHAIN_EMPTY' | 'CHAIN_POSITION_GAP' | 'CHAIN_GENESIS_INVALID' | 'CHAIN_LINK_BROKEN' | 'CHAIN_HASH_MISMATCH' | 'CHAIN_MALFORMED_ENTRY' | 'CHAIN_COSE_DECODE_FAILED' | 'CHAIN_COSE_HEADER_MISMATCH' | 'CHAIN_PAYLOAD_BINDING_MISMATCH' | 'CHAIN_OIDC_ACTOR_MISMATCH' | 'CHAIN_SIGNATURE_INVALID' | 'CHAIN_SIGNATURE_MISSING_KEY' | 'CHAIN_KEY_POLICY_VIOLATION' | 'CHAIN_KEY_EXPIRED' | 'CHAIN_KEY_NOT_YET_ACTIVE' | 'CHAIN_ALG_MISMATCH' | 'CHAIN_UNSUPPORTED_ALGORITHM' | 'CHAIN_SIGNING_KEY_DRIFT' | 'CHAIN_ACTOR_ATTRIBUTION_MISMATCH' | 'CHAIN_AGENT_SIGNATURE_INVALID' | 'CHAIN_FEDERATION_WIRE_INVALID' | 'CHAIN_EVIDENCE_BINDING_MISMATCH' | 'CHAIN_ENTRY_UNSIGNED' | 'CHAIN_SIGNING_KEY_UNANCHORED' | 'CHAIN_KEY_WINDOW_DRIFT' | 'CHECKPOINT_ROW_MISSING' | 'CHECKPOINT_HASH_MISMATCH' | 'CHECKPOINT_SIGNATURE_INVALID' | 'CHECKPOINT_UNSIGNED' | 'CHECKPOINT_KEY_UNANCHORED' | 'CHECKPOINT_CLAIM_MISMATCH' | 'CHECKPOINT_KEY_NOT_YET_ACTIVE' | 'CHECKPOINT_KEY_EXPIRED' | 'CHECKPOINT_ACCOUNTED_ONLY' | 'CHECKPOINT_ACCOUNTED_RUN_EXCEEDED' | 'CHECKPOINT_COVERAGE_MISMATCH' | 'ANCHOR_CHAIN_CUT' | 'ANCHOR_CHAIN_REWRITTEN' | 'ANCHOR_FORK' | 'REWIND_ACKNOWLEDGEMENT_INVALID' | 'CONTENT_BINDING_MALFORMED' | 'CONTENT_HASH_MISMATCH' | 'CONTENT_FIELD_DRIFT' | 'CONTENT_ROW_UNSIGNED' | 'RECEIPT_INVALID' | 'BATCH_UNATTESTED' | 'BATCH_LEAF_MISMATCH' | 'BATCH_HEAD_INVALID' | 'FEDERATION_SIGNATURE_INVALID' | 'FEDERATION_KEY_HISTORY_INVALID' | 'HISTORY_SEAL_INVALID' | 'HISTORY_SEAL_EXCEEDED' | 'HISTORY_SEAL_MISSING_CHAIN' | 'CHAIN_ISSUER_CHANGE_UNEXPLAINED' | 'TENANT_READ_LEAF_HASH_MISMATCH' | 'TENANT_READ_LEAF_INDEX_GAP' | 'TENANT_READ_SIGNATURE_INVALID' | 'TENANT_READ_LEAF_UNSIGNED' | 'TENANT_READ_KEY_UNANCHORED' | 'TENANT_READ_CLAIM_MISMATCH' | 'TENANT_READ_OIDC_MISMATCH' | 'TENANT_READ_KEY_NOT_YET_ACTIVE' | 'TENANT_READ_KEY_EXPIRED' | 'TENANT_CHECKPOINT_LEAF_COUNT_MISMATCH' | 'TENANT_CHECKPOINT_ROOT_MISMATCH' | 'TENANT_CHECKPOINT_SIGNATURE_INVALID' | 'TENANT_CHECKPOINT_UNSIGNED' | 'TENANT_CHECKPOINT_KEY_UNANCHORED' | 'TENANT_CHECKPOINT_CLAIM_MISMATCH' | 'TENANT_CHECKPOINT_KEY_NOT_YET_ACTIVE' | 'TENANT_CHECKPOINT_KEY_EXPIRED' | 'TENANT_CHECKPOINT_FORK' | 'TENANT_CHECKPOINT_COSIGNATURE_INVALID' | 'TENANT_READ_PROOF_INVALID' | 'KEY_STATEMENT_INVALID' | 'KEY_CLOSURE_INVALID';
|
|
87
105
|
/** The actionable next step for a failure code. */
|
|
88
106
|
export declare function suggestion(code: FailureCode): string;
|
package/dist/failures.js
CHANGED
|
@@ -8,76 +8,94 @@
|
|
|
8
8
|
*
|
|
9
9
|
* CHAIN_* per-record (and per-org schema-event) hash-chain entry checks
|
|
10
10
|
* CHECKPOINT_* vault checkpoint cross-check against the live chain
|
|
11
|
-
* TENANT_* org_admin_reads Merkle log + signed tree heads
|
|
11
|
+
* TENANT_* org_admin_reads Merkle log + signed tree heads, their
|
|
12
|
+
* inclusion proofs and witness co-signatures
|
|
12
13
|
* KEY_* the vault key statements themselves (the key registry)
|
|
14
|
+
* BATCH_* entries signed through a batch head (the batched cadence);
|
|
15
|
+
* Server mirrors of `batch_unattested`, `batch_leaf_mismatch`
|
|
16
|
+
* and `batch_head_invalid`
|
|
17
|
+
* HISTORY_* what classical keys signed, held to the history seal an
|
|
18
|
+
* ML-DSA key signed at their retirement
|
|
19
|
+
* EXPORT_* the pages of a cross-record export walk, held to each other,
|
|
20
|
+
* and the read time an export or a page states, held to the
|
|
21
|
+
* signed times of what it holds
|
|
13
22
|
* <bare> input/format-level failures that precede any chain walk
|
|
14
23
|
*
|
|
15
24
|
* Every code carries an actionable next step (`suggestion`) so a result is a
|
|
16
25
|
* directive, not just a verdict.
|
|
17
26
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* integrity check: the signed payload's STRUCTURE
|
|
25
|
-
* no longer matches the canonical projection of the
|
|
26
|
-
* row columns it is bound to. AGLedger never
|
|
27
|
-
* inspects deliverable content.)
|
|
28
|
-
* - CHAIN_SIGNATURE_MISSING_KEY stays for "no key available for this id"; the
|
|
27
|
+
* Codes whose meaning is easy to misread:
|
|
28
|
+
* - CHAIN_PAYLOAD_BINDING_MISMATCH a binding-integrity check: the signed
|
|
29
|
+
* payload's STRUCTURE no longer matches the
|
|
30
|
+
* canonical projection of the row columns it is
|
|
31
|
+
* bound to.
|
|
32
|
+
* - CHAIN_SIGNATURE_MISSING_KEY means "no key available for this id"; the
|
|
29
33
|
* caller-policy case (requireKeyId / out-of-band-
|
|
30
34
|
* only) splits out to CHAIN_KEY_POLICY_VIOLATION so
|
|
31
35
|
* a retired/wrong-key policy hit is alertable apart
|
|
32
36
|
* from a benign missing key.
|
|
33
|
-
* - CHAIN_KEY_EXPIRED
|
|
37
|
+
* - CHAIN_KEY_EXPIRED temporal key-validity: entry written after the
|
|
34
38
|
* signing key's retired_at, or after its
|
|
35
39
|
* distrustedKeys cutoff.
|
|
36
40
|
* - CHAIN_KEY_NOT_YET_ACTIVE entry written before the key's activated_at.
|
|
37
41
|
* Split from CHAIN_KEY_EXPIRED so a consumer is
|
|
38
42
|
* not told "expired" about a key that had not
|
|
39
43
|
* started yet.
|
|
40
|
-
* - CHAIN_EMPTY
|
|
44
|
+
* - CHAIN_EMPTY a chain/vault with nothing to verify is a non-clean
|
|
41
45
|
* verdict, never a silent pass.
|
|
42
46
|
*
|
|
43
|
-
*
|
|
44
|
-
* - CHAIN_ENTRY_UNSIGNED
|
|
47
|
+
* Codes that mirror a Server-side check:
|
|
48
|
+
* - CHAIN_ENTRY_UNSIGNED Server mirror of `signature_missing`: an entry with
|
|
45
49
|
* no signing key id after a signed entry in its
|
|
46
50
|
* chain, or written at or after the earliest
|
|
47
51
|
* activatedAt in the key set. Earlier unsigned
|
|
48
52
|
* entries stay reduced coverage.
|
|
49
|
-
* - CHECKPOINT_UNSIGNED
|
|
53
|
+
* - CHECKPOINT_UNSIGNED Server mirror of `checkpoint_unsigned`: the same
|
|
50
54
|
* instant, applied to an unsigned checkpoint.
|
|
51
55
|
* - TENANT_READ_LEAF_UNSIGNED and TENANT_CHECKPOINT_UNSIGNED the same two
|
|
52
|
-
* rules on the org_admin_reads log (
|
|
56
|
+
* rules on the org_admin_reads log (Server
|
|
53
57
|
* `leaf_signature_missing`, `checkpoint_unsigned`).
|
|
54
|
-
* - CHAIN_SIGNING_KEY_UNANCHORED
|
|
58
|
+
* - CHAIN_SIGNING_KEY_UNANCHORED Server mirror of `signing_key_unanchored`:
|
|
55
59
|
* the entry's key is not linked by signed key
|
|
56
60
|
* statements to a pinned trust anchor. With
|
|
57
61
|
* CHECKPOINT_KEY_UNANCHORED,
|
|
58
62
|
* TENANT_READ_KEY_UNANCHORED and
|
|
59
63
|
* TENANT_CHECKPOINT_KEY_UNANCHORED for the
|
|
60
|
-
*
|
|
64
|
+
* Server's `checkpoint_key_unanchored` and
|
|
61
65
|
* `leaf_key_unanchored`.
|
|
66
|
+
* - CHECKPOINT_KEY_NOT_YET_ACTIVE, CHECKPOINT_KEY_EXPIRED, and the
|
|
67
|
+
* TENANT_READ_KEY_* and TENANT_CHECKPOINT_KEY_* pairs Server mirror of
|
|
68
|
+
* `checkpoint_key_not_yet_active`,
|
|
69
|
+
* `checkpoint_key_expired`, `leaf_key_not_yet_active`
|
|
70
|
+
* and `leaf_key_expired`: a vault checkpoint, a
|
|
71
|
+
* read-log leaf or a read-log tree head written
|
|
72
|
+
* outside its signing key's signed window, by
|
|
73
|
+
* the rule CHAIN_KEY_NOT_YET_ACTIVE and
|
|
74
|
+
* CHAIN_KEY_EXPIRED apply to entries.
|
|
75
|
+
* - CHECKPOINT_ACCOUNTED_ONLY, CHECKPOINT_ACCOUNTED_RUN_EXCEEDED Server mirror
|
|
76
|
+
* of `accounted_checkpoint_only` and
|
|
77
|
+
* `checkpoint_accounted_run_exceeded`: what a
|
|
78
|
+
* chain is left with when the checkpoints a
|
|
79
|
+
* distrustedKeys entry accounts for are set aside.
|
|
62
80
|
* - KEY_STATEMENT_INVALID, KEY_CLOSURE_INVALID, CHAIN_KEY_WINDOW_DRIFT
|
|
63
|
-
*
|
|
81
|
+
* Server mirrors of the key registry findings
|
|
64
82
|
* `key_statement_invalid`, `key_closure_invalid`
|
|
65
83
|
* and `key_window_drift`. They are about the
|
|
66
84
|
* registry, not about any one entry.
|
|
67
85
|
* - CHECKPOINT_CLAIM_MISMATCH, TENANT_READ_CLAIM_MISMATCH,
|
|
68
|
-
* TENANT_CHECKPOINT_CLAIM_MISMATCH
|
|
86
|
+
* TENANT_CHECKPOINT_CLAIM_MISMATCH Server mirrors of the vault's
|
|
69
87
|
* `checkpoint_claim_mismatch` and the read log's
|
|
70
88
|
* `leaf_claim_mismatch` and
|
|
71
89
|
* `checkpoint_claim_mismatch`: the claim signed
|
|
72
90
|
* inside the envelope does not decode, or says
|
|
73
91
|
* something the row's columns do not.
|
|
74
92
|
*
|
|
75
|
-
* Server-side cert re-checks are not mirrored here. The
|
|
93
|
+
* Server-side cert re-checks are not mirrored here. The Server's chain
|
|
76
94
|
* verification also reports `cert_missing`, `cert_actor_drift`,
|
|
77
95
|
* `cert_window_drift`, `cert_expired` and `agent_signature_invalid`, by
|
|
78
96
|
* comparing what an entry sealed in `predicate.on_behalf_of.cert` against the
|
|
79
|
-
*
|
|
80
|
-
*
|
|
97
|
+
* Server's cert record. Neither the export nor the dump carries that
|
|
98
|
+
* record, so an offline verifier cannot reproduce those comparisons, and it
|
|
81
99
|
* does not need to: it trusts only the signed bytes, which already fix the
|
|
82
100
|
* sealed cert id, thumbprint and expiry. The one cert-related check that can
|
|
83
101
|
* run offline is the agent signature, and only when the caller supplies the
|
|
@@ -88,13 +106,15 @@
|
|
|
88
106
|
* verifier's caller (auditor, compliance team, or agent) should do next.
|
|
89
107
|
*/
|
|
90
108
|
const SUGGESTIONS = {
|
|
91
|
-
UNSUPPORTED_FORMAT: 'This verifier reads exportFormatVersion 2.0 / RFC8949-CDE canonicalization. Re-export the chain from a current AGLedger instance, or upgrade the verifier to match the producing
|
|
109
|
+
UNSUPPORTED_FORMAT: 'This verifier reads exportFormatVersion 2.0 / RFC8949-CDE canonicalization. Re-export the chain from a current AGLedger instance, or upgrade the verifier to match the producing Server.',
|
|
110
|
+
EXPORT_PAGE_CONFLICT: 'Two pages of one export walk carry different bytes under the same id: a vault key, a key statement, the window of a key (other than one closing), a batch head, a history seal, or an entry at one chain position. Each page is read from the same tables, so one of the pages was edited after the Server wrote it. Fetch the walk again from the first page and compare.',
|
|
111
|
+
EXPORT_READ_TIME_INVALID: 'The export or page states a read time (exportDate, checkpointEvidence.evidenceReadAt or anchorsJudgedThroughIat) earlier than the signed iat of an entry or checkpoint it holds: it was read after that entry was signed, so the stated time was edited. A backdated read time can set aside an anchor that shows the chain was cut. Fetch the export again from the Server and verify it, giving the time you read it.',
|
|
92
112
|
CHAIN_EMPTY: 'No entries were present to verify. Confirm the record id / dump directory is correct and that the chain has not been truncated to zero rows.',
|
|
93
113
|
CHAIN_POSITION_GAP: 'A chain position is missing or out of order. The chain was truncated or reordered. Obtain a complete, unmodified export/dump from the operator and re-run.',
|
|
94
114
|
CHAIN_GENESIS_INVALID: 'The first entry must carry previousHash = null. A non-null genesis link means the head of the chain was removed. Request the full chain from position 1.',
|
|
95
115
|
CHAIN_LINK_BROKEN: 'An entry\'s previousHash does not match the prior entry\'s payloadHash. The chain was edited between these two entries. Treat every entry from this position on as untrusted.',
|
|
96
116
|
CHAIN_HASH_MISMATCH: 'sha256(cose_sign1) does not equal the stored payloadHash. The envelope bytes or the stored hash were altered. The signed bytes are authoritative; the row was tampered with.',
|
|
97
|
-
CHAIN_MALFORMED_ENTRY: 'An entry is missing a field the
|
|
117
|
+
CHAIN_MALFORMED_ENTRY: 'An entry is missing a field the Server writes on every entry (coseSign1, payloadHash, or a parseable createdAt where a key window or the start of signing needs one), or carries it as another type. The export/dump is incomplete or was edited, and an entry the verifier cannot place is never read as early unsigned history. Regenerate the export/dump from the operator and re-run.',
|
|
98
118
|
CHAIN_COSE_DECODE_FAILED: 'The COSE_Sign1 envelope did not decode as a tagged 4-element structure. The signed bytes are corrupt. Regenerate the export/dump.',
|
|
99
119
|
CHAIN_COSE_HEADER_MISMATCH: 'The position/previousHash signed in the COSE protected header disagree with the row columns. The visible columns were renumbered after signing. Trust the signed header, not the columns.',
|
|
100
120
|
CHAIN_PAYLOAD_BINDING_MISMATCH: 'The signed payload\'s structure no longer matches the canonical projection of the row columns it is bound to: the visible (denormalised) payload was altered after signing. This is a binding-integrity failure, not a judgement on content.',
|
|
@@ -105,34 +125,64 @@ const SUGGESTIONS = {
|
|
|
105
125
|
CHAIN_KEY_EXPIRED: 'The entry was written AFTER its signing key was retired, or after the instant distrustedKeys (VAULT_DISTRUSTED_KEYS on the Server) gives for that key; the detail says which. Possible use of a compromised key: check the key rotation and retention record for that key id.',
|
|
106
126
|
CHAIN_KEY_NOT_YET_ACTIVE: 'The entry was written BEFORE its signing key was activated. Not a rotation problem: the usual causes are a backdated entry or clock skew between the signer and the key registry. Compare the entry write time against the key activation time before treating this as tamper.',
|
|
107
127
|
CHAIN_ALG_MISMATCH: 'The algorithm in the signed protected header (label 1) is not one the entry\'s trusted verification key can produce, or the key registry\'s declared algorithm contradicts the key material itself. Tamper class: the header alg or the key registry was rewritten. Treat the entry as forged; obtain the verification keys out of band and re-run.',
|
|
108
|
-
CHAIN_UNSUPPORTED_ALGORITHM: 'The entry\'s trusted verification key commits to a signature algorithm that could not be computed, either because this verifier build does not implement it or because the host runtime refused it
|
|
128
|
+
CHAIN_UNSUPPORTED_ALGORITHM: 'The entry\'s trusted verification key commits to a signature algorithm that could not be computed, either because this verifier build does not implement it or because the host runtime refused it. The detail names the algorithm, and the cause where it is known. The chain is NOT verified, and this is NOT tamper evidence: the signature was never checked. Upgrade the verifier, or re-run on a host without the restriction. Never treat this result as a pass.',
|
|
109
129
|
CHAIN_SIGNING_KEY_DRIFT: 'The entry\'s signingKeyId column names a different key than the signature-covered kid in the COSE protected header. The column is a denormalized convenience and was rewritten after signing (possibly to point verification at another key). Trust the signed kid; treat the row as tampered.',
|
|
110
130
|
CHAIN_ACTOR_ATTRIBUTION_MISMATCH: 'The entry\'s actorId / actorOwnerId columns name a different actor than the signature-covered actor claim in the COSE protected header (CWT_Claims label 15, private label -65539). The columns are the projection a report displays and they were rewritten after signing, re-attributing the action to another actor. Trust the signed claim; treat the row as tampered and re-obtain the export from the operator.',
|
|
111
|
-
CHAIN_AGENT_SIGNATURE_INVALID: 'The agent signature sealed in predicate.on_behalf_of.agent_signature does not verify under the supplied key whose RFC 7638 thumbprint the entry itself names, or is sealed in a shape nothing can verify. The
|
|
131
|
+
CHAIN_AGENT_SIGNATURE_INVALID: 'The agent signature sealed in predicate.on_behalf_of.agent_signature does not verify under the supplied key whose RFC 7638 thumbprint the entry itself names, or is sealed in a shape nothing can verify. The Server checks this signature at intake and the envelope signature says the Server wrote it, so this is not a caller mistake: treat the agent attribution of this entry as unproven and escalate to the operator.',
|
|
112
132
|
CHAIN_FEDERATION_WIRE_INVALID: 'The federation message sealed in payload.wire does not hold: its body no longer hashes to the bodyHash the sender signed, the entry asserts a state, type, recommendation or dispute the sealed body does not carry, or (under the sender\'s federation key you supplied) the signature does not verify or the sealed senderPublicKey is not that key. The receiving Server verified the message at intake and signed this entry, so this is not a caller mistake: treat what the entry says the peer asserted as unproven and escalate to both operators.',
|
|
113
133
|
CHAIN_EVIDENCE_BINDING_MISMATCH: 'An evidence body inlined in the export (entries[].evidence, from ?evidence=true) does not hash to the payload.evidenceHash or payload.payloadHash its entry signs, or sits on an entry that signs no such hash. The body is an unsigned projection whose only authority is that hash, so it was edited after export or attached where it does not belong. Trust the signed hash, not the body: re-obtain the evidence from the operator and re-bind it (SHA-256 over its RFC 8785 form).',
|
|
114
134
|
CHAIN_ENTRY_UNSIGNED: 'The entry carries no signing key id where the install could not have written an unsigned entry: after a signed entry in the same chain, or at or after the earliest activation time in the signing key set (retired keys included). From that instant every writer holds a registered key, so this is what a writer without one leaves on the chain, or a signed row whose key id was nulled. Treat the entry as forged and escalate to the operator. Unsigned entries from before the first key activation stay reduced signature coverage, not a break.',
|
|
115
135
|
CHAIN_SIGNING_KEY_UNANCHORED: 'The entry is signed by a key that no signed key statement links to a trust anchor you pinned. Anything with write access to the Server\'s database can register a key and sign entries with it; what it cannot write is a statement signed by a key you trust. Treat the entry as forged. If the key is one you vouch for, pin it (trustAnchors) from a source outside the Server, never from the document that served it.',
|
|
116
136
|
CHAIN_KEY_WINDOW_DRIFT: 'A key registry column (activatedAt, retiredAt or status in a dump row or key document) differs from the value its signed key statements carry. The signed value is the one entries are graded against; the column was rewritten, or the retirement was written without its closure statement. Treat the registry as tampered and compare it with the Server\'s own scan (key_window_drift). Where the detail names a distrust entry the listing says the Server applies (distrustedFrom, VAULT_DISTRUSTED_KEYS), the listed retirement may be that entry\'s cut, which the verifier was not given or was given at another instant; the listing\'s word is unsigned, so it stays tampering until the Server\'s operator confirms the entry.',
|
|
117
|
-
CHECKPOINT_ROW_MISSING: 'A signed checkpoint anchors a position that has no matching chain row.
|
|
137
|
+
CHECKPOINT_ROW_MISSING: 'A signed checkpoint anchors a position that has no matching chain row. Chain entries below a checkpoint were removed out of band. The checkpoint is proof of the missing entries. On a record export the position is the one the export states (exportMetadata.expectedEntries): fetch the export again and verify the file exactly as served.',
|
|
118
138
|
CHECKPOINT_HASH_MISMATCH: 'A checkpoint\'s payloadHash does not match the chain row at its position. The chain diverged from what was checkpointed. Treat the chain as tampered.',
|
|
119
139
|
CHECKPOINT_SIGNATURE_INVALID: 'A checkpoint\'s COSE_Sign1 signature did not verify. The checkpoint was forged or altered. Re-run with out-of-band verification keys.',
|
|
120
140
|
CHECKPOINT_UNSIGNED: 'A checkpoint carries no signing key id but was written at or after the earliest activation time in the signing key set (retired keys included), when every writer holds a registered key. The checkpoint was forged or its key id nulled, and nothing it anchors can be trusted. Escalate to the operator.',
|
|
121
141
|
CHECKPOINT_KEY_UNANCHORED: 'A vault checkpoint is signed by a key that no signed key statement links to a trust anchor you pinned. Nothing it anchors can be trusted; treat it as forged (see CHAIN_SIGNING_KEY_UNANCHORED).',
|
|
122
142
|
CHECKPOINT_CLAIM_MISMATCH: 'The claim signed inside a vault checkpoint envelope does not decode, or says something the checkpoint row\'s columns do not (chain position, chain tip hash, subject digest or signed kid). A column was rewritten beside an intact envelope. Trust the signed claim, treat the checkpoint row as tampered, and obtain the dump from the operator again.',
|
|
143
|
+
CHECKPOINT_KEY_NOT_YET_ACTIVE: 'A vault checkpoint was written before the activation its signing key\'s statements sign. A checkpoint backdated under a later key, or a key used before its succession was recorded: treat what it anchors as unproven and compare with the Server\'s own scan (checkpoint_key_not_yet_active).',
|
|
144
|
+
CHECKPOINT_KEY_EXPIRED: 'A vault checkpoint was written after its signing key was retired, or after the instant distrustedKeys gives for that key; the detail says which. Possible use of a compromised key: check the rotation record for that key id, and treat what the checkpoint anchors as unproven.',
|
|
145
|
+
CHECKPOINT_ACCOUNTED_ONLY: 'A chain has no entry in the dump, and its only checkpoints are ones a distrustedKeys entry accounts for. Nothing vouches for the chain and nothing explains its absence: a chain is never empty once written. Obtain the chain from a backup or replica and escalate to the operator (Server scan: accounted_checkpoint_only).',
|
|
146
|
+
CHECKPOINT_ACCOUNTED_RUN_EXCEEDED: 'More than 1000 checkpoints a distrustedKeys entry accounts for sit above the newest checkpoint that entry does not cover. A rotation writes a fresh checkpoint at the next tip, so a run this long is rows planted under the leaked key. Treat the chain as unanchored and escalate to the operator (Server scan: checkpoint_accounted_run_exceeded).',
|
|
147
|
+
CHECKPOINT_COVERAGE_MISMATCH: 'The coverage fields of exportMetadata.checkpointEvidence (coverage, lastEntryPosition, coveredThroughPosition, uncoveredFromPosition, uncoveredEntries) say something other than the entries the export carries and the checkpoint it embeds. The Server computes them from the chain it exported, so the block or the entries were edited after the export was written. Fetch the export again and verify the file exactly as served.',
|
|
148
|
+
ANCHOR_CHAIN_CUT: 'An anchor document whose checkpoint verifies under a published key, signed before the chain was read, names a chain position above the last entry the export or dump carries. Entries from the last one carried through that position are missing, and no acknowledgement of lost history that verifies covers them. Treat the chain as cut, ask the operator for the restore or deletion behind it, and compare with the Server\'s own anchor verification (POST /v1/admin/vault/anchors/verify and /reconcile).',
|
|
149
|
+
ANCHOR_CHAIN_REWRITTEN: 'An anchor document whose checkpoint verifies under a published key signs a chain tip at a position where the entry the export or dump carries has another payloadHash. The chain was written again at or below that position, and no acknowledgement of lost history that verifies covers it. Treat every entry at or below that position as rewritten and escalate to the operator.',
|
|
150
|
+
ANCHOR_FORK: 'Two anchor documents whose checkpoints verify under published keys sign different chain tips for the same chain position. A position is anchored once in the life of an install, so the position was anchored again over another history, and no acknowledgement of lost history that verifies covers it. Fetch every object version of that key from the bucket and escalate to the operator.',
|
|
151
|
+
REWIND_ACKNOWLEDGEMENT_INVALID: 'An acknowledgement of lost history the export lists (checkpointEvidence.acknowledgedRewinds) does not hold: its envelope does not decode as a signed RESTORE_EPOCH on the platform-ops chain, its signature does not verify under an anchored key inside that key\'s window at its signed iat, its row says something its envelope does not, or the unsigned coveredRanges copy differs from the signed coveredFindings. It covers nothing. The export lists the platform-ops rows the database holds, so such a row was written by something other than the Server\'s acknowledgement: verify a vault dump of the platform-ops chain and escalate to the operator.',
|
|
152
|
+
CONTENT_BINDING_MALFORMED: 'A COMPLIANCE_ATTESTATION or AI_IMPACT_ASSESSMENT entry signs a contentHash that is not sha256: then 64 lowercase hex characters, or an attestedAt that is not an RFC 3339 instant. The Server writes both in exactly those forms, so the entry was not written by it. Treat the entry as forged and escalate to the operator.',
|
|
153
|
+
CONTENT_HASH_MISMATCH: 'A compliance record body supplied for verification (the attestation object of GET /v1/records/{id}/compliance-records/{complianceRecordId}) does not hash, as SHA-256 over its RFC 8785 form, to the contentHash its COSE_Sign1 entry signs. The stored attestation was changed after the entry was signed, or the file is not the response as served. Fetch the compliance record again; if it still differs, the stored body was edited (Server check: content_hash_mismatch).',
|
|
154
|
+
CONTENT_FIELD_DRIFT: 'A field of a supplied compliance record (recordId, recordType, attestedBy or attestedAt) differs from the value its COSE_Sign1 entry signs. The stored row was edited after the entry was signed, or the file is not the response as served (Server checks: content_field_drift, content_row_record_mismatch).',
|
|
155
|
+
CONTENT_ROW_UNSIGNED: 'A supplied compliance record belongs to this record and no COMPLIANCE_ATTESTATION entry of its chain names it. The Server writes the row and its entry in one transaction, so the row was written without the entry, or the entry was removed (Server check: content_row_unsigned).',
|
|
156
|
+
RECEIPT_INVALID: 'A SCITT Receipt on a ?receipts=true export does not hold: it does not decode, its signature does not verify under the key its kid names, its inclusion proof does not reach the signed Merkle root from the entry\'s own COSE_Sign1 bytes, it names a leaf other than the entry\'s position or a tree larger than the chain, its key is not anchored, or only some entries carry one. The entry\'s chain checks still stand on their own; treat the Receipt as forged and fetch the export again with ?receipts=true.',
|
|
157
|
+
BATCH_UNATTESTED: 'An entry written under the batched signing cadence (batch marker in its protected header, empty signature) carries no inclusion proof, and was written longer before the artifact was cut than the Server lets an entry wait for its batch head. Nothing signs the entry: it is what a writer holding no key leaves on the chain, or an entry whose proof was removed. Fetch the export again; if the proof is still absent, compare with the Server\'s own scan (batch_unattested) and escalate to the operator.',
|
|
158
|
+
BATCH_LEAF_MISMATCH: 'A batched entry\'s inclusion proof does not reach the root its batch head signs from the entry\'s own leaf (chain key, chain position and payloadHash), or the batch leaf filed for it names another entry hash. The head does not cover these bytes: the entry or its proof was altered after the head was signed. Treat the entry as unsigned and re-obtain the artifact from the operator (Server scan: batch_leaf_mismatch).',
|
|
159
|
+
BATCH_HEAD_INVALID: 'The batch head a batched entry names is absent from the artifact, does not decode, signs another id, tree size, root or leaf format than it is filed under, or does not verify under an anchored key inside that key\'s window at the head\'s write time; the detail says which. Every entry the head covers is unattested. Re-obtain the artifact, verify with keys taken out of band, and compare with the Server\'s own scan (batch_head_invalid).',
|
|
160
|
+
FEDERATION_SIGNATURE_INVALID: 'A signature a Server returned to its federation peer does not hold: an acknowledgement (serverSignature) or a co-sign counter-signature is not in the one spelling its key\'s algorithm takes, is under a key that is not an ML-DSA-87 or ES384 federation key, or does not verify over its own domain and fields. A signature made for one domain or one acknowledgement kind does not verify as another.',
|
|
161
|
+
FEDERATION_KEY_HISTORY_INVALID: 'A federation key history does not hold for the key pinned beside it: the pin is not a key the history admits, the statement that admits it does not verify, or the document is another hub\'s. Pin a key the history lists (the hub\'s current key, or one you held before a change), or obtain the history from the hub\'s /.well-known/agledger-federation-keys.json again.',
|
|
162
|
+
HISTORY_SEAL_INVALID: 'The history seal that covers an entry signed by an Ed25519, ES256 or ES384 key does not hold: it does not decode, is not signed by an anchored ML-DSA key inside that key\'s window, is not bound both ways to the closure that retired its key, its inclusion proof does not reach the signed root, or the chain\'s entry at the sealed position is not the one the seal names. The seal is what an ML-DSA key signs over everything written under earlier keys, so nothing else vouches for the entry against a forged classical signature.',
|
|
163
|
+
HISTORY_SEAL_EXCEEDED: 'An entry signed by an Ed25519, ES256 or ES384 key sits above the position its chain had when the history seal covering that key was written. The retirement that writes a seal waits out every write under the retired key, so an entry under it past the sealed position was written with the key after its retirement.',
|
|
164
|
+
HISTORY_SEAL_MISSING_CHAIN: 'An entry is signed by an Ed25519, ES256 or ES384 key, and the history seal covering that key has no leaf for the entry\'s chain: the chain did not exist when the seal was written, so nothing that key signed can be on it.',
|
|
165
|
+
CHAIN_ISSUER_CHANGE_UNEXPLAINED: 'An entry is signed under an issuer (CWT iss) that no ISSUER_CHANGE_ANNOUNCED and ISSUER_CHANGED pair on the platform-ops chain accounts for. The Server refuses to boot under a new issuer without that procedure, so the entry was signed by a process configured outside it, or by a party writing the database directly. Treat entries under the unexplained issuer as unproven and escalate to the operator.',
|
|
123
166
|
TENANT_READ_LEAF_HASH_MISMATCH: 'An org_admin_reads leaf_hash does not match the RFC 9162 leaf hash of its envelope, sha256(0x00 || cose_sign1). The read-log leaf was altered after recording.',
|
|
124
167
|
TENANT_READ_LEAF_INDEX_GAP: 'org_admin_reads leaf indices are not gap-free for this org. A read-log entry was removed. Obtain the complete log.',
|
|
125
168
|
TENANT_READ_SIGNATURE_INVALID: 'An org_admin_reads leaf\'s COSE_Sign1 signature did not verify. The read-log leaf was forged or altered.',
|
|
126
169
|
TENANT_READ_LEAF_UNSIGNED: 'An org_admin_reads leaf carries the unsigned kid where the install could not have written one: after a signed leaf in the same org log, or at or after the earliest activation time in the signing key set. Treat the leaf as forged and escalate to the operator.',
|
|
127
170
|
TENANT_READ_KEY_UNANCHORED: 'An org_admin_reads leaf is signed by a key that no signed key statement links to a trust anchor you pinned. Treat the leaf as forged (see CHAIN_SIGNING_KEY_UNANCHORED).',
|
|
128
171
|
TENANT_READ_CLAIM_MISMATCH: 'The claim signed inside an org_admin_reads leaf envelope does not decode, or says something the leaf row\'s columns do not (position, previous_hash, record_id or subject digest). A column was rewritten beside an intact envelope. Trust the signed claim and treat the read-log leaf as tampered.',
|
|
172
|
+
TENANT_READ_OIDC_MISMATCH: 'An org_admin_reads row\'s actor_oidc_iss / actor_oidc_sub columns differ from the person its leaf signs as predicate.on_behalf_of.oidc, or name a person on a leaf that signs none. A column was rewritten beside an intact envelope: trust the signed identity and treat the row as tampered.',
|
|
173
|
+
TENANT_READ_KEY_NOT_YET_ACTIVE: 'An org_admin_reads leaf was written before the activation its signing key\'s statements sign. Treat the leaf as backdated or forged and compare with the Server\'s own scan (leaf_key_not_yet_active).',
|
|
174
|
+
TENANT_READ_KEY_EXPIRED: 'An org_admin_reads leaf was written after its signing key was retired, or after the instant distrustedKeys gives for that key; the detail says which. Possible use of a compromised key: check the rotation record for that key id.',
|
|
129
175
|
TENANT_CHECKPOINT_LEAF_COUNT_MISMATCH: 'A signed tree head commits to more leaves than the dump contains. The read log was truncated below a checkpoint.',
|
|
130
176
|
TENANT_CHECKPOINT_ROOT_MISMATCH: 'The RFC 9162 Merkle root recomputed over the leaves does not match the signed root_hash. The read log diverged from what was checkpointed.',
|
|
131
177
|
TENANT_CHECKPOINT_SIGNATURE_INVALID: 'A signed-tree-head COSE_Sign1 signature did not verify. The STH was forged or altered.',
|
|
132
178
|
TENANT_CHECKPOINT_UNSIGNED: 'An org_admin_reads signed tree head carries no signing key id but was written at or after the earliest activation time in the signing key set. The tree head was forged or its key id nulled; escalate to the operator.',
|
|
133
179
|
TENANT_CHECKPOINT_KEY_UNANCHORED: 'An org_admin_reads signed tree head is signed by a key that no signed key statement links to a trust anchor you pinned. Treat it as forged (see CHAIN_SIGNING_KEY_UNANCHORED).',
|
|
134
180
|
TENANT_CHECKPOINT_CLAIM_MISMATCH: 'The claim signed inside an org_admin_reads tree-head envelope does not decode, or says something the tree-head row\'s columns do not (position, chain_tip_hash, leaf count, subject digest or signed kid). A column was rewritten beside an intact envelope. Trust the signed claim and treat the tree-head row as tampered.',
|
|
135
|
-
|
|
181
|
+
TENANT_CHECKPOINT_KEY_NOT_YET_ACTIVE: 'An org_admin_reads signed tree head was written before the activation its signing key\'s statements sign. Treat the tree head as backdated or forged and compare with the Server\'s own scan (checkpoint_key_not_yet_active).',
|
|
182
|
+
TENANT_CHECKPOINT_KEY_EXPIRED: 'An org_admin_reads signed tree head was written after its signing key was retired, or after the instant distrustedKeys gives for that key; the detail says which. Possible use of a compromised key: check the rotation record for that key id.',
|
|
183
|
+
TENANT_CHECKPOINT_FORK: 'Two signed tree heads at the same tree_size carry different roots. This is a Server fork or signing-key compromise. Escalate immediately.',
|
|
184
|
+
TENANT_CHECKPOINT_COSIGNATURE_INVALID: 'A witness co-signature on an org_admin_reads signed tree head does not verify under the key you gave for its witnessKeyId, over the tree head\'s COSE_Sign1 bytes; or you required one and the tree head carries none under a key you gave. The Server stores the witness fields as given, so ask the witness whether it signed this tree head, and compare the tree head with the copy the witness kept.',
|
|
185
|
+
TENANT_READ_PROOF_INVALID: 'An org_admin_reads inclusion proof does not hold: its audit path does not walk the leaf hash at its index to the signed root of the tree head it is for, or it names a different leaf, tree size or root than the leaf and tree head given. Fetch the proof again for that tree head and leaf; a proof that still fails means the leaf is not in the log the tree head signed.',
|
|
136
186
|
KEY_STATEMENT_INVALID: 'A key statement does not verify, disagrees with the columns it was stored under, touches no anchored key, or was signed by a key after its closure or after the key was already admitted. It admits nothing. One that does not verify, or that a key signed after its closure, is what a writer with database access or a leaked retired key produces: have the operator retire that key with force and add it to VAULT_DISTRUSTED_KEYS, and pass the same entry as distrustedKeys.',
|
|
137
187
|
KEY_CLOSURE_INVALID: 'A key is retired with no closure that counts for it, or a closure is signed by a key the walk does not anchor, by a key after its own retirement, or dates a retirement before its subject was activated, or is signed by a key the walk reaches but does not anchor and retires an anchored key earlier, or with force, than any closure a published key signed (so a walk over the published key documents reads that key differently). A closure that still counts ends its subject\'s window whoever wrote it; if its signer leaked, have the operator add it to VAULT_DISTRUSTED_KEYS and pass the same entry as distrustedKeys.',
|
|
138
188
|
};
|
|
@@ -3,7 +3,7 @@ export declare const FEDERATION_WIRE_SCHEME = "agledger.federation.v2";
|
|
|
3
3
|
export interface FederationWire {
|
|
4
4
|
scheme: string;
|
|
5
5
|
senderHubId: string;
|
|
6
|
-
/** The sender's
|
|
6
|
+
/** The sender's federation key as registered at handshake: base64 SPKI DER (ML-DSA-87, ES384, or Ed25519 before Server 4.0.0, which also stored the raw 32 bytes). */
|
|
7
7
|
senderPublicKey: string;
|
|
8
8
|
recipientHubId: string;
|
|
9
9
|
method: string;
|
|
@@ -12,7 +12,7 @@ export interface FederationWire {
|
|
|
12
12
|
bodyHash: string;
|
|
13
13
|
timestamp: string;
|
|
14
14
|
nonce: string;
|
|
15
|
-
/**
|
|
15
|
+
/** The signature over the sign-input: base64url without padding (ML-DSA-87, ES384 as low-S r||s), or 128 hex characters under an Ed25519 key. */
|
|
16
16
|
signature: string;
|
|
17
17
|
/** The request body as received, the bytes `bodyHash` covers. */
|
|
18
18
|
body: Record<string, unknown>;
|
|
@@ -78,19 +78,33 @@ export interface FederationKeyEntry {
|
|
|
78
78
|
history?: FederationKeyHistoryDocument;
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
|
-
* A federation key as base64 SPKI DER
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* nothing under
|
|
81
|
+
* A federation key as base64 SPKI DER: an ML-DSA-87 or ES384 key as it is,
|
|
82
|
+
* and an Ed25519 key (a Server before 4.0.0) from either form that Server's
|
|
83
|
+
* peer table held, SPKI DER or the raw 32-byte key. Returns null for anything
|
|
84
|
+
* else (so a caller refuses it by name rather than verifying nothing under
|
|
85
|
+
* it).
|
|
85
86
|
*/
|
|
86
87
|
export declare function normalizeFederationKey(publicKeyBase64: string): string | null;
|
|
88
|
+
/**
|
|
89
|
+
* A federation key history that does not hold for the keys pinned beside it:
|
|
90
|
+
* the pin is not a key the history admits, the statement that admits it does
|
|
91
|
+
* not verify, or the document is another hub's or another domain's. A
|
|
92
|
+
* `TypeError`, as every refused `federationKeys` input is, carrying the
|
|
93
|
+
* canonical `code`.
|
|
94
|
+
*/
|
|
95
|
+
export declare class FederationKeyHistoryError extends TypeError {
|
|
96
|
+
readonly code: 'FEDERATION_KEY_HISTORY_INVALID';
|
|
97
|
+
constructor(message: string);
|
|
98
|
+
}
|
|
87
99
|
/**
|
|
88
100
|
* Build the registry from `{ [hubId]: publicKey }` or
|
|
89
101
|
* `[{ hubId, publicKey, history? }]`. Throws `TypeError` naming the entry on
|
|
90
|
-
* any key that is not
|
|
91
|
-
* that is another hub's
|
|
92
|
-
* none of the keys pinned for its hub, so a bad input is refused
|
|
93
|
-
* runs rather than reported as a signature failure.
|
|
102
|
+
* any key that is not a federation key, and `FederationKeyHistoryError` (code
|
|
103
|
+
* `FEDERATION_KEY_HISTORY_INVALID`) on a history that is another hub's or
|
|
104
|
+
* admits none of the keys pinned for its hub, so a bad input is refused
|
|
105
|
+
* before any verification runs rather than reported as a signature failure.
|
|
106
|
+
* A statement that does not verify takes no part: the keys it alone would
|
|
107
|
+
* link are not trusted.
|
|
94
108
|
*/
|
|
95
109
|
export declare function buildFederationKeyRegistry(input: Readonly<Record<string, string>> | ReadonlyArray<FederationKeyEntry>): FederationKeyRegistry;
|
|
96
110
|
/**
|
|
@@ -112,12 +126,11 @@ export declare function extractFederationWire(payload: Record<string, unknown>):
|
|
|
112
126
|
export type FederationWireOutcome =
|
|
113
127
|
/**
|
|
114
128
|
* The hash, the entry's fields and, under a supplied key, the signature all
|
|
115
|
-
* hold. `afterRetirement
|
|
116
|
-
* by a succession it signed, before the
|
|
117
|
-
* receiver accepts the old key until it
|
|
118
|
-
* process not yet restarted onto the new
|
|
119
|
-
*
|
|
120
|
-
* publisher comes after the entry.
|
|
129
|
+
* hold. `afterRetirement` (only with `allowAfterRetirement`): the key the
|
|
130
|
+
* message is sealed under was retired, by a succession it signed, before the
|
|
131
|
+
* sender signed the message. The receiver accepts the old key until it
|
|
132
|
+
* revokes the peer, so a publisher process not yet restarted onto the new
|
|
133
|
+
* key sends exactly this for a short gap.
|
|
121
134
|
*/
|
|
122
135
|
{
|
|
123
136
|
outcome: 'ok';
|
|
@@ -131,22 +144,95 @@ export type FederationWireOutcome =
|
|
|
131
144
|
outcome: 'invalid';
|
|
132
145
|
detail: string;
|
|
133
146
|
}
|
|
134
|
-
/** A key was supplied but this host cannot compute
|
|
147
|
+
/** A key was supplied but this host cannot compute its algorithm. */
|
|
135
148
|
| {
|
|
136
149
|
outcome: 'unsupported';
|
|
137
150
|
detail: string;
|
|
138
151
|
};
|
|
152
|
+
/**
|
|
153
|
+
* The allowance at both edges of a federation key's window, as the Server's
|
|
154
|
+
* receiver recipe gives it. `wire.timestamp` is the clock of the process that
|
|
155
|
+
* signed the message and the window's edges are the sender's database clock,
|
|
156
|
+
* so a message signed within this of a key change is on the right key.
|
|
157
|
+
*/
|
|
158
|
+
export declare const FEDERATION_KEY_WINDOW_SKEW_MS = 300000;
|
|
159
|
+
export interface CheckFederationWireOptions {
|
|
160
|
+
/**
|
|
161
|
+
* Accept a message signed by a key its history had already retired (beyond
|
|
162
|
+
* the clock-skew allowance), and count it in `afterRetirement`. A publisher
|
|
163
|
+
* process not yet restarted onto the new key sends exactly this for a short
|
|
164
|
+
* gap, and the receiver accepts the old key until it revokes the peer. Off
|
|
165
|
+
* by default: a retired key signing at any later time is also what a leaked
|
|
166
|
+
* key does.
|
|
167
|
+
*/
|
|
168
|
+
allowAfterRetirement?: boolean;
|
|
169
|
+
}
|
|
139
170
|
/**
|
|
140
171
|
* Check one sealed message against the entry that carries it, and under the
|
|
141
172
|
* sender's key when `keys` has one for `wire.senderHubId`.
|
|
142
173
|
*
|
|
143
174
|
* Runs on an entry that already passed every other check, so `payload` is
|
|
144
175
|
* what the receiver signed. `recordId` is the entry's record; the body names
|
|
145
|
-
* the same record on every message type that carries one
|
|
176
|
+
* the same record on every message type that carries one, or, on an entry that
|
|
177
|
+
* signs `origin`, the record id `origin` names. When the sender's
|
|
146
178
|
* keys came with a history, the message is placed in a key's window by
|
|
147
179
|
* `wire.timestamp`: the sender signed it, the receiver sealed it under its own
|
|
148
180
|
* signature after holding it to its clock-skew allowance, and it is read from
|
|
149
|
-
* the sender's clock, the clock the history's windows are written by
|
|
181
|
+
* the sender's clock, the clock the history's windows are written by, with
|
|
182
|
+
* {@link FEDERATION_KEY_WINDOW_SKEW_MS} allowed at each edge. The
|
|
150
183
|
* entry's `createdAt` is a column no signature covers, so it places nothing.
|
|
151
184
|
*/
|
|
152
|
-
export declare function checkFederationWire(entryType: string, recordId: string | null, payload: Record<string, unknown>, wire: FederationWire, keys: FederationKeyRegistry | undefined): FederationWireOutcome;
|
|
185
|
+
export declare function checkFederationWire(entryType: string, recordId: string | null, payload: Record<string, unknown>, wire: FederationWire, keys: FederationKeyRegistry | undefined, options?: CheckFederationWireOptions): FederationWireOutcome;
|
|
186
|
+
/** Domain an acknowledgement signature covers. */
|
|
187
|
+
export declare const FEDERATION_ACK_DOMAIN = "agledger.federation.ack.v1";
|
|
188
|
+
/** Domain a co-sign counter-signature covers. */
|
|
189
|
+
export declare const FEDERATION_CO_SIGN_DOMAIN = "agledger.federation.co-sign.v1";
|
|
190
|
+
/** What an acknowledgement acknowledges: a state transition, a signal or a dispute leg. */
|
|
191
|
+
export declare const FEDERATION_ACK_KINDS: readonly ['ack', 'signal', 'dispute'];
|
|
192
|
+
/** The members of a co-sign claim, exactly. */
|
|
193
|
+
export declare const FEDERATION_CO_SIGN_CLAIM_FIELDS: readonly ['recordId', 'outcome', 'recommendation', 'outcomeHash', 'state', 'performerHubId', 'validUntil'];
|
|
194
|
+
/** A receiving Server's acknowledgement, with the key it is checked under. */
|
|
195
|
+
export interface FederationAckInput {
|
|
196
|
+
/** `ack` (a state transition, `value` the state), `signal` (`value` the recommendation) or `dispute` (`value` the action). */
|
|
197
|
+
kind: string;
|
|
198
|
+
/** The record id the peer sent. */
|
|
199
|
+
recordId: string;
|
|
200
|
+
value: string;
|
|
201
|
+
serverTimestamp: string;
|
|
202
|
+
serverSignature: string;
|
|
203
|
+
/** The signing Server's federation key: ML-DSA-87 or ES384 as base64 SPKI DER, or the Ed25519 key a Server before 4.0.0 held (its signatures are 128 hex characters). */
|
|
204
|
+
signerPublicKey: string;
|
|
205
|
+
}
|
|
206
|
+
/** A counterparty Server's counter-signature over a co-sign claim. */
|
|
207
|
+
export interface FederationCoSignInput {
|
|
208
|
+
/** Exactly the fields in {@link FEDERATION_CO_SIGN_CLAIM_FIELDS}. */
|
|
209
|
+
claim: Record<string, unknown>;
|
|
210
|
+
counterSignature: string;
|
|
211
|
+
/** The counterparty Server's federation key: ML-DSA-87 or ES384 as base64 SPKI DER, or the Ed25519 key a Server before 4.0.0 held (its signatures are 128 hex characters). */
|
|
212
|
+
signerPublicKey: string;
|
|
213
|
+
}
|
|
214
|
+
export type FederationSignatureOutcome = {
|
|
215
|
+
state: 'ok';
|
|
216
|
+
} | {
|
|
217
|
+
state: 'invalid';
|
|
218
|
+
code: 'FEDERATION_SIGNATURE_INVALID';
|
|
219
|
+
detail: string;
|
|
220
|
+
}
|
|
221
|
+
/** This host cannot compute the key's algorithm. Nothing was verified. */
|
|
222
|
+
| {
|
|
223
|
+
state: 'unsupported';
|
|
224
|
+
detail: string;
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* Verify the acknowledgement a receiving Server returned for a federated
|
|
228
|
+
* transition, signal or dispute leg (`serverSignature`). It covers
|
|
229
|
+
* `agledger.federation.ack.v1:<kind>:<recordId>:<value>:<serverTimestamp>`,
|
|
230
|
+
* so an acknowledgement made for one kind does not verify as another.
|
|
231
|
+
*/
|
|
232
|
+
export declare function verifyFederationAck(ack: FederationAckInput): FederationSignatureOutcome;
|
|
233
|
+
/**
|
|
234
|
+
* Verify a co-sign counter-signature: the counterparty Server's signature
|
|
235
|
+
* over `agledger.federation.co-sign.v1:` and the RFC 8785 form of the claim.
|
|
236
|
+
* The claim holds exactly the fields in {@link FEDERATION_CO_SIGN_CLAIM_FIELDS}.
|
|
237
|
+
*/
|
|
238
|
+
export declare function verifyFederationCoSign(input: FederationCoSignInput): FederationSignatureOutcome;
|