ccip-router 0.1.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/LICENSE +21 -0
- package/README.md +528 -0
- package/contracts/AttestationIndex.sol +125 -0
- package/contracts/NodeRegistry.sol +85 -0
- package/dist/attestation/eip712.d.ts +50 -0
- package/dist/attestation/eip712.d.ts.map +1 -0
- package/dist/attestation/eip712.js +31 -0
- package/dist/attestation/eip712.js.map +1 -0
- package/dist/attestation/ocp.d.ts +9 -0
- package/dist/attestation/ocp.d.ts.map +1 -0
- package/dist/attestation/ocp.js +11 -0
- package/dist/attestation/ocp.js.map +1 -0
- package/dist/attestation/withWyriwe.d.ts +11 -0
- package/dist/attestation/withWyriwe.d.ts.map +1 -0
- package/dist/attestation/withWyriwe.js +92 -0
- package/dist/attestation/withWyriwe.js.map +1 -0
- package/dist/chain/abi.d.ts +178 -0
- package/dist/chain/abi.d.ts.map +1 -0
- package/dist/chain/abi.js +94 -0
- package/dist/chain/abi.js.map +1 -0
- package/dist/chain/client.d.ts +16762 -0
- package/dist/chain/client.d.ts.map +1 -0
- package/dist/chain/client.js +21 -0
- package/dist/chain/client.js.map +1 -0
- package/dist/chain/publish.d.ts +26 -0
- package/dist/chain/publish.d.ts.map +1 -0
- package/dist/chain/publish.js +66 -0
- package/dist/chain/publish.js.map +1 -0
- package/dist/chain/register.d.ts +9 -0
- package/dist/chain/register.d.ts.map +1 -0
- package/dist/chain/register.js +20 -0
- package/dist/chain/register.js.map +1 -0
- package/dist/crypto/hash.d.ts +3 -0
- package/dist/crypto/hash.d.ts.map +1 -0
- package/dist/crypto/hash.js +12 -0
- package/dist/crypto/hash.js.map +1 -0
- package/dist/crypto/index.d.ts +3 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.js +3 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/crypto/sign.d.ts +6 -0
- package/dist/crypto/sign.d.ts.map +1 -0
- package/dist/crypto/sign.js +60 -0
- package/dist/crypto/sign.js.map +1 -0
- package/dist/db/index.d.ts +5 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +13 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/schema.d.ts +6 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +41 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/db/sqlite.d.ts +19 -0
- package/dist/db/sqlite.d.ts.map +1 -0
- package/dist/db/sqlite.js +196 -0
- package/dist/db/sqlite.js.map +1 -0
- package/dist/db/types.d.ts +34 -0
- package/dist/db/types.d.ts.map +1 -0
- package/dist/db/types.js +5 -0
- package/dist/db/types.js.map +1 -0
- package/dist/gateway/__tests__/eip3668.test.d.ts +2 -0
- package/dist/gateway/__tests__/eip3668.test.d.ts.map +1 -0
- package/dist/gateway/__tests__/eip3668.test.js +31 -0
- package/dist/gateway/__tests__/eip3668.test.js.map +1 -0
- package/dist/gateway/eip3668.d.ts +14 -0
- package/dist/gateway/eip3668.d.ts.map +1 -0
- package/dist/gateway/eip3668.js +28 -0
- package/dist/gateway/eip3668.js.map +1 -0
- package/dist/lib.d.ts +12 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +8 -0
- package/dist/lib.js.map +1 -0
- package/dist/mesh/cron.d.ts +4 -0
- package/dist/mesh/cron.d.ts.map +1 -0
- package/dist/mesh/cron.js +22 -0
- package/dist/mesh/cron.js.map +1 -0
- package/dist/mesh/records.d.ts +4 -0
- package/dist/mesh/records.d.ts.map +1 -0
- package/dist/mesh/records.js +47 -0
- package/dist/mesh/records.js.map +1 -0
- package/dist/mesh/sync.d.ts +5 -0
- package/dist/mesh/sync.d.ts.map +1 -0
- package/dist/mesh/sync.js +154 -0
- package/dist/mesh/sync.js.map +1 -0
- package/dist/mesh/vni.d.ts +14 -0
- package/dist/mesh/vni.d.ts.map +1 -0
- package/dist/mesh/vni.js +52 -0
- package/dist/mesh/vni.js.map +1 -0
- package/dist/router/CcipRouter.d.ts +26 -0
- package/dist/router/CcipRouter.d.ts.map +1 -0
- package/dist/router/CcipRouter.js +85 -0
- package/dist/router/CcipRouter.js.map +1 -0
- package/dist/router/index.d.ts +3 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +2 -0
- package/dist/router/index.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
/// @title NodeRegistry
|
|
5
|
+
/// @notice Public directory of ccip-router nodes.
|
|
6
|
+
/// Any node may register or update its URL by proving ownership of its signing key.
|
|
7
|
+
/// The relayer (msg.sender) does not need to be the signing key — gateways
|
|
8
|
+
/// can register without holding ETH in their hot key.
|
|
9
|
+
contract NodeRegistry {
|
|
10
|
+
|
|
11
|
+
struct NodeInfo {
|
|
12
|
+
string url;
|
|
13
|
+
uint256 registeredAt;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
mapping(address => NodeInfo) private _nodes;
|
|
17
|
+
address[] private _signers;
|
|
18
|
+
|
|
19
|
+
event NodeRegistered(address indexed signer, string url);
|
|
20
|
+
event NodeUpdated(address indexed signer, string url);
|
|
21
|
+
|
|
22
|
+
/// @notice Register or update a node.
|
|
23
|
+
/// `signature` must be EIP-191 personal_sign over keccak256("ccip-router:node:" + url).
|
|
24
|
+
/// The signing key is the node's gateway key — recovered to derive the signer address.
|
|
25
|
+
function register(string calldata url, bytes calldata signature) external returns (address signer) {
|
|
26
|
+
bytes32 msgHash = keccak256(bytes(string.concat("ccip-router:node:", url)));
|
|
27
|
+
bytes32 ethSigned = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", msgHash));
|
|
28
|
+
signer = _recover(ethSigned, signature);
|
|
29
|
+
|
|
30
|
+
bool isNew = _nodes[signer].registeredAt == 0;
|
|
31
|
+
_nodes[signer] = NodeInfo({ url: url, registeredAt: block.timestamp });
|
|
32
|
+
|
|
33
|
+
if (isNew) {
|
|
34
|
+
_signers.push(signer);
|
|
35
|
+
emit NodeRegistered(signer, url);
|
|
36
|
+
} else {
|
|
37
|
+
emit NodeUpdated(signer, url);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/// @notice Lookup a node by its signer address.
|
|
42
|
+
function getNode(address signer) external view returns (string memory url, uint256 registeredAt) {
|
|
43
|
+
NodeInfo storage n = _nodes[signer];
|
|
44
|
+
return (n.url, n.registeredAt);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function nodeCount() external view returns (uint256) {
|
|
48
|
+
return _signers.length;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/// @notice Paginated node list.
|
|
52
|
+
function getNodes(uint256 offset, uint256 limit)
|
|
53
|
+
external view
|
|
54
|
+
returns (address[] memory signers, string[] memory urls, uint256[] memory timestamps)
|
|
55
|
+
{
|
|
56
|
+
uint256 total = _signers.length;
|
|
57
|
+
if (offset >= total) return (new address[](0), new string[](0), new uint256[](0));
|
|
58
|
+
uint256 end = offset + limit > total ? total : offset + limit;
|
|
59
|
+
uint256 n = end - offset;
|
|
60
|
+
signers = new address[](n);
|
|
61
|
+
urls = new string[](n);
|
|
62
|
+
timestamps = new uint256[](n);
|
|
63
|
+
for (uint256 i = 0; i < n; i++) {
|
|
64
|
+
address s = _signers[offset + i];
|
|
65
|
+
signers[i] = s;
|
|
66
|
+
urls[i] = _nodes[s].url;
|
|
67
|
+
timestamps[i] = _nodes[s].registeredAt;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function _recover(bytes32 digest, bytes calldata sig) internal pure returns (address) {
|
|
72
|
+
require(sig.length == 65, "NodeRegistry: bad sig length");
|
|
73
|
+
bytes32 r; bytes32 s; uint8 v;
|
|
74
|
+
assembly {
|
|
75
|
+
r := calldataload(sig.offset)
|
|
76
|
+
s := calldataload(add(sig.offset, 32))
|
|
77
|
+
v := byte(0, calldataload(add(sig.offset, 64)))
|
|
78
|
+
}
|
|
79
|
+
if (v < 27) v += 27;
|
|
80
|
+
require(v == 27 || v == 28, "NodeRegistry: bad v");
|
|
81
|
+
address recovered = ecrecover(digest, v, r, s);
|
|
82
|
+
require(recovered != address(0), "NodeRegistry: ecrecover failed");
|
|
83
|
+
return recovered;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare const ATTESTATION_TYPEHASH = "WyriweAttestation(bytes32 agentId,address registry,bytes32 modelHash,bytes32 rawInputHash,bytes32 sanitizationPipelineHash,bytes32 inputHash,bytes32 outputHash,bytes32 commitmentHash,uint256 timestamp)";
|
|
2
|
+
export declare const IDENTITY_SENTINEL: "IDENTITY_SENTINEL";
|
|
3
|
+
export type WyriweAttestation = {
|
|
4
|
+
agentId: `0x${string}`;
|
|
5
|
+
registry: `0x${string}`;
|
|
6
|
+
modelHash: `0x${string}`;
|
|
7
|
+
rawInputHash: `0x${string}`;
|
|
8
|
+
sanitizationPipelineHash: `0x${string}`;
|
|
9
|
+
inputHash: `0x${string}`;
|
|
10
|
+
outputHash: `0x${string}`;
|
|
11
|
+
commitmentHash: `0x${string}`;
|
|
12
|
+
timestamp: bigint;
|
|
13
|
+
};
|
|
14
|
+
export declare const WYRIWE_TYPES: {
|
|
15
|
+
readonly WyriweAttestation: readonly [{
|
|
16
|
+
readonly name: "agentId";
|
|
17
|
+
readonly type: "bytes32";
|
|
18
|
+
}, {
|
|
19
|
+
readonly name: "registry";
|
|
20
|
+
readonly type: "address";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "modelHash";
|
|
23
|
+
readonly type: "bytes32";
|
|
24
|
+
}, {
|
|
25
|
+
readonly name: "rawInputHash";
|
|
26
|
+
readonly type: "bytes32";
|
|
27
|
+
}, {
|
|
28
|
+
readonly name: "sanitizationPipelineHash";
|
|
29
|
+
readonly type: "bytes32";
|
|
30
|
+
}, {
|
|
31
|
+
readonly name: "inputHash";
|
|
32
|
+
readonly type: "bytes32";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "outputHash";
|
|
35
|
+
readonly type: "bytes32";
|
|
36
|
+
}, {
|
|
37
|
+
readonly name: "commitmentHash";
|
|
38
|
+
readonly type: "bytes32";
|
|
39
|
+
}, {
|
|
40
|
+
readonly name: "timestamp";
|
|
41
|
+
readonly type: "uint256";
|
|
42
|
+
}];
|
|
43
|
+
};
|
|
44
|
+
export declare function buildDomain(chainId: number, verifyingContract: `0x${string}`): {
|
|
45
|
+
readonly name: "ERC8004AttestationGateway";
|
|
46
|
+
readonly version: "1";
|
|
47
|
+
readonly chainId: number;
|
|
48
|
+
readonly verifyingContract: `0x${string}`;
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=eip712.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eip712.d.ts","sourceRoot":"","sources":["../../src/attestation/eip712.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,8MAC4K,CAAA;AAK7M,eAAO,MAAM,iBAAiB,EAAG,mBAA4B,CAAA;AAE7D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAmB,KAAK,MAAM,EAAE,CAAA;IACvC,QAAQ,EAAkB,KAAK,MAAM,EAAE,CAAA;IACvC,SAAS,EAAiB,KAAK,MAAM,EAAE,CAAA;IACvC,YAAY,EAAc,KAAK,MAAM,EAAE,CAAA;IACvC,wBAAwB,EAAE,KAAK,MAAM,EAAE,CAAA;IACvC,SAAS,EAAiB,KAAK,MAAM,EAAE,CAAA;IACvC,UAAU,EAAgB,KAAK,MAAM,EAAE,CAAA;IACvC,cAAc,EAAY,KAAK,MAAM,EAAE,CAAA;IACvC,SAAS,EAAiB,MAAM,CAAA;CACjC,CAAA;AAGD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYf,CAAA;AAGV,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,MAAM,EAAE;;;;;EAO5E"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Advanced tier — EIP-712 attestation production after execution
|
|
2
|
+
// Implements the WYRIWE attestation profile (ERC8004AttestationGateway domain)
|
|
3
|
+
export const ATTESTATION_TYPEHASH = 'WyriweAttestation(bytes32 agentId,address registry,bytes32 modelHash,bytes32 rawInputHash,bytes32 sanitizationPipelineHash,bytes32 inputHash,bytes32 outputHash,bytes32 commitmentHash,uint256 timestamp)';
|
|
4
|
+
// IDENTITY_SENTINEL path: no sanitization pipeline was applied.
|
|
5
|
+
// sanitizationPipelineHash is set to keccak256("IDENTITY_SENTINEL") as a well-known sentinel value.
|
|
6
|
+
// inputHash == rawInputHash in this path.
|
|
7
|
+
export const IDENTITY_SENTINEL = 'IDENTITY_SENTINEL';
|
|
8
|
+
// EIP-712 type definition — passed to viem signTypedData
|
|
9
|
+
export const WYRIWE_TYPES = {
|
|
10
|
+
WyriweAttestation: [
|
|
11
|
+
{ name: 'agentId', type: 'bytes32' },
|
|
12
|
+
{ name: 'registry', type: 'address' },
|
|
13
|
+
{ name: 'modelHash', type: 'bytes32' },
|
|
14
|
+
{ name: 'rawInputHash', type: 'bytes32' },
|
|
15
|
+
{ name: 'sanitizationPipelineHash', type: 'bytes32' },
|
|
16
|
+
{ name: 'inputHash', type: 'bytes32' },
|
|
17
|
+
{ name: 'outputHash', type: 'bytes32' },
|
|
18
|
+
{ name: 'commitmentHash', type: 'bytes32' },
|
|
19
|
+
{ name: 'timestamp', type: 'uint256' },
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
// EIP-712 domain — chainId MUST match the chain the registry is deployed on
|
|
23
|
+
export function buildDomain(chainId, verifyingContract) {
|
|
24
|
+
return {
|
|
25
|
+
name: 'ERC8004AttestationGateway',
|
|
26
|
+
version: '1',
|
|
27
|
+
chainId,
|
|
28
|
+
verifyingContract,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=eip712.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eip712.js","sourceRoot":"","sources":["../../src/attestation/eip712.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,+EAA+E;AAE/E,MAAM,CAAC,MAAM,oBAAoB,GAC/B,2MAA2M,CAAA;AAE7M,gEAAgE;AAChE,oGAAoG;AACpG,0CAA0C;AAC1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAA4B,CAAA;AAc7D,yDAAyD;AACzD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,iBAAiB,EAAE;QACjB,EAAE,IAAI,EAAE,SAAS,EAAoB,IAAI,EAAE,SAAS,EAAE;QACtD,EAAE,IAAI,EAAE,UAAU,EAAmB,IAAI,EAAE,SAAS,EAAE;QACtD,EAAE,IAAI,EAAE,WAAW,EAAkB,IAAI,EAAE,SAAS,EAAE;QACtD,EAAE,IAAI,EAAE,cAAc,EAAe,IAAI,EAAE,SAAS,EAAE;QACtD,EAAE,IAAI,EAAE,0BAA0B,EAAG,IAAI,EAAE,SAAS,EAAE;QACtD,EAAE,IAAI,EAAE,WAAW,EAAkB,IAAI,EAAE,SAAS,EAAE;QACtD,EAAE,IAAI,EAAE,YAAY,EAAiB,IAAI,EAAE,SAAS,EAAE;QACtD,EAAE,IAAI,EAAE,gBAAgB,EAAa,IAAI,EAAE,SAAS,EAAE;QACtD,EAAE,IAAI,EAAE,WAAW,EAAkB,IAAI,EAAE,SAAS,EAAE;KACvD;CACO,CAAA;AAEV,4EAA4E;AAC5E,MAAM,UAAU,WAAW,CAAC,OAAe,EAAE,iBAAgC;IAC3E,OAAO;QACL,IAAI,EAAe,2BAA2B;QAC9C,OAAO,EAAY,GAAG;QACtB,OAAO;QACP,iBAAiB;KACT,CAAA;AACZ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type OcpObservation = {
|
|
2
|
+
agentId: `0x${string}`;
|
|
3
|
+
modelHash: `0x${string}`;
|
|
4
|
+
inputHash: `0x${string}`;
|
|
5
|
+
outputHash: `0x${string}`;
|
|
6
|
+
timestamp: bigint;
|
|
7
|
+
};
|
|
8
|
+
export declare function buildCommitmentHash(obs: OcpObservation): `0x${string}`;
|
|
9
|
+
//# sourceMappingURL=ocp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ocp.d.ts","sourceRoot":"","sources":["../../src/attestation/ocp.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAK,KAAK,MAAM,EAAE,CAAA;IACzB,SAAS,EAAG,KAAK,MAAM,EAAE,CAAA;IACzB,SAAS,EAAG,KAAK,MAAM,EAAE,CAAA;IACzB,UAAU,EAAE,KAAK,MAAM,EAAE,CAAA;IACzB,SAAS,EAAG,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,KAAK,MAAM,EAAE,CAatE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { encodeAbiParameters, keccak256 } from 'viem';
|
|
2
|
+
export function buildCommitmentHash(obs) {
|
|
3
|
+
return keccak256(encodeAbiParameters([
|
|
4
|
+
{ name: 'agentId', type: 'bytes32' },
|
|
5
|
+
{ name: 'modelHash', type: 'bytes32' },
|
|
6
|
+
{ name: 'inputHash', type: 'bytes32' },
|
|
7
|
+
{ name: 'outputHash', type: 'bytes32' },
|
|
8
|
+
{ name: 'timestamp', type: 'uint256' },
|
|
9
|
+
], [obs.agentId, obs.modelHash, obs.inputHash, obs.outputHash, obs.timestamp]));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=ocp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ocp.js","sourceRoot":"","sources":["../../src/attestation/ocp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAkBrD,MAAM,UAAU,mBAAmB,CAAC,GAAmB;IACrD,OAAO,SAAS,CACd,mBAAmB,CACjB;QACE,EAAE,IAAI,EAAE,SAAS,EAAK,IAAI,EAAE,SAAS,EAAE;QACvC,EAAE,IAAI,EAAE,WAAW,EAAG,IAAI,EAAE,SAAS,EAAE;QACvC,EAAE,IAAI,EAAE,WAAW,EAAG,IAAI,EAAE,SAAS,EAAE;QACvC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE;QACvC,EAAE,IAAI,EAAE,WAAW,EAAG,IAAI,EAAE,SAAS,EAAE;KACxC,EACD,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,CAC3E,CACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ResolverFn } from '../router/index.js';
|
|
2
|
+
export type WyriweOpts = {
|
|
3
|
+
gatewayKey: `0x${string}`;
|
|
4
|
+
registryAddress: `0x${string}`;
|
|
5
|
+
agentId: `0x${string}`;
|
|
6
|
+
modelHash: `0x${string}`;
|
|
7
|
+
chainId?: number;
|
|
8
|
+
sanitizationCID?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function withWyriwe(resolver: ResolverFn, opts: WyriweOpts): ResolverFn;
|
|
11
|
+
//# sourceMappingURL=withWyriwe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withWyriwe.d.ts","sourceRoot":"","sources":["../../src/attestation/withWyriwe.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AASpD,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAQ,KAAK,MAAM,EAAE,CAAA;IAC/B,eAAe,EAAG,KAAK,MAAM,EAAE,CAAA;IAC/B,OAAO,EAAW,KAAK,MAAM,EAAE,CAAA;IAC/B,SAAS,EAAS,KAAK,MAAM,EAAE,CAAA;IAC/B,OAAO,CAAC,EAAU,MAAM,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAaD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU,CAsF7E"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { keccak256, toBytes, encodeAbiParameters } from 'viem';
|
|
2
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
3
|
+
import { getDB } from '../db/index.js';
|
|
4
|
+
import { buildDomain, WYRIWE_TYPES, IDENTITY_SENTINEL, } from './eip712.js';
|
|
5
|
+
import { buildCommitmentHash } from './ocp.js';
|
|
6
|
+
// Advanced tier — wraps any ResolverFn with full WYRIWE attestation production.
|
|
7
|
+
//
|
|
8
|
+
// Triple-hash chain (two paths):
|
|
9
|
+
//
|
|
10
|
+
// Sentinel path (no sanitizationCID):
|
|
11
|
+
// sanitizationPipelineHash = keccak256("IDENTITY_SENTINEL")
|
|
12
|
+
// inputHash = rawInputHash
|
|
13
|
+
//
|
|
14
|
+
// Non-sentinel path (sanitizationCID provided):
|
|
15
|
+
// sanitizationPipelineHash = keccak256(sanitizationCID)
|
|
16
|
+
// inputHash = keccak256(abi.encode(rawInputHash, sanitizationPipelineHash))
|
|
17
|
+
export function withWyriwe(resolver, opts) {
|
|
18
|
+
const account = privateKeyToAccount(opts.gatewayKey);
|
|
19
|
+
const chainId = opts.chainId ?? 1;
|
|
20
|
+
const sentinelHash = keccak256(toBytes(IDENTITY_SENTINEL));
|
|
21
|
+
return async (sender, calldata, namespace) => {
|
|
22
|
+
// ── Triple-hash chain ──────────────────────────────────────────────────
|
|
23
|
+
const rawInputHash = keccak256(calldata);
|
|
24
|
+
let sanitizationPipelineHash;
|
|
25
|
+
let inputHash;
|
|
26
|
+
if (opts.sanitizationCID) {
|
|
27
|
+
sanitizationPipelineHash = keccak256(toBytes(opts.sanitizationCID));
|
|
28
|
+
inputHash = keccak256(encodeAbiParameters([{ type: 'bytes32' }, { type: 'bytes32' }], [rawInputHash, sanitizationPipelineHash]));
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
sanitizationPipelineHash = sentinelHash;
|
|
32
|
+
inputHash = rawInputHash;
|
|
33
|
+
}
|
|
34
|
+
// ── Resolver call ──────────────────────────────────────────────────────
|
|
35
|
+
const response = await resolver(sender, calldata, namespace);
|
|
36
|
+
// ── Output hash ────────────────────────────────────────────────────────
|
|
37
|
+
const outputHash = keccak256(toBytes(response));
|
|
38
|
+
// ── OCP commitment hash (ERC-8263) ────────────────────────────────────
|
|
39
|
+
const timestamp = BigInt(Math.floor(Date.now() / 1000));
|
|
40
|
+
const commitmentHash = buildCommitmentHash({
|
|
41
|
+
agentId: opts.agentId,
|
|
42
|
+
modelHash: opts.modelHash,
|
|
43
|
+
inputHash, // sanitized input (== rawInputHash on sentinel path)
|
|
44
|
+
outputHash,
|
|
45
|
+
timestamp,
|
|
46
|
+
});
|
|
47
|
+
// ── Build attestation struct ───────────────────────────────────────────
|
|
48
|
+
const attestation = {
|
|
49
|
+
agentId: opts.agentId,
|
|
50
|
+
registry: opts.registryAddress,
|
|
51
|
+
modelHash: opts.modelHash,
|
|
52
|
+
rawInputHash,
|
|
53
|
+
sanitizationPipelineHash,
|
|
54
|
+
inputHash,
|
|
55
|
+
outputHash,
|
|
56
|
+
commitmentHash,
|
|
57
|
+
timestamp,
|
|
58
|
+
};
|
|
59
|
+
// ── EIP-712 sign ───────────────────────────────────────────────────────
|
|
60
|
+
const signature = await account.signTypedData({
|
|
61
|
+
domain: buildDomain(chainId, opts.registryAddress),
|
|
62
|
+
types: WYRIWE_TYPES,
|
|
63
|
+
primaryType: 'WyriweAttestation',
|
|
64
|
+
message: attestation,
|
|
65
|
+
});
|
|
66
|
+
// ── Persist to "{namespace}:wyriwe" ────────────────────────────────────
|
|
67
|
+
// Separate namespace avoids colliding with basic records.
|
|
68
|
+
// Mesh peers sync these alongside regular records.
|
|
69
|
+
// JSON-serialise bigint timestamp as string for DB compatibility.
|
|
70
|
+
try {
|
|
71
|
+
await getDB().insertRecord({
|
|
72
|
+
inputHash: rawInputHash,
|
|
73
|
+
namespace: namespace + ':wyriwe',
|
|
74
|
+
key: rawInputHash,
|
|
75
|
+
// chainId stored so /verify can reconstruct the EIP-712 domain
|
|
76
|
+
// sanitizationCID stored so /verify can reflect the pipeline used (null = sentinel)
|
|
77
|
+
value: JSON.stringify({
|
|
78
|
+
...attestation, timestamp: timestamp.toString(), chainId,
|
|
79
|
+
sanitizationCID: opts.sanitizationCID ?? null,
|
|
80
|
+
}),
|
|
81
|
+
timestamp: Number(timestamp),
|
|
82
|
+
signature,
|
|
83
|
+
sourcePeer: null,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
console.error('[wyriwe] failed to persist attestation:', err);
|
|
88
|
+
}
|
|
89
|
+
return response;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=withWyriwe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withWyriwe.js","sourceRoot":"","sources":["../../src/attestation/withWyriwe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAA;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAEtC,OAAO,EACL,WAAW,EACX,YAAY,EACZ,iBAAiB,GAElB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAW9C,gFAAgF;AAChF,EAAE;AACF,iCAAiC;AACjC,EAAE;AACF,wCAAwC;AACxC,gEAAgE;AAChE,8CAA8C;AAC9C,EAAE;AACF,kDAAkD;AAClD,4DAA4D;AAC5D,+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,CAAC;QAED,OAAO,QAAQ,CAAA;IACjB,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
export declare const ATTESTATION_INDEX_ABI: readonly [{
|
|
2
|
+
readonly type: "function";
|
|
3
|
+
readonly name: "record";
|
|
4
|
+
readonly inputs: readonly [{
|
|
5
|
+
readonly name: "a";
|
|
6
|
+
readonly type: "tuple";
|
|
7
|
+
readonly components: readonly [{
|
|
8
|
+
readonly name: "agentId";
|
|
9
|
+
readonly type: "bytes32";
|
|
10
|
+
}, {
|
|
11
|
+
readonly name: "registry";
|
|
12
|
+
readonly type: "address";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "modelHash";
|
|
15
|
+
readonly type: "bytes32";
|
|
16
|
+
}, {
|
|
17
|
+
readonly name: "rawInputHash";
|
|
18
|
+
readonly type: "bytes32";
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "sanitizationPipelineHash";
|
|
21
|
+
readonly type: "bytes32";
|
|
22
|
+
}, {
|
|
23
|
+
readonly name: "inputHash";
|
|
24
|
+
readonly type: "bytes32";
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "outputHash";
|
|
27
|
+
readonly type: "bytes32";
|
|
28
|
+
}, {
|
|
29
|
+
readonly name: "commitmentHash";
|
|
30
|
+
readonly type: "bytes32";
|
|
31
|
+
}, {
|
|
32
|
+
readonly name: "timestamp";
|
|
33
|
+
readonly type: "uint256";
|
|
34
|
+
}];
|
|
35
|
+
}, {
|
|
36
|
+
readonly name: "signature";
|
|
37
|
+
readonly type: "bytes";
|
|
38
|
+
}];
|
|
39
|
+
readonly outputs: readonly [{
|
|
40
|
+
readonly name: "signer";
|
|
41
|
+
readonly type: "address";
|
|
42
|
+
}];
|
|
43
|
+
readonly stateMutability: "nonpayable";
|
|
44
|
+
}, {
|
|
45
|
+
readonly type: "function";
|
|
46
|
+
readonly name: "isRecorded";
|
|
47
|
+
readonly inputs: readonly [{
|
|
48
|
+
readonly name: "commitmentHash";
|
|
49
|
+
readonly type: "bytes32";
|
|
50
|
+
}];
|
|
51
|
+
readonly outputs: readonly [{
|
|
52
|
+
readonly name: "";
|
|
53
|
+
readonly type: "bool";
|
|
54
|
+
}];
|
|
55
|
+
readonly stateMutability: "view";
|
|
56
|
+
}, {
|
|
57
|
+
readonly type: "function";
|
|
58
|
+
readonly name: "signerOf";
|
|
59
|
+
readonly inputs: readonly [{
|
|
60
|
+
readonly name: "commitmentHash";
|
|
61
|
+
readonly type: "bytes32";
|
|
62
|
+
}];
|
|
63
|
+
readonly outputs: readonly [{
|
|
64
|
+
readonly name: "";
|
|
65
|
+
readonly type: "address";
|
|
66
|
+
}];
|
|
67
|
+
readonly stateMutability: "view";
|
|
68
|
+
}, {
|
|
69
|
+
readonly type: "function";
|
|
70
|
+
readonly name: "commitmentOf";
|
|
71
|
+
readonly inputs: readonly [{
|
|
72
|
+
readonly name: "inputHash";
|
|
73
|
+
readonly type: "bytes32";
|
|
74
|
+
}];
|
|
75
|
+
readonly outputs: readonly [{
|
|
76
|
+
readonly name: "";
|
|
77
|
+
readonly type: "bytes32";
|
|
78
|
+
}];
|
|
79
|
+
readonly stateMutability: "view";
|
|
80
|
+
}, {
|
|
81
|
+
readonly type: "event";
|
|
82
|
+
readonly name: "AttestationRecorded";
|
|
83
|
+
readonly inputs: readonly [{
|
|
84
|
+
readonly name: "commitmentHash";
|
|
85
|
+
readonly type: "bytes32";
|
|
86
|
+
readonly indexed: true;
|
|
87
|
+
}, {
|
|
88
|
+
readonly name: "inputHash";
|
|
89
|
+
readonly type: "bytes32";
|
|
90
|
+
readonly indexed: true;
|
|
91
|
+
}, {
|
|
92
|
+
readonly name: "agentId";
|
|
93
|
+
readonly type: "bytes32";
|
|
94
|
+
readonly indexed: true;
|
|
95
|
+
}, {
|
|
96
|
+
readonly name: "signer";
|
|
97
|
+
readonly type: "address";
|
|
98
|
+
readonly indexed: false;
|
|
99
|
+
}, {
|
|
100
|
+
readonly name: "timestamp";
|
|
101
|
+
readonly type: "uint256";
|
|
102
|
+
readonly indexed: false;
|
|
103
|
+
}];
|
|
104
|
+
}];
|
|
105
|
+
export declare const NODE_REGISTRY_ABI: readonly [{
|
|
106
|
+
readonly type: "function";
|
|
107
|
+
readonly name: "register";
|
|
108
|
+
readonly inputs: readonly [{
|
|
109
|
+
readonly name: "url";
|
|
110
|
+
readonly type: "string";
|
|
111
|
+
}, {
|
|
112
|
+
readonly name: "signature";
|
|
113
|
+
readonly type: "bytes";
|
|
114
|
+
}];
|
|
115
|
+
readonly outputs: readonly [{
|
|
116
|
+
readonly name: "signer";
|
|
117
|
+
readonly type: "address";
|
|
118
|
+
}];
|
|
119
|
+
readonly stateMutability: "nonpayable";
|
|
120
|
+
}, {
|
|
121
|
+
readonly type: "function";
|
|
122
|
+
readonly name: "getNode";
|
|
123
|
+
readonly inputs: readonly [{
|
|
124
|
+
readonly name: "signer";
|
|
125
|
+
readonly type: "address";
|
|
126
|
+
}];
|
|
127
|
+
readonly outputs: readonly [{
|
|
128
|
+
readonly name: "url";
|
|
129
|
+
readonly type: "string";
|
|
130
|
+
}, {
|
|
131
|
+
readonly name: "registeredAt";
|
|
132
|
+
readonly type: "uint256";
|
|
133
|
+
}];
|
|
134
|
+
readonly stateMutability: "view";
|
|
135
|
+
}, {
|
|
136
|
+
readonly type: "function";
|
|
137
|
+
readonly name: "nodeCount";
|
|
138
|
+
readonly inputs: readonly [];
|
|
139
|
+
readonly outputs: readonly [{
|
|
140
|
+
readonly name: "";
|
|
141
|
+
readonly type: "uint256";
|
|
142
|
+
}];
|
|
143
|
+
readonly stateMutability: "view";
|
|
144
|
+
}, {
|
|
145
|
+
readonly type: "function";
|
|
146
|
+
readonly name: "getNodes";
|
|
147
|
+
readonly inputs: readonly [{
|
|
148
|
+
readonly name: "offset";
|
|
149
|
+
readonly type: "uint256";
|
|
150
|
+
}, {
|
|
151
|
+
readonly name: "limit";
|
|
152
|
+
readonly type: "uint256";
|
|
153
|
+
}];
|
|
154
|
+
readonly outputs: readonly [{
|
|
155
|
+
readonly name: "signers";
|
|
156
|
+
readonly type: "address[]";
|
|
157
|
+
}, {
|
|
158
|
+
readonly name: "urls";
|
|
159
|
+
readonly type: "string[]";
|
|
160
|
+
}, {
|
|
161
|
+
readonly name: "timestamps";
|
|
162
|
+
readonly type: "uint256[]";
|
|
163
|
+
}];
|
|
164
|
+
readonly stateMutability: "view";
|
|
165
|
+
}, {
|
|
166
|
+
readonly type: "event";
|
|
167
|
+
readonly name: "NodeRegistered";
|
|
168
|
+
readonly inputs: readonly [{
|
|
169
|
+
readonly name: "signer";
|
|
170
|
+
readonly type: "address";
|
|
171
|
+
readonly indexed: true;
|
|
172
|
+
}, {
|
|
173
|
+
readonly name: "url";
|
|
174
|
+
readonly type: "string";
|
|
175
|
+
readonly indexed: false;
|
|
176
|
+
}];
|
|
177
|
+
}];
|
|
178
|
+
//# sourceMappingURL=abi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../../src/chain/abi.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDxB,CAAA;AAEV,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCpB,CAAA"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export const ATTESTATION_INDEX_ABI = [
|
|
2
|
+
{
|
|
3
|
+
type: 'function',
|
|
4
|
+
name: 'record',
|
|
5
|
+
inputs: [
|
|
6
|
+
{
|
|
7
|
+
name: 'a', type: 'tuple',
|
|
8
|
+
components: [
|
|
9
|
+
{ name: 'agentId', type: 'bytes32' },
|
|
10
|
+
{ name: 'registry', type: 'address' },
|
|
11
|
+
{ name: 'modelHash', type: 'bytes32' },
|
|
12
|
+
{ name: 'rawInputHash', type: 'bytes32' },
|
|
13
|
+
{ name: 'sanitizationPipelineHash', type: 'bytes32' },
|
|
14
|
+
{ name: 'inputHash', type: 'bytes32' },
|
|
15
|
+
{ name: 'outputHash', type: 'bytes32' },
|
|
16
|
+
{ name: 'commitmentHash', type: 'bytes32' },
|
|
17
|
+
{ name: 'timestamp', type: 'uint256' },
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
{ name: 'signature', type: 'bytes' },
|
|
21
|
+
],
|
|
22
|
+
outputs: [{ name: 'signer', type: 'address' }],
|
|
23
|
+
stateMutability: 'nonpayable',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: 'function',
|
|
27
|
+
name: 'isRecorded',
|
|
28
|
+
inputs: [{ name: 'commitmentHash', type: 'bytes32' }],
|
|
29
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
30
|
+
stateMutability: 'view',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: 'function',
|
|
34
|
+
name: 'signerOf',
|
|
35
|
+
inputs: [{ name: 'commitmentHash', type: 'bytes32' }],
|
|
36
|
+
outputs: [{ name: '', type: 'address' }],
|
|
37
|
+
stateMutability: 'view',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: 'function',
|
|
41
|
+
name: 'commitmentOf',
|
|
42
|
+
inputs: [{ name: 'inputHash', type: 'bytes32' }],
|
|
43
|
+
outputs: [{ name: '', type: 'bytes32' }],
|
|
44
|
+
stateMutability: 'view',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'event',
|
|
48
|
+
name: 'AttestationRecorded',
|
|
49
|
+
inputs: [
|
|
50
|
+
{ name: 'commitmentHash', type: 'bytes32', indexed: true },
|
|
51
|
+
{ name: 'inputHash', type: 'bytes32', indexed: true },
|
|
52
|
+
{ name: 'agentId', type: 'bytes32', indexed: true },
|
|
53
|
+
{ name: 'signer', type: 'address', indexed: false },
|
|
54
|
+
{ name: 'timestamp', type: 'uint256', indexed: false },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
export const NODE_REGISTRY_ABI = [
|
|
59
|
+
{
|
|
60
|
+
type: 'function', name: 'register',
|
|
61
|
+
inputs: [{ name: 'url', type: 'string' }, { name: 'signature', type: 'bytes' }],
|
|
62
|
+
outputs: [{ name: 'signer', type: 'address' }],
|
|
63
|
+
stateMutability: 'nonpayable',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: 'function', name: 'getNode',
|
|
67
|
+
inputs: [{ name: 'signer', type: 'address' }],
|
|
68
|
+
outputs: [{ name: 'url', type: 'string' }, { name: 'registeredAt', type: 'uint256' }],
|
|
69
|
+
stateMutability: 'view',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: 'function', name: 'nodeCount',
|
|
73
|
+
inputs: [], outputs: [{ name: '', type: 'uint256' }],
|
|
74
|
+
stateMutability: 'view',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: 'function', name: 'getNodes',
|
|
78
|
+
inputs: [{ name: 'offset', type: 'uint256' }, { name: 'limit', type: 'uint256' }],
|
|
79
|
+
outputs: [
|
|
80
|
+
{ name: 'signers', type: 'address[]' },
|
|
81
|
+
{ name: 'urls', type: 'string[]' },
|
|
82
|
+
{ name: 'timestamps', type: 'uint256[]' },
|
|
83
|
+
],
|
|
84
|
+
stateMutability: 'view',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
type: 'event', name: 'NodeRegistered',
|
|
88
|
+
inputs: [
|
|
89
|
+
{ name: 'signer', type: 'address', indexed: true },
|
|
90
|
+
{ name: 'url', type: 'string', indexed: false },
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
//# sourceMappingURL=abi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi.js","sourceRoot":"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