@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
|
@@ -3821,6 +3821,113 @@ var init_base64url = __esm(() => {
|
|
|
3821
3821
|
init_buffer_utils();
|
|
3822
3822
|
});
|
|
3823
3823
|
|
|
3824
|
+
// ../../node_modules/jose/dist/webapi/lib/crypto_key.js
|
|
3825
|
+
function getHashLength(hash) {
|
|
3826
|
+
return parseInt(hash.name.slice(4), 10);
|
|
3827
|
+
}
|
|
3828
|
+
function checkHashLength(algorithm, expected) {
|
|
3829
|
+
const actual = getHashLength(algorithm.hash);
|
|
3830
|
+
if (actual !== expected)
|
|
3831
|
+
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
3832
|
+
}
|
|
3833
|
+
function getNamedCurve(alg) {
|
|
3834
|
+
switch (alg) {
|
|
3835
|
+
case "ES256":
|
|
3836
|
+
return "P-256";
|
|
3837
|
+
case "ES384":
|
|
3838
|
+
return "P-384";
|
|
3839
|
+
case "ES512":
|
|
3840
|
+
return "P-521";
|
|
3841
|
+
default:
|
|
3842
|
+
throw new Error("unreachable");
|
|
3843
|
+
}
|
|
3844
|
+
}
|
|
3845
|
+
function checkUsage(key, usage) {
|
|
3846
|
+
if (usage && !key.usages.includes(usage)) {
|
|
3847
|
+
throw new TypeError(`CryptoKey does not support this operation, its usages must include ${usage}.`);
|
|
3848
|
+
}
|
|
3849
|
+
}
|
|
3850
|
+
function checkSigCryptoKey(key, alg, usage) {
|
|
3851
|
+
switch (alg) {
|
|
3852
|
+
case "HS256":
|
|
3853
|
+
case "HS384":
|
|
3854
|
+
case "HS512": {
|
|
3855
|
+
if (!isAlgorithm(key.algorithm, "HMAC"))
|
|
3856
|
+
throw unusable("HMAC");
|
|
3857
|
+
checkHashLength(key.algorithm, parseInt(alg.slice(2), 10));
|
|
3858
|
+
break;
|
|
3859
|
+
}
|
|
3860
|
+
case "RS256":
|
|
3861
|
+
case "RS384":
|
|
3862
|
+
case "RS512": {
|
|
3863
|
+
if (!isAlgorithm(key.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
3864
|
+
throw unusable("RSASSA-PKCS1-v1_5");
|
|
3865
|
+
checkHashLength(key.algorithm, parseInt(alg.slice(2), 10));
|
|
3866
|
+
break;
|
|
3867
|
+
}
|
|
3868
|
+
case "PS256":
|
|
3869
|
+
case "PS384":
|
|
3870
|
+
case "PS512": {
|
|
3871
|
+
if (!isAlgorithm(key.algorithm, "RSA-PSS"))
|
|
3872
|
+
throw unusable("RSA-PSS");
|
|
3873
|
+
checkHashLength(key.algorithm, parseInt(alg.slice(2), 10));
|
|
3874
|
+
break;
|
|
3875
|
+
}
|
|
3876
|
+
case "Ed25519":
|
|
3877
|
+
case "EdDSA": {
|
|
3878
|
+
if (!isAlgorithm(key.algorithm, "Ed25519"))
|
|
3879
|
+
throw unusable("Ed25519");
|
|
3880
|
+
break;
|
|
3881
|
+
}
|
|
3882
|
+
case "ML-DSA-44":
|
|
3883
|
+
case "ML-DSA-65":
|
|
3884
|
+
case "ML-DSA-87": {
|
|
3885
|
+
if (!isAlgorithm(key.algorithm, alg))
|
|
3886
|
+
throw unusable(alg);
|
|
3887
|
+
break;
|
|
3888
|
+
}
|
|
3889
|
+
case "ES256":
|
|
3890
|
+
case "ES384":
|
|
3891
|
+
case "ES512": {
|
|
3892
|
+
if (!isAlgorithm(key.algorithm, "ECDSA"))
|
|
3893
|
+
throw unusable("ECDSA");
|
|
3894
|
+
const expected = getNamedCurve(alg);
|
|
3895
|
+
const actual = key.algorithm.namedCurve;
|
|
3896
|
+
if (actual !== expected)
|
|
3897
|
+
throw unusable(expected, "algorithm.namedCurve");
|
|
3898
|
+
break;
|
|
3899
|
+
}
|
|
3900
|
+
default:
|
|
3901
|
+
throw new TypeError("CryptoKey does not support this operation");
|
|
3902
|
+
}
|
|
3903
|
+
checkUsage(key, usage);
|
|
3904
|
+
}
|
|
3905
|
+
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;
|
|
3906
|
+
|
|
3907
|
+
// ../../node_modules/jose/dist/webapi/lib/invalid_key_input.js
|
|
3908
|
+
function message(msg, actual, ...types) {
|
|
3909
|
+
types = types.filter(Boolean);
|
|
3910
|
+
if (types.length > 2) {
|
|
3911
|
+
const last = types.pop();
|
|
3912
|
+
msg += `one of type ${types.join(", ")}, or ${last}.`;
|
|
3913
|
+
} else if (types.length === 2) {
|
|
3914
|
+
msg += `one of type ${types[0]} or ${types[1]}.`;
|
|
3915
|
+
} else {
|
|
3916
|
+
msg += `of type ${types[0]}.`;
|
|
3917
|
+
}
|
|
3918
|
+
if (actual == null) {
|
|
3919
|
+
msg += ` Received ${actual}`;
|
|
3920
|
+
} else if (typeof actual === "function" && actual.name) {
|
|
3921
|
+
msg += ` Received function ${actual.name}`;
|
|
3922
|
+
} else if (typeof actual === "object" && actual != null) {
|
|
3923
|
+
if (actual.constructor?.name) {
|
|
3924
|
+
msg += ` Received an instance of ${actual.constructor.name}`;
|
|
3925
|
+
}
|
|
3926
|
+
}
|
|
3927
|
+
return msg;
|
|
3928
|
+
}
|
|
3929
|
+
var invalidKeyInput = (actual, ...types) => message("Key must be ", actual, ...types), withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);
|
|
3930
|
+
|
|
3824
3931
|
// ../../node_modules/jose/dist/webapi/util/errors.js
|
|
3825
3932
|
var exports_errors = {};
|
|
3826
3933
|
__export(exports_errors, {
|
|
@@ -3845,8 +3952,8 @@ var init_errors2 = __esm(() => {
|
|
|
3845
3952
|
JOSEError = class JOSEError extends Error {
|
|
3846
3953
|
static code = "ERR_JOSE_GENERIC";
|
|
3847
3954
|
code = "ERR_JOSE_GENERIC";
|
|
3848
|
-
constructor(
|
|
3849
|
-
super(
|
|
3955
|
+
constructor(message2, options) {
|
|
3956
|
+
super(message2, options);
|
|
3850
3957
|
this.name = this.constructor.name;
|
|
3851
3958
|
Error.captureStackTrace?.(this, this.constructor);
|
|
3852
3959
|
}
|
|
@@ -3857,8 +3964,8 @@ var init_errors2 = __esm(() => {
|
|
|
3857
3964
|
claim;
|
|
3858
3965
|
reason;
|
|
3859
3966
|
payload;
|
|
3860
|
-
constructor(
|
|
3861
|
-
super(
|
|
3967
|
+
constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
|
|
3968
|
+
super(message2, { cause: { claim, reason, payload } });
|
|
3862
3969
|
this.claim = claim;
|
|
3863
3970
|
this.reason = reason;
|
|
3864
3971
|
this.payload = payload;
|
|
@@ -3870,8 +3977,8 @@ var init_errors2 = __esm(() => {
|
|
|
3870
3977
|
claim;
|
|
3871
3978
|
reason;
|
|
3872
3979
|
payload;
|
|
3873
|
-
constructor(
|
|
3874
|
-
super(
|
|
3980
|
+
constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
|
|
3981
|
+
super(message2, { cause: { claim, reason, payload } });
|
|
3875
3982
|
this.claim = claim;
|
|
3876
3983
|
this.reason = reason;
|
|
3877
3984
|
this.payload = payload;
|
|
@@ -3888,8 +3995,8 @@ var init_errors2 = __esm(() => {
|
|
|
3888
3995
|
JWEDecryptionFailed = class JWEDecryptionFailed extends JOSEError {
|
|
3889
3996
|
static code = "ERR_JWE_DECRYPTION_FAILED";
|
|
3890
3997
|
code = "ERR_JWE_DECRYPTION_FAILED";
|
|
3891
|
-
constructor(
|
|
3892
|
-
super(
|
|
3998
|
+
constructor(message2 = "decryption operation failed", options) {
|
|
3999
|
+
super(message2, options);
|
|
3893
4000
|
}
|
|
3894
4001
|
};
|
|
3895
4002
|
JWEInvalid = class JWEInvalid extends JOSEError {
|
|
@@ -3915,145 +4022,34 @@ var init_errors2 = __esm(() => {
|
|
|
3915
4022
|
JWKSNoMatchingKey = class JWKSNoMatchingKey extends JOSEError {
|
|
3916
4023
|
static code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
3917
4024
|
code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
3918
|
-
constructor(
|
|
3919
|
-
super(
|
|
4025
|
+
constructor(message2 = "no applicable key found in the JSON Web Key Set", options) {
|
|
4026
|
+
super(message2, options);
|
|
3920
4027
|
}
|
|
3921
4028
|
};
|
|
3922
4029
|
JWKSMultipleMatchingKeys = class JWKSMultipleMatchingKeys extends JOSEError {
|
|
3923
4030
|
[Symbol.asyncIterator];
|
|
3924
4031
|
static code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
3925
4032
|
code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
3926
|
-
constructor(
|
|
3927
|
-
super(
|
|
4033
|
+
constructor(message2 = "multiple matching keys found in the JSON Web Key Set", options) {
|
|
4034
|
+
super(message2, options);
|
|
3928
4035
|
}
|
|
3929
4036
|
};
|
|
3930
4037
|
JWKSTimeout = class JWKSTimeout extends JOSEError {
|
|
3931
4038
|
static code = "ERR_JWKS_TIMEOUT";
|
|
3932
4039
|
code = "ERR_JWKS_TIMEOUT";
|
|
3933
|
-
constructor(
|
|
3934
|
-
super(
|
|
4040
|
+
constructor(message2 = "request timed out", options) {
|
|
4041
|
+
super(message2, options);
|
|
3935
4042
|
}
|
|
3936
4043
|
};
|
|
3937
4044
|
JWSSignatureVerificationFailed = class JWSSignatureVerificationFailed extends JOSEError {
|
|
3938
4045
|
static code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
3939
4046
|
code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
3940
|
-
constructor(
|
|
3941
|
-
super(
|
|
4047
|
+
constructor(message2 = "signature verification failed", options) {
|
|
4048
|
+
super(message2, options);
|
|
3942
4049
|
}
|
|
3943
4050
|
};
|
|
3944
4051
|
});
|
|
3945
4052
|
|
|
3946
|
-
// ../../node_modules/jose/dist/webapi/lib/crypto_key.js
|
|
3947
|
-
function getHashLength(hash) {
|
|
3948
|
-
return parseInt(hash.name.slice(4), 10);
|
|
3949
|
-
}
|
|
3950
|
-
function getNamedCurve(alg) {
|
|
3951
|
-
switch (alg) {
|
|
3952
|
-
case "ES256":
|
|
3953
|
-
return "P-256";
|
|
3954
|
-
case "ES384":
|
|
3955
|
-
return "P-384";
|
|
3956
|
-
case "ES512":
|
|
3957
|
-
return "P-521";
|
|
3958
|
-
default:
|
|
3959
|
-
throw new Error("unreachable");
|
|
3960
|
-
}
|
|
3961
|
-
}
|
|
3962
|
-
function checkUsage(key, usage) {
|
|
3963
|
-
if (usage && !key.usages.includes(usage)) {
|
|
3964
|
-
throw new TypeError(`CryptoKey does not support this operation, its usages must include ${usage}.`);
|
|
3965
|
-
}
|
|
3966
|
-
}
|
|
3967
|
-
function checkSigCryptoKey(key, alg, usage) {
|
|
3968
|
-
switch (alg) {
|
|
3969
|
-
case "HS256":
|
|
3970
|
-
case "HS384":
|
|
3971
|
-
case "HS512": {
|
|
3972
|
-
if (!isAlgorithm(key.algorithm, "HMAC"))
|
|
3973
|
-
throw unusable("HMAC");
|
|
3974
|
-
const expected = parseInt(alg.slice(2), 10);
|
|
3975
|
-
const actual = getHashLength(key.algorithm.hash);
|
|
3976
|
-
if (actual !== expected)
|
|
3977
|
-
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
3978
|
-
break;
|
|
3979
|
-
}
|
|
3980
|
-
case "RS256":
|
|
3981
|
-
case "RS384":
|
|
3982
|
-
case "RS512": {
|
|
3983
|
-
if (!isAlgorithm(key.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
3984
|
-
throw unusable("RSASSA-PKCS1-v1_5");
|
|
3985
|
-
const expected = parseInt(alg.slice(2), 10);
|
|
3986
|
-
const actual = getHashLength(key.algorithm.hash);
|
|
3987
|
-
if (actual !== expected)
|
|
3988
|
-
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
3989
|
-
break;
|
|
3990
|
-
}
|
|
3991
|
-
case "PS256":
|
|
3992
|
-
case "PS384":
|
|
3993
|
-
case "PS512": {
|
|
3994
|
-
if (!isAlgorithm(key.algorithm, "RSA-PSS"))
|
|
3995
|
-
throw unusable("RSA-PSS");
|
|
3996
|
-
const expected = parseInt(alg.slice(2), 10);
|
|
3997
|
-
const actual = getHashLength(key.algorithm.hash);
|
|
3998
|
-
if (actual !== expected)
|
|
3999
|
-
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
4000
|
-
break;
|
|
4001
|
-
}
|
|
4002
|
-
case "Ed25519":
|
|
4003
|
-
case "EdDSA": {
|
|
4004
|
-
if (!isAlgorithm(key.algorithm, "Ed25519"))
|
|
4005
|
-
throw unusable("Ed25519");
|
|
4006
|
-
break;
|
|
4007
|
-
}
|
|
4008
|
-
case "ML-DSA-44":
|
|
4009
|
-
case "ML-DSA-65":
|
|
4010
|
-
case "ML-DSA-87": {
|
|
4011
|
-
if (!isAlgorithm(key.algorithm, alg))
|
|
4012
|
-
throw unusable(alg);
|
|
4013
|
-
break;
|
|
4014
|
-
}
|
|
4015
|
-
case "ES256":
|
|
4016
|
-
case "ES384":
|
|
4017
|
-
case "ES512": {
|
|
4018
|
-
if (!isAlgorithm(key.algorithm, "ECDSA"))
|
|
4019
|
-
throw unusable("ECDSA");
|
|
4020
|
-
const expected = getNamedCurve(alg);
|
|
4021
|
-
const actual = key.algorithm.namedCurve;
|
|
4022
|
-
if (actual !== expected)
|
|
4023
|
-
throw unusable(expected, "algorithm.namedCurve");
|
|
4024
|
-
break;
|
|
4025
|
-
}
|
|
4026
|
-
default:
|
|
4027
|
-
throw new TypeError("CryptoKey does not support this operation");
|
|
4028
|
-
}
|
|
4029
|
-
checkUsage(key, usage);
|
|
4030
|
-
}
|
|
4031
|
-
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;
|
|
4032
|
-
|
|
4033
|
-
// ../../node_modules/jose/dist/webapi/lib/invalid_key_input.js
|
|
4034
|
-
function message(msg, actual, ...types) {
|
|
4035
|
-
types = types.filter(Boolean);
|
|
4036
|
-
if (types.length > 2) {
|
|
4037
|
-
const last = types.pop();
|
|
4038
|
-
msg += `one of type ${types.join(", ")}, or ${last}.`;
|
|
4039
|
-
} else if (types.length === 2) {
|
|
4040
|
-
msg += `one of type ${types[0]} or ${types[1]}.`;
|
|
4041
|
-
} else {
|
|
4042
|
-
msg += `of type ${types[0]}.`;
|
|
4043
|
-
}
|
|
4044
|
-
if (actual == null) {
|
|
4045
|
-
msg += ` Received ${actual}`;
|
|
4046
|
-
} else if (typeof actual === "function" && actual.name) {
|
|
4047
|
-
msg += ` Received function ${actual.name}`;
|
|
4048
|
-
} else if (typeof actual === "object" && actual != null) {
|
|
4049
|
-
if (actual.constructor?.name) {
|
|
4050
|
-
msg += ` Received an instance of ${actual.constructor.name}`;
|
|
4051
|
-
}
|
|
4052
|
-
}
|
|
4053
|
-
return msg;
|
|
4054
|
-
}
|
|
4055
|
-
var invalidKeyInput = (actual, ...types) => message("Key must be ", actual, ...types), withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);
|
|
4056
|
-
|
|
4057
4053
|
// ../../node_modules/jose/dist/webapi/lib/is_key_like.js
|
|
4058
4054
|
var isCryptoKey = (key) => {
|
|
4059
4055
|
if (key?.[Symbol.toStringTag] === "CryptoKey")
|
|
@@ -4065,7 +4061,34 @@ var isCryptoKey = (key) => {
|
|
|
4065
4061
|
}
|
|
4066
4062
|
}, isKeyObject = (key) => key?.[Symbol.toStringTag] === "KeyObject", isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);
|
|
4067
4063
|
|
|
4068
|
-
// ../../node_modules/jose/dist/webapi/lib/
|
|
4064
|
+
// ../../node_modules/jose/dist/webapi/lib/helpers.js
|
|
4065
|
+
function decodeBase64url(value, label, ErrorClass) {
|
|
4066
|
+
try {
|
|
4067
|
+
return decode(value);
|
|
4068
|
+
} catch {
|
|
4069
|
+
throw new ErrorClass(`Failed to base64url decode the ${label}`);
|
|
4070
|
+
}
|
|
4071
|
+
}
|
|
4072
|
+
var unprotected;
|
|
4073
|
+
var init_helpers = __esm(() => {
|
|
4074
|
+
init_base64url();
|
|
4075
|
+
unprotected = Symbol();
|
|
4076
|
+
});
|
|
4077
|
+
|
|
4078
|
+
// ../../node_modules/jose/dist/webapi/lib/type_checks.js
|
|
4079
|
+
function isObject(input) {
|
|
4080
|
+
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
4081
|
+
return false;
|
|
4082
|
+
}
|
|
4083
|
+
if (Object.getPrototypeOf(input) === null) {
|
|
4084
|
+
return true;
|
|
4085
|
+
}
|
|
4086
|
+
let proto = input;
|
|
4087
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
4088
|
+
proto = Object.getPrototypeOf(proto);
|
|
4089
|
+
}
|
|
4090
|
+
return Object.getPrototypeOf(input) === proto;
|
|
4091
|
+
}
|
|
4069
4092
|
function isDisjoint(...headers) {
|
|
4070
4093
|
const sources = headers.filter(Boolean);
|
|
4071
4094
|
if (sources.length === 0 || sources.length === 1) {
|
|
@@ -4087,24 +4110,9 @@ function isDisjoint(...headers) {
|
|
|
4087
4110
|
}
|
|
4088
4111
|
return true;
|
|
4089
4112
|
}
|
|
4113
|
+
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";
|
|
4090
4114
|
|
|
4091
|
-
// ../../node_modules/jose/dist/webapi/lib/
|
|
4092
|
-
function isObject(input) {
|
|
4093
|
-
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
4094
|
-
return false;
|
|
4095
|
-
}
|
|
4096
|
-
if (Object.getPrototypeOf(input) === null) {
|
|
4097
|
-
return true;
|
|
4098
|
-
}
|
|
4099
|
-
let proto = input;
|
|
4100
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
|
4101
|
-
proto = Object.getPrototypeOf(proto);
|
|
4102
|
-
}
|
|
4103
|
-
return Object.getPrototypeOf(input) === proto;
|
|
4104
|
-
}
|
|
4105
|
-
var isObjectLike = (value) => typeof value === "object" && value !== null;
|
|
4106
|
-
|
|
4107
|
-
// ../../node_modules/jose/dist/webapi/lib/check_key_length.js
|
|
4115
|
+
// ../../node_modules/jose/dist/webapi/lib/signing.js
|
|
4108
4116
|
function checkKeyLength(alg, key) {
|
|
4109
4117
|
if (alg.startsWith("RS") || alg.startsWith("PS")) {
|
|
4110
4118
|
const { modulusLength } = key.algorithm;
|
|
@@ -4113,6 +4121,59 @@ function checkKeyLength(alg, key) {
|
|
|
4113
4121
|
}
|
|
4114
4122
|
}
|
|
4115
4123
|
}
|
|
4124
|
+
function subtleAlgorithm(alg, algorithm) {
|
|
4125
|
+
const hash = `SHA-${alg.slice(-3)}`;
|
|
4126
|
+
switch (alg) {
|
|
4127
|
+
case "HS256":
|
|
4128
|
+
case "HS384":
|
|
4129
|
+
case "HS512":
|
|
4130
|
+
return { hash, name: "HMAC" };
|
|
4131
|
+
case "PS256":
|
|
4132
|
+
case "PS384":
|
|
4133
|
+
case "PS512":
|
|
4134
|
+
return { hash, name: "RSA-PSS", saltLength: parseInt(alg.slice(-3), 10) >> 3 };
|
|
4135
|
+
case "RS256":
|
|
4136
|
+
case "RS384":
|
|
4137
|
+
case "RS512":
|
|
4138
|
+
return { hash, name: "RSASSA-PKCS1-v1_5" };
|
|
4139
|
+
case "ES256":
|
|
4140
|
+
case "ES384":
|
|
4141
|
+
case "ES512":
|
|
4142
|
+
return { hash, name: "ECDSA", namedCurve: algorithm.namedCurve };
|
|
4143
|
+
case "Ed25519":
|
|
4144
|
+
case "EdDSA":
|
|
4145
|
+
return { name: "Ed25519" };
|
|
4146
|
+
case "ML-DSA-44":
|
|
4147
|
+
case "ML-DSA-65":
|
|
4148
|
+
case "ML-DSA-87":
|
|
4149
|
+
return { name: alg };
|
|
4150
|
+
default:
|
|
4151
|
+
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
4152
|
+
}
|
|
4153
|
+
}
|
|
4154
|
+
async function getSigKey(alg, key, usage) {
|
|
4155
|
+
if (key instanceof Uint8Array) {
|
|
4156
|
+
if (!alg.startsWith("HS")) {
|
|
4157
|
+
throw new TypeError(invalidKeyInput(key, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
4158
|
+
}
|
|
4159
|
+
return crypto.subtle.importKey("raw", key, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage]);
|
|
4160
|
+
}
|
|
4161
|
+
checkSigCryptoKey(key, alg, usage);
|
|
4162
|
+
return key;
|
|
4163
|
+
}
|
|
4164
|
+
async function verify(alg, key, signature, data) {
|
|
4165
|
+
const cryptoKey = await getSigKey(alg, key, "verify");
|
|
4166
|
+
checkKeyLength(alg, cryptoKey);
|
|
4167
|
+
const algorithm = subtleAlgorithm(alg, cryptoKey.algorithm);
|
|
4168
|
+
try {
|
|
4169
|
+
return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
|
|
4170
|
+
} catch {
|
|
4171
|
+
return false;
|
|
4172
|
+
}
|
|
4173
|
+
}
|
|
4174
|
+
var init_signing = __esm(() => {
|
|
4175
|
+
init_errors2();
|
|
4176
|
+
});
|
|
4116
4177
|
|
|
4117
4178
|
// ../../node_modules/jose/dist/webapi/lib/jwk_to_key.js
|
|
4118
4179
|
function subtleMapping(jwk) {
|
|
@@ -4128,7 +4189,7 @@ function subtleMapping(jwk) {
|
|
|
4128
4189
|
keyUsages = jwk.priv ? ["sign"] : ["verify"];
|
|
4129
4190
|
break;
|
|
4130
4191
|
default:
|
|
4131
|
-
throw new JOSENotSupported(
|
|
4192
|
+
throw new JOSENotSupported(unsupportedAlg);
|
|
4132
4193
|
}
|
|
4133
4194
|
break;
|
|
4134
4195
|
}
|
|
@@ -4157,22 +4218,19 @@ function subtleMapping(jwk) {
|
|
|
4157
4218
|
keyUsages = jwk.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
|
|
4158
4219
|
break;
|
|
4159
4220
|
default:
|
|
4160
|
-
throw new JOSENotSupported(
|
|
4221
|
+
throw new JOSENotSupported(unsupportedAlg);
|
|
4161
4222
|
}
|
|
4162
4223
|
break;
|
|
4163
4224
|
}
|
|
4164
4225
|
case "EC": {
|
|
4165
4226
|
switch (jwk.alg) {
|
|
4166
4227
|
case "ES256":
|
|
4167
|
-
algorithm = { name: "ECDSA", namedCurve: "P-256" };
|
|
4168
|
-
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
4169
|
-
break;
|
|
4170
4228
|
case "ES384":
|
|
4171
|
-
algorithm = { name: "ECDSA", namedCurve: "P-384" };
|
|
4172
|
-
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
4173
|
-
break;
|
|
4174
4229
|
case "ES512":
|
|
4175
|
-
algorithm = {
|
|
4230
|
+
algorithm = {
|
|
4231
|
+
name: "ECDSA",
|
|
4232
|
+
namedCurve: { ES256: "P-256", ES384: "P-384", ES512: "P-521" }[jwk.alg]
|
|
4233
|
+
};
|
|
4176
4234
|
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
4177
4235
|
break;
|
|
4178
4236
|
case "ECDH-ES":
|
|
@@ -4183,7 +4241,7 @@ function subtleMapping(jwk) {
|
|
|
4183
4241
|
keyUsages = jwk.d ? ["deriveBits"] : [];
|
|
4184
4242
|
break;
|
|
4185
4243
|
default:
|
|
4186
|
-
throw new JOSENotSupported(
|
|
4244
|
+
throw new JOSENotSupported(unsupportedAlg);
|
|
4187
4245
|
}
|
|
4188
4246
|
break;
|
|
4189
4247
|
}
|
|
@@ -4202,7 +4260,7 @@ function subtleMapping(jwk) {
|
|
|
4202
4260
|
keyUsages = jwk.d ? ["deriveBits"] : [];
|
|
4203
4261
|
break;
|
|
4204
4262
|
default:
|
|
4205
|
-
throw new JOSENotSupported(
|
|
4263
|
+
throw new JOSENotSupported(unsupportedAlg);
|
|
4206
4264
|
}
|
|
4207
4265
|
break;
|
|
4208
4266
|
}
|
|
@@ -4223,100 +4281,11 @@ async function jwkToKey(jwk) {
|
|
|
4223
4281
|
delete keyData.use;
|
|
4224
4282
|
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);
|
|
4225
4283
|
}
|
|
4284
|
+
var unsupportedAlg = 'Invalid or unsupported JWK "alg" (Algorithm) Parameter value';
|
|
4226
4285
|
var init_jwk_to_key = __esm(() => {
|
|
4227
4286
|
init_errors2();
|
|
4228
4287
|
});
|
|
4229
4288
|
|
|
4230
|
-
// ../../node_modules/jose/dist/webapi/key/import.js
|
|
4231
|
-
async function importJWK(jwk, alg, options) {
|
|
4232
|
-
if (!isObject(jwk)) {
|
|
4233
|
-
throw new TypeError("JWK must be an object");
|
|
4234
|
-
}
|
|
4235
|
-
let ext;
|
|
4236
|
-
alg ??= jwk.alg;
|
|
4237
|
-
ext ??= options?.extractable ?? jwk.ext;
|
|
4238
|
-
switch (jwk.kty) {
|
|
4239
|
-
case "oct":
|
|
4240
|
-
if (typeof jwk.k !== "string" || !jwk.k) {
|
|
4241
|
-
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
4242
|
-
}
|
|
4243
|
-
return decode(jwk.k);
|
|
4244
|
-
case "RSA":
|
|
4245
|
-
if ("oth" in jwk && jwk.oth !== undefined) {
|
|
4246
|
-
throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
|
|
4247
|
-
}
|
|
4248
|
-
return jwkToKey({ ...jwk, alg, ext });
|
|
4249
|
-
case "AKP": {
|
|
4250
|
-
if (typeof jwk.alg !== "string" || !jwk.alg) {
|
|
4251
|
-
throw new TypeError('missing "alg" (Algorithm) Parameter value');
|
|
4252
|
-
}
|
|
4253
|
-
if (alg !== undefined && alg !== jwk.alg) {
|
|
4254
|
-
throw new TypeError("JWK alg and alg option value mismatch");
|
|
4255
|
-
}
|
|
4256
|
-
return jwkToKey({ ...jwk, ext });
|
|
4257
|
-
}
|
|
4258
|
-
case "EC":
|
|
4259
|
-
case "OKP":
|
|
4260
|
-
return jwkToKey({ ...jwk, alg, ext });
|
|
4261
|
-
default:
|
|
4262
|
-
throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value');
|
|
4263
|
-
}
|
|
4264
|
-
}
|
|
4265
|
-
var init_import = __esm(() => {
|
|
4266
|
-
init_base64url();
|
|
4267
|
-
init_jwk_to_key();
|
|
4268
|
-
init_errors2();
|
|
4269
|
-
});
|
|
4270
|
-
|
|
4271
|
-
// ../../node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
4272
|
-
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
4273
|
-
if (joseHeader.crit !== undefined && protectedHeader?.crit === undefined) {
|
|
4274
|
-
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
4275
|
-
}
|
|
4276
|
-
if (!protectedHeader || protectedHeader.crit === undefined) {
|
|
4277
|
-
return new Set;
|
|
4278
|
-
}
|
|
4279
|
-
if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== "string" || input.length === 0)) {
|
|
4280
|
-
throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
|
|
4281
|
-
}
|
|
4282
|
-
let recognized;
|
|
4283
|
-
if (recognizedOption !== undefined) {
|
|
4284
|
-
recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
|
|
4285
|
-
} else {
|
|
4286
|
-
recognized = recognizedDefault;
|
|
4287
|
-
}
|
|
4288
|
-
for (const parameter of protectedHeader.crit) {
|
|
4289
|
-
if (!recognized.has(parameter)) {
|
|
4290
|
-
throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);
|
|
4291
|
-
}
|
|
4292
|
-
if (joseHeader[parameter] === undefined) {
|
|
4293
|
-
throw new Err(`Extension Header Parameter "${parameter}" is missing`);
|
|
4294
|
-
}
|
|
4295
|
-
if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {
|
|
4296
|
-
throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);
|
|
4297
|
-
}
|
|
4298
|
-
}
|
|
4299
|
-
return new Set(protectedHeader.crit);
|
|
4300
|
-
}
|
|
4301
|
-
var init_validate_crit = __esm(() => {
|
|
4302
|
-
init_errors2();
|
|
4303
|
-
});
|
|
4304
|
-
|
|
4305
|
-
// ../../node_modules/jose/dist/webapi/lib/validate_algorithms.js
|
|
4306
|
-
function validateAlgorithms(option, algorithms) {
|
|
4307
|
-
if (algorithms !== undefined && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
4308
|
-
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
4309
|
-
}
|
|
4310
|
-
if (!algorithms) {
|
|
4311
|
-
return;
|
|
4312
|
-
}
|
|
4313
|
-
return new Set(algorithms);
|
|
4314
|
-
}
|
|
4315
|
-
|
|
4316
|
-
// ../../node_modules/jose/dist/webapi/lib/is_jwk.js
|
|
4317
|
-
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";
|
|
4318
|
-
var init_is_jwk = () => {};
|
|
4319
|
-
|
|
4320
4289
|
// ../../node_modules/jose/dist/webapi/lib/normalize_key.js
|
|
4321
4290
|
async function normalizeKey(key, alg) {
|
|
4322
4291
|
if (key instanceof Uint8Array) {
|
|
@@ -4349,7 +4318,7 @@ async function normalizeKey(key, alg) {
|
|
|
4349
4318
|
}
|
|
4350
4319
|
throw new Error("unreachable");
|
|
4351
4320
|
}
|
|
4352
|
-
var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
4321
|
+
var unusableForAlg = "given KeyObject instance cannot be used for this algorithm", cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
4353
4322
|
cache ||= new WeakMap;
|
|
4354
4323
|
let cached = cache.get(key);
|
|
4355
4324
|
if (cached?.[alg]) {
|
|
@@ -4381,13 +4350,13 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
4381
4350
|
case "ECDH-ES+A256KW":
|
|
4382
4351
|
break;
|
|
4383
4352
|
default:
|
|
4384
|
-
throw new TypeError(
|
|
4353
|
+
throw new TypeError(unusableForAlg);
|
|
4385
4354
|
}
|
|
4386
4355
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, isPublic ? [] : ["deriveBits"]);
|
|
4387
4356
|
}
|
|
4388
4357
|
if (keyObject.asymmetricKeyType === "ed25519") {
|
|
4389
4358
|
if (alg !== "EdDSA" && alg !== "Ed25519") {
|
|
4390
|
-
throw new TypeError(
|
|
4359
|
+
throw new TypeError(unusableForAlg);
|
|
4391
4360
|
}
|
|
4392
4361
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
|
|
4393
4362
|
isPublic ? "verify" : "sign"
|
|
@@ -4398,7 +4367,7 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
4398
4367
|
case "ml-dsa-65":
|
|
4399
4368
|
case "ml-dsa-87": {
|
|
4400
4369
|
if (alg !== keyObject.asymmetricKeyType.toUpperCase()) {
|
|
4401
|
-
throw new TypeError(
|
|
4370
|
+
throw new TypeError(unusableForAlg);
|
|
4402
4371
|
}
|
|
4403
4372
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
|
|
4404
4373
|
isPublic ? "verify" : "sign"
|
|
@@ -4427,7 +4396,7 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
4427
4396
|
hash = "SHA-512";
|
|
4428
4397
|
break;
|
|
4429
4398
|
default:
|
|
4430
|
-
throw new TypeError(
|
|
4399
|
+
throw new TypeError(unusableForAlg);
|
|
4431
4400
|
}
|
|
4432
4401
|
if (alg.startsWith("RSA-OAEP")) {
|
|
4433
4402
|
return keyObject.toCryptoKey({
|
|
@@ -4448,21 +4417,10 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
4448
4417
|
]);
|
|
4449
4418
|
const namedCurve = nist.get(keyObject.asymmetricKeyDetails?.namedCurve);
|
|
4450
4419
|
if (!namedCurve) {
|
|
4451
|
-
throw new TypeError(
|
|
4452
|
-
}
|
|
4453
|
-
if (alg === "ES256" && namedCurve === "P-256") {
|
|
4454
|
-
cryptoKey = keyObject.toCryptoKey({
|
|
4455
|
-
name: "ECDSA",
|
|
4456
|
-
namedCurve
|
|
4457
|
-
}, extractable, [isPublic ? "verify" : "sign"]);
|
|
4458
|
-
}
|
|
4459
|
-
if (alg === "ES384" && namedCurve === "P-384") {
|
|
4460
|
-
cryptoKey = keyObject.toCryptoKey({
|
|
4461
|
-
name: "ECDSA",
|
|
4462
|
-
namedCurve
|
|
4463
|
-
}, extractable, [isPublic ? "verify" : "sign"]);
|
|
4420
|
+
throw new TypeError(unusableForAlg);
|
|
4464
4421
|
}
|
|
4465
|
-
|
|
4422
|
+
const expectedCurve = { ES256: "P-256", ES384: "P-384", ES512: "P-521" };
|
|
4423
|
+
if (expectedCurve[alg] && namedCurve === expectedCurve[alg]) {
|
|
4466
4424
|
cryptoKey = keyObject.toCryptoKey({
|
|
4467
4425
|
name: "ECDSA",
|
|
4468
4426
|
namedCurve
|
|
@@ -4476,7 +4434,7 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
4476
4434
|
}
|
|
4477
4435
|
}
|
|
4478
4436
|
if (!cryptoKey) {
|
|
4479
|
-
throw new TypeError(
|
|
4437
|
+
throw new TypeError(unusableForAlg);
|
|
4480
4438
|
}
|
|
4481
4439
|
if (!cached) {
|
|
4482
4440
|
cache.set(keyObject, { [alg]: cryptoKey });
|
|
@@ -4486,11 +4444,96 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
4486
4444
|
return cryptoKey;
|
|
4487
4445
|
};
|
|
4488
4446
|
var init_normalize_key = __esm(() => {
|
|
4489
|
-
init_is_jwk();
|
|
4490
4447
|
init_base64url();
|
|
4491
4448
|
init_jwk_to_key();
|
|
4492
4449
|
});
|
|
4493
4450
|
|
|
4451
|
+
// ../../node_modules/jose/dist/webapi/key/import.js
|
|
4452
|
+
async function importJWK(jwk, alg, options) {
|
|
4453
|
+
if (!isObject(jwk)) {
|
|
4454
|
+
throw new TypeError("JWK must be an object");
|
|
4455
|
+
}
|
|
4456
|
+
let ext;
|
|
4457
|
+
alg ??= jwk.alg;
|
|
4458
|
+
ext ??= options?.extractable ?? jwk.ext;
|
|
4459
|
+
switch (jwk.kty) {
|
|
4460
|
+
case "oct":
|
|
4461
|
+
if (typeof jwk.k !== "string" || !jwk.k) {
|
|
4462
|
+
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
4463
|
+
}
|
|
4464
|
+
return decode(jwk.k);
|
|
4465
|
+
case "RSA":
|
|
4466
|
+
if ("oth" in jwk && jwk.oth !== undefined) {
|
|
4467
|
+
throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
|
|
4468
|
+
}
|
|
4469
|
+
return jwkToKey({ ...jwk, alg, ext });
|
|
4470
|
+
case "AKP": {
|
|
4471
|
+
if (typeof jwk.alg !== "string" || !jwk.alg) {
|
|
4472
|
+
throw new TypeError('missing "alg" (Algorithm) Parameter value');
|
|
4473
|
+
}
|
|
4474
|
+
if (alg !== undefined && alg !== jwk.alg) {
|
|
4475
|
+
throw new TypeError("JWK alg and alg option value mismatch");
|
|
4476
|
+
}
|
|
4477
|
+
return jwkToKey({ ...jwk, ext });
|
|
4478
|
+
}
|
|
4479
|
+
case "EC":
|
|
4480
|
+
case "OKP":
|
|
4481
|
+
return jwkToKey({ ...jwk, alg, ext });
|
|
4482
|
+
default:
|
|
4483
|
+
throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value');
|
|
4484
|
+
}
|
|
4485
|
+
}
|
|
4486
|
+
var init_import = __esm(() => {
|
|
4487
|
+
init_base64url();
|
|
4488
|
+
init_jwk_to_key();
|
|
4489
|
+
init_errors2();
|
|
4490
|
+
});
|
|
4491
|
+
|
|
4492
|
+
// ../../node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
4493
|
+
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
4494
|
+
if (joseHeader.crit !== undefined && protectedHeader?.crit === undefined) {
|
|
4495
|
+
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
4496
|
+
}
|
|
4497
|
+
if (!protectedHeader || protectedHeader.crit === undefined) {
|
|
4498
|
+
return new Set;
|
|
4499
|
+
}
|
|
4500
|
+
if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== "string" || input.length === 0)) {
|
|
4501
|
+
throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
|
|
4502
|
+
}
|
|
4503
|
+
let recognized;
|
|
4504
|
+
if (recognizedOption !== undefined) {
|
|
4505
|
+
recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
|
|
4506
|
+
} else {
|
|
4507
|
+
recognized = recognizedDefault;
|
|
4508
|
+
}
|
|
4509
|
+
for (const parameter of protectedHeader.crit) {
|
|
4510
|
+
if (!recognized.has(parameter)) {
|
|
4511
|
+
throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);
|
|
4512
|
+
}
|
|
4513
|
+
if (joseHeader[parameter] === undefined) {
|
|
4514
|
+
throw new Err(`Extension Header Parameter "${parameter}" is missing`);
|
|
4515
|
+
}
|
|
4516
|
+
if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {
|
|
4517
|
+
throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);
|
|
4518
|
+
}
|
|
4519
|
+
}
|
|
4520
|
+
return new Set(protectedHeader.crit);
|
|
4521
|
+
}
|
|
4522
|
+
var init_validate_crit = __esm(() => {
|
|
4523
|
+
init_errors2();
|
|
4524
|
+
});
|
|
4525
|
+
|
|
4526
|
+
// ../../node_modules/jose/dist/webapi/lib/validate_algorithms.js
|
|
4527
|
+
function validateAlgorithms(option, algorithms) {
|
|
4528
|
+
if (algorithms !== undefined && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
4529
|
+
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
4530
|
+
}
|
|
4531
|
+
if (!algorithms) {
|
|
4532
|
+
return;
|
|
4533
|
+
}
|
|
4534
|
+
return new Set(algorithms);
|
|
4535
|
+
}
|
|
4536
|
+
|
|
4494
4537
|
// ../../node_modules/jose/dist/webapi/lib/check_key_type.js
|
|
4495
4538
|
function checkKeyType(alg, key, usage) {
|
|
4496
4539
|
switch (alg.substring(0, 2)) {
|
|
@@ -4607,73 +4650,7 @@ var tag = (key) => key?.[Symbol.toStringTag], jwkMatchesOp = (alg, key, usage) =
|
|
|
4607
4650
|
}
|
|
4608
4651
|
}
|
|
4609
4652
|
};
|
|
4610
|
-
var init_check_key_type =
|
|
4611
|
-
init_is_jwk();
|
|
4612
|
-
});
|
|
4613
|
-
|
|
4614
|
-
// ../../node_modules/jose/dist/webapi/lib/subtle_dsa.js
|
|
4615
|
-
function subtleAlgorithm(alg, algorithm) {
|
|
4616
|
-
const hash = `SHA-${alg.slice(-3)}`;
|
|
4617
|
-
switch (alg) {
|
|
4618
|
-
case "HS256":
|
|
4619
|
-
case "HS384":
|
|
4620
|
-
case "HS512":
|
|
4621
|
-
return { hash, name: "HMAC" };
|
|
4622
|
-
case "PS256":
|
|
4623
|
-
case "PS384":
|
|
4624
|
-
case "PS512":
|
|
4625
|
-
return { hash, name: "RSA-PSS", saltLength: parseInt(alg.slice(-3), 10) >> 3 };
|
|
4626
|
-
case "RS256":
|
|
4627
|
-
case "RS384":
|
|
4628
|
-
case "RS512":
|
|
4629
|
-
return { hash, name: "RSASSA-PKCS1-v1_5" };
|
|
4630
|
-
case "ES256":
|
|
4631
|
-
case "ES384":
|
|
4632
|
-
case "ES512":
|
|
4633
|
-
return { hash, name: "ECDSA", namedCurve: algorithm.namedCurve };
|
|
4634
|
-
case "Ed25519":
|
|
4635
|
-
case "EdDSA":
|
|
4636
|
-
return { name: "Ed25519" };
|
|
4637
|
-
case "ML-DSA-44":
|
|
4638
|
-
case "ML-DSA-65":
|
|
4639
|
-
case "ML-DSA-87":
|
|
4640
|
-
return { name: alg };
|
|
4641
|
-
default:
|
|
4642
|
-
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
4643
|
-
}
|
|
4644
|
-
}
|
|
4645
|
-
var init_subtle_dsa = __esm(() => {
|
|
4646
|
-
init_errors2();
|
|
4647
|
-
});
|
|
4648
|
-
|
|
4649
|
-
// ../../node_modules/jose/dist/webapi/lib/get_sign_verify_key.js
|
|
4650
|
-
async function getSigKey(alg, key, usage) {
|
|
4651
|
-
if (key instanceof Uint8Array) {
|
|
4652
|
-
if (!alg.startsWith("HS")) {
|
|
4653
|
-
throw new TypeError(invalidKeyInput(key, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
4654
|
-
}
|
|
4655
|
-
return crypto.subtle.importKey("raw", key, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage]);
|
|
4656
|
-
}
|
|
4657
|
-
checkSigCryptoKey(key, alg, usage);
|
|
4658
|
-
return key;
|
|
4659
|
-
}
|
|
4660
|
-
var init_get_sign_verify_key = () => {};
|
|
4661
|
-
|
|
4662
|
-
// ../../node_modules/jose/dist/webapi/lib/verify.js
|
|
4663
|
-
async function verify(alg, key, signature, data) {
|
|
4664
|
-
const cryptoKey = await getSigKey(alg, key, "verify");
|
|
4665
|
-
checkKeyLength(alg, cryptoKey);
|
|
4666
|
-
const algorithm = subtleAlgorithm(alg, cryptoKey.algorithm);
|
|
4667
|
-
try {
|
|
4668
|
-
return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
|
|
4669
|
-
} catch {
|
|
4670
|
-
return false;
|
|
4671
|
-
}
|
|
4672
|
-
}
|
|
4673
|
-
var init_verify = __esm(() => {
|
|
4674
|
-
init_subtle_dsa();
|
|
4675
|
-
init_get_sign_verify_key();
|
|
4676
|
-
});
|
|
4653
|
+
var init_check_key_type = () => {};
|
|
4677
4654
|
|
|
4678
4655
|
// ../../node_modules/jose/dist/webapi/jws/flattened/verify.js
|
|
4679
4656
|
async function flattenedVerify(jws, key, options) {
|
|
@@ -4741,12 +4718,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
4741
4718
|
}
|
|
4742
4719
|
checkKeyType(alg, key, "verify");
|
|
4743
4720
|
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);
|
|
4744
|
-
|
|
4745
|
-
try {
|
|
4746
|
-
signature = decode(jws.signature);
|
|
4747
|
-
} catch {
|
|
4748
|
-
throw new JWSInvalid("Failed to base64url decode the signature");
|
|
4749
|
-
}
|
|
4721
|
+
const signature = decodeBase64url(jws.signature, "signature", JWSInvalid);
|
|
4750
4722
|
const k = await normalizeKey(key, alg);
|
|
4751
4723
|
const verified = await verify(alg, k, signature, data);
|
|
4752
4724
|
if (!verified) {
|
|
@@ -4754,11 +4726,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
4754
4726
|
}
|
|
4755
4727
|
let payload;
|
|
4756
4728
|
if (b64) {
|
|
4757
|
-
|
|
4758
|
-
payload = decode(jws.payload);
|
|
4759
|
-
} catch {
|
|
4760
|
-
throw new JWSInvalid("Failed to base64url decode the payload");
|
|
4761
|
-
}
|
|
4729
|
+
payload = decodeBase64url(jws.payload, "payload", JWSInvalid);
|
|
4762
4730
|
} else if (typeof jws.payload === "string") {
|
|
4763
4731
|
payload = encoder.encode(jws.payload);
|
|
4764
4732
|
} else {
|
|
@@ -4776,11 +4744,12 @@ async function flattenedVerify(jws, key, options) {
|
|
|
4776
4744
|
}
|
|
4777
4745
|
return result;
|
|
4778
4746
|
}
|
|
4779
|
-
var
|
|
4747
|
+
var init_verify = __esm(() => {
|
|
4780
4748
|
init_base64url();
|
|
4781
|
-
|
|
4749
|
+
init_signing();
|
|
4782
4750
|
init_errors2();
|
|
4783
4751
|
init_buffer_utils();
|
|
4752
|
+
init_helpers();
|
|
4784
4753
|
init_check_key_type();
|
|
4785
4754
|
init_validate_crit();
|
|
4786
4755
|
init_normalize_key();
|
|
@@ -4805,8 +4774,8 @@ async function compactVerify(jws, key, options) {
|
|
|
4805
4774
|
}
|
|
4806
4775
|
return result;
|
|
4807
4776
|
}
|
|
4808
|
-
var
|
|
4809
|
-
|
|
4777
|
+
var init_verify2 = __esm(() => {
|
|
4778
|
+
init_verify();
|
|
4810
4779
|
init_errors2();
|
|
4811
4780
|
init_buffer_utils();
|
|
4812
4781
|
});
|
|
@@ -5050,8 +5019,8 @@ async function jwtVerify(jwt, key, options) {
|
|
|
5050
5019
|
}
|
|
5051
5020
|
return result;
|
|
5052
5021
|
}
|
|
5053
|
-
var
|
|
5054
|
-
|
|
5022
|
+
var init_verify3 = __esm(() => {
|
|
5023
|
+
init_verify2();
|
|
5055
5024
|
init_jwt_claims_set();
|
|
5056
5025
|
init_errors2();
|
|
5057
5026
|
});
|
|
@@ -5336,7 +5305,7 @@ var init_remote = __esm(() => {
|
|
|
5336
5305
|
init_local();
|
|
5337
5306
|
if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
|
|
5338
5307
|
const NAME = "jose";
|
|
5339
|
-
const VERSION = "v6.1
|
|
5308
|
+
const VERSION = "v6.2.1";
|
|
5340
5309
|
USER_AGENT = `${NAME}/${VERSION}`;
|
|
5341
5310
|
}
|
|
5342
5311
|
customFetch = Symbol();
|
|
@@ -5345,7 +5314,7 @@ var init_remote = __esm(() => {
|
|
|
5345
5314
|
|
|
5346
5315
|
// ../../node_modules/jose/dist/webapi/index.js
|
|
5347
5316
|
var init_webapi = __esm(() => {
|
|
5348
|
-
|
|
5317
|
+
init_verify3();
|
|
5349
5318
|
init_local();
|
|
5350
5319
|
init_remote();
|
|
5351
5320
|
init_errors2();
|
|
@@ -11927,6 +11896,11 @@ function decode2(input) {
|
|
|
11927
11896
|
function getHashLength2(hash) {
|
|
11928
11897
|
return parseInt(hash.name.slice(4), 10);
|
|
11929
11898
|
}
|
|
11899
|
+
function checkHashLength2(algorithm, expected) {
|
|
11900
|
+
const actual = getHashLength2(algorithm.hash);
|
|
11901
|
+
if (actual !== expected)
|
|
11902
|
+
throw unusable2(`SHA-${expected}`, "algorithm.hash");
|
|
11903
|
+
}
|
|
11930
11904
|
function getNamedCurve2(alg) {
|
|
11931
11905
|
switch (alg) {
|
|
11932
11906
|
case "ES256":
|
|
@@ -11951,10 +11925,7 @@ function checkSigCryptoKey2(key, alg, usage) {
|
|
|
11951
11925
|
case "HS512": {
|
|
11952
11926
|
if (!isAlgorithm2(key.algorithm, "HMAC"))
|
|
11953
11927
|
throw unusable2("HMAC");
|
|
11954
|
-
|
|
11955
|
-
const actual = getHashLength2(key.algorithm.hash);
|
|
11956
|
-
if (actual !== expected)
|
|
11957
|
-
throw unusable2(`SHA-${expected}`, "algorithm.hash");
|
|
11928
|
+
checkHashLength2(key.algorithm, parseInt(alg.slice(2), 10));
|
|
11958
11929
|
break;
|
|
11959
11930
|
}
|
|
11960
11931
|
case "RS256":
|
|
@@ -11962,10 +11933,7 @@ function checkSigCryptoKey2(key, alg, usage) {
|
|
|
11962
11933
|
case "RS512": {
|
|
11963
11934
|
if (!isAlgorithm2(key.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
11964
11935
|
throw unusable2("RSASSA-PKCS1-v1_5");
|
|
11965
|
-
|
|
11966
|
-
const actual = getHashLength2(key.algorithm.hash);
|
|
11967
|
-
if (actual !== expected)
|
|
11968
|
-
throw unusable2(`SHA-${expected}`, "algorithm.hash");
|
|
11936
|
+
checkHashLength2(key.algorithm, parseInt(alg.slice(2), 10));
|
|
11969
11937
|
break;
|
|
11970
11938
|
}
|
|
11971
11939
|
case "PS256":
|
|
@@ -11973,10 +11941,7 @@ function checkSigCryptoKey2(key, alg, usage) {
|
|
|
11973
11941
|
case "PS512": {
|
|
11974
11942
|
if (!isAlgorithm2(key.algorithm, "RSA-PSS"))
|
|
11975
11943
|
throw unusable2("RSA-PSS");
|
|
11976
|
-
|
|
11977
|
-
const actual = getHashLength2(key.algorithm.hash);
|
|
11978
|
-
if (actual !== expected)
|
|
11979
|
-
throw unusable2(`SHA-${expected}`, "algorithm.hash");
|
|
11944
|
+
checkHashLength2(key.algorithm, parseInt(alg.slice(2), 10));
|
|
11980
11945
|
break;
|
|
11981
11946
|
}
|
|
11982
11947
|
case "Ed25519":
|
|
@@ -12029,6 +11994,26 @@ function message2(msg, actual, ...types2) {
|
|
|
12029
11994
|
}
|
|
12030
11995
|
return msg;
|
|
12031
11996
|
}
|
|
11997
|
+
function decodeBase64url2(value, label, ErrorClass) {
|
|
11998
|
+
try {
|
|
11999
|
+
return decode2(value);
|
|
12000
|
+
} catch {
|
|
12001
|
+
throw new ErrorClass(`Failed to base64url decode the ${label}`);
|
|
12002
|
+
}
|
|
12003
|
+
}
|
|
12004
|
+
function isObject2(input) {
|
|
12005
|
+
if (!isObjectLike2(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
12006
|
+
return false;
|
|
12007
|
+
}
|
|
12008
|
+
if (Object.getPrototypeOf(input) === null) {
|
|
12009
|
+
return true;
|
|
12010
|
+
}
|
|
12011
|
+
let proto = input;
|
|
12012
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
12013
|
+
proto = Object.getPrototypeOf(proto);
|
|
12014
|
+
}
|
|
12015
|
+
return Object.getPrototypeOf(input) === proto;
|
|
12016
|
+
}
|
|
12032
12017
|
function isDisjoint2(...headers) {
|
|
12033
12018
|
const sources = headers.filter(Boolean);
|
|
12034
12019
|
if (sources.length === 0 || sources.length === 1) {
|
|
@@ -12050,19 +12035,6 @@ function isDisjoint2(...headers) {
|
|
|
12050
12035
|
}
|
|
12051
12036
|
return true;
|
|
12052
12037
|
}
|
|
12053
|
-
function isObject2(input) {
|
|
12054
|
-
if (!isObjectLike2(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
12055
|
-
return false;
|
|
12056
|
-
}
|
|
12057
|
-
if (Object.getPrototypeOf(input) === null) {
|
|
12058
|
-
return true;
|
|
12059
|
-
}
|
|
12060
|
-
let proto = input;
|
|
12061
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
|
12062
|
-
proto = Object.getPrototypeOf(proto);
|
|
12063
|
-
}
|
|
12064
|
-
return Object.getPrototypeOf(input) === proto;
|
|
12065
|
-
}
|
|
12066
12038
|
function checkKeyLength2(alg, key) {
|
|
12067
12039
|
if (alg.startsWith("RS") || alg.startsWith("PS")) {
|
|
12068
12040
|
const { modulusLength } = key.algorithm;
|
|
@@ -12071,6 +12043,56 @@ function checkKeyLength2(alg, key) {
|
|
|
12071
12043
|
}
|
|
12072
12044
|
}
|
|
12073
12045
|
}
|
|
12046
|
+
function subtleAlgorithm2(alg, algorithm) {
|
|
12047
|
+
const hash = `SHA-${alg.slice(-3)}`;
|
|
12048
|
+
switch (alg) {
|
|
12049
|
+
case "HS256":
|
|
12050
|
+
case "HS384":
|
|
12051
|
+
case "HS512":
|
|
12052
|
+
return { hash, name: "HMAC" };
|
|
12053
|
+
case "PS256":
|
|
12054
|
+
case "PS384":
|
|
12055
|
+
case "PS512":
|
|
12056
|
+
return { hash, name: "RSA-PSS", saltLength: parseInt(alg.slice(-3), 10) >> 3 };
|
|
12057
|
+
case "RS256":
|
|
12058
|
+
case "RS384":
|
|
12059
|
+
case "RS512":
|
|
12060
|
+
return { hash, name: "RSASSA-PKCS1-v1_5" };
|
|
12061
|
+
case "ES256":
|
|
12062
|
+
case "ES384":
|
|
12063
|
+
case "ES512":
|
|
12064
|
+
return { hash, name: "ECDSA", namedCurve: algorithm.namedCurve };
|
|
12065
|
+
case "Ed25519":
|
|
12066
|
+
case "EdDSA":
|
|
12067
|
+
return { name: "Ed25519" };
|
|
12068
|
+
case "ML-DSA-44":
|
|
12069
|
+
case "ML-DSA-65":
|
|
12070
|
+
case "ML-DSA-87":
|
|
12071
|
+
return { name: alg };
|
|
12072
|
+
default:
|
|
12073
|
+
throw new JOSENotSupported2(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
12074
|
+
}
|
|
12075
|
+
}
|
|
12076
|
+
async function getSigKey2(alg, key, usage) {
|
|
12077
|
+
if (key instanceof Uint8Array) {
|
|
12078
|
+
if (!alg.startsWith("HS")) {
|
|
12079
|
+
throw new TypeError(invalidKeyInput2(key, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
12080
|
+
}
|
|
12081
|
+
return crypto.subtle.importKey("raw", key, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage]);
|
|
12082
|
+
}
|
|
12083
|
+
checkSigCryptoKey2(key, alg, usage);
|
|
12084
|
+
return key;
|
|
12085
|
+
}
|
|
12086
|
+
async function verify2(alg, key, signature, data) {
|
|
12087
|
+
const cryptoKey = await getSigKey2(alg, key, "verify");
|
|
12088
|
+
checkKeyLength2(alg, cryptoKey);
|
|
12089
|
+
const algorithm = subtleAlgorithm2(alg, cryptoKey.algorithm);
|
|
12090
|
+
try {
|
|
12091
|
+
return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
|
|
12092
|
+
} catch {
|
|
12093
|
+
return false;
|
|
12094
|
+
}
|
|
12095
|
+
}
|
|
12074
12096
|
function subtleMapping2(jwk) {
|
|
12075
12097
|
let algorithm;
|
|
12076
12098
|
let keyUsages;
|
|
@@ -12084,7 +12106,7 @@ function subtleMapping2(jwk) {
|
|
|
12084
12106
|
keyUsages = jwk.priv ? ["sign"] : ["verify"];
|
|
12085
12107
|
break;
|
|
12086
12108
|
default:
|
|
12087
|
-
throw new JOSENotSupported2(
|
|
12109
|
+
throw new JOSENotSupported2(unsupportedAlg2);
|
|
12088
12110
|
}
|
|
12089
12111
|
break;
|
|
12090
12112
|
}
|
|
@@ -12113,22 +12135,19 @@ function subtleMapping2(jwk) {
|
|
|
12113
12135
|
keyUsages = jwk.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
|
|
12114
12136
|
break;
|
|
12115
12137
|
default:
|
|
12116
|
-
throw new JOSENotSupported2(
|
|
12138
|
+
throw new JOSENotSupported2(unsupportedAlg2);
|
|
12117
12139
|
}
|
|
12118
12140
|
break;
|
|
12119
12141
|
}
|
|
12120
12142
|
case "EC": {
|
|
12121
12143
|
switch (jwk.alg) {
|
|
12122
12144
|
case "ES256":
|
|
12123
|
-
algorithm = { name: "ECDSA", namedCurve: "P-256" };
|
|
12124
|
-
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
12125
|
-
break;
|
|
12126
12145
|
case "ES384":
|
|
12127
|
-
algorithm = { name: "ECDSA", namedCurve: "P-384" };
|
|
12128
|
-
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
12129
|
-
break;
|
|
12130
12146
|
case "ES512":
|
|
12131
|
-
algorithm = {
|
|
12147
|
+
algorithm = {
|
|
12148
|
+
name: "ECDSA",
|
|
12149
|
+
namedCurve: { ES256: "P-256", ES384: "P-384", ES512: "P-521" }[jwk.alg]
|
|
12150
|
+
};
|
|
12132
12151
|
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
12133
12152
|
break;
|
|
12134
12153
|
case "ECDH-ES":
|
|
@@ -12139,7 +12158,7 @@ function subtleMapping2(jwk) {
|
|
|
12139
12158
|
keyUsages = jwk.d ? ["deriveBits"] : [];
|
|
12140
12159
|
break;
|
|
12141
12160
|
default:
|
|
12142
|
-
throw new JOSENotSupported2(
|
|
12161
|
+
throw new JOSENotSupported2(unsupportedAlg2);
|
|
12143
12162
|
}
|
|
12144
12163
|
break;
|
|
12145
12164
|
}
|
|
@@ -12158,7 +12177,7 @@ function subtleMapping2(jwk) {
|
|
|
12158
12177
|
keyUsages = jwk.d ? ["deriveBits"] : [];
|
|
12159
12178
|
break;
|
|
12160
12179
|
default:
|
|
12161
|
-
throw new JOSENotSupported2(
|
|
12180
|
+
throw new JOSENotSupported2(unsupportedAlg2);
|
|
12162
12181
|
}
|
|
12163
12182
|
break;
|
|
12164
12183
|
}
|
|
@@ -12179,6 +12198,37 @@ async function jwkToKey2(jwk) {
|
|
|
12179
12198
|
delete keyData.use;
|
|
12180
12199
|
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);
|
|
12181
12200
|
}
|
|
12201
|
+
async function normalizeKey2(key, alg) {
|
|
12202
|
+
if (key instanceof Uint8Array) {
|
|
12203
|
+
return key;
|
|
12204
|
+
}
|
|
12205
|
+
if (isCryptoKey2(key)) {
|
|
12206
|
+
return key;
|
|
12207
|
+
}
|
|
12208
|
+
if (isKeyObject2(key)) {
|
|
12209
|
+
if (key.type === "secret") {
|
|
12210
|
+
return key.export();
|
|
12211
|
+
}
|
|
12212
|
+
if ("toCryptoKey" in key && typeof key.toCryptoKey === "function") {
|
|
12213
|
+
try {
|
|
12214
|
+
return handleKeyObject2(key, alg);
|
|
12215
|
+
} catch (err) {
|
|
12216
|
+
if (err instanceof TypeError) {
|
|
12217
|
+
throw err;
|
|
12218
|
+
}
|
|
12219
|
+
}
|
|
12220
|
+
}
|
|
12221
|
+
let jwk = key.export({ format: "jwk" });
|
|
12222
|
+
return handleJWK2(key, jwk, alg);
|
|
12223
|
+
}
|
|
12224
|
+
if (isJWK2(key)) {
|
|
12225
|
+
if (key.k) {
|
|
12226
|
+
return decode2(key.k);
|
|
12227
|
+
}
|
|
12228
|
+
return handleJWK2(key, key, alg, true);
|
|
12229
|
+
}
|
|
12230
|
+
throw new Error("unreachable");
|
|
12231
|
+
}
|
|
12182
12232
|
async function importJWK2(jwk, alg, options) {
|
|
12183
12233
|
if (!isObject2(jwk)) {
|
|
12184
12234
|
throw new TypeError("JWK must be an object");
|
|
@@ -12251,37 +12301,6 @@ function validateAlgorithms2(option, algorithms) {
|
|
|
12251
12301
|
}
|
|
12252
12302
|
return new Set(algorithms);
|
|
12253
12303
|
}
|
|
12254
|
-
async function normalizeKey2(key, alg) {
|
|
12255
|
-
if (key instanceof Uint8Array) {
|
|
12256
|
-
return key;
|
|
12257
|
-
}
|
|
12258
|
-
if (isCryptoKey2(key)) {
|
|
12259
|
-
return key;
|
|
12260
|
-
}
|
|
12261
|
-
if (isKeyObject2(key)) {
|
|
12262
|
-
if (key.type === "secret") {
|
|
12263
|
-
return key.export();
|
|
12264
|
-
}
|
|
12265
|
-
if ("toCryptoKey" in key && typeof key.toCryptoKey === "function") {
|
|
12266
|
-
try {
|
|
12267
|
-
return handleKeyObject2(key, alg);
|
|
12268
|
-
} catch (err) {
|
|
12269
|
-
if (err instanceof TypeError) {
|
|
12270
|
-
throw err;
|
|
12271
|
-
}
|
|
12272
|
-
}
|
|
12273
|
-
}
|
|
12274
|
-
let jwk = key.export({ format: "jwk" });
|
|
12275
|
-
return handleJWK2(key, jwk, alg);
|
|
12276
|
-
}
|
|
12277
|
-
if (isJWK2(key)) {
|
|
12278
|
-
if (key.k) {
|
|
12279
|
-
return decode2(key.k);
|
|
12280
|
-
}
|
|
12281
|
-
return handleJWK2(key, key, alg, true);
|
|
12282
|
-
}
|
|
12283
|
-
throw new Error("unreachable");
|
|
12284
|
-
}
|
|
12285
12304
|
function checkKeyType2(alg, key, usage) {
|
|
12286
12305
|
switch (alg.substring(0, 2)) {
|
|
12287
12306
|
case "A1":
|
|
@@ -12295,56 +12314,6 @@ function checkKeyType2(alg, key, usage) {
|
|
|
12295
12314
|
asymmetricTypeCheck2(alg, key, usage);
|
|
12296
12315
|
}
|
|
12297
12316
|
}
|
|
12298
|
-
function subtleAlgorithm2(alg, algorithm) {
|
|
12299
|
-
const hash = `SHA-${alg.slice(-3)}`;
|
|
12300
|
-
switch (alg) {
|
|
12301
|
-
case "HS256":
|
|
12302
|
-
case "HS384":
|
|
12303
|
-
case "HS512":
|
|
12304
|
-
return { hash, name: "HMAC" };
|
|
12305
|
-
case "PS256":
|
|
12306
|
-
case "PS384":
|
|
12307
|
-
case "PS512":
|
|
12308
|
-
return { hash, name: "RSA-PSS", saltLength: parseInt(alg.slice(-3), 10) >> 3 };
|
|
12309
|
-
case "RS256":
|
|
12310
|
-
case "RS384":
|
|
12311
|
-
case "RS512":
|
|
12312
|
-
return { hash, name: "RSASSA-PKCS1-v1_5" };
|
|
12313
|
-
case "ES256":
|
|
12314
|
-
case "ES384":
|
|
12315
|
-
case "ES512":
|
|
12316
|
-
return { hash, name: "ECDSA", namedCurve: algorithm.namedCurve };
|
|
12317
|
-
case "Ed25519":
|
|
12318
|
-
case "EdDSA":
|
|
12319
|
-
return { name: "Ed25519" };
|
|
12320
|
-
case "ML-DSA-44":
|
|
12321
|
-
case "ML-DSA-65":
|
|
12322
|
-
case "ML-DSA-87":
|
|
12323
|
-
return { name: alg };
|
|
12324
|
-
default:
|
|
12325
|
-
throw new JOSENotSupported2(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
12326
|
-
}
|
|
12327
|
-
}
|
|
12328
|
-
async function getSigKey2(alg, key, usage) {
|
|
12329
|
-
if (key instanceof Uint8Array) {
|
|
12330
|
-
if (!alg.startsWith("HS")) {
|
|
12331
|
-
throw new TypeError(invalidKeyInput2(key, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
12332
|
-
}
|
|
12333
|
-
return crypto.subtle.importKey("raw", key, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage]);
|
|
12334
|
-
}
|
|
12335
|
-
checkSigCryptoKey2(key, alg, usage);
|
|
12336
|
-
return key;
|
|
12337
|
-
}
|
|
12338
|
-
async function verify2(alg, key, signature, data) {
|
|
12339
|
-
const cryptoKey = await getSigKey2(alg, key, "verify");
|
|
12340
|
-
checkKeyLength2(alg, cryptoKey);
|
|
12341
|
-
const algorithm = subtleAlgorithm2(alg, cryptoKey.algorithm);
|
|
12342
|
-
try {
|
|
12343
|
-
return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
|
|
12344
|
-
} catch {
|
|
12345
|
-
return false;
|
|
12346
|
-
}
|
|
12347
|
-
}
|
|
12348
12317
|
async function flattenedVerify2(jws, key, options) {
|
|
12349
12318
|
if (!isObject2(jws)) {
|
|
12350
12319
|
throw new JWSInvalid2("Flattened JWS must be an object");
|
|
@@ -12410,12 +12379,7 @@ async function flattenedVerify2(jws, key, options) {
|
|
|
12410
12379
|
}
|
|
12411
12380
|
checkKeyType2(alg, key, "verify");
|
|
12412
12381
|
const data = concat2(jws.protected !== undefined ? encode2(jws.protected) : new Uint8Array, encode2("."), typeof jws.payload === "string" ? b64 ? encode2(jws.payload) : encoder2.encode(jws.payload) : jws.payload);
|
|
12413
|
-
|
|
12414
|
-
try {
|
|
12415
|
-
signature = decode2(jws.signature);
|
|
12416
|
-
} catch {
|
|
12417
|
-
throw new JWSInvalid2("Failed to base64url decode the signature");
|
|
12418
|
-
}
|
|
12382
|
+
const signature = decodeBase64url2(jws.signature, "signature", JWSInvalid2);
|
|
12419
12383
|
const k = await normalizeKey2(key, alg);
|
|
12420
12384
|
const verified = await verify2(alg, k, signature, data);
|
|
12421
12385
|
if (!verified) {
|
|
@@ -12423,11 +12387,7 @@ async function flattenedVerify2(jws, key, options) {
|
|
|
12423
12387
|
}
|
|
12424
12388
|
let payload;
|
|
12425
12389
|
if (b64) {
|
|
12426
|
-
|
|
12427
|
-
payload = decode2(jws.payload);
|
|
12428
|
-
} catch {
|
|
12429
|
-
throw new JWSInvalid2("Failed to base64url decode the payload");
|
|
12430
|
-
}
|
|
12390
|
+
payload = decodeBase64url2(jws.payload, "payload", JWSInvalid2);
|
|
12431
12391
|
} else if (typeof jws.payload === "string") {
|
|
12432
12392
|
payload = encoder2.encode(jws.payload);
|
|
12433
12393
|
} else {
|
|
@@ -18179,7 +18139,7 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18179
18139
|
func.exportReturns = exportReturns2(functionDefinition);
|
|
18180
18140
|
func._handler = handler;
|
|
18181
18141
|
return func;
|
|
18182
|
-
}, init_registration_impl2, paginationOptsValidator2, init_pagination2, init_server2, UdfAnalysisError2, init_udf_analyze2, init_analysis2, moduleAnalysisCache2, moduleLoaderApiPromise2 = null, unsubscribeModuleLoader2 = null, init_function_introspection2, MAX_ENTRIES2 = 1000, defaultSink2, init_execution_log2, encoder2, decoder2, MAX_INT322, init_buffer_utils2, init_base64url2,
|
|
18142
|
+
}, init_registration_impl2, paginationOptsValidator2, init_pagination2, init_server2, UdfAnalysisError2, init_udf_analyze2, init_analysis2, moduleAnalysisCache2, moduleLoaderApiPromise2 = null, unsubscribeModuleLoader2 = null, init_function_introspection2, MAX_ENTRIES2 = 1000, defaultSink2, init_execution_log2, encoder2, decoder2, MAX_INT322, init_buffer_utils2, init_base64url2, unusable2 = (name, prop = "algorithm.name") => new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`), isAlgorithm2 = (algorithm, name) => algorithm.name === name, invalidKeyInput2 = (actual, ...types2) => message2("Key must be ", actual, ...types2), withAlg2 = (alg, actual, ...types2) => message2(`Key for the ${alg} algorithm must be `, actual, ...types2), exports_errors2, JOSEError2, JWTClaimValidationFailed2, JWTExpired2, JOSEAlgNotAllowed2, JOSENotSupported2, JWEDecryptionFailed2, JWEInvalid2, JWSInvalid2, JWTInvalid2, JWKInvalid2, JWKSInvalid2, JWKSNoMatchingKey2, JWKSMultipleMatchingKeys2, JWKSTimeout2, JWSSignatureVerificationFailed2, init_errors22, isCryptoKey2 = (key) => {
|
|
18183
18143
|
if (key?.[Symbol.toStringTag] === "CryptoKey")
|
|
18184
18144
|
return true;
|
|
18185
18145
|
try {
|
|
@@ -18187,7 +18147,7 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18187
18147
|
} catch {
|
|
18188
18148
|
return false;
|
|
18189
18149
|
}
|
|
18190
|
-
}, isKeyObject2 = (key) => key?.[Symbol.toStringTag] === "KeyObject", isKeyLike2 = (key) => isCryptoKey2(key) || isKeyObject2(key), isObjectLike2 = (value) => typeof value === "object" && value !== null,
|
|
18150
|
+
}, isKeyObject2 = (key) => key?.[Symbol.toStringTag] === "KeyObject", isKeyLike2 = (key) => isCryptoKey2(key) || isKeyObject2(key), unprotected2, init_helpers2, isObjectLike2 = (value) => typeof value === "object" && value !== null, isJWK2 = (key) => isObject2(key) && typeof key.kty === "string", isPrivateJWK2 = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string"), isPublicJWK2 = (key) => key.kty !== "oct" && key.d === undefined && key.priv === undefined, isSecretJWK2 = (key) => key.kty === "oct" && typeof key.k === "string", init_signing2, unsupportedAlg2 = 'Invalid or unsupported JWK "alg" (Algorithm) Parameter value', init_jwk_to_key2, unusableForAlg2 = "given KeyObject instance cannot be used for this algorithm", cache2, handleJWK2 = async (key, jwk, alg, freeze = false) => {
|
|
18191
18151
|
cache2 ||= new WeakMap;
|
|
18192
18152
|
let cached = cache2.get(key);
|
|
18193
18153
|
if (cached?.[alg]) {
|
|
@@ -18219,13 +18179,13 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18219
18179
|
case "ECDH-ES+A256KW":
|
|
18220
18180
|
break;
|
|
18221
18181
|
default:
|
|
18222
|
-
throw new TypeError(
|
|
18182
|
+
throw new TypeError(unusableForAlg2);
|
|
18223
18183
|
}
|
|
18224
18184
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, isPublic ? [] : ["deriveBits"]);
|
|
18225
18185
|
}
|
|
18226
18186
|
if (keyObject.asymmetricKeyType === "ed25519") {
|
|
18227
18187
|
if (alg !== "EdDSA" && alg !== "Ed25519") {
|
|
18228
|
-
throw new TypeError(
|
|
18188
|
+
throw new TypeError(unusableForAlg2);
|
|
18229
18189
|
}
|
|
18230
18190
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
|
|
18231
18191
|
isPublic ? "verify" : "sign"
|
|
@@ -18236,7 +18196,7 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18236
18196
|
case "ml-dsa-65":
|
|
18237
18197
|
case "ml-dsa-87": {
|
|
18238
18198
|
if (alg !== keyObject.asymmetricKeyType.toUpperCase()) {
|
|
18239
|
-
throw new TypeError(
|
|
18199
|
+
throw new TypeError(unusableForAlg2);
|
|
18240
18200
|
}
|
|
18241
18201
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
|
|
18242
18202
|
isPublic ? "verify" : "sign"
|
|
@@ -18265,7 +18225,7 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18265
18225
|
hash = "SHA-512";
|
|
18266
18226
|
break;
|
|
18267
18227
|
default:
|
|
18268
|
-
throw new TypeError(
|
|
18228
|
+
throw new TypeError(unusableForAlg2);
|
|
18269
18229
|
}
|
|
18270
18230
|
if (alg.startsWith("RSA-OAEP")) {
|
|
18271
18231
|
return keyObject.toCryptoKey({
|
|
@@ -18286,21 +18246,10 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18286
18246
|
]);
|
|
18287
18247
|
const namedCurve = nist.get(keyObject.asymmetricKeyDetails?.namedCurve);
|
|
18288
18248
|
if (!namedCurve) {
|
|
18289
|
-
throw new TypeError(
|
|
18290
|
-
}
|
|
18291
|
-
if (alg === "ES256" && namedCurve === "P-256") {
|
|
18292
|
-
cryptoKey = keyObject.toCryptoKey({
|
|
18293
|
-
name: "ECDSA",
|
|
18294
|
-
namedCurve
|
|
18295
|
-
}, extractable, [isPublic ? "verify" : "sign"]);
|
|
18296
|
-
}
|
|
18297
|
-
if (alg === "ES384" && namedCurve === "P-384") {
|
|
18298
|
-
cryptoKey = keyObject.toCryptoKey({
|
|
18299
|
-
name: "ECDSA",
|
|
18300
|
-
namedCurve
|
|
18301
|
-
}, extractable, [isPublic ? "verify" : "sign"]);
|
|
18249
|
+
throw new TypeError(unusableForAlg2);
|
|
18302
18250
|
}
|
|
18303
|
-
|
|
18251
|
+
const expectedCurve = { ES256: "P-256", ES384: "P-384", ES512: "P-521" };
|
|
18252
|
+
if (expectedCurve[alg] && namedCurve === expectedCurve[alg]) {
|
|
18304
18253
|
cryptoKey = keyObject.toCryptoKey({
|
|
18305
18254
|
name: "ECDSA",
|
|
18306
18255
|
namedCurve
|
|
@@ -18314,7 +18263,7 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18314
18263
|
}
|
|
18315
18264
|
}
|
|
18316
18265
|
if (!cryptoKey) {
|
|
18317
|
-
throw new TypeError(
|
|
18266
|
+
throw new TypeError(unusableForAlg2);
|
|
18318
18267
|
}
|
|
18319
18268
|
if (!cached) {
|
|
18320
18269
|
cache2.set(keyObject, { [alg]: cryptoKey });
|
|
@@ -18322,7 +18271,7 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18322
18271
|
cached[alg] = cryptoKey;
|
|
18323
18272
|
}
|
|
18324
18273
|
return cryptoKey;
|
|
18325
|
-
}, init_normalize_key2, tag2 = (key) => key?.[Symbol.toStringTag], jwkMatchesOp2 = (alg, key, usage) => {
|
|
18274
|
+
}, init_normalize_key2, init_import2, init_validate_crit2, tag2 = (key) => key?.[Symbol.toStringTag], jwkMatchesOp2 = (alg, key, usage) => {
|
|
18326
18275
|
if (key.use !== undefined) {
|
|
18327
18276
|
let expected;
|
|
18328
18277
|
switch (usage) {
|
|
@@ -18423,7 +18372,7 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18423
18372
|
throw new TypeError(`${tag2(key)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
18424
18373
|
}
|
|
18425
18374
|
}
|
|
18426
|
-
}, init_check_key_type2
|
|
18375
|
+
}, init_check_key_type2 = () => {}, init_verify4, init_verify22, epoch2 = (date) => Math.floor(date.getTime() / 1000), minute2 = 60, hour2, day2, week2, year2, REGEX2, normalizeTyp2 = (value) => {
|
|
18427
18376
|
if (value.includes("/")) {
|
|
18428
18377
|
return value.toLowerCase();
|
|
18429
18378
|
}
|
|
@@ -18436,7 +18385,7 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18436
18385
|
return audOption.some(Set.prototype.has.bind(new Set(audPayload)));
|
|
18437
18386
|
}
|
|
18438
18387
|
return false;
|
|
18439
|
-
}, init_jwt_claims_set2,
|
|
18388
|
+
}, init_jwt_claims_set2, init_verify32, init_local2, USER_AGENT2, customFetch2, jwksCache2, init_remote2, init_webapi2, JWTValidationError2, AdminAuthError2, SystemAuthError2, DEFAULT_CLOCK_TOLERANCE_SECONDS2 = 60, DEFAULT_JWKS_CACHE_TTL_MS2, MAX_JWKS_CACHE_TTL_MS2, JWKS_CACHE2, init_jwt2, AUTH_CONTEXT_SYMBOL2, PRINCIPAL_CONTEXT_SYMBOL2, globalAuthContext2, authContext2, principalContext2, init_auth_context2, MANAGEMENT_CAPABILITIES2, init_auth_resolver2, ALLOWED2, defaultAuthorizationPolicy2, init_authorization_policy2, init_auth_config_service2, init_auth2, COMPONENT_MANIFEST_SYMBOL2, init_manifest2, init_id_codec2, SYSTEM_METADATA_GLOBAL_KEY2 = "concave:system_metadata:v1", TABLE_NUMBER_RESERVATION_GLOBAL_PREFIX2 = "concave:table_number:", SYSTEM_TABLE_DEFINITIONS2, init_system_tables2, init_internal2, exports_system_functions_module2, systemFunctions2, init_system_functions_module2, exports_module_loader2, MODULE_STATE_SYMBOL2, MODULE_LOADER_METADATA_SYMBOL2, MODULE_REGISTRY_CONTEXT2, builtInSystemFunctionsModulePromise2, browserConvexFunctionsAllowed2 = false, init_module_loader2, ValidatorError2, init_validator22, Order2, SEARCH_INDEXES_FTS_SCHEMA2 = `
|
|
18440
18389
|
CREATE VIRTUAL TABLE IF NOT EXISTS search_indexes USING fts5(
|
|
18441
18390
|
index_id UNINDEXED,
|
|
18442
18391
|
document_id UNINDEXED,
|
|
@@ -19499,8 +19448,8 @@ var init_dist = __esm(() => {
|
|
|
19499
19448
|
JOSEError2 = class JOSEError3 extends Error {
|
|
19500
19449
|
static code = "ERR_JOSE_GENERIC";
|
|
19501
19450
|
code = "ERR_JOSE_GENERIC";
|
|
19502
|
-
constructor(
|
|
19503
|
-
super(
|
|
19451
|
+
constructor(message22, options) {
|
|
19452
|
+
super(message22, options);
|
|
19504
19453
|
this.name = this.constructor.name;
|
|
19505
19454
|
Error.captureStackTrace?.(this, this.constructor);
|
|
19506
19455
|
}
|
|
@@ -19511,8 +19460,8 @@ var init_dist = __esm(() => {
|
|
|
19511
19460
|
claim;
|
|
19512
19461
|
reason;
|
|
19513
19462
|
payload;
|
|
19514
|
-
constructor(
|
|
19515
|
-
super(
|
|
19463
|
+
constructor(message22, payload, claim = "unspecified", reason = "unspecified") {
|
|
19464
|
+
super(message22, { cause: { claim, reason, payload } });
|
|
19516
19465
|
this.claim = claim;
|
|
19517
19466
|
this.reason = reason;
|
|
19518
19467
|
this.payload = payload;
|
|
@@ -19524,8 +19473,8 @@ var init_dist = __esm(() => {
|
|
|
19524
19473
|
claim;
|
|
19525
19474
|
reason;
|
|
19526
19475
|
payload;
|
|
19527
|
-
constructor(
|
|
19528
|
-
super(
|
|
19476
|
+
constructor(message22, payload, claim = "unspecified", reason = "unspecified") {
|
|
19477
|
+
super(message22, { cause: { claim, reason, payload } });
|
|
19529
19478
|
this.claim = claim;
|
|
19530
19479
|
this.reason = reason;
|
|
19531
19480
|
this.payload = payload;
|
|
@@ -19542,8 +19491,8 @@ var init_dist = __esm(() => {
|
|
|
19542
19491
|
JWEDecryptionFailed2 = class JWEDecryptionFailed3 extends JOSEError2 {
|
|
19543
19492
|
static code = "ERR_JWE_DECRYPTION_FAILED";
|
|
19544
19493
|
code = "ERR_JWE_DECRYPTION_FAILED";
|
|
19545
|
-
constructor(
|
|
19546
|
-
super(
|
|
19494
|
+
constructor(message22 = "decryption operation failed", options) {
|
|
19495
|
+
super(message22, options);
|
|
19547
19496
|
}
|
|
19548
19497
|
};
|
|
19549
19498
|
JWEInvalid2 = class JWEInvalid3 extends JOSEError2 {
|
|
@@ -19569,70 +19518,67 @@ var init_dist = __esm(() => {
|
|
|
19569
19518
|
JWKSNoMatchingKey2 = class JWKSNoMatchingKey3 extends JOSEError2 {
|
|
19570
19519
|
static code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
19571
19520
|
code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
19572
|
-
constructor(
|
|
19573
|
-
super(
|
|
19521
|
+
constructor(message22 = "no applicable key found in the JSON Web Key Set", options) {
|
|
19522
|
+
super(message22, options);
|
|
19574
19523
|
}
|
|
19575
19524
|
};
|
|
19576
19525
|
JWKSMultipleMatchingKeys2 = class JWKSMultipleMatchingKeys3 extends JOSEError2 {
|
|
19577
19526
|
[Symbol.asyncIterator];
|
|
19578
19527
|
static code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
19579
19528
|
code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
19580
|
-
constructor(
|
|
19581
|
-
super(
|
|
19529
|
+
constructor(message22 = "multiple matching keys found in the JSON Web Key Set", options) {
|
|
19530
|
+
super(message22, options);
|
|
19582
19531
|
}
|
|
19583
19532
|
};
|
|
19584
19533
|
JWKSTimeout2 = class JWKSTimeout3 extends JOSEError2 {
|
|
19585
19534
|
static code = "ERR_JWKS_TIMEOUT";
|
|
19586
19535
|
code = "ERR_JWKS_TIMEOUT";
|
|
19587
|
-
constructor(
|
|
19588
|
-
super(
|
|
19536
|
+
constructor(message22 = "request timed out", options) {
|
|
19537
|
+
super(message22, options);
|
|
19589
19538
|
}
|
|
19590
19539
|
};
|
|
19591
19540
|
JWSSignatureVerificationFailed2 = class JWSSignatureVerificationFailed3 extends JOSEError2 {
|
|
19592
19541
|
static code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
19593
19542
|
code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
19594
|
-
constructor(
|
|
19595
|
-
super(
|
|
19543
|
+
constructor(message22 = "signature verification failed", options) {
|
|
19544
|
+
super(message22, options);
|
|
19596
19545
|
}
|
|
19597
19546
|
};
|
|
19598
19547
|
});
|
|
19599
|
-
|
|
19600
|
-
init_errors22();
|
|
19601
|
-
});
|
|
19602
|
-
init_import2 = __esm2(() => {
|
|
19548
|
+
init_helpers2 = __esm2(() => {
|
|
19603
19549
|
init_base64url2();
|
|
19604
|
-
|
|
19550
|
+
unprotected2 = Symbol();
|
|
19551
|
+
});
|
|
19552
|
+
init_signing2 = __esm2(() => {
|
|
19605
19553
|
init_errors22();
|
|
19606
19554
|
});
|
|
19607
|
-
|
|
19555
|
+
init_jwk_to_key2 = __esm2(() => {
|
|
19608
19556
|
init_errors22();
|
|
19609
19557
|
});
|
|
19610
19558
|
init_normalize_key2 = __esm2(() => {
|
|
19611
|
-
init_is_jwk2();
|
|
19612
19559
|
init_base64url2();
|
|
19613
19560
|
init_jwk_to_key2();
|
|
19614
19561
|
});
|
|
19615
|
-
|
|
19616
|
-
|
|
19617
|
-
|
|
19618
|
-
init_subtle_dsa2 = __esm2(() => {
|
|
19562
|
+
init_import2 = __esm2(() => {
|
|
19563
|
+
init_base64url2();
|
|
19564
|
+
init_jwk_to_key2();
|
|
19619
19565
|
init_errors22();
|
|
19620
19566
|
});
|
|
19621
|
-
|
|
19622
|
-
|
|
19623
|
-
init_get_sign_verify_key2();
|
|
19567
|
+
init_validate_crit2 = __esm2(() => {
|
|
19568
|
+
init_errors22();
|
|
19624
19569
|
});
|
|
19625
|
-
|
|
19570
|
+
init_verify4 = __esm2(() => {
|
|
19626
19571
|
init_base64url2();
|
|
19627
|
-
|
|
19572
|
+
init_signing2();
|
|
19628
19573
|
init_errors22();
|
|
19629
19574
|
init_buffer_utils2();
|
|
19575
|
+
init_helpers2();
|
|
19630
19576
|
init_check_key_type2();
|
|
19631
19577
|
init_validate_crit2();
|
|
19632
19578
|
init_normalize_key2();
|
|
19633
19579
|
});
|
|
19634
|
-
|
|
19635
|
-
|
|
19580
|
+
init_verify22 = __esm2(() => {
|
|
19581
|
+
init_verify4();
|
|
19636
19582
|
init_errors22();
|
|
19637
19583
|
init_buffer_utils2();
|
|
19638
19584
|
});
|
|
@@ -19645,8 +19591,8 @@ var init_dist = __esm(() => {
|
|
|
19645
19591
|
year2 = day2 * 365.25;
|
|
19646
19592
|
REGEX2 = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;
|
|
19647
19593
|
});
|
|
19648
|
-
|
|
19649
|
-
|
|
19594
|
+
init_verify32 = __esm2(() => {
|
|
19595
|
+
init_verify22();
|
|
19650
19596
|
init_jwt_claims_set2();
|
|
19651
19597
|
init_errors22();
|
|
19652
19598
|
});
|
|
@@ -19659,14 +19605,14 @@ var init_dist = __esm(() => {
|
|
|
19659
19605
|
init_local2();
|
|
19660
19606
|
if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
|
|
19661
19607
|
const NAME = "jose";
|
|
19662
|
-
const VERSION = "v6.1
|
|
19608
|
+
const VERSION = "v6.2.1";
|
|
19663
19609
|
USER_AGENT2 = `${NAME}/${VERSION}`;
|
|
19664
19610
|
}
|
|
19665
19611
|
customFetch2 = Symbol();
|
|
19666
19612
|
jwksCache2 = Symbol();
|
|
19667
19613
|
});
|
|
19668
19614
|
init_webapi2 = __esm2(() => {
|
|
19669
|
-
|
|
19615
|
+
init_verify32();
|
|
19670
19616
|
init_local2();
|
|
19671
19617
|
init_remote2();
|
|
19672
19618
|
init_errors22();
|
|
@@ -27206,6 +27152,27 @@ function notFoundHttpResponse() {
|
|
|
27206
27152
|
}
|
|
27207
27153
|
});
|
|
27208
27154
|
}
|
|
27155
|
+
function isMissingModuleError(error, moduleName) {
|
|
27156
|
+
if (!error) {
|
|
27157
|
+
return false;
|
|
27158
|
+
}
|
|
27159
|
+
const errorString = String(error);
|
|
27160
|
+
const moduleSpecifiers = [moduleName, `convex/${moduleName}`];
|
|
27161
|
+
const hasDirectMissingMessage = moduleSpecifiers.some((specifier) => errorString.includes(`Module not found: ${specifier}`));
|
|
27162
|
+
if (hasDirectMissingMessage || errorString.toLowerCase().includes("failed to load convex module")) {
|
|
27163
|
+
return true;
|
|
27164
|
+
}
|
|
27165
|
+
const hasResolutionMessage = moduleSpecifiers.some((specifier) => errorString.includes(`Unable to resolve module "${specifier}"`));
|
|
27166
|
+
const causes = error.causes;
|
|
27167
|
+
if (Array.isArray(causes) && causes.length > 0) {
|
|
27168
|
+
return hasResolutionMessage ? causes.every((cause2) => isMissingModuleError(cause2, moduleName)) : causes.some((cause2) => isMissingModuleError(cause2, moduleName));
|
|
27169
|
+
}
|
|
27170
|
+
const cause = error.cause;
|
|
27171
|
+
if (cause) {
|
|
27172
|
+
return isMissingModuleError(cause, moduleName);
|
|
27173
|
+
}
|
|
27174
|
+
return hasResolutionMessage;
|
|
27175
|
+
}
|
|
27209
27176
|
function getHttpRouteRank(routePath) {
|
|
27210
27177
|
if (routePath.endsWith("*")) {
|
|
27211
27178
|
return { kind: 0, length: routePath.length - 1 };
|
|
@@ -27377,8 +27344,7 @@ class InlineUdfExecutor {
|
|
|
27377
27344
|
try {
|
|
27378
27345
|
return await loadConvexModule(moduleName, { componentPath });
|
|
27379
27346
|
} catch (error) {
|
|
27380
|
-
|
|
27381
|
-
if (message2 && (message2.includes("module not found") || message2.includes("failed to load convex module"))) {
|
|
27347
|
+
if (isMissingModuleError(error, moduleName)) {
|
|
27382
27348
|
throw new Error(`UDF module not found: ${moduleName}`);
|
|
27383
27349
|
}
|
|
27384
27350
|
throw error;
|