@coro-ai/runner 0.1.34 → 0.1.36
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/dashboard-dist/assets/{index-C7l2FOsX.js → index-DVdRvXW2.js} +1 -1
- package/dashboard-dist/index.html +1 -1
- package/dist/src/clients/github.d.ts +21 -10
- package/dist/src/clients/github.js +48 -40
- package/dist/src/clients/github.js.map +1 -1
- package/dist/src/cloud/db/postgres-backend.js +21 -13
- package/dist/src/cloud/db/postgres-backend.js.map +1 -1
- package/dist/src/cloud/db/schema.d.ts +1 -1
- package/dist/src/intake/system-prompt.js +3 -0
- package/dist/src/intake/system-prompt.js.map +1 -1
- package/dist/src/jobs/phase-assignment.d.ts +42 -0
- package/dist/src/jobs/phase-assignment.js +46 -43
- package/dist/src/jobs/phase-assignment.js.map +1 -1
- package/dist/src/jobs/runner.js +63 -34
- package/dist/src/jobs/runner.js.map +1 -1
- package/dist/src/plugins/refs.d.ts +50 -1
- package/dist/src/plugins/refs.js +97 -1
- package/dist/src/plugins/refs.js.map +1 -1
- package/dist/src/plugins/registry.d.ts +6 -0
- package/dist/src/plugins/registry.js +11 -2
- package/dist/src/plugins/registry.js.map +1 -1
- package/dist/src/plugins/types.d.ts +1 -1
- package/dist/src/prompt/builder.d.ts +2 -1
- package/dist/src/prompt/builder.js +42 -1
- package/dist/src/prompt/builder.js.map +1 -1
- package/dist/src/runner/build-settings.js +16 -4
- package/dist/src/runner/build-settings.js.map +1 -1
- package/dist/src/state/polling-transport.d.ts +41 -12
- package/dist/src/state/polling-transport.js +95 -56
- package/dist/src/state/polling-transport.js.map +1 -1
- package/dist/src/state/sqlite-backend.js +19 -13
- package/dist/src/state/sqlite-backend.js.map +1 -1
- package/dist/src/tools/run-subagent.js +10 -5
- package/dist/src/tools/run-subagent.js.map +1 -1
- package/node_modules/@coro-ai/cloud-protocol/package.json +1 -1
- package/node_modules/@coro-ai/intelligence-base/layer/agents/coder.md +1 -1
- package/node_modules/@coro-ai/intelligence-base/layer/agents/planner.md +1 -1
- package/node_modules/@coro-ai/intelligence-base/package.json +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/credential-store.d.ts +58 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/credential-store.d.ts.map +1 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/credential-store.js +278 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/credential-store.js.map +1 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/executor.d.ts +12 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/executor.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/executor.js +67 -44
- package/node_modules/@coro-ai/llm-anthropic/dist/executor.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/http-routes.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/http-routes.js +4 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/http-routes.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/index.d.ts +2 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/index.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/index.js +6 -2
- package/node_modules/@coro-ai/llm-anthropic/dist/index.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/sandbox-probe.d.ts +11 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/sandbox-probe.d.ts.map +1 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/sandbox-probe.js +112 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/sandbox-probe.js.map +1 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/test-connection.d.ts +0 -26
- package/node_modules/@coro-ai/llm-anthropic/dist/test-connection.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/test-connection.js +40 -106
- package/node_modules/@coro-ai/llm-anthropic/dist/test-connection.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/package.json +1 -1
- package/node_modules/@coro-ai/llm-openai/dist/executor.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-openai/dist/executor.js +13 -10
- package/node_modules/@coro-ai/llm-openai/dist/executor.js.map +1 -1
- package/node_modules/@coro-ai/llm-openai/dist/models.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-openai/dist/models.js +3 -0
- package/node_modules/@coro-ai/llm-openai/dist/models.js.map +1 -1
- package/node_modules/@coro-ai/llm-openai/package.json +1 -1
- package/node_modules/@coro-ai/plugin-sdk/dist/chat-mcp.d.ts +10 -1
- package/node_modules/@coro-ai/plugin-sdk/dist/chat-mcp.d.ts.map +1 -1
- package/node_modules/@coro-ai/plugin-sdk/dist/chat-mcp.js +16 -2
- package/node_modules/@coro-ai/plugin-sdk/dist/chat-mcp.js.map +1 -1
- package/node_modules/@coro-ai/plugin-sdk/dist/helpers.d.ts +27 -1
- package/node_modules/@coro-ai/plugin-sdk/dist/helpers.d.ts.map +1 -1
- package/node_modules/@coro-ai/plugin-sdk/dist/helpers.js +47 -0
- package/node_modules/@coro-ai/plugin-sdk/dist/helpers.js.map +1 -1
- package/node_modules/@coro-ai/plugin-sdk/dist/types.d.ts +65 -4
- package/node_modules/@coro-ai/plugin-sdk/dist/types.d.ts.map +1 -1
- package/node_modules/@coro-ai/plugin-sdk/package.json +1 -1
- package/node_modules/@hono/node-server/README.md +104 -25
- package/node_modules/@hono/node-server/dist/conninfo.cjs +22 -0
- package/node_modules/@hono/node-server/dist/{conninfo.d.ts → conninfo.d.cts} +4 -3
- package/node_modules/@hono/node-server/dist/conninfo.d.mts +4 -3
- package/node_modules/@hono/node-server/dist/conninfo.mjs +19 -16
- package/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs +5 -0
- package/node_modules/@hono/node-server/dist/constants-BXAKTxRC.cjs +11 -0
- package/node_modules/@hono/node-server/dist/early-hints.cjs +35 -0
- package/node_modules/@hono/node-server/dist/early-hints.d.cts +16 -0
- package/node_modules/@hono/node-server/dist/early-hints.d.mts +16 -0
- package/node_modules/@hono/node-server/dist/early-hints.mjs +33 -0
- package/node_modules/@hono/node-server/dist/index.cjs +1176 -0
- package/node_modules/@hono/node-server/dist/index.d.cts +101 -0
- package/node_modules/@hono/node-server/dist/index.d.mts +101 -8
- package/node_modules/@hono/node-server/dist/index.mjs +1146 -637
- package/node_modules/@hono/node-server/dist/serve-static.cjs +151 -0
- package/node_modules/@hono/node-server/dist/serve-static.d.cts +18 -0
- package/node_modules/@hono/node-server/dist/serve-static.d.mts +14 -13
- package/node_modules/@hono/node-server/dist/serve-static.mjs +143 -145
- package/node_modules/@hono/node-server/dist/utils/response.cjs +8 -0
- package/node_modules/@hono/node-server/dist/utils/response.d.cts +4 -0
- package/node_modules/@hono/node-server/dist/utils/response.d.mts +3 -2
- package/node_modules/@hono/node-server/dist/utils/response.mjs +6 -9
- package/node_modules/@hono/node-server/dist/utils/stream.cjs +65 -0
- package/node_modules/@hono/node-server/dist/utils/stream.d.cts +6 -0
- package/node_modules/@hono/node-server/dist/utils/stream.d.mts +6 -0
- package/node_modules/@hono/node-server/dist/utils/stream.mjs +64 -0
- package/node_modules/@hono/node-server/package.json +78 -54
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.js +1 -12
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.d.ts +7 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.js +9 -3
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.js +5 -3
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.js +1 -12
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.d.ts +5 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.d.ts.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.js +17 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.d.ts +9 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.js +10 -4
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.d.ts +21 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.js +239 -41
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js +25 -6
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.d.ts +32 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.d.ts.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.js +64 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.d.ts +5 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.js +10 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js +2 -13
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.d.ts +7 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js +9 -3
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js +5 -3
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +2 -13
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts +5 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js +13 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts +9 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js +10 -4
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts +21 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js +239 -41
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +25 -6
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts +32 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js +57 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts +5 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js +9 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/media-typer/README.md +15 -14
- package/node_modules/@modelcontextprotocol/sdk/node_modules/media-typer/index.js +0 -8
- package/node_modules/@modelcontextprotocol/sdk/node_modules/media-typer/package.json +16 -12
- package/node_modules/@modelcontextprotocol/sdk/package.json +4 -3
- package/node_modules/express-rate-limit/dist/index.cjs +6 -1
- package/node_modules/express-rate-limit/dist/index.d.cts +10 -12
- package/node_modules/express-rate-limit/dist/index.d.mts +10 -12
- package/node_modules/express-rate-limit/dist/index.d.ts +10 -12
- package/node_modules/express-rate-limit/dist/index.mjs +6 -1
- package/node_modules/express-rate-limit/package.json +8 -8
- package/node_modules/express-rate-limit/readme.md +2 -2
- package/node_modules/fast-uri/index.js +54 -1
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/security.test.js +198 -0
- package/node_modules/hono/dist/cjs/context.js +28 -13
- package/node_modules/hono/dist/cjs/helper/proxy/index.js +4 -0
- package/node_modules/hono/dist/cjs/helper/streaming/sse.js +5 -4
- package/node_modules/hono/dist/cjs/hono-base.js +3 -2
- package/node_modules/hono/dist/cjs/jsx/base.js +27 -23
- package/node_modules/hono/dist/cjs/jsx/hooks/index.js +16 -13
- package/node_modules/hono/dist/cjs/middleware/cache/index.js +103 -8
- package/node_modules/hono/dist/cjs/middleware/compress/index.js +5 -0
- package/node_modules/hono/dist/cjs/middleware/cors/index.js +2 -2
- package/node_modules/hono/dist/cjs/middleware/etag/index.js +4 -1
- package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +9 -4
- package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +9 -4
- package/node_modules/hono/dist/cjs/middleware/language/language.js +10 -6
- package/node_modules/hono/dist/cjs/middleware/method-not-allowed/index.js +90 -0
- package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +10 -4
- package/node_modules/hono/dist/cjs/request.js +14 -11
- package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +55 -56
- package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +64 -85
- package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +13 -5
- package/node_modules/hono/dist/cjs/router/trie-router/node.js +1 -1
- package/node_modules/hono/dist/cjs/router.js +1 -1
- package/node_modules/hono/dist/cjs/utils/accept.js +1 -1
- package/node_modules/hono/dist/cjs/utils/body.js +6 -0
- package/node_modules/hono/dist/cjs/utils/cookie.js +3 -2
- package/node_modules/hono/dist/cjs/utils/stream.js +5 -2
- package/node_modules/hono/dist/cjs/utils/url.js +8 -8
- package/node_modules/hono/dist/context.js +28 -13
- package/node_modules/hono/dist/helper/proxy/index.js +4 -0
- package/node_modules/hono/dist/helper/streaming/sse.js +5 -4
- package/node_modules/hono/dist/hono-base.js +3 -2
- package/node_modules/hono/dist/jsx/base.js +27 -23
- package/node_modules/hono/dist/jsx/hooks/index.js +16 -13
- package/node_modules/hono/dist/middleware/cache/index.js +103 -8
- package/node_modules/hono/dist/middleware/compress/index.js +5 -0
- package/node_modules/hono/dist/middleware/cors/index.js +2 -2
- package/node_modules/hono/dist/middleware/etag/index.js +4 -1
- package/node_modules/hono/dist/middleware/jwk/jwk.js +9 -4
- package/node_modules/hono/dist/middleware/jwt/jwt.js +9 -4
- package/node_modules/hono/dist/middleware/language/language.js +10 -6
- package/node_modules/hono/dist/middleware/method-not-allowed/index.js +68 -0
- package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +10 -4
- package/node_modules/hono/dist/request.js +15 -12
- package/node_modules/hono/dist/router/reg-exp-router/node.js +55 -56
- package/node_modules/hono/dist/router/reg-exp-router/router.js +64 -85
- package/node_modules/hono/dist/router/reg-exp-router/trie.js +13 -5
- package/node_modules/hono/dist/router/trie-router/node.js +1 -1
- package/node_modules/hono/dist/router.js +1 -1
- package/node_modules/hono/dist/types/adapter/aws-lambda/types.d.ts +9 -0
- package/node_modules/hono/dist/types/client/types.d.ts +1 -1
- package/node_modules/hono/dist/types/hono-base.d.ts +4 -3
- package/node_modules/hono/dist/types/jsx/base.d.ts +4 -2
- package/node_modules/hono/dist/types/jsx/dom/index.d.ts +5 -5
- package/node_modules/hono/dist/types/jsx/dom/intrinsic-element/components.d.ts +2 -2
- package/node_modules/hono/dist/types/jsx/dom/server.d.ts +5 -5
- package/node_modules/hono/dist/types/jsx/hooks/index.d.ts +8 -6
- package/node_modules/hono/dist/types/jsx/index.d.ts +5 -5
- package/node_modules/hono/dist/types/middleware/cache/index.d.ts +6 -4
- package/node_modules/hono/dist/types/middleware/combine/index.d.ts +1 -1
- package/node_modules/hono/dist/types/middleware/cors/index.d.ts +1 -1
- package/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +2 -2
- package/node_modules/hono/dist/types/middleware/jwk/jwk.d.ts +2 -0
- package/node_modules/hono/dist/types/middleware/jwt/jwt.d.ts +2 -0
- package/node_modules/hono/dist/types/middleware/method-not-allowed/index.d.ts +49 -0
- package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +1 -1
- package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +2 -1
- package/node_modules/hono/dist/types/router.d.ts +1 -1
- package/node_modules/hono/dist/types/utils/headers.d.ts +2 -2
- package/node_modules/hono/dist/types/utils/url.d.ts +1 -0
- package/node_modules/hono/dist/utils/accept.js +1 -1
- package/node_modules/hono/dist/utils/body.js +6 -0
- package/node_modules/hono/dist/utils/cookie.js +4 -3
- package/node_modules/hono/dist/utils/stream.js +5 -2
- package/node_modules/hono/dist/utils/url.js +6 -7
- package/node_modules/hono/package.json +10 -3
- package/node_modules/ip-address/README.md +146 -126
- package/node_modules/ip-address/dist/common.d.ts +29 -0
- package/node_modules/ip-address/dist/common.js +44 -5
- package/node_modules/ip-address/dist/common.js.map +1 -1
- package/node_modules/ip-address/dist/ipv4.d.ts +8 -1
- package/node_modules/ip-address/dist/ipv4.js +24 -20
- package/node_modules/ip-address/dist/ipv4.js.map +1 -1
- package/node_modules/ip-address/dist/ipv6.d.ts +68 -3
- package/node_modules/ip-address/dist/ipv6.js +180 -53
- package/node_modules/ip-address/dist/ipv6.js.map +1 -1
- package/node_modules/ip-address/dist/v4/constants.js +5 -1
- package/node_modules/ip-address/dist/v4/constants.js.map +1 -1
- package/node_modules/ip-address/dist/v6/constants.js +3 -2
- package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
- package/node_modules/ip-address/package.json +6 -4
- package/node_modules/jose/README.md +13 -16
- package/node_modules/jose/dist/types/index.d.ts +6 -5
- package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +17 -11
- package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +7 -19
- package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +17 -11
- package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +7 -19
- package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +18 -13
- package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +20 -21
- package/node_modules/jose/dist/types/jwk/embedded.d.ts +8 -12
- package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +0 -15
- package/node_modules/jose/dist/types/jwks/local.d.ts +12 -21
- package/node_modules/jose/dist/types/jwks/remote.d.ts +34 -165
- package/node_modules/jose/dist/types/jws/compact/sign.d.ts +2 -13
- package/node_modules/jose/dist/types/jws/compact/verify.d.ts +17 -13
- package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +2 -13
- package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +17 -13
- package/node_modules/jose/dist/types/jws/general/sign.d.ts +16 -17
- package/node_modules/jose/dist/types/jws/general/verify.d.ts +18 -15
- package/node_modules/jose/dist/types/jwt/decrypt.d.ts +17 -11
- package/node_modules/jose/dist/types/jwt/encrypt.d.ts +10 -34
- package/node_modules/jose/dist/types/jwt/sign.d.ts +2 -13
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +4 -13
- package/node_modules/jose/dist/types/jwt/verify.d.ts +14 -13
- package/node_modules/jose/dist/types/key/export.d.ts +0 -14
- package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +7 -14
- package/node_modules/jose/dist/types/key/generate_secret.d.ts +16 -14
- package/node_modules/jose/dist/types/key/import.d.ts +18 -28
- package/node_modules/jose/dist/types/types.d.ts +239 -222
- package/node_modules/jose/dist/types/util/base64url.d.ts +11 -4
- package/node_modules/jose/dist/types/util/decode_jwt.d.ts +1 -9
- package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +0 -8
- package/node_modules/jose/dist/types/util/errors.d.ts +128 -121
- package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +4 -22
- package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +5 -153
- package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +16 -111
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +23 -3
- package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +66 -82
- package/node_modules/jose/dist/webapi/jwk/embedded.js +5 -3
- package/node_modules/jose/dist/webapi/jwks/local.js +32 -73
- package/node_modules/jose/dist/webapi/jwks/remote.js +19 -28
- package/node_modules/jose/dist/webapi/jws/compact/sign.js +5 -2
- package/node_modules/jose/dist/webapi/jws/compact/verify.js +4 -16
- package/node_modules/jose/dist/webapi/jws/flattened/sign.js +7 -65
- package/node_modules/jose/dist/webapi/jws/flattened/verify.js +3 -89
- package/node_modules/jose/dist/webapi/jws/general/sign.js +19 -15
- package/node_modules/jose/dist/webapi/jws/general/verify.js +29 -9
- package/node_modules/jose/dist/webapi/jwt/decrypt.js +5 -5
- package/node_modules/jose/dist/webapi/jwt/sign.js +2 -3
- package/node_modules/jose/dist/webapi/jwt/unsecured.js +4 -3
- package/node_modules/jose/dist/webapi/jwt/verify.js +6 -6
- package/node_modules/jose/dist/webapi/key/export.js +37 -4
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +33 -82
- package/node_modules/jose/dist/webapi/key/generate_secret.js +2 -2
- package/node_modules/jose/dist/webapi/key/import.js +8 -8
- package/node_modules/jose/dist/webapi/lib/asn1.js +53 -122
- package/node_modules/jose/dist/webapi/lib/buffer_utils.js +1 -0
- package/node_modules/jose/dist/webapi/lib/content_encryption.js +34 -109
- package/node_modules/jose/dist/webapi/lib/crypto_key.js +18 -126
- package/node_modules/jose/dist/webapi/lib/helpers.js +23 -0
- package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +0 -1
- package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +107 -0
- package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +186 -0
- package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +110 -0
- package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +8 -98
- package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +73 -0
- package/node_modules/jose/dist/webapi/lib/jws_sign.js +74 -0
- package/node_modules/jose/dist/webapi/lib/jws_verify.js +107 -0
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +68 -109
- package/node_modules/jose/dist/webapi/lib/key.js +132 -0
- package/node_modules/jose/dist/webapi/lib/key_algorithm.js +10 -0
- package/node_modules/jose/dist/webapi/lib/key_descriptor.js +7 -0
- package/node_modules/jose/dist/webapi/lib/key_management.js +162 -92
- package/node_modules/jose/dist/webapi/lib/options.js +48 -0
- package/node_modules/jose/dist/webapi/lib/signing.js +14 -56
- package/node_modules/jose/dist/webapi/lib/type_checks.js +13 -18
- package/node_modules/jose/dist/webapi/util/base64url.js +13 -4
- package/node_modules/jose/dist/webapi/util/decode_jwt.js +2 -2
- package/node_modules/jose/dist/webapi/util/decode_protected_header.js +5 -15
- package/node_modules/jose/dist/webapi/util/errors.js +1 -1
- package/node_modules/jose/package.json +2 -4
- package/node_modules/js-yaml/dist/js-yaml.js +5 -2
- package/node_modules/js-yaml/dist/js-yaml.js.map +1 -1
- package/node_modules/js-yaml/dist/js-yaml.min.js +1 -1
- package/node_modules/js-yaml/dist/js-yaml.min.js.map +1 -1
- package/node_modules/js-yaml/dist/js-yaml.mjs +3 -3
- package/node_modules/js-yaml/dist/js-yaml.mjs.map +1 -1
- package/node_modules/js-yaml/lib/type/omap.js +3 -3
- package/node_modules/js-yaml/package.json +1 -1
- package/node_modules/openai/CHANGELOG.md +32 -0
- package/node_modules/openai/azure.d.mts.map +1 -1
- package/node_modules/openai/azure.d.ts.map +1 -1
- package/node_modules/openai/azure.js +5 -1
- package/node_modules/openai/azure.js.map +1 -1
- package/node_modules/openai/azure.mjs +5 -1
- package/node_modules/openai/azure.mjs.map +1 -1
- package/node_modules/openai/helpers/standard-schema.d.mts +104 -0
- package/node_modules/openai/helpers/standard-schema.d.mts.map +1 -0
- package/node_modules/openai/helpers/standard-schema.d.ts +104 -0
- package/node_modules/openai/helpers/standard-schema.d.ts.map +1 -0
- package/node_modules/openai/helpers/standard-schema.js +320 -0
- package/node_modules/openai/helpers/standard-schema.js.map +1 -0
- package/node_modules/openai/helpers/standard-schema.mjs +314 -0
- package/node_modules/openai/helpers/standard-schema.mjs.map +1 -0
- package/node_modules/openai/helpers/zod.d.mts +26 -3
- package/node_modules/openai/helpers/zod.d.mts.map +1 -1
- package/node_modules/openai/helpers/zod.d.ts +26 -3
- package/node_modules/openai/helpers/zod.d.ts.map +1 -1
- package/node_modules/openai/helpers/zod.js +97 -7
- package/node_modules/openai/helpers/zod.js.map +1 -1
- package/node_modules/openai/helpers/zod.mjs +96 -7
- package/node_modules/openai/helpers/zod.mjs.map +1 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.d.mts.map +1 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.d.ts.map +1 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.js +43 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.js.map +1 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.mjs +43 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.mjs.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStream.d.mts +2 -1
- package/node_modules/openai/lib/ChatCompletionStream.d.mts.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStream.d.ts +2 -1
- package/node_modules/openai/lib/ChatCompletionStream.d.ts.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStream.js +53 -14
- package/node_modules/openai/lib/ChatCompletionStream.js.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStream.mjs +53 -14
- package/node_modules/openai/lib/ChatCompletionStream.mjs.map +1 -1
- package/node_modules/openai/lib/ResponsesParser.d.mts.map +1 -1
- package/node_modules/openai/lib/ResponsesParser.d.ts.map +1 -1
- package/node_modules/openai/lib/ResponsesParser.js +3 -5
- package/node_modules/openai/lib/ResponsesParser.js.map +1 -1
- package/node_modules/openai/lib/ResponsesParser.mjs +3 -5
- package/node_modules/openai/lib/ResponsesParser.mjs.map +1 -1
- package/node_modules/openai/lib/jsonschema.d.mts +3 -0
- package/node_modules/openai/lib/jsonschema.d.mts.map +1 -1
- package/node_modules/openai/lib/jsonschema.d.ts +3 -0
- package/node_modules/openai/lib/jsonschema.d.ts.map +1 -1
- package/node_modules/openai/lib/transform.d.mts +25 -1
- package/node_modules/openai/lib/transform.d.mts.map +1 -1
- package/node_modules/openai/lib/transform.d.ts +25 -1
- package/node_modules/openai/lib/transform.d.ts.map +1 -1
- package/node_modules/openai/lib/transform.js +1521 -82
- package/node_modules/openai/lib/transform.js.map +1 -1
- package/node_modules/openai/lib/transform.mjs +1515 -82
- package/node_modules/openai/lib/transform.mjs.map +1 -1
- package/node_modules/openai/package.json +1 -1
- package/node_modules/openai/resources/admin/organization/index.d.mts +1 -0
- package/node_modules/openai/resources/admin/organization/index.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/index.d.ts +1 -0
- package/node_modules/openai/resources/admin/organization/index.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/index.js +3 -1
- package/node_modules/openai/resources/admin/organization/index.js.map +1 -1
- package/node_modules/openai/resources/admin/organization/index.mjs +1 -0
- package/node_modules/openai/resources/admin/organization/index.mjs.map +1 -1
- package/node_modules/openai/resources/admin/organization/organization.d.mts +4 -0
- package/node_modules/openai/resources/admin/organization/organization.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/organization.d.ts +4 -0
- package/node_modules/openai/resources/admin/organization/organization.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/organization.js +4 -0
- package/node_modules/openai/resources/admin/organization/organization.js.map +1 -1
- package/node_modules/openai/resources/admin/organization/organization.mjs +4 -0
- package/node_modules/openai/resources/admin/organization/organization.mjs.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.d.mts +1 -0
- package/node_modules/openai/resources/admin/organization/projects/index.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.d.ts +1 -0
- package/node_modules/openai/resources/admin/organization/projects/index.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.js +3 -1
- package/node_modules/openai/resources/admin/organization/projects/index.js.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.mjs +1 -0
- package/node_modules/openai/resources/admin/organization/projects/index.mjs.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.d.mts +4 -0
- package/node_modules/openai/resources/admin/organization/projects/projects.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.d.ts +4 -0
- package/node_modules/openai/resources/admin/organization/projects/projects.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.js +4 -0
- package/node_modules/openai/resources/admin/organization/projects/projects.js.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.mjs +4 -0
- package/node_modules/openai/resources/admin/organization/projects/projects.mjs.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/spend-limit.d.mts +115 -0
- package/node_modules/openai/resources/admin/organization/projects/spend-limit.d.mts.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/spend-limit.d.ts +115 -0
- package/node_modules/openai/resources/admin/organization/projects/spend-limit.d.ts.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/spend-limit.js +67 -0
- package/node_modules/openai/resources/admin/organization/projects/spend-limit.js.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/spend-limit.mjs +63 -0
- package/node_modules/openai/resources/admin/organization/projects/spend-limit.mjs.map +1 -0
- package/node_modules/openai/resources/admin/organization/spend-limit.d.mts +108 -0
- package/node_modules/openai/resources/admin/organization/spend-limit.d.mts.map +1 -0
- package/node_modules/openai/resources/admin/organization/spend-limit.d.ts +108 -0
- package/node_modules/openai/resources/admin/organization/spend-limit.d.ts.map +1 -0
- package/node_modules/openai/resources/admin/organization/spend-limit.js +59 -0
- package/node_modules/openai/resources/admin/organization/spend-limit.js.map +1 -0
- package/node_modules/openai/resources/admin/organization/spend-limit.mjs +55 -0
- package/node_modules/openai/resources/admin/organization/spend-limit.mjs.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.d.mts +6 -2
- package/node_modules/openai/resources/beta/responses/input-tokens.d.mts.map +1 -1
- package/node_modules/openai/resources/beta/responses/input-tokens.d.ts +6 -2
- package/node_modules/openai/resources/beta/responses/input-tokens.d.ts.map +1 -1
- package/node_modules/openai/resources/beta/responses/responses.d.mts +21 -11
- package/node_modules/openai/resources/beta/responses/responses.d.mts.map +1 -1
- package/node_modules/openai/resources/beta/responses/responses.d.ts +21 -11
- package/node_modules/openai/resources/beta/responses/responses.d.ts.map +1 -1
- package/node_modules/openai/resources/beta/responses/responses.js.map +1 -1
- package/node_modules/openai/resources/beta/responses/responses.mjs.map +1 -1
- package/node_modules/openai/resources/chat/completions/completions.d.mts +4 -3
- package/node_modules/openai/resources/chat/completions/completions.d.mts.map +1 -1
- package/node_modules/openai/resources/chat/completions/completions.d.ts +4 -3
- package/node_modules/openai/resources/chat/completions/completions.d.ts.map +1 -1
- package/node_modules/openai/resources/chat/completions/completions.js.map +1 -1
- package/node_modules/openai/resources/chat/completions/completions.mjs.map +1 -1
- package/node_modules/openai/resources/responses/input-tokens.d.mts +2 -1
- package/node_modules/openai/resources/responses/input-tokens.d.mts.map +1 -1
- package/node_modules/openai/resources/responses/input-tokens.d.ts +2 -1
- package/node_modules/openai/resources/responses/input-tokens.d.ts.map +1 -1
- package/node_modules/openai/resources/responses/responses.d.mts +9 -8
- package/node_modules/openai/resources/responses/responses.d.mts.map +1 -1
- package/node_modules/openai/resources/responses/responses.d.ts +9 -8
- package/node_modules/openai/resources/responses/responses.d.ts.map +1 -1
- package/node_modules/openai/resources/responses/responses.js.map +1 -1
- package/node_modules/openai/resources/responses/responses.mjs.map +1 -1
- package/node_modules/openai/resources/shared.d.mts +4 -1
- package/node_modules/openai/resources/shared.d.mts.map +1 -1
- package/node_modules/openai/resources/shared.d.ts +4 -1
- package/node_modules/openai/resources/shared.d.ts.map +1 -1
- package/node_modules/openai/src/azure.ts +5 -1
- package/node_modules/openai/src/helpers/standard-schema.ts +570 -0
- package/node_modules/openai/src/helpers/zod.ts +158 -29
- package/node_modules/openai/src/lib/AbstractChatCompletionRunner.ts +43 -1
- package/node_modules/openai/src/lib/ChatCompletionStream.ts +56 -8
- package/node_modules/openai/src/lib/ResponsesParser.ts +7 -5
- package/node_modules/openai/src/lib/jsonschema.ts +3 -0
- package/node_modules/openai/src/lib/transform.ts +1930 -103
- package/node_modules/openai/src/resources/admin/organization/index.ts +6 -0
- package/node_modules/openai/src/resources/admin/organization/organization.ts +16 -0
- package/node_modules/openai/src/resources/admin/organization/projects/index.ts +6 -0
- package/node_modules/openai/src/resources/admin/organization/projects/projects.ts +16 -0
- package/node_modules/openai/src/resources/admin/organization/projects/spend-limit.ts +156 -0
- package/node_modules/openai/src/resources/admin/organization/spend-limit.ts +144 -0
- package/node_modules/openai/src/resources/beta/responses/input-tokens.ts +6 -2
- package/node_modules/openai/src/resources/beta/responses/responses.ts +21 -10
- package/node_modules/openai/src/resources/chat/completions/completions.ts +4 -3
- package/node_modules/openai/src/resources/responses/input-tokens.ts +2 -1
- package/node_modules/openai/src/resources/responses/responses.ts +9 -7
- package/node_modules/openai/src/resources/shared.ts +4 -1
- package/node_modules/openai/src/version.ts +1 -1
- package/node_modules/openai/version.d.mts +1 -1
- package/node_modules/openai/version.d.ts +1 -1
- package/node_modules/openai/version.js +1 -1
- package/node_modules/openai/version.mjs +1 -1
- package/node_modules/process-warning/LICENSE +1 -1
- package/node_modules/process-warning/README.md +41 -2
- package/node_modules/process-warning/index.js +85 -17
- package/node_modules/process-warning/package.json +6 -7
- package/node_modules/process-warning/test/emit-once-only.test.js +3 -3
- package/node_modules/process-warning/test/emit-reset.test.js +4 -4
- package/node_modules/process-warning/test/emit-unlimited.test.js +2 -2
- package/node_modules/process-warning/test/spy-warning.test.js +143 -0
- package/node_modules/process-warning/types/index.d.ts +15 -1
- package/node_modules/process-warning/types/index.tst.ts +48 -0
- package/node_modules/ws/package.json +1 -1
- package/package.json +6 -6
- package/node_modules/@hono/node-server/dist/conninfo.js +0 -42
- package/node_modules/@hono/node-server/dist/globals.d.mts +0 -2
- package/node_modules/@hono/node-server/dist/globals.d.ts +0 -2
- package/node_modules/@hono/node-server/dist/globals.js +0 -29
- package/node_modules/@hono/node-server/dist/globals.mjs +0 -5
- package/node_modules/@hono/node-server/dist/index.d.ts +0 -8
- package/node_modules/@hono/node-server/dist/index.js +0 -702
- package/node_modules/@hono/node-server/dist/listener.d.mts +0 -13
- package/node_modules/@hono/node-server/dist/listener.d.ts +0 -13
- package/node_modules/@hono/node-server/dist/listener.js +0 -670
- package/node_modules/@hono/node-server/dist/listener.mjs +0 -635
- package/node_modules/@hono/node-server/dist/request.d.mts +0 -25
- package/node_modules/@hono/node-server/dist/request.d.ts +0 -25
- package/node_modules/@hono/node-server/dist/request.js +0 -238
- package/node_modules/@hono/node-server/dist/request.mjs +0 -206
- package/node_modules/@hono/node-server/dist/response.d.mts +0 -26
- package/node_modules/@hono/node-server/dist/response.d.ts +0 -26
- package/node_modules/@hono/node-server/dist/response.js +0 -112
- package/node_modules/@hono/node-server/dist/response.mjs +0 -85
- package/node_modules/@hono/node-server/dist/serve-static.d.ts +0 -17
- package/node_modules/@hono/node-server/dist/serve-static.js +0 -177
- package/node_modules/@hono/node-server/dist/server.d.mts +0 -10
- package/node_modules/@hono/node-server/dist/server.d.ts +0 -10
- package/node_modules/@hono/node-server/dist/server.js +0 -696
- package/node_modules/@hono/node-server/dist/server.mjs +0 -660
- package/node_modules/@hono/node-server/dist/types.d.mts +0 -44
- package/node_modules/@hono/node-server/dist/types.d.ts +0 -44
- package/node_modules/@hono/node-server/dist/types.js +0 -18
- package/node_modules/@hono/node-server/dist/types.mjs +0 -0
- package/node_modules/@hono/node-server/dist/utils/response/constants.d.mts +0 -3
- package/node_modules/@hono/node-server/dist/utils/response/constants.d.ts +0 -3
- package/node_modules/@hono/node-server/dist/utils/response/constants.js +0 -30
- package/node_modules/@hono/node-server/dist/utils/response/constants.mjs +0 -5
- package/node_modules/@hono/node-server/dist/utils/response.d.ts +0 -3
- package/node_modules/@hono/node-server/dist/utils/response.js +0 -37
- package/node_modules/@hono/node-server/dist/utils.d.mts +0 -9
- package/node_modules/@hono/node-server/dist/utils.d.ts +0 -9
- package/node_modules/@hono/node-server/dist/utils.js +0 -99
- package/node_modules/@hono/node-server/dist/utils.mjs +0 -71
- package/node_modules/@hono/node-server/dist/vercel.d.mts +0 -7
- package/node_modules/@hono/node-server/dist/vercel.d.ts +0 -7
- package/node_modules/@hono/node-server/dist/vercel.js +0 -677
- package/node_modules/@hono/node-server/dist/vercel.mjs +0 -640
- package/node_modules/jose/dist/webapi/lib/aesgcmkw.js +0 -15
- package/node_modules/jose/dist/webapi/lib/aeskw.js +0 -25
- package/node_modules/jose/dist/webapi/lib/check_key_type.js +0 -122
- package/node_modules/jose/dist/webapi/lib/ecdhes.js +0 -52
- package/node_modules/jose/dist/webapi/lib/key_to_jwk.js +0 -31
- package/node_modules/jose/dist/webapi/lib/normalize_key.js +0 -166
- package/node_modules/jose/dist/webapi/lib/pbes2kw.js +0 -42
- package/node_modules/jose/dist/webapi/lib/rsaes.js +0 -24
- package/node_modules/jose/dist/webapi/lib/validate_algorithms.js +0 -10
- package/node_modules/jose/dist/webapi/lib/validate_crit.js +0 -33
- package/node_modules/process-warning/types/index.test-d.ts +0 -36
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import { encode as b64u } from '../../util/base64url.js';
|
|
2
1
|
import { unprotected, assertNotSet } from '../../lib/helpers.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { isDisjoint } from '../../lib/type_checks.js';
|
|
7
|
-
import { concat, encode } from '../../lib/buffer_utils.js';
|
|
8
|
-
import { validateCrit } from '../../lib/validate_crit.js';
|
|
9
|
-
import { normalizeKey } from '../../lib/normalize_key.js';
|
|
10
|
-
import { checkKeyType } from '../../lib/check_key_type.js';
|
|
11
|
-
import { compress } from '../../lib/deflate.js';
|
|
2
|
+
import { JWEInvalid } from '../../util/errors.js';
|
|
3
|
+
import { createJWE } from '../../lib/jwe_encrypt.js';
|
|
4
|
+
import { validateCritDuplicates } from '../../lib/options.js';
|
|
12
5
|
export class FlattenedEncrypt {
|
|
13
6
|
#plaintext;
|
|
14
7
|
#protectedHeader;
|
|
@@ -62,106 +55,18 @@ export class FlattenedEncrypt {
|
|
|
62
55
|
if (!this.#protectedHeader && !this.#unprotectedHeader && !this.#sharedUnprotectedHeader) {
|
|
63
56
|
throw new JWEInvalid('either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()');
|
|
64
57
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
throw new JWEInvalid('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');
|
|
79
|
-
}
|
|
80
|
-
const { alg, enc } = joseHeader;
|
|
81
|
-
if (typeof alg !== 'string' || !alg) {
|
|
82
|
-
throw new JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');
|
|
83
|
-
}
|
|
84
|
-
if (typeof enc !== 'string' || !enc) {
|
|
85
|
-
throw new JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');
|
|
86
|
-
}
|
|
87
|
-
let encryptedKey;
|
|
88
|
-
if (this.#cek && (alg === 'dir' || alg === 'ECDH-ES')) {
|
|
89
|
-
throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${alg}`);
|
|
90
|
-
}
|
|
91
|
-
checkKeyType(alg === 'dir' ? enc : alg, key, 'encrypt');
|
|
92
|
-
let cek;
|
|
93
|
-
{
|
|
94
|
-
let parameters;
|
|
95
|
-
const k = await normalizeKey(key, alg);
|
|
96
|
-
({ cek, encryptedKey, parameters } = await encryptKeyManagement(alg, enc, k, this.#cek, this.#keyManagementParameters));
|
|
97
|
-
if (parameters) {
|
|
98
|
-
if (options && unprotected in options) {
|
|
99
|
-
if (!this.#unprotectedHeader) {
|
|
100
|
-
this.setUnprotectedHeader(parameters);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
this.#unprotectedHeader = { ...this.#unprotectedHeader, ...parameters };
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
else if (!this.#protectedHeader) {
|
|
107
|
-
this.setProtectedHeader(parameters);
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
this.#protectedHeader = { ...this.#protectedHeader, ...parameters };
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
let additionalData;
|
|
115
|
-
let protectedHeaderS;
|
|
116
|
-
let protectedHeaderB;
|
|
117
|
-
let aadMember;
|
|
118
|
-
if (this.#protectedHeader) {
|
|
119
|
-
protectedHeaderS = b64u(JSON.stringify(this.#protectedHeader));
|
|
120
|
-
protectedHeaderB = encode(protectedHeaderS);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
protectedHeaderS = '';
|
|
124
|
-
protectedHeaderB = new Uint8Array();
|
|
125
|
-
}
|
|
126
|
-
if (this.#aad) {
|
|
127
|
-
aadMember = b64u(this.#aad);
|
|
128
|
-
const aadMemberBytes = encode(aadMember);
|
|
129
|
-
additionalData = concat(protectedHeaderB, encode('.'), aadMemberBytes);
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
additionalData = protectedHeaderB;
|
|
133
|
-
}
|
|
134
|
-
let plaintext = this.#plaintext;
|
|
135
|
-
if (joseHeader.zip === 'DEF') {
|
|
136
|
-
plaintext = await compress(plaintext).catch((cause) => {
|
|
137
|
-
throw new JWEInvalid('Failed to compress plaintext', { cause });
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
const { ciphertext, tag, iv } = await encrypt(enc, plaintext, cek, this.#iv, additionalData);
|
|
141
|
-
const jwe = {
|
|
142
|
-
ciphertext: b64u(ciphertext),
|
|
143
|
-
};
|
|
144
|
-
if (iv) {
|
|
145
|
-
jwe.iv = b64u(iv);
|
|
146
|
-
}
|
|
147
|
-
if (tag) {
|
|
148
|
-
jwe.tag = b64u(tag);
|
|
149
|
-
}
|
|
150
|
-
if (encryptedKey) {
|
|
151
|
-
jwe.encrypted_key = b64u(encryptedKey);
|
|
152
|
-
}
|
|
153
|
-
if (aadMember) {
|
|
154
|
-
jwe.aad = aadMember;
|
|
155
|
-
}
|
|
156
|
-
if (this.#protectedHeader) {
|
|
157
|
-
jwe.protected = protectedHeaderS;
|
|
158
|
-
}
|
|
159
|
-
if (this.#sharedUnprotectedHeader) {
|
|
160
|
-
jwe.unprotected = this.#sharedUnprotectedHeader;
|
|
161
|
-
}
|
|
162
|
-
if (this.#unprotectedHeader) {
|
|
163
|
-
jwe.header = this.#unprotectedHeader;
|
|
164
|
-
}
|
|
165
|
-
return jwe;
|
|
58
|
+
validateCritDuplicates(JWEInvalid, this.#protectedHeader);
|
|
59
|
+
return createJWE([
|
|
60
|
+
this.#plaintext,
|
|
61
|
+
this.#protectedHeader,
|
|
62
|
+
this.#unprotectedHeader,
|
|
63
|
+
this.#sharedUnprotectedHeader,
|
|
64
|
+
this.#aad,
|
|
65
|
+
this.#cek,
|
|
66
|
+
this.#iv,
|
|
67
|
+
this.#keyManagementParameters,
|
|
68
|
+
options?.crit,
|
|
69
|
+
options ? unprotected in options : false,
|
|
70
|
+
], key);
|
|
166
71
|
}
|
|
167
72
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { prepareDecrypt, shareJWE, decryptRecipient, decryptResult, checkShared, checkRecipient, } from '../../lib/jwe_decrypt.js';
|
|
2
2
|
import { JWEDecryptionFailed, JWEInvalid } from '../../util/errors.js';
|
|
3
3
|
import { isObject } from '../../lib/type_checks.js';
|
|
4
4
|
export async function generalDecrypt(jwe, key, options) {
|
|
@@ -11,9 +11,27 @@ export async function generalDecrypt(jwe, key, options) {
|
|
|
11
11
|
if (!jwe.recipients.length) {
|
|
12
12
|
throw new JWEInvalid('JWE Recipients has no members');
|
|
13
13
|
}
|
|
14
|
+
let shared;
|
|
15
|
+
let token;
|
|
16
|
+
try {
|
|
17
|
+
checkShared(jwe);
|
|
18
|
+
shared = prepareDecrypt(options);
|
|
19
|
+
token = shareJWE(jwe);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
throw new JWEDecryptionFailed();
|
|
23
|
+
}
|
|
24
|
+
if (jwe.recipients.length > 1) {
|
|
25
|
+
for (const { header } of jwe.recipients) {
|
|
26
|
+
const alg = token[0]?.alg ?? header?.alg ?? jwe.unprotected?.alg;
|
|
27
|
+
if (alg === 'dir' || alg === 'ECDH-ES') {
|
|
28
|
+
throw new JWEInvalid(`"${alg}" alg may only have a single recipient`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
14
32
|
for (const recipient of jwe.recipients) {
|
|
15
33
|
try {
|
|
16
|
-
|
|
34
|
+
const flattened = {
|
|
17
35
|
aad: jwe.aad,
|
|
18
36
|
ciphertext: jwe.ciphertext,
|
|
19
37
|
encrypted_key: recipient.encrypted_key,
|
|
@@ -22,7 +40,9 @@ export async function generalDecrypt(jwe, key, options) {
|
|
|
22
40
|
protected: jwe.protected,
|
|
23
41
|
tag: jwe.tag,
|
|
24
42
|
unprotected: jwe.unprotected,
|
|
25
|
-
}
|
|
43
|
+
};
|
|
44
|
+
checkRecipient(flattened);
|
|
45
|
+
return decryptResult(flattened, await decryptRecipient(flattened, token, shared, key));
|
|
26
46
|
}
|
|
27
47
|
catch {
|
|
28
48
|
}
|
|
@@ -1,32 +1,28 @@
|
|
|
1
1
|
import { FlattenedEncrypt } from '../flattened/encrypt.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { assertNotSet } from '../../lib/helpers.js';
|
|
3
|
+
import { JWEInvalid } from '../../util/errors.js';
|
|
4
4
|
import { generateCek } from '../../lib/content_encryption.js';
|
|
5
|
-
import { isDisjoint } from '../../lib/type_checks.js';
|
|
6
5
|
import { encryptKeyManagement } from '../../lib/key_management.js';
|
|
7
6
|
import { encode as b64u } from '../../util/base64url.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { validateCritDuplicates } from '../../lib/options.js';
|
|
8
|
+
import { checkEncryptHeaders, encryptJWE } from '../../lib/jwe_encrypt.js';
|
|
9
|
+
import { prepareKey } from '../../lib/key.js';
|
|
10
|
+
import { jweAlgorithm } from '../../lib/jwe_algorithms.js';
|
|
11
11
|
class IndividualRecipient {
|
|
12
12
|
#parent;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
key;
|
|
16
|
-
options;
|
|
17
|
-
constructor(enc, key, options) {
|
|
13
|
+
state;
|
|
14
|
+
constructor(enc, key, crit) {
|
|
18
15
|
this.#parent = enc;
|
|
19
|
-
this.
|
|
20
|
-
this.options = options;
|
|
16
|
+
this.state = [undefined, undefined, key, crit];
|
|
21
17
|
}
|
|
22
18
|
setUnprotectedHeader(unprotectedHeader) {
|
|
23
|
-
assertNotSet(this.
|
|
24
|
-
this.
|
|
19
|
+
assertNotSet(this.state[0], 'setUnprotectedHeader');
|
|
20
|
+
this.state[0] = unprotectedHeader;
|
|
25
21
|
return this;
|
|
26
22
|
}
|
|
27
23
|
setKeyManagementParameters(parameters) {
|
|
28
|
-
assertNotSet(this.
|
|
29
|
-
this.
|
|
24
|
+
assertNotSet(this.state[1], 'setKeyManagementParameters');
|
|
25
|
+
this.state[1] = parameters;
|
|
30
26
|
return this;
|
|
31
27
|
}
|
|
32
28
|
addRecipient(...args) {
|
|
@@ -39,6 +35,17 @@ class IndividualRecipient {
|
|
|
39
35
|
return this.#parent;
|
|
40
36
|
}
|
|
41
37
|
}
|
|
38
|
+
function copyOptionalMembers(flattened, jwe, recipient) {
|
|
39
|
+
const { aad, protected: protectedHeader, unprotected, header } = flattened;
|
|
40
|
+
if (aad)
|
|
41
|
+
jwe.aad = aad;
|
|
42
|
+
if (protectedHeader)
|
|
43
|
+
jwe.protected = protectedHeader;
|
|
44
|
+
if (unprotected)
|
|
45
|
+
jwe.unprotected = unprotected;
|
|
46
|
+
if (header)
|
|
47
|
+
recipient.header = header;
|
|
48
|
+
}
|
|
42
49
|
export class GeneralEncrypt {
|
|
43
50
|
#plaintext;
|
|
44
51
|
#recipients = [];
|
|
@@ -49,7 +56,7 @@ export class GeneralEncrypt {
|
|
|
49
56
|
this.#plaintext = plaintext;
|
|
50
57
|
}
|
|
51
58
|
addRecipient(key, options) {
|
|
52
|
-
const recipient = new IndividualRecipient(this, key,
|
|
59
|
+
const recipient = new IndividualRecipient(this, key, options?.crit);
|
|
53
60
|
this.#recipients.push(recipient);
|
|
54
61
|
return recipient;
|
|
55
62
|
}
|
|
@@ -71,111 +78,88 @@ export class GeneralEncrypt {
|
|
|
71
78
|
if (!this.#recipients.length) {
|
|
72
79
|
throw new JWEInvalid('at least one recipient must be added');
|
|
73
80
|
}
|
|
81
|
+
if (!(this.#plaintext instanceof Uint8Array)) {
|
|
82
|
+
throw new TypeError('plaintext must be an instance of Uint8Array');
|
|
83
|
+
}
|
|
74
84
|
if (this.#recipients.length === 1) {
|
|
75
85
|
const [recipient] = this.#recipients;
|
|
86
|
+
const [unprotectedHeader, keyManagementParameters, key, crit] = recipient.state;
|
|
76
87
|
const flattened = await new FlattenedEncrypt(this.#plaintext)
|
|
77
88
|
.setAdditionalAuthenticatedData(this.#aad)
|
|
78
89
|
.setProtectedHeader(this.#protectedHeader)
|
|
79
90
|
.setSharedUnprotectedHeader(this.#unprotectedHeader)
|
|
80
|
-
.setUnprotectedHeader(
|
|
81
|
-
.
|
|
91
|
+
.setUnprotectedHeader(unprotectedHeader)
|
|
92
|
+
.setKeyManagementParameters(keyManagementParameters)
|
|
93
|
+
.encrypt(key, { crit });
|
|
82
94
|
const jwe = {
|
|
83
95
|
ciphertext: flattened.ciphertext,
|
|
84
96
|
iv: flattened.iv,
|
|
85
97
|
recipients: [{}],
|
|
86
98
|
tag: flattened.tag,
|
|
87
99
|
};
|
|
88
|
-
if (flattened.aad)
|
|
89
|
-
jwe.aad = flattened.aad;
|
|
90
|
-
if (flattened.protected)
|
|
91
|
-
jwe.protected = flattened.protected;
|
|
92
|
-
if (flattened.unprotected)
|
|
93
|
-
jwe.unprotected = flattened.unprotected;
|
|
94
100
|
if (flattened.encrypted_key)
|
|
95
101
|
jwe.recipients[0].encrypted_key = flattened.encrypted_key;
|
|
96
|
-
|
|
97
|
-
jwe.recipients[0].header = flattened.header;
|
|
102
|
+
copyOptionalMembers(flattened, jwe, jwe.recipients[0]);
|
|
98
103
|
return jwe;
|
|
99
104
|
}
|
|
105
|
+
validateCritDuplicates(JWEInvalid, this.#protectedHeader);
|
|
100
106
|
let enc;
|
|
107
|
+
const inputs = [];
|
|
108
|
+
const checked = [];
|
|
101
109
|
for (let i = 0; i < this.#recipients.length; i++) {
|
|
102
110
|
const recipient = this.#recipients[i];
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
const [unprotectedHeader, keyManagementParameters, , crit] = recipient.state;
|
|
112
|
+
const input = [
|
|
113
|
+
this.#plaintext,
|
|
114
|
+
this.#protectedHeader,
|
|
115
|
+
unprotectedHeader,
|
|
116
|
+
this.#unprotectedHeader,
|
|
117
|
+
this.#aad,
|
|
118
|
+
undefined,
|
|
119
|
+
undefined,
|
|
120
|
+
keyManagementParameters,
|
|
121
|
+
crit,
|
|
122
|
+
true,
|
|
123
|
+
];
|
|
124
|
+
const headers = checkEncryptHeaders(input);
|
|
125
|
+
inputs.push(input);
|
|
126
|
+
checked.push(headers);
|
|
127
|
+
if (headers[1] === 'dir' || headers[1] === 'ECDH-ES') {
|
|
128
|
+
throw new JWEInvalid(`"${headers[1]}" alg may only have a single recipient`);
|
|
120
129
|
}
|
|
121
130
|
if (!enc) {
|
|
122
|
-
enc =
|
|
131
|
+
enc = headers[2];
|
|
123
132
|
}
|
|
124
|
-
else if (enc !==
|
|
133
|
+
else if (enc !== headers[2]) {
|
|
125
134
|
throw new JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients');
|
|
126
135
|
}
|
|
127
|
-
validateCrit(JWEInvalid, new Map(), recipient.options.crit, this.#protectedHeader, joseHeader);
|
|
128
|
-
if (joseHeader.zip !== undefined && joseHeader.zip !== 'DEF') {
|
|
129
|
-
throw new JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');
|
|
130
|
-
}
|
|
131
|
-
if (joseHeader.zip !== undefined && !this.#protectedHeader?.zip) {
|
|
132
|
-
throw new JWEInvalid('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');
|
|
133
|
-
}
|
|
134
136
|
}
|
|
135
|
-
const cek = generateCek(
|
|
137
|
+
const cek = generateCek(checked[0][3]);
|
|
136
138
|
const jwe = {
|
|
137
139
|
ciphertext: '',
|
|
138
140
|
recipients: [],
|
|
139
141
|
};
|
|
140
142
|
for (let i = 0; i < this.#recipients.length; i++) {
|
|
141
143
|
const recipient = this.#recipients[i];
|
|
144
|
+
const [unprotectedHeader, keyManagementParameters, key] = recipient.state;
|
|
142
145
|
const target = {};
|
|
143
146
|
jwe.recipients.push(target);
|
|
144
147
|
if (i === 0) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
.setContentEncryptionKey(cek)
|
|
148
|
-
.setProtectedHeader(this.#protectedHeader)
|
|
149
|
-
.setSharedUnprotectedHeader(this.#unprotectedHeader)
|
|
150
|
-
.setUnprotectedHeader(recipient.unprotectedHeader)
|
|
151
|
-
.setKeyManagementParameters(recipient.keyManagementParameters)
|
|
152
|
-
.encrypt(recipient.key, {
|
|
153
|
-
...recipient.options,
|
|
154
|
-
[unprotected]: true,
|
|
155
|
-
});
|
|
148
|
+
inputs[0][5] = cek;
|
|
149
|
+
const flattened = await encryptJWE(inputs[0], checked[0], key);
|
|
156
150
|
jwe.ciphertext = flattened.ciphertext;
|
|
157
151
|
jwe.iv = flattened.iv;
|
|
158
152
|
jwe.tag = flattened.tag;
|
|
159
|
-
if (flattened.aad)
|
|
160
|
-
jwe.aad = flattened.aad;
|
|
161
|
-
if (flattened.protected)
|
|
162
|
-
jwe.protected = flattened.protected;
|
|
163
|
-
if (flattened.unprotected)
|
|
164
|
-
jwe.unprotected = flattened.unprotected;
|
|
165
153
|
target.encrypted_key = flattened.encrypted_key;
|
|
166
|
-
|
|
167
|
-
target.header = flattened.header;
|
|
154
|
+
copyOptionalMembers(flattened, jwe, target);
|
|
168
155
|
continue;
|
|
169
156
|
}
|
|
170
|
-
const alg =
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
checkKeyType(alg === 'dir' ? enc : alg, recipient.key, 'encrypt');
|
|
174
|
-
const k = await normalizeKey(recipient.key, alg);
|
|
175
|
-
const { encryptedKey, parameters } = await encryptKeyManagement(alg, enc, k, cek, recipient.keyManagementParameters);
|
|
157
|
+
const [, alg, , encEntry] = checked[i];
|
|
158
|
+
const k = await prepareKey(jweAlgorithm(alg), key, 'encrypt');
|
|
159
|
+
const [, encryptedKey, parameters] = await encryptKeyManagement(alg, encEntry, k, cek, keyManagementParameters);
|
|
176
160
|
target.encrypted_key = b64u(encryptedKey);
|
|
177
|
-
if (
|
|
178
|
-
target.header = { ...
|
|
161
|
+
if (unprotectedHeader || parameters)
|
|
162
|
+
target.header = { ...unprotectedHeader, ...parameters };
|
|
179
163
|
}
|
|
180
164
|
return jwe;
|
|
181
165
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jwkToKey } from '../lib/jwk_to_key.js';
|
|
2
|
+
import { jwsAlgorithm } from '../lib/jws_algorithms.js';
|
|
2
3
|
import { isObject } from '../lib/type_checks.js';
|
|
3
4
|
import { JWSInvalid } from '../util/errors.js';
|
|
4
5
|
export async function EmbeddedJWK(protectedHeader, token) {
|
|
@@ -9,8 +10,9 @@ export async function EmbeddedJWK(protectedHeader, token) {
|
|
|
9
10
|
if (!isObject(joseHeader.jwk)) {
|
|
10
11
|
throw new JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a JSON object');
|
|
11
12
|
}
|
|
12
|
-
const
|
|
13
|
-
|
|
13
|
+
const entry = jwsAlgorithm(joseHeader.alg);
|
|
14
|
+
const key = await jwkToKey(entry, { ...joseHeader.jwk, ext: true });
|
|
15
|
+
if (key.type !== 'public') {
|
|
14
16
|
throw new JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a public key');
|
|
15
17
|
}
|
|
16
18
|
return key;
|
|
@@ -1,31 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jwkToKey } from '../lib/jwk_to_key.js';
|
|
2
|
+
import { JWS } from '../lib/jws_algorithms.js';
|
|
2
3
|
import { JWKSInvalid, JOSENotSupported, JWKSNoMatchingKey, JWKSMultipleMatchingKeys, } from '../util/errors.js';
|
|
3
4
|
import { isObject } from '../lib/type_checks.js';
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return 'RSA';
|
|
9
|
-
case 'ES':
|
|
10
|
-
return 'EC';
|
|
11
|
-
case 'Ed':
|
|
12
|
-
return 'OKP';
|
|
13
|
-
case 'ML':
|
|
14
|
-
return 'AKP';
|
|
15
|
-
default:
|
|
16
|
-
throw new JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set');
|
|
5
|
+
function signatureAlgorithm(alg) {
|
|
6
|
+
const entry = typeof alg === 'string' ? JWS[alg] : undefined;
|
|
7
|
+
if (!entry || entry.secret) {
|
|
8
|
+
throw new JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set');
|
|
17
9
|
}
|
|
10
|
+
return entry;
|
|
18
11
|
}
|
|
19
12
|
function isJWKSLike(jwks) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
function isJWKLike(key) {
|
|
26
|
-
return isObject(key);
|
|
13
|
+
if (!jwks || typeof jwks !== 'object') {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const { keys } = jwks;
|
|
17
|
+
return Array.isArray(keys) && keys.every((isObject));
|
|
27
18
|
}
|
|
28
|
-
class
|
|
19
|
+
class LocalJWKSetImpl {
|
|
29
20
|
#jwks;
|
|
30
21
|
#cached = new WeakMap();
|
|
31
22
|
constructor(jwks) {
|
|
@@ -39,40 +30,13 @@ class LocalJWKSet {
|
|
|
39
30
|
}
|
|
40
31
|
async getKey(protectedHeader, token) {
|
|
41
32
|
const { alg, kid } = { ...protectedHeader, ...token?.header };
|
|
42
|
-
const
|
|
43
|
-
const candidates = this.#jwks.keys.filter((jwk) =>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
candidate = alg === jwk.alg;
|
|
50
|
-
}
|
|
51
|
-
if (candidate && typeof jwk.use === 'string') {
|
|
52
|
-
candidate = jwk.use === 'sig';
|
|
53
|
-
}
|
|
54
|
-
if (candidate && Array.isArray(jwk.key_ops)) {
|
|
55
|
-
candidate = jwk.key_ops.includes('verify');
|
|
56
|
-
}
|
|
57
|
-
if (candidate) {
|
|
58
|
-
switch (alg) {
|
|
59
|
-
case 'ES256':
|
|
60
|
-
candidate = jwk.crv === 'P-256';
|
|
61
|
-
break;
|
|
62
|
-
case 'ES384':
|
|
63
|
-
candidate = jwk.crv === 'P-384';
|
|
64
|
-
break;
|
|
65
|
-
case 'ES512':
|
|
66
|
-
candidate = jwk.crv === 'P-521';
|
|
67
|
-
break;
|
|
68
|
-
case 'Ed25519':
|
|
69
|
-
case 'EdDSA':
|
|
70
|
-
candidate = jwk.crv === 'Ed25519';
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return candidate;
|
|
75
|
-
});
|
|
33
|
+
const entry = signatureAlgorithm(alg);
|
|
34
|
+
const candidates = this.#jwks.keys.filter((jwk) => entry.kty.includes(jwk.kty) &&
|
|
35
|
+
(typeof kid !== 'string' || kid === jwk.kid) &&
|
|
36
|
+
(!(typeof jwk.alg === 'string' || jwk.kty === 'AKP') || alg === jwk.alg) &&
|
|
37
|
+
(typeof jwk.use !== 'string' || jwk.use === 'sig') &&
|
|
38
|
+
(!Array.isArray(jwk.key_ops) || jwk.key_ops.includes('verify')) &&
|
|
39
|
+
(!entry.crv || jwk.crv === entry.crv));
|
|
76
40
|
const { 0: jwk, length } = candidates;
|
|
77
41
|
if (length === 0) {
|
|
78
42
|
throw new JWKSNoMatchingKey();
|
|
@@ -83,37 +47,32 @@ class LocalJWKSet {
|
|
|
83
47
|
error[Symbol.asyncIterator] = async function* () {
|
|
84
48
|
for (const jwk of candidates) {
|
|
85
49
|
try {
|
|
86
|
-
yield await importWithAlgCache(_cached, jwk,
|
|
50
|
+
yield await importWithAlgCache(_cached, jwk, entry);
|
|
87
51
|
}
|
|
88
52
|
catch { }
|
|
89
53
|
}
|
|
90
54
|
};
|
|
91
55
|
throw error;
|
|
92
56
|
}
|
|
93
|
-
return importWithAlgCache(this.#cached, jwk,
|
|
57
|
+
return importWithAlgCache(this.#cached, jwk, entry);
|
|
94
58
|
}
|
|
95
59
|
}
|
|
96
|
-
async function importWithAlgCache(cache, jwk,
|
|
97
|
-
const cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk);
|
|
98
|
-
if (cached[alg] === undefined) {
|
|
99
|
-
const key = await
|
|
100
|
-
if (key
|
|
60
|
+
async function importWithAlgCache(cache, jwk, entry) {
|
|
61
|
+
const cached = cache.get(jwk) || cache.set(jwk, { __proto__: null }).get(jwk);
|
|
62
|
+
if (cached[entry.alg] === undefined) {
|
|
63
|
+
const key = await jwkToKey(entry, { ...jwk, alg: entry.alg, ext: true });
|
|
64
|
+
if (key.type !== 'public') {
|
|
101
65
|
throw new JWKSInvalid('JSON Web Key Set members must be public keys');
|
|
102
66
|
}
|
|
103
|
-
cached[alg] = key;
|
|
67
|
+
cached[entry.alg] = key;
|
|
104
68
|
}
|
|
105
|
-
return cached[alg];
|
|
69
|
+
return cached[entry.alg];
|
|
106
70
|
}
|
|
107
71
|
export function createLocalJWKSet(jwks) {
|
|
108
|
-
const set = new
|
|
72
|
+
const set = new LocalJWKSetImpl(jwks);
|
|
109
73
|
const localJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);
|
|
110
|
-
Object.
|
|
111
|
-
|
|
112
|
-
value: () => structuredClone(set.jwks()),
|
|
113
|
-
enumerable: false,
|
|
114
|
-
configurable: false,
|
|
115
|
-
writable: false,
|
|
116
|
-
},
|
|
74
|
+
Object.defineProperty(localJWKSet, 'jwks', {
|
|
75
|
+
value: () => structuredClone(set.jwks()),
|
|
117
76
|
});
|
|
118
77
|
return localJWKSet;
|
|
119
78
|
}
|