@kya-os/mcp-i 0.1.0-alpha.3.9 → 1.2.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/README.md +350 -213
- package/dist/149.js +1 -0
- package/dist/189.js +1 -0
- package/dist/261.js +1 -0
- package/dist/28.js +1 -0
- package/dist/295.js +1 -0
- package/dist/460.js +1 -0
- package/dist/570.js +1 -0
- package/dist/634.js +1 -0
- package/dist/647.js +1 -0
- package/dist/67.js +1 -0
- package/dist/739.js +1 -0
- package/dist/742.js +1 -0
- package/dist/904.js +1 -0
- package/dist/938.js +1 -0
- package/dist/auth/api-key.d.ts +16 -0
- package/dist/auth/api-key.js +82 -0
- package/dist/auth/jwt.d.ts +43 -0
- package/dist/auth/jwt.js +51 -0
- package/dist/auth/oauth/factory.d.ts +12 -0
- package/dist/auth/oauth/factory.js +36 -0
- package/dist/auth/oauth/index.d.ts +5 -0
- package/dist/auth/oauth/index.js +27 -0
- package/dist/auth/oauth/providers/proxy-provider.d.ts +13 -0
- package/dist/auth/oauth/providers/proxy-provider.js +159 -0
- package/dist/auth/oauth/router.d.ts +4 -0
- package/dist/auth/oauth/router.js +294 -0
- package/dist/auth/oauth/storage/memory-storage.d.ts +12 -0
- package/dist/auth/oauth/storage/memory-storage.js +40 -0
- package/dist/auth/oauth/types.d.ts +112 -0
- package/dist/cache/__tests__/cloudflare-kv-nonce-cache.test.d.ts +4 -0
- package/dist/cache/__tests__/cloudflare-kv-nonce-cache.test.js +176 -0
- package/dist/cache/__tests__/concurrency.test.d.ts +5 -0
- package/dist/cache/__tests__/concurrency.test.js +300 -0
- package/dist/cache/__tests__/dynamodb-nonce-cache.test.d.ts +4 -0
- package/dist/cache/__tests__/dynamodb-nonce-cache.test.js +176 -0
- package/dist/cache/__tests__/memory-nonce-cache.test.d.ts +4 -0
- package/dist/cache/__tests__/memory-nonce-cache.test.js +132 -0
- package/dist/cache/__tests__/nonce-cache-factory-simple.test.d.ts +4 -0
- package/dist/cache/__tests__/nonce-cache-factory-simple.test.js +133 -0
- package/dist/cache/__tests__/nonce-cache-factory.test.d.ts +4 -0
- package/dist/cache/__tests__/nonce-cache-factory.test.js +252 -0
- package/dist/cache/__tests__/redis-nonce-cache.test.d.ts +4 -0
- package/dist/cache/__tests__/redis-nonce-cache.test.js +95 -0
- package/dist/cache/cloudflare-kv-nonce-cache.d.ts +14 -0
- package/dist/cache/cloudflare-kv-nonce-cache.js +93 -0
- package/dist/cache/dynamodb-nonce-cache.d.ts +15 -0
- package/dist/cache/dynamodb-nonce-cache.js +92 -0
- package/dist/cache/index.d.ts +16 -0
- package/dist/cache/index.js +32 -0
- package/dist/cache/memory-nonce-cache.d.ts +44 -0
- package/dist/cache/memory-nonce-cache.js +105 -0
- package/dist/cache/nonce-cache-factory.d.ts +20 -0
- package/dist/cache/nonce-cache-factory.js +208 -0
- package/dist/cache/redis-nonce-cache.d.ts +14 -0
- package/dist/cache/redis-nonce-cache.js +53 -0
- package/dist/compiler/compiler-context.d.ts +23 -0
- package/dist/compiler/compiler-context.js +24 -0
- package/dist/compiler/config/constants.d.ts +41 -0
- package/dist/compiler/config/constants.js +45 -0
- package/dist/compiler/config/index.d.ts +252 -0
- package/dist/compiler/config/index.js +15 -0
- package/dist/compiler/config/injection.d.ts +26 -0
- package/dist/compiler/config/injection.js +58 -0
- package/dist/compiler/config/schemas/experimental/index.d.ts +91 -0
- package/dist/compiler/config/schemas/experimental/index.js +16 -0
- package/dist/compiler/config/schemas/experimental/oauth.d.ts +74 -0
- package/dist/compiler/config/schemas/experimental/oauth.js +25 -0
- package/dist/compiler/config/schemas/index.d.ts +6 -0
- package/dist/compiler/config/schemas/index.js +17 -0
- package/dist/compiler/config/schemas/paths.d.ts +9 -0
- package/dist/compiler/config/schemas/paths.js +12 -0
- package/dist/compiler/config/schemas/transport/http.d.ts +82 -0
- package/dist/compiler/config/schemas/transport/http.js +33 -0
- package/dist/compiler/config/schemas/transport/stdio.d.ts +9 -0
- package/dist/compiler/config/schemas/transport/stdio.js +15 -0
- package/dist/compiler/config/schemas/webpack.d.ts +3 -0
- package/dist/compiler/config/schemas/webpack.js +15 -0
- package/dist/compiler/config/types.d.ts +1 -0
- package/dist/compiler/config/types.js +2 -0
- package/dist/compiler/config/utils.d.ts +20 -0
- package/dist/compiler/config/utils.js +36 -0
- package/dist/compiler/generate-env-code.d.ts +1 -0
- package/dist/compiler/generate-env-code.js +8 -0
- package/dist/compiler/generate-import-code.d.ts +1 -0
- package/dist/compiler/generate-import-code.js +24 -0
- package/dist/compiler/get-webpack-config/get-entries.d.ts +3 -0
- package/dist/compiler/get-webpack-config/get-entries.js +29 -0
- package/dist/compiler/get-webpack-config/get-externals.d.ts +7 -0
- package/dist/compiler/get-webpack-config/get-externals.js +88 -0
- package/dist/compiler/get-webpack-config/get-injected-variables.d.ts +8 -0
- package/dist/compiler/get-webpack-config/get-injected-variables.js +25 -0
- package/dist/compiler/get-webpack-config/index.d.ts +4 -0
- package/dist/compiler/get-webpack-config/index.js +101 -0
- package/dist/compiler/get-webpack-config/plugins.d.ts +8 -0
- package/dist/compiler/get-webpack-config/plugins.js +132 -0
- package/dist/compiler/get-webpack-config/resolve-tsconfig-paths.d.ts +9 -0
- package/dist/compiler/get-webpack-config/resolve-tsconfig-paths.js +40 -0
- package/dist/compiler/index.d.ts +6 -0
- package/dist/compiler/index.js +194 -0
- package/dist/compiler/on-first-build.d.ts +3 -0
- package/dist/compiler/on-first-build.js +58 -0
- package/dist/compiler/parse-xmcp-config.d.ts +9 -0
- package/dist/compiler/parse-xmcp-config.js +155 -0
- package/dist/compiler/start-http-server.d.ts +1 -0
- package/dist/compiler/start-http-server.js +34 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +38 -0
- package/dist/index.js.LICENSE.txt +49 -0
- package/dist/runtime/__tests__/audit.test.d.ts +4 -0
- package/dist/runtime/__tests__/audit.test.js +328 -0
- package/dist/runtime/__tests__/identity.test.d.ts +4 -0
- package/dist/runtime/__tests__/identity.test.js +164 -0
- package/dist/runtime/__tests__/mcpi-runtime.test.d.ts +4 -0
- package/dist/runtime/__tests__/mcpi-runtime.test.js +372 -0
- package/dist/runtime/__tests__/proof.test.d.ts +4 -0
- package/dist/runtime/__tests__/proof.test.js +302 -0
- package/dist/runtime/__tests__/session.test.d.ts +4 -0
- package/dist/runtime/__tests__/session.test.js +254 -0
- package/dist/runtime/__tests__/well-known.test.d.ts +4 -0
- package/dist/runtime/__tests__/well-known.test.js +312 -0
- package/dist/runtime/adapter-express.js +2 -0
- package/dist/runtime/adapter-express.js.LICENSE.txt +252 -0
- package/dist/runtime/adapter-nextjs.js +2 -0
- package/dist/runtime/adapter-nextjs.js.LICENSE.txt +53 -0
- package/dist/runtime/adapters/express/index.d.ts +2 -0
- package/dist/runtime/adapters/express/index.js +48 -0
- package/dist/runtime/adapters/nextjs/index.d.ts +8 -0
- package/dist/runtime/adapters/nextjs/index.js +18 -0
- package/dist/runtime/audit.d.ts +93 -0
- package/dist/runtime/audit.js +212 -0
- package/dist/runtime/debug.d.ts +118 -0
- package/dist/runtime/debug.js +612 -0
- package/dist/runtime/delegation-hooks.d.ts +85 -0
- package/dist/runtime/delegation-hooks.js +116 -0
- package/dist/runtime/demo.d.ts +71 -0
- package/dist/runtime/demo.js +135 -0
- package/dist/runtime/headers.d.ts +1 -0
- package/dist/runtime/headers.js +9 -0
- package/dist/runtime/http.js +2 -0
- package/dist/runtime/http.js.LICENSE.txt +252 -0
- package/dist/runtime/identity.d.ts +105 -0
- package/dist/runtime/identity.js +232 -0
- package/dist/runtime/index.d.ts +16 -0
- package/dist/runtime/index.js +56 -0
- package/dist/runtime/mcpi-runtime.d.ts +164 -0
- package/dist/runtime/mcpi-runtime.js +352 -0
- package/dist/runtime/proof.d.ts +87 -0
- package/dist/runtime/proof.js +223 -0
- package/dist/runtime/session.d.ts +88 -0
- package/dist/runtime/session.js +216 -0
- package/dist/runtime/stdio.js +2 -0
- package/dist/runtime/stdio.js.LICENSE.txt +1 -0
- package/dist/runtime/templates/home.d.ts +2 -0
- package/dist/runtime/templates/home.js +50 -0
- package/dist/runtime/transports/http/base-streamable-http.d.ts +25 -0
- package/dist/runtime/transports/http/base-streamable-http.js +16 -0
- package/dist/runtime/transports/http/http-context.d.ts +9 -0
- package/dist/runtime/transports/http/http-context.js +8 -0
- package/dist/runtime/transports/http/index.js +55 -0
- package/dist/runtime/transports/http/setup-cors.d.ts +4 -0
- package/dist/runtime/transports/http/setup-cors.js +24 -0
- package/dist/runtime/transports/http/stateless-streamable-http.d.ts +39 -0
- package/dist/runtime/transports/http/stateless-streamable-http.js +331 -0
- package/dist/runtime/transports/stdio/index.d.ts +1 -0
- package/dist/runtime/transports/stdio/index.js +51 -0
- package/dist/runtime/utils/server.d.ts +42 -0
- package/dist/runtime/utils/server.js +39 -0
- package/dist/runtime/utils/tools.d.ts +8 -0
- package/dist/runtime/utils/tools.js +115 -0
- package/dist/runtime/verifier-middleware.d.ts +76 -0
- package/dist/runtime/verifier-middleware.js +322 -0
- package/dist/runtime/well-known.d.ts +151 -0
- package/dist/runtime/well-known.js +258 -0
- package/dist/storage/config.d.ts +28 -0
- package/dist/storage/config.js +79 -0
- package/dist/storage/delegation.d.ts +59 -0
- package/dist/storage/delegation.js +130 -0
- package/dist/storage/merkle-verifier.d.ts +84 -0
- package/dist/storage/merkle-verifier.js +261 -0
- package/dist/test/__tests__/nonce-cache-integration.test.d.ts +1 -0
- package/dist/test/__tests__/nonce-cache-integration.test.js +116 -0
- package/dist/test/__tests__/nonce-cache.test.d.ts +1 -0
- package/dist/test/__tests__/nonce-cache.test.js +122 -0
- package/dist/test/__tests__/runtime-integration.test.d.ts +4 -0
- package/dist/test/__tests__/runtime-integration.test.js +192 -0
- package/dist/test/__tests__/test-infrastructure.test.d.ts +4 -0
- package/dist/test/__tests__/test-infrastructure.test.js +178 -0
- package/dist/test/deterministic-keys.d.ts +31 -0
- package/dist/test/deterministic-keys.js +108 -0
- package/dist/test/examples/test-usage-example.d.ts +140 -0
- package/dist/test/examples/test-usage-example.js +175 -0
- package/dist/test/index.d.ts +11 -0
- package/dist/test/index.js +27 -0
- package/dist/test/local-verification.d.ts +28 -0
- package/dist/test/local-verification.js +342 -0
- package/dist/test/mock-identity-provider.d.ts +96 -0
- package/dist/test/mock-identity-provider.js +243 -0
- package/dist/test/runtime-integration.d.ts +63 -0
- package/dist/test/runtime-integration.js +140 -0
- package/dist/test/test-environment.d.ts +26 -0
- package/dist/test/test-environment.js +50 -0
- package/dist/types/declarations.d.ts +1 -0
- package/dist/types/declarations.js +6 -0
- package/dist/types/middleware.d.ts +2 -0
- package/dist/types/middleware.js +2 -0
- package/dist/types/tool.d.ts +80 -0
- package/dist/types/tool.js +2 -0
- package/dist/utils/cli-icons.d.ts +3 -0
- package/dist/utils/cli-icons.js +7 -0
- package/dist/utils/constants.d.ts +6 -0
- package/dist/utils/constants.js +13 -0
- package/dist/utils/context.d.ts +33 -0
- package/dist/utils/context.js +58 -0
- package/dist/utils/file-watcher.d.ts +19 -0
- package/dist/utils/file-watcher.js +49 -0
- package/dist/utils/fs-utils.d.ts +2 -0
- package/dist/utils/fs-utils.js +22 -0
- package/dist/utils/path-validation.d.ts +3 -0
- package/dist/utils/path-validation.js +56 -0
- package/dist/utils/spawn-process.d.ts +9 -0
- package/dist/utils/spawn-process.js +50 -0
- package/dist/utils/subscribable.d.ts +12 -0
- package/dist/utils/subscribable.js +44 -0
- package/package.json +91 -77
- package/dist/cjs/auto.js +0 -16
- package/dist/cjs/cli-mode.d.ts +0 -16
- package/dist/cjs/cli-mode.js +0 -32
- package/dist/cjs/crypto.d.ts +0 -16
- package/dist/cjs/crypto.js +0 -212
- package/dist/cjs/dev-helper.d.ts +0 -3
- package/dist/cjs/dev-helper.js +0 -46
- package/dist/cjs/encrypted-storage.d.ts +0 -11
- package/dist/cjs/encrypted-storage.js +0 -73
- package/dist/cjs/index.d.ts +0 -56
- package/dist/cjs/index.js +0 -727
- package/dist/cjs/logger.d.ts +0 -32
- package/dist/cjs/logger.js +0 -85
- package/dist/cjs/nextjs.d.ts +0 -10
- package/dist/cjs/nextjs.js +0 -83
- package/dist/cjs/platform-info.d.ts +0 -36
- package/dist/cjs/platform-info.js +0 -274
- package/dist/cjs/polling.d.ts +0 -13
- package/dist/cjs/polling.js +0 -52
- package/dist/cjs/registry/index.d.ts +0 -12
- package/dist/cjs/registry/index.js +0 -56
- package/dist/cjs/registry/knowthat.d.ts +0 -17
- package/dist/cjs/registry/knowthat.js +0 -173
- package/dist/cjs/rotation.d.ts +0 -35
- package/dist/cjs/rotation.js +0 -102
- package/dist/cjs/storage.d.ts +0 -41
- package/dist/cjs/storage.js +0 -163
- package/dist/cjs/transport.d.ts +0 -35
- package/dist/cjs/transport.js +0 -300
- package/dist/cjs/types.d.ts +0 -206
- package/dist/cjs/vercel-adapter.d.ts +0 -8
- package/dist/cjs/vercel-adapter.js +0 -67
- package/dist/esm/auto.d.ts +0 -13
- package/dist/esm/auto.d.ts.map +0 -1
- package/dist/esm/auto.js +0 -30
- package/dist/esm/auto.js.map +0 -1
- package/dist/esm/cli-mode.d.ts +0 -52
- package/dist/esm/cli-mode.d.ts.map +0 -1
- package/dist/esm/cli-mode.js +0 -59
- package/dist/esm/cli-mode.js.map +0 -1
- package/dist/esm/crypto.d.ts +0 -51
- package/dist/esm/crypto.d.ts.map +0 -1
- package/dist/esm/crypto.js +0 -230
- package/dist/esm/crypto.js.map +0 -1
- package/dist/esm/dev-helper.d.ts +0 -15
- package/dist/esm/dev-helper.d.ts.map +0 -1
- package/dist/esm/dev-helper.js +0 -63
- package/dist/esm/dev-helper.js.map +0 -1
- package/dist/esm/encrypted-storage.d.ts +0 -19
- package/dist/esm/encrypted-storage.d.ts.map +0 -1
- package/dist/esm/encrypted-storage.js +0 -48
- package/dist/esm/encrypted-storage.js.map +0 -1
- package/dist/esm/index.d.ts +0 -129
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js +0 -853
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/logger.d.ts +0 -46
- package/dist/esm/logger.d.ts.map +0 -1
- package/dist/esm/logger.js +0 -100
- package/dist/esm/logger.js.map +0 -1
- package/dist/esm/nextjs.d.ts +0 -22
- package/dist/esm/nextjs.d.ts.map +0 -1
- package/dist/esm/nextjs.js +0 -83
- package/dist/esm/nextjs.js.map +0 -1
- package/dist/esm/package.json +0 -1
- package/dist/esm/platform-info.d.ts +0 -74
- package/dist/esm/platform-info.d.ts.map +0 -1
- package/dist/esm/platform-info.js +0 -293
- package/dist/esm/platform-info.js.map +0 -1
- package/dist/esm/polling.d.ts +0 -29
- package/dist/esm/polling.d.ts.map +0 -1
- package/dist/esm/polling.js +0 -76
- package/dist/esm/polling.js.map +0 -1
- package/dist/esm/registry/index.d.ts +0 -43
- package/dist/esm/registry/index.d.ts.map +0 -1
- package/dist/esm/registry/index.js +0 -89
- package/dist/esm/registry/index.js.map +0 -1
- package/dist/esm/registry/knowthat.d.ts +0 -44
- package/dist/esm/registry/knowthat.d.ts.map +0 -1
- package/dist/esm/registry/knowthat.js +0 -220
- package/dist/esm/registry/knowthat.js.map +0 -1
- package/dist/esm/rotation.d.ts +0 -57
- package/dist/esm/rotation.d.ts.map +0 -1
- package/dist/esm/rotation.js +0 -133
- package/dist/esm/rotation.js.map +0 -1
- package/dist/esm/storage.d.ts +0 -65
- package/dist/esm/storage.d.ts.map +0 -1
- package/dist/esm/storage.js +0 -160
- package/dist/esm/storage.js.map +0 -1
- package/dist/esm/transport.d.ts +0 -52
- package/dist/esm/transport.d.ts.map +0 -1
- package/dist/esm/transport.js +0 -340
- package/dist/esm/transport.js.map +0 -1
- package/dist/esm/types.d.ts +0 -293
- package/dist/esm/types.d.ts.map +0 -1
- package/dist/esm/types.js +0 -5
- package/dist/esm/types.js.map +0 -1
- package/dist/esm/vercel-adapter.d.ts +0 -26
- package/dist/esm/vercel-adapter.d.ts.map +0 -1
- package/dist/esm/vercel-adapter.js +0 -80
- package/dist/esm/vercel-adapter.js.map +0 -1
- /package/dist/{cjs → auth/oauth}/types.js +0 -0
- /package/dist/{cjs/auto.d.ts → runtime/transports/http/index.d.ts} +0 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* XMCP-I Runtime - Identity-Aware MCP Runtime
|
|
3
|
+
*
|
|
4
|
+
* Composes upstream XMCP core with identity plugin layer
|
|
5
|
+
* according to runtime support specification and requirements.
|
|
6
|
+
*/
|
|
7
|
+
import { SessionContext, HandshakeRequest } from "@kya-os/contracts/handshake";
|
|
8
|
+
import { ToolRequest, ToolResponse } from "./proof";
|
|
9
|
+
import { WellKnownConfig } from "./well-known";
|
|
10
|
+
import { DemoManager } from "./demo";
|
|
11
|
+
/**
|
|
12
|
+
* Runtime environment check
|
|
13
|
+
*/
|
|
14
|
+
export interface RuntimeEnvironment {
|
|
15
|
+
isNode: boolean;
|
|
16
|
+
isWorker: boolean;
|
|
17
|
+
isVercelEdge: boolean;
|
|
18
|
+
isAWSLambda: boolean;
|
|
19
|
+
nodeVersion?: string;
|
|
20
|
+
supportsESM: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* XMCP-I Runtime configuration
|
|
24
|
+
*/
|
|
25
|
+
export interface MCPIRuntimeConfig {
|
|
26
|
+
identity?: {
|
|
27
|
+
environment?: "development" | "production";
|
|
28
|
+
devIdentityPath?: string;
|
|
29
|
+
privacyMode?: boolean;
|
|
30
|
+
};
|
|
31
|
+
session?: {
|
|
32
|
+
timestampSkewSeconds?: number;
|
|
33
|
+
sessionTtlMinutes?: number;
|
|
34
|
+
absoluteSessionLifetime?: number;
|
|
35
|
+
};
|
|
36
|
+
audit?: {
|
|
37
|
+
enabled?: boolean;
|
|
38
|
+
logFunction?: (record: string) => void;
|
|
39
|
+
includePayloads?: boolean;
|
|
40
|
+
};
|
|
41
|
+
wellKnown?: WellKnownConfig;
|
|
42
|
+
runtime?: {
|
|
43
|
+
showVerifyLink?: boolean;
|
|
44
|
+
identityBadge?: boolean;
|
|
45
|
+
};
|
|
46
|
+
demo?: {
|
|
47
|
+
identityBadge?: boolean;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* XMCP-I Runtime class
|
|
52
|
+
*/
|
|
53
|
+
export declare class MCPIRuntime {
|
|
54
|
+
private identityManager;
|
|
55
|
+
private sessionManager;
|
|
56
|
+
private auditLogger;
|
|
57
|
+
private wellKnownManager?;
|
|
58
|
+
private debugManager?;
|
|
59
|
+
private demoManager?;
|
|
60
|
+
private config;
|
|
61
|
+
private cachedIdentity?;
|
|
62
|
+
constructor(config?: MCPIRuntimeConfig);
|
|
63
|
+
/**
|
|
64
|
+
* Initialize the runtime (async setup)
|
|
65
|
+
*/
|
|
66
|
+
initialize(): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Validate handshake and create session
|
|
69
|
+
*/
|
|
70
|
+
validateHandshake(request: HandshakeRequest): Promise<SessionContext | null>;
|
|
71
|
+
/**
|
|
72
|
+
* Process tool call with identity-aware proof generation
|
|
73
|
+
*/
|
|
74
|
+
processToolCall(request: ToolRequest, session: SessionContext, toolHandler: (request: ToolRequest) => Promise<any>, options?: {
|
|
75
|
+
scopeId?: string;
|
|
76
|
+
delegationRef?: string;
|
|
77
|
+
}): Promise<ToolResponse>;
|
|
78
|
+
/**
|
|
79
|
+
* Get well-known endpoint handler
|
|
80
|
+
*/
|
|
81
|
+
getWellKnownHandler(): import("./well-known").WellKnownHandler;
|
|
82
|
+
/**
|
|
83
|
+
* Get debug endpoint handler (development only)
|
|
84
|
+
*/
|
|
85
|
+
getDebugHandler(logRoot?: string): (_request: any) => Promise<Response>;
|
|
86
|
+
/**
|
|
87
|
+
* Get demo manager
|
|
88
|
+
*/
|
|
89
|
+
getDemoManager(): DemoManager | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Get runtime statistics
|
|
92
|
+
*/
|
|
93
|
+
getStats(): {
|
|
94
|
+
identity: {
|
|
95
|
+
did: string | undefined;
|
|
96
|
+
keyId: string | undefined;
|
|
97
|
+
environment: "production" | "development";
|
|
98
|
+
};
|
|
99
|
+
session: {
|
|
100
|
+
activeSessions: number;
|
|
101
|
+
config: {
|
|
102
|
+
timestampSkewSeconds: number;
|
|
103
|
+
sessionTtlMinutes: number;
|
|
104
|
+
absoluteSessionLifetime?: number;
|
|
105
|
+
cacheType: string;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
audit: {
|
|
109
|
+
enabled: boolean;
|
|
110
|
+
sessionsLogged: number;
|
|
111
|
+
includePayloads: boolean;
|
|
112
|
+
};
|
|
113
|
+
runtime: {
|
|
114
|
+
initialized: boolean;
|
|
115
|
+
wellKnownEnabled: boolean;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Cleanup resources
|
|
120
|
+
*/
|
|
121
|
+
cleanup(): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Check runtime environment compatibility
|
|
124
|
+
*/
|
|
125
|
+
private checkRuntimeEnvironment;
|
|
126
|
+
/**
|
|
127
|
+
* Detect runtime environment
|
|
128
|
+
*/
|
|
129
|
+
private detectRuntimeEnvironment;
|
|
130
|
+
/**
|
|
131
|
+
* Describe runtime environment for logging
|
|
132
|
+
*/
|
|
133
|
+
private describeEnvironment;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Create and initialize XMCP-I runtime
|
|
137
|
+
*/
|
|
138
|
+
export declare function createMCPIRuntime(config?: MCPIRuntimeConfig): Promise<MCPIRuntime>;
|
|
139
|
+
/**
|
|
140
|
+
* Runtime factory for different environments
|
|
141
|
+
*/
|
|
142
|
+
export declare const RuntimeFactory: {
|
|
143
|
+
/**
|
|
144
|
+
* Create runtime for development
|
|
145
|
+
*/
|
|
146
|
+
forDevelopment(overrides?: Partial<MCPIRuntimeConfig>): Promise<MCPIRuntime>;
|
|
147
|
+
/**
|
|
148
|
+
* Create runtime for production
|
|
149
|
+
*/
|
|
150
|
+
forProduction(overrides?: Partial<MCPIRuntimeConfig>): Promise<MCPIRuntime>;
|
|
151
|
+
/**
|
|
152
|
+
* Create runtime for testing
|
|
153
|
+
*/
|
|
154
|
+
forTesting(overrides?: Partial<MCPIRuntimeConfig>): Promise<MCPIRuntime>;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Error codes
|
|
158
|
+
*/
|
|
159
|
+
export declare const RUNTIME_ERRORS: {
|
|
160
|
+
readonly ERUNTIME: "XMCP_I_ERUNTIME";
|
|
161
|
+
readonly ENOIDENTITY: "XMCP_I_ENOIDENTITY";
|
|
162
|
+
readonly EHANDSHAKE: "XMCP_I_EHANDSHAKE";
|
|
163
|
+
readonly ESESSION: "XMCP_I_ESESSION";
|
|
164
|
+
};
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* XMCP-I Runtime - Identity-Aware MCP Runtime
|
|
4
|
+
*
|
|
5
|
+
* Composes upstream XMCP core with identity plugin layer
|
|
6
|
+
* according to runtime support specification and requirements.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.RUNTIME_ERRORS = exports.RuntimeFactory = exports.MCPIRuntime = void 0;
|
|
10
|
+
exports.createMCPIRuntime = createMCPIRuntime;
|
|
11
|
+
const identity_1 = require("./identity");
|
|
12
|
+
const session_1 = require("./session");
|
|
13
|
+
const proof_1 = require("./proof");
|
|
14
|
+
const audit_1 = require("./audit");
|
|
15
|
+
const well_known_1 = require("./well-known");
|
|
16
|
+
const debug_1 = require("./debug");
|
|
17
|
+
const demo_1 = require("./demo");
|
|
18
|
+
/**
|
|
19
|
+
* XMCP-I Runtime class
|
|
20
|
+
*/
|
|
21
|
+
class MCPIRuntime {
|
|
22
|
+
identityManager;
|
|
23
|
+
sessionManager;
|
|
24
|
+
auditLogger;
|
|
25
|
+
wellKnownManager;
|
|
26
|
+
debugManager;
|
|
27
|
+
demoManager;
|
|
28
|
+
config;
|
|
29
|
+
cachedIdentity;
|
|
30
|
+
constructor(config = {}) {
|
|
31
|
+
this.config = config;
|
|
32
|
+
// Initialize identity manager
|
|
33
|
+
this.identityManager = new identity_1.IdentityManager({
|
|
34
|
+
environment: config.identity?.environment || "development",
|
|
35
|
+
...config.identity,
|
|
36
|
+
});
|
|
37
|
+
// Initialize session manager
|
|
38
|
+
this.sessionManager = new session_1.SessionManager(config.session);
|
|
39
|
+
// Initialize audit logger
|
|
40
|
+
this.auditLogger = new audit_1.AuditLogger(config.audit);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Initialize the runtime (async setup)
|
|
44
|
+
*/
|
|
45
|
+
async initialize() {
|
|
46
|
+
// Perform runtime environment checks
|
|
47
|
+
this.checkRuntimeEnvironment();
|
|
48
|
+
// Ensure identity is loaded
|
|
49
|
+
this.cachedIdentity = await this.identityManager.ensureIdentity();
|
|
50
|
+
// Initialize well-known manager if configured
|
|
51
|
+
if (this.config.wellKnown) {
|
|
52
|
+
this.wellKnownManager = new well_known_1.WellKnownManager(this.cachedIdentity, this.config.wellKnown);
|
|
53
|
+
}
|
|
54
|
+
// Initialize debug manager in development
|
|
55
|
+
if (this.config.identity?.environment === "development") {
|
|
56
|
+
this.debugManager = (0, debug_1.createDebugEndpoint)(this.cachedIdentity, this.config.identity.environment);
|
|
57
|
+
}
|
|
58
|
+
// Initialize demo manager
|
|
59
|
+
this.demoManager = (0, demo_1.createDemoManager)(this.cachedIdentity, {
|
|
60
|
+
identityBadge: this.config.demo?.identityBadge || false,
|
|
61
|
+
environment: this.config.identity?.environment || "development",
|
|
62
|
+
});
|
|
63
|
+
console.log(`✅ XMCP-I Runtime initialized`);
|
|
64
|
+
console.log(` DID: ${this.cachedIdentity.did}`);
|
|
65
|
+
console.log(` Key ID: ${this.cachedIdentity.keyId}`);
|
|
66
|
+
// Show verify link in development (default true)
|
|
67
|
+
const showVerifyLink = this.config.runtime?.showVerifyLink !== false;
|
|
68
|
+
demo_1.DemoConsole.printVerifyLink(showVerifyLink, this.config.identity?.environment || "development");
|
|
69
|
+
// Show demo warning if any demo features are enabled
|
|
70
|
+
if (this.demoManager?.isIdentityBadgeEnabled()) {
|
|
71
|
+
demo_1.DemoConsole.printDemoWarning();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Validate handshake and create session
|
|
76
|
+
*/
|
|
77
|
+
async validateHandshake(request) {
|
|
78
|
+
const result = await this.sessionManager.validateHandshake(request);
|
|
79
|
+
if (!result.success) {
|
|
80
|
+
console.error(`Handshake validation failed: ${result.error?.message}`);
|
|
81
|
+
if (result.error?.remediation) {
|
|
82
|
+
console.error(`Remediation: ${result.error.remediation}`);
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
return result.session;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Process tool call with identity-aware proof generation
|
|
90
|
+
*/
|
|
91
|
+
async processToolCall(request, session, toolHandler, options = {}) {
|
|
92
|
+
if (!this.cachedIdentity) {
|
|
93
|
+
throw new Error("Runtime not initialized - call initialize() first");
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
// Execute the tool
|
|
97
|
+
let data = await toolHandler(request);
|
|
98
|
+
// Add identity badge if enabled
|
|
99
|
+
if (this.demoManager?.isIdentityBadgeEnabled()) {
|
|
100
|
+
data = this.demoManager.addIdentityBadgeToResponse(data);
|
|
101
|
+
}
|
|
102
|
+
// Create response with proof
|
|
103
|
+
const response = await (0, proof_1.createProofResponse)(request, data, this.cachedIdentity, session, options);
|
|
104
|
+
// Update debug state with latest proof
|
|
105
|
+
if (this.debugManager && response.meta?.proof) {
|
|
106
|
+
this.debugManager.updateDebugState(response.meta.proof, session);
|
|
107
|
+
}
|
|
108
|
+
// Log audit record (first call per session)
|
|
109
|
+
const auditContext = {
|
|
110
|
+
identity: this.cachedIdentity,
|
|
111
|
+
session,
|
|
112
|
+
requestHash: response.meta.proof.meta.requestHash,
|
|
113
|
+
responseHash: response.meta.proof.meta.responseHash,
|
|
114
|
+
verified: "yes",
|
|
115
|
+
scopeId: options.scopeId,
|
|
116
|
+
};
|
|
117
|
+
await this.auditLogger.logAuditRecord(auditContext);
|
|
118
|
+
return response;
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
// Log failed audit record
|
|
122
|
+
const auditContext = {
|
|
123
|
+
identity: this.cachedIdentity,
|
|
124
|
+
session,
|
|
125
|
+
requestHash: "sha256:error",
|
|
126
|
+
responseHash: "sha256:error",
|
|
127
|
+
verified: "no",
|
|
128
|
+
scopeId: options.scopeId,
|
|
129
|
+
};
|
|
130
|
+
await this.auditLogger.logAuditRecord(auditContext);
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Get well-known endpoint handler
|
|
136
|
+
*/
|
|
137
|
+
getWellKnownHandler() {
|
|
138
|
+
if (!this.cachedIdentity) {
|
|
139
|
+
throw new Error("Runtime not initialized - call initialize() first");
|
|
140
|
+
}
|
|
141
|
+
if (!this.wellKnownManager) {
|
|
142
|
+
throw new Error("Well-known endpoints not configured");
|
|
143
|
+
}
|
|
144
|
+
return (0, well_known_1.createWellKnownHandler)(this.cachedIdentity, this.config.wellKnown);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get debug endpoint handler (development only)
|
|
148
|
+
*/
|
|
149
|
+
getDebugHandler(logRoot) {
|
|
150
|
+
if (!this.cachedIdentity) {
|
|
151
|
+
throw new Error("Runtime not initialized - call initialize() first");
|
|
152
|
+
}
|
|
153
|
+
if (!this.debugManager) {
|
|
154
|
+
throw new Error("Debug endpoint not available (not in development mode)");
|
|
155
|
+
}
|
|
156
|
+
// Update debug manager with log root if provided
|
|
157
|
+
if (logRoot) {
|
|
158
|
+
// Store log root for receipt verification
|
|
159
|
+
this.debugManager.logRoot = logRoot;
|
|
160
|
+
}
|
|
161
|
+
return this.debugManager.createDebugHandler();
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get demo manager
|
|
165
|
+
*/
|
|
166
|
+
getDemoManager() {
|
|
167
|
+
return this.demoManager;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Get runtime statistics
|
|
171
|
+
*/
|
|
172
|
+
getStats() {
|
|
173
|
+
return {
|
|
174
|
+
identity: {
|
|
175
|
+
did: this.cachedIdentity?.did,
|
|
176
|
+
keyId: this.cachedIdentity?.keyId,
|
|
177
|
+
environment: this.config.identity?.environment || "development",
|
|
178
|
+
},
|
|
179
|
+
session: this.sessionManager.getStats(),
|
|
180
|
+
audit: this.auditLogger.getStats(),
|
|
181
|
+
runtime: {
|
|
182
|
+
initialized: !!this.cachedIdentity,
|
|
183
|
+
wellKnownEnabled: !!this.wellKnownManager,
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Cleanup resources
|
|
189
|
+
*/
|
|
190
|
+
async cleanup() {
|
|
191
|
+
await this.sessionManager.cleanup();
|
|
192
|
+
this.auditLogger.clearSessionLog();
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Check runtime environment compatibility
|
|
196
|
+
*/
|
|
197
|
+
checkRuntimeEnvironment() {
|
|
198
|
+
const env = this.detectRuntimeEnvironment();
|
|
199
|
+
// Check Node.js version
|
|
200
|
+
if (env.isNode && env.nodeVersion) {
|
|
201
|
+
const [major, minor] = env.nodeVersion.split(".").map(Number);
|
|
202
|
+
if (major < 18 || (major === 18 && minor < 18)) {
|
|
203
|
+
const error = new Error(`Unsupported Node.js version ${env.nodeVersion}. MCP-I requires Node.js ≥18.18.0`);
|
|
204
|
+
error.code = "XMCP_I_ERUNTIME";
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// Check ESM support
|
|
209
|
+
if (!env.supportsESM) {
|
|
210
|
+
const error = new Error("MCP-I requires ESM support. CommonJS-only environments are not supported.");
|
|
211
|
+
error.code = "XMCP_I_ERUNTIME";
|
|
212
|
+
throw error;
|
|
213
|
+
}
|
|
214
|
+
console.log(`✅ Runtime environment check passed`);
|
|
215
|
+
console.log(` Environment: ${this.describeEnvironment(env)}`);
|
|
216
|
+
console.log(` ESM Support: ${env.supportsESM}`);
|
|
217
|
+
if (env.nodeVersion) {
|
|
218
|
+
console.log(` Node.js: ${env.nodeVersion}`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Detect runtime environment
|
|
223
|
+
*/
|
|
224
|
+
detectRuntimeEnvironment() {
|
|
225
|
+
const isNode = typeof process !== "undefined" && process.versions?.node;
|
|
226
|
+
const isWorker = typeof globalThis !== "undefined" && "WorkerGlobalScope" in globalThis;
|
|
227
|
+
const isVercelEdge = typeof globalThis !== "undefined" && "EdgeRuntime" in globalThis;
|
|
228
|
+
const isAWSLambda = typeof process !== "undefined" && !!process.env.AWS_LAMBDA_FUNCTION_NAME;
|
|
229
|
+
// Check ESM support
|
|
230
|
+
// The package is CommonJS but can be imported via ESM (import from .mjs files)
|
|
231
|
+
// ESM is supported in modern Node.js and edge runtimes
|
|
232
|
+
const supportsESM = !!(isNode || isWorker || isVercelEdge || isAWSLambda);
|
|
233
|
+
return {
|
|
234
|
+
isNode: !!isNode,
|
|
235
|
+
isWorker: !!isWorker,
|
|
236
|
+
isVercelEdge: !!isVercelEdge,
|
|
237
|
+
isAWSLambda: !!isAWSLambda,
|
|
238
|
+
nodeVersion: isNode ? process.versions.node : undefined,
|
|
239
|
+
supportsESM,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Describe runtime environment for logging
|
|
244
|
+
*/
|
|
245
|
+
describeEnvironment(env) {
|
|
246
|
+
if (env.isVercelEdge)
|
|
247
|
+
return "Vercel Edge Runtime";
|
|
248
|
+
if (env.isAWSLambda)
|
|
249
|
+
return "AWS Lambda";
|
|
250
|
+
if (env.isWorker)
|
|
251
|
+
return "Web Worker";
|
|
252
|
+
if (env.isNode)
|
|
253
|
+
return `Node.js ${env.nodeVersion}`;
|
|
254
|
+
return "Unknown";
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
exports.MCPIRuntime = MCPIRuntime;
|
|
258
|
+
/**
|
|
259
|
+
* Create and initialize XMCP-I runtime
|
|
260
|
+
*/
|
|
261
|
+
async function createMCPIRuntime(config = {}) {
|
|
262
|
+
const runtime = new MCPIRuntime(config);
|
|
263
|
+
await runtime.initialize();
|
|
264
|
+
return runtime;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Runtime factory for different environments
|
|
268
|
+
*/
|
|
269
|
+
exports.RuntimeFactory = {
|
|
270
|
+
/**
|
|
271
|
+
* Create runtime for development
|
|
272
|
+
*/
|
|
273
|
+
async forDevelopment(overrides = {}) {
|
|
274
|
+
const config = {
|
|
275
|
+
identity: {
|
|
276
|
+
environment: "development",
|
|
277
|
+
privacyMode: false, // Single public DID default
|
|
278
|
+
devIdentityPath: ".mcpi/identity.json",
|
|
279
|
+
...overrides.identity,
|
|
280
|
+
},
|
|
281
|
+
wellKnown: {
|
|
282
|
+
environment: "development",
|
|
283
|
+
baseUrl: "http://localhost:3000",
|
|
284
|
+
...overrides.wellKnown,
|
|
285
|
+
},
|
|
286
|
+
runtime: {
|
|
287
|
+
showVerifyLink: true, // Default true in dev
|
|
288
|
+
...overrides.runtime,
|
|
289
|
+
},
|
|
290
|
+
demo: {
|
|
291
|
+
identityBadge: false, // Default false, opt-in
|
|
292
|
+
...overrides.demo,
|
|
293
|
+
},
|
|
294
|
+
session: overrides.session,
|
|
295
|
+
audit: overrides.audit,
|
|
296
|
+
};
|
|
297
|
+
return createMCPIRuntime(config);
|
|
298
|
+
},
|
|
299
|
+
/**
|
|
300
|
+
* Create runtime for production
|
|
301
|
+
*/
|
|
302
|
+
async forProduction(overrides = {}) {
|
|
303
|
+
const config = {
|
|
304
|
+
identity: {
|
|
305
|
+
environment: "production",
|
|
306
|
+
privacyMode: false, // Single public DID default
|
|
307
|
+
},
|
|
308
|
+
wellKnown: {
|
|
309
|
+
environment: "production",
|
|
310
|
+
},
|
|
311
|
+
runtime: {
|
|
312
|
+
showVerifyLink: false,
|
|
313
|
+
},
|
|
314
|
+
demo: {
|
|
315
|
+
identityBadge: false, // Disabled in production
|
|
316
|
+
},
|
|
317
|
+
...overrides,
|
|
318
|
+
};
|
|
319
|
+
return createMCPIRuntime(config);
|
|
320
|
+
},
|
|
321
|
+
/**
|
|
322
|
+
* Create runtime for testing
|
|
323
|
+
*/
|
|
324
|
+
async forTesting(overrides = {}) {
|
|
325
|
+
const config = {
|
|
326
|
+
identity: {
|
|
327
|
+
environment: "development",
|
|
328
|
+
devIdentityPath: ".test-mcp-i/identity.json",
|
|
329
|
+
},
|
|
330
|
+
audit: {
|
|
331
|
+
enabled: false, // Disable audit logging in tests
|
|
332
|
+
},
|
|
333
|
+
runtime: {
|
|
334
|
+
showVerifyLink: false,
|
|
335
|
+
},
|
|
336
|
+
demo: {
|
|
337
|
+
identityBadge: false,
|
|
338
|
+
},
|
|
339
|
+
...overrides,
|
|
340
|
+
};
|
|
341
|
+
return createMCPIRuntime(config);
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
/**
|
|
345
|
+
* Error codes
|
|
346
|
+
*/
|
|
347
|
+
exports.RUNTIME_ERRORS = {
|
|
348
|
+
ERUNTIME: "XMCP_I_ERUNTIME",
|
|
349
|
+
ENOIDENTITY: "XMCP_I_ENOIDENTITY",
|
|
350
|
+
EHANDSHAKE: "XMCP_I_EHANDSHAKE",
|
|
351
|
+
ESESSION: "XMCP_I_ESESSION",
|
|
352
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detached Proof Generation for XMCP-I Runtime
|
|
3
|
+
*
|
|
4
|
+
* Handles JCS canonicalization, SHA-256 digest generation, and Ed25519 detached JWS signing
|
|
5
|
+
* according to requirements 5.1, 5.2, 5.3, 5.6.
|
|
6
|
+
*/
|
|
7
|
+
import { DetachedProof } from "@kya-os/contracts/proof";
|
|
8
|
+
import { SessionContext } from "@kya-os/contracts/handshake";
|
|
9
|
+
import { AgentIdentity } from "./identity";
|
|
10
|
+
/**
|
|
11
|
+
* Tool request structure for proof generation
|
|
12
|
+
*/
|
|
13
|
+
export interface ToolRequest {
|
|
14
|
+
method: string;
|
|
15
|
+
params?: any;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Tool response structure for proof generation
|
|
19
|
+
*/
|
|
20
|
+
export interface ToolResponse {
|
|
21
|
+
data: any;
|
|
22
|
+
meta?: {
|
|
23
|
+
proof?: DetachedProof;
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Proof generation options
|
|
29
|
+
*/
|
|
30
|
+
export interface ProofOptions {
|
|
31
|
+
scopeId?: string;
|
|
32
|
+
delegationRef?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Proof generator class
|
|
36
|
+
*/
|
|
37
|
+
export declare class ProofGenerator {
|
|
38
|
+
private identity;
|
|
39
|
+
constructor(identity: AgentIdentity);
|
|
40
|
+
/**
|
|
41
|
+
* Generate detached proof for tool request/response
|
|
42
|
+
* Requirements: 5.1, 5.2, 5.3, 5.6
|
|
43
|
+
*/
|
|
44
|
+
generateProof(request: ToolRequest, response: ToolResponse, session: SessionContext, options?: ProofOptions): Promise<DetachedProof>;
|
|
45
|
+
/**
|
|
46
|
+
* Generate canonical hashes for request and response
|
|
47
|
+
* Requirement: 5.1
|
|
48
|
+
*/
|
|
49
|
+
private generateCanonicalHashes;
|
|
50
|
+
/**
|
|
51
|
+
* Generate SHA-256 hash with JCS canonicalization
|
|
52
|
+
* Requirement: 5.2
|
|
53
|
+
*/
|
|
54
|
+
private generateSHA256Hash;
|
|
55
|
+
/**
|
|
56
|
+
* JCS canonicalization implementation
|
|
57
|
+
* This is a simplified implementation - in production, use a proper JCS library
|
|
58
|
+
*/
|
|
59
|
+
private canonicalizeJSON;
|
|
60
|
+
/**
|
|
61
|
+
* Generate Ed25519 detached JWS (compact format)
|
|
62
|
+
* Requirement: 5.3
|
|
63
|
+
*/
|
|
64
|
+
private generateDetachedJWS;
|
|
65
|
+
/**
|
|
66
|
+
* Format base64 private key as PEM for JOSE library
|
|
67
|
+
*/
|
|
68
|
+
private formatPrivateKeyAsPEM;
|
|
69
|
+
/**
|
|
70
|
+
* Verify a detached proof (for testing/validation)
|
|
71
|
+
*/
|
|
72
|
+
verifyProof(proof: DetachedProof, request: ToolRequest, response: ToolResponse): Promise<boolean>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Utility functions
|
|
76
|
+
*/
|
|
77
|
+
/**
|
|
78
|
+
* Create a tool response with proof
|
|
79
|
+
*/
|
|
80
|
+
export declare function createProofResponse(request: ToolRequest, data: any, identity: AgentIdentity, session: SessionContext, options?: ProofOptions): Promise<ToolResponse>;
|
|
81
|
+
/**
|
|
82
|
+
* Extract canonical data for hashing (utility for testing)
|
|
83
|
+
*/
|
|
84
|
+
export declare function extractCanonicalData(request: ToolRequest, response: ToolResponse): {
|
|
85
|
+
request: any;
|
|
86
|
+
response: any;
|
|
87
|
+
};
|