@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,107 +1,17 @@
|
|
|
1
1
|
import { JOSENotSupported } from '../util/errors.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
let keyUsages;
|
|
6
|
-
switch (jwk.kty) {
|
|
7
|
-
case 'AKP': {
|
|
8
|
-
switch (jwk.alg) {
|
|
9
|
-
case 'ML-DSA-44':
|
|
10
|
-
case 'ML-DSA-65':
|
|
11
|
-
case 'ML-DSA-87':
|
|
12
|
-
algorithm = { name: jwk.alg };
|
|
13
|
-
keyUsages = jwk.priv ? ['sign'] : ['verify'];
|
|
14
|
-
break;
|
|
15
|
-
default:
|
|
16
|
-
throw new JOSENotSupported(unsupportedAlg);
|
|
17
|
-
}
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
case 'RSA': {
|
|
21
|
-
switch (jwk.alg) {
|
|
22
|
-
case 'PS256':
|
|
23
|
-
case 'PS384':
|
|
24
|
-
case 'PS512':
|
|
25
|
-
algorithm = { name: 'RSA-PSS', hash: `SHA-${jwk.alg.slice(-3)}` };
|
|
26
|
-
keyUsages = jwk.d ? ['sign'] : ['verify'];
|
|
27
|
-
break;
|
|
28
|
-
case 'RS256':
|
|
29
|
-
case 'RS384':
|
|
30
|
-
case 'RS512':
|
|
31
|
-
algorithm = { name: 'RSASSA-PKCS1-v1_5', hash: `SHA-${jwk.alg.slice(-3)}` };
|
|
32
|
-
keyUsages = jwk.d ? ['sign'] : ['verify'];
|
|
33
|
-
break;
|
|
34
|
-
case 'RSA-OAEP':
|
|
35
|
-
case 'RSA-OAEP-256':
|
|
36
|
-
case 'RSA-OAEP-384':
|
|
37
|
-
case 'RSA-OAEP-512':
|
|
38
|
-
algorithm = {
|
|
39
|
-
name: 'RSA-OAEP',
|
|
40
|
-
hash: `SHA-${parseInt(jwk.alg.slice(-3), 10) || 1}`,
|
|
41
|
-
};
|
|
42
|
-
keyUsages = jwk.d ? ['decrypt', 'unwrapKey'] : ['encrypt', 'wrapKey'];
|
|
43
|
-
break;
|
|
44
|
-
default:
|
|
45
|
-
throw new JOSENotSupported(unsupportedAlg);
|
|
46
|
-
}
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
case 'EC': {
|
|
50
|
-
switch (jwk.alg) {
|
|
51
|
-
case 'ES256':
|
|
52
|
-
case 'ES384':
|
|
53
|
-
case 'ES512':
|
|
54
|
-
algorithm = {
|
|
55
|
-
name: 'ECDSA',
|
|
56
|
-
namedCurve: { ES256: 'P-256', ES384: 'P-384', ES512: 'P-521' }[jwk.alg],
|
|
57
|
-
};
|
|
58
|
-
keyUsages = jwk.d ? ['sign'] : ['verify'];
|
|
59
|
-
break;
|
|
60
|
-
case 'ECDH-ES':
|
|
61
|
-
case 'ECDH-ES+A128KW':
|
|
62
|
-
case 'ECDH-ES+A192KW':
|
|
63
|
-
case 'ECDH-ES+A256KW':
|
|
64
|
-
algorithm = { name: 'ECDH', namedCurve: jwk.crv };
|
|
65
|
-
keyUsages = jwk.d ? ['deriveBits'] : [];
|
|
66
|
-
break;
|
|
67
|
-
default:
|
|
68
|
-
throw new JOSENotSupported(unsupportedAlg);
|
|
69
|
-
}
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
case 'OKP': {
|
|
73
|
-
switch (jwk.alg) {
|
|
74
|
-
case 'Ed25519':
|
|
75
|
-
case 'EdDSA':
|
|
76
|
-
algorithm = { name: 'Ed25519' };
|
|
77
|
-
keyUsages = jwk.d ? ['sign'] : ['verify'];
|
|
78
|
-
break;
|
|
79
|
-
case 'ECDH-ES':
|
|
80
|
-
case 'ECDH-ES+A128KW':
|
|
81
|
-
case 'ECDH-ES+A192KW':
|
|
82
|
-
case 'ECDH-ES+A256KW':
|
|
83
|
-
algorithm = { name: jwk.crv };
|
|
84
|
-
keyUsages = jwk.d ? ['deriveBits'] : [];
|
|
85
|
-
break;
|
|
86
|
-
default:
|
|
87
|
-
throw new JOSENotSupported(unsupportedAlg);
|
|
88
|
-
}
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
default:
|
|
92
|
-
throw new JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
|
|
2
|
+
export async function jwkToKey(entry, jwk) {
|
|
3
|
+
if (jwk.kty === 'RSA' && 'oth' in jwk && jwk.oth !== undefined) {
|
|
4
|
+
throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
|
|
93
5
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
export async function jwkToKey(jwk) {
|
|
97
|
-
if (!jwk.alg) {
|
|
98
|
-
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
6
|
+
if (!entry.kty.includes(jwk.kty)) {
|
|
7
|
+
throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
99
8
|
}
|
|
100
|
-
const {
|
|
9
|
+
const algorithm = entry.resolve?.({ kty: jwk.kty, crv: jwk.crv }) ?? entry.subtle;
|
|
10
|
+
const isPrivate = !!(jwk.d || jwk.priv);
|
|
101
11
|
const keyData = { ...jwk };
|
|
102
12
|
if (keyData.kty !== 'AKP') {
|
|
103
13
|
delete keyData.alg;
|
|
104
14
|
}
|
|
105
15
|
delete keyData.use;
|
|
106
|
-
return crypto.subtle.importKey('jwk', keyData, algorithm, jwk.ext ??
|
|
16
|
+
return crypto.subtle.importKey('jwk', keyData, algorithm, jwk.ext ?? !isPrivate, jwk.key_ops ?? entry.usages[isPrivate ? 1 : 0]);
|
|
107
17
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { JOSENotSupported } from '../util/errors.js';
|
|
2
|
+
import { table } from './key_descriptor.js';
|
|
3
|
+
const sig = [['verify'], ['sign']];
|
|
4
|
+
function hmac(bits) {
|
|
5
|
+
const subtle = { name: 'HMAC', hash: `SHA-${bits}` };
|
|
6
|
+
return { kty: ['oct'], secret: true, subtle, signing: subtle, usages: sig };
|
|
7
|
+
}
|
|
8
|
+
function rsa(bits, saltLength) {
|
|
9
|
+
const name = saltLength ? 'RSA-PSS' : 'RSASSA-PKCS1-v1_5';
|
|
10
|
+
const subtle = { name, hash: `SHA-${bits}` };
|
|
11
|
+
return {
|
|
12
|
+
kty: ['RSA'],
|
|
13
|
+
subtle,
|
|
14
|
+
signing: saltLength ? { ...subtle, saltLength } : subtle,
|
|
15
|
+
usages: sig,
|
|
16
|
+
minRsaBits: 2048,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function ecdsa(crv, bits) {
|
|
20
|
+
return {
|
|
21
|
+
kty: ['EC'],
|
|
22
|
+
crv,
|
|
23
|
+
subtle: { name: 'ECDSA', namedCurve: crv },
|
|
24
|
+
signing: { name: 'ECDSA', hash: `SHA-${bits}` },
|
|
25
|
+
usages: sig,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function eddsa() {
|
|
29
|
+
const subtle = { name: 'Ed25519' };
|
|
30
|
+
return {
|
|
31
|
+
kty: ['OKP'],
|
|
32
|
+
crv: 'Ed25519',
|
|
33
|
+
subtle,
|
|
34
|
+
signing: subtle,
|
|
35
|
+
usages: sig,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function mldsa(bits) {
|
|
39
|
+
const name = `ML-DSA-${bits}`;
|
|
40
|
+
const subtle = { name };
|
|
41
|
+
return {
|
|
42
|
+
kty: ['AKP'],
|
|
43
|
+
subtle,
|
|
44
|
+
signing: subtle,
|
|
45
|
+
usages: sig,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export const JWS = table({
|
|
49
|
+
HS256: hmac(256),
|
|
50
|
+
HS384: hmac(384),
|
|
51
|
+
HS512: hmac(512),
|
|
52
|
+
RS256: rsa(256),
|
|
53
|
+
RS384: rsa(384),
|
|
54
|
+
RS512: rsa(512),
|
|
55
|
+
PS256: rsa(256, 32),
|
|
56
|
+
PS384: rsa(384, 48),
|
|
57
|
+
PS512: rsa(512, 64),
|
|
58
|
+
ES256: ecdsa('P-256', 256),
|
|
59
|
+
ES384: ecdsa('P-384', 384),
|
|
60
|
+
ES512: ecdsa('P-521', 512),
|
|
61
|
+
EdDSA: eddsa(),
|
|
62
|
+
Ed25519: eddsa(),
|
|
63
|
+
'ML-DSA-44': mldsa(44),
|
|
64
|
+
'ML-DSA-65': mldsa(65),
|
|
65
|
+
'ML-DSA-87': mldsa(87),
|
|
66
|
+
});
|
|
67
|
+
export function jwsAlgorithm(alg) {
|
|
68
|
+
const entry = typeof alg === 'string' ? JWS[alg] : undefined;
|
|
69
|
+
if (!entry) {
|
|
70
|
+
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
71
|
+
}
|
|
72
|
+
return entry;
|
|
73
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { encode as b64u } from '../util/base64url.js';
|
|
2
|
+
import { sign } from './signing.js';
|
|
3
|
+
import { jwsAlgorithm } from './jws_algorithms.js';
|
|
4
|
+
import { isDisjoint } from './type_checks.js';
|
|
5
|
+
import { JWSInvalid } from '../util/errors.js';
|
|
6
|
+
import { concat, encode } from './buffer_utils.js';
|
|
7
|
+
import { validateCrit, validateCritDuplicates, JWS_RECOGNIZED } from './options.js';
|
|
8
|
+
import { prepareKey } from './key.js';
|
|
9
|
+
export function unencodedPayload(protectedHeader) {
|
|
10
|
+
return (protectedHeader?.b64 === false &&
|
|
11
|
+
Array.isArray(protectedHeader.crit) &&
|
|
12
|
+
protectedHeader.crit.includes('b64'));
|
|
13
|
+
}
|
|
14
|
+
export async function createSignature(input, key) {
|
|
15
|
+
const { protectedHeader, unprotectedHeader } = input;
|
|
16
|
+
if (!protectedHeader && !unprotectedHeader) {
|
|
17
|
+
throw new JWSInvalid('either setProtectedHeader or setUnprotectedHeader must be called before #sign()');
|
|
18
|
+
}
|
|
19
|
+
if (!isDisjoint(protectedHeader, unprotectedHeader)) {
|
|
20
|
+
throw new JWSInvalid('JWS Protected and JWS Unprotected Header Parameter names must be disjoint');
|
|
21
|
+
}
|
|
22
|
+
const joseHeader = { ...protectedHeader, ...unprotectedHeader };
|
|
23
|
+
validateCritDuplicates(JWSInvalid, protectedHeader);
|
|
24
|
+
const extensions = validateCrit(JWSInvalid, JWS_RECOGNIZED, input.crit, protectedHeader, joseHeader);
|
|
25
|
+
let b64 = true;
|
|
26
|
+
if (extensions.includes('b64')) {
|
|
27
|
+
b64 = protectedHeader.b64;
|
|
28
|
+
if (typeof b64 !== 'boolean') {
|
|
29
|
+
throw new JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const { alg } = joseHeader;
|
|
33
|
+
if (typeof alg !== 'string' || !alg) {
|
|
34
|
+
throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
35
|
+
}
|
|
36
|
+
const entry = jwsAlgorithm(alg);
|
|
37
|
+
let payloadS;
|
|
38
|
+
let payloadB;
|
|
39
|
+
if (b64) {
|
|
40
|
+
const encoded = (input.encoded ??= []);
|
|
41
|
+
encoded[0] ??= b64u(input.payload);
|
|
42
|
+
encoded[1] ??= encode(encoded[0]);
|
|
43
|
+
payloadS = encoded[0];
|
|
44
|
+
payloadB = encoded[1];
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
payloadB = input.payload;
|
|
48
|
+
payloadS = '';
|
|
49
|
+
}
|
|
50
|
+
let protectedHeaderString;
|
|
51
|
+
let protectedHeaderBytes;
|
|
52
|
+
if (protectedHeader) {
|
|
53
|
+
protectedHeaderString = b64u(JSON.stringify(protectedHeader));
|
|
54
|
+
protectedHeaderBytes = encode(protectedHeaderString);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
protectedHeaderString = '';
|
|
58
|
+
protectedHeaderBytes = new Uint8Array();
|
|
59
|
+
}
|
|
60
|
+
const data = concat(protectedHeaderBytes, encode('.'), payloadB);
|
|
61
|
+
const k = await prepareKey(entry, key, 'sign');
|
|
62
|
+
const signature = await sign(entry, k, data);
|
|
63
|
+
const jws = {
|
|
64
|
+
signature: b64u(signature),
|
|
65
|
+
payload: payloadS,
|
|
66
|
+
};
|
|
67
|
+
if (protectedHeader) {
|
|
68
|
+
jws.protected = protectedHeaderString;
|
|
69
|
+
}
|
|
70
|
+
if (unprotectedHeader) {
|
|
71
|
+
jws.header = unprotectedHeader;
|
|
72
|
+
}
|
|
73
|
+
return jws;
|
|
74
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { verify } from './signing.js';
|
|
2
|
+
import { jwsAlgorithm } from './jws_algorithms.js';
|
|
3
|
+
import { JOSEAlgNotAllowed, JWSInvalid, JWSSignatureVerificationFailed } from '../util/errors.js';
|
|
4
|
+
import { concat, decoder, encoder, encode } from './buffer_utils.js';
|
|
5
|
+
import { decodeBase64url, encodeBase64url, parseJoseHeader } from './helpers.js';
|
|
6
|
+
import { isDisjoint } from './type_checks.js';
|
|
7
|
+
import { validateCrit, validateAlgorithms, JWS_RECOGNIZED } from './options.js';
|
|
8
|
+
import { prepareKey } from './key.js';
|
|
9
|
+
export function verifyResult(jws, verified) {
|
|
10
|
+
const [payload, parsedProt, , key, resolvedKey] = verified;
|
|
11
|
+
const result = { payload };
|
|
12
|
+
if (jws.protected !== undefined) {
|
|
13
|
+
result.protectedHeader = parsedProt;
|
|
14
|
+
}
|
|
15
|
+
if (jws.header !== undefined) {
|
|
16
|
+
result.unprotectedHeader = jws.header;
|
|
17
|
+
}
|
|
18
|
+
if (resolvedKey) {
|
|
19
|
+
return { ...result, key };
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
export function prepareVerify(options) {
|
|
24
|
+
return [options && validateAlgorithms('algorithms', options.algorithms), options?.crit];
|
|
25
|
+
}
|
|
26
|
+
export async function verifySignature(jws, shared, key) {
|
|
27
|
+
const { protected: encodedProtected, header, payload: inputPayload } = jws;
|
|
28
|
+
let parsedProt = {};
|
|
29
|
+
if (encodedProtected) {
|
|
30
|
+
parsedProt = parseJoseHeader(encodedProtected, JWSInvalid, 'JWS Protected Header is invalid');
|
|
31
|
+
}
|
|
32
|
+
let joseHeader;
|
|
33
|
+
if (header !== undefined) {
|
|
34
|
+
if (!isDisjoint(parsedProt, header)) {
|
|
35
|
+
throw new JWSInvalid('JWS Protected and JWS Unprotected Header Parameter names must be disjoint');
|
|
36
|
+
}
|
|
37
|
+
joseHeader = { ...parsedProt, ...header };
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
joseHeader = parsedProt;
|
|
41
|
+
}
|
|
42
|
+
const extensions = validateCrit(JWSInvalid, JWS_RECOGNIZED, shared[1], parsedProt, joseHeader);
|
|
43
|
+
let b64 = true;
|
|
44
|
+
if (extensions.includes('b64')) {
|
|
45
|
+
b64 = parsedProt.b64;
|
|
46
|
+
if (typeof b64 !== 'boolean') {
|
|
47
|
+
throw new JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const { alg } = joseHeader;
|
|
51
|
+
if (typeof alg !== 'string' || !alg) {
|
|
52
|
+
throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
53
|
+
}
|
|
54
|
+
if (shared[0] && !shared[0].has(alg)) {
|
|
55
|
+
throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed');
|
|
56
|
+
}
|
|
57
|
+
if (b64) {
|
|
58
|
+
if (typeof inputPayload !== 'string') {
|
|
59
|
+
throw new JWSInvalid('JWS Payload must be a string');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else if (typeof inputPayload !== 'string' && !(inputPayload instanceof Uint8Array)) {
|
|
63
|
+
throw new JWSInvalid('JWS Payload must be a string or an Uint8Array instance');
|
|
64
|
+
}
|
|
65
|
+
let resolvedKey = false;
|
|
66
|
+
if (typeof key === 'function') {
|
|
67
|
+
key = await key(parsedProt, jws);
|
|
68
|
+
resolvedKey = true;
|
|
69
|
+
}
|
|
70
|
+
const entry = jwsAlgorithm(alg);
|
|
71
|
+
const data = concat(encodedProtected !== undefined ? encode(encodedProtected) : new Uint8Array(), encode('.'), typeof inputPayload === 'string'
|
|
72
|
+
? b64
|
|
73
|
+
?
|
|
74
|
+
(shared[2] ??= encodeBase64url(inputPayload, 'payload', JWSInvalid))
|
|
75
|
+
: encoder.encode(inputPayload)
|
|
76
|
+
: inputPayload);
|
|
77
|
+
const signature = decodeBase64url(jws.signature, 'signature', JWSInvalid);
|
|
78
|
+
const k = await prepareKey(entry, key, 'verify');
|
|
79
|
+
const verified = await verify(entry, k, signature, data);
|
|
80
|
+
if (!verified) {
|
|
81
|
+
throw new JWSSignatureVerificationFailed();
|
|
82
|
+
}
|
|
83
|
+
let payload;
|
|
84
|
+
if (b64) {
|
|
85
|
+
payload = decodeBase64url(inputPayload, 'payload', JWSInvalid);
|
|
86
|
+
}
|
|
87
|
+
else if (typeof inputPayload === 'string') {
|
|
88
|
+
payload = encoder.encode(inputPayload);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
payload = inputPayload;
|
|
92
|
+
}
|
|
93
|
+
return [payload, parsedProt, b64, k, resolvedKey];
|
|
94
|
+
}
|
|
95
|
+
export async function verifyCompact(jws, shared, key) {
|
|
96
|
+
if (jws instanceof Uint8Array) {
|
|
97
|
+
jws = decoder.decode(jws);
|
|
98
|
+
}
|
|
99
|
+
if (typeof jws !== 'string') {
|
|
100
|
+
throw new JWSInvalid('Compact JWS must be a string or Uint8Array');
|
|
101
|
+
}
|
|
102
|
+
const { 0: protectedHeader, 1: payload, 2: signature, length } = jws.split('.');
|
|
103
|
+
if (length !== 3) {
|
|
104
|
+
throw new JWSInvalid('Invalid Compact JWS');
|
|
105
|
+
}
|
|
106
|
+
return verifySignature({ payload, protected: protectedHeader, signature }, shared, key);
|
|
107
|
+
}
|
|
@@ -1,57 +1,24 @@
|
|
|
1
1
|
import { JWTClaimValidationFailed, JWTExpired, JWTInvalid } from '../util/errors.js';
|
|
2
|
-
import { encoder,
|
|
2
|
+
import { encoder, strictDecoder } from './buffer_utils.js';
|
|
3
3
|
import { isObject } from './type_checks.js';
|
|
4
4
|
const epoch = (date) => Math.floor(date.getTime() / 1000);
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const multipliers = {
|
|
6
|
+
s: 1,
|
|
7
|
+
m: 60,
|
|
8
|
+
h: 3600,
|
|
9
|
+
d: 86400,
|
|
10
|
+
w: 604800,
|
|
11
|
+
y: 31557600,
|
|
12
|
+
};
|
|
10
13
|
const REGEX = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;
|
|
14
|
+
const checkFailed = 'check_failed';
|
|
11
15
|
export function secs(str) {
|
|
12
16
|
const matched = REGEX.exec(str);
|
|
13
17
|
if (!matched || (matched[4] && matched[1])) {
|
|
14
18
|
throw new TypeError('Invalid time period format');
|
|
15
19
|
}
|
|
16
20
|
const value = parseFloat(matched[2]);
|
|
17
|
-
const
|
|
18
|
-
let numericDate;
|
|
19
|
-
switch (unit) {
|
|
20
|
-
case 'sec':
|
|
21
|
-
case 'secs':
|
|
22
|
-
case 'second':
|
|
23
|
-
case 'seconds':
|
|
24
|
-
case 's':
|
|
25
|
-
numericDate = Math.round(value);
|
|
26
|
-
break;
|
|
27
|
-
case 'minute':
|
|
28
|
-
case 'minutes':
|
|
29
|
-
case 'min':
|
|
30
|
-
case 'mins':
|
|
31
|
-
case 'm':
|
|
32
|
-
numericDate = Math.round(value * minute);
|
|
33
|
-
break;
|
|
34
|
-
case 'hour':
|
|
35
|
-
case 'hours':
|
|
36
|
-
case 'hr':
|
|
37
|
-
case 'hrs':
|
|
38
|
-
case 'h':
|
|
39
|
-
numericDate = Math.round(value * hour);
|
|
40
|
-
break;
|
|
41
|
-
case 'day':
|
|
42
|
-
case 'days':
|
|
43
|
-
case 'd':
|
|
44
|
-
numericDate = Math.round(value * day);
|
|
45
|
-
break;
|
|
46
|
-
case 'week':
|
|
47
|
-
case 'weeks':
|
|
48
|
-
case 'w':
|
|
49
|
-
numericDate = Math.round(value * week);
|
|
50
|
-
break;
|
|
51
|
-
default:
|
|
52
|
-
numericDate = Math.round(value * year);
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
21
|
+
const numericDate = Math.round(value * multipliers[matched[3][0].toLowerCase()]);
|
|
55
22
|
if (matched[1] === '-' || matched[4] === 'ago') {
|
|
56
23
|
return -numericDate;
|
|
57
24
|
}
|
|
@@ -63,6 +30,13 @@ function validateInput(label, input) {
|
|
|
63
30
|
}
|
|
64
31
|
return input;
|
|
65
32
|
}
|
|
33
|
+
function numericDate(value, label) {
|
|
34
|
+
if (typeof value === 'number')
|
|
35
|
+
return validateInput(label, value);
|
|
36
|
+
if (value instanceof Date)
|
|
37
|
+
return validateInput(label, epoch(value));
|
|
38
|
+
return epoch(new Date()) + secs(value);
|
|
39
|
+
}
|
|
66
40
|
const normalizeTyp = (value) => {
|
|
67
41
|
if (value.includes('/')) {
|
|
68
42
|
return value.toLowerCase();
|
|
@@ -74,14 +48,26 @@ const checkAudiencePresence = (audPayload, audOption) => {
|
|
|
74
48
|
return audOption.includes(audPayload);
|
|
75
49
|
}
|
|
76
50
|
if (Array.isArray(audPayload)) {
|
|
77
|
-
return audOption.some(
|
|
51
|
+
return audOption.some((aud) => audPayload.includes(aud));
|
|
78
52
|
}
|
|
79
53
|
return false;
|
|
80
54
|
};
|
|
55
|
+
function validateNumericDate(payload, claim, required = false) {
|
|
56
|
+
const value = payload[claim];
|
|
57
|
+
if (value === undefined && !required)
|
|
58
|
+
return undefined;
|
|
59
|
+
if (typeof value !== 'number') {
|
|
60
|
+
throw new JWTClaimValidationFailed(`"${claim}" claim must be a number`, payload, claim, 'invalid');
|
|
61
|
+
}
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
function unexpectedClaim(payload, claim) {
|
|
65
|
+
throw new JWTClaimValidationFailed(`unexpected "${claim}" claim value`, payload, claim, checkFailed);
|
|
66
|
+
}
|
|
81
67
|
export function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
|
|
82
68
|
let payload;
|
|
83
69
|
try {
|
|
84
|
-
payload = JSON.parse(
|
|
70
|
+
payload = JSON.parse(strictDecoder.decode(encodedPayload));
|
|
85
71
|
}
|
|
86
72
|
catch {
|
|
87
73
|
}
|
|
@@ -92,7 +78,7 @@ export function validateClaimsSet(protectedHeader, encodedPayload, options = {})
|
|
|
92
78
|
if (typ &&
|
|
93
79
|
(typeof protectedHeader.typ !== 'string' ||
|
|
94
80
|
normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) {
|
|
95
|
-
throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', payload, 'typ',
|
|
81
|
+
throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', payload, 'typ', checkFailed);
|
|
96
82
|
}
|
|
97
83
|
const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;
|
|
98
84
|
const presenceCheck = [...requiredClaims];
|
|
@@ -105,64 +91,56 @@ export function validateClaimsSet(protectedHeader, encodedPayload, options = {})
|
|
|
105
91
|
if (issuer !== undefined)
|
|
106
92
|
presenceCheck.push('iss');
|
|
107
93
|
for (const claim of new Set(presenceCheck.reverse())) {
|
|
108
|
-
if (!(claim
|
|
94
|
+
if (!Object.hasOwn(payload, claim)) {
|
|
109
95
|
throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, payload, claim, 'missing');
|
|
110
96
|
}
|
|
111
97
|
}
|
|
112
|
-
if (issuer &&
|
|
98
|
+
if (issuer !== undefined &&
|
|
113
99
|
!(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
|
|
114
|
-
|
|
100
|
+
unexpectedClaim(payload, 'iss');
|
|
115
101
|
}
|
|
116
|
-
if (subject && payload.sub !== subject) {
|
|
117
|
-
|
|
102
|
+
if (subject !== undefined && payload.sub !== subject) {
|
|
103
|
+
unexpectedClaim(payload, 'sub');
|
|
118
104
|
}
|
|
119
|
-
if (audience &&
|
|
105
|
+
if (audience !== undefined &&
|
|
120
106
|
!checkAudiencePresence(payload.aud, typeof audience === 'string' ? [audience] : audience)) {
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
let tolerance;
|
|
124
|
-
switch (typeof options.clockTolerance) {
|
|
125
|
-
case 'string':
|
|
126
|
-
tolerance = secs(options.clockTolerance);
|
|
127
|
-
break;
|
|
128
|
-
case 'number':
|
|
129
|
-
tolerance = options.clockTolerance;
|
|
130
|
-
break;
|
|
131
|
-
case 'undefined':
|
|
132
|
-
tolerance = 0;
|
|
133
|
-
break;
|
|
134
|
-
default:
|
|
135
|
-
throw new TypeError('Invalid clockTolerance option type');
|
|
107
|
+
unexpectedClaim(payload, 'aud');
|
|
136
108
|
}
|
|
137
|
-
const {
|
|
138
|
-
|
|
139
|
-
if (
|
|
140
|
-
|
|
109
|
+
const { clockTolerance } = options;
|
|
110
|
+
let tolerance = 0;
|
|
111
|
+
if (typeof clockTolerance === 'string') {
|
|
112
|
+
tolerance = secs(clockTolerance);
|
|
141
113
|
}
|
|
142
|
-
if (
|
|
143
|
-
if (typeof
|
|
144
|
-
throw new
|
|
145
|
-
}
|
|
146
|
-
if (payload.nbf > now + tolerance) {
|
|
147
|
-
throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', payload, 'nbf', 'check_failed');
|
|
114
|
+
else if (clockTolerance !== undefined) {
|
|
115
|
+
if (typeof clockTolerance !== 'number') {
|
|
116
|
+
throw new TypeError('Invalid clockTolerance option type');
|
|
148
117
|
}
|
|
118
|
+
tolerance = clockTolerance;
|
|
149
119
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
120
|
+
validateInput('clockTolerance option', tolerance);
|
|
121
|
+
const { currentDate } = options;
|
|
122
|
+
const now = validateInput('currentDate option', epoch(currentDate || new Date()));
|
|
123
|
+
const iat = validateNumericDate(payload, 'iat', maxTokenAge !== undefined);
|
|
124
|
+
const nbf = validateNumericDate(payload, 'nbf');
|
|
125
|
+
if (nbf !== undefined) {
|
|
126
|
+
if (nbf > now + tolerance) {
|
|
127
|
+
throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', payload, 'nbf', checkFailed);
|
|
153
128
|
}
|
|
154
|
-
|
|
155
|
-
|
|
129
|
+
}
|
|
130
|
+
const exp = validateNumericDate(payload, 'exp');
|
|
131
|
+
if (exp !== undefined) {
|
|
132
|
+
if (exp <= now - tolerance) {
|
|
133
|
+
throw new JWTExpired('"exp" claim timestamp check failed', payload, 'exp', checkFailed);
|
|
156
134
|
}
|
|
157
135
|
}
|
|
158
|
-
if (maxTokenAge) {
|
|
159
|
-
const age = now -
|
|
136
|
+
if (maxTokenAge !== undefined) {
|
|
137
|
+
const age = now - iat;
|
|
160
138
|
const max = typeof maxTokenAge === 'number' ? maxTokenAge : secs(maxTokenAge);
|
|
161
139
|
if (age - tolerance > max) {
|
|
162
|
-
throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', payload, 'iat',
|
|
140
|
+
throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', payload, 'iat', checkFailed);
|
|
163
141
|
}
|
|
164
142
|
if (age < 0 - tolerance) {
|
|
165
|
-
throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', payload, 'iat',
|
|
143
|
+
throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', payload, 'iat', checkFailed);
|
|
166
144
|
}
|
|
167
145
|
}
|
|
168
146
|
return payload;
|
|
@@ -200,39 +178,20 @@ export class JWTClaimsBuilder {
|
|
|
200
178
|
this.#payload.jti = value;
|
|
201
179
|
}
|
|
202
180
|
set nbf(value) {
|
|
203
|
-
|
|
204
|
-
this.#payload.nbf = validateInput('setNotBefore', value);
|
|
205
|
-
}
|
|
206
|
-
else if (value instanceof Date) {
|
|
207
|
-
this.#payload.nbf = validateInput('setNotBefore', epoch(value));
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
this.#payload.nbf = epoch(new Date()) + secs(value);
|
|
211
|
-
}
|
|
181
|
+
this.#payload.nbf = numericDate(value, 'setNotBefore');
|
|
212
182
|
}
|
|
213
183
|
set exp(value) {
|
|
214
|
-
|
|
215
|
-
this.#payload.exp = validateInput('setExpirationTime', value);
|
|
216
|
-
}
|
|
217
|
-
else if (value instanceof Date) {
|
|
218
|
-
this.#payload.exp = validateInput('setExpirationTime', epoch(value));
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
this.#payload.exp = epoch(new Date()) + secs(value);
|
|
222
|
-
}
|
|
184
|
+
this.#payload.exp = numericDate(value, 'setExpirationTime');
|
|
223
185
|
}
|
|
224
186
|
set iat(value) {
|
|
225
187
|
if (value === undefined) {
|
|
226
188
|
this.#payload.iat = epoch(new Date());
|
|
227
189
|
}
|
|
228
|
-
else if (value instanceof Date) {
|
|
229
|
-
this.#payload.iat = validateInput('setIssuedAt', epoch(value));
|
|
230
|
-
}
|
|
231
190
|
else if (typeof value === 'string') {
|
|
232
191
|
this.#payload.iat = validateInput('setIssuedAt', epoch(new Date()) + secs(value));
|
|
233
192
|
}
|
|
234
193
|
else {
|
|
235
|
-
this.#payload.iat =
|
|
194
|
+
this.#payload.iat = numericDate(value, 'setIssuedAt');
|
|
236
195
|
}
|
|
237
196
|
}
|
|
238
197
|
}
|