@mida-context/sdk 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 +26 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7115 -0
- package/dist/types/api/app.d.ts +99 -0
- package/dist/types/api/auth-pure.d.ts +51 -0
- package/dist/types/api/auth.d.ts +17 -0
- package/dist/types/api/authorize.d.ts +24 -0
- package/dist/types/api/batch-deny.d.ts +22 -0
- package/dist/types/api/batch-routes.d.ts +69 -0
- package/dist/types/api/batch-store.d.ts +96 -0
- package/dist/types/api/batcher.d.ts +220 -0
- package/dist/types/api/browser.d.ts +14 -0
- package/dist/types/api/chain-budget.d.ts +61 -0
- package/dist/types/api/chain-views.d.ts +87 -0
- package/dist/types/api/client.d.ts +295 -0
- package/dist/types/api/deny-overlay.d.ts +81 -0
- package/dist/types/api/errors.d.ts +30 -0
- package/dist/types/api/file-stores.d.ts +7 -0
- package/dist/types/api/index.d.ts +17 -0
- package/dist/types/api/secure-fs.d.ts +12 -0
- package/dist/types/api/store.d.ts +51 -0
- package/dist/types/api/stores.d.ts +171 -0
- package/dist/types/api/verify-assertion.d.ts +22 -0
- package/dist/types/api/wire.d.ts +27 -0
- package/dist/types/chain/abis.d.ts +2125 -0
- package/dist/types/chain/browser.d.ts +20 -0
- package/dist/types/chain/deployment-fs.d.ts +15 -0
- package/dist/types/chain/deployment.d.ts +33 -0
- package/dist/types/chain/deployments.generated.d.ts +1 -0
- package/dist/types/chain/gas.d.ts +47 -0
- package/dist/types/chain/history.d.ts +52 -0
- package/dist/types/chain/index.d.ts +13 -0
- package/dist/types/chain/local.d.ts +34 -0
- package/dist/types/chain/logs.d.ts +62 -0
- package/dist/types/chain/placements.d.ts +92 -0
- package/dist/types/chain/read-scope.d.ts +66 -0
- package/dist/types/chain/registry.d.ts +16 -0
- package/dist/types/chain/sponsored.d.ts +93 -0
- package/dist/types/chain/transport.d.ts +53 -0
- package/dist/types/chain/writes.d.ts +165 -0
- package/dist/types/crypto/aead.d.ts +5 -0
- package/dist/types/crypto/bytes.d.ts +4 -0
- package/dist/types/crypto/derive.d.ts +20 -0
- package/dist/types/crypto/index.d.ts +6 -0
- package/dist/types/crypto/object.d.ts +42 -0
- package/dist/types/crypto/payload.d.ts +21 -0
- package/dist/types/crypto/wraps.d.ts +36 -0
- package/dist/types/grant-advisor/advise.d.ts +23 -0
- package/dist/types/grant-advisor/authority.d.ts +44 -0
- package/dist/types/grant-advisor/index.d.ts +5 -0
- package/dist/types/grant-advisor/manifest.d.ts +66 -0
- package/dist/types/grant-advisor/policy.d.ts +91 -0
- package/dist/types/grant-advisor/signatures.d.ts +10 -0
- package/dist/types/mida-context-sdk/daemon.d.ts +27 -0
- package/dist/types/mida-context-sdk/errors.d.ts +27 -0
- package/dist/types/mida-context-sdk/index.d.ts +5 -0
- package/dist/types/mida-context-sdk/local.d.ts +40 -0
- package/dist/types/mida-context-sdk/mida.d.ts +65 -0
- package/dist/types/mida-context-sdk/transport.d.ts +137 -0
- package/dist/types/protocol/batch.d.ts +161 -0
- package/dist/types/protocol/constants.d.ts +56 -0
- package/dist/types/protocol/errors.d.ts +15 -0
- package/dist/types/protocol/ids.d.ts +72 -0
- package/dist/types/protocol/index.d.ts +11 -0
- package/dist/types/protocol/namespaces.d.ts +15 -0
- package/dist/types/protocol/owner-link.d.ts +146 -0
- package/dist/types/protocol/typed-data.d.ts +365 -0
- package/dist/types/protocol/types.d.ts +215 -0
- package/dist/types/protocol/webauthn-assertion.d.ts +29 -0
- package/dist/types/protocol/wire.d.ts +8 -0
- package/dist/types/sdk/agent.d.ts +279 -0
- package/dist/types/sdk/batched.d.ts +68 -0
- package/dist/types/sdk/connect.d.ts +88 -0
- package/dist/types/sdk/index.d.ts +7 -0
- package/dist/types/sdk/request-store.d.ts +26 -0
- package/dist/types/storage/index.d.ts +23 -0
- package/package.json +50 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { Address, Hex } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The wire contract between the terminal (`mida init --passkey`, `approve`, `revoke`) and the
|
|
4
|
+
* owner page at https://app.midacontext.xyz. `apps/owner-page/PROTOCOL.md` is the spec; this
|
|
5
|
+
* file is the ONE implementation both sides share — the page and the terminal must never drift
|
|
6
|
+
* on request shape, hashing or the pairing code.
|
|
7
|
+
*
|
|
8
|
+
* In: `https://<origin>/<flow>#v=1&req=<base64url JSON>&port=<n>&nonce=<hex16>`
|
|
9
|
+
* Out: `http://127.0.0.1:<port>/mida-return#nonce=<nonce>&result=<base64url JSON>`
|
|
10
|
+
*
|
|
11
|
+
* Two rules do the security work:
|
|
12
|
+
* - Everything identity-relevant lives inside `req`, so `requestHash = sha256(reqBytes)` covers
|
|
13
|
+
* all of it — and the same bytes feed the pairing code.
|
|
14
|
+
* - The result carries no secret material — `buildOwnerResult` runs the sanitiser and refuses
|
|
15
|
+
* to serialize a 32-byte value under a key whose name contains prf, seed, secret, private, key.
|
|
16
|
+
*
|
|
17
|
+
* This module is bundled into the browser page — no node imports, no Buffer, no process.
|
|
18
|
+
*/
|
|
19
|
+
export type OwnerLinkFlow = "signup" | "approve" | "revoke";
|
|
20
|
+
export declare class OwnerLinkError extends Error {
|
|
21
|
+
readonly reason: string;
|
|
22
|
+
constructor(reason: string);
|
|
23
|
+
}
|
|
24
|
+
export interface OwnerLinkProject {
|
|
25
|
+
id: string;
|
|
26
|
+
label: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The decoded `req` envelope. Fields are flow-specific: `request`+`manifest` belong to approve,
|
|
30
|
+
* `agentId`+`readers` to revoke, `entries` to the project-list signature the page returns. The
|
|
31
|
+
* parser checks the envelope's shape and field types; the flows verify the contents (agent
|
|
32
|
+
* signature, manifest hash, chain state) before any passkey prompt.
|
|
33
|
+
*/
|
|
34
|
+
export interface OwnerLinkRequest {
|
|
35
|
+
chainId: number;
|
|
36
|
+
/** Expected owner address — present on approve/revoke, absent on signup. */
|
|
37
|
+
owner?: Address;
|
|
38
|
+
/** The agent's signed access request (approve). Deep verification happens in the advisor. */
|
|
39
|
+
request?: Record<string, unknown>;
|
|
40
|
+
/** The agent's signed manifest, if the terminal inlined it; else the page fetches it. */
|
|
41
|
+
manifest?: Record<string, unknown>;
|
|
42
|
+
/** The agent to revoke (revoke). */
|
|
43
|
+
agentId?: Hex;
|
|
44
|
+
/** Agent ids the terminal believes survive a revoke — re-checked on chain before re-wrapping. */
|
|
45
|
+
readers?: Hex[];
|
|
46
|
+
project?: OwnerLinkProject;
|
|
47
|
+
/** Current project-list entries the page re-signs after an approve. */
|
|
48
|
+
entries?: Record<string, unknown>[];
|
|
49
|
+
/** The new approved-projects row to append (approve): {agent, projectId, root}. */
|
|
50
|
+
entry?: {
|
|
51
|
+
agent: string;
|
|
52
|
+
projectId: string;
|
|
53
|
+
root: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export interface ParsedOwnerLink {
|
|
57
|
+
flow: OwnerLinkFlow;
|
|
58
|
+
/** The exact decoded req bytes — the pairing code and requestHash both derive from these. */
|
|
59
|
+
requestBytes: Uint8Array;
|
|
60
|
+
requestHash: Hex;
|
|
61
|
+
req: OwnerLinkRequest;
|
|
62
|
+
nonce: string;
|
|
63
|
+
/** Absent when the link carries no port — the page then shows the result instead of returning. */
|
|
64
|
+
port?: number;
|
|
65
|
+
}
|
|
66
|
+
export declare function ownerLinkBase64UrlEncode(bytes: Uint8Array): string;
|
|
67
|
+
export declare function ownerLinkBase64UrlDecode(text: string): Uint8Array;
|
|
68
|
+
/** Throws on the first 32-byte value found under a secret-looking key, anywhere in the tree. */
|
|
69
|
+
export declare function assertNoSecretMaterial(value: unknown, path?: string): void;
|
|
70
|
+
/**
|
|
71
|
+
* 256 common, distinct words — one per byte value. Chosen to be easy to say over a screen share
|
|
72
|
+
* and hard to confuse with each other; the list is the contract, so the entries and their order
|
|
73
|
+
* never change.
|
|
74
|
+
*/
|
|
75
|
+
export declare const PAIRING_WORDS: readonly string[];
|
|
76
|
+
/**
|
|
77
|
+
* Three words and two digits from the exact request bytes. Example: "atlas sugar orbit 07".
|
|
78
|
+
* Both sides call this on the same bytes and must print the same string.
|
|
79
|
+
*
|
|
80
|
+
* FROZEN: the word list, the domain separator, and the byte-to-code mapping are the wire
|
|
81
|
+
* contract between the page and the terminal. Changing any of them orphans every in-flight
|
|
82
|
+
* request — bump the "v1" tag instead, never edit in place.
|
|
83
|
+
*/
|
|
84
|
+
export declare function pairingCode(requestBytes: Uint8Array): string;
|
|
85
|
+
/** sha256 of the exact request bytes, as 0x-hex — what the result's `requestHash` must equal. */
|
|
86
|
+
export declare function requestHash(requestBytes: Uint8Array): Hex;
|
|
87
|
+
/**
|
|
88
|
+
* Parse the link fragment. `fragment` is everything after `#` in the page URL. Every check that
|
|
89
|
+
* can fail throws OwnerLinkError with a plain-words reason — a malformed link is refused before
|
|
90
|
+
* any passkey prompt, and the page shows the reason so the owner can tell a broken terminal from
|
|
91
|
+
* a forged link.
|
|
92
|
+
*/
|
|
93
|
+
export declare function parseOwnerLink(fragment: string, flow: OwnerLinkFlow): ParsedOwnerLink;
|
|
94
|
+
/**
|
|
95
|
+
* Terminal side: build the page link for a request. The request object is validated by the same
|
|
96
|
+
* rules the page applies, then serialized once — `requestBytes` is exactly what the page decodes,
|
|
97
|
+
* so the pairing code and the result's `requestHash` can never drift apart.
|
|
98
|
+
*/
|
|
99
|
+
export declare function buildOwnerLink(input: {
|
|
100
|
+
origin: string;
|
|
101
|
+
flow: OwnerLinkFlow;
|
|
102
|
+
req: OwnerLinkRequest;
|
|
103
|
+
nonce: string;
|
|
104
|
+
port?: number;
|
|
105
|
+
}): {
|
|
106
|
+
url: string;
|
|
107
|
+
requestBytes: Uint8Array;
|
|
108
|
+
requestHash: Hex;
|
|
109
|
+
};
|
|
110
|
+
/** What the page hands back to the terminal — and nothing more. See PROTOCOL.md. */
|
|
111
|
+
export interface OwnerLinkResult {
|
|
112
|
+
v: 1;
|
|
113
|
+
/** "pending" is the sponsor-accepted-but-unconfirmed state — carries the operation hash, never a resend. */
|
|
114
|
+
status: "success" | "cancelled" | "failed" | "pending";
|
|
115
|
+
nonce: string;
|
|
116
|
+
requestHash: Hex;
|
|
117
|
+
owner: Address | null;
|
|
118
|
+
transactions: Hex[];
|
|
119
|
+
operations: Hex[];
|
|
120
|
+
/** The signed project-list entry (approve only). */
|
|
121
|
+
entry?: Record<string, unknown>;
|
|
122
|
+
/** The passkey's P-256 point (signup only). */
|
|
123
|
+
publicKey?: {
|
|
124
|
+
x: Hex;
|
|
125
|
+
y: Hex;
|
|
126
|
+
};
|
|
127
|
+
/** Plain-words reason when status is "failed" or "cancelled". */
|
|
128
|
+
reason?: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Build the result object the page returns. The sanitiser is the guard: any 32-byte value under
|
|
132
|
+
* a secret-looking key name — anywhere in the structure — throws before it can reach the URL.
|
|
133
|
+
*/
|
|
134
|
+
export declare function buildOwnerResult(result: OwnerLinkResult): OwnerLinkResult;
|
|
135
|
+
/**
|
|
136
|
+
* Serialize the result and wrap it in the local return URL. The host is ALWAYS the literal
|
|
137
|
+
* 127.0.0.1 — never a name, never taken from the link — so a crafted link cannot aim the result
|
|
138
|
+
* at another machine.
|
|
139
|
+
*/
|
|
140
|
+
export declare function buildOwnerReturnUrl(port: number, nonce: string, result: OwnerLinkResult): string;
|
|
141
|
+
/**
|
|
142
|
+
* Terminal side: decode and validate the `result=` fragment parameter. Strict about keys, types
|
|
143
|
+
* and the no-secret-material rule — a result that does not match this shape is a page bug or a
|
|
144
|
+
* forgery and is refused before the caller reads a single field.
|
|
145
|
+
*/
|
|
146
|
+
export declare function parseOwnerResult(encoded: string): OwnerLinkResult;
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
2
|
+
import type { AccessRequest } from "./types.js";
|
|
3
|
+
export type UnsignedAccessRequest = Omit<AccessRequest, "agentSignature">;
|
|
4
|
+
export declare const DOMAIN_NAMES: {
|
|
5
|
+
readonly capabilityRegistry: "Mida Capability Registry";
|
|
6
|
+
readonly accessRequest: "Mida Context";
|
|
7
|
+
readonly manifest: "Mida Agent Capability Manifest";
|
|
8
|
+
readonly httpRequest: "Mida Context API";
|
|
9
|
+
};
|
|
10
|
+
export declare function midaDomain(name: string, chainId: bigint, verifyingContract: Address): {
|
|
11
|
+
name: string;
|
|
12
|
+
version: string;
|
|
13
|
+
chainId: bigint;
|
|
14
|
+
verifyingContract: `0x${string}`;
|
|
15
|
+
};
|
|
16
|
+
export declare const ACCESS_REQUEST_TYPES: {
|
|
17
|
+
readonly MidaAccessRequestV1: readonly [{
|
|
18
|
+
readonly name: "requestId";
|
|
19
|
+
readonly type: "bytes32";
|
|
20
|
+
}, {
|
|
21
|
+
readonly name: "nonce";
|
|
22
|
+
readonly type: "bytes32";
|
|
23
|
+
}, {
|
|
24
|
+
readonly name: "agentId";
|
|
25
|
+
readonly type: "bytes32";
|
|
26
|
+
}, {
|
|
27
|
+
readonly name: "purposeIdHash";
|
|
28
|
+
readonly type: "bytes32";
|
|
29
|
+
}, {
|
|
30
|
+
readonly name: "callbackOriginHash";
|
|
31
|
+
readonly type: "bytes32";
|
|
32
|
+
}, {
|
|
33
|
+
readonly name: "manifestHash";
|
|
34
|
+
readonly type: "bytes32";
|
|
35
|
+
}, {
|
|
36
|
+
readonly name: "manifestVersion";
|
|
37
|
+
readonly type: "uint64";
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "policyVersionHash";
|
|
40
|
+
readonly type: "bytes32";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "namespaceTreeVersionHash";
|
|
43
|
+
readonly type: "bytes32";
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "scopesHash";
|
|
46
|
+
readonly type: "bytes32";
|
|
47
|
+
}, {
|
|
48
|
+
readonly name: "issuedAt";
|
|
49
|
+
readonly type: "uint64";
|
|
50
|
+
}, {
|
|
51
|
+
readonly name: "requestExpiresAt";
|
|
52
|
+
readonly type: "uint64";
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "capabilityExpiresAt";
|
|
55
|
+
readonly type: "uint64";
|
|
56
|
+
}];
|
|
57
|
+
};
|
|
58
|
+
export declare const MANIFEST_BINDING_TYPES: {
|
|
59
|
+
readonly ManifestBinding: readonly [{
|
|
60
|
+
readonly name: "bodyHash";
|
|
61
|
+
readonly type: "bytes32";
|
|
62
|
+
}, {
|
|
63
|
+
readonly name: "agentId";
|
|
64
|
+
readonly type: "bytes32";
|
|
65
|
+
}, {
|
|
66
|
+
readonly name: "manifestVersion";
|
|
67
|
+
readonly type: "uint64";
|
|
68
|
+
}];
|
|
69
|
+
};
|
|
70
|
+
export declare const HTTP_REQUEST_TYPES: {
|
|
71
|
+
readonly MidaHttpRequestV1: readonly [{
|
|
72
|
+
readonly name: "signer";
|
|
73
|
+
readonly type: "address";
|
|
74
|
+
}, {
|
|
75
|
+
readonly name: "methodHash";
|
|
76
|
+
readonly type: "bytes32";
|
|
77
|
+
}, {
|
|
78
|
+
readonly name: "targetHash";
|
|
79
|
+
readonly type: "bytes32";
|
|
80
|
+
}, {
|
|
81
|
+
readonly name: "bodyHash";
|
|
82
|
+
readonly type: "bytes32";
|
|
83
|
+
}, {
|
|
84
|
+
readonly name: "timestamp";
|
|
85
|
+
readonly type: "uint64";
|
|
86
|
+
}, {
|
|
87
|
+
readonly name: "nonce";
|
|
88
|
+
readonly type: "bytes32";
|
|
89
|
+
}];
|
|
90
|
+
};
|
|
91
|
+
export declare const AGENT_REGISTRATION_TYPES: {
|
|
92
|
+
readonly MidaAgentRegistrationV1: readonly [{
|
|
93
|
+
readonly name: "agentId";
|
|
94
|
+
readonly type: "bytes32";
|
|
95
|
+
}, {
|
|
96
|
+
readonly name: "operator";
|
|
97
|
+
readonly type: "address";
|
|
98
|
+
}, {
|
|
99
|
+
readonly name: "signer";
|
|
100
|
+
readonly type: "address";
|
|
101
|
+
}, {
|
|
102
|
+
readonly name: "encryptionPublicKey";
|
|
103
|
+
readonly type: "bytes32";
|
|
104
|
+
}, {
|
|
105
|
+
readonly name: "encryptionKeyVersion";
|
|
106
|
+
readonly type: "uint32";
|
|
107
|
+
}, {
|
|
108
|
+
readonly name: "callbackOriginHash";
|
|
109
|
+
readonly type: "bytes32";
|
|
110
|
+
}, {
|
|
111
|
+
readonly name: "capabilityManifestHash";
|
|
112
|
+
readonly type: "bytes32";
|
|
113
|
+
}, {
|
|
114
|
+
readonly name: "capabilityManifestVersion";
|
|
115
|
+
readonly type: "uint64";
|
|
116
|
+
}];
|
|
117
|
+
};
|
|
118
|
+
export declare const SIGNER_ROTATION_TYPES: {
|
|
119
|
+
readonly MidaSignerRotationV1: readonly [{
|
|
120
|
+
readonly name: "agentId";
|
|
121
|
+
readonly type: "bytes32";
|
|
122
|
+
}, {
|
|
123
|
+
readonly name: "newSigner";
|
|
124
|
+
readonly type: "address";
|
|
125
|
+
}, {
|
|
126
|
+
readonly name: "rotationNonce";
|
|
127
|
+
readonly type: "uint64";
|
|
128
|
+
}];
|
|
129
|
+
};
|
|
130
|
+
export declare function accessRequestTypedData(request: UnsignedAccessRequest): {
|
|
131
|
+
domain: {
|
|
132
|
+
name: string;
|
|
133
|
+
version: string;
|
|
134
|
+
chainId: bigint;
|
|
135
|
+
verifyingContract: `0x${string}`;
|
|
136
|
+
};
|
|
137
|
+
types: {
|
|
138
|
+
readonly MidaAccessRequestV1: readonly [{
|
|
139
|
+
readonly name: "requestId";
|
|
140
|
+
readonly type: "bytes32";
|
|
141
|
+
}, {
|
|
142
|
+
readonly name: "nonce";
|
|
143
|
+
readonly type: "bytes32";
|
|
144
|
+
}, {
|
|
145
|
+
readonly name: "agentId";
|
|
146
|
+
readonly type: "bytes32";
|
|
147
|
+
}, {
|
|
148
|
+
readonly name: "purposeIdHash";
|
|
149
|
+
readonly type: "bytes32";
|
|
150
|
+
}, {
|
|
151
|
+
readonly name: "callbackOriginHash";
|
|
152
|
+
readonly type: "bytes32";
|
|
153
|
+
}, {
|
|
154
|
+
readonly name: "manifestHash";
|
|
155
|
+
readonly type: "bytes32";
|
|
156
|
+
}, {
|
|
157
|
+
readonly name: "manifestVersion";
|
|
158
|
+
readonly type: "uint64";
|
|
159
|
+
}, {
|
|
160
|
+
readonly name: "policyVersionHash";
|
|
161
|
+
readonly type: "bytes32";
|
|
162
|
+
}, {
|
|
163
|
+
readonly name: "namespaceTreeVersionHash";
|
|
164
|
+
readonly type: "bytes32";
|
|
165
|
+
}, {
|
|
166
|
+
readonly name: "scopesHash";
|
|
167
|
+
readonly type: "bytes32";
|
|
168
|
+
}, {
|
|
169
|
+
readonly name: "issuedAt";
|
|
170
|
+
readonly type: "uint64";
|
|
171
|
+
}, {
|
|
172
|
+
readonly name: "requestExpiresAt";
|
|
173
|
+
readonly type: "uint64";
|
|
174
|
+
}, {
|
|
175
|
+
readonly name: "capabilityExpiresAt";
|
|
176
|
+
readonly type: "uint64";
|
|
177
|
+
}];
|
|
178
|
+
};
|
|
179
|
+
primaryType: "MidaAccessRequestV1";
|
|
180
|
+
message: {
|
|
181
|
+
requestId: `0x${string}`;
|
|
182
|
+
nonce: `0x${string}`;
|
|
183
|
+
agentId: `0x${string}`;
|
|
184
|
+
purposeIdHash: `0x${string}`;
|
|
185
|
+
callbackOriginHash: `0x${string}`;
|
|
186
|
+
manifestHash: `0x${string}`;
|
|
187
|
+
manifestVersion: bigint;
|
|
188
|
+
policyVersionHash: `0x${string}`;
|
|
189
|
+
namespaceTreeVersionHash: `0x${string}`;
|
|
190
|
+
scopesHash: `0x${string}`;
|
|
191
|
+
issuedAt: bigint;
|
|
192
|
+
requestExpiresAt: bigint;
|
|
193
|
+
capabilityExpiresAt: bigint;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
export declare const accessRequestHash: (request: UnsignedAccessRequest) => Hex;
|
|
197
|
+
export declare function manifestBindingTypedData(input: {
|
|
198
|
+
chainId: bigint;
|
|
199
|
+
capabilityRegistry: Address;
|
|
200
|
+
bodyHash: Hex;
|
|
201
|
+
agentId: Hex;
|
|
202
|
+
manifestVersion: bigint;
|
|
203
|
+
}): {
|
|
204
|
+
domain: {
|
|
205
|
+
name: string;
|
|
206
|
+
version: string;
|
|
207
|
+
chainId: bigint;
|
|
208
|
+
verifyingContract: `0x${string}`;
|
|
209
|
+
};
|
|
210
|
+
types: {
|
|
211
|
+
readonly ManifestBinding: readonly [{
|
|
212
|
+
readonly name: "bodyHash";
|
|
213
|
+
readonly type: "bytes32";
|
|
214
|
+
}, {
|
|
215
|
+
readonly name: "agentId";
|
|
216
|
+
readonly type: "bytes32";
|
|
217
|
+
}, {
|
|
218
|
+
readonly name: "manifestVersion";
|
|
219
|
+
readonly type: "uint64";
|
|
220
|
+
}];
|
|
221
|
+
};
|
|
222
|
+
primaryType: "ManifestBinding";
|
|
223
|
+
message: {
|
|
224
|
+
bodyHash: `0x${string}`;
|
|
225
|
+
agentId: `0x${string}`;
|
|
226
|
+
manifestVersion: bigint;
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
export declare function canonicalTarget(pathname: string, query?: Record<string, string>): string;
|
|
230
|
+
export declare function httpRequestTypedData(input: {
|
|
231
|
+
chainId: bigint;
|
|
232
|
+
capabilityRegistry: Address;
|
|
233
|
+
signer: Address;
|
|
234
|
+
method: string;
|
|
235
|
+
target: string;
|
|
236
|
+
body: Uint8Array;
|
|
237
|
+
timestamp: bigint;
|
|
238
|
+
nonce: Hex;
|
|
239
|
+
}): {
|
|
240
|
+
domain: {
|
|
241
|
+
name: string;
|
|
242
|
+
version: string;
|
|
243
|
+
chainId: bigint;
|
|
244
|
+
verifyingContract: `0x${string}`;
|
|
245
|
+
};
|
|
246
|
+
types: {
|
|
247
|
+
readonly MidaHttpRequestV1: readonly [{
|
|
248
|
+
readonly name: "signer";
|
|
249
|
+
readonly type: "address";
|
|
250
|
+
}, {
|
|
251
|
+
readonly name: "methodHash";
|
|
252
|
+
readonly type: "bytes32";
|
|
253
|
+
}, {
|
|
254
|
+
readonly name: "targetHash";
|
|
255
|
+
readonly type: "bytes32";
|
|
256
|
+
}, {
|
|
257
|
+
readonly name: "bodyHash";
|
|
258
|
+
readonly type: "bytes32";
|
|
259
|
+
}, {
|
|
260
|
+
readonly name: "timestamp";
|
|
261
|
+
readonly type: "uint64";
|
|
262
|
+
}, {
|
|
263
|
+
readonly name: "nonce";
|
|
264
|
+
readonly type: "bytes32";
|
|
265
|
+
}];
|
|
266
|
+
};
|
|
267
|
+
primaryType: "MidaHttpRequestV1";
|
|
268
|
+
message: {
|
|
269
|
+
signer: `0x${string}`;
|
|
270
|
+
methodHash: `0x${string}`;
|
|
271
|
+
targetHash: `0x${string}`;
|
|
272
|
+
bodyHash: `0x${string}`;
|
|
273
|
+
timestamp: bigint;
|
|
274
|
+
nonce: `0x${string}`;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
export declare function agentRegistrationTypedData(input: {
|
|
278
|
+
chainId: bigint;
|
|
279
|
+
capabilityRegistry: Address;
|
|
280
|
+
agentId: Hex;
|
|
281
|
+
operator: Address;
|
|
282
|
+
signer: Address;
|
|
283
|
+
encryptionPublicKey: Hex;
|
|
284
|
+
encryptionKeyVersion: number;
|
|
285
|
+
callbackOriginHash: Hex;
|
|
286
|
+
capabilityManifestHash: Hex;
|
|
287
|
+
capabilityManifestVersion: bigint;
|
|
288
|
+
}): {
|
|
289
|
+
domain: {
|
|
290
|
+
name: string;
|
|
291
|
+
version: string;
|
|
292
|
+
chainId: bigint;
|
|
293
|
+
verifyingContract: `0x${string}`;
|
|
294
|
+
};
|
|
295
|
+
types: {
|
|
296
|
+
readonly MidaAgentRegistrationV1: readonly [{
|
|
297
|
+
readonly name: "agentId";
|
|
298
|
+
readonly type: "bytes32";
|
|
299
|
+
}, {
|
|
300
|
+
readonly name: "operator";
|
|
301
|
+
readonly type: "address";
|
|
302
|
+
}, {
|
|
303
|
+
readonly name: "signer";
|
|
304
|
+
readonly type: "address";
|
|
305
|
+
}, {
|
|
306
|
+
readonly name: "encryptionPublicKey";
|
|
307
|
+
readonly type: "bytes32";
|
|
308
|
+
}, {
|
|
309
|
+
readonly name: "encryptionKeyVersion";
|
|
310
|
+
readonly type: "uint32";
|
|
311
|
+
}, {
|
|
312
|
+
readonly name: "callbackOriginHash";
|
|
313
|
+
readonly type: "bytes32";
|
|
314
|
+
}, {
|
|
315
|
+
readonly name: "capabilityManifestHash";
|
|
316
|
+
readonly type: "bytes32";
|
|
317
|
+
}, {
|
|
318
|
+
readonly name: "capabilityManifestVersion";
|
|
319
|
+
readonly type: "uint64";
|
|
320
|
+
}];
|
|
321
|
+
};
|
|
322
|
+
primaryType: "MidaAgentRegistrationV1";
|
|
323
|
+
message: {
|
|
324
|
+
agentId: `0x${string}`;
|
|
325
|
+
operator: `0x${string}`;
|
|
326
|
+
signer: `0x${string}`;
|
|
327
|
+
encryptionPublicKey: `0x${string}`;
|
|
328
|
+
encryptionKeyVersion: number;
|
|
329
|
+
callbackOriginHash: `0x${string}`;
|
|
330
|
+
capabilityManifestHash: `0x${string}`;
|
|
331
|
+
capabilityManifestVersion: bigint;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
export declare function signerRotationTypedData(input: {
|
|
335
|
+
chainId: bigint;
|
|
336
|
+
capabilityRegistry: Address;
|
|
337
|
+
agentId: Hex;
|
|
338
|
+
newSigner: Address;
|
|
339
|
+
rotationNonce: bigint;
|
|
340
|
+
}): {
|
|
341
|
+
domain: {
|
|
342
|
+
name: string;
|
|
343
|
+
version: string;
|
|
344
|
+
chainId: bigint;
|
|
345
|
+
verifyingContract: `0x${string}`;
|
|
346
|
+
};
|
|
347
|
+
types: {
|
|
348
|
+
readonly MidaSignerRotationV1: readonly [{
|
|
349
|
+
readonly name: "agentId";
|
|
350
|
+
readonly type: "bytes32";
|
|
351
|
+
}, {
|
|
352
|
+
readonly name: "newSigner";
|
|
353
|
+
readonly type: "address";
|
|
354
|
+
}, {
|
|
355
|
+
readonly name: "rotationNonce";
|
|
356
|
+
readonly type: "uint64";
|
|
357
|
+
}];
|
|
358
|
+
};
|
|
359
|
+
primaryType: "MidaSignerRotationV1";
|
|
360
|
+
message: {
|
|
361
|
+
agentId: `0x${string}`;
|
|
362
|
+
newSigner: `0x${string}`;
|
|
363
|
+
rotationNonce: bigint;
|
|
364
|
+
};
|
|
365
|
+
};
|