@mikeargento/bitgraph-player 0.8.1 → 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/DOMAIN.md DELETED
@@ -1,119 +0,0 @@
1
- # BitGraph Domain
2
-
3
- A BitGraph Domain is a party's own domain publishing the keys that record
4
- for it. A reader pins the domain once; `bitgraph-play check --from
5
- <domain>` then answers offline, from the export in hand and the pin on
6
- disk, whether a file holds a recorded position under a key the domain
7
- published.
8
-
9
- The domain's file is the party speaking for itself, never BitGraph
10
- speaking about the party. A proof carries a key and nothing else. Which
11
- domains to pin, and what to make of them, belongs to each reader; a
12
- domain's file is one source among any number, never an authority.
13
-
14
- ## The file: `bitgraph-domain/1`
15
-
16
- Served over HTTPS at `https://<domain>/.well-known/bitgraph`, at most
17
- 64 KiB:
18
-
19
- ```json
20
- {
21
- "version": "bitgraph-domain/1",
22
- "domain": "acme.com",
23
- "party": "Acme Corp",
24
- "keys": {
25
- "invoices": { "alg": "es256", "publicKey": "<SPKI DER, base64>" },
26
- "press": { "alg": "ed25519", "publicKey": "<raw 32 bytes, base64>" }
27
- }
28
- }
29
- ```
30
-
31
- - `version` is exactly `"bitgraph-domain/1"`. The discriminator field is
32
- `version`, as in `bitgraph/1` proofs, because `domain` is the file's own
33
- subject field. Unknown fields are a parse error; additions are a new
34
- format version.
35
- - `domain` is a lowercase hostname: no scheme, no port, no path. At pin
36
- time it must equal the domain the reader asked for, so a redirect cannot
37
- cause one party's file to be stored under another party's name.
38
- - `party` is the name the domain gives itself. Display only; the domain is
39
- the binding.
40
- - `keys` is a nonempty object. Names follow the trusted-key grammar of
41
- SPEC.md section 9.1 (`[A-Za-z0-9_.-]+`, at least one non-digit, unique),
42
- and each entry is exactly a section 9.1 trusted-key body: for `es256`
43
- the publicKey is SPKI DER in base64, the spelling actor proofs carry;
44
- for `ed25519` it is the raw 32-byte key in base64. An entry therefore
45
- pastes into a format 2 rule's `trustedKeys` unchanged.
46
-
47
- A key's **fingerprint** is the lowercase hex SHA-256 of the decoded
48
- publicKey bytes. For `es256` keys this is exactly the `keyId` actor proofs
49
- carry. Fingerprints are always derived and never written in the file, so a
50
- domain cannot claim a key it does not show.
51
-
52
- ## Pin
53
-
54
- `bitgraph-play pin <domain>` fetches the file, prints the party and every
55
- key's name, algorithm and fingerprint, and stores the file bytes verbatim
56
- on the reader's machine after confirmation. Pinning is the only step that
57
- touches the network, once per domain. Pinning again shows what changed,
58
- added, removed or replaced keys, before asking again. `pin` alone lists
59
- stored pins; `pin --forget <domain>` removes one.
60
-
61
- A malformed file is refused at the pin, so a check never reads a bad one.
62
- `check --from` never fetches; `--from` naming a domain with no stored pin
63
- is an invocation error (exit 3) whose remedy is the pin command, because a
64
- reader's missing setup is not evidence and gets no verdict.
65
-
66
- ## The domain line
67
-
68
- With `--from <domain>`, one line joins the check report for each
69
- recording.
70
-
71
- TRUE when the recording verifies and either
72
-
73
- - its actor's `keyId` equals the fingerprint of an `es256` key in the
74
- pinned file, or
75
- - a `bitgraph-sig/1` file among the bundle's candidate signature files
76
- (SPEC.md section 9.4) verifies over the recording's digest under any
77
- pinned key.
78
-
79
- UNDETERMINED otherwise. **The domain line is never FALSE**, by the same
80
- open-world rule as `signedBy` (SPEC.md section 9.3): domain evidence can
81
- exist outside any bundle, so its absence contradicts nothing. Evidence in
82
- hand that contradicts the recording itself already reads FALSE on the
83
- existing lines; the domain line does not restate them.
84
-
85
- An enclave epoch key listed in a domain's file matches nothing: it is not
86
- an actor key, and the enclave never signs the domain-separated
87
- bitgraph-sig message. Exit codes are unchanged; the line joins the
88
- report's conjunction.
89
-
90
- ## What it establishes, and the cost
91
-
92
- TRUE establishes that a key published by the domain stands behind a
93
- recording of exactly these bytes at a fixed causal position. Not
94
- authorship: anyone can record a file they downloaded, under any key they
95
- hold. Not content. Not exclusivity: the same bytes may hold other
96
- positions, under other keys or none. The statement is as strong as the
97
- domain and the keys behind it: a stolen key keeps the domain's standing
98
- until it is removed and readers pin again.
99
-
100
- Publishing a key names it in public, retroactively: every recording the
101
- key has ever made or will make reads as the party's, positions and volume
102
- included, and pins outlive the file that provided them. Only digests
103
- travel, so no content is exposed, and unpublished keys and anonymous
104
- recordings are untouched. Publish keys dedicated to what you intend to
105
- stand behind, named for their purpose. A published key is per purpose,
106
- never per document: the per-document evidence is the signature each
107
- recording already carries, and a pin only works because the keys it
108
- stores outlive it. Attribution without public grouping is the other
109
- posture, and it needs no domain file: record under an unpublished key and
110
- hand the counterparty the evidence directly; they declare the key in
111
- their own rule's `trustedKeys`.
112
-
113
- ## Relation to the specification
114
-
115
- Evaluation semantics (SPEC.md sections 1 through 9) are untouched. The
116
- domain file shares section 9.1's key grammar, section 9.3's open-world
117
- rule and section 9.4's candidate discipline; `check` remains the section
118
- 8 convenience surface, and its report format adds the domain entry as
119
- `bitgraph-check/2`.
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=domain.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domain.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/domain.test.ts"],"names":[],"mappings":""}
@@ -1,265 +0,0 @@
1
- // Copyright (c) 2024-2026 Mike Argento. Licensed under the MIT License. See LICENSE.
2
- /**
3
- * BitGraph Domain: parseDomainFile, fingerprints, the pin store, the
4
- * fetch, and check --from's "domain" line.
5
- *
6
- * The invariants under test:
7
- * - The domain line is TRUE or UNDETERMINED, never FALSE: absence of
8
- * domain evidence contradicts nothing (SPEC §9.3's open-world rule).
9
- * - Fingerprints are always derived from key material, never read from
10
- * the file; for es256 the fingerprint IS the actor keyId, proved
11
- * against the real declared recording (fixtures/declared-12010).
12
- * - A malformed file is refused at the pin, and a redirect cannot store
13
- * one party's file under another party's name (the `domain` field
14
- * must equal the domain the reader asked for).
15
- * - A report without --from stays bitgraph-check/1 with no `from` key.
16
- *
17
- * Everything runs in memory or under a temp dir. The fetch is injected;
18
- * no network, no ledger writes, ever.
19
- */
20
- import { strict as assert } from "node:assert";
21
- import { createHash, generateKeyPairSync, sign as cryptoSign } from "node:crypto";
22
- import { mkdtempSync, readFileSync, rmSync } from "node:fs";
23
- import { tmpdir } from "node:os";
24
- import { join } from "node:path";
25
- import { test } from "node:test";
26
- import { ingestEntries } from "@mikeargento/bitgraph-audit";
27
- import { checkIngest } from "../check.js";
28
- import { checkDomain, diffDomainFiles, DomainFileError, domainKeyRefs, isDomainName, keyFingerprint, parseDomainFile, } from "../domain.js";
29
- import { fetchDomainFile, forgetPin, listPins, readPin, writePin } from "../pin.js";
30
- import { sigMessage } from "../sig.js";
31
- // ---------------------------------------------------------------------------
32
- // The real declared recording: actor key ee0c6517…, provider passkey
33
- // ---------------------------------------------------------------------------
34
- const proofBytes = readFileSync(new URL("../../src/__tests__/fixtures/declared-12010/proof.json", import.meta.url));
35
- const proofJson = JSON.parse(proofBytes.toString("utf8"));
36
- const ACTOR_KEY_B64 = proofJson.agency.actor.publicKeyB64;
37
- const ACTOR_KEY_ID = proofJson.agency.actor.keyId;
38
- const DIGEST_HEX = Buffer.from(proofJson.artifact.digestB64, "base64").toString("hex");
39
- function domainText(overrides) {
40
- return JSON.stringify({
41
- version: "bitgraph-domain/1",
42
- domain: "acme.com",
43
- party: "Acme Corp",
44
- keys: { studio: { alg: "es256", publicKey: ACTOR_KEY_B64 } },
45
- ...overrides,
46
- });
47
- }
48
- async function ingestProof(bytes = proofBytes) {
49
- return ingestEntries([{ path: "proof.json", open: () => Promise.resolve(new Uint8Array(bytes)) }]);
50
- }
51
- function onlyRecording(report) {
52
- assert.equal(report.recordings.length, 1);
53
- return report.recordings[0];
54
- }
55
- function domainLineOf(recording) {
56
- const line = recording.lines.find((l) => l.name === "domain");
57
- assert.notEqual(line, undefined, "expected a domain line");
58
- return line;
59
- }
60
- // ---------------------------------------------------------------------------
61
- // Parsing and fingerprints
62
- // ---------------------------------------------------------------------------
63
- test("parseDomainFile accepts a valid file and derives the party/keys", () => {
64
- const file = parseDomainFile(domainText(), "acme.com");
65
- assert.equal(file.domain, "acme.com");
66
- assert.equal(file.party, "Acme Corp");
67
- assert.deepEqual(Object.keys(file.keys), ["studio"]);
68
- });
69
- test("isDomainName: lowercase dotted hostnames only", () => {
70
- assert.equal(isDomainName("acme.com"), true);
71
- assert.equal(isDomainName("sub.acme-corp.co.uk"), true);
72
- assert.equal(isDomainName("ACME.com"), false);
73
- assert.equal(isDomainName("acme"), false);
74
- assert.equal(isDomainName("acme.com/path"), false);
75
- assert.equal(isDomainName("https://acme.com"), false);
76
- assert.equal(isDomainName("acme.com:443"), false);
77
- assert.equal(isDomainName(""), false);
78
- });
79
- test("parseDomainFile refuses malformed files with every issue named", () => {
80
- const bad = (text, expected) => {
81
- try {
82
- parseDomainFile(text, expected);
83
- }
84
- catch (err) {
85
- assert.ok(err instanceof DomainFileError);
86
- return [...err.issues];
87
- }
88
- assert.fail("expected DomainFileError");
89
- };
90
- assert.match(bad(domainText({ version: "bitgraph-domain/2" })).join(" "), /"version" must be exactly/);
91
- assert.match(bad(domainText({ extra: 1 })).join(" "), /unknown field "extra"/);
92
- assert.match(bad(domainText(), "other.example").join(" "), /refusing to store one party's file/);
93
- assert.match(bad(domainText({ party: " " })).join(" "), /"party" is required/);
94
- assert.match(bad(domainText({ keys: {} })).join(" "), /at least one key/);
95
- assert.match(bad(domainText({ keys: { "1234": { alg: "es256", publicKey: ACTOR_KEY_B64 } } })).join(" "), /non-digit/);
96
- assert.match(bad(domainText({ keys: { studio: { alg: "es256", publicKey: ACTOR_KEY_B64, note: "x" } } })).join(" "), /unknown field "note"/);
97
- assert.match(bad(domainText({ keys: { studio: { alg: "rsa", publicKey: ACTOR_KEY_B64 } } })).join(" "), /"alg" must be/);
98
- assert.match(bad(domainText({ keys: { studio: { alg: "es256", publicKey: "!!!" } } })).join(" "), /does not decode/);
99
- assert.match(bad(domainText({ keys: { press: { alg: "ed25519", publicKey: Buffer.alloc(16).toString("base64") } } })).join(" "), /does not decode/);
100
- assert.match(bad(domainText({ domain: "https://acme.com" })).join(" "), /lowercase hostname/);
101
- // Oversize input is refused before parsing.
102
- const big = new Uint8Array(70_000);
103
- assert.throws(() => parseDomainFile(big), DomainFileError);
104
- });
105
- test("an es256 fingerprint IS the actor keyId (derived, never assigned)", () => {
106
- assert.equal(keyFingerprint({ alg: "es256", publicKey: ACTOR_KEY_B64 }), ACTOR_KEY_ID);
107
- const refs = domainKeyRefs(parseDomainFile(domainText()));
108
- assert.deepEqual(refs.map((r) => [r.name, r.fingerprint]), [["studio", ACTOR_KEY_ID]]);
109
- });
110
- test("checkDomain resolves actor keyIds case-insensitively, es256 only", () => {
111
- const from = checkDomain(parseDomainFile(domainText()));
112
- assert.equal(from.actorKeyName(ACTOR_KEY_ID), "studio");
113
- assert.equal(from.actorKeyName(ACTOR_KEY_ID.toUpperCase()), "studio");
114
- assert.equal(from.actorKeyName("00".repeat(32)), undefined);
115
- // An ed25519 key never actor-matches: actors are P-256.
116
- const edPub = generateKeyPairSync("ed25519").publicKey.export({ type: "spki", format: "der" });
117
- const edOnly = parseDomainFile(domainText({ keys: { press: { alg: "ed25519", publicKey: edPub.subarray(edPub.length - 32).toString("base64") } } }));
118
- const edFingerprint = keyFingerprint(edOnly.keys["press"]);
119
- assert.equal(checkDomain(edOnly).actorKeyName(edFingerprint), undefined);
120
- });
121
- // ---------------------------------------------------------------------------
122
- // check --from: the domain line
123
- // ---------------------------------------------------------------------------
124
- test("check --from: the real declared recording reads TRUE under its published key", async () => {
125
- const report = await checkIngest(await ingestProof(), { from: checkDomain(parseDomainFile(domainText())) });
126
- assert.equal(report.check, "bitgraph-check/2");
127
- assert.deepEqual(report.from, { domain: "acme.com", party: "Acme Corp" });
128
- const line = domainLineOf(onlyRecording(report));
129
- assert.equal(line.result, "TRUE");
130
- assert.match(line.detail, /actor key "studio" · published by acme\.com \(Acme Corp\)/);
131
- assert.ok(report.notChecked.some((n) => n.includes("pinned")));
132
- });
133
- test("check --from: a domain that never published the key reads UNDETERMINED, never FALSE", async () => {
134
- const otherKey = generateKeyPairSync("ec", { namedCurve: "P-256" })
135
- .publicKey.export({ type: "spki", format: "der" });
136
- const from = checkDomain(parseDomainFile(domainText({ keys: { invoices: { alg: "es256", publicKey: otherKey.toString("base64") } } })));
137
- const report = await checkIngest(await ingestProof(), { from });
138
- const line = domainLineOf(onlyRecording(report));
139
- assert.equal(line.result, "UNDETERMINED");
140
- assert.match(line.detail, /is not among the 1 key\(s\) acme\.com publishes/);
141
- });
142
- test("check --from: a recording that does not verify gets an UNDETERMINED domain line", async () => {
143
- const stripped = JSON.parse(proofBytes.toString("utf8"));
144
- delete stripped["agency"];
145
- const report = await checkIngest(await ingestProof(Buffer.from(JSON.stringify(stripped))), {
146
- from: checkDomain(parseDomainFile(domainText())),
147
- });
148
- const recording = onlyRecording(report);
149
- assert.equal(recording.lines.find((l) => l.name === "signature")?.result, "FALSE");
150
- const line = domainLineOf(recording);
151
- assert.equal(line.result, "UNDETERMINED");
152
- assert.match(line.detail, /is not verified here/);
153
- });
154
- test("check --from: a detached bitgraph-sig/1 under a published ed25519 key reads TRUE", async () => {
155
- const { publicKey, privateKey } = generateKeyPairSync("ed25519");
156
- const spki = publicKey.export({ type: "spki", format: "der" });
157
- const rawB64 = spki.subarray(spki.length - 32).toString("base64");
158
- const signature = cryptoSign(null, sigMessage(DIGEST_HEX), privateKey).toString("base64");
159
- const sigBytes = Buffer.from(JSON.stringify({
160
- sig: "bitgraph-sig/1",
161
- over: `sha256:${DIGEST_HEX}`,
162
- alg: "ed25519",
163
- publicKey: rawB64,
164
- signature,
165
- }));
166
- const from = checkDomain(parseDomainFile(domainText({ keys: { press: { alg: "ed25519", publicKey: rawB64 } } })));
167
- const sigEvidence = new Map([[createHash("sha256").update(sigBytes).digest("hex"), new Uint8Array(sigBytes)]]);
168
- const report = await checkIngest(await ingestProof(), { from, sigEvidence });
169
- const line = domainLineOf(onlyRecording(report));
170
- assert.equal(line.result, "TRUE");
171
- assert.match(line.detail, /signature by "press" · published by acme\.com/);
172
- });
173
- test("without --from the report stays bitgraph-check/1 with no from key and no domain line", async () => {
174
- const report = await checkIngest(await ingestProof());
175
- assert.equal(report.check, "bitgraph-check/1");
176
- assert.equal("from" in report, false);
177
- assert.equal(onlyRecording(report).lines.some((l) => l.name === "domain"), false);
178
- });
179
- // ---------------------------------------------------------------------------
180
- // The pin store
181
- // ---------------------------------------------------------------------------
182
- test("pin store: write, read, list, forget; malformed pins are refused at read", () => {
183
- const dir = mkdtempSync(join(tmpdir(), "bitgraph-pins-"));
184
- try {
185
- const path = writePin("acme.com", Buffer.from(domainText()), dir);
186
- assert.ok(path.endsWith("acme.com"));
187
- const pin = readPin("acme.com", dir);
188
- assert.equal(pin?.file.party, "Acme Corp");
189
- assert.equal(pin?.bytes.toString("utf8"), domainText());
190
- // A stored file naming a different domain is refused: the store binds
191
- // name to statement, so a bad write cannot impersonate.
192
- writePin("evil.example", Buffer.from(domainText()), dir);
193
- assert.throws(() => readPin("evil.example", dir), DomainFileError);
194
- writePin("broken.example", Buffer.from("{"), dir);
195
- assert.throws(() => readPin("broken.example", dir), DomainFileError);
196
- const listed = listPins(dir);
197
- assert.deepEqual(listed.map((p) => [p.domain, p.malformed]), [
198
- ["acme.com", false],
199
- ["broken.example", true],
200
- ["evil.example", true],
201
- ]);
202
- assert.equal(listed[0]?.party, "Acme Corp");
203
- assert.equal(listed[0]?.keyCount, 1);
204
- assert.equal(forgetPin("acme.com", dir), true);
205
- assert.equal(readPin("acme.com", dir), undefined);
206
- assert.equal(forgetPin("acme.com", dir), false);
207
- }
208
- finally {
209
- rmSync(dir, { recursive: true, force: true });
210
- }
211
- });
212
- // ---------------------------------------------------------------------------
213
- // The fetch (injected; the only networked verb)
214
- // ---------------------------------------------------------------------------
215
- function fakeFetch(body, status = 200) {
216
- const urls = [];
217
- const impl = (url) => {
218
- urls.push(url);
219
- return Promise.resolve({
220
- ok: status >= 200 && status < 300,
221
- status,
222
- headers: { get: () => null },
223
- arrayBuffer: () => {
224
- const buf = Buffer.from(body);
225
- return Promise.resolve(buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength));
226
- },
227
- });
228
- };
229
- return { impl, urls };
230
- }
231
- test("fetchDomainFile: fixed well-known path, verbatim bytes, strict domain binding", async () => {
232
- const { impl, urls } = fakeFetch(domainText());
233
- const fetched = await fetchDomainFile("acme.com", impl);
234
- assert.deepEqual(urls, ["https://acme.com/.well-known/bitgraph"]);
235
- assert.equal(fetched.file.party, "Acme Corp");
236
- assert.equal(fetched.bytes.toString("utf8"), domainText());
237
- // The served file names acme.com; pinning it as another.example must
238
- // refuse: a redirect cannot repoint the name.
239
- await assert.rejects(fetchDomainFile("another.example", fakeFetch(domainText()).impl), DomainFileError);
240
- await assert.rejects(fetchDomainFile("acme.com", fakeFetch("nope", 404).impl), /HTTP 404/);
241
- await assert.rejects(fetchDomainFile("acme.com", fakeFetch(Buffer.alloc(70_000)).impl), /the cap is/);
242
- await assert.rejects(fetchDomainFile("https://acme.com", fakeFetch(domainText()).impl), /bare hostname/);
243
- });
244
- // ---------------------------------------------------------------------------
245
- // Re-pin diffs
246
- // ---------------------------------------------------------------------------
247
- test("diffDomainFiles reports added, removed, changed, and a renamed party", () => {
248
- const edPub = generateKeyPairSync("ed25519").publicKey.export({ type: "spki", format: "der" });
249
- const edB64 = edPub.subarray(edPub.length - 32).toString("base64");
250
- const before = parseDomainFile(domainText());
251
- const after = parseDomainFile(domainText({
252
- party: "Acme Corporation",
253
- keys: {
254
- studio: { alg: "ed25519", publicKey: edB64 },
255
- press: { alg: "ed25519", publicKey: edB64 },
256
- },
257
- }));
258
- const diff = diffDomainFiles(before, after);
259
- assert.deepEqual(diff.partyChanged, { before: "Acme Corp", after: "Acme Corporation" });
260
- assert.deepEqual(diff.added.map((r) => r.name), ["press"]);
261
- assert.deepEqual(diff.removed.map((r) => r.name), []);
262
- assert.deepEqual(diff.changed.map((c) => c.name), ["studio"]);
263
- assert.equal(diff.unchanged, 0);
264
- });
265
- //# sourceMappingURL=domain.test.js.map
@@ -1 +0,0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C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IACtD,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9D,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC"}
package/dist/domain.d.ts DELETED
@@ -1,64 +0,0 @@
1
- import type { CheckDomain } from "./check.js";
2
- import type { TrustedKey } from "./sig.js";
3
- export declare const DOMAIN_FILE_VERSION = "bitgraph-domain/1";
4
- export declare const DOMAIN_WELL_KNOWN_PATH = "/.well-known/bitgraph";
5
- export declare const DOMAIN_FILE_MAX_BYTES = 65536;
6
- export interface DomainFile {
7
- version: "bitgraph-domain/1";
8
- /** Lowercase hostname; the binding. Must equal the domain the reader asked for. */
9
- domain: string;
10
- /** The name the domain gives itself. Display only. */
11
- party: string;
12
- /** SPEC §9.1 trusted-key bodies, named. */
13
- keys: Record<string, TrustedKey>;
14
- }
15
- export declare class DomainFileError extends Error {
16
- readonly issues: readonly string[];
17
- constructor(issues: string[]);
18
- }
19
- export declare function isDomainName(s: string): boolean;
20
- /**
21
- * Parse and validate a bitgraph-domain/1 file. Strict: unknown fields are
22
- * errors (additions are a new format version), and key material that does
23
- * not decode is refused here rather than stored, so a pin can never hold
24
- * keys that silently match nothing. Throws DomainFileError with every
25
- * issue found.
26
- */
27
- export declare function parseDomainFile(input: Uint8Array | string, expectedDomain?: string): DomainFile;
28
- /**
29
- * Lowercase hex SHA-256 of the decoded publicKey bytes. For es256 this is
30
- * exactly the actor keyId (hex SHA-256 of the SPKI DER). Undefined when
31
- * the material does not decode, which parseDomainFile refuses anyway.
32
- */
33
- export declare function keyFingerprint(key: TrustedKey): string | undefined;
34
- export interface DomainKeyRef {
35
- name: string;
36
- key: TrustedKey;
37
- fingerprint: string;
38
- }
39
- /** Every key with its derived fingerprint, name order. */
40
- export declare function domainKeyRefs(file: DomainFile): DomainKeyRef[];
41
- export interface DomainDiff {
42
- partyChanged?: {
43
- before: string;
44
- after: string;
45
- };
46
- added: DomainKeyRef[];
47
- removed: DomainKeyRef[];
48
- changed: {
49
- name: string;
50
- before: DomainKeyRef;
51
- after: DomainKeyRef;
52
- }[];
53
- unchanged: number;
54
- }
55
- /** What a re-pin would change, for showing before asking. */
56
- export declare function diffDomainFiles(before: DomainFile, after: DomainFile): DomainDiff;
57
- /**
58
- * The check-report adapter: what `check --from` consults per recording.
59
- * Defined as an interface in check.ts so the check module (which also
60
- * builds verify.html) never imports the crypto this module uses; the CLI
61
- * hands the report builder this object.
62
- */
63
- export declare function checkDomain(file: DomainFile): CheckDomain;
64
- //# sourceMappingURL=domain.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../src/domain.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AACvD,eAAO,MAAM,sBAAsB,0BAA0B,CAAC;AAC9D,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAE5C,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,mFAAmF;IACnF,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CAClC;AAED,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;gBACvB,MAAM,EAAE,MAAM,EAAE;CAK7B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