@tenuo/core 0.2.4-beta.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 +187 -0
- package/README.md +62 -0
- package/dist/api.d.ts +270 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +8 -0
- package/dist/api.js.map +1 -0
- package/dist/client.d.ts +18 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +417 -0
- package/dist/client.js.map +1 -0
- package/dist/constraints.d.ts +11 -0
- package/dist/constraints.d.ts.map +1 -0
- package/dist/constraints.js +32 -0
- package/dist/constraints.js.map +1 -0
- package/dist/errors.d.ts +19 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +37 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/package.json +1 -0
- package/dist/generated/tenuo_wasm.d.ts +290 -0
- package/dist/generated/tenuo_wasm.js +1415 -0
- package/dist/generated/tenuo_wasm_bg.wasm +0 -0
- package/dist/generated/tenuo_wasm_bg.wasm.d.ts +58 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp.d.ts +4 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +258 -0
- package/dist/mcp.js.map +1 -0
- package/dist/nonce.d.ts +11 -0
- package/dist/nonce.d.ts.map +1 -0
- package/dist/nonce.js +28 -0
- package/dist/nonce.js.map +1 -0
- package/dist/session.d.ts +19 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +50 -0
- package/dist/session.js.map +1 -0
- package/dist/wasm.d.ts +107 -0
- package/dist/wasm.d.ts.map +1 -0
- package/dist/wasm.js +64 -0
- package/dist/wasm.js.map +1 -0
- package/package.json +64 -0
|
Binary file
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const check_access: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number) => any;
|
|
5
|
+
export const check_access_with_pop: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number, i: number) => any;
|
|
6
|
+
export const check_chain_access: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number) => any;
|
|
7
|
+
export const check_chain_access_with_approvals: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: any, i: number, j: number) => any;
|
|
8
|
+
export const check_revocation: (a: number, b: number, c: number, d: number) => any;
|
|
9
|
+
export const compute_request_hash_wasm: (a: number, b: number, c: number, d: number, e: any) => any;
|
|
10
|
+
export const create_issuer_warrant: (a: any) => any;
|
|
11
|
+
export const create_sample_warrant: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => any;
|
|
12
|
+
export const create_warrant_from_config: (a: any) => any;
|
|
13
|
+
export const decode_pem_chain_wasm: (a: number, b: number) => any;
|
|
14
|
+
export const decode_warrant: (a: number, b: number) => any;
|
|
15
|
+
export const evaluate_approval_gates: (a: number, b: number, c: number, d: number, e: any) => any;
|
|
16
|
+
export const generate_keypair: () => any;
|
|
17
|
+
export const parse_connect_token: (a: number, b: number) => any;
|
|
18
|
+
export const sign: (a: number, b: number, c: number, d: number, e: number, f: number, g: any) => any;
|
|
19
|
+
export const sign_receipt: (a: any, b: number, c: number) => any;
|
|
20
|
+
export const verify_approval_set: (a: number, b: number, c: number, d: number, e: any) => any;
|
|
21
|
+
export const verify_signed_approval: (a: number, b: number) => any;
|
|
22
|
+
export const verify_srl: (a: number, b: number, c: number, d: number) => any;
|
|
23
|
+
export const init_panic_hook: () => void;
|
|
24
|
+
export const __wbg_sdkcontext_free: (a: number, b: number) => void;
|
|
25
|
+
export const __wbg_sdksession_free: (a: number, b: number) => void;
|
|
26
|
+
export const sdkInspectParts: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
27
|
+
export const sdkInspectWarrant: (a: number, b: number) => [number, number, number];
|
|
28
|
+
export const sdkSignApproval: (a: number, b: number, c: number, d: any, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number, number];
|
|
29
|
+
export const sdkSignPublishedRevocationList: (a: any, b: number, c: number, d: number) => [number, number, number, number];
|
|
30
|
+
export const sdkSignRevocationList: (a: any, b: number, c: number) => [number, number, number, number];
|
|
31
|
+
export const sdkVerifyReceipt: (a: number, b: number) => [number, number, number];
|
|
32
|
+
export const sdkVerifyReceiptChain: (a: number, b: number, c: any) => [number, number, number];
|
|
33
|
+
export const sdkcontext_authorize: (a: number, b: number, c: number, d: number, e: any, f: any, g: any, h: number, i: number) => any;
|
|
34
|
+
export const sdkcontext_authorizeAsOf: (a: number, b: number, c: number, d: number, e: any, f: number, g: any, h: any) => any;
|
|
35
|
+
export const sdkcontext_authorizePresented: (a: number, b: any, c: number, d: number, e: any, f: number, g: number, h: any, i: any, j: number, k: number) => any;
|
|
36
|
+
export const sdkcontext_fromTrustedRoots: (a: any) => [number, number, number];
|
|
37
|
+
export const sdkcontext_loadRevocationList: (a: number, b: number, c: number) => [number, number];
|
|
38
|
+
export const sdkcontext_mint: (a: number, b: any, c: number, d: any) => [number, number, number];
|
|
39
|
+
export const sdkcontext_narrow: (a: number, b: number, c: any) => [number, number, number];
|
|
40
|
+
export const sdkcontext_new: () => number;
|
|
41
|
+
export const sdkcontext_signPop: (a: number, b: number, c: number, d: number, e: any) => [number, number, number, number];
|
|
42
|
+
export const sdkcontext_signRevocationList: (a: number, b: any) => [number, number, number, number];
|
|
43
|
+
export const sdksession_dedupKey: (a: number, b: number, c: number, d: any) => [number, number, number, number];
|
|
44
|
+
export const sdksession_exportWire: (a: number) => [number, number, number];
|
|
45
|
+
export const sdksession_fromChain: (a: any, b: number, c: number) => [number, number, number];
|
|
46
|
+
export const sdksession_fromParts: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
47
|
+
export const sdksession_fromWire: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
48
|
+
export const sdksession_toStackWire: (a: number) => [number, number, number, number];
|
|
49
|
+
export const sdksession_toWire: (a: number) => [number, number, number];
|
|
50
|
+
export const sdksession_warrantIds: (a: number) => [number, number, number];
|
|
51
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
52
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
53
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
54
|
+
export const __externref_table_alloc: () => number;
|
|
55
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
56
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
57
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
58
|
+
export const __wbindgen_start: () => void;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { AllowPolicy, ApprovalRequest, ConstraintExpr, CreateTenuoOptions, Decision, DevRoot, EmailConstraint, ExactConstraint, ExecuteOptions, MaxConstraint, McpAttachOptions, McpCallParams, McpHandlerPolicy, McpJsonRpcError, McpVerifyOptions, NarrowInput, NonceStore, OneOfConstraint, PatternConstraint, ProtectedTool, PublicKeyHandle, RequireApproval, Session, SessionAllow, SessionFromWireInput, SessionInput, Tenuo, TenuoErrorCode, TenuoMcp, TenuoMcpMeta, ToolLike, WarrantPart, ToolPolicy, UnderConstraint, } from "./api.ts";
|
|
2
|
+
export { ApprovalRequiredError, AuthorizationDeniedError, TenuoConfigurationError, TenuoError, } from "./errors.ts";
|
|
3
|
+
export { email, exact, max, oneOf, pattern, under } from "./constraints.ts";
|
|
4
|
+
export { memoryNonceStore } from "./nonce.ts";
|
|
5
|
+
export { Session as SessionHandle, isSession } from "./session.ts";
|
|
6
|
+
export { createTenuo } from "./client.ts";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,WAAW,EACX,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,eAAe,EACf,eAAe,EACf,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,eAAe,EACf,OAAO,EACP,YAAY,EACZ,oBAAoB,EACpB,YAAY,EACZ,KAAK,EACL,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,eAAe,GAChB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ApprovalRequiredError, AuthorizationDeniedError, TenuoConfigurationError, TenuoError, } from "./errors.js";
|
|
2
|
+
export { email, exact, max, oneOf, pattern, under } from "./constraints.js";
|
|
3
|
+
export { memoryNonceStore } from "./nonce.js";
|
|
4
|
+
export { Session as SessionHandle, isSession } from "./session.js";
|
|
5
|
+
export { createTenuo } from "./client.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAqCA,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAMV,QAAQ,EACT,MAAM,UAAU,CAAC;AAGlB,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE3D,wBAAgB,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,QAAQ,CAuFhH"}
|
package/dist/mcp.js
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { ApprovalRequiredError, AuthorizationDeniedError, TenuoConfigurationError, TenuoError } from "./errors.js";
|
|
2
|
+
import { nativeSession } from "./session.js";
|
|
3
|
+
export function createMcp(context, decide) {
|
|
4
|
+
const mcp = {
|
|
5
|
+
attach(session, name, args, options) {
|
|
6
|
+
if (options !== undefined) {
|
|
7
|
+
assertKnownKeys(options, ATTACH_OPTION_KEYS, "mcp.attach() options");
|
|
8
|
+
}
|
|
9
|
+
const native = nativeSession(session);
|
|
10
|
+
const wireArgs = stripNulls(args);
|
|
11
|
+
const local = context.authorize(native, name, wireArgs, options?.approvals, undefined, options?.requestId);
|
|
12
|
+
emitReceipt(options?.onReceipt, local.receipt);
|
|
13
|
+
decide(local, name);
|
|
14
|
+
const signature = context.signPop(native, name, wireArgs);
|
|
15
|
+
const warrant = stackWire(native);
|
|
16
|
+
const tenuo = { warrant, signature };
|
|
17
|
+
if (options?.approvals !== undefined && options.approvals.length > 0) {
|
|
18
|
+
return {
|
|
19
|
+
name,
|
|
20
|
+
arguments: wireArgs,
|
|
21
|
+
_meta: {
|
|
22
|
+
tenuo: {
|
|
23
|
+
...tenuo,
|
|
24
|
+
approvals: options.approvals.map(approvalWire),
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return { name, arguments: wireArgs, _meta: { tenuo } };
|
|
30
|
+
},
|
|
31
|
+
async verify(name, args, meta, options) {
|
|
32
|
+
if (options !== undefined) {
|
|
33
|
+
assertKnownKeys(options, VERIFY_OPTION_KEYS, "mcp.verify() options");
|
|
34
|
+
}
|
|
35
|
+
const envelope = tenuoEnvelope(meta);
|
|
36
|
+
if (envelope === undefined) {
|
|
37
|
+
throw new TenuoConfigurationError("MCP call is missing _meta.tenuo. The client must call tenuo.mcp.attach().");
|
|
38
|
+
}
|
|
39
|
+
const decision = context.authorizePresented(envelope.warrant, name, stripNulls(args), envelope.signature, envelope.approvals, options?.allow, options?.requestId);
|
|
40
|
+
// Rust already signed this envelope. Emit before the nonce store can
|
|
41
|
+
// refuse a replay — otherwise an attacker leaves no audit artifact.
|
|
42
|
+
emitReceipt(options?.onReceipt, decision.receipt);
|
|
43
|
+
if (decision.outcome === "allow") {
|
|
44
|
+
await admitPop(options?.nonceStore, envelope.signature, options?.onNonceStoreError);
|
|
45
|
+
}
|
|
46
|
+
decide(decision, name);
|
|
47
|
+
return plainArgs(decision.args);
|
|
48
|
+
},
|
|
49
|
+
handler(name, policyOrExecute, maybeExecute) {
|
|
50
|
+
const policy = isHandlerPolicy(policyOrExecute) ? policyOrExecute : undefined;
|
|
51
|
+
const execute = isHandlerPolicy(policyOrExecute) ? maybeExecute : policyOrExecute;
|
|
52
|
+
if (typeof execute !== "function") {
|
|
53
|
+
throw new TenuoConfigurationError("mcp.handler() requires an execute function");
|
|
54
|
+
}
|
|
55
|
+
return async (args, extra) => {
|
|
56
|
+
const authorized = await mcp.verify(name, args, extra?._meta ?? extra?.meta, {
|
|
57
|
+
...(policy?.allow !== undefined ? { allow: policy.allow } : {}),
|
|
58
|
+
...(policy?.onReceipt !== undefined ? { onReceipt: policy.onReceipt } : {}),
|
|
59
|
+
...(policy?.nonceStore !== undefined ? { nonceStore: policy.nonceStore } : {}),
|
|
60
|
+
...(policy?.onNonceStoreError !== undefined ? { onNonceStoreError: policy.onNonceStoreError } : {}),
|
|
61
|
+
});
|
|
62
|
+
return execute(authorized);
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
jsonRpcError(error) {
|
|
66
|
+
return jsonRpcError(error);
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
return mcp;
|
|
70
|
+
}
|
|
71
|
+
function stackWire(native) {
|
|
72
|
+
const session = native;
|
|
73
|
+
if (typeof session.toStackWire !== "function") {
|
|
74
|
+
throw new TenuoConfigurationError("session is not bound to the WASM core");
|
|
75
|
+
}
|
|
76
|
+
const wire = session.toStackWire();
|
|
77
|
+
if (typeof wire !== "string" || wire.length === 0) {
|
|
78
|
+
throw new TenuoConfigurationError("toStackWire() did not return a warrant stack");
|
|
79
|
+
}
|
|
80
|
+
return wire;
|
|
81
|
+
}
|
|
82
|
+
function approvalWire(value) {
|
|
83
|
+
if (typeof value === "string") {
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
return Buffer.from(value).toString("base64");
|
|
87
|
+
}
|
|
88
|
+
function tenuoEnvelope(meta) {
|
|
89
|
+
if (meta === null || typeof meta !== "object") {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
const root = meta;
|
|
93
|
+
const block = root.tenuo ?? root._meta?.tenuo;
|
|
94
|
+
if (block === null || typeof block !== "object") {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
const tenuo = block;
|
|
98
|
+
if (typeof tenuo.warrant !== "string" || tenuo.warrant.length === 0) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
if (typeof tenuo.signature !== "string" || tenuo.signature.length === 0) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
const approvals = Array.isArray(tenuo.approvals)
|
|
105
|
+
? tenuo.approvals.filter((item) => typeof item === "string")
|
|
106
|
+
: undefined;
|
|
107
|
+
return {
|
|
108
|
+
warrant: tenuo.warrant,
|
|
109
|
+
signature: tenuo.signature,
|
|
110
|
+
...(approvals !== undefined && approvals.length > 0 ? { approvals } : {}),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
const HANDLER_POLICY_KEYS = new Set(["allow", "onReceipt", "nonceStore", "onNonceStoreError"]);
|
|
114
|
+
const VERIFY_OPTION_KEYS = new Set([
|
|
115
|
+
"allow",
|
|
116
|
+
"onReceipt",
|
|
117
|
+
"nonceStore",
|
|
118
|
+
"onNonceStoreError",
|
|
119
|
+
"requestId",
|
|
120
|
+
]);
|
|
121
|
+
const REPLAY_STORE_UNAVAILABLE = "Replay store unavailable";
|
|
122
|
+
const ATTACH_OPTION_KEYS = new Set(["approvals", "onReceipt", "requestId"]);
|
|
123
|
+
const MAX_STRIP_DEPTH = 32;
|
|
124
|
+
const MAX_STRIP_LEN = 1024;
|
|
125
|
+
function assertKnownKeys(value, known, label) {
|
|
126
|
+
const unknown = Object.keys(value).filter((key) => !known.has(key));
|
|
127
|
+
if (unknown[0] !== undefined) {
|
|
128
|
+
throw new TenuoConfigurationError(`${label} has unknown key '${unknown[0]}'. Use ${[...known].join(", ")}.`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function isHandlerPolicy(value) {
|
|
132
|
+
if (value === null || typeof value !== "object" || Array.isArray(value) || typeof value === "function") {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
const keys = Object.keys(value);
|
|
136
|
+
assertKnownKeys(value, HANDLER_POLICY_KEYS, "mcp.handler() policy");
|
|
137
|
+
const record = value;
|
|
138
|
+
const hasAllow = "allow" in record && record.allow !== null && typeof record.allow === "object" && !Array.isArray(record.allow);
|
|
139
|
+
const hasReceipt = "onReceipt" in record && typeof record.onReceipt === "function";
|
|
140
|
+
const hasNonce = "nonceStore" in record && record.nonceStore !== null && typeof record.nonceStore === "object";
|
|
141
|
+
const hasStoreError = "onNonceStoreError" in record && typeof record.onNonceStoreError === "function";
|
|
142
|
+
return keys.length === 0 || hasAllow || hasReceipt || hasNonce || hasStoreError;
|
|
143
|
+
}
|
|
144
|
+
async function admitPop(store, signature, onNonceStoreError) {
|
|
145
|
+
if (store === undefined) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
let admitted;
|
|
149
|
+
try {
|
|
150
|
+
admitted = store.checkAndRecord(signature);
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
throw replayStoreUnavailable(error, onNonceStoreError);
|
|
154
|
+
}
|
|
155
|
+
if (isThenable(admitted)) {
|
|
156
|
+
try {
|
|
157
|
+
admitted = await admitted;
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
throw replayStoreUnavailable(error, onNonceStoreError);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (typeof admitted !== "boolean") {
|
|
164
|
+
throw replayStoreUnavailable(new TenuoConfigurationError("NonceStore.checkAndRecord() must return boolean or Promise<boolean>"), onNonceStoreError);
|
|
165
|
+
}
|
|
166
|
+
if (!admitted) {
|
|
167
|
+
throw new AuthorizationDeniedError("TENUO_INVALID_POP", "PoP replay detected — this exact authorization token was already consumed.");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function replayStoreUnavailable(cause, onNonceStoreError) {
|
|
171
|
+
emitIsolated(onNonceStoreError, cause);
|
|
172
|
+
const error = new TenuoConfigurationError(REPLAY_STORE_UNAVAILABLE);
|
|
173
|
+
if (cause !== undefined) {
|
|
174
|
+
error.cause = cause;
|
|
175
|
+
}
|
|
176
|
+
return error;
|
|
177
|
+
}
|
|
178
|
+
function emitIsolated(hook, error) {
|
|
179
|
+
if (hook === undefined) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
const result = hook(error);
|
|
184
|
+
if (isThenable(result)) {
|
|
185
|
+
void Promise.resolve(result).catch(() => undefined);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
// Isolated — must not change the public error.
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function isThenable(value) {
|
|
193
|
+
return value !== null && typeof value === "object" && "then" in value && typeof value.then === "function";
|
|
194
|
+
}
|
|
195
|
+
function emitReceipt(onReceipt, receipt) {
|
|
196
|
+
if (onReceipt === undefined || receipt === undefined) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
try {
|
|
200
|
+
const result = onReceipt(receipt);
|
|
201
|
+
if (isThenable(result)) {
|
|
202
|
+
void Promise.resolve(result).catch(() => undefined);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
// Receipt hooks must not deny or fail the tool.
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function plainArgs(value) {
|
|
210
|
+
if (value instanceof Map) {
|
|
211
|
+
return Object.fromEntries(value);
|
|
212
|
+
}
|
|
213
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
214
|
+
return { ...value };
|
|
215
|
+
}
|
|
216
|
+
return {};
|
|
217
|
+
}
|
|
218
|
+
/** Same rule as Python `strip_none_values`: drop null so optional MCP args do not break PoP. */
|
|
219
|
+
function stripNulls(args) {
|
|
220
|
+
const keys = Object.keys(args);
|
|
221
|
+
if (keys.length > MAX_STRIP_LEN) {
|
|
222
|
+
throw new TenuoConfigurationError("arguments exceed the TypeScript input budget");
|
|
223
|
+
}
|
|
224
|
+
const out = {};
|
|
225
|
+
for (const [key, value] of Object.entries(args)) {
|
|
226
|
+
if (value === null || value === undefined) {
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
out[key] = Array.isArray(value) ? cleanList(value, 1) : value;
|
|
230
|
+
}
|
|
231
|
+
return out;
|
|
232
|
+
}
|
|
233
|
+
function cleanList(value, depth) {
|
|
234
|
+
if (depth > MAX_STRIP_DEPTH) {
|
|
235
|
+
throw new TenuoConfigurationError("arguments exceed the TypeScript nesting budget");
|
|
236
|
+
}
|
|
237
|
+
if (value.length > MAX_STRIP_LEN) {
|
|
238
|
+
throw new TenuoConfigurationError("arguments exceed the TypeScript input budget");
|
|
239
|
+
}
|
|
240
|
+
const cleaned = [];
|
|
241
|
+
for (const item of value) {
|
|
242
|
+
if (item === null || item === undefined) {
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
cleaned.push(Array.isArray(item) ? cleanList(item, depth + 1) : item);
|
|
246
|
+
}
|
|
247
|
+
return cleaned;
|
|
248
|
+
}
|
|
249
|
+
function jsonRpcError(error) {
|
|
250
|
+
if (error instanceof TenuoError) {
|
|
251
|
+
const code = error.code;
|
|
252
|
+
const rpc = code === "TENUO_APPROVAL_REQUIRED" ? -32002 : code === "TENUO_CANONICALIZATION" ? -32602 : -32001;
|
|
253
|
+
return { code: rpc, message: error.message, data: { tenuo: { code } } };
|
|
254
|
+
}
|
|
255
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
256
|
+
return { code: -32001, message };
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=mcp.js.map
|
package/dist/mcp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACnH,OAAO,EAAE,aAAa,EAAgB,MAAM,cAAc,CAAC;AAG3D,MAAM,UAAU,SAAS,CAAC,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,YAAY,CAAC,KAAc;IAClC,IAAI,KAAK,YAAY,UAAU,EAAE,CAAC;QAChC,MAAM,IAAI,GAAmB,KAAK,CAAC,IAAI,CAAC;QACxC,MAAM,GAAG,GAAG,IAAI,KAAK,yBAAyB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,wBAAwB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC9G,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IAC1E,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;AACnC,CAAC"}
|
package/dist/nonce.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NonceStore } from "./api.ts";
|
|
2
|
+
/**
|
|
3
|
+
* In-process PoP replay store. Same shape as Python `NonceStore`.
|
|
4
|
+
* Not on by default. Does not work across processes — implement
|
|
5
|
+
* `NonceStore` with an async Redis `checkAndRecord` (return
|
|
6
|
+
* `Promise<boolean>`). A rejected Promise fails closed.
|
|
7
|
+
*/
|
|
8
|
+
export declare function memoryNonceStore(options?: {
|
|
9
|
+
readonly ttlSeconds?: number;
|
|
10
|
+
}): NonceStore;
|
|
11
|
+
//# sourceMappingURL=nonce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nonce.d.ts","sourceRoot":"","sources":["../src/nonce.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAmBvF"}
|
package/dist/nonce.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
/**
|
|
3
|
+
* In-process PoP replay store. Same shape as Python `NonceStore`.
|
|
4
|
+
* Not on by default. Does not work across processes — implement
|
|
5
|
+
* `NonceStore` with an async Redis `checkAndRecord` (return
|
|
6
|
+
* `Promise<boolean>`). A rejected Promise fails closed.
|
|
7
|
+
*/
|
|
8
|
+
export function memoryNonceStore(options) {
|
|
9
|
+
const ttlMs = (options?.ttlSeconds ?? 180) * 1000;
|
|
10
|
+
const seen = new Map();
|
|
11
|
+
return {
|
|
12
|
+
checkAndRecord(popSignature) {
|
|
13
|
+
const now = Date.now();
|
|
14
|
+
for (const [key, expiry] of seen) {
|
|
15
|
+
if (expiry <= now) {
|
|
16
|
+
seen.delete(key);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const key = createHash("sha256").update(popSignature).digest("hex");
|
|
20
|
+
if (seen.has(key)) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
seen.set(key, now + ttlMs);
|
|
24
|
+
return true;
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=nonce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nonce.js","sourceRoot":"","sources":["../src/nonce.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAA0C;IACzE,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,UAAU,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC;IAClD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IACvC,OAAO;QACL,cAAc,CAAC,YAAoB;YACjC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACvB,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;gBACjC,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;oBAClB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACnB,CAAC;YACH,CAAC;YACD,MAAM,GAAG,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACpE,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAClB,OAAO,KAAK,CAAC;YACf,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,KAAK,CAAC,CAAC;YAC3B,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Session as SessionContract } from "./api.ts";
|
|
2
|
+
import type { WasmSession } from "./wasm.ts";
|
|
3
|
+
declare const inspect: unique symbol;
|
|
4
|
+
/**
|
|
5
|
+
* Opaque session handle. Structural clones and JSON are not sessions.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Session implements SessionContract {
|
|
8
|
+
readonly [Symbol.toStringTag]: "TenuoSession";
|
|
9
|
+
constructor(native: WasmSession);
|
|
10
|
+
toJSON(): string;
|
|
11
|
+
toString(): string;
|
|
12
|
+
[inspect](): string;
|
|
13
|
+
toWire(): string[];
|
|
14
|
+
dedupKey(tool: string, args: Readonly<Record<string, unknown>>): string;
|
|
15
|
+
}
|
|
16
|
+
export declare function isSession(value: unknown): value is Session;
|
|
17
|
+
export declare function nativeSession(session: Session): WasmSession;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,QAAA,MAAM,OAAO,eAA2C,CAAC;AAGzD;;GAEG;AACH,qBAAa,OAAQ,YAAW,eAAe;IAC7C,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,EAAG,cAAc,CAAU;gBAE5C,MAAM,EAAE,WAAW;IAI/B,MAAM,IAAI,MAAM;IAIhB,QAAQ,IAAI,MAAM;IAIlB,CAAC,OAAO,CAAC,IAAI,MAAM;IAInB,MAAM,IAAI,MAAM,EAAE;IAYlB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM;CASxE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAE1D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAM3D"}
|
package/dist/session.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { TenuoConfigurationError } from "./errors.js";
|
|
2
|
+
const inspect = Symbol.for("nodejs.util.inspect.custom");
|
|
3
|
+
const nativeSessions = new WeakMap();
|
|
4
|
+
/**
|
|
5
|
+
* Opaque session handle. Structural clones and JSON are not sessions.
|
|
6
|
+
*/
|
|
7
|
+
export class Session {
|
|
8
|
+
[Symbol.toStringTag] = "TenuoSession";
|
|
9
|
+
constructor(native) {
|
|
10
|
+
nativeSessions.set(this, native);
|
|
11
|
+
}
|
|
12
|
+
toJSON() {
|
|
13
|
+
return "[TenuoSession]";
|
|
14
|
+
}
|
|
15
|
+
toString() {
|
|
16
|
+
return "[TenuoSession]";
|
|
17
|
+
}
|
|
18
|
+
[inspect]() {
|
|
19
|
+
return "[TenuoSession]";
|
|
20
|
+
}
|
|
21
|
+
toWire() {
|
|
22
|
+
const native = nativeSessions.get(this);
|
|
23
|
+
if (native?.toWire === undefined) {
|
|
24
|
+
throw new TenuoConfigurationError("session is not bound to the WASM core");
|
|
25
|
+
}
|
|
26
|
+
const tokens = native.toWire();
|
|
27
|
+
if (!Array.isArray(tokens) || tokens.some((token) => typeof token !== "string")) {
|
|
28
|
+
throw new TenuoConfigurationError("toWire() did not return warrant tokens");
|
|
29
|
+
}
|
|
30
|
+
return tokens;
|
|
31
|
+
}
|
|
32
|
+
dedupKey(tool, args) {
|
|
33
|
+
const native = nativeSessions.get(this);
|
|
34
|
+
if (typeof native?.dedupKey !== "function") {
|
|
35
|
+
throw new TenuoConfigurationError("session is not bound to the WASM core");
|
|
36
|
+
}
|
|
37
|
+
return native.dedupKey(tool, args);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function isSession(value) {
|
|
41
|
+
return value instanceof Session;
|
|
42
|
+
}
|
|
43
|
+
export function nativeSession(session) {
|
|
44
|
+
const native = nativeSessions.get(session);
|
|
45
|
+
if (!native) {
|
|
46
|
+
throw new TenuoConfigurationError("session is not bound to the WASM core");
|
|
47
|
+
}
|
|
48
|
+
return native;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAGtD,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AACzD,MAAM,cAAc,GAAG,IAAI,OAAO,EAAwB,CAAC;AAE3D;;GAEG;AACH,MAAM,OAAO,OAAO;IACT,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,cAAuB,CAAC;IAExD,YAAY,MAAmB;QAC7B,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AAC,CAAC;IAC3C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,uBAAuB,CAAC,uCAAuC,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/wasm.d.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { TenuoErrorCode } from "./api.ts";
|
|
2
|
+
export type WasmDecision = {
|
|
3
|
+
outcome: "allow" | "deny" | "approval_required";
|
|
4
|
+
code?: TenuoErrorCode;
|
|
5
|
+
field?: string;
|
|
6
|
+
message?: string;
|
|
7
|
+
args?: Record<string, unknown>;
|
|
8
|
+
tool?: string;
|
|
9
|
+
required?: number;
|
|
10
|
+
received?: number;
|
|
11
|
+
receipt?: string;
|
|
12
|
+
};
|
|
13
|
+
export type WasmInspect = {
|
|
14
|
+
payload_hex: string;
|
|
15
|
+
signature_hex: string;
|
|
16
|
+
id: string;
|
|
17
|
+
};
|
|
18
|
+
export type WasmReceipt = {
|
|
19
|
+
authentic: true;
|
|
20
|
+
/** Hex key the receipt is signed under — resolve against your authorizer set. */
|
|
21
|
+
signer_key: string;
|
|
22
|
+
outcome: "allow" | "deny";
|
|
23
|
+
action: string;
|
|
24
|
+
decision_code?: string;
|
|
25
|
+
request_id: string;
|
|
26
|
+
/** Version of the revocation list in force, when it carried one. */
|
|
27
|
+
srl_version?: number;
|
|
28
|
+
/**
|
|
29
|
+
* SHA-256 (hex) of the revocation list bytes in force at decision time.
|
|
30
|
+
* Absent means no revocation data was loaded — a different claim from a
|
|
31
|
+
* loaded list that revoked nothing.
|
|
32
|
+
*/
|
|
33
|
+
srl_hash?: string;
|
|
34
|
+
/**
|
|
35
|
+
* SHA-256 (hex) commitment to the canonical invocation this decision was
|
|
36
|
+
* made over. Absent when the arguments could not be canonicalized — never
|
|
37
|
+
* zero-filled, so absence is a claim rather than a value.
|
|
38
|
+
*/
|
|
39
|
+
request_hash?: string;
|
|
40
|
+
/** SHA-256 (hex) of the host ceiling applied to this decision. */
|
|
41
|
+
policy_definition_hash?: string;
|
|
42
|
+
/**
|
|
43
|
+
* SHA-256 (hex) of the previous receipt from this signer. Absent on the
|
|
44
|
+
* first receipt, or when the deployment does not chain. A broken link means
|
|
45
|
+
* a receipt was removed from the stream.
|
|
46
|
+
*/
|
|
47
|
+
prev_receipt_hash?: string;
|
|
48
|
+
/** SHA-256 (hex) of the trusted root set in force at decision time. */
|
|
49
|
+
trusted_roots_hash?: string;
|
|
50
|
+
};
|
|
51
|
+
export type WasmReceiptChain = {
|
|
52
|
+
signer_key: string;
|
|
53
|
+
outcome: "allow" | "deny";
|
|
54
|
+
decision_code?: string;
|
|
55
|
+
timestamp: number;
|
|
56
|
+
/** The embedded chain verifies to a supplied root at the decision instant. */
|
|
57
|
+
chain_valid: boolean;
|
|
58
|
+
/** Canonical error name when it does not. */
|
|
59
|
+
chain_error?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Deny receipts only: the chain failure matches the stated decision_code,
|
|
62
|
+
* so the embedded authority independently corroborates the refusal.
|
|
63
|
+
*/
|
|
64
|
+
corroborates_denial?: boolean;
|
|
65
|
+
root_issuer?: string;
|
|
66
|
+
leaf_holder?: string;
|
|
67
|
+
};
|
|
68
|
+
export type WasmSession = object;
|
|
69
|
+
export type WasmContext = {
|
|
70
|
+
mint(allow: unknown, ttlSeconds: number, requireApproval?: unknown): WasmSession;
|
|
71
|
+
narrow(session: WasmSession, allow: unknown): WasmSession;
|
|
72
|
+
authorize(session: WasmSession, tool: string, args: unknown, approvals?: unknown, toolAllow?: unknown, requestId?: string): WasmDecision;
|
|
73
|
+
authorizeAsOf(session: WasmSession, tool: string, args: unknown, asOf: number, approvals?: unknown, toolAllow?: unknown): WasmDecision;
|
|
74
|
+
loadRevocationList(srl: string): void;
|
|
75
|
+
signRevocationList(ids: string[]): string;
|
|
76
|
+
signPop(session: WasmSession, tool: string, args: unknown): string;
|
|
77
|
+
authorizePresented(warrants: unknown, tool: string, args: unknown, pop: string, approvals?: unknown, toolAllow?: unknown, requestId?: string): WasmDecision;
|
|
78
|
+
};
|
|
79
|
+
type Generated = {
|
|
80
|
+
SdkContext: {
|
|
81
|
+
new (): WasmContext;
|
|
82
|
+
fromTrustedRoots(roots: string[]): WasmContext;
|
|
83
|
+
};
|
|
84
|
+
SdkSession: {
|
|
85
|
+
fromWire(warrant: string, holder: Uint8Array): WasmSession;
|
|
86
|
+
fromParts(payloadHex: string, signatureHex: string, holder: Uint8Array): WasmSession;
|
|
87
|
+
fromChain(parts: unknown, holder: Uint8Array): WasmSession;
|
|
88
|
+
};
|
|
89
|
+
sdkInspectWarrant(wire: string): WasmInspect;
|
|
90
|
+
sdkInspectParts(payloadHex: string, signatureHex: string): WasmInspect;
|
|
91
|
+
sdkSignApproval(session: WasmSession, tool: string, args: unknown, approverSecret: Uint8Array, externalId: string, asOf?: number): string;
|
|
92
|
+
sdkSignRevocationList(ids: string[], issuerSecret: Uint8Array): string;
|
|
93
|
+
sdkSignPublishedRevocationList(ids: string[], version: number, issuerSecret: Uint8Array): string;
|
|
94
|
+
sdkVerifyReceipt(wire: string): WasmReceipt;
|
|
95
|
+
sdkVerifyReceiptChain(wire: string, roots: string[]): WasmReceiptChain;
|
|
96
|
+
};
|
|
97
|
+
export declare function wasmAvailable(): boolean;
|
|
98
|
+
export declare function loadWasm(): Generated;
|
|
99
|
+
export declare function createDevContext(): WasmContext;
|
|
100
|
+
export declare function createVerifierContext(rootHexes: readonly string[], revocationList?: string): WasmContext;
|
|
101
|
+
export declare function importSessionFromWire(warrant: string, holderKey: Uint8Array): WasmSession;
|
|
102
|
+
export declare function importSessionFromParts(payloadHex: string, signatureHex: string, holderKey: Uint8Array): WasmSession;
|
|
103
|
+
export declare function importSessionFromChain(parts: unknown, holderKey: Uint8Array): WasmSession;
|
|
104
|
+
export declare function inspectWarrant(wire: string): WasmInspect;
|
|
105
|
+
export declare function inspectParts(payloadHex: string, signatureHex: string): WasmInspect;
|
|
106
|
+
export {};
|
|
107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