@mikeargento/bitgraph 1.9.0 → 1.9.2
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 +1 -1
- package/README.md +58 -35
- package/dist/constructor.js +1 -1
- package/dist/constructor.js.map +1 -1
- package/dist/fuse-cli.js +1 -1
- package/dist/fuse-cli.js.map +1 -1
- package/dist/fuse.js +1 -1
- package/dist/fuse.js.map +1 -1
- package/dist/host.js +1 -1
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/policy.js +1 -1
- package/dist/policy.js.map +1 -1
- package/package.json +23 -8
- package/src/constructor.ts +1 -1
- package/src/fuse-cli.ts +1 -1
- package/src/fuse.ts +1 -1
- package/src/host.ts +1 -1
- package/src/index.ts +3 -2
- package/src/policy.ts +1 -1
- package/dist/__tests__/audit-anchors.test.d.ts +0 -2
- package/dist/__tests__/audit-anchors.test.d.ts.map +0 -1
- package/dist/__tests__/audit-anchors.test.js +0 -152
- package/dist/__tests__/audit-anchors.test.js.map +0 -1
- package/dist/__tests__/audit-anomalies.test.d.ts +0 -2
- package/dist/__tests__/audit-anomalies.test.d.ts.map +0 -1
- package/dist/__tests__/audit-anomalies.test.js +0 -663
- package/dist/__tests__/audit-anomalies.test.js.map +0 -1
- package/dist/__tests__/audit-attestation.test.d.ts +0 -2
- package/dist/__tests__/audit-attestation.test.d.ts.map +0 -1
- package/dist/__tests__/audit-attestation.test.js +0 -403
- package/dist/__tests__/audit-attestation.test.js.map +0 -1
- package/dist/__tests__/audit-bench-smoke.test.d.ts +0 -2
- package/dist/__tests__/audit-bench-smoke.test.d.ts.map +0 -1
- package/dist/__tests__/audit-bench-smoke.test.js +0 -87
- package/dist/__tests__/audit-bench-smoke.test.js.map +0 -1
- package/dist/__tests__/audit-boundary.test.d.ts +0 -20
- package/dist/__tests__/audit-boundary.test.d.ts.map +0 -1
- package/dist/__tests__/audit-boundary.test.js +0 -84
- package/dist/__tests__/audit-boundary.test.js.map +0 -1
- package/dist/__tests__/audit-cli.test.d.ts +0 -2
- package/dist/__tests__/audit-cli.test.d.ts.map +0 -1
- package/dist/__tests__/audit-cli.test.js +0 -239
- package/dist/__tests__/audit-cli.test.js.map +0 -1
- package/dist/__tests__/audit-dependencies.test.d.ts +0 -2
- package/dist/__tests__/audit-dependencies.test.d.ts.map +0 -1
- package/dist/__tests__/audit-dependencies.test.js +0 -116
- package/dist/__tests__/audit-dependencies.test.js.map +0 -1
- package/dist/__tests__/audit-fixtures.d.ts +0 -265
- package/dist/__tests__/audit-fixtures.d.ts.map +0 -1
- package/dist/__tests__/audit-fixtures.js +0 -511
- package/dist/__tests__/audit-fixtures.js.map +0 -1
- package/dist/__tests__/audit-ingest.test.d.ts +0 -2
- package/dist/__tests__/audit-ingest.test.d.ts.map +0 -1
- package/dist/__tests__/audit-ingest.test.js +0 -473
- package/dist/__tests__/audit-ingest.test.js.map +0 -1
- package/dist/__tests__/audit-memory-ingest.test.d.ts +0 -12
- package/dist/__tests__/audit-memory-ingest.test.d.ts.map +0 -1
- package/dist/__tests__/audit-memory-ingest.test.js +0 -135
- package/dist/__tests__/audit-memory-ingest.test.js.map +0 -1
- package/dist/__tests__/audit-property.test.d.ts +0 -2
- package/dist/__tests__/audit-property.test.d.ts.map +0 -1
- package/dist/__tests__/audit-property.test.js +0 -771
- package/dist/__tests__/audit-property.test.js.map +0 -1
- package/dist/__tests__/audit-real-fixtures.test.d.ts +0 -2
- package/dist/__tests__/audit-real-fixtures.test.d.ts.map +0 -1
- package/dist/__tests__/audit-real-fixtures.test.js +0 -132
- package/dist/__tests__/audit-real-fixtures.test.js.map +0 -1
- package/dist/__tests__/audit-real-live.test.d.ts +0 -2
- package/dist/__tests__/audit-real-live.test.d.ts.map +0 -1
- package/dist/__tests__/audit-real-live.test.js +0 -107
- package/dist/__tests__/audit-real-live.test.js.map +0 -1
- package/dist/__tests__/audit-reconstruct.test.d.ts +0 -2
- package/dist/__tests__/audit-reconstruct.test.d.ts.map +0 -1
- package/dist/__tests__/audit-reconstruct.test.js +0 -287
- package/dist/__tests__/audit-reconstruct.test.js.map +0 -1
- package/dist/__tests__/audit-report.test.d.ts +0 -2
- package/dist/__tests__/audit-report.test.d.ts.map +0 -1
- package/dist/__tests__/audit-report.test.js +0 -186
- package/dist/__tests__/audit-report.test.js.map +0 -1
- package/dist/__tests__/audit-roundtrip.test.d.ts +0 -2
- package/dist/__tests__/audit-roundtrip.test.d.ts.map +0 -1
- package/dist/__tests__/audit-roundtrip.test.js +0 -368
- package/dist/__tests__/audit-roundtrip.test.js.map +0 -1
- package/dist/__tests__/audit-temporal.test.d.ts +0 -2
- package/dist/__tests__/audit-temporal.test.d.ts.map +0 -1
- package/dist/__tests__/audit-temporal.test.js +0 -364
- package/dist/__tests__/audit-temporal.test.js.map +0 -1
- package/dist/__tests__/audit-tiers.test.d.ts +0 -2
- package/dist/__tests__/audit-tiers.test.d.ts.map +0 -1
- package/dist/__tests__/audit-tiers.test.js +0 -282
- package/dist/__tests__/audit-tiers.test.js.map +0 -1
- package/dist/__tests__/audit-witness-real.test.d.ts +0 -19
- package/dist/__tests__/audit-witness-real.test.d.ts.map +0 -1
- package/dist/__tests__/audit-witness-real.test.js +0 -82
- package/dist/__tests__/audit-witness-real.test.js.map +0 -1
- package/dist/__tests__/audit-witness.test.d.ts +0 -2
- package/dist/__tests__/audit-witness.test.d.ts.map +0 -1
- package/dist/__tests__/audit-witness.test.js +0 -308
- package/dist/__tests__/audit-witness.test.js.map +0 -1
- package/dist/__tests__/canonical.test.d.ts +0 -2
- package/dist/__tests__/canonical.test.d.ts.map +0 -1
- package/dist/__tests__/canonical.test.js +0 -162
- package/dist/__tests__/canonical.test.js.map +0 -1
- package/dist/__tests__/chain-hash-anchor.test.d.ts +0 -22
- package/dist/__tests__/chain-hash-anchor.test.d.ts.map +0 -1
- package/dist/__tests__/chain-hash-anchor.test.js +0 -55
- package/dist/__tests__/chain-hash-anchor.test.js.map +0 -1
- package/dist/__tests__/commit-service.integration.test.d.ts +0 -2
- package/dist/__tests__/commit-service.integration.test.d.ts.map +0 -1
- package/dist/__tests__/commit-service.integration.test.js +0 -95
- package/dist/__tests__/commit-service.integration.test.js.map +0 -1
- package/dist/__tests__/constructor.test.d.ts +0 -2
- package/dist/__tests__/constructor.test.d.ts.map +0 -1
- package/dist/__tests__/constructor.test.js +0 -267
- package/dist/__tests__/constructor.test.js.map +0 -1
- package/dist/__tests__/declared-proof-fixture.d.ts +0 -66
- package/dist/__tests__/declared-proof-fixture.d.ts.map +0 -1
- package/dist/__tests__/declared-proof-fixture.js +0 -66
- package/dist/__tests__/declared-proof-fixture.js.map +0 -1
- package/dist/__tests__/fuse-placement.test.d.ts +0 -2
- package/dist/__tests__/fuse-placement.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-placement.test.js +0 -31
- package/dist/__tests__/fuse-placement.test.js.map +0 -1
- package/dist/__tests__/fuse-roundtrip.test.d.ts +0 -2
- package/dist/__tests__/fuse-roundtrip.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-roundtrip.test.js +0 -241
- package/dist/__tests__/fuse-roundtrip.test.js.map +0 -1
- package/dist/__tests__/fuse-sdk.test.d.ts +0 -2
- package/dist/__tests__/fuse-sdk.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-sdk.test.js +0 -117
- package/dist/__tests__/fuse-sdk.test.js.map +0 -1
- package/dist/__tests__/fuse-set-sdk.test.d.ts +0 -2
- package/dist/__tests__/fuse-set-sdk.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-set-sdk.test.js +0 -721
- package/dist/__tests__/fuse-set-sdk.test.js.map +0 -1
- package/dist/__tests__/fuse-set.test.d.ts +0 -2
- package/dist/__tests__/fuse-set.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-set.test.js +0 -868
- package/dist/__tests__/fuse-set.test.js.map +0 -1
- package/dist/__tests__/fuse-set2.test.d.ts +0 -2
- package/dist/__tests__/fuse-set2.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-set2.test.js +0 -294
- package/dist/__tests__/fuse-set2.test.js.map +0 -1
- package/dist/__tests__/fuse-vectors.test.d.ts +0 -2
- package/dist/__tests__/fuse-vectors.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-vectors.test.js +0 -175
- package/dist/__tests__/fuse-vectors.test.js.map +0 -1
- package/dist/__tests__/fuse-verify.test.d.ts +0 -2
- package/dist/__tests__/fuse-verify.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-verify.test.js +0 -250
- package/dist/__tests__/fuse-verify.test.js.map +0 -1
- package/dist/__tests__/hello-world.test.d.ts +0 -2
- package/dist/__tests__/hello-world.test.d.ts.map +0 -1
- package/dist/__tests__/hello-world.test.js +0 -9
- package/dist/__tests__/hello-world.test.js.map +0 -1
- package/dist/__tests__/mock-proof-fixture.d.ts +0 -15
- package/dist/__tests__/mock-proof-fixture.d.ts.map +0 -1
- package/dist/__tests__/mock-proof-fixture.js +0 -34
- package/dist/__tests__/mock-proof-fixture.js.map +0 -1
- package/dist/__tests__/policy-enforcement.test.d.ts +0 -2
- package/dist/__tests__/policy-enforcement.test.d.ts.map +0 -1
- package/dist/__tests__/policy-enforcement.test.js +0 -188
- package/dist/__tests__/policy-enforcement.test.js.map +0 -1
- package/dist/__tests__/proof-hash-regression.test.d.ts +0 -2
- package/dist/__tests__/proof-hash-regression.test.d.ts.map +0 -1
- package/dist/__tests__/proof-hash-regression.test.js +0 -95
- package/dist/__tests__/proof-hash-regression.test.js.map +0 -1
- package/dist/__tests__/proof-hash.test.d.ts +0 -2
- package/dist/__tests__/proof-hash.test.d.ts.map +0 -1
- package/dist/__tests__/proof-hash.test.js +0 -116
- package/dist/__tests__/proof-hash.test.js.map +0 -1
- package/dist/__tests__/proof-integrity.test.d.ts +0 -2
- package/dist/__tests__/proof-integrity.test.d.ts.map +0 -1
- package/dist/__tests__/proof-integrity.test.js +0 -426
- package/dist/__tests__/proof-integrity.test.js.map +0 -1
- package/dist/__tests__/realistic-proof-fixture.d.ts +0 -56
- package/dist/__tests__/realistic-proof-fixture.d.ts.map +0 -1
- package/dist/__tests__/realistic-proof-fixture.js +0 -57
- package/dist/__tests__/realistic-proof-fixture.js.map +0 -1
- package/dist/__tests__/verifier.test.d.ts +0 -2
- package/dist/__tests__/verifier.test.d.ts.map +0 -1
- package/dist/__tests__/verifier.test.js +0 -531
- package/dist/__tests__/verifier.test.js.map +0 -1
- package/dist/canonical.d.ts +0 -54
- package/dist/canonical.d.ts.map +0 -1
- package/dist/canonical.js +0 -119
- package/dist/canonical.js.map +0 -1
- package/dist/proof-hash.d.ts +0 -9
- package/dist/proof-hash.d.ts.map +0 -1
- package/dist/proof-hash.js +0 -75
- package/dist/proof-hash.js.map +0 -1
- package/dist/types.d.ts +0 -705
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
- package/dist/verifier.d.ts +0 -27
- package/dist/verifier.d.ts.map +0 -1
- package/dist/verifier.js +0 -844
- package/dist/verifier.js.map +0 -1
- package/src/__tests__/audit-anchors.test.ts +0 -188
- package/src/__tests__/audit-anomalies.test.ts +0 -815
- package/src/__tests__/audit-attestation.test.ts +0 -529
- package/src/__tests__/audit-bench-smoke.test.ts +0 -108
- package/src/__tests__/audit-boundary.test.ts +0 -96
- package/src/__tests__/audit-cli.test.ts +0 -288
- package/src/__tests__/audit-dependencies.test.ts +0 -141
- package/src/__tests__/audit-fixtures.ts +0 -736
- package/src/__tests__/audit-ingest.test.ts +0 -575
- package/src/__tests__/audit-memory-ingest.test.ts +0 -156
- package/src/__tests__/audit-property.test.ts +0 -892
- package/src/__tests__/audit-real-fixtures.test.ts +0 -153
- package/src/__tests__/audit-real-live.test.ts +0 -128
- package/src/__tests__/audit-reconstruct.test.ts +0 -353
- package/src/__tests__/audit-report.test.ts +0 -222
- package/src/__tests__/audit-roundtrip.test.ts +0 -464
- package/src/__tests__/audit-temporal.test.ts +0 -446
- package/src/__tests__/audit-tiers.test.ts +0 -343
- package/src/__tests__/audit-witness-real.test.ts +0 -92
- package/src/__tests__/audit-witness.test.ts +0 -345
- package/src/__tests__/canonical.test.ts +0 -253
- package/src/__tests__/chain-hash-anchor.test.ts +0 -67
- package/src/__tests__/commit-service.integration.test.ts +0 -117
- package/src/__tests__/constructor.test.ts +0 -340
- package/src/__tests__/declared-proof-fixture.ts +0 -65
- package/src/__tests__/fuse-placement.test.ts +0 -32
- package/src/__tests__/fuse-roundtrip.test.ts +0 -243
- package/src/__tests__/fuse-sdk.test.ts +0 -142
- package/src/__tests__/fuse-set-sdk.test.ts +0 -852
- package/src/__tests__/fuse-set.test.ts +0 -1005
- package/src/__tests__/fuse-set2.test.ts +0 -343
- package/src/__tests__/fuse-vectors.test.ts +0 -218
- package/src/__tests__/fuse-verify.test.ts +0 -278
- package/src/__tests__/hello-world.test.ts +0 -10
- package/src/__tests__/mock-proof-fixture.ts +0 -36
- package/src/__tests__/policy-enforcement.test.ts +0 -226
- package/src/__tests__/proof-hash-regression.test.ts +0 -107
- package/src/__tests__/proof-hash.test.ts +0 -129
- package/src/__tests__/proof-integrity.test.ts +0 -541
- package/src/__tests__/real-fixtures/anchor-after-112762.json +0 -47
- package/src/__tests__/real-fixtures/anchor-with-ethereum-112758.json +0 -47
- package/src/__tests__/real-fixtures/live-proof-0.json +0 -42
- package/src/__tests__/real-fixtures/live-proof-1.json +0 -43
- package/src/__tests__/real-fixtures/live-proof-2.json +0 -43
- package/src/__tests__/real-fixtures/successor-112760.json +0 -38
- package/src/__tests__/real-fixtures/witness-25525146.json +0 -6
- package/src/__tests__/real-fixtures/witness-25525147.json +0 -6
- package/src/__tests__/realistic-proof-fixture.ts +0 -57
- package/src/__tests__/verifier.test.ts +0 -624
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Mike Argento. All rights reserved. See LICENSE.
|
|
2
|
-
// End-to-end test for the BitGraph policy enforcement pipeline.
|
|
3
|
-
import { test, describe } from "node:test";
|
|
4
|
-
import * as assert from "node:assert/strict";
|
|
5
|
-
import { tmpdir } from "node:os";
|
|
6
|
-
import { mkdirSync } from "node:fs";
|
|
7
|
-
import { join } from "node:path";
|
|
8
|
-
import { Constructor } from "../constructor.js";
|
|
9
|
-
import { canonicalize } from "../index.js";
|
|
10
|
-
import { hashPolicy, createPolicyBinding } from "../policy.js";
|
|
11
|
-
import { sha256 } from "@noble/hashes/sha256";
|
|
12
|
-
// Inline stub host for test isolation — dynamic import avoids tsc dist conflicts
|
|
13
|
-
async function createTestHost(statePath) {
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
15
|
-
const mod = await import("bitgraph-stub");
|
|
16
|
-
const StubHost = mod.StubHost ?? mod.default?.StubHost;
|
|
17
|
-
return StubHost.createPersistent({
|
|
18
|
-
statePath,
|
|
19
|
-
measurement: "test",
|
|
20
|
-
enableTime: true,
|
|
21
|
-
enableCounter: true,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
const TEST_POLICY = `# Policy: Test Policy
|
|
25
|
-
version: 2.0
|
|
26
|
-
|
|
27
|
-
## Allowed Tools
|
|
28
|
-
- search
|
|
29
|
-
- read_file
|
|
30
|
-
|
|
31
|
-
## Limits
|
|
32
|
-
- max_actions: 100
|
|
33
|
-
- rate_limit: 10/min
|
|
34
|
-
`;
|
|
35
|
-
const TEST_POLICY_REVOKED = `# Policy: Test Policy Revoked
|
|
36
|
-
version: 3.0
|
|
37
|
-
|
|
38
|
-
## Allowed Tools
|
|
39
|
-
- search
|
|
40
|
-
|
|
41
|
-
## Limits
|
|
42
|
-
- max_actions: 50
|
|
43
|
-
`;
|
|
44
|
-
describe("Policy Enforcement Pipeline", () => {
|
|
45
|
-
test("policy binding is created from markdown", () => {
|
|
46
|
-
const binding = createPolicyBinding(TEST_POLICY);
|
|
47
|
-
assert.ok(binding.digestB64, "should have digestB64");
|
|
48
|
-
assert.equal(binding.name, "Test Policy");
|
|
49
|
-
assert.equal(binding.version, "2.0");
|
|
50
|
-
});
|
|
51
|
-
test("policy committed as slot 0 with binding in proof", async () => {
|
|
52
|
-
const testDir = join(tmpdir(), `bitgraph-test-${Date.now()}`);
|
|
53
|
-
mkdirSync(testDir, { recursive: true });
|
|
54
|
-
const stub = await createTestHost(join(testDir, "state.json"));
|
|
55
|
-
const constructor = await Constructor.initialize({
|
|
56
|
-
host: stub.host,
|
|
57
|
-
policy: { requireCounter: true, requireTime: true },
|
|
58
|
-
});
|
|
59
|
-
const binding = createPolicyBinding(TEST_POLICY);
|
|
60
|
-
const policyDigest = hashPolicy(TEST_POLICY);
|
|
61
|
-
const policyProof = await constructor.commitDigest({
|
|
62
|
-
digestB64: policyDigest,
|
|
63
|
-
metadata: { kind: "policy-commitment", policyName: binding.name },
|
|
64
|
-
policy: binding,
|
|
65
|
-
});
|
|
66
|
-
assert.ok(policyProof, "should return a proof");
|
|
67
|
-
assert.equal(policyProof.commit.counter, "1");
|
|
68
|
-
assert.ok(policyProof.policy, "proof should have policy field");
|
|
69
|
-
assert.equal(policyProof.policy.digestB64, policyDigest);
|
|
70
|
-
assert.equal(policyProof.policy.name, "Test Policy");
|
|
71
|
-
const proofHash = Buffer.from(sha256(canonicalize(policyProof))).toString("base64");
|
|
72
|
-
binding.authorProofDigestB64 = proofHash;
|
|
73
|
-
assert.ok(binding.authorProofDigestB64);
|
|
74
|
-
});
|
|
75
|
-
test("action proofs carry the policy binding", async () => {
|
|
76
|
-
const testDir = join(tmpdir(), `bitgraph-test-${Date.now()}`);
|
|
77
|
-
mkdirSync(testDir, { recursive: true });
|
|
78
|
-
const stub = await createTestHost(join(testDir, "state.json"));
|
|
79
|
-
const constructor = await Constructor.initialize({
|
|
80
|
-
host: stub.host,
|
|
81
|
-
policy: { requireCounter: true, requireTime: true },
|
|
82
|
-
});
|
|
83
|
-
const binding = createPolicyBinding(TEST_POLICY);
|
|
84
|
-
const policyDigest = hashPolicy(TEST_POLICY);
|
|
85
|
-
const policyProof = await constructor.commitDigest({
|
|
86
|
-
digestB64: policyDigest,
|
|
87
|
-
metadata: { kind: "policy-commitment" },
|
|
88
|
-
policy: binding,
|
|
89
|
-
});
|
|
90
|
-
const proofHash = Buffer.from(sha256(canonicalize(policyProof))).toString("base64");
|
|
91
|
-
binding.authorProofDigestB64 = proofHash;
|
|
92
|
-
const actionDigest = Buffer.from(sha256(new TextEncoder().encode("search:query"))).toString("base64");
|
|
93
|
-
const actionProof = await constructor.commitDigest({
|
|
94
|
-
digestB64: actionDigest,
|
|
95
|
-
metadata: { kind: "tool-execution", tool: "search" },
|
|
96
|
-
prevProofHashB64: proofHash,
|
|
97
|
-
policy: binding,
|
|
98
|
-
});
|
|
99
|
-
assert.ok(actionProof.policy, "action proof should have policy");
|
|
100
|
-
assert.equal(actionProof.policy.digestB64, policyDigest);
|
|
101
|
-
assert.equal(actionProof.policy.authorProofDigestB64, proofHash);
|
|
102
|
-
assert.equal(actionProof.commit.counter, "2");
|
|
103
|
-
});
|
|
104
|
-
test("policy revocation updates binding", async () => {
|
|
105
|
-
const testDir = join(tmpdir(), `bitgraph-test-${Date.now()}`);
|
|
106
|
-
mkdirSync(testDir, { recursive: true });
|
|
107
|
-
const stub = await createTestHost(join(testDir, "state.json"));
|
|
108
|
-
const constructor = await Constructor.initialize({
|
|
109
|
-
host: stub.host,
|
|
110
|
-
policy: { requireCounter: true, requireTime: true },
|
|
111
|
-
});
|
|
112
|
-
// Slot 0: original policy
|
|
113
|
-
const originalBinding = createPolicyBinding(TEST_POLICY);
|
|
114
|
-
const originalDigest = hashPolicy(TEST_POLICY);
|
|
115
|
-
const slot0Proof = await constructor.commitDigest({
|
|
116
|
-
digestB64: originalDigest,
|
|
117
|
-
metadata: { kind: "policy-commitment" },
|
|
118
|
-
policy: originalBinding,
|
|
119
|
-
});
|
|
120
|
-
const slot0Hash = Buffer.from(sha256(canonicalize(slot0Proof))).toString("base64");
|
|
121
|
-
originalBinding.authorProofDigestB64 = slot0Hash;
|
|
122
|
-
// Action under original policy
|
|
123
|
-
const action1 = await constructor.commitDigest({
|
|
124
|
-
digestB64: Buffer.from(sha256(new TextEncoder().encode("action1"))).toString("base64"),
|
|
125
|
-
metadata: { kind: "tool-execution", tool: "read_file" },
|
|
126
|
-
prevProofHashB64: slot0Hash,
|
|
127
|
-
policy: originalBinding,
|
|
128
|
-
});
|
|
129
|
-
assert.equal(action1.policy.digestB64, originalDigest);
|
|
130
|
-
// Revoke: commit new policy
|
|
131
|
-
const revokedBinding = createPolicyBinding(TEST_POLICY_REVOKED);
|
|
132
|
-
const revokedDigest = hashPolicy(TEST_POLICY_REVOKED);
|
|
133
|
-
const action1Hash = Buffer.from(sha256(canonicalize(action1))).toString("base64");
|
|
134
|
-
const revokeProof = await constructor.commitDigest({
|
|
135
|
-
digestB64: revokedDigest,
|
|
136
|
-
metadata: { kind: "policy-change", removed: ["read_file"] },
|
|
137
|
-
prevProofHashB64: action1Hash,
|
|
138
|
-
policy: revokedBinding,
|
|
139
|
-
});
|
|
140
|
-
const revokeHash = Buffer.from(sha256(canonicalize(revokeProof))).toString("base64");
|
|
141
|
-
revokedBinding.authorProofDigestB64 = revokeHash;
|
|
142
|
-
// Action under new (revoked) policy
|
|
143
|
-
const action2 = await constructor.commitDigest({
|
|
144
|
-
digestB64: Buffer.from(sha256(new TextEncoder().encode("action2"))).toString("base64"),
|
|
145
|
-
metadata: { kind: "tool-execution", tool: "search" },
|
|
146
|
-
prevProofHashB64: revokeHash,
|
|
147
|
-
policy: revokedBinding,
|
|
148
|
-
});
|
|
149
|
-
assert.equal(action2.policy.digestB64, revokedDigest);
|
|
150
|
-
assert.equal(action2.policy.authorProofDigestB64, revokeHash);
|
|
151
|
-
assert.notEqual(action2.policy.digestB64, originalDigest);
|
|
152
|
-
});
|
|
153
|
-
test("causal ordering: policy counter < action counter", async () => {
|
|
154
|
-
const testDir = join(tmpdir(), `bitgraph-test-${Date.now()}`);
|
|
155
|
-
mkdirSync(testDir, { recursive: true });
|
|
156
|
-
const stub = await createTestHost(join(testDir, "state.json"));
|
|
157
|
-
const constructor = await Constructor.initialize({
|
|
158
|
-
host: stub.host,
|
|
159
|
-
policy: { requireCounter: true, requireTime: true },
|
|
160
|
-
});
|
|
161
|
-
const binding = createPolicyBinding(TEST_POLICY);
|
|
162
|
-
const policyProof = await constructor.commitDigest({
|
|
163
|
-
digestB64: hashPolicy(TEST_POLICY),
|
|
164
|
-
metadata: { kind: "policy-commitment" },
|
|
165
|
-
policy: binding,
|
|
166
|
-
});
|
|
167
|
-
const policyCounter = BigInt(policyProof.commit.counter ?? "0");
|
|
168
|
-
const proofHash = Buffer.from(sha256(canonicalize(policyProof))).toString("base64");
|
|
169
|
-
binding.authorProofDigestB64 = proofHash;
|
|
170
|
-
for (let i = 1; i <= 3; i++) {
|
|
171
|
-
const actionProof = await constructor.commitDigest({
|
|
172
|
-
digestB64: Buffer.from(sha256(new TextEncoder().encode(`action-${i}`))).toString("base64"),
|
|
173
|
-
metadata: { kind: "tool-execution", tool: "search" },
|
|
174
|
-
policy: binding,
|
|
175
|
-
});
|
|
176
|
-
const actionCounter = BigInt(actionProof.commit.counter ?? "0");
|
|
177
|
-
assert.ok(actionCounter > policyCounter, `action ${i} counter (${actionCounter}) > policy counter (${policyCounter})`);
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
test("hashPolicy produces consistent digest", () => {
|
|
181
|
-
const digest1 = hashPolicy(TEST_POLICY);
|
|
182
|
-
const digest2 = hashPolicy(TEST_POLICY);
|
|
183
|
-
assert.equal(digest1, digest2);
|
|
184
|
-
const digest3 = hashPolicy(TEST_POLICY_REVOKED);
|
|
185
|
-
assert.notEqual(digest1, digest3);
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
//# sourceMappingURL=policy-enforcement.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"policy-enforcement.test.js","sourceRoot":"","sources":["../../src/__tests__/policy-enforcement.test.ts"],"names":[],"m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;gBAC1F,QAAQ,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACpD,MAAM,EAAE,OAAO;aAChB,CAAC,CAAC;YACH,MAAM,aAAa,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,IAAI,GAAG,CAAC,CAAC;YAChE,MAAM,CAAC,EAAE,CAAC,aAAa,GAAG,aAAa,EAAE,UAAU,CAAC,aAAa,aAAa,uBAAuB,aAAa,GAAG,CAAC,CAAC;QACzH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,uCAAuC,EAAE,GAAG,EAAE;QACjD,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;QACxC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAE/B,MAAM,OAAO,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;QAChD,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proof-hash-regression.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/proof-hash-regression.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Regression test: all code paths must produce identical proofHash.
|
|
3
|
-
*
|
|
4
|
-
* Simulates the hash computation as done by:
|
|
5
|
-
* 1. computeProofHash() from bitgraph (canonical)
|
|
6
|
-
* 2. Inline signed-body + canonicalize + sha256 (how ledger s3.ts USED to do it)
|
|
7
|
-
* 3. Any other path
|
|
8
|
-
*
|
|
9
|
-
* If these ever diverge, this test fails.
|
|
10
|
-
*/
|
|
11
|
-
import { describe, it } from "node:test";
|
|
12
|
-
import * as assert from "node:assert/strict";
|
|
13
|
-
import { sha256 } from "@noble/hashes/sha256";
|
|
14
|
-
import { computeProofHash, canonicalize } from "../index.js";
|
|
15
|
-
// Fixture extracted verbatim to a shared non-test module so other suites
|
|
16
|
-
// (audit attestation honesty tests) can import it without re-registering
|
|
17
|
-
// this file's suites. Values unchanged.
|
|
18
|
-
import { REALISTIC_PROOF } from "./realistic-proof-fixture.js";
|
|
19
|
-
/**
|
|
20
|
-
* Inline signed-body hash — the OLD way ledger s3.ts computed it.
|
|
21
|
-
* This must produce the same result as computeProofHash().
|
|
22
|
-
*/
|
|
23
|
-
function inlineSignedBodyHash(proof) {
|
|
24
|
-
const signer = proof.signer;
|
|
25
|
-
const env = proof.environment;
|
|
26
|
-
const signedBody = {
|
|
27
|
-
version: proof.version,
|
|
28
|
-
artifact: proof.artifact,
|
|
29
|
-
commit: proof.commit,
|
|
30
|
-
publicKeyB64: signer.publicKeyB64,
|
|
31
|
-
enforcement: env.enforcement,
|
|
32
|
-
measurement: env.measurement,
|
|
33
|
-
};
|
|
34
|
-
if (proof.attribution)
|
|
35
|
-
signedBody.attribution = proof.attribution;
|
|
36
|
-
if (env.attestation)
|
|
37
|
-
signedBody.attestationFormat = env.attestation.format;
|
|
38
|
-
return Buffer.from(sha256(canonicalize(signedBody))).toString("base64");
|
|
39
|
-
}
|
|
40
|
-
describe("proof hash regression — all paths must agree", () => {
|
|
41
|
-
it("computeProofHash matches inline signed-body hash (with attribution)", () => {
|
|
42
|
-
const canonical = computeProofHash(REALISTIC_PROOF);
|
|
43
|
-
const inline = inlineSignedBodyHash(REALISTIC_PROOF);
|
|
44
|
-
assert.equal(canonical, inline, "hash drift detected: computeProofHash vs inline");
|
|
45
|
-
});
|
|
46
|
-
it("computeProofHash matches inline signed-body hash (without attribution)", () => {
|
|
47
|
-
const noAttr = { ...REALISTIC_PROOF };
|
|
48
|
-
delete noAttr.attribution;
|
|
49
|
-
const canonical = computeProofHash(noAttr);
|
|
50
|
-
const inline = inlineSignedBodyHash(noAttr);
|
|
51
|
-
assert.equal(canonical, inline, "hash drift detected without attribution");
|
|
52
|
-
});
|
|
53
|
-
it("computeProofHash matches inline signed-body hash (without attestation)", () => {
|
|
54
|
-
const noAttest = {
|
|
55
|
-
...REALISTIC_PROOF,
|
|
56
|
-
environment: {
|
|
57
|
-
enforcement: REALISTIC_PROOF.environment.enforcement,
|
|
58
|
-
measurement: REALISTIC_PROOF.environment.measurement,
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
const canonical = computeProofHash(noAttest);
|
|
62
|
-
const inline = inlineSignedBodyHash(noAttest);
|
|
63
|
-
assert.equal(canonical, inline, "hash drift detected without attestation");
|
|
64
|
-
});
|
|
65
|
-
it("anchor proof and user proof use the same hash function", () => {
|
|
66
|
-
// User proof (no attribution)
|
|
67
|
-
const userProof = { ...REALISTIC_PROOF };
|
|
68
|
-
delete userProof.attribution;
|
|
69
|
-
// Anchor proof (has attribution)
|
|
70
|
-
const anchorProof = REALISTIC_PROOF;
|
|
71
|
-
// Both should work with the same function
|
|
72
|
-
const userHash = computeProofHash(userProof);
|
|
73
|
-
const anchorHash = computeProofHash(anchorProof);
|
|
74
|
-
// They should be different (different inputs) but both valid
|
|
75
|
-
assert.notEqual(userHash, anchorHash, "user and anchor proofs with different data should differ");
|
|
76
|
-
assert.equal(Buffer.from(userHash, "base64").length, 32, "user hash should be SHA-256");
|
|
77
|
-
assert.equal(Buffer.from(anchorHash, "base64").length, 32, "anchor hash should be SHA-256");
|
|
78
|
-
});
|
|
79
|
-
it("adding slotAllocation or metadata does not change hash", () => {
|
|
80
|
-
const bare = { ...REALISTIC_PROOF };
|
|
81
|
-
delete bare.slotAllocation;
|
|
82
|
-
const withSlot = { ...REALISTIC_PROOF };
|
|
83
|
-
const withMetadata = {
|
|
84
|
-
...REALISTIC_PROOF,
|
|
85
|
-
metadata: { type: "ethereum-anchor", extra: true },
|
|
86
|
-
timestamps: { artifact: { time: 1234567890 } },
|
|
87
|
-
};
|
|
88
|
-
const bareHash = computeProofHash(bare);
|
|
89
|
-
const withSlotHash = computeProofHash(withSlot);
|
|
90
|
-
const withMetaHash = computeProofHash(withMetadata);
|
|
91
|
-
assert.equal(bareHash, withSlotHash, "slotAllocation should not affect hash");
|
|
92
|
-
assert.equal(bareHash, withMetaHash, "metadata/timestamps should not affect hash");
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
//# sourceMappingURL=proof-hash-regression.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proof-hash-regression.test.js","sourceRoot":"","sources":["../../src/__tests__/proof-hash-regression.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC7D,yEAAyE;AACzE,yEAAyE;AACzE,wCAAwC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D;;;GAGG;AACH,SAAS,oBAAoB,CAAC,KAA8B;IAC1D,MAAM,MAAM,GAAG,KAAK,CAAC,MAAkC,CAAC;IACxD,MAAM,GAAG,GAAG,KAAK,CAAC,WAA6F,CAAC;IAEhH,MAAM,UAAU,GAA4B;QAC1C,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,WAAW,EAAE,GAAG,CAAC,WAAW;KAC7B,CAAC;IACF,IAAI,KAAK,CAAC,WAAW;QAAE,UAAU,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;IAClE,IAAI,GA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C,IAAI,CAAC,CAAC;QACxC,MAAM,YAAY,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAChD,MAAM,YAAY,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAEpD,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,uCAAuC,CAAC,CAAC;QAC9E,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,4CAA4C,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proof-hash.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/proof-hash.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { describe, it } from "node:test";
|
|
2
|
-
import * as assert from "node:assert/strict";
|
|
3
|
-
import { sha256 } from "@noble/hashes/sha256";
|
|
4
|
-
import { computeProofHash, canonicalize } from "../index.js";
|
|
5
|
-
// Fixture moved verbatim to a shared non-test module so other suites can
|
|
6
|
-
// import it without re-registering this file's describes under node:test.
|
|
7
|
-
import { MOCK_PROOF } from "./mock-proof-fixture.js";
|
|
8
|
-
describe("computeProofHash", () => {
|
|
9
|
-
it("produces base64-encoded SHA-256", () => {
|
|
10
|
-
const hash = computeProofHash(MOCK_PROOF);
|
|
11
|
-
// Base64 of SHA-256 is always 44 chars (with padding)
|
|
12
|
-
assert.ok(hash.length > 0 && hash.length <= 44, `unexpected hash length: ${hash.length}`);
|
|
13
|
-
// Valid base64
|
|
14
|
-
const decoded = Buffer.from(hash, "base64");
|
|
15
|
-
assert.equal(decoded.length, 32, "SHA-256 output should be 32 bytes");
|
|
16
|
-
});
|
|
17
|
-
it("matches manual signed-body computation", () => {
|
|
18
|
-
const signedBody = {
|
|
19
|
-
version: MOCK_PROOF.version,
|
|
20
|
-
artifact: MOCK_PROOF.artifact,
|
|
21
|
-
commit: MOCK_PROOF.commit,
|
|
22
|
-
publicKeyB64: MOCK_PROOF.signer.publicKeyB64,
|
|
23
|
-
enforcement: MOCK_PROOF.environment.enforcement,
|
|
24
|
-
measurement: MOCK_PROOF.environment.measurement,
|
|
25
|
-
attribution: MOCK_PROOF.attribution,
|
|
26
|
-
attestationFormat: MOCK_PROOF.environment.attestation.format,
|
|
27
|
-
};
|
|
28
|
-
const expected = Buffer.from(sha256(canonicalize(signedBody))).toString("base64");
|
|
29
|
-
const actual = computeProofHash(MOCK_PROOF);
|
|
30
|
-
assert.equal(actual, expected, "computeProofHash must match manual signed-body hash");
|
|
31
|
-
});
|
|
32
|
-
it("is deterministic — same input always produces same output", () => {
|
|
33
|
-
const a = computeProofHash(MOCK_PROOF);
|
|
34
|
-
const b = computeProofHash(MOCK_PROOF);
|
|
35
|
-
assert.equal(a, b);
|
|
36
|
-
});
|
|
37
|
-
it("is not affected by key ordering in input", () => {
|
|
38
|
-
// Construct same proof with keys in different order
|
|
39
|
-
const reordered = {
|
|
40
|
-
environment: MOCK_PROOF.environment,
|
|
41
|
-
version: MOCK_PROOF.version,
|
|
42
|
-
signer: MOCK_PROOF.signer,
|
|
43
|
-
artifact: MOCK_PROOF.artifact,
|
|
44
|
-
commit: MOCK_PROOF.commit,
|
|
45
|
-
attribution: MOCK_PROOF.attribution,
|
|
46
|
-
};
|
|
47
|
-
assert.equal(computeProofHash(reordered), computeProofHash(MOCK_PROOF));
|
|
48
|
-
});
|
|
49
|
-
it("is not affected by metadata (outside signed body)", () => {
|
|
50
|
-
const withMetadata = {
|
|
51
|
-
...MOCK_PROOF,
|
|
52
|
-
metadata: { extra: "stuff", nested: { deep: true } },
|
|
53
|
-
timestamps: { artifact: { time: 12345 } },
|
|
54
|
-
};
|
|
55
|
-
assert.equal(computeProofHash(withMetadata), computeProofHash(MOCK_PROOF));
|
|
56
|
-
});
|
|
57
|
-
it("is not affected by signatureB64 (not in signed body)", () => {
|
|
58
|
-
const differentSig = {
|
|
59
|
-
...MOCK_PROOF,
|
|
60
|
-
signer: { ...MOCK_PROOF.signer, signatureB64: "completely-different-sig==" },
|
|
61
|
-
};
|
|
62
|
-
assert.equal(computeProofHash(differentSig), computeProofHash(MOCK_PROOF));
|
|
63
|
-
});
|
|
64
|
-
it("is not affected by attestation reportB64 (not in signed body)", () => {
|
|
65
|
-
const differentReport = {
|
|
66
|
-
...MOCK_PROOF,
|
|
67
|
-
environment: {
|
|
68
|
-
...MOCK_PROOF.environment,
|
|
69
|
-
attestation: { format: "aws-nitro", reportB64: "totally-different==" },
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
assert.equal(computeProofHash(differentReport), computeProofHash(MOCK_PROOF));
|
|
73
|
-
});
|
|
74
|
-
it("changes when artifact changes", () => {
|
|
75
|
-
const different = {
|
|
76
|
-
...MOCK_PROOF,
|
|
77
|
-
artifact: { hashAlg: "sha256", digestB64: "different==" },
|
|
78
|
-
};
|
|
79
|
-
assert.notEqual(computeProofHash(different), computeProofHash(MOCK_PROOF));
|
|
80
|
-
});
|
|
81
|
-
it("changes when counter changes", () => {
|
|
82
|
-
const different = {
|
|
83
|
-
...MOCK_PROOF,
|
|
84
|
-
commit: { ...MOCK_PROOF.commit, counter: "99" },
|
|
85
|
-
};
|
|
86
|
-
assert.notEqual(computeProofHash(different), computeProofHash(MOCK_PROOF));
|
|
87
|
-
});
|
|
88
|
-
it("changes when publicKeyB64 changes", () => {
|
|
89
|
-
const different = {
|
|
90
|
-
...MOCK_PROOF,
|
|
91
|
-
signer: { ...MOCK_PROOF.signer, publicKeyB64: "different-key==" },
|
|
92
|
-
};
|
|
93
|
-
assert.notEqual(computeProofHash(different), computeProofHash(MOCK_PROOF));
|
|
94
|
-
});
|
|
95
|
-
it("includes attribution when present", () => {
|
|
96
|
-
const without = { ...MOCK_PROOF };
|
|
97
|
-
delete without.attribution;
|
|
98
|
-
assert.notEqual(computeProofHash(without), computeProofHash(MOCK_PROOF));
|
|
99
|
-
});
|
|
100
|
-
it("includes attestationFormat when present", () => {
|
|
101
|
-
const withoutAttestation = {
|
|
102
|
-
...MOCK_PROOF,
|
|
103
|
-
environment: {
|
|
104
|
-
enforcement: MOCK_PROOF.environment.enforcement,
|
|
105
|
-
measurement: MOCK_PROOF.environment.measurement,
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
assert.notEqual(computeProofHash(withoutAttestation), computeProofHash(MOCK_PROOF));
|
|
109
|
-
});
|
|
110
|
-
it("works with Record<string, unknown> input (not just BitGraphProof)", () => {
|
|
111
|
-
const record = { ...MOCK_PROOF };
|
|
112
|
-
const hash = computeProofHash(record);
|
|
113
|
-
assert.equal(hash, computeProofHash(MOCK_PROOF));
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
//# sourceMappingURL=proof-hash.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proof-hash.test.js","sourceRoot":"","sources":["../../src/__tests__/proof-hash.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE7D,yEAAyE;AACzE,0EAA0E;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,MAAM,IAAI,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAC1C,sDAAsD;QACtD,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE,2BAA2B,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAC1F,eAAe;QACf,MAAM,OAAO,G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