@action-state-group/capsule-viewer 0.8.0 → 0.10.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/README.md +6 -1
- package/dist/browser.d.ts +3 -0
- package/dist/browser.js +16 -3
- package/dist/browser.js.map +1 -1
- package/dist/cadence-witness.d.ts +29 -0
- package/dist/cadence-witness.js +324 -0
- package/dist/cadence-witness.js.map +1 -0
- package/dist/compliance-view.js +6 -2
- package/dist/compliance-view.js.map +1 -1
- package/dist/contract-report-wording.js +11 -2
- package/dist/contract-report-wording.js.map +1 -1
- package/dist/evidence-graph-view.js +13 -21
- package/dist/evidence-graph-view.js.map +1 -1
- package/dist/evidence-graph.iife.js +1819 -834
- package/dist/outcome-report-view.d.ts +2 -2
- package/dist/outcome-report-view.js +43 -27
- package/dist/outcome-report-view.js.map +1 -1
- package/dist/payment-preimage.d.ts +12 -0
- package/dist/payment-preimage.js +46 -0
- package/dist/payment-preimage.js.map +1 -0
- package/dist/reader-witnesses.d.ts +39 -0
- package/dist/reader-witnesses.js +111 -0
- package/dist/reader-witnesses.js.map +1 -0
- package/dist/report-levels.d.ts +11 -0
- package/dist/report-levels.js +22 -0
- package/dist/report-levels.js.map +1 -1
- package/dist/viewer-build.js +2 -2
- package/dist/viewer-build.js.map +1 -1
- package/dist/wording/contract-report-eu-ai-act.en.json +2 -0
- package/dist/wording/contract-report-outcomes.en.json +12 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,7 +21,12 @@ module ships the same build as `go/pageruntime`. Bundle verification comes from
|
|
|
21
21
|
the runtime's global `EvidenceGraph` carries the verifier functions a
|
|
22
22
|
presentation module may call: `buildResultRoot`, `disclosureOf`,
|
|
23
23
|
`ed25519Available`, `verifiedPayload`, `verifyDisclosureEnvelope` and
|
|
24
|
-
`verifyProducerEnvelope`.
|
|
24
|
+
`verifyProducerEnvelope`. It also carries the History card's witness check,
|
|
25
|
+
which the module calls and does not run itself: `readerAnchorWitness` (the
|
|
26
|
+
snapshot's witness Receipts under the reader's own witness list, with
|
|
27
|
+
agent-action-capsule's `checkAnchorWitnessed`) and `readerWitnessPolicy` and
|
|
28
|
+
`setReaderWitnessPolicy` (the reader's list, empty by default, kept in the
|
|
29
|
+
page's memory only).
|
|
25
30
|
|
|
26
31
|
The code moved here from agent-action-capsule (agent-action-capsule#281) and
|
|
27
32
|
keeps its BSD-3-Clause license (`LICENSE-BSD-3-Clause`); the rest of the
|
package/dist/browser.d.ts
CHANGED
|
@@ -5,3 +5,6 @@ export { conversationStatus } from "./outcome-report-view.js";
|
|
|
5
5
|
export { obligationStatus, rowStatus } from "./compliance-view.js";
|
|
6
6
|
export * from "./presentation-mount.js";
|
|
7
7
|
export { buildResultRoot, buildVerifiedBundleContext, disclosureOf, ed25519Available, verifiedPayload, verifyDisclosureEnvelope, verifyProducerEnvelope, } from "@action-state-group/agent-action-capsule";
|
|
8
|
+
export { readerAnchorWitness, readerWitnessPolicy, setReaderWitnessPolicy, } from "./reader-witnesses.js";
|
|
9
|
+
export { paymentPreimageCheck } from "./payment-preimage.js";
|
|
10
|
+
export { readerCadenceWitness } from "./cadence-witness.js";
|
package/dist/browser.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// The in-browser renderer the emitted page runs. It is published only as
|
|
3
3
|
// dist/evidence-graph.iife.js (`npm run emitter:iife`), which exposes
|
|
4
4
|
// renderEvidenceGraph, and not as a package export. It bundles
|
|
5
|
-
// @action-state-group/agent-action-capsule (0.9.0 or later)
|
|
6
|
-
//
|
|
7
|
-
// ships the build as go/pageruntime.
|
|
5
|
+
// @action-state-group/agent-action-capsule (0.9.0 or later) and
|
|
6
|
+
// @action-state-group/cll, each through its own browser entry, by plain
|
|
7
|
+
// package resolution. The Go module ships the build as go/pageruntime.
|
|
8
8
|
export * from "./evidence-graph-view.js";
|
|
9
9
|
export * from "./contract-report.js";
|
|
10
10
|
export * from "./contract-report-wording.js";
|
|
@@ -24,4 +24,17 @@ export * from "./presentation-mount.js";
|
|
|
24
24
|
// agent-action-capsule's verifier, and removing one breaks the modules that
|
|
25
25
|
// call it.
|
|
26
26
|
export { buildResultRoot, buildVerifiedBundleContext, disclosureOf, ed25519Available, verifiedPayload, verifyDisclosureEnvelope, verifyProducerEnvelope, } from "@action-state-group/agent-action-capsule";
|
|
27
|
+
// The reader's own witness list, and the History card's witness standing under
|
|
28
|
+
// it (static/standard_history_card.js; capsule-viewer#183). The check is
|
|
29
|
+
// agent-action-capsule's checkAnchorWitnessed, unchanged; the module calls
|
|
30
|
+
// readerAnchorWitness and verifies nothing itself.
|
|
31
|
+
export { readerAnchorWitness, readerWitnessPolicy, setReaderWitnessPolicy, } from "./reader-witnesses.js";
|
|
32
|
+
// The deal receipt's two checks a module may not run (capsule-viewer#214;
|
|
33
|
+
// evidencebook-deal#94, 9b frame 8): a Lightning settlement's preimage
|
|
34
|
+
// against its payment hash (lightning-v0 `preimage_verified`), and a deal
|
|
35
|
+
// bundle's x-cadence-witness/v0 chain with its receipts under the reader's
|
|
36
|
+
// own witness list. Built from cll's checkpoint and MMR verifiers and
|
|
37
|
+
// agent-action-capsule's JCS and receipt check; the module verifies nothing.
|
|
38
|
+
export { paymentPreimageCheck } from "./payment-preimage.js";
|
|
39
|
+
export { readerCadenceWitness } from "./cadence-witness.js";
|
|
27
40
|
//# sourceMappingURL=browser.js.map
|
package/dist/browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,sEAAsE;AACtE,+DAA+D;AAC/D,
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,sEAAsE;AACtE,+DAA+D;AAC/D,gEAAgE;AAChE,wEAAwE;AACxE,uEAAuE;AACvE,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACnE,cAAc,yBAAyB,CAAC;AAExC,yEAAyE;AACzE,8EAA8E;AAC9E,8EAA8E;AAC9E,0EAA0E;AAC1E,uEAAuE;AACvE,4EAA4E;AAC5E,6EAA6E;AAC7E,0EAA0E;AAC1E,2DAA2D;AAC3D,4DAA4D;AAC5D,4EAA4E;AAC5E,WAAW;AACX,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,0CAA0C,CAAC;AAElD,+EAA+E;AAC/E,yEAAyE;AACzE,2EAA2E;AAC3E,mDAAmD;AACnD,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAE/B,0EAA0E;AAC1E,uEAAuE;AACvE,0EAA0E;AAC1E,2EAA2E;AAC3E,sEAAsE;AACtE,6EAA6E;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** What {@link readerCadenceWitness} says about a bundle's cadence chain. */
|
|
2
|
+
export interface ReaderCadenceWitness {
|
|
3
|
+
/** `PASS` only when every link holds and a receipt verifies under a key of
|
|
4
|
+
* the reader's list; `NOT_PRESENT` when the bundle claims no witnessed
|
|
5
|
+
* chain, or its chain carries no receipt. */
|
|
6
|
+
readonly status: "PASS" | "FAIL" | "NOT_PRESENT" | "NOT_CHECKED";
|
|
7
|
+
/** Why it is not `PASS`: capsule-cli's finding for a broken link
|
|
8
|
+
* (`cadence_*`, `checkpoint_unverified`), or for the receipts
|
|
9
|
+
* (`receipt_malformed`, `receipt_not_verified`, `receipt_not_checked`,
|
|
10
|
+
* `no_reader_witness`);
|
|
11
|
+
* `not_a_verified_context` for anything the runtime did not build, and
|
|
12
|
+
* `check_unavailable` when this page could not run a step. Null on `PASS`
|
|
13
|
+
* and `NOT_PRESENT`. */
|
|
14
|
+
readonly finding: string | null;
|
|
15
|
+
/** The reader's name for the witness of the receipt it names. */
|
|
16
|
+
readonly witness: string | null;
|
|
17
|
+
/** That receipt's registration time (a NumericDate), when it carries one. */
|
|
18
|
+
readonly witnessed_time: number | null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The deal's witness standing, from a context this runtime built
|
|
22
|
+
* (`buildVerifiedBundleContext`): its `x-cadence-witness/v0` chain walked from
|
|
23
|
+
* the bundle's own checkpoint, which must have authenticated in the
|
|
24
|
+
* context's strict checks, to the witnessed cadence checkpoint, whose
|
|
25
|
+
* receipts are checked under the reader's own witness list ({@link
|
|
26
|
+
* readerWitnessPolicy}). Never throws; a check this page cannot run is
|
|
27
|
+
* `NOT_CHECKED`, never a pass.
|
|
28
|
+
*/
|
|
29
|
+
export declare function readerCadenceWitness(context: unknown): Promise<ReaderCadenceWitness>;
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// A deal bundle's witness standing (capsule-viewer#214), for a presentation
|
|
3
|
+
// module, which verifies nothing itself (presentation-contract-v0 section 3).
|
|
4
|
+
//
|
|
5
|
+
// A deal's own checkpoint is never sent to a witness. capsulectl seals it as a
|
|
6
|
+
// leaf of a fixed-depth tree whose root is one entry of a cadence log, and the
|
|
7
|
+
// cadence log's checkpoint is what the witness receipts are over; the bundle
|
|
8
|
+
// carries that chain as its `x-cadence-witness/v0` extension, a capsule-cli
|
|
9
|
+
// private kind (cli/deal_cadence.go). This walks the chain as capsule-cli's
|
|
10
|
+
// own verifier does (cli/deal_cadence_verify.go `cadenceClaim`), with the
|
|
11
|
+
// same findings, using the verifiers the page already carries: cll's
|
|
12
|
+
// checkpoint and MMR proofs, and agent-action-capsule's JCS and witness
|
|
13
|
+
// receipt check. The receipts are checked under the reader's own witness list
|
|
14
|
+
// (reader-witnesses.ts), never anything the bundle names (see `receipts` for
|
|
15
|
+
// where that makes this differ from capsule-cli).
|
|
16
|
+
import { isVerifiedBundleContext, jcs, } from "@action-state-group/agent-action-capsule";
|
|
17
|
+
import { base64Canonical, verifyReceipt, } from "@action-state-group/agent-action-capsule/witness";
|
|
18
|
+
import { checkpointMetadata, rootFromPeaks, verifyConsistency, verifyHexInclusion, } from "@action-state-group/cll";
|
|
19
|
+
import { readerWitnessPolicy } from "./reader-witnesses.js";
|
|
20
|
+
/** The extension's name, then the names bundles carried it under before (the
|
|
21
|
+
* last of which names its log `deal_log_id`). */
|
|
22
|
+
const CADENCE_EXTENSIONS = [
|
|
23
|
+
"x-cadence-witness/v0",
|
|
24
|
+
"cadence-witness/v0",
|
|
25
|
+
"x-deal-cadence-v0",
|
|
26
|
+
];
|
|
27
|
+
/** Every path is 16 hashes: up to 65535 deals per tick. */
|
|
28
|
+
const CADENCE_DEPTH = 16;
|
|
29
|
+
const object = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
30
|
+
const result = (status, finding = null, witness = null, witnessed_time = null) => ({ status, finding, witness, witnessed_time });
|
|
31
|
+
// Go's hex.DecodeString: digit pairs in either case.
|
|
32
|
+
const fromHex = (value) => {
|
|
33
|
+
if (typeof value !== "string" || !/^(?:[0-9a-fA-F]{2})*$/u.test(value))
|
|
34
|
+
return undefined;
|
|
35
|
+
const out = new Uint8Array(new ArrayBuffer(value.length / 2));
|
|
36
|
+
for (let i = 0; i < out.length; i += 1)
|
|
37
|
+
out[i] = Number.parseInt(value.slice(2 * i, 2 * i + 2), 16);
|
|
38
|
+
return out;
|
|
39
|
+
};
|
|
40
|
+
const toHex = (bytes) => Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
41
|
+
const hashList = (value) => {
|
|
42
|
+
if (!Array.isArray(value))
|
|
43
|
+
return undefined;
|
|
44
|
+
const out = value.map(fromHex);
|
|
45
|
+
return out.every((h) => h !== undefined) ? out : undefined;
|
|
46
|
+
};
|
|
47
|
+
// Unpadded base64url, as capsulectl writes a checkpoint's `cose`.
|
|
48
|
+
const fromBase64Url = (value) => {
|
|
49
|
+
if (typeof value !== "string" || !/^[A-Za-z0-9_-]*$/u.test(value))
|
|
50
|
+
return undefined;
|
|
51
|
+
try {
|
|
52
|
+
const binary = atob(value.replace(/-/gu, "+").replace(/_/gu, "/"));
|
|
53
|
+
return Uint8Array.from(binary, (c) => c.charCodeAt(0));
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
// capsule-cli's JSONUint: a non-negative integer.
|
|
60
|
+
const uint = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0
|
|
61
|
+
? value
|
|
62
|
+
: undefined;
|
|
63
|
+
const sha256 = async (...parts) => {
|
|
64
|
+
const joined = new Uint8Array(new ArrayBuffer(parts.reduce((n, p) => n + p.length, 0)));
|
|
65
|
+
let at = 0;
|
|
66
|
+
for (const p of parts) {
|
|
67
|
+
joined.set(p, at);
|
|
68
|
+
at += p.length;
|
|
69
|
+
}
|
|
70
|
+
return new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", joined));
|
|
71
|
+
};
|
|
72
|
+
// capsule-cli's CadenceLeaf and CadenceNode: leaves and nodes are
|
|
73
|
+
// domain-separated.
|
|
74
|
+
const cadenceLeaf = async (logId, size, checkpointSha256, salt) => sha256(Uint8Array.of(0), jcs({ checkpoint_sha256: checkpointSha256, log_id: logId, salt, size }));
|
|
75
|
+
const cadenceRoot = async (leaf, index, path) => {
|
|
76
|
+
let h = leaf;
|
|
77
|
+
for (let level = 0; level < path.length; level += 1)
|
|
78
|
+
h =
|
|
79
|
+
Math.floor(index / 2 ** level) % 2 === 0
|
|
80
|
+
? await sha256(Uint8Array.of(1), h, path[level])
|
|
81
|
+
: await sha256(Uint8Array.of(1), path[level], h);
|
|
82
|
+
return h;
|
|
83
|
+
};
|
|
84
|
+
// An inclusion proof as capsulectl writes it, checked as agent-action-capsule
|
|
85
|
+
// checks a record's (bundle.ts verifyProof): cll's verifier takes the path,
|
|
86
|
+
// then the peaks to the right bagged into one, then each peak to the left.
|
|
87
|
+
const included = async (root, size, leafIndex, identity, raw) => {
|
|
88
|
+
if (!object(raw) || raw.v !== 1 || raw.kind !== "inclusion")
|
|
89
|
+
return false;
|
|
90
|
+
const proofSize = uint(raw.size), proofIndex = uint(raw.leaf_index), witness = hashList(raw.witness), left = hashList(raw.peaks_left), right = hashList(raw.peaks_right);
|
|
91
|
+
if (proofSize === undefined ||
|
|
92
|
+
BigInt(proofSize) !== size ||
|
|
93
|
+
proofIndex !== leafIndex ||
|
|
94
|
+
!witness ||
|
|
95
|
+
!left ||
|
|
96
|
+
!right)
|
|
97
|
+
return false;
|
|
98
|
+
const flattened = [...witness];
|
|
99
|
+
if (right.length)
|
|
100
|
+
flattened.push(await rootFromPeaks(right));
|
|
101
|
+
flattened.push(...left.toReversed());
|
|
102
|
+
return verifyHexInclusion(root, size, BigInt(leafIndex), identity, flattened);
|
|
103
|
+
};
|
|
104
|
+
// A consistency proof as capsulectl writes it (capsule-cli parseConsistencyJSON).
|
|
105
|
+
const consistent = async (oldRoot, oldSize, newRoot, newSize, raw) => {
|
|
106
|
+
if (!object(raw) || raw.v !== 1 || raw.kind !== "consistency")
|
|
107
|
+
return false;
|
|
108
|
+
const from = uint(raw.old_size), to = uint(raw.new_size), oldPeaks = hashList(raw.old_peaks), newPeaks = hashList(raw.new_peaks), steps = Array.isArray(raw.witness) ? raw.witness.map(hashList) : undefined, a = fromHex(oldRoot), b = fromHex(newRoot);
|
|
109
|
+
if (from === undefined ||
|
|
110
|
+
to === undefined ||
|
|
111
|
+
BigInt(from) !== oldSize ||
|
|
112
|
+
BigInt(to) !== newSize ||
|
|
113
|
+
!oldPeaks ||
|
|
114
|
+
!newPeaks ||
|
|
115
|
+
!steps ||
|
|
116
|
+
steps.some((s) => s === undefined) ||
|
|
117
|
+
!a ||
|
|
118
|
+
!b)
|
|
119
|
+
return false;
|
|
120
|
+
return verifyConsistency(a, b, {
|
|
121
|
+
oldSize: oldSize,
|
|
122
|
+
newSize: newSize,
|
|
123
|
+
oldPeaks,
|
|
124
|
+
witness: steps,
|
|
125
|
+
newPeaks,
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
const signedOf = (cp) => ({
|
|
129
|
+
log_id: cp.logId,
|
|
130
|
+
mmr_size: Number(cp.size),
|
|
131
|
+
root: cp.root,
|
|
132
|
+
key_id: cp.keyId,
|
|
133
|
+
timestamp: cp.timestamp,
|
|
134
|
+
prev_size: Number(cp.previousSize),
|
|
135
|
+
prev_root: cp.previousRoot,
|
|
136
|
+
});
|
|
137
|
+
/** The cadence chain a bundle carries, under its name or an earlier one. */
|
|
138
|
+
const chainOf = (bundle) => {
|
|
139
|
+
const extensions = object(bundle) ? bundle.extensions : undefined;
|
|
140
|
+
if (!object(extensions))
|
|
141
|
+
return undefined;
|
|
142
|
+
for (const name of CADENCE_EXTENSIONS)
|
|
143
|
+
if (object(extensions[name]))
|
|
144
|
+
return extensions[name];
|
|
145
|
+
return undefined;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Every link of the chain but the receipts (capsule-cli `cadenceClaim`, in
|
|
149
|
+
* its order and with its findings), or the cadence checkpoint the receipts
|
|
150
|
+
* are over when every link holds.
|
|
151
|
+
*/
|
|
152
|
+
async function walk(chain, dealCose) {
|
|
153
|
+
const fail = (finding) => ({ status: "FAIL", finding });
|
|
154
|
+
let dealStatement = dealCose;
|
|
155
|
+
let deal = await checkpointMetadata(dealStatement);
|
|
156
|
+
if (deal === undefined)
|
|
157
|
+
return fail("cadence_deal_checkpoint_malformed");
|
|
158
|
+
// Witnessed in part: the leaf holds an earlier checkpoint of this deal,
|
|
159
|
+
// signed by the same key, which the bundle's checkpoint extends.
|
|
160
|
+
if (chain.extent === "part") {
|
|
161
|
+
const earlier = object(chain.earlier) ? chain.earlier : {};
|
|
162
|
+
const cp = object(earlier.checkpoint) ? earlier.checkpoint : {};
|
|
163
|
+
const statement = fromBase64Url(cp.cose);
|
|
164
|
+
if (statement === undefined)
|
|
165
|
+
return fail("cadence_earlier_checkpoint_malformed");
|
|
166
|
+
const prior = await checkpointMetadata(statement);
|
|
167
|
+
if (prior === undefined)
|
|
168
|
+
return fail("cadence_earlier_checkpoint_signature_invalid");
|
|
169
|
+
if (prior.keyId !== deal.keyId ||
|
|
170
|
+
prior.logId !== deal.logId ||
|
|
171
|
+
prior.size >= deal.size)
|
|
172
|
+
return fail("cadence_earlier_checkpoint_not_this_deal");
|
|
173
|
+
if (!(await consistent(prior.root, prior.size, deal.root, deal.size, earlier.consistency_proof)))
|
|
174
|
+
return fail("cadence_earlier_checkpoint_not_a_prefix");
|
|
175
|
+
dealStatement = statement;
|
|
176
|
+
deal = prior;
|
|
177
|
+
}
|
|
178
|
+
let logId = typeof chain.log_id === "string" ? chain.log_id : "";
|
|
179
|
+
if (logId === "" && typeof chain.deal_log_id === "string")
|
|
180
|
+
logId = chain.deal_log_id;
|
|
181
|
+
const salt = typeof chain.salt === "string" ? chain.salt : "";
|
|
182
|
+
const size = uint(chain.size), index = uint(chain.index);
|
|
183
|
+
if (logId !== deal.logId || size === undefined || BigInt(size) !== deal.size)
|
|
184
|
+
return fail("cadence_leaf_does_not_name_this_checkpoint");
|
|
185
|
+
if (index === undefined || index >= 2 ** CADENCE_DEPTH || salt === "")
|
|
186
|
+
return fail("cadence_leaf_malformed");
|
|
187
|
+
const path = hashList(chain.path);
|
|
188
|
+
if (!path ||
|
|
189
|
+
path.length !== CADENCE_DEPTH ||
|
|
190
|
+
path.some((h) => h.length !== 32))
|
|
191
|
+
return fail("cadence_path_malformed");
|
|
192
|
+
const leaf = await cadenceLeaf(logId, size, toHex(await sha256(dealStatement)), salt);
|
|
193
|
+
const root = await cadenceRoot(leaf, index, path);
|
|
194
|
+
const inner = object(chain.cadence) ? chain.cadence : {};
|
|
195
|
+
const cp = object(inner.checkpoint) ? inner.checkpoint : {};
|
|
196
|
+
const cose = fromBase64Url(cp.cose);
|
|
197
|
+
if (cose === undefined)
|
|
198
|
+
return fail("cadence_checkpoint_malformed");
|
|
199
|
+
const cadence = await checkpointMetadata(cose);
|
|
200
|
+
if (cadence === undefined)
|
|
201
|
+
return fail("cadence_checkpoint_signature_invalid");
|
|
202
|
+
if (cadence.keyId !== deal.keyId)
|
|
203
|
+
return fail("cadence_checkpoint_signer_differs");
|
|
204
|
+
if (inner.log_id !== cadence.logId)
|
|
205
|
+
return fail("cadence_log_id_mismatch");
|
|
206
|
+
const entry = uint(inner.entry_index);
|
|
207
|
+
const cadenceRootBytes = fromHex(cadence.root);
|
|
208
|
+
if (entry === undefined ||
|
|
209
|
+
!cadenceRootBytes ||
|
|
210
|
+
!(await included(cadenceRootBytes, cadence.size, entry, toHex(root), inner.inclusion_proof)))
|
|
211
|
+
return fail("cadence_entry_not_included");
|
|
212
|
+
return { cadence, cose, inner };
|
|
213
|
+
}
|
|
214
|
+
// A witness record as capsule-cli and agent-action-capsule read one (AAC
|
|
215
|
+
// witness `isRecord`): every member present; `ts_url`, `entry_hash` and
|
|
216
|
+
// `receipt_b64` non-empty strings; `receipt_b64` canonical standard base64.
|
|
217
|
+
const RECORD_FIELDS = [
|
|
218
|
+
"ts_url",
|
|
219
|
+
"entry_hash",
|
|
220
|
+
"receipt_b64",
|
|
221
|
+
"leaf_index",
|
|
222
|
+
"tree_size",
|
|
223
|
+
];
|
|
224
|
+
const isRecord = (entry) => {
|
|
225
|
+
if (!object(entry) ||
|
|
226
|
+
!RECORD_FIELDS.every((name) => Object.hasOwn(entry, name)))
|
|
227
|
+
return false;
|
|
228
|
+
if (!["ts_url", "entry_hash", "receipt_b64"].every((name) => typeof entry[name] === "string" && entry[name] !== ""))
|
|
229
|
+
return false;
|
|
230
|
+
try {
|
|
231
|
+
base64Canonical(entry.receipt_b64);
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
return true;
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* The cadence checkpoint's receipts under the reader's own witness list.
|
|
240
|
+
*
|
|
241
|
+
* What does not depend on whom the reader trusts is decided as capsule-cli
|
|
242
|
+
* decides it (AAC witness `VerifyReceipts`): a malformed entry fails the
|
|
243
|
+
* whole result, whatever else passes, and a stub (one that never reached a
|
|
244
|
+
* witness) is not checked. Whom to trust is the reader's list, which names
|
|
245
|
+
* keys, not witness URLs, so it cannot tell a witness it does not list from
|
|
246
|
+
* a forged receipt: each receipt is decided as #183 decides an anchor's
|
|
247
|
+
* (agent-action-capsule `checkAnchorWitnessed`). It passes under the first
|
|
248
|
+
* listed key that verifies it, else fails (not checked when the page could
|
|
249
|
+
* not run the check), and any pass wins, naming the passing receipt with the
|
|
250
|
+
* earliest registration time.
|
|
251
|
+
*/
|
|
252
|
+
async function receipts(entries, signed, cose) {
|
|
253
|
+
// capsule-cli reads receipts that are not a list as none.
|
|
254
|
+
if (!Array.isArray(entries) || entries.length === 0)
|
|
255
|
+
return result("NOT_PRESENT");
|
|
256
|
+
if (!entries.every(isRecord))
|
|
257
|
+
return result("FAIL", "receipt_malformed");
|
|
258
|
+
const keys = readerWitnessPolicy().witnesses.flatMap(({ name, keys }) => keys.map((key) => ({ name, key: fromHex(key) })));
|
|
259
|
+
if (keys.length === 0)
|
|
260
|
+
return result("NOT_CHECKED", "no_reader_witness");
|
|
261
|
+
let failed = false;
|
|
262
|
+
let chosen;
|
|
263
|
+
for (const entry of entries) {
|
|
264
|
+
if (entry.is_stub === true)
|
|
265
|
+
continue;
|
|
266
|
+
let passed;
|
|
267
|
+
let unavailable = false;
|
|
268
|
+
for (const { name, key } of keys) {
|
|
269
|
+
const outcome = await verifyReceipt(signed, entry, key, cose);
|
|
270
|
+
if (outcome.ok) {
|
|
271
|
+
passed = { name, time: outcome.registrationTime };
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
if (outcome.notChecked)
|
|
275
|
+
unavailable = true;
|
|
276
|
+
}
|
|
277
|
+
if (passed === undefined) {
|
|
278
|
+
if (!unavailable)
|
|
279
|
+
failed = true;
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
if (chosen === undefined ||
|
|
283
|
+
(passed.time !== null &&
|
|
284
|
+
(chosen.time === null || passed.time < chosen.time)))
|
|
285
|
+
chosen = passed;
|
|
286
|
+
}
|
|
287
|
+
if (chosen !== undefined)
|
|
288
|
+
return result("PASS", null, chosen.name, chosen.time);
|
|
289
|
+
if (failed)
|
|
290
|
+
return result("FAIL", "receipt_not_verified");
|
|
291
|
+
return result("NOT_CHECKED", "receipt_not_checked");
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* The deal's witness standing, from a context this runtime built
|
|
295
|
+
* (`buildVerifiedBundleContext`): its `x-cadence-witness/v0` chain walked from
|
|
296
|
+
* the bundle's own checkpoint, which must have authenticated in the
|
|
297
|
+
* context's strict checks, to the witnessed cadence checkpoint, whose
|
|
298
|
+
* receipts are checked under the reader's own witness list ({@link
|
|
299
|
+
* readerWitnessPolicy}). Never throws; a check this page cannot run is
|
|
300
|
+
* `NOT_CHECKED`, never a pass.
|
|
301
|
+
*/
|
|
302
|
+
export async function readerCadenceWitness(context) {
|
|
303
|
+
if (!isVerifiedBundleContext(context))
|
|
304
|
+
return result("NOT_CHECKED", "not_a_verified_context");
|
|
305
|
+
const chain = chainOf(context.bundle);
|
|
306
|
+
if (chain === undefined || chain.state !== "witnessed")
|
|
307
|
+
return result("NOT_PRESENT");
|
|
308
|
+
if (context.strict?.checkpointAuthenticated !== true)
|
|
309
|
+
return result("NOT_CHECKED", "checkpoint_unverified");
|
|
310
|
+
try {
|
|
311
|
+
const stated = context.bundle.checkpoint;
|
|
312
|
+
const dealCose = fromBase64Url(stated.cose);
|
|
313
|
+
if (dealCose === undefined)
|
|
314
|
+
return result("NOT_CHECKED", "checkpoint_unverified");
|
|
315
|
+
const walked = await walk(chain, dealCose);
|
|
316
|
+
if (!("cadence" in walked))
|
|
317
|
+
return result(walked.status, walked.finding);
|
|
318
|
+
return await receipts(walked.inner.witnesses, signedOf(walked.cadence), walked.cose);
|
|
319
|
+
}
|
|
320
|
+
catch {
|
|
321
|
+
return result("NOT_CHECKED", "check_unavailable");
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
//# sourceMappingURL=cadence-witness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cadence-witness.js","sourceRoot":"","sources":["../src/cadence-witness.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,4EAA4E;AAC5E,8EAA8E;AAC9E,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,6EAA6E;AAC7E,4EAA4E;AAC5E,4EAA4E;AAC5E,0EAA0E;AAC1E,qEAAqE;AACrE,wEAAwE;AACxE,8EAA8E;AAC9E,6EAA6E;AAC7E,kDAAkD;AAClD,OAAO,EACL,uBAAuB,EACvB,GAAG,GACJ,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACL,eAAe,EACf,aAAa,GAEd,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D;iDACiD;AACjD,MAAM,kBAAkB,GAAG;IACzB,sBAAsB;IACtB,oBAAoB;IACpB,mBAAmB;CACX,CAAC;AACX,2DAA2D;AAC3D,MAAM,aAAa,GAAG,EAAE,CAAC;AAyBzB,MAAM,MAAM,GAAG,CAAC,KAAc,EAAiB,EAAE,CAC/C,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,I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AAgB;IAEhB,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC;QACnC,OAAO,MAAM,CAAC,aAAa,EAAE,wBAAwB,CAAC,CAAC;IACzD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACtC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,KAAK,WAAW;QACpD,OAAO,MAAM,CAAC,aAAa,CAAC,CAAC;IAC/B,IAAI,OAAO,CAAC,MAAM,EAAE,uBAAuB,KAAK,IAAI;QAClD,OAAO,MAAM,CAAC,aAAa,EAAE,uBAAuB,CAAC,CAAC;IACxD,IAAI,CAAC;QACH,MAAM,MAAM,GAAI,OAAO,CAAC,MAAe,CAAC,UAAkB,CAAC;QAC3D,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,QAAQ,KAAK,SAAS;YACxB,OAAO,MAAM,CAAC,aAAa,EAAE,uBAAuB,CAAC,CAAC;QACxD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC3C,IAAI,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC;YAAE,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QACzE,OAAO,MAAM,QAAQ,CACnB,MAAM,CAAC,KAAK,CAAC,SAAS,EACtB,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EACxB,MAAM,CAAC,IAAI,CACZ,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC;IACpD,CAAC;AACH,CAAC"}
|
package/dist/compliance-view.js
CHANGED
|
@@ -5,7 +5,7 @@ import { NOT_STATED } from "@action-state-group/agent-action-capsule";
|
|
|
5
5
|
import { spotCheckToggle } from "./spot-check.js";
|
|
6
6
|
import { DEFAULT_WORDS } from "./contract-report-wording.js";
|
|
7
7
|
import { ROW_TIERS } from "./evidence-contract.js";
|
|
8
|
-
import { caseParts, judgedOf, judgeNote, lazyBody, levelToggle, proofList, conversationFold, evidenceAction, ruleWord, wordPill, assuranceRow, reportSummary, } from "./report-levels.js";
|
|
8
|
+
import { caseParts, judgedOf, judgeNote, lazyBody, levelToggle, proofList, conversationFold, evidenceAction, ruleWord, wordPill, assuranceRow, withheldMark, reportSummary, } from "./report-levels.js";
|
|
9
9
|
import { renderLegend } from "./report-legend.js";
|
|
10
10
|
import { provenanceLines, renderProvenance } from "./report-provenance.js";
|
|
11
11
|
import { renderCheckYourself, expandableRow, leadWithProvenance, } from "./report-front.js";
|
|
@@ -847,8 +847,12 @@ function sessionProofs(session, model, w) {
|
|
|
847
847
|
ev.append(element("span", w.t("groups.pf.absent")));
|
|
848
848
|
}
|
|
849
849
|
// contract-report/v1 section 2: assurance stays on the claim.
|
|
850
|
-
if (test.claim !== undefined)
|
|
850
|
+
if (test.claim !== undefined) {
|
|
851
851
|
ev.append(proofList([assuranceRow(test.claim, w)]));
|
|
852
|
+
const mark = withheldMark(test.claim, w);
|
|
853
|
+
if (mark !== undefined)
|
|
854
|
+
ev.append(mark);
|
|
855
|
+
}
|
|
852
856
|
box.append(ev);
|
|
853
857
|
}
|
|
854
858
|
return box;
|