Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/agent/test/encrypt-inline-policy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@ async function resolveEncryptInlinePayload(
contextGraphId: string,
publishContextGraphId?: string,
) {
// RFC-39 / LU-11 refactor extracted the access-policy probe + curated
// bootstrap into the private helper `_resolveCuratedChainKeyContext`,
// which `_resolveEncryptInlinePayload` now delegates to before returning
// either the AEAD callback or `undefined`. The lightweight `agentLike`
// harness in this file does not extend `DKGAgent.prototype`, so we must
// also bind the helper here — otherwise the first call throws
// `TypeError: this._resolveCuratedChainKeyContext is not a function`
// before any of the policy assertions below can run. All test cases in
// this file short-circuit inside the policy probe (public CG → undefined,
// unknown policy → throw) so they never touch the curated bootstrap
// dependencies (`createAndDistributeSwmSenderKeyEpoch` etc.).
agentLike._resolveCuratedChainKeyContext = (DKGAgent.prototype as any)
._resolveCuratedChainKeyContext;
return (DKGAgent.prototype as any)._resolveEncryptInlinePayload.call(
agentLike,
contextGraphId,
Expand Down
22 changes: 22 additions & 0 deletions packages/chain/src/mock-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,28 @@ export class MockChainAdapter implements ChainAdapter {
return id;
}

/**
* OT-RFC-39 LU-11 — resolve an EOA to its on-chain identityId.
*
* Mirrors `EVMChainAdapter.getIdentityIdForAddress` so the mock-backed
* fifth authorization path for `PROTOCOL_GET_CIPHERTEXT_CHUNK`
* (registered-node-operator auth in `dkg-agent`) can be exercised
* offline. Address lookups try both checksum and lowercase forms
* because `seedIdentity` stores whatever the caller passed.
*
* Returns `0n` for non-addresses or addresses with no seeded identity
* — matching Solidity's zero-init mapping semantics.
*/
async getIdentityIdForAddress(address: string): Promise<bigint> {
if (!ethers.isAddress(address)) return 0n;
const checksum = ethers.getAddress(address);
return (
this.identities.get(checksum) ??
this.identities.get(checksum.toLowerCase()) ??
0n
);
}

/**
* Test helper: seed a deterministic identity for an address in this in-memory adapter.
* Used by black-box daemon tests that need stable participant IDs across processes.
Expand Down
1 change: 1 addition & 0 deletions packages/node-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@vitejs/plugin-react": "^4",
"@vitest/coverage-v8": "^4.0.18",
"cross-env": "^10.1.0",
"happy-dom": "20.8.9",
"react": "^19",
"react-dom": "^19",
"react-router-dom": "^7",
Expand Down
Loading
Loading