toolcraft 0.0.119 → 0.0.121

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 (153) hide show
  1. package/composition.json +17 -2
  2. package/dist/composition.json +17 -2
  3. package/dist/http.compile-check.d.ts +1 -0
  4. package/dist/http.compile-check.js +31 -0
  5. package/dist/http.d.ts +19 -0
  6. package/dist/http.js +62 -0
  7. package/dist/mcp.js +26 -11
  8. package/node_modules/jose/LICENSE.md +21 -0
  9. package/node_modules/jose/README.md +153 -0
  10. package/node_modules/jose/dist/types/index.d.ts +55 -0
  11. package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +31 -0
  12. package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +65 -0
  13. package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +31 -0
  14. package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +83 -0
  15. package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +38 -0
  16. package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +74 -0
  17. package/node_modules/jose/dist/types/jwk/embedded.d.ts +17 -0
  18. package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +32 -0
  19. package/node_modules/jose/dist/types/jwks/local.d.ts +29 -0
  20. package/node_modules/jose/dist/types/jwks/remote.d.ts +237 -0
  21. package/node_modules/jose/dist/types/jws/compact/sign.d.ts +36 -0
  22. package/node_modules/jose/dist/types/jws/compact/verify.d.ts +33 -0
  23. package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +42 -0
  24. package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +33 -0
  25. package/node_modules/jose/dist/types/jws/general/sign.d.ts +53 -0
  26. package/node_modules/jose/dist/types/jws/general/verify.d.ts +41 -0
  27. package/node_modules/jose/dist/types/jwt/decrypt.d.ts +35 -0
  28. package/node_modules/jose/dist/types/jwt/encrypt.d.ts +91 -0
  29. package/node_modules/jose/dist/types/jwt/sign.d.ts +43 -0
  30. package/node_modules/jose/dist/types/jwt/unsecured.d.ts +43 -0
  31. package/node_modules/jose/dist/types/jwt/verify.d.ts +37 -0
  32. package/node_modules/jose/dist/types/key/export.d.ts +33 -0
  33. package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +47 -0
  34. package/node_modules/jose/dist/types/key/generate_secret.d.ts +35 -0
  35. package/node_modules/jose/dist/types/key/import.d.ts +83 -0
  36. package/node_modules/jose/dist/types/types.d.ts +852 -0
  37. package/node_modules/jose/dist/types/util/base64url.d.ts +9 -0
  38. package/node_modules/jose/dist/types/util/decode_jwt.d.ts +18 -0
  39. package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +17 -0
  40. package/node_modules/jose/dist/types/util/errors.d.ts +213 -0
  41. package/node_modules/jose/dist/webapi/index.js +32 -0
  42. package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +27 -0
  43. package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +27 -0
  44. package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +159 -0
  45. package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +167 -0
  46. package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +31 -0
  47. package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +182 -0
  48. package/node_modules/jose/dist/webapi/jwk/embedded.js +17 -0
  49. package/node_modules/jose/dist/webapi/jwk/thumbprint.js +68 -0
  50. package/node_modules/jose/dist/webapi/jwks/local.js +119 -0
  51. package/node_modules/jose/dist/webapi/jwks/remote.js +179 -0
  52. package/node_modules/jose/dist/webapi/jws/compact/sign.js +18 -0
  53. package/node_modules/jose/dist/webapi/jws/compact/verify.js +21 -0
  54. package/node_modules/jose/dist/webapi/jws/flattened/sign.js +89 -0
  55. package/node_modules/jose/dist/webapi/jws/flattened/verify.js +110 -0
  56. package/node_modules/jose/dist/webapi/jws/general/sign.js +70 -0
  57. package/node_modules/jose/dist/webapi/jws/general/verify.js +24 -0
  58. package/node_modules/jose/dist/webapi/jwt/decrypt.js +23 -0
  59. package/node_modules/jose/dist/webapi/jwt/encrypt.js +101 -0
  60. package/node_modules/jose/dist/webapi/jwt/sign.js +52 -0
  61. package/node_modules/jose/dist/webapi/jwt/unsecured.js +63 -0
  62. package/node_modules/jose/dist/webapi/jwt/verify.js +15 -0
  63. package/node_modules/jose/dist/webapi/key/export.js +11 -0
  64. package/node_modules/jose/dist/webapi/key/generate_key_pair.js +97 -0
  65. package/node_modules/jose/dist/webapi/key/generate_secret.js +40 -0
  66. package/node_modules/jose/dist/webapi/key/import.js +57 -0
  67. package/node_modules/jose/dist/webapi/lib/aesgcmkw.js +15 -0
  68. package/node_modules/jose/dist/webapi/lib/aeskw.js +25 -0
  69. package/node_modules/jose/dist/webapi/lib/asn1.js +243 -0
  70. package/node_modules/jose/dist/webapi/lib/base64.js +22 -0
  71. package/node_modules/jose/dist/webapi/lib/buffer_utils.js +43 -0
  72. package/node_modules/jose/dist/webapi/lib/check_key_type.js +122 -0
  73. package/node_modules/jose/dist/webapi/lib/content_encryption.js +217 -0
  74. package/node_modules/jose/dist/webapi/lib/crypto_key.js +136 -0
  75. package/node_modules/jose/dist/webapi/lib/deflate.js +44 -0
  76. package/node_modules/jose/dist/webapi/lib/ecdhes.js +52 -0
  77. package/node_modules/jose/dist/webapi/lib/helpers.js +19 -0
  78. package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +27 -0
  79. package/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -0
  80. package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +107 -0
  81. package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +238 -0
  82. package/node_modules/jose/dist/webapi/lib/key_management.js +186 -0
  83. package/node_modules/jose/dist/webapi/lib/key_to_jwk.js +31 -0
  84. package/node_modules/jose/dist/webapi/lib/normalize_key.js +166 -0
  85. package/node_modules/jose/dist/webapi/lib/pbes2kw.js +42 -0
  86. package/node_modules/jose/dist/webapi/lib/rsaes.js +24 -0
  87. package/node_modules/jose/dist/webapi/lib/signing.js +68 -0
  88. package/node_modules/jose/dist/webapi/lib/type_checks.js +40 -0
  89. package/node_modules/jose/dist/webapi/lib/validate_algorithms.js +10 -0
  90. package/node_modules/jose/dist/webapi/lib/validate_crit.js +33 -0
  91. package/node_modules/jose/dist/webapi/util/base64url.js +30 -0
  92. package/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -0
  93. package/node_modules/jose/dist/webapi/util/decode_protected_header.js +34 -0
  94. package/node_modules/jose/dist/webapi/util/errors.js +99 -0
  95. package/node_modules/jose/package.json +200 -0
  96. package/node_modules/tiny-http-mcp-server/LICENSE +21 -0
  97. package/node_modules/tiny-http-mcp-server/README.md +778 -0
  98. package/node_modules/tiny-http-mcp-server/dist/auth.d.ts +69 -0
  99. package/node_modules/tiny-http-mcp-server/dist/auth.js +261 -0
  100. package/node_modules/tiny-http-mcp-server/dist/cli.d.ts +20 -0
  101. package/node_modules/tiny-http-mcp-server/dist/cli.js +465 -0
  102. package/node_modules/tiny-http-mcp-server/dist/composition.json +30 -0
  103. package/node_modules/tiny-http-mcp-server/dist/express-middleware.d.ts +18 -0
  104. package/node_modules/tiny-http-mcp-server/dist/express-middleware.js +90 -0
  105. package/node_modules/tiny-http-mcp-server/dist/http-server.d.ts +49 -0
  106. package/node_modules/tiny-http-mcp-server/dist/http-server.js +264 -0
  107. package/node_modules/tiny-http-mcp-server/dist/http-transport.d.ts +164 -0
  108. package/node_modules/tiny-http-mcp-server/dist/http-transport.js +897 -0
  109. package/node_modules/tiny-http-mcp-server/dist/index.d.ts +13 -0
  110. package/node_modules/tiny-http-mcp-server/dist/index.js +6 -0
  111. package/node_modules/tiny-http-mcp-server/dist/load-oauth-verifier.d.ts +6 -0
  112. package/node_modules/tiny-http-mcp-server/dist/load-oauth-verifier.js +43 -0
  113. package/node_modules/tiny-http-mcp-server/dist/parse-body.d.ts +22 -0
  114. package/node_modules/tiny-http-mcp-server/dist/parse-body.js +150 -0
  115. package/node_modules/tiny-http-mcp-server/dist/server.d.ts +9 -0
  116. package/node_modules/tiny-http-mcp-server/dist/server.js +4 -0
  117. package/node_modules/tiny-http-mcp-server/dist/session.d.ts +18 -0
  118. package/node_modules/tiny-http-mcp-server/dist/session.js +37 -0
  119. package/node_modules/tiny-http-mcp-server/dist/sse.d.ts +11 -0
  120. package/node_modules/tiny-http-mcp-server/dist/sse.js +22 -0
  121. package/node_modules/tiny-http-mcp-server/dist/test-support.d.ts +10 -0
  122. package/node_modules/tiny-http-mcp-server/dist/test-support.js +398 -0
  123. package/node_modules/tiny-http-mcp-server/dist/testing.d.ts +59 -0
  124. package/node_modules/tiny-http-mcp-server/dist/testing.js +191 -0
  125. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/LICENSE +21 -0
  126. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/README.md +70 -0
  127. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/auth-store-session-store.d.ts +14 -0
  128. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/auth-store-session-store.js +169 -0
  129. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/authorization-state.d.ts +8 -0
  130. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/authorization-state.js +47 -0
  131. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.d.ts +3 -0
  132. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.js +627 -0
  133. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/loopback-authorization.d.ts +20 -0
  134. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/loopback-authorization.js +207 -0
  135. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/pkce.d.ts +2 -0
  136. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/pkce.js +7 -0
  137. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/token-endpoint.d.ts +40 -0
  138. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/token-endpoint.js +164 -0
  139. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/types.d.ts +113 -0
  140. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/types.js +1 -0
  141. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/index.d.ts +10 -0
  142. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/index.js +7 -0
  143. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/resource-indicator.d.ts +1 -0
  144. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/resource-indicator.js +11 -0
  145. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/server/jwks-token-verifier.d.ts +32 -0
  146. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/server/jwks-token-verifier.js +388 -0
  147. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/types.compile-check.d.ts +1 -0
  148. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/types.compile-check.js +22 -0
  149. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/package.json +28 -0
  150. package/node_modules/tiny-http-mcp-server/package.json +59 -0
  151. package/node_modules/tiny-stdio-mcp-server/dist/composition.json +1 -1
  152. package/node_modules/toolcraft-schema/package.json +1 -1
  153. package/package.json +11 -4
package/composition.json CHANGED
@@ -61,11 +61,21 @@
61
61
  "version": "5.3.2",
62
62
  "license": "MIT"
63
63
  },
64
+ {
65
+ "name": "jose",
66
+ "version": "6.2.3",
67
+ "license": "MIT"
68
+ },
64
69
  {
65
70
  "name": "jsonc-parser",
66
71
  "version": "3.3.1",
67
72
  "license": "MIT"
68
73
  },
74
+ {
75
+ "name": "mcp-oauth",
76
+ "version": "0.0.1",
77
+ "license": "MIT"
78
+ },
69
79
  {
70
80
  "name": "sisteransi",
71
81
  "version": "1.0.5",
@@ -76,6 +86,11 @@
76
86
  "version": "1.6.1",
77
87
  "license": "BSD-3-Clause"
78
88
  },
89
+ {
90
+ "name": "tiny-http-mcp-server",
91
+ "version": "0.1.0",
92
+ "license": "MIT"
93
+ },
79
94
  {
80
95
  "name": "tiny-mcp-client",
81
96
  "version": "0.1.0",
@@ -88,7 +103,7 @@
88
103
  },
89
104
  {
90
105
  "name": "toolcraft",
91
- "version": "0.0.119",
106
+ "version": "0.0.121",
92
107
  "license": "MIT"
93
108
  },
94
109
  {
@@ -98,7 +113,7 @@
98
113
  },
99
114
  {
100
115
  "name": "toolcraft-schema",
101
- "version": "0.0.119",
116
+ "version": "0.0.121",
102
117
  "license": "MIT"
103
118
  },
104
119
  {
@@ -61,11 +61,21 @@
61
61
  "version": "5.3.2",
62
62
  "license": "MIT"
63
63
  },
64
+ {
65
+ "name": "jose",
66
+ "version": "6.2.3",
67
+ "license": "MIT"
68
+ },
64
69
  {
65
70
  "name": "jsonc-parser",
66
71
  "version": "3.3.1",
67
72
  "license": "MIT"
68
73
  },
74
+ {
75
+ "name": "mcp-oauth",
76
+ "version": "0.0.1",
77
+ "license": "MIT"
78
+ },
69
79
  {
70
80
  "name": "sisteransi",
71
81
  "version": "1.0.5",
@@ -76,6 +86,11 @@
76
86
  "version": "1.6.1",
77
87
  "license": "BSD-3-Clause"
78
88
  },
89
+ {
90
+ "name": "tiny-http-mcp-server",
91
+ "version": "0.1.0",
92
+ "license": "MIT"
93
+ },
79
94
  {
80
95
  "name": "tiny-mcp-client",
81
96
  "version": "0.1.0",
@@ -88,7 +103,7 @@
88
103
  },
89
104
  {
90
105
  "name": "toolcraft",
91
- "version": "0.0.119",
106
+ "version": "0.0.121",
92
107
  "license": "MIT"
93
108
  },
94
109
  {
@@ -98,7 +113,7 @@
98
113
  },
99
114
  {
100
115
  "name": "toolcraft-schema",
101
- "version": "0.0.119",
116
+ "version": "0.0.121",
102
117
  "license": "MIT"
103
118
  },
104
119
  {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ import { S } from "toolcraft-schema";
2
+ import { defineCommand, defineGroup } from "./index.js";
3
+ import { createHTTPMCPServer, runHTTPMCP } from "./http.js";
4
+ const ignoredRoot = defineGroup({
5
+ name: "root",
6
+ children: [
7
+ defineCommand({
8
+ name: "whoami",
9
+ params: S.Object({}),
10
+ handler: async ({ requester }) => requester
11
+ })
12
+ ]
13
+ });
14
+ const ignoredOptions = {
15
+ name: "toolcraft-http-test",
16
+ version: "1.0.0",
17
+ hostname: "127.0.0.1",
18
+ port: 0,
19
+ path: "/mcp",
20
+ enableJsonResponse: true,
21
+ allowedHosts: ["127.0.0.1"],
22
+ allowedOrigins: ["https://example.com"],
23
+ maxRequestBytes: 1_000_000,
24
+ maxConcurrentToolCalls: 4,
25
+ requestTimeoutMs: 30_000,
26
+ requestServices(context) {
27
+ return { requester: context.auth?.subject ?? "anonymous" };
28
+ }
29
+ };
30
+ const ignoredServer = createHTTPMCPServer(ignoredRoot, ignoredOptions);
31
+ const ignoredHandle = runHTTPMCP(ignoredRoot, ignoredOptions);
package/dist/http.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import "./node-require-shim.js";
2
+ import { type HttpListenOptions, type HttpServer, type HttpServerHandle, type HttpToolContext, type HttpTransportOptions } from "tiny-http-mcp-server/server";
3
+ import type { Group } from "./index.js";
4
+ import { type RunMCPOptions } from "./mcp.js";
5
+ export type ToolcraftHTTPContext = HttpToolContext;
6
+ export type ToolcraftHTTPServer = HttpServer;
7
+ export type ToolcraftHTTPServerHandle = HttpServerHandle;
8
+ type HTTPTransportControls = Omit<HttpTransportOptions, "name" | "version" | "validateToolArguments">;
9
+ type HTTPListenControls = Omit<HttpListenOptions, "port" | "hostname" | "path">;
10
+ export interface RunHTTPMCPOptions<TServices extends object = Record<string, unknown>> extends RunMCPOptions<TServices>, HTTPTransportControls, HTTPListenControls {
11
+ hostname?: string;
12
+ port?: number;
13
+ path?: string;
14
+ requestServices?(context: ToolcraftHTTPContext): Partial<TServices> | Promise<Partial<TServices>>;
15
+ }
16
+ export declare function createHTTPMCPServer<TServices extends object = Record<string, unknown>>(roots: Group<TServices> | Group<TServices>[], options: RunHTTPMCPOptions<TServices>): Promise<ToolcraftHTTPServer>;
17
+ export declare function runHTTPMCP<TServices extends object = Record<string, unknown>>(roots: Group<TServices> | Group<TServices>[], options: RunHTTPMCPOptions<TServices>): Promise<ToolcraftHTTPServerHandle>;
18
+ export type { HttpListenOptions, HttpObservabilityEvent, HttpObservabilityOptions, RequestAuthInfo, Session, SessionStore, StreamableHttpTransportOptions, TinyHttpMcpServerOAuthOptions, TokenVerifier, VerifiedAccessToken } from "tiny-http-mcp-server/server";
19
+ export { createJwksTokenVerifier, TokenVerificationError } from "tiny-http-mcp-server/server";
package/dist/http.js ADDED
@@ -0,0 +1,62 @@
1
+ import "./node-require-shim.js";
2
+ import { createHttpServer } from "tiny-http-mcp-server/server";
3
+ import { createMCPServerForTransport } from "./mcp.js";
4
+ import { enableSourceMaps } from "./stack-trim.js";
5
+ function createTransportOptions(options, serverOptions) {
6
+ return {
7
+ ...serverOptions,
8
+ toolCallTimeoutMs: options.toolCallTimeoutMs,
9
+ sessionIdGenerator: options.sessionIdGenerator,
10
+ enableJsonResponse: options.enableJsonResponse,
11
+ allowedOrigins: options.allowedOrigins,
12
+ allowedHosts: options.allowedHosts,
13
+ maxRequestBytes: options.maxRequestBytes,
14
+ maxBatchSize: options.maxBatchSize,
15
+ maxSessions: options.maxSessions,
16
+ sessionTtlMs: options.sessionTtlMs,
17
+ maxStreamsPerSession: options.maxStreamsPerSession,
18
+ maxStreamBufferBytes: options.maxStreamBufferBytes,
19
+ maxSseEventHistory: options.maxSseEventHistory,
20
+ sseKeepAliveMs: options.sseKeepAliveMs,
21
+ maxConcurrentToolCalls: options.maxConcurrentToolCalls,
22
+ sessionStore: options.sessionStore,
23
+ requestIdGenerator: options.requestIdGenerator,
24
+ observability: options.observability,
25
+ trustedProxy: options.trustedProxy,
26
+ oauth: options.oauth
27
+ };
28
+ }
29
+ function createListenOptions(options) {
30
+ return {
31
+ hostname: options.hostname,
32
+ port: options.port,
33
+ path: options.path,
34
+ signal: options.signal,
35
+ requestTimeoutMs: options.requestTimeoutMs,
36
+ headersTimeoutMs: options.headersTimeoutMs,
37
+ keepAliveTimeoutMs: options.keepAliveTimeoutMs
38
+ };
39
+ }
40
+ export async function createHTTPMCPServer(roots, options) {
41
+ let server;
42
+ await createMCPServerForTransport(roots, options, {
43
+ createServer(serverOptions) {
44
+ server = createHttpServer(createTransportOptions(options, serverOptions));
45
+ return server;
46
+ },
47
+ getRequestContext() {
48
+ return server?.getRequestContext();
49
+ },
50
+ requestServices: options.requestServices
51
+ });
52
+ if (server === undefined) {
53
+ throw new Error("Toolcraft HTTP MCP server was not created.");
54
+ }
55
+ return server;
56
+ }
57
+ export async function runHTTPMCP(roots, options) {
58
+ enableSourceMaps();
59
+ const server = await createHTTPMCPServer(roots, options);
60
+ return server.listenHttp(createListenOptions(options));
61
+ }
62
+ export { createJwksTokenVerifier, TokenVerificationError } from "tiny-http-mcp-server/server";
package/dist/mcp.js CHANGED
@@ -714,7 +714,7 @@ function toToolError(error, reportPath) {
714
714
  }
715
715
  return new ToolError(JSON_RPC_ERROR_CODES.INTERNAL_ERROR, String(error));
716
716
  }
717
- function createResolvedMCPServer(root, options) {
717
+ function createResolvedMCPServer(root, options, runtime = {}) {
718
718
  const casing = options.casing ?? "snake";
719
719
  const services = (options.services ?? {});
720
720
  const runtimeOptions = options.humanInLoop ?? {};
@@ -723,19 +723,19 @@ function createResolvedMCPServer(root, options) {
723
723
  level: options.logLevel,
724
724
  logger: options.logger
725
725
  });
726
- const servicesWithBuiltIns = {
727
- ...services,
728
- runtimeOptions,
729
- root
730
- };
731
726
  validateServices(services);
732
727
  const tools = enumerateTools(root, casing, options.tools, options.omitRootToolNamePrefix ?? false);
733
728
  const version = resolveMCPVersion(options.version);
734
- const server = createServer({
729
+ const server = runtime.createServer?.({
735
730
  name: options.name,
736
731
  version,
737
732
  validateToolArguments: false
738
- });
733
+ }) ??
734
+ createServer({
735
+ name: options.name,
736
+ version,
737
+ validateToolArguments: false
738
+ });
739
739
  const streamTools = tools.filter((tool) => tool.command.stream !== undefined);
740
740
  const subscriptions = new Map();
741
741
  let nextSubscriptionId = 0;
@@ -760,8 +760,12 @@ function createResolvedMCPServer(root, options) {
760
760
  }
761
761
  const argumentsValue = isPlainObject(request?.arguments) ? request.arguments : {};
762
762
  const secrets = resolveCommandSecrets(tool.command, options.env);
763
+ const requestServices = await runtime.requestServices?.(runtime.getRequestContext?.());
763
764
  const baseContext = {
764
- ...servicesWithBuiltIns,
765
+ ...services,
766
+ ...requestServices,
767
+ runtimeOptions,
768
+ root,
765
769
  secrets,
766
770
  fetch: runtimeFetch,
767
771
  fs: createFs(options.fs),
@@ -850,13 +854,17 @@ function createResolvedMCPServer(root, options) {
850
854
  return { unsubscribed: true };
851
855
  });
852
856
  for (const tool of tools.filter((candidate) => candidate.command.stream === undefined)) {
853
- const handler = async (argumentsValue) => {
857
+ const handler = async (argumentsValue, transportContext) => {
854
858
  let params;
855
859
  let secrets;
856
860
  try {
857
861
  secrets = resolveCommandSecrets(tool.command, options.env);
862
+ const requestServices = await runtime.requestServices?.(transportContext);
858
863
  const baseContext = {
859
- ...servicesWithBuiltIns,
864
+ ...services,
865
+ ...requestServices,
866
+ runtimeOptions,
867
+ root,
860
868
  secrets,
861
869
  fetch: runtimeFetch,
862
870
  fs: createFs(options.fs),
@@ -958,6 +966,13 @@ export function createMCPServer(roots, options) {
958
966
  }
959
967
  return createDeferredMCPServer(root, options);
960
968
  }
969
+ /** @internal */
970
+ export async function createMCPServerForTransport(roots, options, runtime) {
971
+ const normalizedRoot = normalizeRoots(roots);
972
+ const root = options.approvals === true ? mergeApprovalsGroup(normalizedRoot) : normalizedRoot;
973
+ await resolveMcpProxies(root, { projectRoot: options.projectRoot });
974
+ createResolvedMCPServer(root, options, runtime);
975
+ }
961
976
  export async function runMCP(roots, options) {
962
977
  enableSourceMaps();
963
978
  const normalizedRoot = normalizeRoots(roots);
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Filip Skokan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,153 @@
1
+ # jose
2
+
3
+ `jose` is a JavaScript module for JSON Object Signing and Encryption, providing support for JSON Web Tokens (JWT), JSON Web Signature (JWS), JSON Web Encryption (JWE), JSON Web Key (JWK), JSON Web Key Set (JWKS), and more. The module is designed to work across various Web-interoperable runtimes including Node.js, browsers, Cloudflare Workers, Deno, Bun, and others.
4
+
5
+ ## Sponsor
6
+
7
+ <picture>
8
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/panva/jose/HEAD/sponsor/Auth0byOkta_dark.png">
9
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/panva/jose/HEAD/sponsor/Auth0byOkta_light.png">
10
+ <img height="65" align="left" alt="Auth0 by Okta" src="https://raw.githubusercontent.com/panva/jose/HEAD/sponsor/Auth0byOkta_light.png">
11
+ </picture>
12
+
13
+ If you want to quickly add JWT authentication to JavaScript apps, feel free to check out Auth0's JavaScript SDK and free plan. [Create an Auth0 account; it's free!][sponsor-auth0]<br><br>
14
+
15
+ ## [💗 Help the project](https://github.com/sponsors/panva)
16
+
17
+ Support from the community to continue maintaining and improving this module is welcome. If you find the module useful, please consider supporting the project by [becoming a sponsor](https://github.com/sponsors/panva).
18
+
19
+ ## Dependencies: 0
20
+
21
+ `jose` has no dependencies and it exports tree-shakeable ESM[^cjs].
22
+
23
+ ## Documentation
24
+
25
+ `jose` is distributed via [npmjs.com](https://www.npmjs.com/package/jose), [jsr.io](https://jsr.io/@panva/jose), [jsdelivr.com](https://www.jsdelivr.com/package/npm/jose), and [github.com](https://github.com/panva/jose).
26
+
27
+ **`example`** ESM import[^cjs]
28
+
29
+ ```js
30
+ import * as jose from 'jose'
31
+ ```
32
+
33
+ ### JSON Web Tokens (JWT)
34
+
35
+ The `jose` module supports JSON Web Tokens (JWT) and provides functionality for signing and verifying tokens, as well as their JWT Claims Set validation.
36
+
37
+ - [JWT Claims Set Validation & Signature Verification](docs/jwt/verify/functions/jwtVerify.md) using the `jwtVerify` function
38
+ - [Using a remote JSON Web Key Set (JWKS)](docs/jwks/remote/functions/createRemoteJWKSet.md)
39
+ - [Using a local JSON Web Key Set (JWKS)](docs/jwks/local/functions/createLocalJWKSet.md)
40
+ - [Signing](docs/jwt/sign/classes/SignJWT.md) using the `SignJWT` class
41
+ - Utility functions
42
+ - [Decoding Token's Protected Header](docs/util/decode_protected_header/functions/decodeProtectedHeader.md)
43
+ - [Decoding JWT Claims Set](docs/util/decode_jwt/functions/decodeJwt.md) prior to its validation
44
+
45
+ ### Encrypted JSON Web Tokens
46
+
47
+ The `jose` module supports encrypted JSON Web Tokens and provides functionality for encrypting and decrypting tokens, as well as their JWT Claims Set validation.
48
+
49
+ - [Decryption & JWT Claims Set Validation](docs/jwt/decrypt/functions/jwtDecrypt.md) using the `jwtDecrypt` function
50
+ - [Encryption](docs/jwt/encrypt/classes/EncryptJWT.md) using the `EncryptJWT` class
51
+ - Utility functions
52
+ - [Decoding Token's Protected Header](docs/util/decode_protected_header/functions/decodeProtectedHeader.md)
53
+
54
+ ### Key Utilities
55
+
56
+ The `jose` module supports importing, exporting, and generating keys and secrets in various formats, including PEM formats like SPKI, X.509 certificate, and PKCS #8, as well as JSON Web Key (JWK).
57
+
58
+ - Key Import Functions
59
+ - [JWK Import](docs/key/import/functions/importJWK.md)
60
+ - [Public Key Import (SPKI)](docs/key/import/functions/importSPKI.md)
61
+ - [Public Key Import (X.509 Certificate)](docs/key/import/functions/importX509.md)
62
+ - [Private Key Import (PKCS #8)](docs/key/import/functions/importPKCS8.md)
63
+ - Key and Secret Generation Functions
64
+ - [Asymmetric Key Pair Generation](docs/key/generate_key_pair/functions/generateKeyPair.md)
65
+ - [Symmetric Secret Generation](docs/key/generate_secret/functions/generateSecret.md)
66
+ - Key Export Functions
67
+ - [JWK Export](docs/key/export/functions/exportJWK.md)
68
+ - [Private Key Export](docs/key/export/functions/exportPKCS8.md)
69
+ - [Public Key Export](docs/key/export/functions/exportSPKI.md)
70
+
71
+ ### JSON Web Signature (JWS)
72
+
73
+ The `jose` module supports signing and verification of JWS messages with arbitrary payloads in Compact, Flattened JSON, and General JSON serialization syntaxes.
74
+
75
+ - Signing - [Compact](docs/jws/compact/sign/classes/CompactSign.md), [Flattened JSON](docs/jws/flattened/sign/classes/FlattenedSign.md), [General JSON](docs/jws/general/sign/classes/GeneralSign.md)
76
+ - Verification - [Compact](docs/jws/compact/verify/functions/compactVerify.md), [Flattened JSON](docs/jws/flattened/verify/functions/flattenedVerify.md), [General JSON](docs/jws/general/verify/functions/generalVerify.md)
77
+ - [Using a remote JSON Web Key Set (JWKS)](docs/jwks/remote/functions/createRemoteJWKSet.md)
78
+ - [Using a local JSON Web Key Set (JWKS)](docs/jwks/local/functions/createLocalJWKSet.md)
79
+ - Utility functions
80
+ - [Decoding Token's Protected Header](docs/util/decode_protected_header/functions/decodeProtectedHeader.md)
81
+
82
+ ### JSON Web Encryption (JWE)
83
+
84
+ The `jose` module supports encryption and decryption of JWE messages with arbitrary plaintext in Compact, Flattened JSON, and General JSON serialization syntaxes.
85
+
86
+ - Encryption - [Compact](docs/jwe/compact/encrypt/classes/CompactEncrypt.md), [Flattened JSON](docs/jwe/flattened/encrypt/classes/FlattenedEncrypt.md), [General JSON](docs/jwe/general/encrypt/classes/GeneralEncrypt.md)
87
+ - Decryption - [Compact](docs/jwe/compact/decrypt/functions/compactDecrypt.md), [Flattened JSON](docs/jwe/flattened/decrypt/functions/flattenedDecrypt.md), [General JSON](docs/jwe/general/decrypt/functions/generalDecrypt.md)
88
+ - Utility functions
89
+ - [Decoding Token's Protected Header](docs/util/decode_protected_header/functions/decodeProtectedHeader.md)
90
+
91
+ ### Other
92
+
93
+ The following are additional features and utilities provided by the `jose` module:
94
+
95
+ - [Calculating JWK Thumbprint](docs/jwk/thumbprint/functions/calculateJwkThumbprint.md)
96
+ - [Calculating JWK Thumbprint URI](docs/jwk/thumbprint/functions/calculateJwkThumbprintUri.md)
97
+ - [Verification using a JWK Embedded in a JWS Header](docs/jwk/embedded/functions/EmbeddedJWK.md)
98
+ - [Unsecured JWT](docs/jwt/unsecured/classes/UnsecuredJWT.md)
99
+ - [JOSE Errors](docs/util/errors/README.md)
100
+
101
+ ## Supported Runtimes
102
+
103
+ The `jose` module is compatible with JavaScript runtimes that support the utilized Web API globals and standard built-in objects or are Node.js.
104
+
105
+ The following runtimes are supported _(this is not an exhaustive list)_:
106
+
107
+ - [Bun](https://github.com/panva/jose/issues/471)
108
+ - [Browsers](https://github.com/panva/jose/issues/263)
109
+ - [Cloudflare Workers](https://github.com/panva/jose/issues/265)
110
+ - [Deno](https://github.com/panva/jose/issues/266)
111
+ - [Electron](https://github.com/panva/jose/issues/264)
112
+ - [Node.js](https://github.com/panva/jose/issues/262)
113
+
114
+ Please note that certain algorithms may not be available depending on the runtime used. You can find a list of available algorithms for each runtime in the specific issue links provided above.
115
+
116
+ ## Supported Versions
117
+
118
+ | Version | Security Fixes 🔑 | Other Bug Fixes 🐞 | New Features ⭐ | Runtime and Module type |
119
+ | ----------------------------------------------- | ----------------- | ------------------ | --------------- | ------------------------------- |
120
+ | [v6.x](https://github.com/panva/jose/tree/v6.x) | [Security Policy] | ✅ | ✅ | Universal[^universal] ESM[^cjs] |
121
+ | [v5.x](https://github.com/panva/jose/tree/v5.x) | [Security Policy] | ❌ | ❌ | Universal[^universal] CJS + ESM |
122
+ | [v4.x](https://github.com/panva/jose/tree/v4.x) | [Security Policy] | ❌ | ❌ | Universal[^universal] CJS + ESM |
123
+ | [v2.x](https://github.com/panva/jose/tree/v2.x) | [Security Policy] | ❌ | ❌ | Node.js CJS |
124
+
125
+ ## Specifications
126
+
127
+ <details>
128
+ <summary>Details</summary>
129
+
130
+ - JSON Web Signature (JWS) - [RFC7515](https://www.rfc-editor.org/rfc/rfc7515)
131
+ - JSON Web Encryption (JWE) - [RFC7516](https://www.rfc-editor.org/rfc/rfc7516)
132
+ - JSON Web Key (JWK) - [RFC7517](https://www.rfc-editor.org/rfc/rfc7517)
133
+ - JSON Web Algorithms (JWA) - [RFC7518](https://www.rfc-editor.org/rfc/rfc7518)
134
+ - JSON Web Token (JWT) - [RFC7519](https://www.rfc-editor.org/rfc/rfc7519)
135
+ - JSON Web Key Thumbprint - [RFC7638](https://www.rfc-editor.org/rfc/rfc7638)
136
+ - JSON Web Key Thumbprint URI - [RFC9278](https://www.rfc-editor.org/rfc/rfc9278)
137
+ - JWS Unencoded Payload Option - [RFC7797](https://www.rfc-editor.org/rfc/rfc7797)
138
+ - CFRG Elliptic Curve ECDH and Signatures - [RFC8037](https://www.rfc-editor.org/rfc/rfc8037)
139
+ - Fully-Specified Algorithms for JOSE - [RFC9864](https://www.rfc-editor.org/rfc/rfc9864.html)
140
+ - ML-DSA for JOSE - [draft-ietf-cose-dilithium-10](https://www.ietf.org/archive/id/draft-ietf-cose-dilithium-10.html)
141
+
142
+ The algorithm implementations in `jose` have been tested using test vectors from their respective specifications as well as [RFC7520](https://www.rfc-editor.org/rfc/rfc7520).
143
+
144
+ </details>
145
+
146
+ [sponsor-auth0]: https://a0.to/signup/panva
147
+ [WebCryptoAPI]: https://w3c.github.io/webcrypto/
148
+ [Fetch API]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
149
+ [Security Policy]: https://github.com/panva/jose/security/policy
150
+
151
+ [^cjs]: CJS style `let jose = require('jose')` is possible in Node.js versions where the `require(esm)` feature is enabled by default (^20.19.0 || ^22.12.0 || >= 23.0.0).
152
+
153
+ [^universal]: Assumes runtime support of [WebCryptoAPI][] and [Fetch API][]
@@ -0,0 +1,55 @@
1
+ export { compactDecrypt } from './jwe/compact/decrypt.js';
2
+ export type { CompactDecryptGetKey } from './jwe/compact/decrypt.js';
3
+ export { flattenedDecrypt } from './jwe/flattened/decrypt.js';
4
+ export type { FlattenedDecryptGetKey } from './jwe/flattened/decrypt.js';
5
+ export { generalDecrypt } from './jwe/general/decrypt.js';
6
+ export type { GeneralDecryptGetKey } from './jwe/general/decrypt.js';
7
+ export { GeneralEncrypt } from './jwe/general/encrypt.js';
8
+ export type { Recipient } from './jwe/general/encrypt.js';
9
+ export { compactVerify } from './jws/compact/verify.js';
10
+ export type { CompactVerifyGetKey } from './jws/compact/verify.js';
11
+ export { flattenedVerify } from './jws/flattened/verify.js';
12
+ export type { FlattenedVerifyGetKey } from './jws/flattened/verify.js';
13
+ export { generalVerify } from './jws/general/verify.js';
14
+ export type { GeneralVerifyGetKey } from './jws/general/verify.js';
15
+ export { jwtVerify } from './jwt/verify.js';
16
+ export type { JWTVerifyOptions, JWTVerifyGetKey } from './jwt/verify.js';
17
+ export { jwtDecrypt } from './jwt/decrypt.js';
18
+ export type { JWTDecryptOptions, JWTDecryptGetKey } from './jwt/decrypt.js';
19
+ export { CompactEncrypt } from './jwe/compact/encrypt.js';
20
+ export { FlattenedEncrypt } from './jwe/flattened/encrypt.js';
21
+ export { CompactSign } from './jws/compact/sign.js';
22
+ export { FlattenedSign } from './jws/flattened/sign.js';
23
+ export { GeneralSign } from './jws/general/sign.js';
24
+ export type { Signature } from './jws/general/sign.js';
25
+ export { SignJWT } from './jwt/sign.js';
26
+ export { EncryptJWT } from './jwt/encrypt.js';
27
+ export { calculateJwkThumbprint, calculateJwkThumbprintUri } from './jwk/thumbprint.js';
28
+ export { EmbeddedJWK } from './jwk/embedded.js';
29
+ export { createLocalJWKSet } from './jwks/local.js';
30
+ export { createRemoteJWKSet, jwksCache, customFetch } from './jwks/remote.js';
31
+ export type { RemoteJWKSetOptions, JWKSCacheInput, ExportedJWKSCache, FetchImplementation, } from './jwks/remote.js';
32
+ export { UnsecuredJWT } from './jwt/unsecured.js';
33
+ export type { UnsecuredResult } from './jwt/unsecured.js';
34
+ export { exportPKCS8, exportSPKI, exportJWK } from './key/export.js';
35
+ export { importSPKI, importPKCS8, importX509, importJWK } from './key/import.js';
36
+ export type { KeyImportOptions } from './key/import.js';
37
+ export { decodeProtectedHeader } from './util/decode_protected_header.js';
38
+ export { decodeJwt } from './util/decode_jwt.js';
39
+ export type { ProtectedHeaderParameters } from './util/decode_protected_header.js';
40
+ import * as errors from './util/errors.js';
41
+ export { errors };
42
+ export { generateKeyPair } from './key/generate_key_pair.js';
43
+ export type { GenerateKeyPairResult, GenerateKeyPairOptions } from './key/generate_key_pair.js';
44
+ export { generateSecret } from './key/generate_secret.js';
45
+ export type { GenerateSecretOptions } from './key/generate_secret.js';
46
+ import * as base64url from './util/base64url.js';
47
+ export { base64url };
48
+ export type { CompactDecryptResult, CompactJWEHeaderParameters, CompactJWSHeaderParameters, CompactVerifyResult, CritOption, CryptoKey, DecryptOptions, EncryptOptions, FlattenedDecryptResult, FlattenedJWE, FlattenedJWS, FlattenedJWSInput, FlattenedVerifyResult, GeneralDecryptResult, GeneralJWE, GeneralJWS, GeneralJWSInput, GeneralVerifyResult, GetKeyFunction, JoseHeaderParameters, JSONWebKeySet, JWEHeaderParameters, JWEKeyManagementHeaderParameters, JWK_EC_Private, JWK_EC_Public, JWK_oct, JWK_OKP_Private, JWK_OKP_Public, JWK_RSA_Private, JWK_RSA_Public, JWK, JWKParameters, JWSHeaderParameters, JWTClaimVerificationOptions, JWTDecryptResult, JWTHeaderParameters, JWTPayload, JWTVerifyResult, KeyObject, ProduceJWT, ResolvedKey, SignOptions, VerifyOptions, } from './types.d.ts';
49
+ /**
50
+ * In prior releases this indicated whether a Node.js-specific build was loaded, this is now fixed
51
+ * to `"WebCryptoAPI"`
52
+ *
53
+ * @deprecated
54
+ */
55
+ export declare const cryptoRuntime = "WebCryptoAPI";
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Decrypting JSON Web Encryption (JWE) in Compact Serialization
3
+ *
4
+ * @module
5
+ */
6
+ import type * as types from '../../types.d.ts';
7
+ /**
8
+ * Interface for Compact JWE Decryption dynamic key resolution. No token components have been
9
+ * verified at the time of this function call.
10
+ */
11
+ export interface CompactDecryptGetKey extends types.GetKeyFunction<types.CompactJWEHeaderParameters, types.FlattenedJWE> {
12
+ }
13
+ /**
14
+ * Decrypts a Compact JWE.
15
+ *
16
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
17
+ * as from its subpath export `'jose/jwe/compact/decrypt'`.
18
+ *
19
+ * @param jwe Compact JWE.
20
+ * @param key Private Key or Secret to decrypt the JWE with. See
21
+ * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
22
+ * @param options JWE Decryption options.
23
+ */
24
+ export declare function compactDecrypt(jwe: string | Uint8Array, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.DecryptOptions): Promise<types.CompactDecryptResult>;
25
+ /**
26
+ * @param jwe Compact JWE.
27
+ * @param getKey Function resolving Private Key or Secret to decrypt the JWE with. See
28
+ * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
29
+ * @param options JWE Decryption options.
30
+ */
31
+ export declare function compactDecrypt(jwe: string | Uint8Array, getKey: CompactDecryptGetKey, options?: types.DecryptOptions): Promise<types.CompactDecryptResult & types.ResolvedKey>;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Encrypting JSON Web Encryption (JWE) in Compact Serialization
3
+ *
4
+ * @module
5
+ */
6
+ import type * as types from '../../types.d.ts';
7
+ /**
8
+ * The CompactEncrypt class is used to build and encrypt Compact JWE strings.
9
+ *
10
+ * This class is exported (as a named export) from the main `'jose'` module entry point as well as
11
+ * from its subpath export `'jose/jwe/compact/encrypt'`.
12
+ *
13
+ */
14
+ export declare class CompactEncrypt {
15
+ #private;
16
+ /**
17
+ * {@link CompactEncrypt} constructor
18
+ *
19
+ * @param plaintext Binary representation of the plaintext to encrypt.
20
+ */
21
+ constructor(plaintext: Uint8Array);
22
+ /**
23
+ * Sets a content encryption key to use, by default a random suitable one is generated for the JWE
24
+ * enc" (Encryption Algorithm) Header Parameter.
25
+ *
26
+ * @deprecated You should not use this method. It is only really intended for test and vector
27
+ * validation purposes.
28
+ *
29
+ * @param cek JWE Content Encryption Key.
30
+ */
31
+ setContentEncryptionKey(cek: Uint8Array): this;
32
+ /**
33
+ * Sets the JWE Initialization Vector to use for content encryption, by default a random suitable
34
+ * one is generated for the JWE enc" (Encryption Algorithm) Header Parameter.
35
+ *
36
+ * @deprecated You should not use this method. It is only really intended for test and vector
37
+ * validation purposes.
38
+ *
39
+ * @param iv JWE Initialization Vector.
40
+ */
41
+ setInitializationVector(iv: Uint8Array): this;
42
+ /**
43
+ * Sets the JWE Protected Header on the CompactEncrypt object.
44
+ *
45
+ * @param protectedHeader JWE Protected Header object.
46
+ */
47
+ setProtectedHeader(protectedHeader: types.CompactJWEHeaderParameters): this;
48
+ /**
49
+ * Sets the JWE Key Management parameters to be used when encrypting.
50
+ *
51
+ * (ECDH-ES) Use of this method is needed for ECDH based algorithms to set the "apu" (Agreement
52
+ * PartyUInfo) or "apv" (Agreement PartyVInfo) parameters.
53
+ *
54
+ * @param parameters JWE Key Management parameters.
55
+ */
56
+ setKeyManagementParameters(parameters: types.JWEKeyManagementHeaderParameters): this;
57
+ /**
58
+ * Encrypts and resolves the value of the Compact JWE string.
59
+ *
60
+ * @param key Public Key or Secret to encrypt the JWE with. See
61
+ * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
62
+ * @param options JWE Encryption options.
63
+ */
64
+ encrypt(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.EncryptOptions): Promise<string>;
65
+ }