@zuplo/cli 6.73.26 → 6.73.28
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/node_modules/@modelcontextprotocol/sdk/node_modules/jose/README.md +13 -13
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/index.d.ts +6 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +17 -11
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +7 -19
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +17 -11
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +7 -19
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +18 -13
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +20 -21
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwk/embedded.d.ts +8 -12
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwk/thumbprint.d.ts +0 -15
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwks/local.d.ts +12 -21
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwks/remote.d.ts +34 -165
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/compact/sign.d.ts +2 -13
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/compact/verify.d.ts +17 -13
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/flattened/sign.d.ts +2 -13
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/flattened/verify.d.ts +17 -13
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/general/sign.d.ts +16 -17
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/general/verify.d.ts +18 -15
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/decrypt.d.ts +17 -11
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/encrypt.d.ts +10 -34
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/sign.d.ts +2 -13
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/unsecured.d.ts +4 -13
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/verify.d.ts +14 -13
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/export.d.ts +0 -14
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/generate_key_pair.d.ts +7 -14
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/generate_secret.d.ts +16 -14
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/import.d.ts +18 -28
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/types.d.ts +242 -223
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/base64url.d.ts +11 -4
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/decode_jwt.d.ts +1 -9
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/decode_protected_header.d.ts +0 -8
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/errors.d.ts +128 -121
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +3 -21
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +5 -153
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +16 -111
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/decrypt.js +15 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/encrypt.js +33 -48
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwk/embedded.js +5 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/local.js +27 -47
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +3 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/compact/sign.js +5 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/compact/verify.js +3 -15
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/flattened/sign.js +7 -57
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/flattened/verify.js +3 -89
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/general/sign.js +18 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/general/verify.js +21 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/decrypt.js +4 -4
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/sign.js +2 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/unsecured.js +4 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/verify.js +5 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/export.js +34 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/generate_key_pair.js +32 -82
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/import.js +8 -8
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/asn1.js +29 -65
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/buffer_utils.js +1 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/content_encryption.js +20 -77
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/crypto_key.js +13 -127
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/helpers.js +23 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +143 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +181 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +109 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwk_to_key.js +11 -96
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_algorithms.js +74 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_sign.js +68 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_verify.js +108 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +9 -8
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key.js +170 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_algorithm.js +16 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_descriptor.js +7 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_management.js +186 -29
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/{validate_crit.js → options.js} +18 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/signing.js +20 -52
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/base64url.js +11 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/decode_jwt.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/decode_protected_header.js +5 -15
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/errors.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/package.json +2 -4
- package/node_modules/@posthog/types/dist/capture.d.ts +4 -0
- package/node_modules/@posthog/types/dist/capture.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 +50 -2
- package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/session-recording.d.ts +10 -0
- package/node_modules/@posthog/types/dist/session-recording.d.ts.map +1 -1
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/capture.ts +4 -0
- package/node_modules/@posthog/types/src/index.ts +1 -0
- package/node_modules/@posthog/types/src/posthog-config.ts +56 -2
- package/node_modules/@posthog/types/src/session-recording.ts +11 -0
- 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-SL6SOWIV.js → chunk-6SNZ4DOC.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-PEUB7LX7.js → chunk-A3QGJZO7.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/chunk-GWEFPK3R.js +405 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-GWEFPK3R.js.LEGAL.txt +16 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-GWEFPK3R.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-RB2LCXBX.js → chunk-QGAJTUPE.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-V4X24KCQ.js → chunk-QVZD2XRK.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-7WS4HIGR.js → chunk-SH74D236.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-2WLR6ZDZ.js → chunk-TYV53J3B.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-TRBIM47E.js → chunk-UKQQD2JN.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-A3425Z75.js → chunk-VHRZC4UF.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-VCMIY3WJ.js → chunk-YIT72S45.js} +3 -3
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp/messages/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +13 -13
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +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/out/types/index.d.ts +86 -3
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/package.json +6 -6
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/aesgcmkw.js +0 -15
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/aeskw.js +0 -25
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/check_key_type.js +0 -122
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/ecdhes.js +0 -52
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_to_jwk.js +0 -34
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/normalize_key.js +0 -166
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/pbes2kw.js +0 -42
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/rsaes.js +0 -24
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/validate_algorithms.js +0 -10
- package/node_modules/@zuplo/runtime/out/esm/chunk-WK5G5RKI.js +0 -385
- package/node_modules/@zuplo/runtime/out/esm/chunk-WK5G5RKI.js.LEGAL.txt +0 -7
- package/node_modules/@zuplo/runtime/out/esm/chunk-WK5G5RKI.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-SL6SOWIV.js.map → chunk-6SNZ4DOC.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-PEUB7LX7.js.map → chunk-A3QGJZO7.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-RB2LCXBX.js.map → chunk-QGAJTUPE.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-V4X24KCQ.js.map → chunk-QVZD2XRK.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-7WS4HIGR.js.map → chunk-SH74D236.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-2WLR6ZDZ.js.map → chunk-TYV53J3B.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-TRBIM47E.js.map → chunk-UKQQD2JN.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-A3425Z75.js.map → chunk-VHRZC4UF.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-VCMIY3WJ.js.LEGAL.txt → chunk-YIT72S45.js.LEGAL.txt} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-VCMIY3WJ.js.map → chunk-YIT72S45.js.map} +0 -0
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*--------------------------------------------------------------------------------------------*/
|
|
24
24
|
|
|
25
|
-
import{b as l}from"../chunk-
|
|
25
|
+
import{b as l}from"../chunk-SH74D236.js";import{Z as n}from"../chunk-YIT72S45.js";import{a as o}from"../chunk-TYV53J3B.js";function g(u={request:new Request("https://api.example.com")}){let e=[];function t(i){e.push(Promise.resolve(i))}return o(t,"waitUntil"),{context:new s({event:{waitUntil:t},route:u.route}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(g,"createMockContext");var p={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},s=class extends EventTarget{static{o(this,"MockZuploContext")}#e;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=p,parentContext:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:n.console.info,log:n.console.log,debug:n.console.debug,warn:n.console.warn,error:n.console.error,setLogProperties:o(()=>{},"setLogProperties")},this.custom={},this.route=t,this.incomingRequestProperties={asn:1234,asOrganization:"ORGANIZATION",city:"Seattle",region:"Washington",regionCode:"WA",colo:"SEA",continent:"NA",country:"US",postalCode:"98004",metroCode:"SEA",latitude:void 0,longitude:void 0,timezone:void 0,httpProtocol:void 0,clientCert:void 0,clientMtlsVerificationStatus:void 0,clientMtlsVerificationReason:void 0,clientCertFingerprintSha256:void 0,clientCertNotBefore:void 0,clientCertNotAfter:void 0,clientCertIssuerDn:void 0,clientCertSubjectDn:void 0},this.parentContext=r,this.#e=e,this.analyticsContext=new l(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,r){throw new Error("Not implemented")}invokeRoute(e,t){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addEventListener(e,t,r){let d=o(i=>{try{typeof t=="function"?t(i):t.handleEvent(i)}catch(a){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),a}},"wrapped");super.addEventListener(e,d,r)}};export{s as MockZuploContext,g as createMockContext};
|
|
26
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*--------------------------------------------------------------------------------------------*/
|
|
24
24
|
|
|
25
|
-
import{h as a,i as l,j as c,k as o,n as p,o as y,p as m}from"../../chunk-
|
|
25
|
+
import{h as a,i as l,j as c,k as o,n as p,o as y,p as m}from"../../chunk-QVZD2XRK.js";import"../../chunk-UKQQD2JN.js";import"../../chunk-YIT72S45.js";import{a as i}from"../../chunk-TYV53J3B.js";async function g(r,e){let t=typeof e.credentials=="function"?await e.credentials():e.credentials,n=r.method,d=n!=="GET"&&n!=="HEAD"&&r.body!=null?await r.arrayBuffer():null,s=await new o({method:n,url:r.url,headers:r.headers,body:d,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,sessionToken:t.sessionToken,service:e.service,region:e.region,signQuery:e.signQuery}).sign();return new Request(s.url.toString(),{method:s.method,headers:s.headers,body:s.body})}i(g,"signRequest");export{c as AwsClient,o as AwsV4Signer,p as fromTemporaryCredentials,y as fromWebToken,m as fromZuploIdentity,l as getAwsCredentialProvider,a as setAwsCredentialProvider,g as signRequest};
|
|
26
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Attributes } from "@opentelemetry/api";
|
|
2
|
-
import { CallToolRequest } from "@
|
|
3
|
-
import { CallToolResult } from "@
|
|
2
|
+
import type { CallToolRequest } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
4
4
|
import { InboundPolicyHandler as InboundPolicyHandler_2 } from "../../policies.js";
|
|
5
5
|
import { KeyLike } from "jose";
|
|
6
6
|
import { RequestGeneric as RequestGeneric_2 } from "../../request.js";
|
|
@@ -10543,6 +10543,12 @@ declare interface NotFoundOptions {
|
|
|
10543
10543
|
routesMatchedByPathOnly: RouteConfiguration[];
|
|
10544
10544
|
}
|
|
10545
10545
|
|
|
10546
|
+
/**
|
|
10547
|
+
* Where the client credentials are sent on the token request. `body` sends `client_id` and `client_secret` as form parameters. `header` sends them with HTTP Basic authentication as described in RFC 6749 section 2.3.1.
|
|
10548
|
+
* @public
|
|
10549
|
+
*/
|
|
10550
|
+
declare type OAuthClientCredentialsLocation = "body" | "header";
|
|
10551
|
+
|
|
10546
10552
|
/* Excluded from this release type: OAuthProtectedResourceBasePlugin */
|
|
10547
10553
|
|
|
10548
10554
|
/* Excluded from this release type: OAuthProtectedResourceMetadataOptions */
|
|
@@ -15210,6 +15216,83 @@ export declare interface UpstreamGcpServiceAuthInboundPolicyOptions {
|
|
|
15210
15216
|
enableSuspiciousHeaderWarning?: boolean;
|
|
15211
15217
|
}
|
|
15212
15218
|
|
|
15219
|
+
/**
|
|
15220
|
+
* Fetches an access token from any OAuth 2.0 token endpoint using the client
|
|
15221
|
+
* credentials grant and adds it to a header (`Authorization` by default) on
|
|
15222
|
+
* the upstream request. Tokens are cached until shortly before they expire.
|
|
15223
|
+
*
|
|
15224
|
+
* @title Upstream OAuth 2.0 Client Credentials Auth
|
|
15225
|
+
* @product api-gateway
|
|
15226
|
+
* @public
|
|
15227
|
+
* @param request - The ZuploRequest
|
|
15228
|
+
* @param context - The ZuploContext
|
|
15229
|
+
* @param options - The policy options set in policies.json
|
|
15230
|
+
* @param policyName - The name of the policy as set in policies.json
|
|
15231
|
+
* @returns A Request or a Response
|
|
15232
|
+
*/
|
|
15233
|
+
export declare class UpstreamOAuthClientCredentialsInboundPolicy extends InboundPolicy<UpstreamOAuthClientCredentialsInboundPolicyOptions> {
|
|
15234
|
+
#private;
|
|
15235
|
+
static readonly policyType = "upstream-oauth-client-credentials";
|
|
15236
|
+
constructor(
|
|
15237
|
+
options: UpstreamOAuthClientCredentialsInboundPolicyOptions,
|
|
15238
|
+
policyName: string
|
|
15239
|
+
);
|
|
15240
|
+
handler(
|
|
15241
|
+
request: ZuploRequest,
|
|
15242
|
+
context: ZuploContext
|
|
15243
|
+
): Promise<ZuploRequest | Response>;
|
|
15244
|
+
}
|
|
15245
|
+
|
|
15246
|
+
/**
|
|
15247
|
+
* The options for this policy.
|
|
15248
|
+
* @public
|
|
15249
|
+
*/
|
|
15250
|
+
export declare interface UpstreamOAuthClientCredentialsInboundPolicyOptions {
|
|
15251
|
+
/**
|
|
15252
|
+
* The URL of the OAuth 2.0 token endpoint that issues the access token.
|
|
15253
|
+
*/
|
|
15254
|
+
tokenUrl: string;
|
|
15255
|
+
/**
|
|
15256
|
+
* The client ID used to authenticate with the token endpoint.
|
|
15257
|
+
*/
|
|
15258
|
+
clientId: string;
|
|
15259
|
+
/**
|
|
15260
|
+
* The client secret used to authenticate with the token endpoint.
|
|
15261
|
+
*/
|
|
15262
|
+
clientSecret: string;
|
|
15263
|
+
/**
|
|
15264
|
+
* Space-delimited list of scopes to request. When not set, the `scope` parameter is omitted from the token request.
|
|
15265
|
+
*/
|
|
15266
|
+
scope?: string;
|
|
15267
|
+
/**
|
|
15268
|
+
* The value of the `audience` form parameter sent to the token endpoint. Required by some identity providers such as Auth0. When not set, the parameter is omitted from the token request.
|
|
15269
|
+
*/
|
|
15270
|
+
audience?: string;
|
|
15271
|
+
credentialsIn?: OAuthClientCredentialsLocation;
|
|
15272
|
+
/**
|
|
15273
|
+
* Additional form parameters to include in the token request, for example `resource` for identity providers that require it.
|
|
15274
|
+
*/
|
|
15275
|
+
additionalParameters?: {
|
|
15276
|
+
[k: string]: string;
|
|
15277
|
+
};
|
|
15278
|
+
/**
|
|
15279
|
+
* The name of the header on the upstream request that the access token is set on.
|
|
15280
|
+
*/
|
|
15281
|
+
headerName?: string;
|
|
15282
|
+
/**
|
|
15283
|
+
* The scheme that prefixes the access token in the header. When the token response includes a `token_type`, that value is used instead.
|
|
15284
|
+
*/
|
|
15285
|
+
headerScheme?: string;
|
|
15286
|
+
/**
|
|
15287
|
+
* The number of times to retry fetching the token in the event of a failure.
|
|
15288
|
+
*/
|
|
15289
|
+
tokenRetries?: number;
|
|
15290
|
+
/**
|
|
15291
|
+
* The number of seconds less than the token expiration to cache the token.
|
|
15292
|
+
*/
|
|
15293
|
+
expirationOffsetSeconds?: number;
|
|
15294
|
+
}
|
|
15295
|
+
|
|
15213
15296
|
/**
|
|
15214
15297
|
* Generates a Zuplo JWT token and attaches it to the outgoing request. This
|
|
15215
15298
|
* policy creates a self-signed JWT using the Zuplo JWT plugin and adds it
|
|
@@ -16084,7 +16167,7 @@ export declare class ZuploMcpSdk {
|
|
|
16084
16167
|
* Retrieves the MCP request object from the context.
|
|
16085
16168
|
* Use this to access metadata like `_meta` from the incoming tool call.
|
|
16086
16169
|
*
|
|
16087
|
-
* @returns The
|
|
16170
|
+
* @returns The MCP call tool request object or null if not found
|
|
16088
16171
|
*/
|
|
16089
16172
|
getRawCallToolRequest(): CallToolRequest | null;
|
|
16090
16173
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/cli",
|
|
3
|
-
"version": "6.73.
|
|
3
|
+
"version": "6.73.28",
|
|
4
4
|
"repository": "https://github.com/zuplo/zuplo",
|
|
5
5
|
"author": "Zuplo, Inc.",
|
|
6
6
|
"type": "module",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"@opentelemetry/api": "1.9.0",
|
|
28
28
|
"@opentelemetry/api-logs": "0.220.0",
|
|
29
29
|
"@swc/core": "1.10.18",
|
|
30
|
-
"@zuplo/core": "6.73.
|
|
30
|
+
"@zuplo/core": "6.73.28",
|
|
31
31
|
"@zuplo/editor": "1.0.29844086763",
|
|
32
|
-
"@zuplo/openapi-tools": "6.73.
|
|
33
|
-
"@zuplo/runtime": "6.73.
|
|
32
|
+
"@zuplo/openapi-tools": "6.73.28",
|
|
33
|
+
"@zuplo/runtime": "6.73.28",
|
|
34
34
|
"chalk": "5.4.1",
|
|
35
35
|
"chokidar": "3.5.3",
|
|
36
36
|
"cookie": "1.0.2",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"workerd": "1.20241230.0",
|
|
62
62
|
"yargs": "17.7.2",
|
|
63
63
|
"zod": "3.25.76",
|
|
64
|
-
"@zuplo/graphql": "6.73.
|
|
65
|
-
"@zuplo/otel": "6.73.
|
|
64
|
+
"@zuplo/graphql": "6.73.28",
|
|
65
|
+
"@zuplo/otel": "6.73.28"
|
|
66
66
|
},
|
|
67
67
|
"bundleDependencies": [
|
|
68
68
|
"@inquirer/prompts",
|
package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/aesgcmkw.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { encrypt, decrypt } from './content_encryption.js';
|
|
2
|
-
import { encode as b64u } from '../util/base64url.js';
|
|
3
|
-
export async function wrap(alg, key, cek, iv) {
|
|
4
|
-
const jweAlgorithm = alg.slice(0, 7);
|
|
5
|
-
const wrapped = await encrypt(jweAlgorithm, cek, key, iv, new Uint8Array());
|
|
6
|
-
return {
|
|
7
|
-
encryptedKey: wrapped.ciphertext,
|
|
8
|
-
iv: b64u(wrapped.iv),
|
|
9
|
-
tag: b64u(wrapped.tag),
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export async function unwrap(alg, key, encryptedKey, iv, tag) {
|
|
13
|
-
const jweAlgorithm = alg.slice(0, 7);
|
|
14
|
-
return decrypt(jweAlgorithm, key, encryptedKey, iv, tag, new Uint8Array());
|
|
15
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { checkEncCryptoKey } from './crypto_key.js';
|
|
2
|
-
function checkKeySize(key, alg) {
|
|
3
|
-
if (key.algorithm.length !== parseInt(alg.slice(1, 4), 10)) {
|
|
4
|
-
throw new TypeError(`Invalid key size for alg: ${alg}`);
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
function getCryptoKey(key, alg, usage) {
|
|
8
|
-
if (key instanceof Uint8Array) {
|
|
9
|
-
return crypto.subtle.importKey('raw', key, 'AES-KW', true, [usage]);
|
|
10
|
-
}
|
|
11
|
-
checkEncCryptoKey(key, alg, usage);
|
|
12
|
-
return key;
|
|
13
|
-
}
|
|
14
|
-
export async function wrap(alg, key, cek) {
|
|
15
|
-
const cryptoKey = await getCryptoKey(key, alg, 'wrapKey');
|
|
16
|
-
checkKeySize(cryptoKey, alg);
|
|
17
|
-
const cryptoKeyCek = await crypto.subtle.importKey('raw', cek, { hash: 'SHA-256', name: 'HMAC' }, true, ['sign']);
|
|
18
|
-
return new Uint8Array(await crypto.subtle.wrapKey('raw', cryptoKeyCek, cryptoKey, 'AES-KW'));
|
|
19
|
-
}
|
|
20
|
-
export async function unwrap(alg, key, encryptedKey) {
|
|
21
|
-
const cryptoKey = await getCryptoKey(key, alg, 'unwrapKey');
|
|
22
|
-
checkKeySize(cryptoKey, alg);
|
|
23
|
-
const cryptoKeyCek = await crypto.subtle.unwrapKey('raw', encryptedKey, cryptoKey, 'AES-KW', { hash: 'SHA-256', name: 'HMAC' }, true, ['sign']);
|
|
24
|
-
return new Uint8Array(await crypto.subtle.exportKey('raw', cryptoKeyCek));
|
|
25
|
-
}
|
package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/check_key_type.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { withAlg as invalidKeyInput } from './invalid_key_input.js';
|
|
2
|
-
import { isKeyLike } from './is_key_like.js';
|
|
3
|
-
import * as jwk from './type_checks.js';
|
|
4
|
-
const tag = (key) => key?.[Symbol.toStringTag];
|
|
5
|
-
const jwkMatchesOp = (alg, key, usage) => {
|
|
6
|
-
if (key.use !== undefined) {
|
|
7
|
-
let expected;
|
|
8
|
-
switch (usage) {
|
|
9
|
-
case 'sign':
|
|
10
|
-
case 'verify':
|
|
11
|
-
expected = 'sig';
|
|
12
|
-
break;
|
|
13
|
-
case 'encrypt':
|
|
14
|
-
case 'decrypt':
|
|
15
|
-
expected = 'enc';
|
|
16
|
-
break;
|
|
17
|
-
}
|
|
18
|
-
if (key.use !== expected) {
|
|
19
|
-
throw new TypeError(`Invalid key for this operation, its "use" must be "${expected}" when present`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
if (key.alg !== undefined && key.alg !== alg) {
|
|
23
|
-
throw new TypeError(`Invalid key for this operation, its "alg" must be "${alg}" when present`);
|
|
24
|
-
}
|
|
25
|
-
if (Array.isArray(key.key_ops)) {
|
|
26
|
-
let expectedKeyOp;
|
|
27
|
-
switch (true) {
|
|
28
|
-
case usage === 'sign' || usage === 'verify':
|
|
29
|
-
case alg === 'dir':
|
|
30
|
-
case alg.includes('CBC-HS'):
|
|
31
|
-
expectedKeyOp = usage;
|
|
32
|
-
break;
|
|
33
|
-
case alg.startsWith('PBES2'):
|
|
34
|
-
expectedKeyOp = 'deriveBits';
|
|
35
|
-
break;
|
|
36
|
-
case /^A\d{3}(?:GCM)?(?:KW)?$/.test(alg):
|
|
37
|
-
if (!alg.includes('GCM') && alg.endsWith('KW')) {
|
|
38
|
-
expectedKeyOp = usage === 'encrypt' ? 'wrapKey' : 'unwrapKey';
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
expectedKeyOp = usage;
|
|
42
|
-
}
|
|
43
|
-
break;
|
|
44
|
-
case usage === 'encrypt' && alg.startsWith('RSA'):
|
|
45
|
-
expectedKeyOp = 'wrapKey';
|
|
46
|
-
break;
|
|
47
|
-
case usage === 'decrypt':
|
|
48
|
-
expectedKeyOp = alg.startsWith('RSA') ? 'unwrapKey' : 'deriveBits';
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
if (expectedKeyOp && key.key_ops?.includes?.(expectedKeyOp) === false) {
|
|
52
|
-
throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${expectedKeyOp}" when present`);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return true;
|
|
56
|
-
};
|
|
57
|
-
const symmetricTypeCheck = (alg, key, usage) => {
|
|
58
|
-
if (key instanceof Uint8Array)
|
|
59
|
-
return;
|
|
60
|
-
if (jwk.isJWK(key)) {
|
|
61
|
-
if (jwk.isSecretJWK(key) && jwkMatchesOp(alg, key, usage))
|
|
62
|
-
return;
|
|
63
|
-
throw new TypeError(`JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`);
|
|
64
|
-
}
|
|
65
|
-
if (!isKeyLike(key)) {
|
|
66
|
-
throw new TypeError(invalidKeyInput(alg, key, 'CryptoKey', 'KeyObject', 'JSON Web Key', 'Uint8Array'));
|
|
67
|
-
}
|
|
68
|
-
if (key.type !== 'secret') {
|
|
69
|
-
throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type "secret"`);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const asymmetricTypeCheck = (alg, key, usage) => {
|
|
73
|
-
if (jwk.isJWK(key)) {
|
|
74
|
-
switch (usage) {
|
|
75
|
-
case 'decrypt':
|
|
76
|
-
case 'sign':
|
|
77
|
-
if (jwk.isPrivateJWK(key) && jwkMatchesOp(alg, key, usage))
|
|
78
|
-
return;
|
|
79
|
-
throw new TypeError(`JSON Web Key for this operation must be a private JWK`);
|
|
80
|
-
case 'encrypt':
|
|
81
|
-
case 'verify':
|
|
82
|
-
if (jwk.isPublicJWK(key) && jwkMatchesOp(alg, key, usage))
|
|
83
|
-
return;
|
|
84
|
-
throw new TypeError(`JSON Web Key for this operation must be a public JWK`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (!isKeyLike(key)) {
|
|
88
|
-
throw new TypeError(invalidKeyInput(alg, key, 'CryptoKey', 'KeyObject', 'JSON Web Key'));
|
|
89
|
-
}
|
|
90
|
-
if (key.type === 'secret') {
|
|
91
|
-
throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type "secret"`);
|
|
92
|
-
}
|
|
93
|
-
if (key.type === 'public') {
|
|
94
|
-
switch (usage) {
|
|
95
|
-
case 'sign':
|
|
96
|
-
throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type "private"`);
|
|
97
|
-
case 'decrypt':
|
|
98
|
-
throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type "private"`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (key.type === 'private') {
|
|
102
|
-
switch (usage) {
|
|
103
|
-
case 'verify':
|
|
104
|
-
throw new TypeError(`${tag(key)} instances for asymmetric algorithm verifying must be of type "public"`);
|
|
105
|
-
case 'encrypt':
|
|
106
|
-
throw new TypeError(`${tag(key)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
export function checkKeyType(alg, key, usage) {
|
|
111
|
-
switch (alg.substring(0, 2)) {
|
|
112
|
-
case 'A1':
|
|
113
|
-
case 'A2':
|
|
114
|
-
case 'di':
|
|
115
|
-
case 'HS':
|
|
116
|
-
case 'PB':
|
|
117
|
-
symmetricTypeCheck(alg, key, usage);
|
|
118
|
-
break;
|
|
119
|
-
default:
|
|
120
|
-
asymmetricTypeCheck(alg, key, usage);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { encode, concat, uint32be } from './buffer_utils.js';
|
|
2
|
-
import { checkEncCryptoKey } from './crypto_key.js';
|
|
3
|
-
import { digest } from './helpers.js';
|
|
4
|
-
function lengthAndInput(input) {
|
|
5
|
-
return concat(uint32be(input.length), input);
|
|
6
|
-
}
|
|
7
|
-
async function concatKdf(Z, L, OtherInfo) {
|
|
8
|
-
const dkLen = L >> 3;
|
|
9
|
-
const hashLen = 32;
|
|
10
|
-
const reps = Math.ceil(dkLen / hashLen);
|
|
11
|
-
const dk = new Uint8Array(reps * hashLen);
|
|
12
|
-
for (let i = 1; i <= reps; i++) {
|
|
13
|
-
const hashInput = new Uint8Array(4 + Z.length + OtherInfo.length);
|
|
14
|
-
hashInput.set(uint32be(i), 0);
|
|
15
|
-
hashInput.set(Z, 4);
|
|
16
|
-
hashInput.set(OtherInfo, 4 + Z.length);
|
|
17
|
-
const hashResult = await digest('sha256', hashInput);
|
|
18
|
-
dk.set(hashResult, (i - 1) * hashLen);
|
|
19
|
-
}
|
|
20
|
-
return dk.slice(0, dkLen);
|
|
21
|
-
}
|
|
22
|
-
export async function deriveKey(publicKey, privateKey, algorithm, keyLength, apu = new Uint8Array(), apv = new Uint8Array()) {
|
|
23
|
-
checkEncCryptoKey(publicKey, 'ECDH');
|
|
24
|
-
checkEncCryptoKey(privateKey, 'ECDH', 'deriveBits');
|
|
25
|
-
const algorithmID = lengthAndInput(encode(algorithm));
|
|
26
|
-
const partyUInfo = lengthAndInput(apu);
|
|
27
|
-
const partyVInfo = lengthAndInput(apv);
|
|
28
|
-
const suppPubInfo = uint32be(keyLength);
|
|
29
|
-
const suppPrivInfo = new Uint8Array();
|
|
30
|
-
const otherInfo = concat(algorithmID, partyUInfo, partyVInfo, suppPubInfo, suppPrivInfo);
|
|
31
|
-
const Z = new Uint8Array(await crypto.subtle.deriveBits({
|
|
32
|
-
name: publicKey.algorithm.name,
|
|
33
|
-
public: publicKey,
|
|
34
|
-
}, privateKey, getEcdhBitLength(publicKey)));
|
|
35
|
-
return concatKdf(Z, keyLength, otherInfo);
|
|
36
|
-
}
|
|
37
|
-
function getEcdhBitLength(publicKey) {
|
|
38
|
-
if (publicKey.algorithm.name === 'X25519') {
|
|
39
|
-
return 256;
|
|
40
|
-
}
|
|
41
|
-
return (Math.ceil(parseInt(publicKey.algorithm.namedCurve.slice(-3), 10) / 8) << 3);
|
|
42
|
-
}
|
|
43
|
-
export function allowed(key) {
|
|
44
|
-
switch (key.algorithm.namedCurve) {
|
|
45
|
-
case 'P-256':
|
|
46
|
-
case 'P-384':
|
|
47
|
-
case 'P-521':
|
|
48
|
-
return true;
|
|
49
|
-
default:
|
|
50
|
-
return key.algorithm.name === 'X25519';
|
|
51
|
-
}
|
|
52
|
-
}
|
package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_to_jwk.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { invalidKeyInput } from './invalid_key_input.js';
|
|
2
|
-
import { encode as b64u } from '../util/base64url.js';
|
|
3
|
-
import { isCryptoKey, isKeyObject } from './is_key_like.js';
|
|
4
|
-
function omitUndefinedProperties(jwk) {
|
|
5
|
-
return Object.fromEntries(Object.entries(jwk).filter(([, value]) => value !== undefined));
|
|
6
|
-
}
|
|
7
|
-
export async function keyToJWK(key) {
|
|
8
|
-
if (isKeyObject(key)) {
|
|
9
|
-
if (key.type === 'secret') {
|
|
10
|
-
key = key.export();
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
return key.export({ format: 'jwk' });
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
if (key instanceof Uint8Array) {
|
|
17
|
-
return {
|
|
18
|
-
kty: 'oct',
|
|
19
|
-
k: b64u(key),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
if (!isCryptoKey(key)) {
|
|
23
|
-
throw new TypeError(invalidKeyInput(key, 'CryptoKey', 'KeyObject', 'Uint8Array'));
|
|
24
|
-
}
|
|
25
|
-
if (!key.extractable) {
|
|
26
|
-
throw new TypeError('non-extractable CryptoKey cannot be exported as a JWK');
|
|
27
|
-
}
|
|
28
|
-
const { ext, key_ops, alg, use, ...jwk } = omitUndefinedProperties(await crypto.subtle.exportKey('jwk', key));
|
|
29
|
-
if (jwk.kty === 'AKP') {
|
|
30
|
-
;
|
|
31
|
-
jwk.alg = alg;
|
|
32
|
-
}
|
|
33
|
-
return jwk;
|
|
34
|
-
}
|
package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/normalize_key.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { isJWK } from './type_checks.js';
|
|
2
|
-
import { decode } from '../util/base64url.js';
|
|
3
|
-
import { jwkToKey } from './jwk_to_key.js';
|
|
4
|
-
import { isCryptoKey, isKeyObject } from './is_key_like.js';
|
|
5
|
-
const unusableForAlg = 'given KeyObject instance cannot be used for this algorithm';
|
|
6
|
-
let cache;
|
|
7
|
-
const handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
8
|
-
cache ||= new WeakMap();
|
|
9
|
-
let cached = cache.get(key);
|
|
10
|
-
if (cached?.[alg]) {
|
|
11
|
-
return cached[alg];
|
|
12
|
-
}
|
|
13
|
-
const cryptoKey = await jwkToKey({ ...jwk, alg });
|
|
14
|
-
if (freeze)
|
|
15
|
-
Object.freeze(key);
|
|
16
|
-
if (!cached) {
|
|
17
|
-
cache.set(key, { [alg]: cryptoKey });
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
cached[alg] = cryptoKey;
|
|
21
|
-
}
|
|
22
|
-
return cryptoKey;
|
|
23
|
-
};
|
|
24
|
-
const handleKeyObject = (keyObject, alg) => {
|
|
25
|
-
cache ||= new WeakMap();
|
|
26
|
-
let cached = cache.get(keyObject);
|
|
27
|
-
if (cached?.[alg]) {
|
|
28
|
-
return cached[alg];
|
|
29
|
-
}
|
|
30
|
-
const isPublic = keyObject.type === 'public';
|
|
31
|
-
const extractable = isPublic ? true : false;
|
|
32
|
-
let cryptoKey;
|
|
33
|
-
if (keyObject.asymmetricKeyType === 'x25519') {
|
|
34
|
-
switch (alg) {
|
|
35
|
-
case 'ECDH-ES':
|
|
36
|
-
case 'ECDH-ES+A128KW':
|
|
37
|
-
case 'ECDH-ES+A192KW':
|
|
38
|
-
case 'ECDH-ES+A256KW':
|
|
39
|
-
break;
|
|
40
|
-
default:
|
|
41
|
-
throw new TypeError(unusableForAlg);
|
|
42
|
-
}
|
|
43
|
-
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, isPublic ? [] : ['deriveBits']);
|
|
44
|
-
}
|
|
45
|
-
if (keyObject.asymmetricKeyType === 'ed25519') {
|
|
46
|
-
if (alg !== 'EdDSA' && alg !== 'Ed25519') {
|
|
47
|
-
throw new TypeError(unusableForAlg);
|
|
48
|
-
}
|
|
49
|
-
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
|
|
50
|
-
isPublic ? 'verify' : 'sign',
|
|
51
|
-
]);
|
|
52
|
-
}
|
|
53
|
-
switch (keyObject.asymmetricKeyType) {
|
|
54
|
-
case 'ml-dsa-44':
|
|
55
|
-
case 'ml-dsa-65':
|
|
56
|
-
case 'ml-dsa-87': {
|
|
57
|
-
if (alg !== keyObject.asymmetricKeyType.toUpperCase()) {
|
|
58
|
-
throw new TypeError(unusableForAlg);
|
|
59
|
-
}
|
|
60
|
-
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
|
|
61
|
-
isPublic ? 'verify' : 'sign',
|
|
62
|
-
]);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if (keyObject.asymmetricKeyType === 'rsa') {
|
|
66
|
-
let hash;
|
|
67
|
-
switch (alg) {
|
|
68
|
-
case 'RSA-OAEP':
|
|
69
|
-
hash = 'SHA-1';
|
|
70
|
-
break;
|
|
71
|
-
case 'RS256':
|
|
72
|
-
case 'PS256':
|
|
73
|
-
case 'RSA-OAEP-256':
|
|
74
|
-
hash = 'SHA-256';
|
|
75
|
-
break;
|
|
76
|
-
case 'RS384':
|
|
77
|
-
case 'PS384':
|
|
78
|
-
case 'RSA-OAEP-384':
|
|
79
|
-
hash = 'SHA-384';
|
|
80
|
-
break;
|
|
81
|
-
case 'RS512':
|
|
82
|
-
case 'PS512':
|
|
83
|
-
case 'RSA-OAEP-512':
|
|
84
|
-
hash = 'SHA-512';
|
|
85
|
-
break;
|
|
86
|
-
default:
|
|
87
|
-
throw new TypeError(unusableForAlg);
|
|
88
|
-
}
|
|
89
|
-
if (alg.startsWith('RSA-OAEP')) {
|
|
90
|
-
return keyObject.toCryptoKey({
|
|
91
|
-
name: 'RSA-OAEP',
|
|
92
|
-
hash,
|
|
93
|
-
}, extractable, isPublic ? ['encrypt'] : ['decrypt']);
|
|
94
|
-
}
|
|
95
|
-
cryptoKey = keyObject.toCryptoKey({
|
|
96
|
-
name: alg.startsWith('PS') ? 'RSA-PSS' : 'RSASSA-PKCS1-v1_5',
|
|
97
|
-
hash,
|
|
98
|
-
}, extractable, [isPublic ? 'verify' : 'sign']);
|
|
99
|
-
}
|
|
100
|
-
if (keyObject.asymmetricKeyType === 'ec') {
|
|
101
|
-
const nist = new Map([
|
|
102
|
-
['prime256v1', 'P-256'],
|
|
103
|
-
['secp384r1', 'P-384'],
|
|
104
|
-
['secp521r1', 'P-521'],
|
|
105
|
-
]);
|
|
106
|
-
const namedCurve = nist.get(keyObject.asymmetricKeyDetails?.namedCurve);
|
|
107
|
-
if (!namedCurve) {
|
|
108
|
-
throw new TypeError(unusableForAlg);
|
|
109
|
-
}
|
|
110
|
-
const expectedCurve = { ES256: 'P-256', ES384: 'P-384', ES512: 'P-521' };
|
|
111
|
-
if (expectedCurve[alg] && namedCurve === expectedCurve[alg]) {
|
|
112
|
-
cryptoKey = keyObject.toCryptoKey({
|
|
113
|
-
name: 'ECDSA',
|
|
114
|
-
namedCurve,
|
|
115
|
-
}, extractable, [isPublic ? 'verify' : 'sign']);
|
|
116
|
-
}
|
|
117
|
-
if (alg.startsWith('ECDH-ES')) {
|
|
118
|
-
cryptoKey = keyObject.toCryptoKey({
|
|
119
|
-
name: 'ECDH',
|
|
120
|
-
namedCurve,
|
|
121
|
-
}, extractable, isPublic ? [] : ['deriveBits']);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (!cryptoKey) {
|
|
125
|
-
throw new TypeError(unusableForAlg);
|
|
126
|
-
}
|
|
127
|
-
if (!cached) {
|
|
128
|
-
cache.set(keyObject, { [alg]: cryptoKey });
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
cached[alg] = cryptoKey;
|
|
132
|
-
}
|
|
133
|
-
return cryptoKey;
|
|
134
|
-
};
|
|
135
|
-
export async function normalizeKey(key, alg) {
|
|
136
|
-
if (key instanceof Uint8Array) {
|
|
137
|
-
return key;
|
|
138
|
-
}
|
|
139
|
-
if (isCryptoKey(key)) {
|
|
140
|
-
return key;
|
|
141
|
-
}
|
|
142
|
-
if (isKeyObject(key)) {
|
|
143
|
-
if (key.type === 'secret') {
|
|
144
|
-
return key.export();
|
|
145
|
-
}
|
|
146
|
-
if ('toCryptoKey' in key && typeof key.toCryptoKey === 'function') {
|
|
147
|
-
try {
|
|
148
|
-
return handleKeyObject(key, alg);
|
|
149
|
-
}
|
|
150
|
-
catch (err) {
|
|
151
|
-
if (err instanceof TypeError) {
|
|
152
|
-
throw err;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
let jwk = key.export({ format: 'jwk' });
|
|
157
|
-
return handleJWK(key, jwk, alg);
|
|
158
|
-
}
|
|
159
|
-
if (isJWK(key)) {
|
|
160
|
-
if (key.k) {
|
|
161
|
-
return decode(key.k);
|
|
162
|
-
}
|
|
163
|
-
return handleJWK(key, key, alg, true);
|
|
164
|
-
}
|
|
165
|
-
throw new Error('unreachable');
|
|
166
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { encode as b64u } from '../util/base64url.js';
|
|
2
|
-
import * as aeskw from './aeskw.js';
|
|
3
|
-
import { checkEncCryptoKey } from './crypto_key.js';
|
|
4
|
-
import { concat, encode } from './buffer_utils.js';
|
|
5
|
-
import { JWEInvalid } from '../util/errors.js';
|
|
6
|
-
function getCryptoKey(key, alg) {
|
|
7
|
-
if (key instanceof Uint8Array) {
|
|
8
|
-
return crypto.subtle.importKey('raw', key, 'PBKDF2', false, [
|
|
9
|
-
'deriveBits',
|
|
10
|
-
]);
|
|
11
|
-
}
|
|
12
|
-
checkEncCryptoKey(key, alg, 'deriveBits');
|
|
13
|
-
return key;
|
|
14
|
-
}
|
|
15
|
-
const concatSalt = (alg, p2sInput) => concat(encode(alg), Uint8Array.of(0x00), p2sInput);
|
|
16
|
-
async function deriveKey(p2s, alg, p2c, key) {
|
|
17
|
-
if (!(p2s instanceof Uint8Array) || p2s.length < 8) {
|
|
18
|
-
throw new JWEInvalid('PBES2 Salt Input must be 8 or more octets');
|
|
19
|
-
}
|
|
20
|
-
if (!Number.isSafeInteger(p2c) || Math.sign(p2c) !== 1) {
|
|
21
|
-
throw new JWEInvalid('PBES2 Count Input must be a positive integer');
|
|
22
|
-
}
|
|
23
|
-
const salt = concatSalt(alg, p2s);
|
|
24
|
-
const keylen = parseInt(alg.slice(13, 16), 10);
|
|
25
|
-
const subtleAlg = {
|
|
26
|
-
hash: `SHA-${alg.slice(8, 11)}`,
|
|
27
|
-
iterations: p2c,
|
|
28
|
-
name: 'PBKDF2',
|
|
29
|
-
salt,
|
|
30
|
-
};
|
|
31
|
-
const cryptoKey = await getCryptoKey(key, alg);
|
|
32
|
-
return new Uint8Array(await crypto.subtle.deriveBits(subtleAlg, cryptoKey, keylen));
|
|
33
|
-
}
|
|
34
|
-
export async function wrap(alg, key, cek, p2c = 2048, p2s = crypto.getRandomValues(new Uint8Array(16))) {
|
|
35
|
-
const derived = await deriveKey(p2s, alg, p2c, key);
|
|
36
|
-
const encryptedKey = await aeskw.wrap(alg.slice(-6), derived, cek);
|
|
37
|
-
return { encryptedKey, p2c, p2s: b64u(p2s) };
|
|
38
|
-
}
|
|
39
|
-
export async function unwrap(alg, key, encryptedKey, p2c, p2s) {
|
|
40
|
-
const derived = await deriveKey(p2s, alg, p2c, key);
|
|
41
|
-
return aeskw.unwrap(alg.slice(-6), derived, encryptedKey);
|
|
42
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { checkEncCryptoKey } from './crypto_key.js';
|
|
2
|
-
import { checkKeyLength } from './signing.js';
|
|
3
|
-
import { JOSENotSupported } from '../util/errors.js';
|
|
4
|
-
const subtleAlgorithm = (alg) => {
|
|
5
|
-
switch (alg) {
|
|
6
|
-
case 'RSA-OAEP':
|
|
7
|
-
case 'RSA-OAEP-256':
|
|
8
|
-
case 'RSA-OAEP-384':
|
|
9
|
-
case 'RSA-OAEP-512':
|
|
10
|
-
return 'RSA-OAEP';
|
|
11
|
-
default:
|
|
12
|
-
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
export async function encrypt(alg, key, cek) {
|
|
16
|
-
checkEncCryptoKey(key, alg, 'encrypt');
|
|
17
|
-
checkKeyLength(alg, key);
|
|
18
|
-
return new Uint8Array(await crypto.subtle.encrypt(subtleAlgorithm(alg), key, cek));
|
|
19
|
-
}
|
|
20
|
-
export async function decrypt(alg, key, encryptedKey) {
|
|
21
|
-
checkEncCryptoKey(key, alg, 'decrypt');
|
|
22
|
-
checkKeyLength(alg, key);
|
|
23
|
-
return new Uint8Array(await crypto.subtle.decrypt(subtleAlgorithm(alg), key, encryptedKey));
|
|
24
|
-
}
|