@rohan-protocol/mcp 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -12
- package/dist/firewall.d.ts.map +1 -1
- package/dist/firewall.js +3 -1
- package/dist/firewall.js.map +1 -1
- package/dist/gateway.d.ts +26 -0
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +10 -1
- package/dist/gateway.js.map +1 -1
- package/dist/identity/handshake.d.ts +42 -0
- package/dist/identity/handshake.d.ts.map +1 -0
- package/dist/identity/handshake.js +74 -0
- package/dist/identity/handshake.js.map +1 -0
- package/dist/identity/keystore.d.ts +27 -0
- package/dist/identity/keystore.d.ts.map +1 -0
- package/dist/identity/keystore.js +336 -0
- package/dist/identity/keystore.js.map +1 -0
- package/dist/identity.d.ts +3 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +38 -0
- package/dist/identity.js.map +1 -0
- package/dist/server.d.ts +15 -30
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +69 -45
- package/dist/server.js.map +1 -1
- package/package.json +8 -4
- package/server.json +41 -25
- package/src/firewall.ts +5 -1
- package/src/gateway.ts +11 -1
- package/src/identity/handshake.ts +82 -0
- package/src/identity/keystore.ts +385 -0
- package/src/server.ts +81 -48
- package/tests/firewall.test.js +9 -0
- package/tests/gateway.test.js +27 -0
- package/tests/identity.test.js +170 -0
package/README.md
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
# @rohan-protocol/mcp (v0.
|
|
1
|
+
# @rohan-protocol/mcp (v0.8.1)
|
|
2
2
|
|
|
3
3
|
Official Model Context Protocol (MCP) server providing confidential state transitions, ledger inspection, and cryptographic audit tools for Claude Desktop, Cursor, Cline, and Gemini.
|
|
4
4
|
|
|
5
|
-
[](https://glama.ai/mcp/servers/rohan-protocol/sdk)
|
|
6
6
|
[](https://smithery.ai/servers/rohanprotocol/shield)
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
## 🛠️ The
|
|
10
|
+
## 🛠️ The 4 MCP Tools
|
|
11
11
|
|
|
12
|
-
### 1. `
|
|
12
|
+
### 1. `rohan_execute_handshake` (Write / Settlement)
|
|
13
13
|
Executes a confidential state transition on Midnight Blockchain. Confidential parameters are automatically canonicalized (RFC 8785) and hashed in client RAM—never exposed on-chain or in model logs.
|
|
14
|
-
* **Arguments:** `
|
|
14
|
+
* **Arguments:** `actionSummary` (non-empty string, required), `agentId` (string, optional when a local signer is configured), `confidentialPayload` (object, optional). If supplied with a signer, `agentId` must match its DID. The legacy `rohan_zk_handshake` tool name remains accepted.
|
|
15
15
|
|
|
16
|
-
### 2. `
|
|
17
|
-
Cryptographically audits and verifies whether a plaintext payload matches an on-chain commitment using RFC 8785 JSON Canonicalization and SHA-256. Zero gas cost, executes instantly in local RAM.
|
|
18
|
-
* **Arguments:** `payload` (object, required), `expectedDigest` (string, required — accepts raw hex, `sha256:`, or `0x` prefixes).
|
|
19
|
-
|
|
20
|
-
### 3. `rohan_get_ledger_state` (Read / State Inspection)
|
|
16
|
+
### 2. `rohan_get_ledger_state` (Read / State Inspection)
|
|
21
17
|
Reads the current anchored state of the Rohan Protocol smart contract on Midnight Preprod L1. Returns state root, block height, and last mined transaction hash from memory cache.
|
|
22
18
|
* **Arguments:** None.
|
|
23
19
|
|
|
20
|
+
### 3. `rohan_get_transaction_history` (Read / Settlement History)
|
|
21
|
+
Lists recent settlement transactions and receipts recorded by the relayer.
|
|
22
|
+
* **Arguments:** `limit` (integer, optional — defaults to 10, maximum 50).
|
|
23
|
+
|
|
24
|
+
### 4. `rohan_verify_commitment` (Audit / Verify)
|
|
25
|
+
Verifies a plaintext confidential payload against its canonical SHA-256 digest in local memory.
|
|
26
|
+
* **Arguments:** `payload` (object, required), `expectedDigest` (string, required — accepts raw hex, `sha256:`, or `0x` prefixes). Supply the inner payload digest referenced in `actionSummary`, not the timestamp-salted outer on-chain `intentHash`.
|
|
27
|
+
|
|
24
28
|
---
|
|
25
29
|
|
|
26
30
|
## 🚀 Setup & Configuration
|
|
@@ -33,7 +37,7 @@ Add this to your `claude_desktop_config.json`:
|
|
|
33
37
|
"mcpServers": {
|
|
34
38
|
"rohan-shield": {
|
|
35
39
|
"command": "npx",
|
|
36
|
-
"args": ["-y", "@rohan-protocol/mcp@0.
|
|
40
|
+
"args": ["-y", "@rohan-protocol/mcp@0.8.1"],
|
|
37
41
|
"env": {
|
|
38
42
|
"ROHAN_API_KEY": ""
|
|
39
43
|
}
|
|
@@ -47,13 +51,41 @@ Add this to your `claude_desktop_config.json`:
|
|
|
47
51
|
2. Click **Add New MCP Server**:
|
|
48
52
|
* **Name:** `rohan-shield`
|
|
49
53
|
* **Type:** `command`
|
|
50
|
-
* **Command:** `npx -y @rohan-protocol/mcp@0.
|
|
54
|
+
* **Command:** `npx -y @rohan-protocol/mcp@0.8.1`
|
|
51
55
|
|
|
52
56
|
### Option C: Remote MCP (Smithery / Cloud Agents)
|
|
53
57
|
Connect directly to the hosted endpoint:
|
|
54
58
|
* **Server Card:** `https://api.rohanprotocol.network/.well-known/mcp/server-card.json`
|
|
55
59
|
* **JSON-RPC Endpoint:** `https://api.rohanprotocol.network/mcp`
|
|
56
60
|
|
|
61
|
+
### Local agent identity and signing (V-08)
|
|
62
|
+
The local stdio server loads identity in this order:
|
|
63
|
+
|
|
64
|
+
1. `ROHAN_AGENT_PRIVATE_KEY`, if set, as a 32-byte Ed25519 seed encoded in
|
|
65
|
+
exactly 64 hexadecimal characters (an optional `0x` prefix is accepted).
|
|
66
|
+
Invalid configured values fail startup; they never fall back to another key.
|
|
67
|
+
2. The existing `~/.rohan/agent-identity.json` keystore, after checking its
|
|
68
|
+
permissions and verifying that its DID matches the public key derived from
|
|
69
|
+
the stored seed.
|
|
70
|
+
3. If no keystore exists, the server provisions one with exclusive,
|
|
71
|
+
create-only semantics. It is stored as plaintext key material in the
|
|
72
|
+
user-only file `~/.rohan/agent-identity.json`; the directory is restricted
|
|
73
|
+
to `0700` and the file to `0600` on POSIX systems. Corrupt or mismatched
|
|
74
|
+
existing files fail closed and are never silently replaced.
|
|
75
|
+
|
|
76
|
+
With the local signer active, `agentId` may be omitted and the server supplies
|
|
77
|
+
the signer's DID. If provided, it must exactly match. A non-empty
|
|
78
|
+
`actionSummary` is always required; the `intent` property is deprecated and
|
|
79
|
+
cannot replace it. The DID is reported at startup so operators can record it
|
|
80
|
+
for their agent configuration.
|
|
81
|
+
|
|
82
|
+
Protect and back up the keystore as a secret. Deleting it provisions a new key
|
|
83
|
+
and therefore a new DID; restoring it preserves the identity. Never put key
|
|
84
|
+
material in tool arguments, prompts, source control, or logs. JavaScript and
|
|
85
|
+
WebCrypto cannot guarantee erasure of all in-memory key copies. A `did:key`
|
|
86
|
+
proves control of a key, not a real-world identity, and the relayer must enforce
|
|
87
|
+
signature verification for server-side authentication.
|
|
88
|
+
|
|
57
89
|
---
|
|
58
90
|
|
|
59
91
|
## 📜 License
|
package/dist/firewall.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firewall.d.ts","sourceRoot":"","sources":["../src/firewall.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CACmI;IAE1K,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO;
|
|
1
|
+
{"version":3,"file":"firewall.d.ts","sourceRoot":"","sources":["../src/firewall.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CACmI;IAE1K,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO;CA0BlD"}
|
package/dist/firewall.js
CHANGED
|
@@ -4,7 +4,9 @@ export class SemanticFirewall {
|
|
|
4
4
|
if (!intent.agentId || typeof intent.agentId !== 'string' || intent.agentId.length > 128) {
|
|
5
5
|
return false;
|
|
6
6
|
}
|
|
7
|
-
if (!intent.action || (intent.action !== 'rohan_zk_handshake' &&
|
|
7
|
+
if (!intent.action || (intent.action !== 'rohan_zk_handshake' &&
|
|
8
|
+
intent.action !== 'rohan_execute_handshake' &&
|
|
9
|
+
intent.action !== 'verify_batched_handshakes')) {
|
|
8
10
|
return false;
|
|
9
11
|
}
|
|
10
12
|
if (!intent.payload || typeof intent.payload !== 'object') {
|
package/dist/firewall.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firewall.js","sourceRoot":"","sources":["../src/firewall.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAU,eAAe,GACrC,uKAAuK,CAAC;IAE1K,MAAM,CAAC,QAAQ,CAAC,MAAuB;QACrC,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;YACzF,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"firewall.js","sourceRoot":"","sources":["../src/firewall.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAU,eAAe,GACrC,uKAAuK,CAAC;IAE1K,MAAM,CAAC,QAAQ,CAAC,MAAuB;QACrC,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;YACzF,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CACpB,MAAM,CAAC,MAAM,KAAK,oBAAoB;YACtC,MAAM,CAAC,MAAM,KAAK,yBAAyB;YAC3C,MAAM,CAAC,MAAM,KAAK,2BAA2B,CAC9C,EAAE,CAAC;YACF,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC1D,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,UAAU,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC;YAC7B,OAAO,KAAK,CAAC,CAAC,kDAAkD;QAClE,CAAC;QAED,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1C,OAAO,KAAK,CAAC,CAAC,qCAAqC;QACrD,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC"}
|
package/dist/gateway.d.ts
CHANGED
|
@@ -40,5 +40,31 @@ export declare class RohanMcpGateway {
|
|
|
40
40
|
};
|
|
41
41
|
execute: (params: any) => Promise<import("@rohan-protocol/sdk").HandshakeReceipt>;
|
|
42
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Generates the legacy tool name for integrations that have not migrated yet.
|
|
45
|
+
*/
|
|
46
|
+
asLegacyAdkTool(): {
|
|
47
|
+
name: string;
|
|
48
|
+
description: string;
|
|
49
|
+
parameters: {
|
|
50
|
+
type: string;
|
|
51
|
+
properties: {
|
|
52
|
+
agentId: {
|
|
53
|
+
type: string;
|
|
54
|
+
description: string;
|
|
55
|
+
};
|
|
56
|
+
intent: {
|
|
57
|
+
type: string;
|
|
58
|
+
description: string;
|
|
59
|
+
};
|
|
60
|
+
counterpartyId: {
|
|
61
|
+
type: string;
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
required: string[];
|
|
66
|
+
};
|
|
67
|
+
execute: (params: any) => Promise<import("@rohan-protocol/sdk").HandshakeReceipt>;
|
|
68
|
+
};
|
|
43
69
|
}
|
|
44
70
|
//# sourceMappingURL=gateway.d.ts.map
|
package/dist/gateway.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,OAAO,GAAG,iBAAiB,CAAC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,aAAa,EAAE,kBAAkB,CAAC;gBAEtC,OAAO,GAAE,sBAA2B;IAShD;;OAEG;IACH,SAAS;;;;;;;;;;;;;;;;;;;;;0BAamB,GAAG;;
|
|
1
|
+
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,OAAO,GAAG,iBAAiB,CAAC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,aAAa,EAAE,kBAAkB,CAAC;gBAEtC,OAAO,GAAE,sBAA2B;IAShD;;OAEG;IACH,SAAS;;;;;;;;;;;;;;;;;;;;;0BAamB,GAAG;;IAM/B;;OAEG;IACH,eAAe;;;;;;;;;;;;;;;;;;;;;0BATa,GAAG;;CAehC"}
|
package/dist/gateway.js
CHANGED
|
@@ -20,7 +20,7 @@ export class RohanMcpGateway {
|
|
|
20
20
|
*/
|
|
21
21
|
asAdkTool() {
|
|
22
22
|
return {
|
|
23
|
-
name: '
|
|
23
|
+
name: 'rohan_execute_handshake',
|
|
24
24
|
description: 'Executes a zero-knowledge verifiable handshake proof on Midnight Network with zero plaintext leaks.',
|
|
25
25
|
parameters: {
|
|
26
26
|
type: 'object',
|
|
@@ -36,5 +36,14 @@ export class RohanMcpGateway {
|
|
|
36
36
|
},
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Generates the legacy tool name for integrations that have not migrated yet.
|
|
41
|
+
*/
|
|
42
|
+
asLegacyAdkTool() {
|
|
43
|
+
return {
|
|
44
|
+
...this.asAdkTool(),
|
|
45
|
+
name: 'rohan_zk_handshake',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
39
48
|
}
|
|
40
49
|
//# sourceMappingURL=gateway.js.map
|
package/dist/gateway.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AASzD;;;;GAIG;AACH,MAAM,OAAO,eAAe;IACV,SAAS,CAAS;IAClB,aAAa,CAAqB;IAElD,YAAY,UAAkC,EAAE;QAC9C,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,iBAAiB,CAAC;QACxD,IAAI,CAAC,aAAa,G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E,MAAW,EAAE,EAAE;gBAC7B,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC1D,CAAC;SACF,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,eAAe;QACb,OAAO;YACL,GAAG,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,EAAE,oBAAoB;SAC3B,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AgentSigner } from '@rohan-protocol/sdk';
|
|
2
|
+
export declare const ROHAN_HANDSHAKE_TOOL_SCHEMA: {
|
|
3
|
+
readonly name: "rohan_execute_handshake";
|
|
4
|
+
readonly description: "Executes a confidential zero-knowledge state transition on Midnight Blockchain. Confidential parameters are automatically canonicalized (RFC 8785) and hashed in client RAM—never exposed on-chain or in model logs.";
|
|
5
|
+
readonly inputSchema: {
|
|
6
|
+
readonly type: "object";
|
|
7
|
+
readonly properties: {
|
|
8
|
+
readonly actionSummary: {
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
readonly minLength: 1;
|
|
11
|
+
readonly description: "Required public high-level action label.";
|
|
12
|
+
};
|
|
13
|
+
readonly agentId: {
|
|
14
|
+
readonly type: "string";
|
|
15
|
+
readonly description: "Optional Sovereign Agent DID. Defaults to the local signer's DID and must match it when provided.";
|
|
16
|
+
};
|
|
17
|
+
readonly confidentialPayload: {
|
|
18
|
+
readonly type: "object";
|
|
19
|
+
readonly description: "Optional confidential parameters, canonicalized and hashed locally.";
|
|
20
|
+
};
|
|
21
|
+
readonly counterpartyId: {
|
|
22
|
+
readonly type: "string";
|
|
23
|
+
readonly description: "Optional counterparty agent identifier.";
|
|
24
|
+
};
|
|
25
|
+
readonly intent: {
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
readonly deprecated: true;
|
|
28
|
+
readonly description: "Deprecated alias. actionSummary remains required.";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
readonly required: readonly ["actionSummary"];
|
|
32
|
+
readonly additionalProperties: false;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export declare function validateActionSummary(value: unknown): string | undefined;
|
|
36
|
+
export declare function validateHandshakeArguments(args: Record<string, unknown>): string | undefined;
|
|
37
|
+
export declare function resolveHandshakeAgentId(requestedAgentId: unknown, signer?: AgentSigner): {
|
|
38
|
+
agentId: string;
|
|
39
|
+
} | {
|
|
40
|
+
error: string;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=handshake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handshake.d.ts","sourceRoot":"","sources":["../../src/identity/handshake.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiC9B,CAAC;AAEX,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAKxE;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,CAe5F;AAED,wBAAgB,uBAAuB,CACrC,gBAAgB,EAAE,OAAO,EACzB,MAAM,CAAC,EAAE,WAAW,GACnB;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAiBzC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export const ROHAN_HANDSHAKE_TOOL_SCHEMA = {
|
|
2
|
+
name: 'rohan_execute_handshake',
|
|
3
|
+
description: 'Executes a confidential zero-knowledge state transition on Midnight Blockchain. Confidential parameters are automatically canonicalized (RFC 8785) and hashed in client RAM—never exposed on-chain or in model logs.',
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {
|
|
7
|
+
actionSummary: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
minLength: 1,
|
|
10
|
+
description: 'Required public high-level action label.',
|
|
11
|
+
},
|
|
12
|
+
agentId: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: "Optional Sovereign Agent DID. Defaults to the local signer's DID and must match it when provided.",
|
|
15
|
+
},
|
|
16
|
+
confidentialPayload: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
description: 'Optional confidential parameters, canonicalized and hashed locally.',
|
|
19
|
+
},
|
|
20
|
+
counterpartyId: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'Optional counterparty agent identifier.',
|
|
23
|
+
},
|
|
24
|
+
intent: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
deprecated: true,
|
|
27
|
+
description: 'Deprecated alias. actionSummary remains required.',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
required: ['actionSummary'],
|
|
31
|
+
additionalProperties: false,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
export function validateActionSummary(value) {
|
|
35
|
+
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
36
|
+
return 'INVALID_ARGUMENTS: actionSummary is required and cannot be empty.';
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
export function validateHandshakeArguments(args) {
|
|
41
|
+
const allowedProperties = new Set([
|
|
42
|
+
'actionSummary',
|
|
43
|
+
'agentId',
|
|
44
|
+
'confidentialPayload',
|
|
45
|
+
'counterpartyId',
|
|
46
|
+
'intent',
|
|
47
|
+
]);
|
|
48
|
+
if (Object.keys(args).some((key) => !allowedProperties.has(key))) {
|
|
49
|
+
return 'INVALID_ARGUMENTS: Handshake arguments contain unsupported properties.';
|
|
50
|
+
}
|
|
51
|
+
if (args.intent !== undefined && typeof args.intent !== 'string') {
|
|
52
|
+
return 'INVALID_ARGUMENTS: Deprecated intent must be a string when provided.';
|
|
53
|
+
}
|
|
54
|
+
return validateActionSummary(args.actionSummary);
|
|
55
|
+
}
|
|
56
|
+
export function resolveHandshakeAgentId(requestedAgentId, signer) {
|
|
57
|
+
if (signer) {
|
|
58
|
+
if (requestedAgentId === undefined)
|
|
59
|
+
return { agentId: signer.did };
|
|
60
|
+
if (typeof requestedAgentId !== 'string' || requestedAgentId !== signer.did) {
|
|
61
|
+
return {
|
|
62
|
+
error: 'IDENTITY_MISMATCH: Declared agentId does not match the armed Sovereign Signer DID.',
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return { agentId: signer.did };
|
|
66
|
+
}
|
|
67
|
+
if (typeof requestedAgentId !== 'string' || requestedAgentId.trim().length === 0) {
|
|
68
|
+
return {
|
|
69
|
+
error: 'MISSING_AGENT_ID: An explicit agentId is required when no Sovereign Signer is armed.',
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return { agentId: requestedAgentId };
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=handshake.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handshake.js","sourceRoot":"","sources":["../../src/identity/handshake.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EACT,sNAAsN;IACxN,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,aAAa,EAAE;gBACb,IAAI,EAAE,QAAQ;gBACd,SAAS,EAAE,CAAC;gBACZ,WAAW,EAAE,0CAA0C;aACxD;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mGAAmG;aACjH;YACD,mBAAmB,EAAE;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,qEAAqE;aACnF;YACD,cAAc,EAAE;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yCAAyC;aACvD;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,IAAI;gBAChB,WAAW,EAAE,mDAAmD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,MAAM,CAAC,GAAG,EAAE,CAAC;IACjC,CAAC;IAED,IAAI,OAAO,gBAAgB,KAAK,QAAQ,IAAI,gBAAgB,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjF,OAAO;YACL,KAAK,EAAE,sFAAsF;SAC9F,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { InMemoryEd25519Signer, type AgentSigner } from '@rohan-protocol/sdk';
|
|
2
|
+
export interface AgentKeystoreData {
|
|
3
|
+
did: string;
|
|
4
|
+
privateKeyHex: string;
|
|
5
|
+
createdAt: number;
|
|
6
|
+
}
|
|
7
|
+
export interface LoadedAgentIdentity {
|
|
8
|
+
signer: AgentSigner;
|
|
9
|
+
did: string;
|
|
10
|
+
source: 'env' | 'filesystem' | 'auto-provisioned';
|
|
11
|
+
filePath?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class KeystoreResolutionError extends Error {
|
|
14
|
+
readonly code?: string;
|
|
15
|
+
constructor(message: string, options?: {
|
|
16
|
+
cause?: unknown;
|
|
17
|
+
code?: string;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export declare function loadKeystoreFile(filePath: string): Promise<InMemoryEd25519Signer>;
|
|
21
|
+
export declare function saveKeystoreFile(filePath: string, keystore: AgentKeystoreData): Promise<void>;
|
|
22
|
+
export declare function createNewKeystoreFile(filePath: string): Promise<InMemoryEd25519Signer>;
|
|
23
|
+
export declare function resolveAgentIdentity(options?: {
|
|
24
|
+
privateKeyHex?: string;
|
|
25
|
+
filePath?: string;
|
|
26
|
+
}): Promise<LoadedAgentIdentity>;
|
|
27
|
+
//# sourceMappingURL=keystore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keystore.d.ts","sourceRoot":"","sources":["../../src/identity/keystore.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,qBAAqB,EACrB,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAC;AAU7B,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,WAAW,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,KAAK,GAAG,YAAY,GAAG,kBAAkB,CAAC;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;CAK1E;AAgKD,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA6CvF;AAED,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuEnG;AAED,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAuB5F;AAED,wBAAsB,oBAAoB,CAAC,OAAO,GAAE;IAClD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAoCpC"}
|