@concavejs/cli 0.0.1-alpha.12 → 0.0.1-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/manifest.json +11 -11
- package/dist/assets/runtime-bun/server/index.js +692 -724
- package/dist/assets/runtime-cf/runtime.bundle.js +1283 -1357
- package/dist/assets/runtime-node/server/index.js +511 -545
- package/dist/cli.js +355 -386
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -4817,6 +4817,113 @@ var init_base64url = __esm(() => {
|
|
|
4817
4817
|
init_buffer_utils();
|
|
4818
4818
|
});
|
|
4819
4819
|
|
|
4820
|
+
// ../../node_modules/jose/dist/webapi/lib/crypto_key.js
|
|
4821
|
+
function getHashLength(hash) {
|
|
4822
|
+
return parseInt(hash.name.slice(4), 10);
|
|
4823
|
+
}
|
|
4824
|
+
function checkHashLength(algorithm, expected) {
|
|
4825
|
+
const actual = getHashLength(algorithm.hash);
|
|
4826
|
+
if (actual !== expected)
|
|
4827
|
+
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
4828
|
+
}
|
|
4829
|
+
function getNamedCurve(alg) {
|
|
4830
|
+
switch (alg) {
|
|
4831
|
+
case "ES256":
|
|
4832
|
+
return "P-256";
|
|
4833
|
+
case "ES384":
|
|
4834
|
+
return "P-384";
|
|
4835
|
+
case "ES512":
|
|
4836
|
+
return "P-521";
|
|
4837
|
+
default:
|
|
4838
|
+
throw new Error("unreachable");
|
|
4839
|
+
}
|
|
4840
|
+
}
|
|
4841
|
+
function checkUsage(key, usage) {
|
|
4842
|
+
if (usage && !key.usages.includes(usage)) {
|
|
4843
|
+
throw new TypeError(`CryptoKey does not support this operation, its usages must include ${usage}.`);
|
|
4844
|
+
}
|
|
4845
|
+
}
|
|
4846
|
+
function checkSigCryptoKey(key, alg, usage) {
|
|
4847
|
+
switch (alg) {
|
|
4848
|
+
case "HS256":
|
|
4849
|
+
case "HS384":
|
|
4850
|
+
case "HS512": {
|
|
4851
|
+
if (!isAlgorithm(key.algorithm, "HMAC"))
|
|
4852
|
+
throw unusable("HMAC");
|
|
4853
|
+
checkHashLength(key.algorithm, parseInt(alg.slice(2), 10));
|
|
4854
|
+
break;
|
|
4855
|
+
}
|
|
4856
|
+
case "RS256":
|
|
4857
|
+
case "RS384":
|
|
4858
|
+
case "RS512": {
|
|
4859
|
+
if (!isAlgorithm(key.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
4860
|
+
throw unusable("RSASSA-PKCS1-v1_5");
|
|
4861
|
+
checkHashLength(key.algorithm, parseInt(alg.slice(2), 10));
|
|
4862
|
+
break;
|
|
4863
|
+
}
|
|
4864
|
+
case "PS256":
|
|
4865
|
+
case "PS384":
|
|
4866
|
+
case "PS512": {
|
|
4867
|
+
if (!isAlgorithm(key.algorithm, "RSA-PSS"))
|
|
4868
|
+
throw unusable("RSA-PSS");
|
|
4869
|
+
checkHashLength(key.algorithm, parseInt(alg.slice(2), 10));
|
|
4870
|
+
break;
|
|
4871
|
+
}
|
|
4872
|
+
case "Ed25519":
|
|
4873
|
+
case "EdDSA": {
|
|
4874
|
+
if (!isAlgorithm(key.algorithm, "Ed25519"))
|
|
4875
|
+
throw unusable("Ed25519");
|
|
4876
|
+
break;
|
|
4877
|
+
}
|
|
4878
|
+
case "ML-DSA-44":
|
|
4879
|
+
case "ML-DSA-65":
|
|
4880
|
+
case "ML-DSA-87": {
|
|
4881
|
+
if (!isAlgorithm(key.algorithm, alg))
|
|
4882
|
+
throw unusable(alg);
|
|
4883
|
+
break;
|
|
4884
|
+
}
|
|
4885
|
+
case "ES256":
|
|
4886
|
+
case "ES384":
|
|
4887
|
+
case "ES512": {
|
|
4888
|
+
if (!isAlgorithm(key.algorithm, "ECDSA"))
|
|
4889
|
+
throw unusable("ECDSA");
|
|
4890
|
+
const expected = getNamedCurve(alg);
|
|
4891
|
+
const actual = key.algorithm.namedCurve;
|
|
4892
|
+
if (actual !== expected)
|
|
4893
|
+
throw unusable(expected, "algorithm.namedCurve");
|
|
4894
|
+
break;
|
|
4895
|
+
}
|
|
4896
|
+
default:
|
|
4897
|
+
throw new TypeError("CryptoKey does not support this operation");
|
|
4898
|
+
}
|
|
4899
|
+
checkUsage(key, usage);
|
|
4900
|
+
}
|
|
4901
|
+
var unusable = (name, prop = "algorithm.name") => new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`), isAlgorithm = (algorithm, name) => algorithm.name === name;
|
|
4902
|
+
|
|
4903
|
+
// ../../node_modules/jose/dist/webapi/lib/invalid_key_input.js
|
|
4904
|
+
function message(msg, actual, ...types) {
|
|
4905
|
+
types = types.filter(Boolean);
|
|
4906
|
+
if (types.length > 2) {
|
|
4907
|
+
const last = types.pop();
|
|
4908
|
+
msg += `one of type ${types.join(", ")}, or ${last}.`;
|
|
4909
|
+
} else if (types.length === 2) {
|
|
4910
|
+
msg += `one of type ${types[0]} or ${types[1]}.`;
|
|
4911
|
+
} else {
|
|
4912
|
+
msg += `of type ${types[0]}.`;
|
|
4913
|
+
}
|
|
4914
|
+
if (actual == null) {
|
|
4915
|
+
msg += ` Received ${actual}`;
|
|
4916
|
+
} else if (typeof actual === "function" && actual.name) {
|
|
4917
|
+
msg += ` Received function ${actual.name}`;
|
|
4918
|
+
} else if (typeof actual === "object" && actual != null) {
|
|
4919
|
+
if (actual.constructor?.name) {
|
|
4920
|
+
msg += ` Received an instance of ${actual.constructor.name}`;
|
|
4921
|
+
}
|
|
4922
|
+
}
|
|
4923
|
+
return msg;
|
|
4924
|
+
}
|
|
4925
|
+
var invalidKeyInput = (actual, ...types) => message("Key must be ", actual, ...types), withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);
|
|
4926
|
+
|
|
4820
4927
|
// ../../node_modules/jose/dist/webapi/util/errors.js
|
|
4821
4928
|
var exports_errors = {};
|
|
4822
4929
|
__export(exports_errors, {
|
|
@@ -4841,8 +4948,8 @@ var init_errors2 = __esm(() => {
|
|
|
4841
4948
|
JOSEError = class JOSEError extends Error {
|
|
4842
4949
|
static code = "ERR_JOSE_GENERIC";
|
|
4843
4950
|
code = "ERR_JOSE_GENERIC";
|
|
4844
|
-
constructor(
|
|
4845
|
-
super(
|
|
4951
|
+
constructor(message2, options) {
|
|
4952
|
+
super(message2, options);
|
|
4846
4953
|
this.name = this.constructor.name;
|
|
4847
4954
|
Error.captureStackTrace?.(this, this.constructor);
|
|
4848
4955
|
}
|
|
@@ -4853,8 +4960,8 @@ var init_errors2 = __esm(() => {
|
|
|
4853
4960
|
claim;
|
|
4854
4961
|
reason;
|
|
4855
4962
|
payload;
|
|
4856
|
-
constructor(
|
|
4857
|
-
super(
|
|
4963
|
+
constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
|
|
4964
|
+
super(message2, { cause: { claim, reason, payload } });
|
|
4858
4965
|
this.claim = claim;
|
|
4859
4966
|
this.reason = reason;
|
|
4860
4967
|
this.payload = payload;
|
|
@@ -4866,8 +4973,8 @@ var init_errors2 = __esm(() => {
|
|
|
4866
4973
|
claim;
|
|
4867
4974
|
reason;
|
|
4868
4975
|
payload;
|
|
4869
|
-
constructor(
|
|
4870
|
-
super(
|
|
4976
|
+
constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
|
|
4977
|
+
super(message2, { cause: { claim, reason, payload } });
|
|
4871
4978
|
this.claim = claim;
|
|
4872
4979
|
this.reason = reason;
|
|
4873
4980
|
this.payload = payload;
|
|
@@ -4884,8 +4991,8 @@ var init_errors2 = __esm(() => {
|
|
|
4884
4991
|
JWEDecryptionFailed = class JWEDecryptionFailed extends JOSEError {
|
|
4885
4992
|
static code = "ERR_JWE_DECRYPTION_FAILED";
|
|
4886
4993
|
code = "ERR_JWE_DECRYPTION_FAILED";
|
|
4887
|
-
constructor(
|
|
4888
|
-
super(
|
|
4994
|
+
constructor(message2 = "decryption operation failed", options) {
|
|
4995
|
+
super(message2, options);
|
|
4889
4996
|
}
|
|
4890
4997
|
};
|
|
4891
4998
|
JWEInvalid = class JWEInvalid extends JOSEError {
|
|
@@ -4911,145 +5018,34 @@ var init_errors2 = __esm(() => {
|
|
|
4911
5018
|
JWKSNoMatchingKey = class JWKSNoMatchingKey extends JOSEError {
|
|
4912
5019
|
static code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
4913
5020
|
code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
4914
|
-
constructor(
|
|
4915
|
-
super(
|
|
5021
|
+
constructor(message2 = "no applicable key found in the JSON Web Key Set", options) {
|
|
5022
|
+
super(message2, options);
|
|
4916
5023
|
}
|
|
4917
5024
|
};
|
|
4918
5025
|
JWKSMultipleMatchingKeys = class JWKSMultipleMatchingKeys extends JOSEError {
|
|
4919
5026
|
[Symbol.asyncIterator];
|
|
4920
5027
|
static code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
4921
5028
|
code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
4922
|
-
constructor(
|
|
4923
|
-
super(
|
|
5029
|
+
constructor(message2 = "multiple matching keys found in the JSON Web Key Set", options) {
|
|
5030
|
+
super(message2, options);
|
|
4924
5031
|
}
|
|
4925
5032
|
};
|
|
4926
5033
|
JWKSTimeout = class JWKSTimeout extends JOSEError {
|
|
4927
5034
|
static code = "ERR_JWKS_TIMEOUT";
|
|
4928
5035
|
code = "ERR_JWKS_TIMEOUT";
|
|
4929
|
-
constructor(
|
|
4930
|
-
super(
|
|
5036
|
+
constructor(message2 = "request timed out", options) {
|
|
5037
|
+
super(message2, options);
|
|
4931
5038
|
}
|
|
4932
5039
|
};
|
|
4933
5040
|
JWSSignatureVerificationFailed = class JWSSignatureVerificationFailed extends JOSEError {
|
|
4934
5041
|
static code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
4935
5042
|
code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
4936
|
-
constructor(
|
|
4937
|
-
super(
|
|
5043
|
+
constructor(message2 = "signature verification failed", options) {
|
|
5044
|
+
super(message2, options);
|
|
4938
5045
|
}
|
|
4939
5046
|
};
|
|
4940
5047
|
});
|
|
4941
5048
|
|
|
4942
|
-
// ../../node_modules/jose/dist/webapi/lib/crypto_key.js
|
|
4943
|
-
function getHashLength(hash) {
|
|
4944
|
-
return parseInt(hash.name.slice(4), 10);
|
|
4945
|
-
}
|
|
4946
|
-
function getNamedCurve(alg) {
|
|
4947
|
-
switch (alg) {
|
|
4948
|
-
case "ES256":
|
|
4949
|
-
return "P-256";
|
|
4950
|
-
case "ES384":
|
|
4951
|
-
return "P-384";
|
|
4952
|
-
case "ES512":
|
|
4953
|
-
return "P-521";
|
|
4954
|
-
default:
|
|
4955
|
-
throw new Error("unreachable");
|
|
4956
|
-
}
|
|
4957
|
-
}
|
|
4958
|
-
function checkUsage(key, usage) {
|
|
4959
|
-
if (usage && !key.usages.includes(usage)) {
|
|
4960
|
-
throw new TypeError(`CryptoKey does not support this operation, its usages must include ${usage}.`);
|
|
4961
|
-
}
|
|
4962
|
-
}
|
|
4963
|
-
function checkSigCryptoKey(key, alg, usage) {
|
|
4964
|
-
switch (alg) {
|
|
4965
|
-
case "HS256":
|
|
4966
|
-
case "HS384":
|
|
4967
|
-
case "HS512": {
|
|
4968
|
-
if (!isAlgorithm(key.algorithm, "HMAC"))
|
|
4969
|
-
throw unusable("HMAC");
|
|
4970
|
-
const expected = parseInt(alg.slice(2), 10);
|
|
4971
|
-
const actual = getHashLength(key.algorithm.hash);
|
|
4972
|
-
if (actual !== expected)
|
|
4973
|
-
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
4974
|
-
break;
|
|
4975
|
-
}
|
|
4976
|
-
case "RS256":
|
|
4977
|
-
case "RS384":
|
|
4978
|
-
case "RS512": {
|
|
4979
|
-
if (!isAlgorithm(key.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
4980
|
-
throw unusable("RSASSA-PKCS1-v1_5");
|
|
4981
|
-
const expected = parseInt(alg.slice(2), 10);
|
|
4982
|
-
const actual = getHashLength(key.algorithm.hash);
|
|
4983
|
-
if (actual !== expected)
|
|
4984
|
-
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
4985
|
-
break;
|
|
4986
|
-
}
|
|
4987
|
-
case "PS256":
|
|
4988
|
-
case "PS384":
|
|
4989
|
-
case "PS512": {
|
|
4990
|
-
if (!isAlgorithm(key.algorithm, "RSA-PSS"))
|
|
4991
|
-
throw unusable("RSA-PSS");
|
|
4992
|
-
const expected = parseInt(alg.slice(2), 10);
|
|
4993
|
-
const actual = getHashLength(key.algorithm.hash);
|
|
4994
|
-
if (actual !== expected)
|
|
4995
|
-
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
4996
|
-
break;
|
|
4997
|
-
}
|
|
4998
|
-
case "Ed25519":
|
|
4999
|
-
case "EdDSA": {
|
|
5000
|
-
if (!isAlgorithm(key.algorithm, "Ed25519"))
|
|
5001
|
-
throw unusable("Ed25519");
|
|
5002
|
-
break;
|
|
5003
|
-
}
|
|
5004
|
-
case "ML-DSA-44":
|
|
5005
|
-
case "ML-DSA-65":
|
|
5006
|
-
case "ML-DSA-87": {
|
|
5007
|
-
if (!isAlgorithm(key.algorithm, alg))
|
|
5008
|
-
throw unusable(alg);
|
|
5009
|
-
break;
|
|
5010
|
-
}
|
|
5011
|
-
case "ES256":
|
|
5012
|
-
case "ES384":
|
|
5013
|
-
case "ES512": {
|
|
5014
|
-
if (!isAlgorithm(key.algorithm, "ECDSA"))
|
|
5015
|
-
throw unusable("ECDSA");
|
|
5016
|
-
const expected = getNamedCurve(alg);
|
|
5017
|
-
const actual = key.algorithm.namedCurve;
|
|
5018
|
-
if (actual !== expected)
|
|
5019
|
-
throw unusable(expected, "algorithm.namedCurve");
|
|
5020
|
-
break;
|
|
5021
|
-
}
|
|
5022
|
-
default:
|
|
5023
|
-
throw new TypeError("CryptoKey does not support this operation");
|
|
5024
|
-
}
|
|
5025
|
-
checkUsage(key, usage);
|
|
5026
|
-
}
|
|
5027
|
-
var unusable = (name, prop = "algorithm.name") => new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`), isAlgorithm = (algorithm, name) => algorithm.name === name;
|
|
5028
|
-
|
|
5029
|
-
// ../../node_modules/jose/dist/webapi/lib/invalid_key_input.js
|
|
5030
|
-
function message(msg, actual, ...types) {
|
|
5031
|
-
types = types.filter(Boolean);
|
|
5032
|
-
if (types.length > 2) {
|
|
5033
|
-
const last = types.pop();
|
|
5034
|
-
msg += `one of type ${types.join(", ")}, or ${last}.`;
|
|
5035
|
-
} else if (types.length === 2) {
|
|
5036
|
-
msg += `one of type ${types[0]} or ${types[1]}.`;
|
|
5037
|
-
} else {
|
|
5038
|
-
msg += `of type ${types[0]}.`;
|
|
5039
|
-
}
|
|
5040
|
-
if (actual == null) {
|
|
5041
|
-
msg += ` Received ${actual}`;
|
|
5042
|
-
} else if (typeof actual === "function" && actual.name) {
|
|
5043
|
-
msg += ` Received function ${actual.name}`;
|
|
5044
|
-
} else if (typeof actual === "object" && actual != null) {
|
|
5045
|
-
if (actual.constructor?.name) {
|
|
5046
|
-
msg += ` Received an instance of ${actual.constructor.name}`;
|
|
5047
|
-
}
|
|
5048
|
-
}
|
|
5049
|
-
return msg;
|
|
5050
|
-
}
|
|
5051
|
-
var invalidKeyInput = (actual, ...types) => message("Key must be ", actual, ...types), withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);
|
|
5052
|
-
|
|
5053
5049
|
// ../../node_modules/jose/dist/webapi/lib/is_key_like.js
|
|
5054
5050
|
var isCryptoKey = (key) => {
|
|
5055
5051
|
if (key?.[Symbol.toStringTag] === "CryptoKey")
|
|
@@ -5061,7 +5057,34 @@ var isCryptoKey = (key) => {
|
|
|
5061
5057
|
}
|
|
5062
5058
|
}, isKeyObject = (key) => key?.[Symbol.toStringTag] === "KeyObject", isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);
|
|
5063
5059
|
|
|
5064
|
-
// ../../node_modules/jose/dist/webapi/lib/
|
|
5060
|
+
// ../../node_modules/jose/dist/webapi/lib/helpers.js
|
|
5061
|
+
function decodeBase64url(value, label, ErrorClass) {
|
|
5062
|
+
try {
|
|
5063
|
+
return decode(value);
|
|
5064
|
+
} catch {
|
|
5065
|
+
throw new ErrorClass(`Failed to base64url decode the ${label}`);
|
|
5066
|
+
}
|
|
5067
|
+
}
|
|
5068
|
+
var unprotected;
|
|
5069
|
+
var init_helpers = __esm(() => {
|
|
5070
|
+
init_base64url();
|
|
5071
|
+
unprotected = Symbol();
|
|
5072
|
+
});
|
|
5073
|
+
|
|
5074
|
+
// ../../node_modules/jose/dist/webapi/lib/type_checks.js
|
|
5075
|
+
function isObject(input) {
|
|
5076
|
+
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
5077
|
+
return false;
|
|
5078
|
+
}
|
|
5079
|
+
if (Object.getPrototypeOf(input) === null) {
|
|
5080
|
+
return true;
|
|
5081
|
+
}
|
|
5082
|
+
let proto = input;
|
|
5083
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
5084
|
+
proto = Object.getPrototypeOf(proto);
|
|
5085
|
+
}
|
|
5086
|
+
return Object.getPrototypeOf(input) === proto;
|
|
5087
|
+
}
|
|
5065
5088
|
function isDisjoint(...headers) {
|
|
5066
5089
|
const sources = headers.filter(Boolean);
|
|
5067
5090
|
if (sources.length === 0 || sources.length === 1) {
|
|
@@ -5083,24 +5106,9 @@ function isDisjoint(...headers) {
|
|
|
5083
5106
|
}
|
|
5084
5107
|
return true;
|
|
5085
5108
|
}
|
|
5109
|
+
var isObjectLike = (value) => typeof value === "object" && value !== null, isJWK = (key) => isObject(key) && typeof key.kty === "string", isPrivateJWK = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string"), isPublicJWK = (key) => key.kty !== "oct" && key.d === undefined && key.priv === undefined, isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
|
|
5086
5110
|
|
|
5087
|
-
// ../../node_modules/jose/dist/webapi/lib/
|
|
5088
|
-
function isObject(input) {
|
|
5089
|
-
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
5090
|
-
return false;
|
|
5091
|
-
}
|
|
5092
|
-
if (Object.getPrototypeOf(input) === null) {
|
|
5093
|
-
return true;
|
|
5094
|
-
}
|
|
5095
|
-
let proto = input;
|
|
5096
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
|
5097
|
-
proto = Object.getPrototypeOf(proto);
|
|
5098
|
-
}
|
|
5099
|
-
return Object.getPrototypeOf(input) === proto;
|
|
5100
|
-
}
|
|
5101
|
-
var isObjectLike = (value) => typeof value === "object" && value !== null;
|
|
5102
|
-
|
|
5103
|
-
// ../../node_modules/jose/dist/webapi/lib/check_key_length.js
|
|
5111
|
+
// ../../node_modules/jose/dist/webapi/lib/signing.js
|
|
5104
5112
|
function checkKeyLength(alg, key) {
|
|
5105
5113
|
if (alg.startsWith("RS") || alg.startsWith("PS")) {
|
|
5106
5114
|
const { modulusLength } = key.algorithm;
|
|
@@ -5109,6 +5117,59 @@ function checkKeyLength(alg, key) {
|
|
|
5109
5117
|
}
|
|
5110
5118
|
}
|
|
5111
5119
|
}
|
|
5120
|
+
function subtleAlgorithm(alg, algorithm) {
|
|
5121
|
+
const hash = `SHA-${alg.slice(-3)}`;
|
|
5122
|
+
switch (alg) {
|
|
5123
|
+
case "HS256":
|
|
5124
|
+
case "HS384":
|
|
5125
|
+
case "HS512":
|
|
5126
|
+
return { hash, name: "HMAC" };
|
|
5127
|
+
case "PS256":
|
|
5128
|
+
case "PS384":
|
|
5129
|
+
case "PS512":
|
|
5130
|
+
return { hash, name: "RSA-PSS", saltLength: parseInt(alg.slice(-3), 10) >> 3 };
|
|
5131
|
+
case "RS256":
|
|
5132
|
+
case "RS384":
|
|
5133
|
+
case "RS512":
|
|
5134
|
+
return { hash, name: "RSASSA-PKCS1-v1_5" };
|
|
5135
|
+
case "ES256":
|
|
5136
|
+
case "ES384":
|
|
5137
|
+
case "ES512":
|
|
5138
|
+
return { hash, name: "ECDSA", namedCurve: algorithm.namedCurve };
|
|
5139
|
+
case "Ed25519":
|
|
5140
|
+
case "EdDSA":
|
|
5141
|
+
return { name: "Ed25519" };
|
|
5142
|
+
case "ML-DSA-44":
|
|
5143
|
+
case "ML-DSA-65":
|
|
5144
|
+
case "ML-DSA-87":
|
|
5145
|
+
return { name: alg };
|
|
5146
|
+
default:
|
|
5147
|
+
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
5148
|
+
}
|
|
5149
|
+
}
|
|
5150
|
+
async function getSigKey(alg, key, usage) {
|
|
5151
|
+
if (key instanceof Uint8Array) {
|
|
5152
|
+
if (!alg.startsWith("HS")) {
|
|
5153
|
+
throw new TypeError(invalidKeyInput(key, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
5154
|
+
}
|
|
5155
|
+
return crypto.subtle.importKey("raw", key, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage]);
|
|
5156
|
+
}
|
|
5157
|
+
checkSigCryptoKey(key, alg, usage);
|
|
5158
|
+
return key;
|
|
5159
|
+
}
|
|
5160
|
+
async function verify(alg, key, signature, data) {
|
|
5161
|
+
const cryptoKey = await getSigKey(alg, key, "verify");
|
|
5162
|
+
checkKeyLength(alg, cryptoKey);
|
|
5163
|
+
const algorithm = subtleAlgorithm(alg, cryptoKey.algorithm);
|
|
5164
|
+
try {
|
|
5165
|
+
return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
|
|
5166
|
+
} catch {
|
|
5167
|
+
return false;
|
|
5168
|
+
}
|
|
5169
|
+
}
|
|
5170
|
+
var init_signing = __esm(() => {
|
|
5171
|
+
init_errors2();
|
|
5172
|
+
});
|
|
5112
5173
|
|
|
5113
5174
|
// ../../node_modules/jose/dist/webapi/lib/jwk_to_key.js
|
|
5114
5175
|
function subtleMapping(jwk) {
|
|
@@ -5124,7 +5185,7 @@ function subtleMapping(jwk) {
|
|
|
5124
5185
|
keyUsages = jwk.priv ? ["sign"] : ["verify"];
|
|
5125
5186
|
break;
|
|
5126
5187
|
default:
|
|
5127
|
-
throw new JOSENotSupported(
|
|
5188
|
+
throw new JOSENotSupported(unsupportedAlg);
|
|
5128
5189
|
}
|
|
5129
5190
|
break;
|
|
5130
5191
|
}
|
|
@@ -5153,22 +5214,19 @@ function subtleMapping(jwk) {
|
|
|
5153
5214
|
keyUsages = jwk.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
|
|
5154
5215
|
break;
|
|
5155
5216
|
default:
|
|
5156
|
-
throw new JOSENotSupported(
|
|
5217
|
+
throw new JOSENotSupported(unsupportedAlg);
|
|
5157
5218
|
}
|
|
5158
5219
|
break;
|
|
5159
5220
|
}
|
|
5160
5221
|
case "EC": {
|
|
5161
5222
|
switch (jwk.alg) {
|
|
5162
5223
|
case "ES256":
|
|
5163
|
-
algorithm = { name: "ECDSA", namedCurve: "P-256" };
|
|
5164
|
-
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
5165
|
-
break;
|
|
5166
5224
|
case "ES384":
|
|
5167
|
-
algorithm = { name: "ECDSA", namedCurve: "P-384" };
|
|
5168
|
-
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
5169
|
-
break;
|
|
5170
5225
|
case "ES512":
|
|
5171
|
-
algorithm = {
|
|
5226
|
+
algorithm = {
|
|
5227
|
+
name: "ECDSA",
|
|
5228
|
+
namedCurve: { ES256: "P-256", ES384: "P-384", ES512: "P-521" }[jwk.alg]
|
|
5229
|
+
};
|
|
5172
5230
|
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
5173
5231
|
break;
|
|
5174
5232
|
case "ECDH-ES":
|
|
@@ -5177,142 +5235,53 @@ function subtleMapping(jwk) {
|
|
|
5177
5235
|
case "ECDH-ES+A256KW":
|
|
5178
5236
|
algorithm = { name: "ECDH", namedCurve: jwk.crv };
|
|
5179
5237
|
keyUsages = jwk.d ? ["deriveBits"] : [];
|
|
5180
|
-
break;
|
|
5181
|
-
default:
|
|
5182
|
-
throw new JOSENotSupported(
|
|
5183
|
-
}
|
|
5184
|
-
break;
|
|
5185
|
-
}
|
|
5186
|
-
case "OKP": {
|
|
5187
|
-
switch (jwk.alg) {
|
|
5188
|
-
case "Ed25519":
|
|
5189
|
-
case "EdDSA":
|
|
5190
|
-
algorithm = { name: "Ed25519" };
|
|
5191
|
-
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
5192
|
-
break;
|
|
5193
|
-
case "ECDH-ES":
|
|
5194
|
-
case "ECDH-ES+A128KW":
|
|
5195
|
-
case "ECDH-ES+A192KW":
|
|
5196
|
-
case "ECDH-ES+A256KW":
|
|
5197
|
-
algorithm = { name: jwk.crv };
|
|
5198
|
-
keyUsages = jwk.d ? ["deriveBits"] : [];
|
|
5199
|
-
break;
|
|
5200
|
-
default:
|
|
5201
|
-
throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
5202
|
-
}
|
|
5203
|
-
break;
|
|
5204
|
-
}
|
|
5205
|
-
default:
|
|
5206
|
-
throw new JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
|
|
5207
|
-
}
|
|
5208
|
-
return { algorithm, keyUsages };
|
|
5209
|
-
}
|
|
5210
|
-
async function jwkToKey(jwk) {
|
|
5211
|
-
if (!jwk.alg) {
|
|
5212
|
-
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
5213
|
-
}
|
|
5214
|
-
const { algorithm, keyUsages } = subtleMapping(jwk);
|
|
5215
|
-
const keyData = { ...jwk };
|
|
5216
|
-
if (keyData.kty !== "AKP") {
|
|
5217
|
-
delete keyData.alg;
|
|
5218
|
-
}
|
|
5219
|
-
delete keyData.use;
|
|
5220
|
-
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);
|
|
5221
|
-
}
|
|
5222
|
-
var init_jwk_to_key = __esm(() => {
|
|
5223
|
-
init_errors2();
|
|
5224
|
-
});
|
|
5225
|
-
|
|
5226
|
-
// ../../node_modules/jose/dist/webapi/key/import.js
|
|
5227
|
-
async function importJWK(jwk, alg, options) {
|
|
5228
|
-
if (!isObject(jwk)) {
|
|
5229
|
-
throw new TypeError("JWK must be an object");
|
|
5230
|
-
}
|
|
5231
|
-
let ext;
|
|
5232
|
-
alg ??= jwk.alg;
|
|
5233
|
-
ext ??= options?.extractable ?? jwk.ext;
|
|
5234
|
-
switch (jwk.kty) {
|
|
5235
|
-
case "oct":
|
|
5236
|
-
if (typeof jwk.k !== "string" || !jwk.k) {
|
|
5237
|
-
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
5238
|
-
}
|
|
5239
|
-
return decode(jwk.k);
|
|
5240
|
-
case "RSA":
|
|
5241
|
-
if ("oth" in jwk && jwk.oth !== undefined) {
|
|
5242
|
-
throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
|
|
5243
|
-
}
|
|
5244
|
-
return jwkToKey({ ...jwk, alg, ext });
|
|
5245
|
-
case "AKP": {
|
|
5246
|
-
if (typeof jwk.alg !== "string" || !jwk.alg) {
|
|
5247
|
-
throw new TypeError('missing "alg" (Algorithm) Parameter value');
|
|
5238
|
+
break;
|
|
5239
|
+
default:
|
|
5240
|
+
throw new JOSENotSupported(unsupportedAlg);
|
|
5248
5241
|
}
|
|
5249
|
-
|
|
5250
|
-
|
|
5242
|
+
break;
|
|
5243
|
+
}
|
|
5244
|
+
case "OKP": {
|
|
5245
|
+
switch (jwk.alg) {
|
|
5246
|
+
case "Ed25519":
|
|
5247
|
+
case "EdDSA":
|
|
5248
|
+
algorithm = { name: "Ed25519" };
|
|
5249
|
+
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
5250
|
+
break;
|
|
5251
|
+
case "ECDH-ES":
|
|
5252
|
+
case "ECDH-ES+A128KW":
|
|
5253
|
+
case "ECDH-ES+A192KW":
|
|
5254
|
+
case "ECDH-ES+A256KW":
|
|
5255
|
+
algorithm = { name: jwk.crv };
|
|
5256
|
+
keyUsages = jwk.d ? ["deriveBits"] : [];
|
|
5257
|
+
break;
|
|
5258
|
+
default:
|
|
5259
|
+
throw new JOSENotSupported(unsupportedAlg);
|
|
5251
5260
|
}
|
|
5252
|
-
|
|
5261
|
+
break;
|
|
5253
5262
|
}
|
|
5254
|
-
case "EC":
|
|
5255
|
-
case "OKP":
|
|
5256
|
-
return jwkToKey({ ...jwk, alg, ext });
|
|
5257
5263
|
default:
|
|
5258
|
-
throw new JOSENotSupported('
|
|
5264
|
+
throw new JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
|
|
5259
5265
|
}
|
|
5266
|
+
return { algorithm, keyUsages };
|
|
5260
5267
|
}
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
init_errors2();
|
|
5265
|
-
});
|
|
5266
|
-
|
|
5267
|
-
// ../../node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
5268
|
-
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
5269
|
-
if (joseHeader.crit !== undefined && protectedHeader?.crit === undefined) {
|
|
5270
|
-
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
5271
|
-
}
|
|
5272
|
-
if (!protectedHeader || protectedHeader.crit === undefined) {
|
|
5273
|
-
return new Set;
|
|
5274
|
-
}
|
|
5275
|
-
if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== "string" || input.length === 0)) {
|
|
5276
|
-
throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
|
|
5277
|
-
}
|
|
5278
|
-
let recognized;
|
|
5279
|
-
if (recognizedOption !== undefined) {
|
|
5280
|
-
recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
|
|
5281
|
-
} else {
|
|
5282
|
-
recognized = recognizedDefault;
|
|
5268
|
+
async function jwkToKey(jwk) {
|
|
5269
|
+
if (!jwk.alg) {
|
|
5270
|
+
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
5283
5271
|
}
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
if (joseHeader[parameter] === undefined) {
|
|
5289
|
-
throw new Err(`Extension Header Parameter "${parameter}" is missing`);
|
|
5290
|
-
}
|
|
5291
|
-
if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {
|
|
5292
|
-
throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);
|
|
5293
|
-
}
|
|
5272
|
+
const { algorithm, keyUsages } = subtleMapping(jwk);
|
|
5273
|
+
const keyData = { ...jwk };
|
|
5274
|
+
if (keyData.kty !== "AKP") {
|
|
5275
|
+
delete keyData.alg;
|
|
5294
5276
|
}
|
|
5295
|
-
|
|
5277
|
+
delete keyData.use;
|
|
5278
|
+
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);
|
|
5296
5279
|
}
|
|
5297
|
-
var
|
|
5280
|
+
var unsupportedAlg = 'Invalid or unsupported JWK "alg" (Algorithm) Parameter value';
|
|
5281
|
+
var init_jwk_to_key = __esm(() => {
|
|
5298
5282
|
init_errors2();
|
|
5299
5283
|
});
|
|
5300
5284
|
|
|
5301
|
-
// ../../node_modules/jose/dist/webapi/lib/validate_algorithms.js
|
|
5302
|
-
function validateAlgorithms(option, algorithms) {
|
|
5303
|
-
if (algorithms !== undefined && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
5304
|
-
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
5305
|
-
}
|
|
5306
|
-
if (!algorithms) {
|
|
5307
|
-
return;
|
|
5308
|
-
}
|
|
5309
|
-
return new Set(algorithms);
|
|
5310
|
-
}
|
|
5311
|
-
|
|
5312
|
-
// ../../node_modules/jose/dist/webapi/lib/is_jwk.js
|
|
5313
|
-
var isJWK = (key) => isObject(key) && typeof key.kty === "string", isPrivateJWK = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string"), isPublicJWK = (key) => key.kty !== "oct" && key.d === undefined && key.priv === undefined, isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
|
|
5314
|
-
var init_is_jwk = () => {};
|
|
5315
|
-
|
|
5316
5285
|
// ../../node_modules/jose/dist/webapi/lib/normalize_key.js
|
|
5317
5286
|
async function normalizeKey(key, alg) {
|
|
5318
5287
|
if (key instanceof Uint8Array) {
|
|
@@ -5345,7 +5314,7 @@ async function normalizeKey(key, alg) {
|
|
|
5345
5314
|
}
|
|
5346
5315
|
throw new Error("unreachable");
|
|
5347
5316
|
}
|
|
5348
|
-
var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
5317
|
+
var unusableForAlg = "given KeyObject instance cannot be used for this algorithm", cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
5349
5318
|
cache ||= new WeakMap;
|
|
5350
5319
|
let cached = cache.get(key);
|
|
5351
5320
|
if (cached?.[alg]) {
|
|
@@ -5377,13 +5346,13 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
5377
5346
|
case "ECDH-ES+A256KW":
|
|
5378
5347
|
break;
|
|
5379
5348
|
default:
|
|
5380
|
-
throw new TypeError(
|
|
5349
|
+
throw new TypeError(unusableForAlg);
|
|
5381
5350
|
}
|
|
5382
5351
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, isPublic ? [] : ["deriveBits"]);
|
|
5383
5352
|
}
|
|
5384
5353
|
if (keyObject.asymmetricKeyType === "ed25519") {
|
|
5385
5354
|
if (alg !== "EdDSA" && alg !== "Ed25519") {
|
|
5386
|
-
throw new TypeError(
|
|
5355
|
+
throw new TypeError(unusableForAlg);
|
|
5387
5356
|
}
|
|
5388
5357
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
|
|
5389
5358
|
isPublic ? "verify" : "sign"
|
|
@@ -5394,7 +5363,7 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
5394
5363
|
case "ml-dsa-65":
|
|
5395
5364
|
case "ml-dsa-87": {
|
|
5396
5365
|
if (alg !== keyObject.asymmetricKeyType.toUpperCase()) {
|
|
5397
|
-
throw new TypeError(
|
|
5366
|
+
throw new TypeError(unusableForAlg);
|
|
5398
5367
|
}
|
|
5399
5368
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
|
|
5400
5369
|
isPublic ? "verify" : "sign"
|
|
@@ -5423,7 +5392,7 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
5423
5392
|
hash = "SHA-512";
|
|
5424
5393
|
break;
|
|
5425
5394
|
default:
|
|
5426
|
-
throw new TypeError(
|
|
5395
|
+
throw new TypeError(unusableForAlg);
|
|
5427
5396
|
}
|
|
5428
5397
|
if (alg.startsWith("RSA-OAEP")) {
|
|
5429
5398
|
return keyObject.toCryptoKey({
|
|
@@ -5444,21 +5413,10 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
5444
5413
|
]);
|
|
5445
5414
|
const namedCurve = nist.get(keyObject.asymmetricKeyDetails?.namedCurve);
|
|
5446
5415
|
if (!namedCurve) {
|
|
5447
|
-
throw new TypeError(
|
|
5448
|
-
}
|
|
5449
|
-
if (alg === "ES256" && namedCurve === "P-256") {
|
|
5450
|
-
cryptoKey = keyObject.toCryptoKey({
|
|
5451
|
-
name: "ECDSA",
|
|
5452
|
-
namedCurve
|
|
5453
|
-
}, extractable, [isPublic ? "verify" : "sign"]);
|
|
5454
|
-
}
|
|
5455
|
-
if (alg === "ES384" && namedCurve === "P-384") {
|
|
5456
|
-
cryptoKey = keyObject.toCryptoKey({
|
|
5457
|
-
name: "ECDSA",
|
|
5458
|
-
namedCurve
|
|
5459
|
-
}, extractable, [isPublic ? "verify" : "sign"]);
|
|
5416
|
+
throw new TypeError(unusableForAlg);
|
|
5460
5417
|
}
|
|
5461
|
-
|
|
5418
|
+
const expectedCurve = { ES256: "P-256", ES384: "P-384", ES512: "P-521" };
|
|
5419
|
+
if (expectedCurve[alg] && namedCurve === expectedCurve[alg]) {
|
|
5462
5420
|
cryptoKey = keyObject.toCryptoKey({
|
|
5463
5421
|
name: "ECDSA",
|
|
5464
5422
|
namedCurve
|
|
@@ -5472,7 +5430,7 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
5472
5430
|
}
|
|
5473
5431
|
}
|
|
5474
5432
|
if (!cryptoKey) {
|
|
5475
|
-
throw new TypeError(
|
|
5433
|
+
throw new TypeError(unusableForAlg);
|
|
5476
5434
|
}
|
|
5477
5435
|
if (!cached) {
|
|
5478
5436
|
cache.set(keyObject, { [alg]: cryptoKey });
|
|
@@ -5482,11 +5440,96 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
5482
5440
|
return cryptoKey;
|
|
5483
5441
|
};
|
|
5484
5442
|
var init_normalize_key = __esm(() => {
|
|
5485
|
-
init_is_jwk();
|
|
5486
5443
|
init_base64url();
|
|
5487
5444
|
init_jwk_to_key();
|
|
5488
5445
|
});
|
|
5489
5446
|
|
|
5447
|
+
// ../../node_modules/jose/dist/webapi/key/import.js
|
|
5448
|
+
async function importJWK(jwk, alg, options) {
|
|
5449
|
+
if (!isObject(jwk)) {
|
|
5450
|
+
throw new TypeError("JWK must be an object");
|
|
5451
|
+
}
|
|
5452
|
+
let ext;
|
|
5453
|
+
alg ??= jwk.alg;
|
|
5454
|
+
ext ??= options?.extractable ?? jwk.ext;
|
|
5455
|
+
switch (jwk.kty) {
|
|
5456
|
+
case "oct":
|
|
5457
|
+
if (typeof jwk.k !== "string" || !jwk.k) {
|
|
5458
|
+
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
5459
|
+
}
|
|
5460
|
+
return decode(jwk.k);
|
|
5461
|
+
case "RSA":
|
|
5462
|
+
if ("oth" in jwk && jwk.oth !== undefined) {
|
|
5463
|
+
throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
|
|
5464
|
+
}
|
|
5465
|
+
return jwkToKey({ ...jwk, alg, ext });
|
|
5466
|
+
case "AKP": {
|
|
5467
|
+
if (typeof jwk.alg !== "string" || !jwk.alg) {
|
|
5468
|
+
throw new TypeError('missing "alg" (Algorithm) Parameter value');
|
|
5469
|
+
}
|
|
5470
|
+
if (alg !== undefined && alg !== jwk.alg) {
|
|
5471
|
+
throw new TypeError("JWK alg and alg option value mismatch");
|
|
5472
|
+
}
|
|
5473
|
+
return jwkToKey({ ...jwk, ext });
|
|
5474
|
+
}
|
|
5475
|
+
case "EC":
|
|
5476
|
+
case "OKP":
|
|
5477
|
+
return jwkToKey({ ...jwk, alg, ext });
|
|
5478
|
+
default:
|
|
5479
|
+
throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value');
|
|
5480
|
+
}
|
|
5481
|
+
}
|
|
5482
|
+
var init_import = __esm(() => {
|
|
5483
|
+
init_base64url();
|
|
5484
|
+
init_jwk_to_key();
|
|
5485
|
+
init_errors2();
|
|
5486
|
+
});
|
|
5487
|
+
|
|
5488
|
+
// ../../node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
5489
|
+
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
5490
|
+
if (joseHeader.crit !== undefined && protectedHeader?.crit === undefined) {
|
|
5491
|
+
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
5492
|
+
}
|
|
5493
|
+
if (!protectedHeader || protectedHeader.crit === undefined) {
|
|
5494
|
+
return new Set;
|
|
5495
|
+
}
|
|
5496
|
+
if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== "string" || input.length === 0)) {
|
|
5497
|
+
throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
|
|
5498
|
+
}
|
|
5499
|
+
let recognized;
|
|
5500
|
+
if (recognizedOption !== undefined) {
|
|
5501
|
+
recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
|
|
5502
|
+
} else {
|
|
5503
|
+
recognized = recognizedDefault;
|
|
5504
|
+
}
|
|
5505
|
+
for (const parameter of protectedHeader.crit) {
|
|
5506
|
+
if (!recognized.has(parameter)) {
|
|
5507
|
+
throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);
|
|
5508
|
+
}
|
|
5509
|
+
if (joseHeader[parameter] === undefined) {
|
|
5510
|
+
throw new Err(`Extension Header Parameter "${parameter}" is missing`);
|
|
5511
|
+
}
|
|
5512
|
+
if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {
|
|
5513
|
+
throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);
|
|
5514
|
+
}
|
|
5515
|
+
}
|
|
5516
|
+
return new Set(protectedHeader.crit);
|
|
5517
|
+
}
|
|
5518
|
+
var init_validate_crit = __esm(() => {
|
|
5519
|
+
init_errors2();
|
|
5520
|
+
});
|
|
5521
|
+
|
|
5522
|
+
// ../../node_modules/jose/dist/webapi/lib/validate_algorithms.js
|
|
5523
|
+
function validateAlgorithms(option, algorithms) {
|
|
5524
|
+
if (algorithms !== undefined && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
5525
|
+
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
5526
|
+
}
|
|
5527
|
+
if (!algorithms) {
|
|
5528
|
+
return;
|
|
5529
|
+
}
|
|
5530
|
+
return new Set(algorithms);
|
|
5531
|
+
}
|
|
5532
|
+
|
|
5490
5533
|
// ../../node_modules/jose/dist/webapi/lib/check_key_type.js
|
|
5491
5534
|
function checkKeyType(alg, key, usage) {
|
|
5492
5535
|
switch (alg.substring(0, 2)) {
|
|
@@ -5603,73 +5646,7 @@ var tag = (key) => key?.[Symbol.toStringTag], jwkMatchesOp = (alg, key, usage) =
|
|
|
5603
5646
|
}
|
|
5604
5647
|
}
|
|
5605
5648
|
};
|
|
5606
|
-
var init_check_key_type =
|
|
5607
|
-
init_is_jwk();
|
|
5608
|
-
});
|
|
5609
|
-
|
|
5610
|
-
// ../../node_modules/jose/dist/webapi/lib/subtle_dsa.js
|
|
5611
|
-
function subtleAlgorithm(alg, algorithm) {
|
|
5612
|
-
const hash = `SHA-${alg.slice(-3)}`;
|
|
5613
|
-
switch (alg) {
|
|
5614
|
-
case "HS256":
|
|
5615
|
-
case "HS384":
|
|
5616
|
-
case "HS512":
|
|
5617
|
-
return { hash, name: "HMAC" };
|
|
5618
|
-
case "PS256":
|
|
5619
|
-
case "PS384":
|
|
5620
|
-
case "PS512":
|
|
5621
|
-
return { hash, name: "RSA-PSS", saltLength: parseInt(alg.slice(-3), 10) >> 3 };
|
|
5622
|
-
case "RS256":
|
|
5623
|
-
case "RS384":
|
|
5624
|
-
case "RS512":
|
|
5625
|
-
return { hash, name: "RSASSA-PKCS1-v1_5" };
|
|
5626
|
-
case "ES256":
|
|
5627
|
-
case "ES384":
|
|
5628
|
-
case "ES512":
|
|
5629
|
-
return { hash, name: "ECDSA", namedCurve: algorithm.namedCurve };
|
|
5630
|
-
case "Ed25519":
|
|
5631
|
-
case "EdDSA":
|
|
5632
|
-
return { name: "Ed25519" };
|
|
5633
|
-
case "ML-DSA-44":
|
|
5634
|
-
case "ML-DSA-65":
|
|
5635
|
-
case "ML-DSA-87":
|
|
5636
|
-
return { name: alg };
|
|
5637
|
-
default:
|
|
5638
|
-
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
5639
|
-
}
|
|
5640
|
-
}
|
|
5641
|
-
var init_subtle_dsa = __esm(() => {
|
|
5642
|
-
init_errors2();
|
|
5643
|
-
});
|
|
5644
|
-
|
|
5645
|
-
// ../../node_modules/jose/dist/webapi/lib/get_sign_verify_key.js
|
|
5646
|
-
async function getSigKey(alg, key, usage) {
|
|
5647
|
-
if (key instanceof Uint8Array) {
|
|
5648
|
-
if (!alg.startsWith("HS")) {
|
|
5649
|
-
throw new TypeError(invalidKeyInput(key, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
5650
|
-
}
|
|
5651
|
-
return crypto.subtle.importKey("raw", key, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage]);
|
|
5652
|
-
}
|
|
5653
|
-
checkSigCryptoKey(key, alg, usage);
|
|
5654
|
-
return key;
|
|
5655
|
-
}
|
|
5656
|
-
var init_get_sign_verify_key = () => {};
|
|
5657
|
-
|
|
5658
|
-
// ../../node_modules/jose/dist/webapi/lib/verify.js
|
|
5659
|
-
async function verify(alg, key, signature, data) {
|
|
5660
|
-
const cryptoKey = await getSigKey(alg, key, "verify");
|
|
5661
|
-
checkKeyLength(alg, cryptoKey);
|
|
5662
|
-
const algorithm = subtleAlgorithm(alg, cryptoKey.algorithm);
|
|
5663
|
-
try {
|
|
5664
|
-
return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
|
|
5665
|
-
} catch {
|
|
5666
|
-
return false;
|
|
5667
|
-
}
|
|
5668
|
-
}
|
|
5669
|
-
var init_verify = __esm(() => {
|
|
5670
|
-
init_subtle_dsa();
|
|
5671
|
-
init_get_sign_verify_key();
|
|
5672
|
-
});
|
|
5649
|
+
var init_check_key_type = () => {};
|
|
5673
5650
|
|
|
5674
5651
|
// ../../node_modules/jose/dist/webapi/jws/flattened/verify.js
|
|
5675
5652
|
async function flattenedVerify(jws, key, options) {
|
|
@@ -5737,12 +5714,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
5737
5714
|
}
|
|
5738
5715
|
checkKeyType(alg, key, "verify");
|
|
5739
5716
|
const data = concat(jws.protected !== undefined ? encode(jws.protected) : new Uint8Array, encode("."), typeof jws.payload === "string" ? b64 ? encode(jws.payload) : encoder.encode(jws.payload) : jws.payload);
|
|
5740
|
-
|
|
5741
|
-
try {
|
|
5742
|
-
signature = decode(jws.signature);
|
|
5743
|
-
} catch {
|
|
5744
|
-
throw new JWSInvalid("Failed to base64url decode the signature");
|
|
5745
|
-
}
|
|
5717
|
+
const signature = decodeBase64url(jws.signature, "signature", JWSInvalid);
|
|
5746
5718
|
const k = await normalizeKey(key, alg);
|
|
5747
5719
|
const verified = await verify(alg, k, signature, data);
|
|
5748
5720
|
if (!verified) {
|
|
@@ -5750,11 +5722,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
5750
5722
|
}
|
|
5751
5723
|
let payload;
|
|
5752
5724
|
if (b64) {
|
|
5753
|
-
|
|
5754
|
-
payload = decode(jws.payload);
|
|
5755
|
-
} catch {
|
|
5756
|
-
throw new JWSInvalid("Failed to base64url decode the payload");
|
|
5757
|
-
}
|
|
5725
|
+
payload = decodeBase64url(jws.payload, "payload", JWSInvalid);
|
|
5758
5726
|
} else if (typeof jws.payload === "string") {
|
|
5759
5727
|
payload = encoder.encode(jws.payload);
|
|
5760
5728
|
} else {
|
|
@@ -5772,11 +5740,12 @@ async function flattenedVerify(jws, key, options) {
|
|
|
5772
5740
|
}
|
|
5773
5741
|
return result;
|
|
5774
5742
|
}
|
|
5775
|
-
var
|
|
5743
|
+
var init_verify = __esm(() => {
|
|
5776
5744
|
init_base64url();
|
|
5777
|
-
|
|
5745
|
+
init_signing();
|
|
5778
5746
|
init_errors2();
|
|
5779
5747
|
init_buffer_utils();
|
|
5748
|
+
init_helpers();
|
|
5780
5749
|
init_check_key_type();
|
|
5781
5750
|
init_validate_crit();
|
|
5782
5751
|
init_normalize_key();
|
|
@@ -5801,8 +5770,8 @@ async function compactVerify(jws, key, options) {
|
|
|
5801
5770
|
}
|
|
5802
5771
|
return result;
|
|
5803
5772
|
}
|
|
5804
|
-
var
|
|
5805
|
-
|
|
5773
|
+
var init_verify2 = __esm(() => {
|
|
5774
|
+
init_verify();
|
|
5806
5775
|
init_errors2();
|
|
5807
5776
|
init_buffer_utils();
|
|
5808
5777
|
});
|
|
@@ -6046,8 +6015,8 @@ async function jwtVerify(jwt, key, options) {
|
|
|
6046
6015
|
}
|
|
6047
6016
|
return result;
|
|
6048
6017
|
}
|
|
6049
|
-
var
|
|
6050
|
-
|
|
6018
|
+
var init_verify3 = __esm(() => {
|
|
6019
|
+
init_verify2();
|
|
6051
6020
|
init_jwt_claims_set();
|
|
6052
6021
|
init_errors2();
|
|
6053
6022
|
});
|
|
@@ -6332,7 +6301,7 @@ var init_remote = __esm(() => {
|
|
|
6332
6301
|
init_local();
|
|
6333
6302
|
if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
|
|
6334
6303
|
const NAME = "jose";
|
|
6335
|
-
const VERSION = "v6.1
|
|
6304
|
+
const VERSION = "v6.2.1";
|
|
6336
6305
|
USER_AGENT = `${NAME}/${VERSION}`;
|
|
6337
6306
|
}
|
|
6338
6307
|
customFetch = Symbol();
|
|
@@ -6341,7 +6310,7 @@ var init_remote = __esm(() => {
|
|
|
6341
6310
|
|
|
6342
6311
|
// ../../node_modules/jose/dist/webapi/index.js
|
|
6343
6312
|
var init_webapi = __esm(() => {
|
|
6344
|
-
|
|
6313
|
+
init_verify3();
|
|
6345
6314
|
init_local();
|
|
6346
6315
|
init_remote();
|
|
6347
6316
|
init_errors2();
|
|
@@ -22565,7 +22534,7 @@ var WATCH_IGNORE_PATTERNS = [
|
|
|
22565
22534
|
/(^|[/\\])_generated([/\\]|$)/
|
|
22566
22535
|
];
|
|
22567
22536
|
// package.json
|
|
22568
|
-
var version2 = "0.0.1-alpha.
|
|
22537
|
+
var version2 = "0.0.1-alpha.13";
|
|
22569
22538
|
|
|
22570
22539
|
// src/cli/cli.ts
|
|
22571
22540
|
var DEFAULT_CONVEX_VERSION_RANGE = "^1.27.3";
|