@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.
Files changed (328) hide show
  1. package/README.md +350 -213
  2. package/dist/149.js +1 -0
  3. package/dist/189.js +1 -0
  4. package/dist/261.js +1 -0
  5. package/dist/28.js +1 -0
  6. package/dist/295.js +1 -0
  7. package/dist/460.js +1 -0
  8. package/dist/570.js +1 -0
  9. package/dist/634.js +1 -0
  10. package/dist/647.js +1 -0
  11. package/dist/67.js +1 -0
  12. package/dist/739.js +1 -0
  13. package/dist/742.js +1 -0
  14. package/dist/904.js +1 -0
  15. package/dist/938.js +1 -0
  16. package/dist/auth/api-key.d.ts +16 -0
  17. package/dist/auth/api-key.js +82 -0
  18. package/dist/auth/jwt.d.ts +43 -0
  19. package/dist/auth/jwt.js +51 -0
  20. package/dist/auth/oauth/factory.d.ts +12 -0
  21. package/dist/auth/oauth/factory.js +36 -0
  22. package/dist/auth/oauth/index.d.ts +5 -0
  23. package/dist/auth/oauth/index.js +27 -0
  24. package/dist/auth/oauth/providers/proxy-provider.d.ts +13 -0
  25. package/dist/auth/oauth/providers/proxy-provider.js +159 -0
  26. package/dist/auth/oauth/router.d.ts +4 -0
  27. package/dist/auth/oauth/router.js +294 -0
  28. package/dist/auth/oauth/storage/memory-storage.d.ts +12 -0
  29. package/dist/auth/oauth/storage/memory-storage.js +40 -0
  30. package/dist/auth/oauth/types.d.ts +112 -0
  31. package/dist/cache/__tests__/cloudflare-kv-nonce-cache.test.d.ts +4 -0
  32. package/dist/cache/__tests__/cloudflare-kv-nonce-cache.test.js +176 -0
  33. package/dist/cache/__tests__/concurrency.test.d.ts +5 -0
  34. package/dist/cache/__tests__/concurrency.test.js +300 -0
  35. package/dist/cache/__tests__/dynamodb-nonce-cache.test.d.ts +4 -0
  36. package/dist/cache/__tests__/dynamodb-nonce-cache.test.js +176 -0
  37. package/dist/cache/__tests__/memory-nonce-cache.test.d.ts +4 -0
  38. package/dist/cache/__tests__/memory-nonce-cache.test.js +132 -0
  39. package/dist/cache/__tests__/nonce-cache-factory-simple.test.d.ts +4 -0
  40. package/dist/cache/__tests__/nonce-cache-factory-simple.test.js +133 -0
  41. package/dist/cache/__tests__/nonce-cache-factory.test.d.ts +4 -0
  42. package/dist/cache/__tests__/nonce-cache-factory.test.js +252 -0
  43. package/dist/cache/__tests__/redis-nonce-cache.test.d.ts +4 -0
  44. package/dist/cache/__tests__/redis-nonce-cache.test.js +95 -0
  45. package/dist/cache/cloudflare-kv-nonce-cache.d.ts +14 -0
  46. package/dist/cache/cloudflare-kv-nonce-cache.js +93 -0
  47. package/dist/cache/dynamodb-nonce-cache.d.ts +15 -0
  48. package/dist/cache/dynamodb-nonce-cache.js +92 -0
  49. package/dist/cache/index.d.ts +16 -0
  50. package/dist/cache/index.js +32 -0
  51. package/dist/cache/memory-nonce-cache.d.ts +44 -0
  52. package/dist/cache/memory-nonce-cache.js +105 -0
  53. package/dist/cache/nonce-cache-factory.d.ts +20 -0
  54. package/dist/cache/nonce-cache-factory.js +208 -0
  55. package/dist/cache/redis-nonce-cache.d.ts +14 -0
  56. package/dist/cache/redis-nonce-cache.js +53 -0
  57. package/dist/compiler/compiler-context.d.ts +23 -0
  58. package/dist/compiler/compiler-context.js +24 -0
  59. package/dist/compiler/config/constants.d.ts +41 -0
  60. package/dist/compiler/config/constants.js +45 -0
  61. package/dist/compiler/config/index.d.ts +252 -0
  62. package/dist/compiler/config/index.js +15 -0
  63. package/dist/compiler/config/injection.d.ts +26 -0
  64. package/dist/compiler/config/injection.js +58 -0
  65. package/dist/compiler/config/schemas/experimental/index.d.ts +91 -0
  66. package/dist/compiler/config/schemas/experimental/index.js +16 -0
  67. package/dist/compiler/config/schemas/experimental/oauth.d.ts +74 -0
  68. package/dist/compiler/config/schemas/experimental/oauth.js +25 -0
  69. package/dist/compiler/config/schemas/index.d.ts +6 -0
  70. package/dist/compiler/config/schemas/index.js +17 -0
  71. package/dist/compiler/config/schemas/paths.d.ts +9 -0
  72. package/dist/compiler/config/schemas/paths.js +12 -0
  73. package/dist/compiler/config/schemas/transport/http.d.ts +82 -0
  74. package/dist/compiler/config/schemas/transport/http.js +33 -0
  75. package/dist/compiler/config/schemas/transport/stdio.d.ts +9 -0
  76. package/dist/compiler/config/schemas/transport/stdio.js +15 -0
  77. package/dist/compiler/config/schemas/webpack.d.ts +3 -0
  78. package/dist/compiler/config/schemas/webpack.js +15 -0
  79. package/dist/compiler/config/types.d.ts +1 -0
  80. package/dist/compiler/config/types.js +2 -0
  81. package/dist/compiler/config/utils.d.ts +20 -0
  82. package/dist/compiler/config/utils.js +36 -0
  83. package/dist/compiler/generate-env-code.d.ts +1 -0
  84. package/dist/compiler/generate-env-code.js +8 -0
  85. package/dist/compiler/generate-import-code.d.ts +1 -0
  86. package/dist/compiler/generate-import-code.js +24 -0
  87. package/dist/compiler/get-webpack-config/get-entries.d.ts +3 -0
  88. package/dist/compiler/get-webpack-config/get-entries.js +29 -0
  89. package/dist/compiler/get-webpack-config/get-externals.d.ts +7 -0
  90. package/dist/compiler/get-webpack-config/get-externals.js +88 -0
  91. package/dist/compiler/get-webpack-config/get-injected-variables.d.ts +8 -0
  92. package/dist/compiler/get-webpack-config/get-injected-variables.js +25 -0
  93. package/dist/compiler/get-webpack-config/index.d.ts +4 -0
  94. package/dist/compiler/get-webpack-config/index.js +101 -0
  95. package/dist/compiler/get-webpack-config/plugins.d.ts +8 -0
  96. package/dist/compiler/get-webpack-config/plugins.js +132 -0
  97. package/dist/compiler/get-webpack-config/resolve-tsconfig-paths.d.ts +9 -0
  98. package/dist/compiler/get-webpack-config/resolve-tsconfig-paths.js +40 -0
  99. package/dist/compiler/index.d.ts +6 -0
  100. package/dist/compiler/index.js +194 -0
  101. package/dist/compiler/on-first-build.d.ts +3 -0
  102. package/dist/compiler/on-first-build.js +58 -0
  103. package/dist/compiler/parse-xmcp-config.d.ts +9 -0
  104. package/dist/compiler/parse-xmcp-config.js +155 -0
  105. package/dist/compiler/start-http-server.d.ts +1 -0
  106. package/dist/compiler/start-http-server.js +34 -0
  107. package/dist/index.d.ts +12 -0
  108. package/dist/index.js +38 -0
  109. package/dist/index.js.LICENSE.txt +49 -0
  110. package/dist/runtime/__tests__/audit.test.d.ts +4 -0
  111. package/dist/runtime/__tests__/audit.test.js +328 -0
  112. package/dist/runtime/__tests__/identity.test.d.ts +4 -0
  113. package/dist/runtime/__tests__/identity.test.js +164 -0
  114. package/dist/runtime/__tests__/mcpi-runtime.test.d.ts +4 -0
  115. package/dist/runtime/__tests__/mcpi-runtime.test.js +372 -0
  116. package/dist/runtime/__tests__/proof.test.d.ts +4 -0
  117. package/dist/runtime/__tests__/proof.test.js +302 -0
  118. package/dist/runtime/__tests__/session.test.d.ts +4 -0
  119. package/dist/runtime/__tests__/session.test.js +254 -0
  120. package/dist/runtime/__tests__/well-known.test.d.ts +4 -0
  121. package/dist/runtime/__tests__/well-known.test.js +312 -0
  122. package/dist/runtime/adapter-express.js +2 -0
  123. package/dist/runtime/adapter-express.js.LICENSE.txt +252 -0
  124. package/dist/runtime/adapter-nextjs.js +2 -0
  125. package/dist/runtime/adapter-nextjs.js.LICENSE.txt +53 -0
  126. package/dist/runtime/adapters/express/index.d.ts +2 -0
  127. package/dist/runtime/adapters/express/index.js +48 -0
  128. package/dist/runtime/adapters/nextjs/index.d.ts +8 -0
  129. package/dist/runtime/adapters/nextjs/index.js +18 -0
  130. package/dist/runtime/audit.d.ts +93 -0
  131. package/dist/runtime/audit.js +212 -0
  132. package/dist/runtime/debug.d.ts +118 -0
  133. package/dist/runtime/debug.js +612 -0
  134. package/dist/runtime/delegation-hooks.d.ts +85 -0
  135. package/dist/runtime/delegation-hooks.js +116 -0
  136. package/dist/runtime/demo.d.ts +71 -0
  137. package/dist/runtime/demo.js +135 -0
  138. package/dist/runtime/headers.d.ts +1 -0
  139. package/dist/runtime/headers.js +9 -0
  140. package/dist/runtime/http.js +2 -0
  141. package/dist/runtime/http.js.LICENSE.txt +252 -0
  142. package/dist/runtime/identity.d.ts +105 -0
  143. package/dist/runtime/identity.js +232 -0
  144. package/dist/runtime/index.d.ts +16 -0
  145. package/dist/runtime/index.js +56 -0
  146. package/dist/runtime/mcpi-runtime.d.ts +164 -0
  147. package/dist/runtime/mcpi-runtime.js +352 -0
  148. package/dist/runtime/proof.d.ts +87 -0
  149. package/dist/runtime/proof.js +223 -0
  150. package/dist/runtime/session.d.ts +88 -0
  151. package/dist/runtime/session.js +216 -0
  152. package/dist/runtime/stdio.js +2 -0
  153. package/dist/runtime/stdio.js.LICENSE.txt +1 -0
  154. package/dist/runtime/templates/home.d.ts +2 -0
  155. package/dist/runtime/templates/home.js +50 -0
  156. package/dist/runtime/transports/http/base-streamable-http.d.ts +25 -0
  157. package/dist/runtime/transports/http/base-streamable-http.js +16 -0
  158. package/dist/runtime/transports/http/http-context.d.ts +9 -0
  159. package/dist/runtime/transports/http/http-context.js +8 -0
  160. package/dist/runtime/transports/http/index.js +55 -0
  161. package/dist/runtime/transports/http/setup-cors.d.ts +4 -0
  162. package/dist/runtime/transports/http/setup-cors.js +24 -0
  163. package/dist/runtime/transports/http/stateless-streamable-http.d.ts +39 -0
  164. package/dist/runtime/transports/http/stateless-streamable-http.js +331 -0
  165. package/dist/runtime/transports/stdio/index.d.ts +1 -0
  166. package/dist/runtime/transports/stdio/index.js +51 -0
  167. package/dist/runtime/utils/server.d.ts +42 -0
  168. package/dist/runtime/utils/server.js +39 -0
  169. package/dist/runtime/utils/tools.d.ts +8 -0
  170. package/dist/runtime/utils/tools.js +115 -0
  171. package/dist/runtime/verifier-middleware.d.ts +76 -0
  172. package/dist/runtime/verifier-middleware.js +322 -0
  173. package/dist/runtime/well-known.d.ts +151 -0
  174. package/dist/runtime/well-known.js +258 -0
  175. package/dist/storage/config.d.ts +28 -0
  176. package/dist/storage/config.js +79 -0
  177. package/dist/storage/delegation.d.ts +59 -0
  178. package/dist/storage/delegation.js +130 -0
  179. package/dist/storage/merkle-verifier.d.ts +84 -0
  180. package/dist/storage/merkle-verifier.js +261 -0
  181. package/dist/test/__tests__/nonce-cache-integration.test.d.ts +1 -0
  182. package/dist/test/__tests__/nonce-cache-integration.test.js +116 -0
  183. package/dist/test/__tests__/nonce-cache.test.d.ts +1 -0
  184. package/dist/test/__tests__/nonce-cache.test.js +122 -0
  185. package/dist/test/__tests__/runtime-integration.test.d.ts +4 -0
  186. package/dist/test/__tests__/runtime-integration.test.js +192 -0
  187. package/dist/test/__tests__/test-infrastructure.test.d.ts +4 -0
  188. package/dist/test/__tests__/test-infrastructure.test.js +178 -0
  189. package/dist/test/deterministic-keys.d.ts +31 -0
  190. package/dist/test/deterministic-keys.js +108 -0
  191. package/dist/test/examples/test-usage-example.d.ts +140 -0
  192. package/dist/test/examples/test-usage-example.js +175 -0
  193. package/dist/test/index.d.ts +11 -0
  194. package/dist/test/index.js +27 -0
  195. package/dist/test/local-verification.d.ts +28 -0
  196. package/dist/test/local-verification.js +342 -0
  197. package/dist/test/mock-identity-provider.d.ts +96 -0
  198. package/dist/test/mock-identity-provider.js +243 -0
  199. package/dist/test/runtime-integration.d.ts +63 -0
  200. package/dist/test/runtime-integration.js +140 -0
  201. package/dist/test/test-environment.d.ts +26 -0
  202. package/dist/test/test-environment.js +50 -0
  203. package/dist/types/declarations.d.ts +1 -0
  204. package/dist/types/declarations.js +6 -0
  205. package/dist/types/middleware.d.ts +2 -0
  206. package/dist/types/middleware.js +2 -0
  207. package/dist/types/tool.d.ts +80 -0
  208. package/dist/types/tool.js +2 -0
  209. package/dist/utils/cli-icons.d.ts +3 -0
  210. package/dist/utils/cli-icons.js +7 -0
  211. package/dist/utils/constants.d.ts +6 -0
  212. package/dist/utils/constants.js +13 -0
  213. package/dist/utils/context.d.ts +33 -0
  214. package/dist/utils/context.js +58 -0
  215. package/dist/utils/file-watcher.d.ts +19 -0
  216. package/dist/utils/file-watcher.js +49 -0
  217. package/dist/utils/fs-utils.d.ts +2 -0
  218. package/dist/utils/fs-utils.js +22 -0
  219. package/dist/utils/path-validation.d.ts +3 -0
  220. package/dist/utils/path-validation.js +56 -0
  221. package/dist/utils/spawn-process.d.ts +9 -0
  222. package/dist/utils/spawn-process.js +50 -0
  223. package/dist/utils/subscribable.d.ts +12 -0
  224. package/dist/utils/subscribable.js +44 -0
  225. package/package.json +91 -77
  226. package/dist/cjs/auto.js +0 -16
  227. package/dist/cjs/cli-mode.d.ts +0 -16
  228. package/dist/cjs/cli-mode.js +0 -32
  229. package/dist/cjs/crypto.d.ts +0 -16
  230. package/dist/cjs/crypto.js +0 -212
  231. package/dist/cjs/dev-helper.d.ts +0 -3
  232. package/dist/cjs/dev-helper.js +0 -46
  233. package/dist/cjs/encrypted-storage.d.ts +0 -11
  234. package/dist/cjs/encrypted-storage.js +0 -73
  235. package/dist/cjs/index.d.ts +0 -56
  236. package/dist/cjs/index.js +0 -727
  237. package/dist/cjs/logger.d.ts +0 -32
  238. package/dist/cjs/logger.js +0 -85
  239. package/dist/cjs/nextjs.d.ts +0 -10
  240. package/dist/cjs/nextjs.js +0 -83
  241. package/dist/cjs/platform-info.d.ts +0 -36
  242. package/dist/cjs/platform-info.js +0 -274
  243. package/dist/cjs/polling.d.ts +0 -13
  244. package/dist/cjs/polling.js +0 -52
  245. package/dist/cjs/registry/index.d.ts +0 -12
  246. package/dist/cjs/registry/index.js +0 -56
  247. package/dist/cjs/registry/knowthat.d.ts +0 -17
  248. package/dist/cjs/registry/knowthat.js +0 -173
  249. package/dist/cjs/rotation.d.ts +0 -35
  250. package/dist/cjs/rotation.js +0 -102
  251. package/dist/cjs/storage.d.ts +0 -41
  252. package/dist/cjs/storage.js +0 -163
  253. package/dist/cjs/transport.d.ts +0 -35
  254. package/dist/cjs/transport.js +0 -300
  255. package/dist/cjs/types.d.ts +0 -206
  256. package/dist/cjs/vercel-adapter.d.ts +0 -8
  257. package/dist/cjs/vercel-adapter.js +0 -67
  258. package/dist/esm/auto.d.ts +0 -13
  259. package/dist/esm/auto.d.ts.map +0 -1
  260. package/dist/esm/auto.js +0 -30
  261. package/dist/esm/auto.js.map +0 -1
  262. package/dist/esm/cli-mode.d.ts +0 -52
  263. package/dist/esm/cli-mode.d.ts.map +0 -1
  264. package/dist/esm/cli-mode.js +0 -59
  265. package/dist/esm/cli-mode.js.map +0 -1
  266. package/dist/esm/crypto.d.ts +0 -51
  267. package/dist/esm/crypto.d.ts.map +0 -1
  268. package/dist/esm/crypto.js +0 -230
  269. package/dist/esm/crypto.js.map +0 -1
  270. package/dist/esm/dev-helper.d.ts +0 -15
  271. package/dist/esm/dev-helper.d.ts.map +0 -1
  272. package/dist/esm/dev-helper.js +0 -63
  273. package/dist/esm/dev-helper.js.map +0 -1
  274. package/dist/esm/encrypted-storage.d.ts +0 -19
  275. package/dist/esm/encrypted-storage.d.ts.map +0 -1
  276. package/dist/esm/encrypted-storage.js +0 -48
  277. package/dist/esm/encrypted-storage.js.map +0 -1
  278. package/dist/esm/index.d.ts +0 -129
  279. package/dist/esm/index.d.ts.map +0 -1
  280. package/dist/esm/index.js +0 -853
  281. package/dist/esm/index.js.map +0 -1
  282. package/dist/esm/logger.d.ts +0 -46
  283. package/dist/esm/logger.d.ts.map +0 -1
  284. package/dist/esm/logger.js +0 -100
  285. package/dist/esm/logger.js.map +0 -1
  286. package/dist/esm/nextjs.d.ts +0 -22
  287. package/dist/esm/nextjs.d.ts.map +0 -1
  288. package/dist/esm/nextjs.js +0 -83
  289. package/dist/esm/nextjs.js.map +0 -1
  290. package/dist/esm/package.json +0 -1
  291. package/dist/esm/platform-info.d.ts +0 -74
  292. package/dist/esm/platform-info.d.ts.map +0 -1
  293. package/dist/esm/platform-info.js +0 -293
  294. package/dist/esm/platform-info.js.map +0 -1
  295. package/dist/esm/polling.d.ts +0 -29
  296. package/dist/esm/polling.d.ts.map +0 -1
  297. package/dist/esm/polling.js +0 -76
  298. package/dist/esm/polling.js.map +0 -1
  299. package/dist/esm/registry/index.d.ts +0 -43
  300. package/dist/esm/registry/index.d.ts.map +0 -1
  301. package/dist/esm/registry/index.js +0 -89
  302. package/dist/esm/registry/index.js.map +0 -1
  303. package/dist/esm/registry/knowthat.d.ts +0 -44
  304. package/dist/esm/registry/knowthat.d.ts.map +0 -1
  305. package/dist/esm/registry/knowthat.js +0 -220
  306. package/dist/esm/registry/knowthat.js.map +0 -1
  307. package/dist/esm/rotation.d.ts +0 -57
  308. package/dist/esm/rotation.d.ts.map +0 -1
  309. package/dist/esm/rotation.js +0 -133
  310. package/dist/esm/rotation.js.map +0 -1
  311. package/dist/esm/storage.d.ts +0 -65
  312. package/dist/esm/storage.d.ts.map +0 -1
  313. package/dist/esm/storage.js +0 -160
  314. package/dist/esm/storage.js.map +0 -1
  315. package/dist/esm/transport.d.ts +0 -52
  316. package/dist/esm/transport.d.ts.map +0 -1
  317. package/dist/esm/transport.js +0 -340
  318. package/dist/esm/transport.js.map +0 -1
  319. package/dist/esm/types.d.ts +0 -293
  320. package/dist/esm/types.d.ts.map +0 -1
  321. package/dist/esm/types.js +0 -5
  322. package/dist/esm/types.js.map +0 -1
  323. package/dist/esm/vercel-adapter.d.ts +0 -26
  324. package/dist/esm/vercel-adapter.d.ts.map +0 -1
  325. package/dist/esm/vercel-adapter.js +0 -80
  326. package/dist/esm/vercel-adapter.js.map +0 -1
  327. /package/dist/{cjs → auth/oauth}/types.js +0 -0
  328. /package/dist/{cjs/auto.d.ts → runtime/transports/http/index.d.ts} +0 -0
@@ -1,59 +0,0 @@
1
- /**
2
- * CLI Mode for MCP-I Package
3
- * @internal - For use by @kya-os/cli package only
4
- * @private
5
- *
6
- * This module provides a specialized interface for the KYA-OS CLI
7
- * with enhanced progress reporting and silent logging by default.
8
- */
9
- import { enableMCPIdentity } from './index.js';
10
- /**
11
- * Enable MCP Identity with CLI-optimized defaults
12
- * @internal - For use by @kya-os/cli package only
13
- *
14
- * This function:
15
- * - Sets silent logging by default
16
- * - Provides structured progress events
17
- * - Returns additional metadata useful for CLI animations
18
- * - Optimizes for the best CLI experience
19
- *
20
- * @param options Configuration options
21
- * @returns MCPIdentity instance with additional CLI metadata
22
- */
23
- export async function enableMCPIdentityCLI(options) {
24
- // Track if this is a new identity
25
- let isNewIdentity = false;
26
- let capturedClaimUrl;
27
- // Wrap the progress callback to capture metadata
28
- const wrappedProgress = (event) => {
29
- // Capture claim URL from complete event
30
- if (event.stage === 'complete' && event.data?.claimUrl) {
31
- capturedClaimUrl = event.data.claimUrl;
32
- }
33
- // Detect if this is a new identity
34
- if (event.stage === 'generating_keys') {
35
- isNewIdentity = true;
36
- }
37
- // Call the original callback if provided
38
- options?.onProgress?.(event);
39
- };
40
- // Initialize with CLI-optimized defaults
41
- const identity = await enableMCPIdentity({
42
- ...options,
43
- logLevel: options?.logLevel || 'silent', // Silent by default
44
- onProgress: wrappedProgress
45
- });
46
- // Get DID for metadata
47
- const did = identity.did;
48
- // Return identity with additional CLI metadata
49
- return {
50
- identity,
51
- metadata: {
52
- isNewIdentity,
53
- did,
54
- claimUrl: capturedClaimUrl,
55
- registryUrl: 'https://knowthat.ai/agents/' + did.split(':').pop()
56
- }
57
- };
58
- }
59
- //# sourceMappingURL=cli-mode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli-mode.js","sourceRoot":"","sources":["../../src/cli-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAoB/C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,OAA+B;IAU/B,kCAAkC;IAClC,IAAI,aAAa,GAAG,KAAK,CAAC;IAC1B,IAAI,gBAAoC,CAAC;IAEzC,iDAAiD;IACjD,MAAM,eAAe,GAAgC,CAAC,KAAK,EAAE,EAAE;QAC7D,wCAAwC;QACxC,IAAI,KAAK,CAAC,KAAK,KAAK,UAAU,IAAI,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC;YACvD,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;QACzC,CAAC;QAED,mCAAmC;QACnC,IAAI,KAAK,CAAC,KAAK,KAAK,iBAAiB,EAAE,CAAC;YACtC,aAAa,GAAG,IAAI,CAAC;QACvB,CAAC;QAED,yCAAyC;QACzC,OAAO,EAAE,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC,CAAC;IAEF,yCAAyC;IACzC,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC;QACvC,GAAG,OAAO;QACV,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,QAAQ,EAAE,oBAAoB;QAC7D,UAAU,EAAE,eAAe;KAC5B,CAAC,CAAC;IAEH,uBAAuB;IACvB,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;IAEzB,+CAA+C;IAC/C,OAAO;QACL,QAAQ;QACR,QAAQ,EAAE;YACR,aAAa;YACb,GAAG;YACH,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,6BAA6B,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE;SAClE;KACF,CAAC;AACJ,CAAC"}
@@ -1,51 +0,0 @@
1
- /**
2
- * Optimized cryptographic utilities for MCP-I with lazy loading
3
- * Implements Ed25519 signing and verification with caching
4
- */
5
- /**
6
- * Precomputed key pair with cached base64 strings
7
- */
8
- export interface PrecomputedKeyPair {
9
- publicKey: string;
10
- privateKey: string;
11
- publicKeyBytes?: Uint8Array;
12
- privateKeyBytes?: Uint8Array;
13
- }
14
- /**
15
- * Generate a new Ed25519 key pair with precomputed values
16
- */
17
- export declare function generateKeyPair(): Promise<PrecomputedKeyPair>;
18
- /**
19
- * Sign a message with Ed25519 (with caching)
20
- */
21
- export declare function sign(message: string | Buffer, privateKeyBase64: string): Promise<string>;
22
- /**
23
- * Verify an Ed25519 signature
24
- */
25
- export declare function verify(message: string | Buffer, signatureBase64: string, publicKeyBase64: string): Promise<boolean>;
26
- /**
27
- * Generate a cryptographically secure nonce
28
- */
29
- export declare function generateNonce(length?: number): Promise<string>;
30
- export declare function generateNonceSync(length?: number): string;
31
- /**
32
- * Constant-time string comparison to prevent timing attacks
33
- */
34
- export declare function constantTimeEqual(a: string, b: string): boolean;
35
- /**
36
- * Convert Ed25519 public key to did:key format
37
- */
38
- export declare function publicKeyToDid(publicKeyBase64: string): string;
39
- /**
40
- * Encrypt data using AES-256-GCM (for key storage)
41
- */
42
- export declare function encrypt(data: string, password: string): Promise<string>;
43
- /**
44
- * Decrypt data using AES-256-GCM
45
- */
46
- export declare function decrypt(encryptedData: string, password: string): Promise<string>;
47
- /**
48
- * Clear signature cache (useful for testing or memory management)
49
- */
50
- export declare function clearCache(): void;
51
- //# sourceMappingURL=crypto.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/crypto.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2BH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B,eAAe,CAAC,EAAE,UAAU,CAAC;CAC9B;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAgBnE;AAED;;GAEG;AACH,wBAAsB,IAAI,CACxB,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAgCjB;AAED;;GAEG;AACH,wBAAsB,MAAM,CAC1B,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,OAAO,CAAC,CAclB;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAGxE;AAQD,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,MAAW,GAAG,MAAM,CAqB7D;AAWD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAW/D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAQ9D;AAED;;GAEG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA2C7E;AAED;;GAEG;AACH,wBAAsB,OAAO,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA6DtF;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAEjC"}
@@ -1,230 +0,0 @@
1
- /**
2
- * Optimized cryptographic utilities for MCP-I with lazy loading
3
- * Implements Ed25519 signing and verification with caching
4
- */
5
- // Lazy-loaded modules
6
- let ed25519 = null;
7
- let cryptoModule = null;
8
- // Cache for computed values
9
- const signatureCache = new Map();
10
- const MAX_CACHE_SIZE = 100;
11
- /**
12
- * Lazy load crypto dependencies
13
- */
14
- async function loadEd25519() {
15
- if (!ed25519) {
16
- ed25519 = await import('@noble/ed25519');
17
- }
18
- return ed25519;
19
- }
20
- async function loadCrypto() {
21
- if (!cryptoModule) {
22
- cryptoModule = await import('crypto');
23
- }
24
- return cryptoModule;
25
- }
26
- /**
27
- * Generate a new Ed25519 key pair with precomputed values
28
- */
29
- export async function generateKeyPair() {
30
- const ed = await loadEd25519();
31
- const privateKeyBytes = ed.utils.randomPrivateKey();
32
- const publicKeyBytes = await ed.getPublicKeyAsync(privateKeyBytes);
33
- // Precompute base64 strings
34
- const publicKey = Buffer.from(publicKeyBytes).toString('base64');
35
- const privateKey = Buffer.from(privateKeyBytes).toString('base64');
36
- return {
37
- publicKey,
38
- privateKey,
39
- publicKeyBytes,
40
- privateKeyBytes
41
- };
42
- }
43
- /**
44
- * Sign a message with Ed25519 (with caching)
45
- */
46
- export async function sign(message, privateKeyBase64) {
47
- // Create cache key
48
- const messageStr = typeof message === 'string' ? message : message.toString('base64');
49
- const cacheKey = `${privateKeyBase64}:${messageStr}`;
50
- // Check cache
51
- const cached = signatureCache.get(cacheKey);
52
- if (cached) {
53
- return cached;
54
- }
55
- // Perform signing
56
- const ed = await loadEd25519();
57
- const messageBuffer = typeof message === 'string'
58
- ? Buffer.from(message, 'utf-8')
59
- : message;
60
- const privateKey = Buffer.from(privateKeyBase64, 'base64');
61
- const signature = await ed.signAsync(messageBuffer, privateKey);
62
- const signatureBase64 = Buffer.from(signature).toString('base64');
63
- // Cache result (with size limit)
64
- if (signatureCache.size >= MAX_CACHE_SIZE) {
65
- // Remove oldest entry
66
- const firstKey = signatureCache.keys().next().value;
67
- if (firstKey) {
68
- signatureCache.delete(firstKey);
69
- }
70
- }
71
- signatureCache.set(cacheKey, signatureBase64);
72
- return signatureBase64;
73
- }
74
- /**
75
- * Verify an Ed25519 signature
76
- */
77
- export async function verify(message, signatureBase64, publicKeyBase64) {
78
- try {
79
- const ed = await loadEd25519();
80
- const messageBuffer = typeof message === 'string'
81
- ? Buffer.from(message, 'utf-8')
82
- : message;
83
- const signature = Buffer.from(signatureBase64, 'base64');
84
- const publicKey = Buffer.from(publicKeyBase64, 'base64');
85
- return await ed.verifyAsync(signature, messageBuffer, publicKey);
86
- }
87
- catch {
88
- return false;
89
- }
90
- }
91
- /**
92
- * Generate a cryptographically secure nonce
93
- */
94
- export async function generateNonce(length = 32) {
95
- const crypto = await loadCrypto();
96
- return crypto.randomBytes(length).toString('hex');
97
- }
98
- /**
99
- * Generate nonce synchronously (for performance-critical paths)
100
- * Uses cached crypto module if available
101
- */
102
- let cachedCrypto = null;
103
- export function generateNonceSync(length = 32) {
104
- if (typeof globalThis.crypto !== 'undefined' && globalThis.crypto.getRandomValues) {
105
- // Use Web Crypto API if available
106
- const bytes = new Uint8Array(length);
107
- globalThis.crypto.getRandomValues(bytes);
108
- return Buffer.from(bytes).toString('hex');
109
- }
110
- else {
111
- // Try to use cached crypto module
112
- if (!cachedCrypto) {
113
- // In Node.js environment, we should have already loaded crypto module
114
- // This is a fallback for edge cases
115
- const hex = '0123456789abcdef';
116
- let output = '';
117
- for (let i = 0; i < length * 2; i++) {
118
- output += hex[Math.floor(Math.random() * 16)];
119
- }
120
- console.warn('Using Math.random for nonce generation - not cryptographically secure!');
121
- return output;
122
- }
123
- return cachedCrypto.randomBytes(length).toString('hex');
124
- }
125
- }
126
- // Initialize crypto module cache on load (for Node.js environments)
127
- if (typeof process !== 'undefined' && process.versions && process.versions.node) {
128
- loadCrypto().then(crypto => {
129
- cachedCrypto = crypto;
130
- }).catch(() => {
131
- // Ignore errors - will fallback to other methods
132
- });
133
- }
134
- /**
135
- * Constant-time string comparison to prevent timing attacks
136
- */
137
- export function constantTimeEqual(a, b) {
138
- if (a.length !== b.length) {
139
- return false;
140
- }
141
- let result = 0;
142
- for (let i = 0; i < a.length; i++) {
143
- result |= a.charCodeAt(i) ^ b.charCodeAt(i);
144
- }
145
- return result === 0;
146
- }
147
- /**
148
- * Convert Ed25519 public key to did:key format
149
- */
150
- export function publicKeyToDid(publicKeyBase64) {
151
- const publicKey = Buffer.from(publicKeyBase64, 'base64');
152
- // Multicodec ed25519-pub header (0xed 0x01)
153
- const multicodec = Buffer.from([0xed, 0x01]);
154
- const multikey = Buffer.concat([multicodec, publicKey]);
155
- // Base58 encode (simplified - in production use a proper base58 library)
156
- return `did:key:z${multikey.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '')}`;
157
- }
158
- /**
159
- * Encrypt data using AES-256-GCM (for key storage)
160
- */
161
- export async function encrypt(data, password) {
162
- const encoder = new TextEncoder();
163
- const salt = new Uint8Array(16);
164
- globalThis.crypto.getRandomValues(salt);
165
- // Derive key from password
166
- const keyMaterial = await globalThis.crypto.subtle.importKey('raw', encoder.encode(password), 'PBKDF2', false, ['deriveKey']);
167
- const key = await globalThis.crypto.subtle.deriveKey({
168
- name: 'PBKDF2',
169
- salt,
170
- iterations: 100000,
171
- hash: 'SHA-256'
172
- }, keyMaterial, { name: 'AES-GCM', length: 256 }, false, ['encrypt']);
173
- const iv = new Uint8Array(12);
174
- globalThis.crypto.getRandomValues(iv);
175
- const encrypted = await globalThis.crypto.subtle.encrypt({ name: 'AES-GCM', iv }, key, encoder.encode(data));
176
- // Combine salt + iv + encrypted data
177
- const combined = new Uint8Array(salt.length + iv.length + encrypted.byteLength);
178
- combined.set(salt);
179
- combined.set(iv, salt.length);
180
- combined.set(new Uint8Array(encrypted), salt.length + iv.length);
181
- return 'enc:' + Buffer.from(combined).toString('base64');
182
- }
183
- /**
184
- * Decrypt data using AES-256-GCM
185
- */
186
- export async function decrypt(encryptedData, password) {
187
- // Handle enc: prefix
188
- let dataToDecrypt = encryptedData;
189
- if (encryptedData.startsWith('enc:')) {
190
- dataToDecrypt = encryptedData.slice(4);
191
- }
192
- // If data doesn't look like base64 encrypted data, return as-is
193
- if (!dataToDecrypt || dataToDecrypt.length < 44) {
194
- return encryptedData;
195
- }
196
- const encoder = new TextEncoder();
197
- const decoder = new TextDecoder();
198
- try {
199
- const combined = Buffer.from(dataToDecrypt, 'base64');
200
- // Check minimum size for encrypted data (salt + iv + auth tag + at least 1 byte)
201
- if (combined.length < 29) {
202
- return encryptedData;
203
- }
204
- // Extract salt, iv, and encrypted data
205
- const salt = combined.slice(0, 16);
206
- const iv = combined.slice(16, 28);
207
- const encrypted = combined.slice(28);
208
- // Derive key from password
209
- const keyMaterial = await globalThis.crypto.subtle.importKey('raw', encoder.encode(password), 'PBKDF2', false, ['deriveKey']);
210
- const key = await globalThis.crypto.subtle.deriveKey({
211
- name: 'PBKDF2',
212
- salt: new Uint8Array(salt),
213
- iterations: 100000,
214
- hash: 'SHA-256'
215
- }, keyMaterial, { name: 'AES-GCM', length: 256 }, false, ['decrypt']);
216
- const decrypted = await globalThis.crypto.subtle.decrypt({ name: 'AES-GCM', iv: new Uint8Array(iv) }, key, new Uint8Array(encrypted));
217
- return decoder.decode(decrypted);
218
- }
219
- catch (error) {
220
- // If decryption fails, throw error
221
- throw new Error('Failed to decrypt data: invalid password or corrupted data');
222
- }
223
- }
224
- /**
225
- * Clear signature cache (useful for testing or memory management)
226
- */
227
- export function clearCache() {
228
- signatureCache.clear();
229
- }
230
- //# sourceMappingURL=crypto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../src/crypto.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sBAAsB;AACtB,IAAI,OAAO,GAA2C,IAAI,CAAC;AAC3D,IAAI,YAAY,GAAmC,IAAI,CAAC;AAExD,4BAA4B;AAC5B,MAAM,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;AACjD,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B;;GAEG;AACH,KAAK,UAAU,WAAW;IACxB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,YAAY,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAYD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,MAAM,EAAE,GAAG,MAAM,WAAW,EAAE,CAAC;IAE/B,MAAM,eAAe,GAAG,EAAE,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;IACpD,MAAM,cAAc,GAAG,MAAM,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;IAEnE,4BAA4B;IAC5B,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,QAA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IAAI,EAAE,IAAI,UAAU,CAAC,IAAI,CAAC;YAC1B,UAAU,EAAE,MAAM;YAClB,IAAI,EAAE,SAAS;SAChB,EACD,WAAW,EACX,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,EAChC,KAAK,EACL,CAAC,SAAS,CAAC,CACZ,CAAC;QAEF,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CACtD,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAC3C,GAAG,EACH,IAAI,UAAU,CAAC,SAAS,CAAC,CAC1B,CAAC;QAEF,OAAO,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mCAAmC;QACnC,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,cAAc,CAAC,KAAK,EAAE,CAAC;AACzB,CAAC"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Development Helper for MCP-I Package
3
- *
4
- * Provides additional developer experience improvements for local development
5
- */
6
- import { MCPIdentity } from './index';
7
- /**
8
- * Enhanced development experience with helpful logging and tips
9
- */
10
- export declare function initWithDevExperience(options?: any): Promise<MCPIdentity>;
11
- /**
12
- * Quick agent status check for debugging
13
- */
14
- export declare function showAgentStatus(identity: MCPIdentity): void;
15
- //# sourceMappingURL=dev-helper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dev-helper.d.ts","sourceRoot":"","sources":["../../src/dev-helper.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,GAAE,GAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAoCnF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI,CAmB3D"}
@@ -1,63 +0,0 @@
1
- /**
2
- * Development Helper for MCP-I Package
3
- *
4
- * Provides additional developer experience improvements for local development
5
- */
6
- import { MCPIdentity } from './index.js';
7
- import { getLogger } from './logger.js';
8
- /**
9
- * Enhanced development experience with helpful logging and tips
10
- */
11
- export async function initWithDevExperience(options = {}) {
12
- const logger = getLogger();
13
- // Add development mode if not specified
14
- if (process.env.NODE_ENV === 'development' && !options.mode) {
15
- options.mode = 'development';
16
- logger.info('🔧 Development mode detected - agents will be created as drafts');
17
- }
18
- // Auto-detect MCP server name from package.json
19
- if (!options.name && !process.env.MCP_SERVER_NAME) {
20
- // In Next.js and other bundled environments, we can't dynamically require package.json
21
- // Users should provide the name explicitly
22
- options.name = 'Development MCP Server';
23
- logger.info('💡 Tip: Provide a name in options for better agent identification');
24
- }
25
- // Performance tips
26
- if (!options.storage) {
27
- logger.info('💡 Tip: Use storage: "file" for persistent identity across restarts');
28
- }
29
- const identity = await MCPIdentity.init(options);
30
- // Show useful development information
31
- logger.info('✨ MCP Identity initialized successfully!');
32
- logger.info(`🆔 DID: ${identity.did}`);
33
- // Show claim URL in development
34
- const { claimUrl } = await identity.requestEditAccess();
35
- logger.info(`🔗 Claim your agent: ${claimUrl}`);
36
- // Show integration tip
37
- logger.info('💡 Your MCP server responses are now automatically signed with your agent identity');
38
- return identity;
39
- }
40
- /**
41
- * Quick agent status check for debugging
42
- */
43
- export function showAgentStatus(identity) {
44
- const logger = getLogger();
45
- const capabilities = identity.getCapabilities();
46
- logger.info('📊 Agent Status:');
47
- logger.info(` DID: ${identity.did}`);
48
- logger.info(` Conformance Level: ${capabilities.conformanceLevel}`);
49
- logger.info(` Registry: ${capabilities.registry || 'knowthat.ai'}`);
50
- logger.info(` Handshake Supported: ${capabilities.handshakeSupported}`);
51
- // Show directory preferences
52
- const directories = identity.getDirectories();
53
- if (directories === 'none') {
54
- logger.info('📋 Directories: Not listing on any directories');
55
- }
56
- else if (directories === 'verified') {
57
- logger.info('📋 Directories: Listing on all verified directories');
58
- }
59
- else if (Array.isArray(directories)) {
60
- logger.info(`📋 Directories: ${directories.join(', ')}`);
61
- }
62
- }
63
- //# sourceMappingURL=dev-helper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dev-helper.js","sourceRoot":"","sources":["../../src/dev-helper.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,UAAe,EAAE;IAC3D,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAE3B,wCAAwC;IACxC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAC5D,OAAO,CAAC,IAAI,GAAG,aAAa,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAC;IACjF,CAAC;IAED,gDAAgD;IAChD,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC;QAClD,uFAAuF;QACvF,2CAA2C;QAC3C,OAAO,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC;IACnF,CAAC;IAED,mBAAmB;IACnB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,qEAAqE,CAAC,CAAC;IACrF,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEjD,sCAAsC;IACtC,MAAM,CAAC,IAAI,CAAC,0CAA0C,CAAC,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mB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Encrypted storage wrapper for MCP-I identity
3
- * Adds encryption layer on top of any storage provider
4
- */
5
- import { StorageProvider } from './storage';
6
- import { PersistedIdentity } from './types';
7
- export declare class EncryptedStorage implements StorageProvider {
8
- private baseStorage;
9
- private password;
10
- constructor(baseStorage: StorageProvider, password: string);
11
- load(): Promise<PersistedIdentity | null>;
12
- save(identity: PersistedIdentity): Promise<void>;
13
- exists(): Promise<boolean>;
14
- }
15
- /**
16
- * Create encrypted storage wrapper
17
- */
18
- export declare function createEncryptedStorage(baseStorage: StorageProvider, password: string): StorageProvider;
19
- //# sourceMappingURL=encrypted-storage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encrypted-storage.d.ts","sourceRoot":"","sources":["../../src/encrypted-storage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,qBAAa,gBAAiB,YAAW,eAAe;IAEpD,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,QAAQ;gBADR,WAAW,EAAE,eAAe,EAC5B,QAAQ,EAAE,MAAM;IAGpB,IAAI,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAkBzC,IAAI,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAehD,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;CAGjC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,eAAe,EAC5B,QAAQ,EAAE,MAAM,GACf,eAAe,CAEjB"}
@@ -1,48 +0,0 @@
1
- /**
2
- * Encrypted storage wrapper for MCP-I identity
3
- * Adds encryption layer on top of any storage provider
4
- */
5
- import * as crypto from './crypto.js';
6
- export class EncryptedStorage {
7
- baseStorage;
8
- password;
9
- constructor(baseStorage, password) {
10
- this.baseStorage = baseStorage;
11
- this.password = password;
12
- }
13
- async load() {
14
- const identity = await this.baseStorage.load();
15
- if (!identity) {
16
- return null;
17
- }
18
- // Decrypt private key if encrypted
19
- if (identity.privateKey.startsWith('enc:')) {
20
- try {
21
- identity.privateKey = await crypto.decrypt(identity.privateKey, this.password);
22
- }
23
- catch (error) {
24
- throw new Error('Failed to decrypt stored identity - invalid password');
25
- }
26
- }
27
- return identity;
28
- }
29
- async save(identity) {
30
- // Create a copy to avoid modifying the original
31
- const encryptedIdentity = { ...identity };
32
- // Encrypt private key before saving
33
- if (!encryptedIdentity.privateKey.startsWith('enc:')) {
34
- encryptedIdentity.privateKey = await crypto.encrypt(encryptedIdentity.privateKey, this.password);
35
- }
36
- await this.baseStorage.save(encryptedIdentity);
37
- }
38
- async exists() {
39
- return this.baseStorage.exists();
40
- }
41
- }
42
- /**
43
- * Create encrypted storage wrapper
44
- */
45
- export function createEncryptedStorage(baseStorage, password) {
46
- return new EncryptedStorage(baseStorage, password);
47
- }
48
- //# sourceMappingURL=encrypted-storage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encrypted-storage.js","sourceRoot":"","sources":["../../src/encrypted-storage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,OAAO,gBAAgB;IAEjB;IACA;IAFV,YACU,WAA4B,EAC5B,QAAgB;QADhB,gBAAW,GAAX,WAAW,CAAiB;QAC5B,aAAQ,GAAR,QAAQ,CAAQ;IACvB,CAAC;IAEJ,KAAK,CAAC,IAAI;QACR,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAC/C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,IAAI,CAAC;QACd,CAAC;QAED,mCAAmC;QACnC,IAAI,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3C,IAAI,CAAC;gBACH,QAAQ,CAAC,UAAU,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAA2B;QACpC,gDAAgD;QAChD,MAAM,iBAAiB,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;QAE1C,oCAAoC;QACpC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YACrD,iBAAiB,CAAC,UAAU,GAAG,MAAM,MAAM,CAAC,OAAO,CACjD,iBAAiB,CAAC,UAAU,EAC5B,IAAI,CAAC,QAAQ,CACd,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;IACnC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,WAA4B,EAC5B,QAAgB;IAEhB,OAAO,IAAI,gBAAgB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AACrD,CAAC"}
@@ -1,129 +0,0 @@
1
- /**
2
- * @kya-os/mcp-i - Optimized MCP Identity with production features
3
- *
4
- * Enable any MCP server to get a verifiable identity with just 2 lines of code:
5
- *
6
- * ```typescript
7
- * import "@kya-os/mcp-i/auto"; // That's it! Your server now has identity
8
- * ```
9
- */
10
- import { MCPIdentityOptions, Challenge, ChallengeResponse, MCPICapabilities, SignedResponse, MCPMiddleware, DirectoryPreference } from './types';
11
- import { KeyRotationResult, KeyHealth } from './rotation';
12
- export * from './types';
13
- export * from './vercel-adapter';
14
- export { RegistryFactory, REGISTRY_TIERS, resolveRegistries } from './registry';
15
- export { LoggerFactory, ConsoleLogger, SilentLogger } from './logger';
16
- export { StorageFactory, MemoryStorage, FileStorage } from './storage';
17
- export { TransportFactory, RuntimeDetector } from './transport';
18
- export { KeyRotationManager } from './rotation';
19
- export { initWithDevExperience, showAgentStatus } from './dev-helper';
20
- export { pollRegistrationStatus, isAsyncRegistrationResponse } from './polling';
21
- export declare class MCPIdentity {
22
- readonly did: string;
23
- readonly publicKey: string;
24
- private privateKey;
25
- private timestampTolerance;
26
- private enableNonceTracking;
27
- private usedNonces;
28
- private nonceCleanupInterval?;
29
- private encryptionPassword?;
30
- private decryptedPrivateKey?;
31
- private directories;
32
- private storage;
33
- private transport;
34
- private logger;
35
- private rotationManager?;
36
- private precomputed;
37
- private constructor();
38
- /**
39
- * Initialize MCP Identity - the main entry point
40
- */
41
- static init(options?: MCPIdentityOptions): Promise<MCPIdentity>;
42
- /**
43
- * Enable automatic key rotation
44
- */
45
- enableAutoRotation(policy?: {
46
- maxAge?: number;
47
- maxSignatures?: number;
48
- }): Promise<void>;
49
- /**
50
- * Manually rotate keys
51
- */
52
- rotateKeys(reason?: string): Promise<KeyRotationResult>;
53
- /**
54
- * Check key health
55
- */
56
- checkKeyHealth(): KeyHealth | null;
57
- /**
58
- * Get decrypted private key (lazy decryption)
59
- */
60
- private getPrivateKey;
61
- /**
62
- * Sign a message with caching
63
- */
64
- sign(message: string | Buffer): Promise<string>;
65
- /**
66
- * Request edit access with claim URL support
67
- */
68
- requestEditAccess(): Promise<{
69
- editUrl: string;
70
- claimUrl?: string;
71
- }>;
72
- /**
73
- * Verify a signature
74
- */
75
- verify(message: string | Buffer, signature: string, publicKey?: string): Promise<boolean>;
76
- /**
77
- * Respond to an MCP-I challenge
78
- */
79
- respondToChallenge(challenge: Challenge): Promise<ChallengeResponse>;
80
- /**
81
- * Get MCP-I capabilities for advertisement
82
- */
83
- getCapabilities(): MCPICapabilities;
84
- /**
85
- * Sign an MCP response with identity metadata
86
- */
87
- signResponse<T = any>(response: T): Promise<SignedResponse<T>>;
88
- /**
89
- * Generate a new nonce for challenges
90
- */
91
- static generateNonce(): string;
92
- /**
93
- * Get directory preferences
94
- */
95
- getDirectories(): DirectoryPreference;
96
- /**
97
- * Clean up old nonces periodically to prevent memory leaks
98
- */
99
- private startNonceCleanup;
100
- /**
101
- * Clean up resources
102
- */
103
- destroy(): void;
104
- /**
105
- * Helper to extract agent name from DID
106
- */
107
- private extractAgentName;
108
- /**
109
- * Helper to extract agent ID
110
- */
111
- private extractAgentId;
112
- /**
113
- * Helper to extract agent slug
114
- */
115
- private extractAgentSlug;
116
- /**
117
- * Persist full identity (for key rotation)
118
- */
119
- private persistIdentity;
120
- }
121
- /**
122
- * Enable MCP Identity for any MCP server
123
- */
124
- export declare function enableMCPIdentity(options?: MCPIdentityOptions): Promise<MCPIdentity>;
125
- /**
126
- * Create MCP middleware for manual integration
127
- */
128
- export declare function createMCPMiddleware(identity: MCPIdentity): MCPMiddleware;
129
- //# sourceMappingURL=index.d.ts.map