@action-state-group/capsule-viewer 0.10.0 → 0.11.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 +3 -1
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +4 -0
- package/dist/browser.js.map +1 -1
- package/dist/card-signature.d.ts +18 -0
- package/dist/card-signature.js +39 -0
- package/dist/card-signature.js.map +1 -0
- package/dist/evidence-graph.iife.js +280 -260
- package/dist/viewer-build.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,9 @@ which the module calls and does not run itself: `readerAnchorWitness` (the
|
|
|
26
26
|
snapshot's witness Receipts under the reader's own witness list, with
|
|
27
27
|
agent-action-capsule's `checkAnchorWitnessed`) and `readerWitnessPolicy` and
|
|
28
28
|
`setReaderWitnessPolicy` (the reader's list, empty by default, kept in the
|
|
29
|
-
page's memory only).
|
|
29
|
+
page's memory only). The History card's signature line asks
|
|
30
|
+
`readerCardSignature`, which reads the context's own strict verdict for the
|
|
31
|
+
card's record and names the key it is signed with on a pass.
|
|
30
32
|
|
|
31
33
|
The code moved here from agent-action-capsule (agent-action-capsule#281) and
|
|
32
34
|
keeps its BSD-3-Clause license (`LICENSE-BSD-3-Clause`); the rest of the
|
package/dist/browser.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export { buildResultRoot, buildVerifiedBundleContext, disclosureOf, ed25519Avail
|
|
|
8
8
|
export { readerAnchorWitness, readerWitnessPolicy, setReaderWitnessPolicy, } from "./reader-witnesses.js";
|
|
9
9
|
export { paymentPreimageCheck } from "./payment-preimage.js";
|
|
10
10
|
export { readerCadenceWitness } from "./cadence-witness.js";
|
|
11
|
+
export { readerCardSignature } from "./card-signature.js";
|
package/dist/browser.js
CHANGED
|
@@ -37,4 +37,8 @@ export { readerAnchorWitness, readerWitnessPolicy, setReaderWitnessPolicy, } fro
|
|
|
37
37
|
// agent-action-capsule's JCS and receipt check; the module verifies nothing.
|
|
38
38
|
export { paymentPreimageCheck } from "./payment-preimage.js";
|
|
39
39
|
export { readerCadenceWitness } from "./cadence-witness.js";
|
|
40
|
+
// The History card's signature (capsule-viewer#211; rule F4.7): the context's
|
|
41
|
+
// own strict verdict for the root record, which the module draws and does
|
|
42
|
+
// not decide.
|
|
43
|
+
export { readerCardSignature } from "./card-signature.js";
|
|
40
44
|
//# 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,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,6EA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mB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** What {@link readerCardSignature} says about a History card's signature. */
|
|
2
|
+
export interface ReaderCardSignature {
|
|
3
|
+
/** `PASS` when the root record's signature verifies under the key it names,
|
|
4
|
+
* `FAIL` when it does not, `NOT_PRESENT` when the record claims none, and
|
|
5
|
+
* `NOT_CHECKED` when this page has no strict result (no Ed25519 in this
|
|
6
|
+
* browser) or was not handed a verified context. */
|
|
7
|
+
readonly status: "PASS" | "FAIL" | "NOT_PRESENT" | "NOT_CHECKED";
|
|
8
|
+
/** The record's key_id (lowercase hex of its Ed25519 public key) on `PASS`,
|
|
9
|
+
* else null. */
|
|
10
|
+
readonly key_id: string | null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The History card's signature standing from a verified context
|
|
14
|
+
* (`buildVerifiedBundleContext`): the strict verdict of the context's root
|
|
15
|
+
* record. Never throws; a check this page cannot run is `NOT_CHECKED`, never
|
|
16
|
+
* a pass.
|
|
17
|
+
*/
|
|
18
|
+
export declare function readerCardSignature(context: unknown): Promise<ReaderCardSignature>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// The History card's signature standing (capsule-viewer#211; rule F4.7,
|
|
3
|
+
// "Snapshot · witnessed · signed · policy v1"), for a presentation module,
|
|
4
|
+
// which verifies nothing itself (presentation-contract-v0 section 3).
|
|
5
|
+
//
|
|
6
|
+
// The card is the root record's agent_input. Whether the root record's
|
|
7
|
+
// producer signature verifies is already decided by the context's strict
|
|
8
|
+
// verification (agent-action-capsule verifyBundle with `strict`, which runs
|
|
9
|
+
// only when this browser can verify Ed25519): `authored` under the key the
|
|
10
|
+
// record names, `invalid`, or `unclaimed`. This reads that verdict for the
|
|
11
|
+
// root and nothing else. A pass says the card was signed with the key the
|
|
12
|
+
// record names; it says nothing about who holds that key.
|
|
13
|
+
import { isVerifiedBundleContext } from "@action-state-group/agent-action-capsule";
|
|
14
|
+
const result = (status, keyId = null) => ({ status, key_id: keyId });
|
|
15
|
+
/**
|
|
16
|
+
* The History card's signature standing from a verified context
|
|
17
|
+
* (`buildVerifiedBundleContext`): the strict verdict of the context's root
|
|
18
|
+
* record. Never throws; a check this page cannot run is `NOT_CHECKED`, never
|
|
19
|
+
* a pass.
|
|
20
|
+
*/
|
|
21
|
+
export async function readerCardSignature(context) {
|
|
22
|
+
if (!isVerifiedBundleContext(context))
|
|
23
|
+
return result("NOT_CHECKED");
|
|
24
|
+
const record = context.strict?.records.find((r) => r.capsuleId === context.root);
|
|
25
|
+
if (record === undefined)
|
|
26
|
+
return result("NOT_CHECKED");
|
|
27
|
+
switch (record.signature) {
|
|
28
|
+
case "authored":
|
|
29
|
+
return record.keyId === null
|
|
30
|
+
? result("NOT_CHECKED")
|
|
31
|
+
: result("PASS", record.keyId);
|
|
32
|
+
case "invalid":
|
|
33
|
+
return result("FAIL");
|
|
34
|
+
case "unclaimed":
|
|
35
|
+
return result("NOT_PRESENT");
|
|
36
|
+
}
|
|
37
|
+
return result("NOT_CHECKED");
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=card-signature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-signature.js","sourceRoot":"","sources":["../src/card-signature.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,wEAAwE;AACxE,2EAA2E;AAC3E,sEAAsE;AACtE,EAAE;AACF,uEAAuE;AACvE,yEAAyE;AACzE,4EAA4E;AAC5E,2EAA2E;AAC3E,2EAA2E;AAC3E,0EAA0E;AAC1E,0DAA0D;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAcnF,MAAM,MAAM,GAAG,CACb,MAAqC,EACrC,KAAK,GAAkB,IAAI,EACN,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAEtD;;;;;GAKG;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