@om_patel_26/chat-widget 1.0.1
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/README.md +276 -0
- package/dist/_virtual/_plugin-vue_export-helper.cjs.js +2 -0
- package/dist/_virtual/_plugin-vue_export-helper.cjs.js.map +1 -0
- package/dist/_virtual/_plugin-vue_export-helper.esm.js +11 -0
- package/dist/_virtual/_plugin-vue_export-helper.esm.js.map +1 -0
- package/dist/adapters/vue/index.d.ts +7 -0
- package/dist/adapters/vue/index.d.ts.map +1 -0
- package/dist/adapters/vue/useChatMode.d.ts +21 -0
- package/dist/adapters/vue/useChatMode.d.ts.map +1 -0
- package/dist/components/ChatWidget.d.ts +43 -0
- package/dist/components/ChatWidget.d.ts.map +1 -0
- package/dist/components/ChatWidget.vue.cjs.js +2 -0
- package/dist/components/ChatWidget.vue.cjs.js.map +1 -0
- package/dist/components/ChatWidget.vue.cjs2.js +2 -0
- package/dist/components/ChatWidget.vue.cjs2.js.map +1 -0
- package/dist/components/ChatWidget.vue.esm.js +8 -0
- package/dist/components/ChatWidget.vue.esm.js.map +1 -0
- package/dist/components/ChatWidget.vue.esm2.js +331 -0
- package/dist/components/ChatWidget.vue.esm2.js.map +1 -0
- package/dist/composables/useChatWidget.cjs.js +2 -0
- package/dist/composables/useChatWidget.cjs.js.map +1 -0
- package/dist/composables/useChatWidget.d.ts +34 -0
- package/dist/composables/useChatWidget.d.ts.map +1 -0
- package/dist/composables/useChatWidget.esm.js +72 -0
- package/dist/composables/useChatWidget.esm.js.map +1 -0
- package/dist/core/stateManager.cjs.js +2 -0
- package/dist/core/stateManager.cjs.js.map +1 -0
- package/dist/core/stateManager.d.ts +136 -0
- package/dist/core/stateManager.d.ts.map +1 -0
- package/dist/core/stateManager.esm.js +907 -0
- package/dist/core/stateManager.esm.js.map +1 -0
- package/dist/core/types.d.ts +66 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/entry/next.d.ts +9 -0
- package/dist/entry/next.d.ts.map +1 -0
- package/dist/entry/nuxt.d.ts +10 -0
- package/dist/entry/nuxt.d.ts.map +1 -0
- package/dist/entry/react.d.ts +10 -0
- package/dist/entry/react.d.ts.map +1 -0
- package/dist/entry/vanilla.d.ts +33 -0
- package/dist/entry/vanilla.d.ts.map +1 -0
- package/dist/entry/vite.d.ts +11 -0
- package/dist/entry/vite.d.ts.map +1 -0
- package/dist/entry/vue.d.ts +11 -0
- package/dist/entry/vue.d.ts.map +1 -0
- package/dist/hooks/useChatMode.d.ts +17 -0
- package/dist/hooks/useChatMode.d.ts.map +1 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +25 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/jws/compact/sign.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/jws/compact/sign.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/jws/compact/sign.esm.js +21 -0
- package/dist/node_modules/jose/dist/browser/jws/compact/sign.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/jws/flattened/sign.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/jws/flattened/sign.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/jws/flattened/sign.esm.js +84 -0
- package/dist/node_modules/jose/dist/browser/jws/flattened/sign.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/jwt/produce.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/jwt/produce.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/jwt/produce.esm.js +72 -0
- package/dist/node_modules/jose/dist/browser/jwt/produce.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/jwt/sign.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/jwt/sign.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/jwt/sign.esm.js +22 -0
- package/dist/node_modules/jose/dist/browser/jwt/sign.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/key/import.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/key/import.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/key/import.esm.js +11 -0
- package/dist/node_modules/jose/dist/browser/key/import.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/buffer_utils.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/lib/buffer_utils.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/buffer_utils.esm.js +18 -0
- package/dist/node_modules/jose/dist/browser/lib/buffer_utils.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/check_key_type.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/lib/check_key_type.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/check_key_type.esm.js +77 -0
- package/dist/node_modules/jose/dist/browser/lib/check_key_type.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/crypto_key.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/lib/crypto_key.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/crypto_key.esm.js +101 -0
- package/dist/node_modules/jose/dist/browser/lib/crypto_key.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/epoch.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/lib/epoch.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/epoch.esm.js +5 -0
- package/dist/node_modules/jose/dist/browser/lib/epoch.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/invalid_key_input.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/lib/invalid_key_input.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/invalid_key_input.esm.js +32 -0
- package/dist/node_modules/jose/dist/browser/lib/invalid_key_input.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/is_disjoint.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/lib/is_disjoint.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/is_disjoint.esm.js +25 -0
- package/dist/node_modules/jose/dist/browser/lib/is_disjoint.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/is_jwk.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/lib/is_jwk.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/is_jwk.esm.js +20 -0
- package/dist/node_modules/jose/dist/browser/lib/is_jwk.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/is_object.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/lib/is_object.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/is_object.esm.js +20 -0
- package/dist/node_modules/jose/dist/browser/lib/is_object.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/secs.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/lib/secs.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/secs.esm.js +59 -0
- package/dist/node_modules/jose/dist/browser/lib/secs.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/validate_crit.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/lib/validate_crit.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/lib/validate_crit.esm.js +34 -0
- package/dist/node_modules/jose/dist/browser/lib/validate_crit.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/asn1.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/runtime/asn1.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/asn1.esm.js +103 -0
- package/dist/node_modules/jose/dist/browser/runtime/asn1.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/base64url.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/runtime/base64url.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/base64url.esm.js +43 -0
- package/dist/node_modules/jose/dist/browser/runtime/base64url.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/check_key_length.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/runtime/check_key_length.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/check_key_length.esm.js +12 -0
- package/dist/node_modules/jose/dist/browser/runtime/check_key_length.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/get_sign_verify_key.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/runtime/get_sign_verify_key.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/get_sign_verify_key.esm.js +25 -0
- package/dist/node_modules/jose/dist/browser/runtime/get_sign_verify_key.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/is_key_like.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/runtime/is_key_like.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/is_key_like.esm.js +13 -0
- package/dist/node_modules/jose/dist/browser/runtime/is_key_like.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/jwk_to_key.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/runtime/jwk_to_key.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/jwk_to_key.esm.js +107 -0
- package/dist/node_modules/jose/dist/browser/runtime/jwk_to_key.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/normalize_key.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/runtime/normalize_key.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/normalize_key.esm.js +71 -0
- package/dist/node_modules/jose/dist/browser/runtime/normalize_key.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/sign.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/runtime/sign.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/sign.esm.js +14 -0
- package/dist/node_modules/jose/dist/browser/runtime/sign.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/subtle_dsa.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/runtime/subtle_dsa.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/subtle_dsa.esm.js +32 -0
- package/dist/node_modules/jose/dist/browser/runtime/subtle_dsa.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/webcrypto.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/runtime/webcrypto.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/runtime/webcrypto.esm.js +7 -0
- package/dist/node_modules/jose/dist/browser/runtime/webcrypto.esm.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/util/errors.cjs.js +2 -0
- package/dist/node_modules/jose/dist/browser/util/errors.cjs.js.map +1 -0
- package/dist/node_modules/jose/dist/browser/util/errors.esm.js +131 -0
- package/dist/node_modules/jose/dist/browser/util/errors.esm.js.map +1 -0
- package/dist/nuxt.cjs.js +2 -0
- package/dist/nuxt.cjs.js.map +1 -0
- package/dist/nuxt.esm.js +8 -0
- package/dist/nuxt.esm.js.map +1 -0
- package/dist/services/chatService.cjs.js +2 -0
- package/dist/services/chatService.cjs.js.map +1 -0
- package/dist/services/chatService.d.ts +144 -0
- package/dist/services/chatService.d.ts.map +1 -0
- package/dist/services/chatService.esm.js +482 -0
- package/dist/services/chatService.esm.js.map +1 -0
- package/dist/services/dialogflowClient.cjs.js +2 -0
- package/dist/services/dialogflowClient.cjs.js.map +1 -0
- package/dist/services/dialogflowClient.d.ts +36 -0
- package/dist/services/dialogflowClient.d.ts.map +1 -0
- package/dist/services/dialogflowClient.esm.js +282 -0
- package/dist/services/dialogflowClient.esm.js.map +1 -0
- package/dist/services/sessionManager.cjs.js +2 -0
- package/dist/services/sessionManager.cjs.js.map +1 -0
- package/dist/services/sessionManager.d.ts +13 -0
- package/dist/services/sessionManager.d.ts.map +1 -0
- package/dist/services/sessionManager.esm.js +48 -0
- package/dist/services/sessionManager.esm.js.map +1 -0
- package/dist/styles.css +0 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/dialogflowHandler.d.ts +31 -0
- package/dist/utils/dialogflowHandler.d.ts.map +1 -0
- package/dist/utils/frameworkDetector.d.ts +17 -0
- package/dist/utils/frameworkDetector.d.ts.map +1 -0
- package/dist/utils/sanitize.cjs.js +2 -0
- package/dist/utils/sanitize.cjs.js.map +1 -0
- package/dist/utils/sanitize.d.ts +25 -0
- package/dist/utils/sanitize.d.ts.map +1 -0
- package/dist/utils/sanitize.esm.js +57 -0
- package/dist/utils/sanitize.esm.js.map +1 -0
- package/dist/utils/ssr.cjs.js +2 -0
- package/dist/utils/ssr.cjs.js.map +1 -0
- package/dist/utils/ssr.d.ts +35 -0
- package/dist/utils/ssr.d.ts.map +1 -0
- package/dist/utils/ssr.esm.js +48 -0
- package/dist/utils/ssr.esm.js.map +1 -0
- package/dist/vue.cjs.js +2 -0
- package/dist/vue.cjs.js.map +1 -0
- package/dist/vue.esm.js +10 -0
- package/dist/vue.esm.js.map +1 -0
- package/package.json +145 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import epoch from "../lib/epoch.esm.js";
|
|
2
|
+
import isObject from "../lib/is_object.esm.js";
|
|
3
|
+
import secs from "../lib/secs.esm.js";
|
|
4
|
+
function validateInput(label, input) {
|
|
5
|
+
if (!Number.isFinite(input)) {
|
|
6
|
+
throw new TypeError(`Invalid ${label} input`);
|
|
7
|
+
}
|
|
8
|
+
return input;
|
|
9
|
+
}
|
|
10
|
+
class ProduceJWT {
|
|
11
|
+
constructor(payload = {}) {
|
|
12
|
+
if (!isObject(payload)) {
|
|
13
|
+
throw new TypeError("JWT Claims Set MUST be an object");
|
|
14
|
+
}
|
|
15
|
+
this._payload = payload;
|
|
16
|
+
}
|
|
17
|
+
setIssuer(issuer) {
|
|
18
|
+
this._payload = { ...this._payload, iss: issuer };
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
setSubject(subject) {
|
|
22
|
+
this._payload = { ...this._payload, sub: subject };
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
setAudience(audience) {
|
|
26
|
+
this._payload = { ...this._payload, aud: audience };
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
setJti(jwtId) {
|
|
30
|
+
this._payload = { ...this._payload, jti: jwtId };
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
setNotBefore(input) {
|
|
34
|
+
if (typeof input === "number") {
|
|
35
|
+
this._payload = { ...this._payload, nbf: validateInput("setNotBefore", input) };
|
|
36
|
+
} else if (input instanceof Date) {
|
|
37
|
+
this._payload = { ...this._payload, nbf: validateInput("setNotBefore", epoch(input)) };
|
|
38
|
+
} else {
|
|
39
|
+
this._payload = { ...this._payload, nbf: epoch(/* @__PURE__ */ new Date()) + secs(input) };
|
|
40
|
+
}
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
setExpirationTime(input) {
|
|
44
|
+
if (typeof input === "number") {
|
|
45
|
+
this._payload = { ...this._payload, exp: validateInput("setExpirationTime", input) };
|
|
46
|
+
} else if (input instanceof Date) {
|
|
47
|
+
this._payload = { ...this._payload, exp: validateInput("setExpirationTime", epoch(input)) };
|
|
48
|
+
} else {
|
|
49
|
+
this._payload = { ...this._payload, exp: epoch(/* @__PURE__ */ new Date()) + secs(input) };
|
|
50
|
+
}
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
setIssuedAt(input) {
|
|
54
|
+
if (typeof input === "undefined") {
|
|
55
|
+
this._payload = { ...this._payload, iat: epoch(/* @__PURE__ */ new Date()) };
|
|
56
|
+
} else if (input instanceof Date) {
|
|
57
|
+
this._payload = { ...this._payload, iat: validateInput("setIssuedAt", epoch(input)) };
|
|
58
|
+
} else if (typeof input === "string") {
|
|
59
|
+
this._payload = {
|
|
60
|
+
...this._payload,
|
|
61
|
+
iat: validateInput("setIssuedAt", epoch(/* @__PURE__ */ new Date()) + secs(input))
|
|
62
|
+
};
|
|
63
|
+
} else {
|
|
64
|
+
this._payload = { ...this._payload, iat: validateInput("setIssuedAt", input) };
|
|
65
|
+
}
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
ProduceJWT
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=produce.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"produce.esm.js","sources":["../../../../../../node_modules/jose/dist/browser/jwt/produce.js"],"sourcesContent":["import epoch from '../lib/epoch.js';\nimport isObject from '../lib/is_object.js';\nimport secs from '../lib/secs.js';\nfunction validateInput(label, input) {\n if (!Number.isFinite(input)) {\n throw new TypeError(`Invalid ${label} input`);\n }\n return input;\n}\nexport class ProduceJWT {\n constructor(payload = {}) {\n if (!isObject(payload)) {\n throw new TypeError('JWT Claims Set MUST be an object');\n }\n this._payload = payload;\n }\n setIssuer(issuer) {\n this._payload = { ...this._payload, iss: issuer };\n return this;\n }\n setSubject(subject) {\n this._payload = { ...this._payload, sub: subject };\n return this;\n }\n setAudience(audience) {\n this._payload = { ...this._payload, aud: audience };\n return this;\n }\n setJti(jwtId) {\n this._payload = { ...this._payload, jti: jwtId };\n return this;\n }\n setNotBefore(input) {\n if (typeof input === 'number') {\n this._payload = { ...this._payload, nbf: validateInput('setNotBefore', input) };\n }\n else if (input instanceof Date) {\n this._payload = { ...this._payload, nbf: validateInput('setNotBefore', epoch(input)) };\n }\n else {\n this._payload = { ...this._payload, nbf: epoch(new Date()) + secs(input) };\n }\n return this;\n }\n setExpirationTime(input) {\n if (typeof input === 'number') {\n this._payload = { ...this._payload, exp: validateInput('setExpirationTime', input) };\n }\n else if (input instanceof Date) {\n this._payload = { ...this._payload, exp: validateInput('setExpirationTime', epoch(input)) };\n }\n else {\n this._payload = { ...this._payload, exp: epoch(new Date()) + secs(input) };\n }\n return this;\n }\n setIssuedAt(input) {\n if (typeof input === 'undefined') {\n this._payload = { ...this._payload, iat: epoch(new Date()) };\n }\n else if (input instanceof Date) {\n this._payload = { ...this._payload, iat: validateInput('setIssuedAt', epoch(input)) };\n }\n else if (typeof input === 'string') {\n this._payload = {\n ...this._payload,\n iat: validateInput('setIssuedAt', epoch(new Date()) + secs(input)),\n };\n }\n else {\n this._payload = { ...this._payload, iat: validateInput('setIssuedAt', input) };\n }\n return this;\n }\n}\n"],"names":[],"mappings":";;;AAGA,SAAS,cAAc,OAAO,OAAO;AACjC,MAAI,CAAC,OAAO,SAAS,KAAK,GAAG;AACzB,UAAM,IAAI,UAAU,WAAW,KAAK,QAAQ;AAAA,EAChD;AACA,SAAO;AACX;AACO,MAAM,WAAW;AAAA,EACpB,YAAY,UAAU,IAAI;AACtB,QAAI,CAAC,SAAS,OAAO,GAAG;AACpB,YAAM,IAAI,UAAU,kCAAkC;AAAA,IAC1D;AACA,SAAK,WAAW;AAAA,EACpB;AAAA,EACA,UAAU,QAAQ;AACd,SAAK,WAAW,EAAE,GAAG,KAAK,UAAU,KAAK,OAAM;AAC/C,WAAO;AAAA,EACX;AAAA,EACA,WAAW,SAAS;AAChB,SAAK,WAAW,EAAE,GAAG,KAAK,UAAU,KAAK,QAAO;AAChD,WAAO;AAAA,EACX;AAAA,EACA,YAAY,UAAU;AAClB,SAAK,WAAW,EAAE,GAAG,KAAK,UAAU,KAAK,SAAQ;AACjD,WAAO;AAAA,EACX;AAAA,EACA,OAAO,OAAO;AACV,SAAK,WAAW,EAAE,GAAG,KAAK,UAAU,KAAK,MAAK;AAC9C,WAAO;AAAA,EACX;AAAA,EACA,aAAa,OAAO;AAChB,QAAI,OAAO,UAAU,UAAU;AAC3B,WAAK,WAAW,EAAE,GAAG,KAAK,UAAU,KAAK,cAAc,gBAAgB,KAAK,EAAC;AAAA,IACjF,WACS,iBAAiB,MAAM;AAC5B,WAAK,WAAW,EAAE,GAAG,KAAK,UAAU,KAAK,cAAc,gBAAgB,MAAM,KAAK,CAAC,EAAC;AAAA,IACxF,OACK;AACD,WAAK,WAAW,EAAE,GAAG,KAAK,UAAU,KAAK,MAAM,oBAAI,KAAI,CAAE,IAAI,KAAK,KAAK,EAAC;AAAA,IAC5E;AACA,WAAO;AAAA,EACX;AAAA,EACA,kBAAkB,OAAO;AACrB,QAAI,OAAO,UAAU,UAAU;AAC3B,WAAK,WAAW,EAAE,GAAG,KAAK,UAAU,KAAK,cAAc,qBAAqB,KAAK,EAAC;AAAA,IACtF,WACS,iBAAiB,MAAM;AAC5B,WAAK,WAAW,EAAE,GAAG,KAAK,UAAU,KAAK,cAAc,qBAAqB,MAAM,KAAK,CAAC,EAAC;AAAA,IAC7F,OACK;AACD,WAAK,WAAW,EAAE,GAAG,KAAK,UAAU,KAAK,MAAM,oBAAI,KAAI,CAAE,IAAI,KAAK,KAAK,EAAC;AAAA,IAC5E;AACA,WAAO;AAAA,EACX;AAAA,EACA,YAAY,OAAO;AACf,QAAI,OAAO,UAAU,aAAa;AAC9B,WAAK,WAAW,EAAE,GAAG,KAAK,UAAU,KAAK,MAAM,oBAAI,KAAI,CAAE,EAAC;AAAA,IAC9D,WACS,iBAAiB,MAAM;AAC5B,WAAK,WAAW,EAAE,GAAG,KAAK,UAAU,KAAK,cAAc,eAAe,MAAM,KAAK,CAAC,EAAC;AAAA,IACvF,WACS,OAAO,UAAU,UAAU;AAChC,WAAK,WAAW;AAAA,QACZ,GAAG,KAAK;AAAA,QACR,KAAK,cAAc,eAAe,MAAM,oBAAI,MAAM,IAAI,KAAK,KAAK,CAAC;AAAA,MACjF;AAAA,IACQ,OACK;AACD,WAAK,WAAW,EAAE,GAAG,KAAK,UAAU,KAAK,cAAc,eAAe,KAAK,EAAC;AAAA,IAChF;AACA,WAAO;AAAA,EACX;AACJ;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../jws/compact/sign.cjs.js"),r=require("../util/errors.cjs.js"),t=require("../lib/buffer_utils.cjs.js"),s=require("./produce.cjs.js");class i extends s.ProduceJWT{setProtectedHeader(e){return this._protectedHeader=e,this}async sign(s,i){const c=new e.CompactSign(t.encoder.encode(JSON.stringify(this._payload)));if(c.setProtectedHeader(this._protectedHeader),Array.isArray(this._protectedHeader?.crit)&&this._protectedHeader.crit.includes("b64")&&!1===this._protectedHeader.b64)throw new r.JWTInvalid("JWTs MUST NOT use unencoded payload");return c.sign(s,i)}}exports.SignJWT=i;
|
|
2
|
+
//# sourceMappingURL=sign.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign.cjs.js","sources":["../../../../../../node_modules/jose/dist/browser/jwt/sign.js"],"sourcesContent":["import { CompactSign } from '../jws/compact/sign.js';\nimport { JWTInvalid } from '../util/errors.js';\nimport { encoder } from '../lib/buffer_utils.js';\nimport { ProduceJWT } from './produce.js';\nexport class SignJWT extends ProduceJWT {\n setProtectedHeader(protectedHeader) {\n this._protectedHeader = protectedHeader;\n return this;\n }\n async sign(key, options) {\n const sig = new CompactSign(encoder.encode(JSON.stringify(this._payload)));\n sig.setProtectedHeader(this._protectedHeader);\n if (Array.isArray(this._protectedHeader?.crit) &&\n this._protectedHeader.crit.includes('b64') &&\n this._protectedHeader.b64 === false) {\n throw new JWTInvalid('JWTs MUST NOT use unencoded payload');\n }\n return sig.sign(key, options);\n }\n}\n"],"names":["SignJWT","ProduceJWT","setProtectedHeader","protectedHeader","this","_protectedHeader","sign","key","options","sig","CompactSign","encoder","encode","JSON","stringify","_payload","Array","isArray","crit","includes","b64","JWTInvalid"],"mappings":"uOAIO,MAAMA,UAAgBC,EAAAA,WACzB,kBAAAC,CAAmBC,GAEf,OADAC,KAAKC,iBAAmBF,EACjBC,IACX,CACA,UAAME,CAAKC,EAAKC,GACZ,MAAMC,EAAM,IAAIC,EAAAA,YAAYC,UAAQC,OAAOC,KAAKC,UAAUV,KAAKW,YAE/D,GADAN,EAAIP,mBAAmBE,KAAKC,kBACxBW,MAAMC,QAAQb,KAAKC,kBAAkBa,OACrCd,KAAKC,iBAAiBa,KAAKC,SAAS,SACN,IAA9Bf,KAAKC,iBAAiBe,IACtB,MAAM,IAAIC,EAAAA,WAAW,uCAEzB,OAAOZ,EAAIH,KAAKC,EAAKC,EACzB","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CompactSign } from "../jws/compact/sign.esm.js";
|
|
2
|
+
import { JWTInvalid } from "../util/errors.esm.js";
|
|
3
|
+
import { encoder } from "../lib/buffer_utils.esm.js";
|
|
4
|
+
import { ProduceJWT } from "./produce.esm.js";
|
|
5
|
+
class SignJWT extends ProduceJWT {
|
|
6
|
+
setProtectedHeader(protectedHeader) {
|
|
7
|
+
this._protectedHeader = protectedHeader;
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
async sign(key, options) {
|
|
11
|
+
const sig = new CompactSign(encoder.encode(JSON.stringify(this._payload)));
|
|
12
|
+
sig.setProtectedHeader(this._protectedHeader);
|
|
13
|
+
if (Array.isArray(this._protectedHeader?.crit) && this._protectedHeader.crit.includes("b64") && this._protectedHeader.b64 === false) {
|
|
14
|
+
throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
|
|
15
|
+
}
|
|
16
|
+
return sig.sign(key, options);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
SignJWT
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=sign.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign.esm.js","sources":["../../../../../../node_modules/jose/dist/browser/jwt/sign.js"],"sourcesContent":["import { CompactSign } from '../jws/compact/sign.js';\nimport { JWTInvalid } from '../util/errors.js';\nimport { encoder } from '../lib/buffer_utils.js';\nimport { ProduceJWT } from './produce.js';\nexport class SignJWT extends ProduceJWT {\n setProtectedHeader(protectedHeader) {\n this._protectedHeader = protectedHeader;\n return this;\n }\n async sign(key, options) {\n const sig = new CompactSign(encoder.encode(JSON.stringify(this._payload)));\n sig.setProtectedHeader(this._protectedHeader);\n if (Array.isArray(this._protectedHeader?.crit) &&\n this._protectedHeader.crit.includes('b64') &&\n this._protectedHeader.b64 === false) {\n throw new JWTInvalid('JWTs MUST NOT use unencoded payload');\n }\n return sig.sign(key, options);\n }\n}\n"],"names":[],"mappings":";;;;AAIO,MAAM,gBAAgB,WAAW;AAAA,EACpC,mBAAmB,iBAAiB;AAChC,SAAK,mBAAmB;AACxB,WAAO;AAAA,EACX;AAAA,EACA,MAAM,KAAK,KAAK,SAAS;AACrB,UAAM,MAAM,IAAI,YAAY,QAAQ,OAAO,KAAK,UAAU,KAAK,QAAQ,CAAC,CAAC;AACzE,QAAI,mBAAmB,KAAK,gBAAgB;AAC5C,QAAI,MAAM,QAAQ,KAAK,kBAAkB,IAAI,KACzC,KAAK,iBAAiB,KAAK,SAAS,KAAK,KACzC,KAAK,iBAAiB,QAAQ,OAAO;AACrC,YAAM,IAAI,WAAW,qCAAqC;AAAA,IAC9D;AACA,WAAO,IAAI,KAAK,KAAK,OAAO;AAAA,EAChC;AACJ;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../runtime/asn1.cjs.js");exports.importPKCS8=async function(t,e,o){if("string"!=typeof t||0!==t.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return r.fromPKCS8(t,e)};
|
|
2
|
+
//# sourceMappingURL=import.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.cjs.js","sources":["../../../../../../node_modules/jose/dist/browser/key/import.js"],"sourcesContent":["import { decode as decodeBase64URL } from '../runtime/base64url.js';\nimport { fromSPKI, fromPKCS8, fromX509 } from '../runtime/asn1.js';\nimport asKeyObject from '../runtime/jwk_to_key.js';\nimport { JOSENotSupported } from '../util/errors.js';\nimport isObject from '../lib/is_object.js';\nexport async function importSPKI(spki, alg, options) {\n if (typeof spki !== 'string' || spki.indexOf('-----BEGIN PUBLIC KEY-----') !== 0) {\n throw new TypeError('\"spki\" must be SPKI formatted string');\n }\n return fromSPKI(spki, alg, options);\n}\nexport async function importX509(x509, alg, options) {\n if (typeof x509 !== 'string' || x509.indexOf('-----BEGIN CERTIFICATE-----') !== 0) {\n throw new TypeError('\"x509\" must be X.509 formatted string');\n }\n return fromX509(x509, alg, options);\n}\nexport async function importPKCS8(pkcs8, alg, options) {\n if (typeof pkcs8 !== 'string' || pkcs8.indexOf('-----BEGIN PRIVATE KEY-----') !== 0) {\n throw new TypeError('\"pkcs8\" must be PKCS#8 formatted string');\n }\n return fromPKCS8(pkcs8, alg, options);\n}\nexport async function importJWK(jwk, alg) {\n if (!isObject(jwk)) {\n throw new TypeError('JWK must be an object');\n }\n alg || (alg = jwk.alg);\n switch (jwk.kty) {\n case 'oct':\n if (typeof jwk.k !== 'string' || !jwk.k) {\n throw new TypeError('missing \"k\" (Key Value) Parameter value');\n }\n return decodeBase64URL(jwk.k);\n case 'RSA':\n if ('oth' in jwk && jwk.oth !== undefined) {\n throw new JOSENotSupported('RSA JWK \"oth\" (Other Primes Info) Parameter value is not supported');\n }\n case 'EC':\n case 'OKP':\n return asKeyObject({ ...jwk, alg });\n default:\n throw new JOSENotSupported('Unsupported \"kty\" (Key Type) Parameter value');\n }\n}\n"],"names":["async","pkcs8","alg","options","indexOf","TypeError","fromPKCS8"],"mappings":"8IAiBOA,eAA2BC,EAAOC,EAAKC,GAC1C,GAAqB,iBAAVF,GAAuE,IAAjDA,EAAMG,QAAQ,+BAC3C,MAAM,IAAIC,UAAU,2CAExB,OAAOC,EAAAA,UAAUL,EAAOC,EAC5B","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { fromPKCS8 } from "../runtime/asn1.esm.js";
|
|
2
|
+
async function importPKCS8(pkcs8, alg, options) {
|
|
3
|
+
if (typeof pkcs8 !== "string" || pkcs8.indexOf("-----BEGIN PRIVATE KEY-----") !== 0) {
|
|
4
|
+
throw new TypeError('"pkcs8" must be PKCS#8 formatted string');
|
|
5
|
+
}
|
|
6
|
+
return fromPKCS8(pkcs8, alg);
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
importPKCS8
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=import.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.esm.js","sources":["../../../../../../node_modules/jose/dist/browser/key/import.js"],"sourcesContent":["import { decode as decodeBase64URL } from '../runtime/base64url.js';\nimport { fromSPKI, fromPKCS8, fromX509 } from '../runtime/asn1.js';\nimport asKeyObject from '../runtime/jwk_to_key.js';\nimport { JOSENotSupported } from '../util/errors.js';\nimport isObject from '../lib/is_object.js';\nexport async function importSPKI(spki, alg, options) {\n if (typeof spki !== 'string' || spki.indexOf('-----BEGIN PUBLIC KEY-----') !== 0) {\n throw new TypeError('\"spki\" must be SPKI formatted string');\n }\n return fromSPKI(spki, alg, options);\n}\nexport async function importX509(x509, alg, options) {\n if (typeof x509 !== 'string' || x509.indexOf('-----BEGIN CERTIFICATE-----') !== 0) {\n throw new TypeError('\"x509\" must be X.509 formatted string');\n }\n return fromX509(x509, alg, options);\n}\nexport async function importPKCS8(pkcs8, alg, options) {\n if (typeof pkcs8 !== 'string' || pkcs8.indexOf('-----BEGIN PRIVATE KEY-----') !== 0) {\n throw new TypeError('\"pkcs8\" must be PKCS#8 formatted string');\n }\n return fromPKCS8(pkcs8, alg, options);\n}\nexport async function importJWK(jwk, alg) {\n if (!isObject(jwk)) {\n throw new TypeError('JWK must be an object');\n }\n alg || (alg = jwk.alg);\n switch (jwk.kty) {\n case 'oct':\n if (typeof jwk.k !== 'string' || !jwk.k) {\n throw new TypeError('missing \"k\" (Key Value) Parameter value');\n }\n return decodeBase64URL(jwk.k);\n case 'RSA':\n if ('oth' in jwk && jwk.oth !== undefined) {\n throw new JOSENotSupported('RSA JWK \"oth\" (Other Primes Info) Parameter value is not supported');\n }\n case 'EC':\n case 'OKP':\n return asKeyObject({ ...jwk, alg });\n default:\n throw new JOSENotSupported('Unsupported \"kty\" (Key Type) Parameter value');\n }\n}\n"],"names":[],"mappings":";AAiBO,eAAe,YAAY,OAAO,KAAK,SAAS;AACnD,MAAI,OAAO,UAAU,YAAY,MAAM,QAAQ,6BAA6B,MAAM,GAAG;AACjF,UAAM,IAAI,UAAU,yCAAyC;AAAA,EACjE;AACA,SAAO,UAAU,OAAO,GAAY;AACxC;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=new TextEncoder,t=new TextDecoder;exports.concat=function(...e){const t=e.reduce((e,{length:t})=>e+t,0),o=new Uint8Array(t);let r=0;for(const n of e)o.set(n,r),r+=n.length;return o},exports.decoder=t,exports.encoder=e;
|
|
2
|
+
//# sourceMappingURL=buffer_utils.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer_utils.cjs.js","sources":["../../../../../../node_modules/jose/dist/browser/lib/buffer_utils.js"],"sourcesContent":["import digest from '../runtime/digest.js';\nexport const encoder = new TextEncoder();\nexport const decoder = new TextDecoder();\nconst MAX_INT32 = 2 ** 32;\nexport function concat(...buffers) {\n const size = buffers.reduce((acc, { length }) => acc + length, 0);\n const buf = new Uint8Array(size);\n let i = 0;\n for (const buffer of buffers) {\n buf.set(buffer, i);\n i += buffer.length;\n }\n return buf;\n}\nexport function p2s(alg, p2sInput) {\n return concat(encoder.encode(alg), new Uint8Array([0]), p2sInput);\n}\nfunction writeUInt32BE(buf, value, offset) {\n if (value < 0 || value >= MAX_INT32) {\n throw new RangeError(`value must be >= 0 and <= ${MAX_INT32 - 1}. Received ${value}`);\n }\n buf.set([value >>> 24, value >>> 16, value >>> 8, value & 0xff], offset);\n}\nexport function uint64be(value) {\n const high = Math.floor(value / MAX_INT32);\n const low = value % MAX_INT32;\n const buf = new Uint8Array(8);\n writeUInt32BE(buf, high, 0);\n writeUInt32BE(buf, low, 4);\n return buf;\n}\nexport function uint32be(value) {\n const buf = new Uint8Array(4);\n writeUInt32BE(buf, value);\n return buf;\n}\nexport function lengthAndInput(input) {\n return concat(uint32be(input.length), input);\n}\nexport async function concatKdf(secret, bits, value) {\n const iterations = Math.ceil((bits >> 3) / 32);\n const res = new Uint8Array(iterations * 32);\n for (let iter = 0; iter < iterations; iter++) {\n const buf = new Uint8Array(4 + secret.length + value.length);\n buf.set(uint32be(iter + 1));\n buf.set(secret, 4);\n buf.set(value, 4 + secret.length);\n res.set(await digest('sha256', buf), iter * 32);\n }\n return res.slice(0, bits >> 3);\n}\n"],"names":["encoder","TextEncoder","decoder","TextDecoder","buffers","size","reduce","acc","length","buf","Uint8Array","i","buffer","set"],"mappings":"gFACY,MAACA,EAAU,IAAIC,YACdC,EAAU,IAAIC,2BAEpB,YAAmBC,GACtB,MAAMC,EAAOD,EAAQE,OAAO,CAACC,GAAOC,YAAaD,EAAMC,EAAQ,GACzDC,EAAM,IAAIC,WAAWL,GAC3B,IAAIM,EAAI,EACR,IAAA,MAAWC,KAAUR,EACjBK,EAAII,IAAID,EAAQD,GAChBA,GAAKC,EAAOJ,OAEhB,OAAOC,CACX","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const encoder = new TextEncoder();
|
|
2
|
+
const decoder = new TextDecoder();
|
|
3
|
+
function concat(...buffers) {
|
|
4
|
+
const size = buffers.reduce((acc, { length }) => acc + length, 0);
|
|
5
|
+
const buf = new Uint8Array(size);
|
|
6
|
+
let i = 0;
|
|
7
|
+
for (const buffer of buffers) {
|
|
8
|
+
buf.set(buffer, i);
|
|
9
|
+
i += buffer.length;
|
|
10
|
+
}
|
|
11
|
+
return buf;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
concat,
|
|
15
|
+
decoder,
|
|
16
|
+
encoder
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=buffer_utils.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer_utils.esm.js","sources":["../../../../../../node_modules/jose/dist/browser/lib/buffer_utils.js"],"sourcesContent":["import digest from '../runtime/digest.js';\nexport const encoder = new TextEncoder();\nexport const decoder = new TextDecoder();\nconst MAX_INT32 = 2 ** 32;\nexport function concat(...buffers) {\n const size = buffers.reduce((acc, { length }) => acc + length, 0);\n const buf = new Uint8Array(size);\n let i = 0;\n for (const buffer of buffers) {\n buf.set(buffer, i);\n i += buffer.length;\n }\n return buf;\n}\nexport function p2s(alg, p2sInput) {\n return concat(encoder.encode(alg), new Uint8Array([0]), p2sInput);\n}\nfunction writeUInt32BE(buf, value, offset) {\n if (value < 0 || value >= MAX_INT32) {\n throw new RangeError(`value must be >= 0 and <= ${MAX_INT32 - 1}. Received ${value}`);\n }\n buf.set([value >>> 24, value >>> 16, value >>> 8, value & 0xff], offset);\n}\nexport function uint64be(value) {\n const high = Math.floor(value / MAX_INT32);\n const low = value % MAX_INT32;\n const buf = new Uint8Array(8);\n writeUInt32BE(buf, high, 0);\n writeUInt32BE(buf, low, 4);\n return buf;\n}\nexport function uint32be(value) {\n const buf = new Uint8Array(4);\n writeUInt32BE(buf, value);\n return buf;\n}\nexport function lengthAndInput(input) {\n return concat(uint32be(input.length), input);\n}\nexport async function concatKdf(secret, bits, value) {\n const iterations = Math.ceil((bits >> 3) / 32);\n const res = new Uint8Array(iterations * 32);\n for (let iter = 0; iter < iterations; iter++) {\n const buf = new Uint8Array(4 + secret.length + value.length);\n buf.set(uint32be(iter + 1));\n buf.set(secret, 4);\n buf.set(value, 4 + secret.length);\n res.set(await digest('sha256', buf), iter * 32);\n }\n return res.slice(0, bits >> 3);\n}\n"],"names":[],"mappings":"AACY,MAAC,UAAU,IAAI,YAAW;AAC1B,MAAC,UAAU,IAAI,YAAW;AAE/B,SAAS,UAAU,SAAS;AAC/B,QAAM,OAAO,QAAQ,OAAO,CAAC,KAAK,EAAE,aAAa,MAAM,QAAQ,CAAC;AAChE,QAAM,MAAM,IAAI,WAAW,IAAI;AAC/B,MAAI,IAAI;AACR,aAAW,UAAU,SAAS;AAC1B,QAAI,IAAI,QAAQ,CAAC;AACjB,SAAK,OAAO;AAAA,EAChB;AACA,SAAO;AACX;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./invalid_key_input.cjs.js"),r=require("../runtime/is_key_like.cjs.js"),t=require("./is_jwk.cjs.js"),i=e=>e?.[Symbol.toStringTag],o=(e,r,t)=>{if(void 0!==r.use&&"sig"!==r.use)throw new TypeError("Invalid key for this operation, when present its use must be sig");if(void 0!==r.key_ops&&!0!==r.key_ops.includes?.(t))throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${t}`);if(void 0!==r.alg&&r.alg!==e)throw new TypeError(`Invalid key for this operation, when present its alg must be ${e}`);return!0};function s(s,n,y,p){n.startsWith("HS")||"dir"===n||n.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(n)?((s,n,y,p)=>{if(!(n instanceof Uint8Array)){if(p&&t.isJWK(n)){if(t.isSecretJWK(n)&&o(s,n,y))return;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')}if(!r.default(n))throw new TypeError(e.withAlg(s,n,...r.types,"Uint8Array",p?"JSON Web Key":null));if("secret"!==n.type)throw new TypeError(`${i(n)} instances for symmetric algorithms must be of type "secret"`)}})(n,y,p,s):((s,n,y,p)=>{if(p&&t.isJWK(n))switch(y){case"sign":if(t.isPrivateJWK(n)&&o(s,n,y))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(t.isPublicJWK(n)&&o(s,n,y))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!r.default(n))throw new TypeError(e.withAlg(s,n,...r.types,p?"JSON Web Key":null));if("secret"===n.type)throw new TypeError(`${i(n)} instances for asymmetric algorithms must not be of type "secret"`);if("sign"===y&&"public"===n.type)throw new TypeError(`${i(n)} instances for asymmetric algorithm signing must be of type "private"`);if("decrypt"===y&&"public"===n.type)throw new TypeError(`${i(n)} instances for asymmetric algorithm decryption must be of type "private"`);if(n.algorithm&&"verify"===y&&"private"===n.type)throw new TypeError(`${i(n)} instances for asymmetric algorithm verifying must be of type "public"`);if(n.algorithm&&"encrypt"===y&&"private"===n.type)throw new TypeError(`${i(n)} instances for asymmetric algorithm encryption must be of type "public"`)})(n,y,p,s)}s.bind(void 0,!1);const n=s.bind(void 0,!0);exports.checkKeyTypeWithJwk=n;
|
|
2
|
+
//# sourceMappingURL=check_key_type.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check_key_type.cjs.js","sources":["../../../../../../node_modules/jose/dist/browser/lib/check_key_type.js"],"sourcesContent":["import { withAlg as invalidKeyInput } from './invalid_key_input.js';\nimport isKeyLike, { types } from '../runtime/is_key_like.js';\nimport * as jwk from './is_jwk.js';\nconst tag = (key) => key?.[Symbol.toStringTag];\nconst jwkMatchesOp = (alg, key, usage) => {\n if (key.use !== undefined && key.use !== 'sig') {\n throw new TypeError('Invalid key for this operation, when present its use must be sig');\n }\n if (key.key_ops !== undefined && key.key_ops.includes?.(usage) !== true) {\n throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${usage}`);\n }\n if (key.alg !== undefined && key.alg !== alg) {\n throw new TypeError(`Invalid key for this operation, when present its alg must be ${alg}`);\n }\n return true;\n};\nconst symmetricTypeCheck = (alg, key, usage, allowJwk) => {\n if (key instanceof Uint8Array)\n return;\n if (allowJwk && jwk.isJWK(key)) {\n if (jwk.isSecretJWK(key) && jwkMatchesOp(alg, key, usage))\n return;\n 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`);\n }\n if (!isKeyLike(key)) {\n throw new TypeError(invalidKeyInput(alg, key, ...types, 'Uint8Array', allowJwk ? 'JSON Web Key' : null));\n }\n if (key.type !== 'secret') {\n throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type \"secret\"`);\n }\n};\nconst asymmetricTypeCheck = (alg, key, usage, allowJwk) => {\n if (allowJwk && jwk.isJWK(key)) {\n switch (usage) {\n case 'sign':\n if (jwk.isPrivateJWK(key) && jwkMatchesOp(alg, key, usage))\n return;\n throw new TypeError(`JSON Web Key for this operation be a private JWK`);\n case 'verify':\n if (jwk.isPublicJWK(key) && jwkMatchesOp(alg, key, usage))\n return;\n throw new TypeError(`JSON Web Key for this operation be a public JWK`);\n }\n }\n if (!isKeyLike(key)) {\n throw new TypeError(invalidKeyInput(alg, key, ...types, allowJwk ? 'JSON Web Key' : null));\n }\n if (key.type === 'secret') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type \"secret\"`);\n }\n if (usage === 'sign' && key.type === 'public') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type \"private\"`);\n }\n if (usage === 'decrypt' && key.type === 'public') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type \"private\"`);\n }\n if (key.algorithm && usage === 'verify' && key.type === 'private') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm verifying must be of type \"public\"`);\n }\n if (key.algorithm && usage === 'encrypt' && key.type === 'private') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm encryption must be of type \"public\"`);\n }\n};\nfunction checkKeyType(allowJwk, alg, key, usage) {\n const symmetric = alg.startsWith('HS') ||\n alg === 'dir' ||\n alg.startsWith('PBES2') ||\n /^A\\d{3}(?:GCM)?KW$/.test(alg);\n if (symmetric) {\n symmetricTypeCheck(alg, key, usage, allowJwk);\n }\n else {\n asymmetricTypeCheck(alg, key, usage, allowJwk);\n }\n}\nexport default checkKeyType.bind(undefined, false);\nexport const checkKeyTypeWithJwk = checkKeyType.bind(undefined, true);\n"],"names":["tag","key","Symbol","toStringTag","jwkMatchesOp","alg","usage","use","TypeError","key_ops","includes","checkKeyType","allowJwk","startsWith","test","Uint8Array","jwk.isJWK","jwk.isSecretJWK","isKeyLike","invalidKeyInput","types","type","symmetricTypeCheck","jwk.isPrivateJWK","jwk.isPublicJWK","algorithm","asymmetricTypeCheck","bind","checkKeyTypeWithJwk"],"mappings":"sMAGMA,EAAOC,GAAQA,IAAMC,OAAOC,aAC5BC,EAAe,CAACC,EAAKJ,EAAKK,KAC5B,QAAgB,IAAZL,EAAIM,KAAiC,QAAZN,EAAIM,IAC7B,MAAM,IAAIC,UAAU,oEAExB,QAAoB,IAAhBP,EAAIQ,UAA2D,IAAlCR,EAAIQ,QAAQC,WAAWJ,GACpD,MAAM,IAAIE,UAAU,yEAAyEF,KAEjG,QAAgB,IAAZL,EAAII,KAAqBJ,EAAII,MAAQA,EACrC,MAAM,IAAIG,UAAU,gEAAgEH,KAExF,OAAO,GAiDX,SAASM,EAAaC,EAAUP,EAAKJ,EAAKK,GACpBD,EAAIQ,WAAW,OACrB,QAARR,GACAA,EAAIQ,WAAW,UACf,qBAAqBC,KAAKT,GAnDP,EAACA,EAAKJ,EAAKK,EAAOM,KACzC,KAAIX,aAAec,YAAnB,CAEA,GAAIH,GAAYI,QAAUf,GAAM,CAC5B,GAAIgB,EAAAA,YAAgBhB,IAAQG,EAAaC,EAAKJ,EAAKK,GAC/C,OACJ,MAAM,IAAIE,UAAU,0HACxB,CACA,IAAKU,EAAAA,QAAUjB,GACX,MAAM,IAAIO,UAAUW,UAAgBd,EAAKJ,KAAQmB,EAAAA,MAAO,aAAcR,EAAW,eAAiB,OAEtG,GAAiB,WAAbX,EAAIoB,KACJ,MAAM,IAAIb,UAAU,GAAGR,EAAIC,iEAV3B,GAmDAqB,CAAmBjB,EAAKJ,EAAKK,EAAOM,GAtChB,EAACP,EAAKJ,EAAKK,EAAOM,KAC1C,GAAIA,GAAYI,QAAUf,GACtB,OAAQK,GACJ,IAAK,OACD,GAAIiB,EAAAA,aAAiBtB,IAAQG,EAAaC,EAAKJ,EAAKK,GAChD,OACJ,MAAM,IAAIE,UAAU,oDACxB,IAAK,SACD,GAAIgB,EAAAA,YAAgBvB,IAAQG,EAAaC,EAAKJ,EAAKK,GAC/C,OACJ,MAAM,IAAIE,UAAU,mDAGhC,IAAKU,EAAAA,QAAUjB,GACX,MAAM,IAAIO,UAAUW,EAAAA,QAAgBd,EAAKJ,KAAQmB,EAAAA,MAAOR,EAAW,eAAiB,OAExF,GAAiB,WAAbX,EAAIoB,KACJ,MAAM,IAAIb,UAAU,GAAGR,EAAIC,uEAE/B,GAAc,SAAVK,GAAiC,WAAbL,EAAIoB,KACxB,MAAM,IAAIb,UAAU,GAAGR,EAAIC,2EAE/B,GAAc,YAAVK,GAAoC,WAAbL,EAAIoB,KAC3B,MAAM,IAAIb,UAAU,GAAGR,EAAIC,8EAE/B,GAAIA,EAAIwB,WAAuB,WAAVnB,GAAmC,YAAbL,EAAIoB,KAC3C,MAAM,IAAIb,UAAU,GAAGR,EAAIC,4EAE/B,GAAIA,EAAIwB,WAAuB,YAAVnB,GAAoC,YAAbL,EAAIoB,KAC5C,MAAM,IAAIb,UAAU,GAAGR,EAAIC,8EAY3ByB,CAAoBrB,EAAKJ,EAAKK,EAAOM,EAE7C,CACeD,EAAagB,aAAgB,GAChC,MAACC,EAAsBjB,EAAagB,UAAK,GAAW","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { withAlg } from "./invalid_key_input.esm.js";
|
|
2
|
+
import isKeyLike, { types } from "../runtime/is_key_like.esm.js";
|
|
3
|
+
import { isJWK, isSecretJWK, isPublicJWK, isPrivateJWK } from "./is_jwk.esm.js";
|
|
4
|
+
const tag = (key) => key?.[Symbol.toStringTag];
|
|
5
|
+
const jwkMatchesOp = (alg, key, usage) => {
|
|
6
|
+
if (key.use !== void 0 && key.use !== "sig") {
|
|
7
|
+
throw new TypeError("Invalid key for this operation, when present its use must be sig");
|
|
8
|
+
}
|
|
9
|
+
if (key.key_ops !== void 0 && key.key_ops.includes?.(usage) !== true) {
|
|
10
|
+
throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${usage}`);
|
|
11
|
+
}
|
|
12
|
+
if (key.alg !== void 0 && key.alg !== alg) {
|
|
13
|
+
throw new TypeError(`Invalid key for this operation, when present its alg must be ${alg}`);
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
};
|
|
17
|
+
const symmetricTypeCheck = (alg, key, usage, allowJwk) => {
|
|
18
|
+
if (key instanceof Uint8Array)
|
|
19
|
+
return;
|
|
20
|
+
if (allowJwk && isJWK(key)) {
|
|
21
|
+
if (isSecretJWK(key) && jwkMatchesOp(alg, key, usage))
|
|
22
|
+
return;
|
|
23
|
+
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`);
|
|
24
|
+
}
|
|
25
|
+
if (!isKeyLike(key)) {
|
|
26
|
+
throw new TypeError(withAlg(alg, key, ...types, "Uint8Array", allowJwk ? "JSON Web Key" : null));
|
|
27
|
+
}
|
|
28
|
+
if (key.type !== "secret") {
|
|
29
|
+
throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type "secret"`);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const asymmetricTypeCheck = (alg, key, usage, allowJwk) => {
|
|
33
|
+
if (allowJwk && isJWK(key)) {
|
|
34
|
+
switch (usage) {
|
|
35
|
+
case "sign":
|
|
36
|
+
if (isPrivateJWK(key) && jwkMatchesOp(alg, key, usage))
|
|
37
|
+
return;
|
|
38
|
+
throw new TypeError(`JSON Web Key for this operation be a private JWK`);
|
|
39
|
+
case "verify":
|
|
40
|
+
if (isPublicJWK(key) && jwkMatchesOp(alg, key, usage))
|
|
41
|
+
return;
|
|
42
|
+
throw new TypeError(`JSON Web Key for this operation be a public JWK`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (!isKeyLike(key)) {
|
|
46
|
+
throw new TypeError(withAlg(alg, key, ...types, allowJwk ? "JSON Web Key" : null));
|
|
47
|
+
}
|
|
48
|
+
if (key.type === "secret") {
|
|
49
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type "secret"`);
|
|
50
|
+
}
|
|
51
|
+
if (usage === "sign" && key.type === "public") {
|
|
52
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type "private"`);
|
|
53
|
+
}
|
|
54
|
+
if (usage === "decrypt" && key.type === "public") {
|
|
55
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type "private"`);
|
|
56
|
+
}
|
|
57
|
+
if (key.algorithm && usage === "verify" && key.type === "private") {
|
|
58
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithm verifying must be of type "public"`);
|
|
59
|
+
}
|
|
60
|
+
if (key.algorithm && usage === "encrypt" && key.type === "private") {
|
|
61
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
function checkKeyType(allowJwk, alg, key, usage) {
|
|
65
|
+
const symmetric = alg.startsWith("HS") || alg === "dir" || alg.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(alg);
|
|
66
|
+
if (symmetric) {
|
|
67
|
+
symmetricTypeCheck(alg, key, usage, allowJwk);
|
|
68
|
+
} else {
|
|
69
|
+
asymmetricTypeCheck(alg, key, usage, allowJwk);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
checkKeyType.bind(void 0, false);
|
|
73
|
+
const checkKeyTypeWithJwk = checkKeyType.bind(void 0, true);
|
|
74
|
+
export {
|
|
75
|
+
checkKeyTypeWithJwk
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=check_key_type.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check_key_type.esm.js","sources":["../../../../../../node_modules/jose/dist/browser/lib/check_key_type.js"],"sourcesContent":["import { withAlg as invalidKeyInput } from './invalid_key_input.js';\nimport isKeyLike, { types } from '../runtime/is_key_like.js';\nimport * as jwk from './is_jwk.js';\nconst tag = (key) => key?.[Symbol.toStringTag];\nconst jwkMatchesOp = (alg, key, usage) => {\n if (key.use !== undefined && key.use !== 'sig') {\n throw new TypeError('Invalid key for this operation, when present its use must be sig');\n }\n if (key.key_ops !== undefined && key.key_ops.includes?.(usage) !== true) {\n throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${usage}`);\n }\n if (key.alg !== undefined && key.alg !== alg) {\n throw new TypeError(`Invalid key for this operation, when present its alg must be ${alg}`);\n }\n return true;\n};\nconst symmetricTypeCheck = (alg, key, usage, allowJwk) => {\n if (key instanceof Uint8Array)\n return;\n if (allowJwk && jwk.isJWK(key)) {\n if (jwk.isSecretJWK(key) && jwkMatchesOp(alg, key, usage))\n return;\n 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`);\n }\n if (!isKeyLike(key)) {\n throw new TypeError(invalidKeyInput(alg, key, ...types, 'Uint8Array', allowJwk ? 'JSON Web Key' : null));\n }\n if (key.type !== 'secret') {\n throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type \"secret\"`);\n }\n};\nconst asymmetricTypeCheck = (alg, key, usage, allowJwk) => {\n if (allowJwk && jwk.isJWK(key)) {\n switch (usage) {\n case 'sign':\n if (jwk.isPrivateJWK(key) && jwkMatchesOp(alg, key, usage))\n return;\n throw new TypeError(`JSON Web Key for this operation be a private JWK`);\n case 'verify':\n if (jwk.isPublicJWK(key) && jwkMatchesOp(alg, key, usage))\n return;\n throw new TypeError(`JSON Web Key for this operation be a public JWK`);\n }\n }\n if (!isKeyLike(key)) {\n throw new TypeError(invalidKeyInput(alg, key, ...types, allowJwk ? 'JSON Web Key' : null));\n }\n if (key.type === 'secret') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type \"secret\"`);\n }\n if (usage === 'sign' && key.type === 'public') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type \"private\"`);\n }\n if (usage === 'decrypt' && key.type === 'public') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type \"private\"`);\n }\n if (key.algorithm && usage === 'verify' && key.type === 'private') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm verifying must be of type \"public\"`);\n }\n if (key.algorithm && usage === 'encrypt' && key.type === 'private') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm encryption must be of type \"public\"`);\n }\n};\nfunction checkKeyType(allowJwk, alg, key, usage) {\n const symmetric = alg.startsWith('HS') ||\n alg === 'dir' ||\n alg.startsWith('PBES2') ||\n /^A\\d{3}(?:GCM)?KW$/.test(alg);\n if (symmetric) {\n symmetricTypeCheck(alg, key, usage, allowJwk);\n }\n else {\n asymmetricTypeCheck(alg, key, usage, allowJwk);\n }\n}\nexport default checkKeyType.bind(undefined, false);\nexport const checkKeyTypeWithJwk = checkKeyType.bind(undefined, true);\n"],"names":["jwk.isJWK","jwk.isSecretJWK","invalidKeyInput","jwk.isPrivateJWK","jwk.isPublicJWK"],"mappings":";;;AAGA,MAAM,MAAM,CAAC,QAAQ,MAAM,OAAO,WAAW;AAC7C,MAAM,eAAe,CAAC,KAAK,KAAK,UAAU;AACtC,MAAI,IAAI,QAAQ,UAAa,IAAI,QAAQ,OAAO;AAC5C,UAAM,IAAI,UAAU,kEAAkE;AAAA,EAC1F;AACA,MAAI,IAAI,YAAY,UAAa,IAAI,QAAQ,WAAW,KAAK,MAAM,MAAM;AACrE,UAAM,IAAI,UAAU,yEAAyE,KAAK,EAAE;AAAA,EACxG;AACA,MAAI,IAAI,QAAQ,UAAa,IAAI,QAAQ,KAAK;AAC1C,UAAM,IAAI,UAAU,gEAAgE,GAAG,EAAE;AAAA,EAC7F;AACA,SAAO;AACX;AACA,MAAM,qBAAqB,CAAC,KAAK,KAAK,OAAO,aAAa;AACtD,MAAI,eAAe;AACf;AACJ,MAAI,YAAYA,MAAU,GAAG,GAAG;AAC5B,QAAIC,YAAgB,GAAG,KAAK,aAAa,KAAK,KAAK,KAAK;AACpD;AACJ,UAAM,IAAI,UAAU,yHAAyH;AAAA,EACjJ;AACA,MAAI,CAAC,UAAU,GAAG,GAAG;AACjB,UAAM,IAAI,UAAUC,QAAgB,KAAK,KAAK,GAAG,OAAO,cAAc,WAAW,iBAAiB,IAAI,CAAC;AAAA,EAC3G;AACA,MAAI,IAAI,SAAS,UAAU;AACvB,UAAM,IAAI,UAAU,GAAG,IAAI,GAAG,CAAC,8DAA8D;AAAA,EACjG;AACJ;AACA,MAAM,sBAAsB,CAAC,KAAK,KAAK,OAAO,aAAa;AACvD,MAAI,YAAYF,MAAU,GAAG,GAAG;AAC5B,YAAQ,OAAK;AAAA,MACT,KAAK;AACD,YAAIG,aAAiB,GAAG,KAAK,aAAa,KAAK,KAAK,KAAK;AACrD;AACJ,cAAM,IAAI,UAAU,kDAAkD;AAAA,MAC1E,KAAK;AACD,YAAIC,YAAgB,GAAG,KAAK,aAAa,KAAK,KAAK,KAAK;AACpD;AACJ,cAAM,IAAI,UAAU,iDAAiD;AAAA,IACrF;AAAA,EACI;AACA,MAAI,CAAC,UAAU,GAAG,GAAG;AACjB,UAAM,IAAI,UAAUF,QAAgB,KAAK,KAAK,GAAG,OAAO,WAAW,iBAAiB,IAAI,CAAC;AAAA,EAC7F;AACA,MAAI,IAAI,SAAS,UAAU;AACvB,UAAM,IAAI,UAAU,GAAG,IAAI,GAAG,CAAC,mEAAmE;AAAA,EACtG;AACA,MAAI,UAAU,UAAU,IAAI,SAAS,UAAU;AAC3C,UAAM,IAAI,UAAU,GAAG,IAAI,GAAG,CAAC,uEAAuE;AAAA,EAC1G;AACA,MAAI,UAAU,aAAa,IAAI,SAAS,UAAU;AAC9C,UAAM,IAAI,UAAU,GAAG,IAAI,GAAG,CAAC,0EAA0E;AAAA,EAC7G;AACA,MAAI,IAAI,aAAa,UAAU,YAAY,IAAI,SAAS,WAAW;AAC/D,UAAM,IAAI,UAAU,GAAG,IAAI,GAAG,CAAC,wEAAwE;AAAA,EAC3G;AACA,MAAI,IAAI,aAAa,UAAU,aAAa,IAAI,SAAS,WAAW;AAChE,UAAM,IAAI,UAAU,GAAG,IAAI,GAAG,CAAC,yEAAyE;AAAA,EAC5G;AACJ;AACA,SAAS,aAAa,UAAU,KAAK,KAAK,OAAO;AAC7C,QAAM,YAAY,IAAI,WAAW,IAAI,KACjC,QAAQ,SACR,IAAI,WAAW,OAAO,KACtB,qBAAqB,KAAK,GAAG;AACjC,MAAI,WAAW;AACX,uBAAmB,KAAK,KAAK,OAAO,QAAQ;AAAA,EAChD,OACK;AACD,wBAAoB,KAAK,KAAK,OAAO,QAAQ;AAAA,EACjD;AACJ;AACe,aAAa,KAAK,QAAW,KAAK;AACrC,MAAC,sBAAsB,aAAa,KAAK,QAAW,IAAI;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";function e(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function t(e,t){return e.name===t}function r(e){return parseInt(e.name.slice(4),10)}Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.checkSigCryptoKey=function(o,a,...s){switch(a){case"HS256":case"HS384":case"HS512":{if(!t(o.algorithm,"HMAC"))throw e("HMAC");const s=parseInt(a.slice(2),10);if(r(o.algorithm.hash)!==s)throw e(`SHA-${s}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!t(o.algorithm,"RSASSA-PKCS1-v1_5"))throw e("RSASSA-PKCS1-v1_5");const s=parseInt(a.slice(2),10);if(r(o.algorithm.hash)!==s)throw e(`SHA-${s}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!t(o.algorithm,"RSA-PSS"))throw e("RSA-PSS");const s=parseInt(a.slice(2),10);if(r(o.algorithm.hash)!==s)throw e(`SHA-${s}`,"algorithm.hash");break}case"EdDSA":if("Ed25519"!==o.algorithm.name&&"Ed448"!==o.algorithm.name)throw e("Ed25519 or Ed448");break;case"Ed25519":if(!t(o.algorithm,"Ed25519"))throw e("Ed25519");break;case"ES256":case"ES384":case"ES512":{if(!t(o.algorithm,"ECDSA"))throw e("ECDSA");const r=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}(a);if(o.algorithm.namedCurve!==r)throw e(r,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}!function(e,t){if(t.length&&!t.some(t=>e.usages.includes(t))){let e="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const r=t.pop();e+=`one of ${t.join(", ")}, or ${r}.`}else 2===t.length?e+=`one of ${t[0]} or ${t[1]}.`:e+=`${t[0]}.`;throw new TypeError(e)}}(o,s)};
|
|
2
|
+
//# sourceMappingURL=crypto_key.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto_key.cjs.js","sources":["../../../../../../node_modules/jose/dist/browser/lib/crypto_key.js"],"sourcesContent":["function unusable(name, prop = 'algorithm.name') {\n return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);\n}\nfunction isAlgorithm(algorithm, name) {\n return algorithm.name === name;\n}\nfunction getHashLength(hash) {\n return parseInt(hash.name.slice(4), 10);\n}\nfunction getNamedCurve(alg) {\n switch (alg) {\n case 'ES256':\n return 'P-256';\n case 'ES384':\n return 'P-384';\n case 'ES512':\n return 'P-521';\n default:\n throw new Error('unreachable');\n }\n}\nfunction checkUsage(key, usages) {\n if (usages.length && !usages.some((expected) => key.usages.includes(expected))) {\n let msg = 'CryptoKey does not support this operation, its usages must include ';\n if (usages.length > 2) {\n const last = usages.pop();\n msg += `one of ${usages.join(', ')}, or ${last}.`;\n }\n else if (usages.length === 2) {\n msg += `one of ${usages[0]} or ${usages[1]}.`;\n }\n else {\n msg += `${usages[0]}.`;\n }\n throw new TypeError(msg);\n }\n}\nexport function checkSigCryptoKey(key, alg, ...usages) {\n switch (alg) {\n case 'HS256':\n case 'HS384':\n case 'HS512': {\n if (!isAlgorithm(key.algorithm, 'HMAC'))\n throw unusable('HMAC');\n const expected = parseInt(alg.slice(2), 10);\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n case 'RS256':\n case 'RS384':\n case 'RS512': {\n if (!isAlgorithm(key.algorithm, 'RSASSA-PKCS1-v1_5'))\n throw unusable('RSASSA-PKCS1-v1_5');\n const expected = parseInt(alg.slice(2), 10);\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n case 'PS256':\n case 'PS384':\n case 'PS512': {\n if (!isAlgorithm(key.algorithm, 'RSA-PSS'))\n throw unusable('RSA-PSS');\n const expected = parseInt(alg.slice(2), 10);\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n case 'EdDSA': {\n if (key.algorithm.name !== 'Ed25519' && key.algorithm.name !== 'Ed448') {\n throw unusable('Ed25519 or Ed448');\n }\n break;\n }\n case 'Ed25519': {\n if (!isAlgorithm(key.algorithm, 'Ed25519'))\n throw unusable('Ed25519');\n break;\n }\n case 'ES256':\n case 'ES384':\n case 'ES512': {\n if (!isAlgorithm(key.algorithm, 'ECDSA'))\n throw unusable('ECDSA');\n const expected = getNamedCurve(alg);\n const actual = key.algorithm.namedCurve;\n if (actual !== expected)\n throw unusable(expected, 'algorithm.namedCurve');\n break;\n }\n default:\n throw new TypeError('CryptoKey does not support this operation');\n }\n checkUsage(key, usages);\n}\nexport function checkEncCryptoKey(key, alg, ...usages) {\n switch (alg) {\n case 'A128GCM':\n case 'A192GCM':\n case 'A256GCM': {\n if (!isAlgorithm(key.algorithm, 'AES-GCM'))\n throw unusable('AES-GCM');\n const expected = parseInt(alg.slice(1, 4), 10);\n const actual = key.algorithm.length;\n if (actual !== expected)\n throw unusable(expected, 'algorithm.length');\n break;\n }\n case 'A128KW':\n case 'A192KW':\n case 'A256KW': {\n if (!isAlgorithm(key.algorithm, 'AES-KW'))\n throw unusable('AES-KW');\n const expected = parseInt(alg.slice(1, 4), 10);\n const actual = key.algorithm.length;\n if (actual !== expected)\n throw unusable(expected, 'algorithm.length');\n break;\n }\n case 'ECDH': {\n switch (key.algorithm.name) {\n case 'ECDH':\n case 'X25519':\n case 'X448':\n break;\n default:\n throw unusable('ECDH, X25519, or X448');\n }\n break;\n }\n case 'PBES2-HS256+A128KW':\n case 'PBES2-HS384+A192KW':\n case 'PBES2-HS512+A256KW':\n if (!isAlgorithm(key.algorithm, 'PBKDF2'))\n throw unusable('PBKDF2');\n break;\n case 'RSA-OAEP':\n case 'RSA-OAEP-256':\n case 'RSA-OAEP-384':\n case 'RSA-OAEP-512': {\n if (!isAlgorithm(key.algorithm, 'RSA-OAEP'))\n throw unusable('RSA-OAEP');\n const expected = parseInt(alg.slice(9), 10) || 1;\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n default:\n throw new TypeError('CryptoKey does not support this operation');\n }\n checkUsage(key, usages);\n}\n"],"names":["unusable","name","prop","TypeError","isAlgorithm","algorithm","getHashLength","hash","parseInt","slice","key","alg","usages","expected","Error","getNamedCurve","namedCurve","length","some","includes","msg","last","pop","join","checkUsage"],"mappings":"aAAA,SAASA,EAASC,EAAMC,EAAO,kBAC3B,OAAO,IAAIC,UAAU,kDAAkDD,aAAgBD,IAC3F,CACA,SAASG,EAAYC,EAAWJ,GAC5B,OAAOI,EAAUJ,OAASA,CAC9B,CACA,SAASK,EAAcC,GACnB,OAAOC,SAASD,EAAKN,KAAKQ,MAAM,GAAI,GACxC,8FA6BO,SAA2BC,EAAKC,KAAQC,GAC3C,OAAQD,GACJ,IAAK,QACL,IAAK,QACL,IAAK,QAAS,CACV,IAAKP,EAAYM,EAAIL,UAAW,QAC5B,MAAML,EAAS,QACnB,MAAMa,EAAWL,SAASG,EAAIF,MAAM,GAAI,IAExC,GADeH,EAAcI,EAAIL,UAAUE,QAC5BM,EACX,MAAMb,EAAS,OAAOa,IAAY,kBACtC,KACJ,CACA,IAAK,QACL,IAAK,QACL,IAAK,QAAS,CACV,IAAKT,EAAYM,EAAIL,UAAW,qBAC5B,MAAML,EAAS,qBACnB,MAAMa,EAAWL,SAASG,EAAIF,MAAM,GAAI,IAExC,GADeH,EAAcI,EAAIL,UAAUE,QAC5BM,EACX,MAAMb,EAAS,OAAOa,IAAY,kBACtC,KACJ,CACA,IAAK,QACL,IAAK,QACL,IAAK,QAAS,CACV,IAAKT,EAAYM,EAAIL,UAAW,WAC5B,MAAML,EAAS,WACnB,MAAMa,EAAWL,SAASG,EAAIF,MAAM,GAAI,IAExC,GADeH,EAAcI,EAAIL,UAAUE,QAC5BM,EACX,MAAMb,EAAS,OAAOa,IAAY,kBACtC,KACJ,CACA,IAAK,QACD,GAA2B,YAAvBH,EAAIL,UAAUJ,MAA6C,UAAvBS,EAAIL,UAAUJ,KAClD,MAAMD,EAAS,oBAEnB,MAEJ,IAAK,UACD,IAAKI,EAAYM,EAAIL,UAAW,WAC5B,MAAML,EAAS,WACnB,MAEJ,IAAK,QACL,IAAK,QACL,IAAK,QAAS,CACV,IAAKI,EAAYM,EAAIL,UAAW,SAC5B,MAAML,EAAS,SACnB,MAAMa,EA/ElB,SAAuBF,GACnB,OAAQA,GACJ,IAAK,QACD,MAAO,QACX,IAAK,QACD,MAAO,QACX,IAAK,QACD,MAAO,QACX,QACI,MAAM,IAAIG,MAAM,eAE5B,CAoE6BC,CAAcJ,GAE/B,GADeD,EAAIL,UAAUW,aACdH,EACX,MAAMb,EAASa,EAAU,wBAC7B,KACJ,CACA,QACI,MAAM,IAAIV,UAAU,8CA1EhC,SAAoBO,EAAKE,GACrB,GAAIA,EAAOK,SAAWL,EAAOM,KAAML,GAAaH,EAAIE,OAAOO,SAASN,IAAY,CAC5E,IAAIO,EAAM,sEACV,GAAIR,EAAOK,OAAS,EAAG,CACnB,MAAMI,EAAOT,EAAOU,MACpBF,GAAO,UAAUR,EAAOW,KAAK,aAAaF,IAC9C,MAC2B,IAAlBT,EAAOK,OACZG,GAAO,UAAUR,EAAO,SAASA,EAAO,MAGxCQ,GAAO,GAAGR,EAAO,MAErB,MAAM,IAAIT,UAAUiB,EACxB,CACJ,CA6DII,CAAWd,EAAKE,EACpB","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
function unusable(name, prop = "algorithm.name") {
|
|
2
|
+
return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
|
|
3
|
+
}
|
|
4
|
+
function isAlgorithm(algorithm, name) {
|
|
5
|
+
return algorithm.name === name;
|
|
6
|
+
}
|
|
7
|
+
function getHashLength(hash) {
|
|
8
|
+
return parseInt(hash.name.slice(4), 10);
|
|
9
|
+
}
|
|
10
|
+
function getNamedCurve(alg) {
|
|
11
|
+
switch (alg) {
|
|
12
|
+
case "ES256":
|
|
13
|
+
return "P-256";
|
|
14
|
+
case "ES384":
|
|
15
|
+
return "P-384";
|
|
16
|
+
case "ES512":
|
|
17
|
+
return "P-521";
|
|
18
|
+
default:
|
|
19
|
+
throw new Error("unreachable");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function checkUsage(key, usages) {
|
|
23
|
+
if (usages.length && !usages.some((expected) => key.usages.includes(expected))) {
|
|
24
|
+
let msg = "CryptoKey does not support this operation, its usages must include ";
|
|
25
|
+
if (usages.length > 2) {
|
|
26
|
+
const last = usages.pop();
|
|
27
|
+
msg += `one of ${usages.join(", ")}, or ${last}.`;
|
|
28
|
+
} else if (usages.length === 2) {
|
|
29
|
+
msg += `one of ${usages[0]} or ${usages[1]}.`;
|
|
30
|
+
} else {
|
|
31
|
+
msg += `${usages[0]}.`;
|
|
32
|
+
}
|
|
33
|
+
throw new TypeError(msg);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function checkSigCryptoKey(key, alg, ...usages) {
|
|
37
|
+
switch (alg) {
|
|
38
|
+
case "HS256":
|
|
39
|
+
case "HS384":
|
|
40
|
+
case "HS512": {
|
|
41
|
+
if (!isAlgorithm(key.algorithm, "HMAC"))
|
|
42
|
+
throw unusable("HMAC");
|
|
43
|
+
const expected = parseInt(alg.slice(2), 10);
|
|
44
|
+
const actual = getHashLength(key.algorithm.hash);
|
|
45
|
+
if (actual !== expected)
|
|
46
|
+
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
case "RS256":
|
|
50
|
+
case "RS384":
|
|
51
|
+
case "RS512": {
|
|
52
|
+
if (!isAlgorithm(key.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
53
|
+
throw unusable("RSASSA-PKCS1-v1_5");
|
|
54
|
+
const expected = parseInt(alg.slice(2), 10);
|
|
55
|
+
const actual = getHashLength(key.algorithm.hash);
|
|
56
|
+
if (actual !== expected)
|
|
57
|
+
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
case "PS256":
|
|
61
|
+
case "PS384":
|
|
62
|
+
case "PS512": {
|
|
63
|
+
if (!isAlgorithm(key.algorithm, "RSA-PSS"))
|
|
64
|
+
throw unusable("RSA-PSS");
|
|
65
|
+
const expected = parseInt(alg.slice(2), 10);
|
|
66
|
+
const actual = getHashLength(key.algorithm.hash);
|
|
67
|
+
if (actual !== expected)
|
|
68
|
+
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
case "EdDSA": {
|
|
72
|
+
if (key.algorithm.name !== "Ed25519" && key.algorithm.name !== "Ed448") {
|
|
73
|
+
throw unusable("Ed25519 or Ed448");
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
case "Ed25519": {
|
|
78
|
+
if (!isAlgorithm(key.algorithm, "Ed25519"))
|
|
79
|
+
throw unusable("Ed25519");
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case "ES256":
|
|
83
|
+
case "ES384":
|
|
84
|
+
case "ES512": {
|
|
85
|
+
if (!isAlgorithm(key.algorithm, "ECDSA"))
|
|
86
|
+
throw unusable("ECDSA");
|
|
87
|
+
const expected = getNamedCurve(alg);
|
|
88
|
+
const actual = key.algorithm.namedCurve;
|
|
89
|
+
if (actual !== expected)
|
|
90
|
+
throw unusable(expected, "algorithm.namedCurve");
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
default:
|
|
94
|
+
throw new TypeError("CryptoKey does not support this operation");
|
|
95
|
+
}
|
|
96
|
+
checkUsage(key, usages);
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
checkSigCryptoKey
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=crypto_key.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto_key.esm.js","sources":["../../../../../../node_modules/jose/dist/browser/lib/crypto_key.js"],"sourcesContent":["function unusable(name, prop = 'algorithm.name') {\n return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);\n}\nfunction isAlgorithm(algorithm, name) {\n return algorithm.name === name;\n}\nfunction getHashLength(hash) {\n return parseInt(hash.name.slice(4), 10);\n}\nfunction getNamedCurve(alg) {\n switch (alg) {\n case 'ES256':\n return 'P-256';\n case 'ES384':\n return 'P-384';\n case 'ES512':\n return 'P-521';\n default:\n throw new Error('unreachable');\n }\n}\nfunction checkUsage(key, usages) {\n if (usages.length && !usages.some((expected) => key.usages.includes(expected))) {\n let msg = 'CryptoKey does not support this operation, its usages must include ';\n if (usages.length > 2) {\n const last = usages.pop();\n msg += `one of ${usages.join(', ')}, or ${last}.`;\n }\n else if (usages.length === 2) {\n msg += `one of ${usages[0]} or ${usages[1]}.`;\n }\n else {\n msg += `${usages[0]}.`;\n }\n throw new TypeError(msg);\n }\n}\nexport function checkSigCryptoKey(key, alg, ...usages) {\n switch (alg) {\n case 'HS256':\n case 'HS384':\n case 'HS512': {\n if (!isAlgorithm(key.algorithm, 'HMAC'))\n throw unusable('HMAC');\n const expected = parseInt(alg.slice(2), 10);\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n case 'RS256':\n case 'RS384':\n case 'RS512': {\n if (!isAlgorithm(key.algorithm, 'RSASSA-PKCS1-v1_5'))\n throw unusable('RSASSA-PKCS1-v1_5');\n const expected = parseInt(alg.slice(2), 10);\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n case 'PS256':\n case 'PS384':\n case 'PS512': {\n if (!isAlgorithm(key.algorithm, 'RSA-PSS'))\n throw unusable('RSA-PSS');\n const expected = parseInt(alg.slice(2), 10);\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n case 'EdDSA': {\n if (key.algorithm.name !== 'Ed25519' && key.algorithm.name !== 'Ed448') {\n throw unusable('Ed25519 or Ed448');\n }\n break;\n }\n case 'Ed25519': {\n if (!isAlgorithm(key.algorithm, 'Ed25519'))\n throw unusable('Ed25519');\n break;\n }\n case 'ES256':\n case 'ES384':\n case 'ES512': {\n if (!isAlgorithm(key.algorithm, 'ECDSA'))\n throw unusable('ECDSA');\n const expected = getNamedCurve(alg);\n const actual = key.algorithm.namedCurve;\n if (actual !== expected)\n throw unusable(expected, 'algorithm.namedCurve');\n break;\n }\n default:\n throw new TypeError('CryptoKey does not support this operation');\n }\n checkUsage(key, usages);\n}\nexport function checkEncCryptoKey(key, alg, ...usages) {\n switch (alg) {\n case 'A128GCM':\n case 'A192GCM':\n case 'A256GCM': {\n if (!isAlgorithm(key.algorithm, 'AES-GCM'))\n throw unusable('AES-GCM');\n const expected = parseInt(alg.slice(1, 4), 10);\n const actual = key.algorithm.length;\n if (actual !== expected)\n throw unusable(expected, 'algorithm.length');\n break;\n }\n case 'A128KW':\n case 'A192KW':\n case 'A256KW': {\n if (!isAlgorithm(key.algorithm, 'AES-KW'))\n throw unusable('AES-KW');\n const expected = parseInt(alg.slice(1, 4), 10);\n const actual = key.algorithm.length;\n if (actual !== expected)\n throw unusable(expected, 'algorithm.length');\n break;\n }\n case 'ECDH': {\n switch (key.algorithm.name) {\n case 'ECDH':\n case 'X25519':\n case 'X448':\n break;\n default:\n throw unusable('ECDH, X25519, or X448');\n }\n break;\n }\n case 'PBES2-HS256+A128KW':\n case 'PBES2-HS384+A192KW':\n case 'PBES2-HS512+A256KW':\n if (!isAlgorithm(key.algorithm, 'PBKDF2'))\n throw unusable('PBKDF2');\n break;\n case 'RSA-OAEP':\n case 'RSA-OAEP-256':\n case 'RSA-OAEP-384':\n case 'RSA-OAEP-512': {\n if (!isAlgorithm(key.algorithm, 'RSA-OAEP'))\n throw unusable('RSA-OAEP');\n const expected = parseInt(alg.slice(9), 10) || 1;\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n default:\n throw new TypeError('CryptoKey does not support this operation');\n }\n checkUsage(key, usages);\n}\n"],"names":[],"mappings":"AAAA,SAAS,SAAS,MAAM,OAAO,kBAAkB;AAC7C,SAAO,IAAI,UAAU,kDAAkD,IAAI,YAAY,IAAI,EAAE;AACjG;AACA,SAAS,YAAY,WAAW,MAAM;AAClC,SAAO,UAAU,SAAS;AAC9B;AACA,SAAS,cAAc,MAAM;AACzB,SAAO,SAAS,KAAK,KAAK,MAAM,CAAC,GAAG,EAAE;AAC1C;AACA,SAAS,cAAc,KAAK;AACxB,UAAQ,KAAG;AAAA,IACP,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX;AACI,YAAM,IAAI,MAAM,aAAa;AAAA,EACzC;AACA;AACA,SAAS,WAAW,KAAK,QAAQ;AAC7B,MAAI,OAAO,UAAU,CAAC,OAAO,KAAK,CAAC,aAAa,IAAI,OAAO,SAAS,QAAQ,CAAC,GAAG;AAC5E,QAAI,MAAM;AACV,QAAI,OAAO,SAAS,GAAG;AACnB,YAAM,OAAO,OAAO,IAAG;AACvB,aAAO,UAAU,OAAO,KAAK,IAAI,CAAC,QAAQ,IAAI;AAAA,IAClD,WACS,OAAO,WAAW,GAAG;AAC1B,aAAO,UAAU,OAAO,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC;AAAA,IAC9C,OACK;AACD,aAAO,GAAG,OAAO,CAAC,CAAC;AAAA,IACvB;AACA,UAAM,IAAI,UAAU,GAAG;AAAA,EAC3B;AACJ;AACO,SAAS,kBAAkB,KAAK,QAAQ,QAAQ;AACnD,UAAQ,KAAG;AAAA,IACP,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK,SAAS;AACV,UAAI,CAAC,YAAY,IAAI,WAAW,MAAM;AAClC,cAAM,SAAS,MAAM;AACzB,YAAM,WAAW,SAAS,IAAI,MAAM,CAAC,GAAG,EAAE;AAC1C,YAAM,SAAS,cAAc,IAAI,UAAU,IAAI;AAC/C,UAAI,WAAW;AACX,cAAM,SAAS,OAAO,QAAQ,IAAI,gBAAgB;AACtD;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK,SAAS;AACV,UAAI,CAAC,YAAY,IAAI,WAAW,mBAAmB;AAC/C,cAAM,SAAS,mBAAmB;AACtC,YAAM,WAAW,SAAS,IAAI,MAAM,CAAC,GAAG,EAAE;AAC1C,YAAM,SAAS,cAAc,IAAI,UAAU,IAAI;AAC/C,UAAI,WAAW;AACX,cAAM,SAAS,OAAO,QAAQ,IAAI,gBAAgB;AACtD;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK,SAAS;AACV,UAAI,CAAC,YAAY,IAAI,WAAW,SAAS;AACrC,cAAM,SAAS,SAAS;AAC5B,YAAM,WAAW,SAAS,IAAI,MAAM,CAAC,GAAG,EAAE;AAC1C,YAAM,SAAS,cAAc,IAAI,UAAU,IAAI;AAC/C,UAAI,WAAW;AACX,cAAM,SAAS,OAAO,QAAQ,IAAI,gBAAgB;AACtD;AAAA,IACJ;AAAA,IACA,KAAK,SAAS;AACV,UAAI,IAAI,UAAU,SAAS,aAAa,IAAI,UAAU,SAAS,SAAS;AACpE,cAAM,SAAS,kBAAkB;AAAA,MACrC;AACA;AAAA,IACJ;AAAA,IACA,KAAK,WAAW;AACZ,UAAI,CAAC,YAAY,IAAI,WAAW,SAAS;AACrC,cAAM,SAAS,SAAS;AAC5B;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK,SAAS;AACV,UAAI,CAAC,YAAY,IAAI,WAAW,OAAO;AACnC,cAAM,SAAS,OAAO;AAC1B,YAAM,WAAW,cAAc,GAAG;AAClC,YAAM,SAAS,IAAI,UAAU;AAC7B,UAAI,WAAW;AACX,cAAM,SAAS,UAAU,sBAAsB;AACnD;AAAA,IACJ;AAAA,IACA;AACI,YAAM,IAAI,UAAU,2CAA2C;AAAA,EAC3E;AACI,aAAW,KAAK,MAAM;AAC1B;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epoch.cjs.js","sources":["../../../../../../node_modules/jose/dist/browser/lib/epoch.js"],"sourcesContent":["export default (date) => Math.floor(date.getTime() / 1000);\n"],"names":["date","Math","floor","getTime"],"mappings":"4HAAgBA,GAASC,KAAKC,MAAMF,EAAKG,UAAY","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epoch.esm.js","sources":["../../../../../../node_modules/jose/dist/browser/lib/epoch.js"],"sourcesContent":["export default (date) => Math.floor(date.getTime() / 1000);\n"],"names":[],"mappings":"AAAA,MAAA,QAAe,CAAC,SAAS,KAAK,MAAM,KAAK,QAAO,IAAK,GAAI;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";function e(e,t,...o){if((o=o.filter(Boolean)).length>2){const t=o.pop();e+=`one of type ${o.join(", ")}, or ${t}.`}else 2===o.length?e+=`one of type ${o[0]} or ${o[1]}.`:e+=`of type ${o[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});exports.default=(t,...o)=>e("Key must be ",t,...o),exports.withAlg=function(t,o,...n){return e(`Key for the ${t} algorithm must be `,o,...n)};
|
|
2
|
+
//# sourceMappingURL=invalid_key_input.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invalid_key_input.cjs.js","sources":["../../../../../../node_modules/jose/dist/browser/lib/invalid_key_input.js"],"sourcesContent":["function message(msg, actual, ...types) {\n types = types.filter(Boolean);\n if (types.length > 2) {\n const last = types.pop();\n msg += `one of type ${types.join(', ')}, or ${last}.`;\n }\n else if (types.length === 2) {\n msg += `one of type ${types[0]} or ${types[1]}.`;\n }\n else {\n msg += `of type ${types[0]}.`;\n }\n if (actual == null) {\n msg += ` Received ${actual}`;\n }\n else if (typeof actual === 'function' && actual.name) {\n msg += ` Received function ${actual.name}`;\n }\n else if (typeof actual === 'object' && actual != null) {\n if (actual.constructor?.name) {\n msg += ` Received an instance of ${actual.constructor.name}`;\n }\n }\n return msg;\n}\nexport default (actual, ...types) => {\n return message('Key must be ', actual, ...types);\n};\nexport function withAlg(alg, actual, ...types) {\n return message(`Key for the ${alg} algorithm must be `, actual, ...types);\n}\n"],"names":["message","msg","actual","types","filter","Boolean","length","last","pop","join","name","constructor","alg"],"mappings":"aAAA,SAASA,EAAQC,EAAKC,KAAWC,GAE7B,IADAA,EAAQA,EAAMC,OAAOC,UACXC,OAAS,EAAG,CAClB,MAAMC,EAAOJ,EAAMK,MACnBP,GAAO,eAAeE,EAAMM,KAAK,aAAaF,IAClD,MAC0B,IAAjBJ,EAAMG,OACXL,GAAO,eAAeE,EAAM,SAASA,EAAM,MAG3CF,GAAO,WAAWE,EAAM,MAa5B,OAXc,MAAVD,EACAD,GAAO,aAAaC,IAEG,mBAAXA,GAAyBA,EAAOQ,KAC5CT,GAAO,sBAAsBC,EAAOQ,OAEb,iBAAXR,GAAiC,MAAVA,GAC/BA,EAAOS,aAAaD,OACpBT,GAAO,4BAA4BC,EAAOS,YAAYD,QAGvDT,CACX,gHACe,CAACC,KAAWC,IAChBH,EAAQ,eAAgBE,KAAWC,mBAEvC,SAAiBS,EAAKV,KAAWC,GACpC,OAAOH,EAAQ,eAAeY,uBAA0BV,KAAWC,EACvE","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
function message(msg, actual, ...types) {
|
|
2
|
+
types = types.filter(Boolean);
|
|
3
|
+
if (types.length > 2) {
|
|
4
|
+
const last = types.pop();
|
|
5
|
+
msg += `one of type ${types.join(", ")}, or ${last}.`;
|
|
6
|
+
} else if (types.length === 2) {
|
|
7
|
+
msg += `one of type ${types[0]} or ${types[1]}.`;
|
|
8
|
+
} else {
|
|
9
|
+
msg += `of type ${types[0]}.`;
|
|
10
|
+
}
|
|
11
|
+
if (actual == null) {
|
|
12
|
+
msg += ` Received ${actual}`;
|
|
13
|
+
} else if (typeof actual === "function" && actual.name) {
|
|
14
|
+
msg += ` Received function ${actual.name}`;
|
|
15
|
+
} else if (typeof actual === "object" && actual != null) {
|
|
16
|
+
if (actual.constructor?.name) {
|
|
17
|
+
msg += ` Received an instance of ${actual.constructor.name}`;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return msg;
|
|
21
|
+
}
|
|
22
|
+
const invalidKeyInput = (actual, ...types) => {
|
|
23
|
+
return message("Key must be ", actual, ...types);
|
|
24
|
+
};
|
|
25
|
+
function withAlg(alg, actual, ...types) {
|
|
26
|
+
return message(`Key for the ${alg} algorithm must be `, actual, ...types);
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
invalidKeyInput as default,
|
|
30
|
+
withAlg
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=invalid_key_input.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invalid_key_input.esm.js","sources":["../../../../../../node_modules/jose/dist/browser/lib/invalid_key_input.js"],"sourcesContent":["function message(msg, actual, ...types) {\n types = types.filter(Boolean);\n if (types.length > 2) {\n const last = types.pop();\n msg += `one of type ${types.join(', ')}, or ${last}.`;\n }\n else if (types.length === 2) {\n msg += `one of type ${types[0]} or ${types[1]}.`;\n }\n else {\n msg += `of type ${types[0]}.`;\n }\n if (actual == null) {\n msg += ` Received ${actual}`;\n }\n else if (typeof actual === 'function' && actual.name) {\n msg += ` Received function ${actual.name}`;\n }\n else if (typeof actual === 'object' && actual != null) {\n if (actual.constructor?.name) {\n msg += ` Received an instance of ${actual.constructor.name}`;\n }\n }\n return msg;\n}\nexport default (actual, ...types) => {\n return message('Key must be ', actual, ...types);\n};\nexport function withAlg(alg, actual, ...types) {\n return message(`Key for the ${alg} algorithm must be `, actual, ...types);\n}\n"],"names":[],"mappings":"AAAA,SAAS,QAAQ,KAAK,WAAW,OAAO;AACpC,UAAQ,MAAM,OAAO,OAAO;AAC5B,MAAI,MAAM,SAAS,GAAG;AAClB,UAAM,OAAO,MAAM,IAAG;AACtB,WAAO,eAAe,MAAM,KAAK,IAAI,CAAC,QAAQ,IAAI;AAAA,EACtD,WACS,MAAM,WAAW,GAAG;AACzB,WAAO,eAAe,MAAM,CAAC,CAAC,OAAO,MAAM,CAAC,CAAC;AAAA,EACjD,OACK;AACD,WAAO,WAAW,MAAM,CAAC,CAAC;AAAA,EAC9B;AACA,MAAI,UAAU,MAAM;AAChB,WAAO,aAAa,MAAM;AAAA,EAC9B,WACS,OAAO,WAAW,cAAc,OAAO,MAAM;AAClD,WAAO,sBAAsB,OAAO,IAAI;AAAA,EAC5C,WACS,OAAO,WAAW,YAAY,UAAU,MAAM;AACnD,QAAI,OAAO,aAAa,MAAM;AAC1B,aAAO,4BAA4B,OAAO,YAAY,IAAI;AAAA,IAC9D;AAAA,EACJ;AACA,SAAO;AACX;AACA,MAAA,kBAAe,CAAC,WAAW,UAAU;AACjC,SAAO,QAAQ,gBAAgB,QAAQ,GAAG,KAAK;AACnD;AACO,SAAS,QAAQ,KAAK,WAAW,OAAO;AAC3C,SAAO,QAAQ,eAAe,GAAG,uBAAuB,QAAQ,GAAG,KAAK;AAC5E;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});exports.default=(...e)=>{const t=e.filter(Boolean);if(0===t.length||1===t.length)return!0;let o;for(const r of t){const e=Object.keys(r);if(o&&0!==o.size)for(const t of e){if(o.has(t))return!1;o.add(t)}else o=new Set(e)}return!0};
|
|
2
|
+
//# sourceMappingURL=is_disjoint.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is_disjoint.cjs.js","sources":["../../../../../../node_modules/jose/dist/browser/lib/is_disjoint.js"],"sourcesContent":["const isDisjoint = (...headers) => {\n const sources = headers.filter(Boolean);\n if (sources.length === 0 || sources.length === 1) {\n return true;\n }\n let acc;\n for (const header of sources) {\n const parameters = Object.keys(header);\n if (!acc || acc.size === 0) {\n acc = new Set(parameters);\n continue;\n }\n for (const parameter of parameters) {\n if (acc.has(parameter)) {\n return false;\n }\n acc.add(parameter);\n }\n }\n return true;\n};\nexport default isDisjoint;\n"],"names":["headers","sources","filter","Boolean","length","acc","header","parameters","Object","keys","size","parameter","has","add","Set"],"mappings":"4HAAmB,IAAIA,KACnB,MAAMC,EAAUD,EAAQE,OAAOC,SAC/B,GAAuB,IAAnBF,EAAQG,QAAmC,IAAnBH,EAAQG,OAChC,OAAO,EAEX,IAAIC,EACJ,IAAA,MAAWC,KAAUL,EAAS,CAC1B,MAAMM,EAAaC,OAAOC,KAAKH,GAC/B,GAAKD,GAAoB,IAAbA,EAAIK,KAIhB,IAAA,MAAWC,KAAaJ,EAAY,CAChC,GAAIF,EAAIO,IAAID,GACR,OAAO,EAEXN,EAAIQ,IAAIF,EACZ,MARIN,EAAM,IAAIS,IAAIP,EAStB,CACA,OAAO","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const isDisjoint = (...headers) => {
|
|
2
|
+
const sources = headers.filter(Boolean);
|
|
3
|
+
if (sources.length === 0 || sources.length === 1) {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
let acc;
|
|
7
|
+
for (const header of sources) {
|
|
8
|
+
const parameters = Object.keys(header);
|
|
9
|
+
if (!acc || acc.size === 0) {
|
|
10
|
+
acc = new Set(parameters);
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
for (const parameter of parameters) {
|
|
14
|
+
if (acc.has(parameter)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
acc.add(parameter);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
isDisjoint as default
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=is_disjoint.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is_disjoint.esm.js","sources":["../../../../../../node_modules/jose/dist/browser/lib/is_disjoint.js"],"sourcesContent":["const isDisjoint = (...headers) => {\n const sources = headers.filter(Boolean);\n if (sources.length === 0 || sources.length === 1) {\n return true;\n }\n let acc;\n for (const header of sources) {\n const parameters = Object.keys(header);\n if (!acc || acc.size === 0) {\n acc = new Set(parameters);\n continue;\n }\n for (const parameter of parameters) {\n if (acc.has(parameter)) {\n return false;\n }\n acc.add(parameter);\n }\n }\n return true;\n};\nexport default isDisjoint;\n"],"names":[],"mappings":"AAAK,MAAC,aAAa,IAAI,YAAY;AAC/B,QAAM,UAAU,QAAQ,OAAO,OAAO;AACtC,MAAI,QAAQ,WAAW,KAAK,QAAQ,WAAW,GAAG;AAC9C,WAAO;AAAA,EACX;AACA,MAAI;AACJ,aAAW,UAAU,SAAS;AAC1B,UAAM,aAAa,OAAO,KAAK,MAAM;AACrC,QAAI,CAAC,OAAO,IAAI,SAAS,GAAG;AACxB,YAAM,IAAI,IAAI,UAAU;AACxB;AAAA,IACJ;AACA,eAAW,aAAa,YAAY;AAChC,UAAI,IAAI,IAAI,SAAS,GAAG;AACpB,eAAO;AAAA,MACX;AACA,UAAI,IAAI,SAAS;AAAA,IACrB;AAAA,EACJ;AACA,SAAO;AACX;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./is_object.cjs.js");function e(e){return t.default(e)&&"string"==typeof e.kty}exports.isJWK=e,exports.isPrivateJWK=function(t){return"oct"!==t.kty&&"string"==typeof t.d},exports.isPublicJWK=function(t){return"oct"!==t.kty&&void 0===t.d},exports.isSecretJWK=function(t){return e(t)&&"oct"===t.kty&&"string"==typeof t.k};
|
|
2
|
+
//# sourceMappingURL=is_jwk.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is_jwk.cjs.js","sources":["../../../../../../node_modules/jose/dist/browser/lib/is_jwk.js"],"sourcesContent":["import isObject from './is_object.js';\nexport function isJWK(key) {\n return isObject(key) && typeof key.kty === 'string';\n}\nexport function isPrivateJWK(key) {\n return key.kty !== 'oct' && typeof key.d === 'string';\n}\nexport function isPublicJWK(key) {\n return key.kty !== 'oct' && typeof key.d === 'undefined';\n}\nexport function isSecretJWK(key) {\n return isJWK(key) && key.kty === 'oct' && typeof key.k === 'string';\n}\n"],"names":["isJWK","key","isObject","kty","d","k"],"mappings":"sHACO,SAASA,EAAMC,GAClB,OAAOC,EAAAA,QAASD,IAA2B,iBAAZA,EAAIE,GACvC,sCACO,SAAsBF,GACzB,MAAmB,QAAZA,EAAIE,KAAkC,iBAAVF,EAAIG,CAC3C,sBACO,SAAqBH,GACxB,MAAmB,QAAZA,EAAIE,UAAkC,IAAVF,EAAIG,CAC3C,sBACO,SAAqBH,GACxB,OAAOD,EAAMC,IAAoB,QAAZA,EAAIE,KAAkC,iBAAVF,EAAII,CACzD","x_google_ignoreList":[0]}
|