@zuplo/cli 7.4.4 → 7.4.6
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/dist/common/settings.d.ts +1 -0
- package/dist/common/settings.d.ts.map +1 -1
- package/dist/common/settings.js +3 -0
- package/dist/common/settings.js.map +1 -1
- package/dist/deploy/classify-build-probe.d.ts +14 -0
- package/dist/deploy/classify-build-probe.d.ts.map +1 -0
- package/dist/deploy/classify-build-probe.js +35 -0
- package/dist/deploy/classify-build-probe.js.map +1 -0
- package/dist/deploy/classify-build-probe.test.d.ts +2 -0
- package/dist/deploy/classify-build-probe.test.d.ts.map +1 -0
- package/dist/deploy/classify-build-probe.test.js +51 -0
- package/dist/deploy/classify-build-probe.test.js.map +1 -0
- package/dist/deploy/handler.js +20 -5
- package/dist/deploy/handler.js.map +1 -1
- package/dist/deploy/poll-deployment.d.ts +8 -4
- package/dist/deploy/poll-deployment.d.ts.map +1 -1
- package/dist/deploy/poll-deployment.js +32 -4
- package/dist/deploy/poll-deployment.js.map +1 -1
- package/dist/deploy/poll-deployment.test.d.ts +2 -0
- package/dist/deploy/poll-deployment.test.d.ts.map +1 -0
- package/dist/deploy/poll-deployment.test.js +158 -0
- package/dist/deploy/poll-deployment.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwks/remote.d.ts +4 -4
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jws/general/verify.d.ts +3 -3
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/encrypt.d.ts +8 -14
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/sign.d.ts +8 -14
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/unsecured.d.ts +9 -15
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +30 -8
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +8 -4
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +6 -13
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/general/decrypt.js +19 -19
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/general/encrypt.js +27 -20
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwk/embedded.js +15 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwk/thumbprint.js +11 -5
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/local.js +45 -53
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/remote.js +82 -103
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/compact/sign.js +10 -9
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/flattened/sign.js +2 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/flattened/verify.js +8 -7
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/general/sign.js +5 -3
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/general/verify.js +51 -21
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/decrypt.js +7 -9
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/encrypt.js +21 -50
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/sign.js +8 -41
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/unsecured.js +21 -42
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/key/generate_key_pair.js +6 -2
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/key/generate_secret.js +7 -6
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/key/import.js +16 -12
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/asn1.js +7 -2
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/content_encryption.js +7 -15
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/deflate.js +8 -0
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/helpers.js +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +85 -28
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +40 -12
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwk_metadata.js +20 -0
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jws_sign.js +47 -36
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jws_verify.js +77 -45
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +82 -47
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key.js +24 -9
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key_management.js +10 -4
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key_options.js +6 -0
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/options.js +26 -0
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/type_checks.js +11 -13
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwks/remote.d.ts +4 -4
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/general/verify.d.ts +3 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/encrypt.d.ts +8 -14
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/sign.d.ts +8 -14
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/unsecured.d.ts +9 -15
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +30 -8
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +8 -4
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +6 -13
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/decrypt.js +19 -19
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/encrypt.js +27 -20
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwk/embedded.js +15 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwk/thumbprint.js +11 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/local.js +45 -53
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +82 -103
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/compact/sign.js +10 -9
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/flattened/sign.js +2 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/flattened/verify.js +8 -7
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/general/sign.js +5 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/general/verify.js +51 -21
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/decrypt.js +7 -9
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/encrypt.js +21 -50
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/sign.js +8 -41
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/unsecured.js +21 -42
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/generate_key_pair.js +6 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/generate_secret.js +7 -6
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/import.js +16 -12
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/asn1.js +7 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/content_encryption.js +7 -15
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/deflate.js +8 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/helpers.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +85 -28
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +40 -12
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwk_metadata.js +20 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_sign.js +47 -36
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_verify.js +77 -45
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +82 -47
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key.js +24 -9
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_management.js +10 -4
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_options.js +6 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/options.js +26 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/type_checks.js +11 -13
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/package.json +1 -1
- package/node_modules/@posthog/core/dist/logs/index.js +1 -1
- package/node_modules/@posthog/core/dist/logs/index.mjs +1 -1
- package/node_modules/@posthog/core/dist/logs/logs-utils.d.ts +4 -13
- package/node_modules/@posthog/core/dist/logs/logs-utils.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/logs/logs-utils.js +160 -26
- package/node_modules/@posthog/core/dist/logs/logs-utils.mjs +160 -26
- package/node_modules/@posthog/core/dist/metrics/index.js +1 -1
- package/node_modules/@posthog/core/dist/metrics/index.mjs +1 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts +12 -18
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.js +15 -47
- package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +15 -47
- package/node_modules/@posthog/core/dist/posthog-core.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core.js +12 -7
- package/node_modules/@posthog/core/dist/posthog-core.mjs +12 -7
- package/node_modules/@posthog/core/dist/types.d.ts +4 -1
- package/node_modules/@posthog/core/dist/types.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/utils/index.d.ts +1 -1
- package/node_modules/@posthog/core/dist/utils/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/utils/index.js +14 -24
- package/node_modules/@posthog/core/dist/utils/index.mjs +2 -2
- package/node_modules/@posthog/core/dist/utils/json-utils.d.ts +15 -0
- package/node_modules/@posthog/core/dist/utils/json-utils.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/utils/json-utils.js +24 -0
- package/node_modules/@posthog/core/dist/utils/json-utils.mjs +1 -1
- package/node_modules/@posthog/core/package.json +2 -2
- package/node_modules/@posthog/core/src/logs/index.spec.ts +77 -0
- package/node_modules/@posthog/core/src/logs/index.ts +2 -2
- package/node_modules/@posthog/core/src/logs/logs-utils.spec.ts +314 -9
- package/node_modules/@posthog/core/src/logs/logs-utils.ts +215 -27
- package/node_modules/@posthog/core/src/metrics/index.spec.ts +15 -1
- package/node_modules/@posthog/core/src/metrics/index.ts +1 -1
- package/node_modules/@posthog/core/src/posthog-core-stateless.ts +40 -65
- package/node_modules/@posthog/core/src/posthog-core.ts +19 -12
- package/node_modules/@posthog/core/src/types.ts +3 -1
- package/node_modules/@posthog/core/src/utils/index.ts +3 -1
- package/node_modules/@posthog/core/src/utils/json-utils.ts +15 -8
- package/node_modules/@posthog/types/dist/capture-log.d.ts +10 -1
- package/node_modules/@posthog/types/dist/capture-log.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/index.d.ts +1 -1
- package/node_modules/@posthog/types/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/posthog-config.d.ts +20 -5
- package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/capture-log.ts +8 -1
- package/node_modules/@posthog/types/src/index.ts +1 -0
- package/node_modules/@posthog/types/src/posthog-config.ts +21 -5
- package/node_modules/@zuplo/core/customer.cli.minified.js +1 -1
- package/node_modules/@zuplo/core/index.minified.js +1 -1
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-IZE65N7D.js → chunk-CUK3VROF.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-4CDML74A.js → chunk-K4TBJG47.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-4VE55TG3.js → chunk-S4EBLGSU.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-4POCC75H.js → chunk-XF3IIUDX.js} +4 -4
- package/node_modules/@zuplo/runtime/out/esm/{chunk-4POCC75H.js.map → chunk-XF3IIUDX.js.map} +1 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-ZPOD3IK4.js +403 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-ZPOD3IK4.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/node_modules/fast-uri/index.js +201 -48
- package/node_modules/fast-uri/lib/schemes.js +9 -4
- package/node_modules/fast-uri/lib/utils.js +388 -91
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/component-safe-serialization.test.js +105 -0
- package/node_modules/fast-uri/test/equal.test.js +31 -3
- package/node_modules/fast-uri/test/fixtures/uri-js-parse.json +2 -0
- package/node_modules/fast-uri/test/ipv6-canonical.test.js +34 -0
- package/node_modules/fast-uri/test/ipv6-validation.test.js +90 -0
- package/node_modules/fast-uri/test/malformed-percent.test.js +77 -0
- package/node_modules/fast-uri/test/malformed-urn.test.js +61 -0
- package/node_modules/fast-uri/test/parse.test.js +7 -3
- package/node_modules/fast-uri/test/query-fragment-normalization.test.js +33 -0
- package/node_modules/fast-uri/test/reserved-path-normalization.test.js +109 -0
- package/node_modules/fast-uri/test/scheme-validation.test.js +124 -0
- package/node_modules/fast-uri/test/security-normalization.test.js +101 -0
- package/node_modules/fast-uri/test/security.test.js +75 -3
- package/node_modules/fast-uri/test/urn-full-input.test.js +29 -0
- package/node_modules/fast-uri/test/websocket-query-preservation.test.js +24 -0
- package/node_modules/hono/dist/cjs/client/client.js +25 -11
- package/node_modules/hono/dist/cjs/client/utils.js +3 -0
- package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +36 -2
- package/node_modules/hono/dist/cjs/jsx/dom/render.js +2 -0
- package/node_modules/hono/dist/cjs/middleware/etag/index.js +1 -1
- package/node_modules/hono/dist/cjs/request.js +8 -4
- package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +10 -3
- package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +47 -83
- package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +2 -1
- package/node_modules/hono/dist/cjs/router/trie-router/node.js +4 -3
- package/node_modules/hono/dist/cjs/router/utils.js +27 -0
- package/node_modules/hono/dist/cjs/utils/cookie.js +1 -1
- package/node_modules/hono/dist/cjs/utils/stream.js +7 -1
- package/node_modules/hono/dist/client/client.js +25 -11
- package/node_modules/hono/dist/client/utils.js +3 -0
- package/node_modules/hono/dist/helper/accepts/accepts.js +36 -2
- package/node_modules/hono/dist/jsx/dom/render.js +2 -0
- package/node_modules/hono/dist/middleware/etag/index.js +1 -1
- package/node_modules/hono/dist/request.js +8 -4
- package/node_modules/hono/dist/router/reg-exp-router/node.js +6 -2
- package/node_modules/hono/dist/router/reg-exp-router/router.js +53 -84
- package/node_modules/hono/dist/router/reg-exp-router/trie.js +2 -1
- package/node_modules/hono/dist/router/trie-router/node.js +4 -3
- package/node_modules/hono/dist/router/utils.js +5 -0
- package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +3 -0
- package/node_modules/hono/dist/types/router/utils.d.ts +1 -0
- package/node_modules/hono/dist/utils/cookie.js +1 -1
- package/node_modules/hono/dist/utils/stream.js +7 -1
- package/node_modules/hono/package.json +1 -1
- package/package.json +11 -11
- package/node_modules/@zuplo/runtime/out/esm/chunk-4SX4HBWT.js +0 -409
- package/node_modules/@zuplo/runtime/out/esm/chunk-4SX4HBWT.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-IZE65N7D.js.map → chunk-CUK3VROF.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-4CDML74A.js.map → chunk-K4TBJG47.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-4VE55TG3.js.map → chunk-S4EBLGSU.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-4POCC75H.js.LEGAL.txt → chunk-XF3IIUDX.js.LEGAL.txt} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-4SX4HBWT.js.LEGAL.txt → chunk-ZPOD3IK4.js.LEGAL.txt} +0 -0
|
@@ -12,13 +12,22 @@ const multipliers = {
|
|
|
12
12
|
};
|
|
13
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
14
|
const checkFailed = 'check_failed';
|
|
15
|
+
function invalidDuration() {
|
|
16
|
+
throw new TypeError('Invalid time period format');
|
|
17
|
+
}
|
|
15
18
|
export function secs(str) {
|
|
19
|
+
if (typeof str !== 'string') {
|
|
20
|
+
invalidDuration();
|
|
21
|
+
}
|
|
16
22
|
const matched = REGEX.exec(str);
|
|
17
23
|
if (!matched || (matched[4] && matched[1])) {
|
|
18
|
-
|
|
24
|
+
invalidDuration();
|
|
19
25
|
}
|
|
20
26
|
const value = parseFloat(matched[2]);
|
|
21
27
|
const numericDate = Math.round(value * multipliers[matched[3][0].toLowerCase()]);
|
|
28
|
+
if (!Number.isFinite(numericDate)) {
|
|
29
|
+
invalidDuration();
|
|
30
|
+
}
|
|
22
31
|
if (matched[1] === '-' || matched[4] === 'ago') {
|
|
23
32
|
return -numericDate;
|
|
24
33
|
}
|
|
@@ -30,6 +39,17 @@ function validateInput(label, input) {
|
|
|
30
39
|
}
|
|
31
40
|
return input;
|
|
32
41
|
}
|
|
42
|
+
function validateStringClaim(claim, value) {
|
|
43
|
+
if (typeof value !== 'string') {
|
|
44
|
+
throw new TypeError(`"${claim}" claim must be a string`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function validateAudienceClaim(value) {
|
|
48
|
+
if (typeof value !== 'string' &&
|
|
49
|
+
(!Array.isArray(value) || Array.from(value).some((member) => typeof member !== 'string'))) {
|
|
50
|
+
throw new TypeError('"aud" claim must be a string or an array of strings');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
33
53
|
function numericDate(value, label) {
|
|
34
54
|
if (typeof value === 'number')
|
|
35
55
|
return validateInput(label, value);
|
|
@@ -38,10 +58,8 @@ function numericDate(value, label) {
|
|
|
38
58
|
return epoch(new Date()) + secs(value);
|
|
39
59
|
}
|
|
40
60
|
const normalizeTyp = (value) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
return `application/${value.toLowerCase()}`;
|
|
61
|
+
const normalized = value.toLowerCase();
|
|
62
|
+
return value.includes('/') ? normalized : `application/${normalized}`;
|
|
45
63
|
};
|
|
46
64
|
const checkAudiencePresence = (audPayload, audOption) => {
|
|
47
65
|
if (typeof audPayload === 'string') {
|
|
@@ -75,7 +93,7 @@ export function validateClaimsSet(protectedHeader, encodedPayload, options = {})
|
|
|
75
93
|
throw new JWTInvalid('JWT Claims Set must be a top-level JSON object');
|
|
76
94
|
}
|
|
77
95
|
const { typ } = options;
|
|
78
|
-
if (typ &&
|
|
96
|
+
if (typ !== undefined &&
|
|
79
97
|
(typeof protectedHeader.typ !== 'string' ||
|
|
80
98
|
normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) {
|
|
81
99
|
throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', payload, 'typ', checkFailed);
|
|
@@ -119,7 +137,7 @@ export function validateClaimsSet(protectedHeader, encodedPayload, options = {})
|
|
|
119
137
|
}
|
|
120
138
|
validateInput('clockTolerance option', tolerance);
|
|
121
139
|
const { currentDate } = options;
|
|
122
|
-
const now = validateInput('currentDate option', epoch(currentDate
|
|
140
|
+
const now = validateInput('currentDate option', epoch(currentDate === undefined ? new Date() : currentDate));
|
|
123
141
|
const iat = validateNumericDate(payload, 'iat', maxTokenAge !== undefined);
|
|
124
142
|
const nbf = validateNumericDate(payload, 'nbf');
|
|
125
143
|
if (nbf !== undefined) {
|
|
@@ -135,63 +153,80 @@ export function validateClaimsSet(protectedHeader, encodedPayload, options = {})
|
|
|
135
153
|
}
|
|
136
154
|
if (maxTokenAge !== undefined) {
|
|
137
155
|
const age = now - iat;
|
|
138
|
-
const max = typeof maxTokenAge === 'number' ? maxTokenAge : secs(maxTokenAge);
|
|
156
|
+
const max = validateInput('maxTokenAge option', typeof maxTokenAge === 'number' ? maxTokenAge : secs(maxTokenAge));
|
|
139
157
|
if (age - tolerance > max) {
|
|
140
158
|
throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', payload, 'iat', checkFailed);
|
|
141
159
|
}
|
|
142
|
-
if (age <
|
|
160
|
+
if (age < -tolerance) {
|
|
143
161
|
throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', payload, 'iat', checkFailed);
|
|
144
162
|
}
|
|
145
163
|
}
|
|
146
164
|
return payload;
|
|
147
165
|
}
|
|
166
|
+
let producerPayloads;
|
|
167
|
+
function producerPayload(producer) {
|
|
168
|
+
return producerPayloads.get(producer);
|
|
169
|
+
}
|
|
170
|
+
export function jwtData(producer) {
|
|
171
|
+
const payload = producerPayload(producer);
|
|
172
|
+
for (const claim of ['iat', 'nbf', 'exp']) {
|
|
173
|
+
const value = payload[claim];
|
|
174
|
+
if (typeof value === 'number' && !Number.isFinite(value)) {
|
|
175
|
+
throw new TypeError(`"${claim}" claim must be a finite number`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return encoder.encode(JSON.stringify(payload));
|
|
179
|
+
}
|
|
180
|
+
export function jwtClaim(producer, claim) {
|
|
181
|
+
return producerPayload(producer)[claim];
|
|
182
|
+
}
|
|
148
183
|
export class JWTClaimsBuilder {
|
|
149
|
-
|
|
150
|
-
constructor(payload) {
|
|
184
|
+
constructor(payload = {}) {
|
|
151
185
|
if (!isObject(payload)) {
|
|
152
186
|
throw new TypeError('JWT Claims Set MUST be an object');
|
|
153
187
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
return this
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
this
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
this
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
this
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
188
|
+
;
|
|
189
|
+
(producerPayloads ||= new WeakMap()).set(this, structuredClone(payload));
|
|
190
|
+
}
|
|
191
|
+
setIssuer(value) {
|
|
192
|
+
validateStringClaim('iss', value);
|
|
193
|
+
producerPayload(this).iss = value;
|
|
194
|
+
return this;
|
|
195
|
+
}
|
|
196
|
+
setSubject(value) {
|
|
197
|
+
validateStringClaim('sub', value);
|
|
198
|
+
producerPayload(this).sub = value;
|
|
199
|
+
return this;
|
|
200
|
+
}
|
|
201
|
+
setAudience(value) {
|
|
202
|
+
validateAudienceClaim(value);
|
|
203
|
+
producerPayload(this).aud = value;
|
|
204
|
+
return this;
|
|
205
|
+
}
|
|
206
|
+
setJti(value) {
|
|
207
|
+
validateStringClaim('jti', value);
|
|
208
|
+
producerPayload(this).jti = value;
|
|
209
|
+
return this;
|
|
210
|
+
}
|
|
211
|
+
setNotBefore(value) {
|
|
212
|
+
producerPayload(this).nbf = numericDate(value, 'setNotBefore');
|
|
213
|
+
return this;
|
|
214
|
+
}
|
|
215
|
+
setExpirationTime(value) {
|
|
216
|
+
producerPayload(this).exp = numericDate(value, 'setExpirationTime');
|
|
217
|
+
return this;
|
|
218
|
+
}
|
|
219
|
+
setIssuedAt(value) {
|
|
220
|
+
const payload = producerPayload(this);
|
|
187
221
|
if (value === undefined) {
|
|
188
|
-
|
|
222
|
+
payload.iat = epoch(new Date());
|
|
189
223
|
}
|
|
190
224
|
else if (typeof value === 'string') {
|
|
191
|
-
|
|
225
|
+
payload.iat = validateInput('setIssuedAt', epoch(new Date()) + secs(value));
|
|
192
226
|
}
|
|
193
227
|
else {
|
|
194
|
-
|
|
228
|
+
payload.iat = numericDate(value, 'setIssuedAt');
|
|
195
229
|
}
|
|
230
|
+
return this;
|
|
196
231
|
}
|
|
197
232
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { withAlg as invalidKeyInput } from './invalid_key_input.js';
|
|
2
2
|
import { isKeyLike, isCryptoKey } from './is_key_like.js';
|
|
3
|
-
import
|
|
3
|
+
import { isObject } from './type_checks.js';
|
|
4
4
|
import { decode } from '../util/base64url.js';
|
|
5
5
|
import { jwkToKey } from './jwk_to_key.js';
|
|
6
|
+
import { normalizeJwk } from './jwk_metadata.js';
|
|
6
7
|
const tag = (key) => key[Symbol.toStringTag];
|
|
7
8
|
const jwkMatchesOp = (entry, key, usage) => {
|
|
8
9
|
const { alg } = entry;
|
|
@@ -27,14 +28,27 @@ export function checkKeyType(entry, key, usage) {
|
|
|
27
28
|
const privateKey = usage === 'decrypt' || usage === 'sign';
|
|
28
29
|
if (secret && key instanceof Uint8Array)
|
|
29
30
|
return [BYTES, key];
|
|
30
|
-
if (
|
|
31
|
-
|
|
31
|
+
if (isObject(key)) {
|
|
32
|
+
const normalized = normalizeJwk(key);
|
|
33
|
+
if (typeof normalized.kty !== 'string') {
|
|
34
|
+
throw new TypeError(secret
|
|
35
|
+
? invalidKeyInput(alg, key, 'CryptoKey', 'KeyObject', 'JSON Web Key', 'Uint8Array')
|
|
36
|
+
: invalidKeyInput(alg, key, 'CryptoKey', 'KeyObject', 'JSON Web Key'));
|
|
37
|
+
}
|
|
38
|
+
const valid = secret
|
|
39
|
+
? normalized.kty === 'oct' && typeof normalized.k === 'string'
|
|
40
|
+
: normalized.kty !== 'oct' &&
|
|
41
|
+
(privateKey
|
|
42
|
+
? (normalized.kty === 'AKP' && typeof normalized.priv === 'string') ||
|
|
43
|
+
typeof normalized.d === 'string'
|
|
44
|
+
: normalized.d === undefined && normalized.priv === undefined);
|
|
45
|
+
if (!valid) {
|
|
32
46
|
throw new TypeError(secret
|
|
33
47
|
? `JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`
|
|
34
48
|
: `JSON Web Key for this operation must be a ${privateKey ? 'private' : 'public'} JWK`);
|
|
35
49
|
}
|
|
36
|
-
jwkMatchesOp(entry,
|
|
37
|
-
return [JWK, key];
|
|
50
|
+
jwkMatchesOp(entry, normalized, usage);
|
|
51
|
+
return [JWK, key, normalized];
|
|
38
52
|
}
|
|
39
53
|
if (!isKeyLike(key)) {
|
|
40
54
|
throw new TypeError(secret
|
|
@@ -81,7 +95,7 @@ function cached(key, alg, value) {
|
|
|
81
95
|
entry[alg] = value;
|
|
82
96
|
}
|
|
83
97
|
else {
|
|
84
|
-
cache.set(key, {
|
|
98
|
+
cache.set(key, { [alg]: value });
|
|
85
99
|
}
|
|
86
100
|
}
|
|
87
101
|
return value ?? entry?.[alg];
|
|
@@ -107,8 +121,9 @@ export async function prepareKey(entry, key, usage) {
|
|
|
107
121
|
return tagged[1];
|
|
108
122
|
case JWK: {
|
|
109
123
|
const key = tagged[1];
|
|
110
|
-
|
|
111
|
-
|
|
124
|
+
const normalized = tagged[2];
|
|
125
|
+
if (normalized.kty === 'oct') {
|
|
126
|
+
return decode(normalized.k);
|
|
112
127
|
}
|
|
113
128
|
if (!Object.isFrozen(key)) {
|
|
114
129
|
const { key_ops } = key;
|
|
@@ -116,7 +131,7 @@ export async function prepareKey(entry, key, usage) {
|
|
|
116
131
|
Object.freeze(key_ops);
|
|
117
132
|
Object.freeze(key);
|
|
118
133
|
}
|
|
119
|
-
return handleJWK(key,
|
|
134
|
+
return handleJWK(key, normalized, entry);
|
|
120
135
|
}
|
|
121
136
|
case KEYOBJECT: {
|
|
122
137
|
const keyObject = tagged[1];
|
|
@@ -5,7 +5,7 @@ import { jweAlgorithm, jweEncryption } from './jwe_algorithms.js';
|
|
|
5
5
|
import { JOSENotSupported, JWEInvalid } from '../util/errors.js';
|
|
6
6
|
import { decodeBase64url, digest } from './helpers.js';
|
|
7
7
|
import { generateCek, encrypt, decrypt } from './content_encryption.js';
|
|
8
|
-
import { isObject } from './type_checks.js';
|
|
8
|
+
import { assertUint8Array, isObject } from './type_checks.js';
|
|
9
9
|
import { checkCryptoKey, checkModulusLength, checkUsage } from './crypto_key.js';
|
|
10
10
|
import { concat, encode, uint32be } from './buffer_utils.js';
|
|
11
11
|
import { assertCryptoKey } from './is_key_like.js';
|
|
@@ -110,7 +110,7 @@ function assertNoEncryptedKey(encryptedKey) {
|
|
|
110
110
|
if (encryptedKey !== undefined)
|
|
111
111
|
throw new JWEInvalid('Encountered unexpected JWE Encrypted Key');
|
|
112
112
|
}
|
|
113
|
-
export async function decryptKeyManagement(alg, enc, key, encryptedKey, joseHeader,
|
|
113
|
+
export async function decryptKeyManagement(alg, enc, key, encryptedKey, joseHeader, maxPBES2Count) {
|
|
114
114
|
const entry = jweAlgorithm(alg);
|
|
115
115
|
if (alg === 'dir') {
|
|
116
116
|
assertNoEncryptedKey(encryptedKey);
|
|
@@ -152,7 +152,7 @@ export async function decryptKeyManagement(alg, enc, key, encryptedKey, joseHead
|
|
|
152
152
|
assertEncryptedKey(encryptedKey);
|
|
153
153
|
if (typeof joseHeader.p2c !== 'number')
|
|
154
154
|
throw new JWEInvalid(`JOSE Header "p2c" (PBES2 Count) missing or invalid`);
|
|
155
|
-
const p2cLimit =
|
|
155
|
+
const p2cLimit = maxPBES2Count || 10_000;
|
|
156
156
|
if (joseHeader.p2c > p2cLimit)
|
|
157
157
|
throw new JWEInvalid(`JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds`);
|
|
158
158
|
if (typeof joseHeader.p2s !== 'string')
|
|
@@ -190,8 +190,14 @@ export async function encryptKeyManagement(alg, enc, key, providedCek, providedP
|
|
|
190
190
|
case 'ECDH': {
|
|
191
191
|
assertEcdhKey(key);
|
|
192
192
|
const { apu, apv } = providedParameters;
|
|
193
|
+
if (apu !== undefined) {
|
|
194
|
+
assertUint8Array(apu, '"apu"');
|
|
195
|
+
}
|
|
196
|
+
if (apv !== undefined) {
|
|
197
|
+
assertUint8Array(apv, '"apv"');
|
|
198
|
+
}
|
|
193
199
|
let ephemeralKey;
|
|
194
|
-
if (providedParameters.epk) {
|
|
200
|
+
if (providedParameters.epk !== undefined) {
|
|
195
201
|
ephemeralKey = (await prepareKey(entry, providedParameters.epk, 'decrypt'));
|
|
196
202
|
}
|
|
197
203
|
else {
|
package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/options.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { JOSENotSupported, JWEInvalid, JWSInvalid } from '../util/errors.js';
|
|
2
|
+
import { isObject } from './type_checks.js';
|
|
2
3
|
export const JWS_RECOGNIZED = { __proto__: null, b64: true };
|
|
3
4
|
export const JWE_RECOGNIZED = { __proto__: null };
|
|
4
5
|
export function validateAlgorithms(option, algorithms) {
|
|
@@ -46,3 +47,28 @@ export function validateCrit(Err, recognizedDefault, recognizedOption, protected
|
|
|
46
47
|
}
|
|
47
48
|
return protectedHeader.crit;
|
|
48
49
|
}
|
|
50
|
+
export function validateB64(protectedHeader, extensions) {
|
|
51
|
+
if (extensions.includes('b64')) {
|
|
52
|
+
const b64 = protectedHeader.b64;
|
|
53
|
+
if (typeof b64 !== 'boolean') {
|
|
54
|
+
throw new JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
55
|
+
}
|
|
56
|
+
return b64;
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
export function serializeJoseHeader(Err, header) {
|
|
61
|
+
let serialized;
|
|
62
|
+
let parsed;
|
|
63
|
+
try {
|
|
64
|
+
serialized = JSON.stringify(header);
|
|
65
|
+
parsed = JSON.parse(serialized);
|
|
66
|
+
}
|
|
67
|
+
catch (cause) {
|
|
68
|
+
throw new Err('JOSE Header is not valid JSON', { cause });
|
|
69
|
+
}
|
|
70
|
+
if (!isObject(parsed)) {
|
|
71
|
+
throw new Err('JOSE Header is not a JSON object');
|
|
72
|
+
}
|
|
73
|
+
return [parsed, serialized];
|
|
74
|
+
}
|
package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/type_checks.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export function assertUint8Array(input, label) {
|
|
2
|
+
if (!(input instanceof Uint8Array)) {
|
|
3
|
+
throw new TypeError(`${label} must be an instance of Uint8Array`);
|
|
4
|
+
}
|
|
5
|
+
}
|
|
1
6
|
export function isObject(input) {
|
|
2
7
|
if (typeof input !== 'object' ||
|
|
3
8
|
input === null ||
|
|
@@ -5,14 +10,12 @@ export function isObject(input) {
|
|
|
5
10
|
return false;
|
|
6
11
|
}
|
|
7
12
|
const prototype = Object.getPrototypeOf(input);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
return prototype === proto;
|
|
13
|
+
return prototype === null || Object.getPrototypeOf(prototype) === null;
|
|
14
|
+
}
|
|
15
|
+
export function isJwkSet(input) {
|
|
16
|
+
return (isObject(input) &&
|
|
17
|
+
Array.isArray(input.keys) &&
|
|
18
|
+
Array.from(input.keys).every(isObject));
|
|
16
19
|
}
|
|
17
20
|
export function isDisjoint(...headers) {
|
|
18
21
|
const parameters = new Set();
|
|
@@ -28,8 +31,3 @@ export function isDisjoint(...headers) {
|
|
|
28
31
|
}
|
|
29
32
|
return true;
|
|
30
33
|
}
|
|
31
|
-
export const isJWK = (key) => isObject(key) && typeof key.kty === 'string';
|
|
32
|
-
export const isPrivateJWK = (key) => key.kty !== 'oct' &&
|
|
33
|
-
((key.kty === 'AKP' && typeof key.priv === 'string') || typeof key.d === 'string');
|
|
34
|
-
export const isPublicJWK = (key) => key.kty !== 'oct' && key.d === undefined && key.priv === undefined;
|
|
35
|
-
export const isSecretJWK = (key) => key.kty === 'oct' && typeof key.k === 'string';
|
package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwks/remote.d.ts
CHANGED
|
@@ -36,17 +36,17 @@ export declare const jwksCache: unique symbol;
|
|
|
36
36
|
export interface RemoteJWKSetOptions {
|
|
37
37
|
/**
|
|
38
38
|
* Timeout (in milliseconds) for the HTTP request. When reached the request will be aborted and
|
|
39
|
-
* the verification will fail. Default is 5000 (5 seconds).
|
|
39
|
+
* the verification will fail. Must be a non-negative integer. Default is 5000 (5 seconds).
|
|
40
40
|
*/
|
|
41
41
|
timeoutDuration?: number;
|
|
42
42
|
/**
|
|
43
43
|
* Duration (in milliseconds) for which no more HTTP requests will be triggered after a previous
|
|
44
|
-
* successful fetch. Default is 30000 (30 seconds).
|
|
44
|
+
* successful fetch. Must not be `NaN`. Default is 30000 (30 seconds).
|
|
45
45
|
*/
|
|
46
46
|
cooldownDuration?: number;
|
|
47
47
|
/**
|
|
48
48
|
* Maximum time (in milliseconds) between successful HTTP requests. Default is 600000 (10
|
|
49
|
-
* minutes).
|
|
49
|
+
* minutes). Must not be `NaN`.
|
|
50
50
|
*/
|
|
51
51
|
cacheMaxAge?: number | typeof Infinity;
|
|
52
52
|
/** Headers to be sent with the HTTP request. */
|
|
@@ -60,7 +60,7 @@ export interface RemoteJWKSetOptions {
|
|
|
60
60
|
export interface ExportedJWKSCache {
|
|
61
61
|
/** Current cached JSON Web Key Set */
|
|
62
62
|
jwks: types.JSONWebKeySet;
|
|
63
|
-
/** Last updated at timestamp (
|
|
63
|
+
/** Last updated at timestamp (milliseconds since epoch) */
|
|
64
64
|
uat: number;
|
|
65
65
|
}
|
|
66
66
|
/** See {@link jwksCache}. */
|
package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/general/verify.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ export interface GeneralVerifyGetKey<KeyType extends types.CryptoKey | Uint8Arra
|
|
|
11
11
|
* > Note: The function iterates over the `signatures` array in the General JWS and returns the verification
|
|
12
12
|
* > result of the first signature entry that can be successfully verified. The result only contains
|
|
13
13
|
* > the payload, protected header, and unprotected header of that successfully verified signature
|
|
14
|
-
* > entry. Other signature entries
|
|
15
|
-
* >
|
|
16
|
-
* > (verified) data.
|
|
14
|
+
* > entry. Other signature entries' headers may be inspected solely to reject inconsistent use of the
|
|
15
|
+
* > JWS Unencoded Payload Option, and their headers are not included in the returned result.
|
|
16
|
+
* > Recipients of a General JWS should only rely on the returned (verified) data.
|
|
17
17
|
*
|
|
18
18
|
* @param jws General JWS.
|
|
19
19
|
* @param key Key to verify the JWS with. See
|
package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/encrypt.d.ts
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import type * as types from '../types.d.ts';
|
|
2
|
+
/**
|
|
3
|
+
* EncryptJWT constructor
|
|
4
|
+
*
|
|
5
|
+
* @param payload The JWT Claims Set object. Defaults to an empty object.
|
|
6
|
+
*/
|
|
7
|
+
declare const EncryptJWT_base: new (payload?: types.JWTPayload) => types.ProduceJWT;
|
|
2
8
|
/** The EncryptJWT class is used to build and encrypt Compact JWE formatted JSON Web Tokens. */
|
|
3
|
-
export declare class EncryptJWT
|
|
9
|
+
export declare class EncryptJWT extends EncryptJWT_base {
|
|
4
10
|
#private;
|
|
5
|
-
/**
|
|
6
|
-
* {@link EncryptJWT} constructor
|
|
7
|
-
*
|
|
8
|
-
* @param payload The JWT Claims Set object. Defaults to an empty object.
|
|
9
|
-
*/
|
|
10
|
-
constructor(payload?: types.JWTPayload);
|
|
11
|
-
setIssuer(issuer: string): this;
|
|
12
|
-
setSubject(subject: string): this;
|
|
13
|
-
setAudience(audience: string | string[]): this;
|
|
14
|
-
setJti(jwtId: string): this;
|
|
15
|
-
setNotBefore(input: number | string | Date): this;
|
|
16
|
-
setExpirationTime(input: number | string | Date): this;
|
|
17
|
-
setIssuedAt(input?: number | string | Date): this;
|
|
18
11
|
/**
|
|
19
12
|
* Sets the JWE Protected Header on the EncryptJWT object.
|
|
20
13
|
*
|
|
@@ -66,3 +59,4 @@ export declare class EncryptJWT implements types.ProduceJWT {
|
|
|
66
59
|
*/
|
|
67
60
|
encrypt(key: types.KeyInput, options?: types.EncryptOptions): Promise<string>;
|
|
68
61
|
}
|
|
62
|
+
export {};
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import type * as types from '../types.d.ts';
|
|
2
|
+
/**
|
|
3
|
+
* SignJWT constructor
|
|
4
|
+
*
|
|
5
|
+
* @param payload The JWT Claims Set object. Defaults to an empty object.
|
|
6
|
+
*/
|
|
7
|
+
declare const SignJWT_base: new (payload?: types.JWTPayload) => types.ProduceJWT;
|
|
2
8
|
/** The SignJWT class is used to build and sign Compact JWS formatted JSON Web Tokens. */
|
|
3
|
-
export declare class SignJWT
|
|
9
|
+
export declare class SignJWT extends SignJWT_base {
|
|
4
10
|
#private;
|
|
5
|
-
/**
|
|
6
|
-
* {@link SignJWT} constructor
|
|
7
|
-
*
|
|
8
|
-
* @param payload The JWT Claims Set object. Defaults to an empty object.
|
|
9
|
-
*/
|
|
10
|
-
constructor(payload?: types.JWTPayload);
|
|
11
|
-
setIssuer(issuer: string): this;
|
|
12
|
-
setSubject(subject: string): this;
|
|
13
|
-
setAudience(audience: string | string[]): this;
|
|
14
|
-
setJti(jwtId: string): this;
|
|
15
|
-
setNotBefore(input: number | string | Date): this;
|
|
16
|
-
setExpirationTime(input: number | string | Date): this;
|
|
17
|
-
setIssuedAt(input?: number | string | Date): this;
|
|
18
11
|
/**
|
|
19
12
|
* Sets the JWS Protected Header on the SignJWT object.
|
|
20
13
|
*
|
|
@@ -30,3 +23,4 @@ export declare class SignJWT implements types.ProduceJWT {
|
|
|
30
23
|
*/
|
|
31
24
|
sign(key: types.KeyInput, options?: types.SignOptions): Promise<string>;
|
|
32
25
|
}
|
|
26
|
+
export {};
|
package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/unsecured.d.ts
CHANGED
|
@@ -6,24 +6,17 @@ export interface UnsecuredResult<PayloadType = types.JWTPayload> {
|
|
|
6
6
|
/** The decoded JOSE Header; always `{ "alg": "none" }` for an Unsecured JWT. */
|
|
7
7
|
header: types.JWSHeaderParameters;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* UnsecuredJWT constructor
|
|
11
|
+
*
|
|
12
|
+
* @param payload The JWT Claims Set object. Defaults to an empty object.
|
|
13
|
+
*/
|
|
14
|
+
declare const UnsecuredJWT_base: new (payload?: types.JWTPayload) => types.ProduceJWT;
|
|
9
15
|
/** The UnsecuredJWT class is a utility for dealing with `{ "alg": "none" }` Unsecured JWTs. */
|
|
10
|
-
export declare class UnsecuredJWT
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* {@link UnsecuredJWT} constructor
|
|
14
|
-
*
|
|
15
|
-
* @param payload The JWT Claims Set object. Defaults to an empty object.
|
|
16
|
-
*/
|
|
17
|
-
constructor(payload?: types.JWTPayload);
|
|
16
|
+
export declare class UnsecuredJWT extends UnsecuredJWT_base {
|
|
17
|
+
private jwt;
|
|
18
18
|
/** Encodes the Unsecured JWT. */
|
|
19
19
|
encode(): string;
|
|
20
|
-
setIssuer(issuer: string): this;
|
|
21
|
-
setSubject(subject: string): this;
|
|
22
|
-
setAudience(audience: string | string[]): this;
|
|
23
|
-
setJti(jwtId: string): this;
|
|
24
|
-
setNotBefore(input: number | string | Date): this;
|
|
25
|
-
setExpirationTime(input: number | string | Date): this;
|
|
26
|
-
setIssuedAt(input?: number | string | Date): this;
|
|
27
20
|
/**
|
|
28
21
|
* Decodes an unsecured JWT.
|
|
29
22
|
*
|
|
@@ -32,3 +25,4 @@ export declare class UnsecuredJWT implements types.ProduceJWT {
|
|
|
32
25
|
*/
|
|
33
26
|
static decode<PayloadType = types.JWTPayload>(jwt: string, options?: types.JWTClaimVerificationOptions): UnsecuredResult<PayloadType>;
|
|
34
27
|
}
|
|
28
|
+
export {};
|
package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/compact/encrypt.js
CHANGED
|
@@ -1,27 +1,49 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { assertNotSet } from '../../lib/helpers.js';
|
|
2
|
+
import { assertUint8Array } from '../../lib/type_checks.js';
|
|
3
|
+
import { createJWE } from '../../lib/jwe_encrypt.js';
|
|
2
4
|
export class CompactEncrypt {
|
|
3
|
-
#
|
|
5
|
+
#plaintext;
|
|
6
|
+
#protectedHeader;
|
|
7
|
+
#cek;
|
|
8
|
+
#iv;
|
|
9
|
+
#keyManagementParameters;
|
|
4
10
|
constructor(plaintext) {
|
|
5
|
-
|
|
11
|
+
assertUint8Array(plaintext, 'plaintext');
|
|
12
|
+
this.#plaintext = plaintext;
|
|
6
13
|
}
|
|
7
14
|
setContentEncryptionKey(cek) {
|
|
8
|
-
this.#
|
|
15
|
+
assertNotSet(this.#cek, 'setContentEncryptionKey');
|
|
16
|
+
this.#cek = cek;
|
|
9
17
|
return this;
|
|
10
18
|
}
|
|
11
19
|
setInitializationVector(iv) {
|
|
12
|
-
this.#
|
|
20
|
+
assertNotSet(this.#iv, 'setInitializationVector');
|
|
21
|
+
this.#iv = iv;
|
|
13
22
|
return this;
|
|
14
23
|
}
|
|
15
24
|
setProtectedHeader(protectedHeader) {
|
|
16
|
-
this.#
|
|
25
|
+
assertNotSet(this.#protectedHeader, 'setProtectedHeader');
|
|
26
|
+
this.#protectedHeader = protectedHeader;
|
|
17
27
|
return this;
|
|
18
28
|
}
|
|
19
29
|
setKeyManagementParameters(parameters) {
|
|
20
|
-
this.#
|
|
30
|
+
assertNotSet(this.#keyManagementParameters, 'setKeyManagementParameters');
|
|
31
|
+
this.#keyManagementParameters = parameters;
|
|
21
32
|
return this;
|
|
22
33
|
}
|
|
23
34
|
async encrypt(key, options) {
|
|
24
|
-
const jwe = await
|
|
35
|
+
const jwe = await createJWE([
|
|
36
|
+
this.#plaintext,
|
|
37
|
+
this.#protectedHeader,
|
|
38
|
+
undefined,
|
|
39
|
+
undefined,
|
|
40
|
+
undefined,
|
|
41
|
+
this.#cek,
|
|
42
|
+
this.#iv,
|
|
43
|
+
this.#keyManagementParameters,
|
|
44
|
+
undefined,
|
|
45
|
+
false,
|
|
46
|
+
], key, options);
|
|
25
47
|
return [jwe.protected, jwe.encrypted_key, jwe.iv, jwe.ciphertext, jwe.tag].join('.');
|
|
26
48
|
}
|
|
27
49
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { JWEInvalid } from '../../util/errors.js';
|
|
2
2
|
import { isObject } from '../../lib/type_checks.js';
|
|
3
|
-
import { prepareDecrypt, decryptJWE, decryptResult,
|
|
3
|
+
import { prepareDecrypt, decryptJWE, decryptResult, checkRecipient, snapshotSharedJWE, snapshotRecipientJWE, } from '../../lib/jwe_decrypt.js';
|
|
4
4
|
export async function flattenedDecrypt(jwe, key, options) {
|
|
5
5
|
if (!isObject(jwe)) {
|
|
6
6
|
throw new JWEInvalid('Flattened JWE must be an object');
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const shared = snapshotSharedJWE(jwe);
|
|
9
|
+
const [recipient, , error] = snapshotRecipientJWE(jwe);
|
|
10
|
+
if (!recipient)
|
|
11
|
+
throw error;
|
|
12
|
+
const snapshot = { ...shared, ...recipient };
|
|
13
|
+
checkRecipient(snapshot);
|
|
14
|
+
return decryptResult(snapshot, await decryptJWE(snapshot, prepareDecrypt(options), key));
|
|
11
15
|
}
|