@concavejs/runtime-node 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/factory.js +511 -545
- package/dist/index.js +511 -545
- package/dist/server/index.js +511 -545
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -2860,6 +2860,113 @@ var init_base64url = __esm(() => {
|
|
|
2860
2860
|
init_buffer_utils();
|
|
2861
2861
|
});
|
|
2862
2862
|
|
|
2863
|
+
// ../../node_modules/jose/dist/webapi/lib/crypto_key.js
|
|
2864
|
+
function getHashLength(hash) {
|
|
2865
|
+
return parseInt(hash.name.slice(4), 10);
|
|
2866
|
+
}
|
|
2867
|
+
function checkHashLength(algorithm, expected) {
|
|
2868
|
+
const actual = getHashLength(algorithm.hash);
|
|
2869
|
+
if (actual !== expected)
|
|
2870
|
+
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
2871
|
+
}
|
|
2872
|
+
function getNamedCurve(alg) {
|
|
2873
|
+
switch (alg) {
|
|
2874
|
+
case "ES256":
|
|
2875
|
+
return "P-256";
|
|
2876
|
+
case "ES384":
|
|
2877
|
+
return "P-384";
|
|
2878
|
+
case "ES512":
|
|
2879
|
+
return "P-521";
|
|
2880
|
+
default:
|
|
2881
|
+
throw new Error("unreachable");
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
function checkUsage(key, usage) {
|
|
2885
|
+
if (usage && !key.usages.includes(usage)) {
|
|
2886
|
+
throw new TypeError(`CryptoKey does not support this operation, its usages must include ${usage}.`);
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
function checkSigCryptoKey(key, alg, usage) {
|
|
2890
|
+
switch (alg) {
|
|
2891
|
+
case "HS256":
|
|
2892
|
+
case "HS384":
|
|
2893
|
+
case "HS512": {
|
|
2894
|
+
if (!isAlgorithm(key.algorithm, "HMAC"))
|
|
2895
|
+
throw unusable("HMAC");
|
|
2896
|
+
checkHashLength(key.algorithm, parseInt(alg.slice(2), 10));
|
|
2897
|
+
break;
|
|
2898
|
+
}
|
|
2899
|
+
case "RS256":
|
|
2900
|
+
case "RS384":
|
|
2901
|
+
case "RS512": {
|
|
2902
|
+
if (!isAlgorithm(key.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
2903
|
+
throw unusable("RSASSA-PKCS1-v1_5");
|
|
2904
|
+
checkHashLength(key.algorithm, parseInt(alg.slice(2), 10));
|
|
2905
|
+
break;
|
|
2906
|
+
}
|
|
2907
|
+
case "PS256":
|
|
2908
|
+
case "PS384":
|
|
2909
|
+
case "PS512": {
|
|
2910
|
+
if (!isAlgorithm(key.algorithm, "RSA-PSS"))
|
|
2911
|
+
throw unusable("RSA-PSS");
|
|
2912
|
+
checkHashLength(key.algorithm, parseInt(alg.slice(2), 10));
|
|
2913
|
+
break;
|
|
2914
|
+
}
|
|
2915
|
+
case "Ed25519":
|
|
2916
|
+
case "EdDSA": {
|
|
2917
|
+
if (!isAlgorithm(key.algorithm, "Ed25519"))
|
|
2918
|
+
throw unusable("Ed25519");
|
|
2919
|
+
break;
|
|
2920
|
+
}
|
|
2921
|
+
case "ML-DSA-44":
|
|
2922
|
+
case "ML-DSA-65":
|
|
2923
|
+
case "ML-DSA-87": {
|
|
2924
|
+
if (!isAlgorithm(key.algorithm, alg))
|
|
2925
|
+
throw unusable(alg);
|
|
2926
|
+
break;
|
|
2927
|
+
}
|
|
2928
|
+
case "ES256":
|
|
2929
|
+
case "ES384":
|
|
2930
|
+
case "ES512": {
|
|
2931
|
+
if (!isAlgorithm(key.algorithm, "ECDSA"))
|
|
2932
|
+
throw unusable("ECDSA");
|
|
2933
|
+
const expected = getNamedCurve(alg);
|
|
2934
|
+
const actual = key.algorithm.namedCurve;
|
|
2935
|
+
if (actual !== expected)
|
|
2936
|
+
throw unusable(expected, "algorithm.namedCurve");
|
|
2937
|
+
break;
|
|
2938
|
+
}
|
|
2939
|
+
default:
|
|
2940
|
+
throw new TypeError("CryptoKey does not support this operation");
|
|
2941
|
+
}
|
|
2942
|
+
checkUsage(key, usage);
|
|
2943
|
+
}
|
|
2944
|
+
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;
|
|
2945
|
+
|
|
2946
|
+
// ../../node_modules/jose/dist/webapi/lib/invalid_key_input.js
|
|
2947
|
+
function message(msg, actual, ...types) {
|
|
2948
|
+
types = types.filter(Boolean);
|
|
2949
|
+
if (types.length > 2) {
|
|
2950
|
+
const last = types.pop();
|
|
2951
|
+
msg += `one of type ${types.join(", ")}, or ${last}.`;
|
|
2952
|
+
} else if (types.length === 2) {
|
|
2953
|
+
msg += `one of type ${types[0]} or ${types[1]}.`;
|
|
2954
|
+
} else {
|
|
2955
|
+
msg += `of type ${types[0]}.`;
|
|
2956
|
+
}
|
|
2957
|
+
if (actual == null) {
|
|
2958
|
+
msg += ` Received ${actual}`;
|
|
2959
|
+
} else if (typeof actual === "function" && actual.name) {
|
|
2960
|
+
msg += ` Received function ${actual.name}`;
|
|
2961
|
+
} else if (typeof actual === "object" && actual != null) {
|
|
2962
|
+
if (actual.constructor?.name) {
|
|
2963
|
+
msg += ` Received an instance of ${actual.constructor.name}`;
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
return msg;
|
|
2967
|
+
}
|
|
2968
|
+
var invalidKeyInput = (actual, ...types) => message("Key must be ", actual, ...types), withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);
|
|
2969
|
+
|
|
2863
2970
|
// ../../node_modules/jose/dist/webapi/util/errors.js
|
|
2864
2971
|
var exports_errors = {};
|
|
2865
2972
|
__export(exports_errors, {
|
|
@@ -2884,8 +2991,8 @@ var init_errors2 = __esm(() => {
|
|
|
2884
2991
|
JOSEError = class JOSEError extends Error {
|
|
2885
2992
|
static code = "ERR_JOSE_GENERIC";
|
|
2886
2993
|
code = "ERR_JOSE_GENERIC";
|
|
2887
|
-
constructor(
|
|
2888
|
-
super(
|
|
2994
|
+
constructor(message2, options) {
|
|
2995
|
+
super(message2, options);
|
|
2889
2996
|
this.name = this.constructor.name;
|
|
2890
2997
|
Error.captureStackTrace?.(this, this.constructor);
|
|
2891
2998
|
}
|
|
@@ -2896,8 +3003,8 @@ var init_errors2 = __esm(() => {
|
|
|
2896
3003
|
claim;
|
|
2897
3004
|
reason;
|
|
2898
3005
|
payload;
|
|
2899
|
-
constructor(
|
|
2900
|
-
super(
|
|
3006
|
+
constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
|
|
3007
|
+
super(message2, { cause: { claim, reason, payload } });
|
|
2901
3008
|
this.claim = claim;
|
|
2902
3009
|
this.reason = reason;
|
|
2903
3010
|
this.payload = payload;
|
|
@@ -2909,8 +3016,8 @@ var init_errors2 = __esm(() => {
|
|
|
2909
3016
|
claim;
|
|
2910
3017
|
reason;
|
|
2911
3018
|
payload;
|
|
2912
|
-
constructor(
|
|
2913
|
-
super(
|
|
3019
|
+
constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
|
|
3020
|
+
super(message2, { cause: { claim, reason, payload } });
|
|
2914
3021
|
this.claim = claim;
|
|
2915
3022
|
this.reason = reason;
|
|
2916
3023
|
this.payload = payload;
|
|
@@ -2927,8 +3034,8 @@ var init_errors2 = __esm(() => {
|
|
|
2927
3034
|
JWEDecryptionFailed = class JWEDecryptionFailed extends JOSEError {
|
|
2928
3035
|
static code = "ERR_JWE_DECRYPTION_FAILED";
|
|
2929
3036
|
code = "ERR_JWE_DECRYPTION_FAILED";
|
|
2930
|
-
constructor(
|
|
2931
|
-
super(
|
|
3037
|
+
constructor(message2 = "decryption operation failed", options) {
|
|
3038
|
+
super(message2, options);
|
|
2932
3039
|
}
|
|
2933
3040
|
};
|
|
2934
3041
|
JWEInvalid = class JWEInvalid extends JOSEError {
|
|
@@ -2954,145 +3061,34 @@ var init_errors2 = __esm(() => {
|
|
|
2954
3061
|
JWKSNoMatchingKey = class JWKSNoMatchingKey extends JOSEError {
|
|
2955
3062
|
static code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
2956
3063
|
code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
2957
|
-
constructor(
|
|
2958
|
-
super(
|
|
3064
|
+
constructor(message2 = "no applicable key found in the JSON Web Key Set", options) {
|
|
3065
|
+
super(message2, options);
|
|
2959
3066
|
}
|
|
2960
3067
|
};
|
|
2961
3068
|
JWKSMultipleMatchingKeys = class JWKSMultipleMatchingKeys extends JOSEError {
|
|
2962
3069
|
[Symbol.asyncIterator];
|
|
2963
3070
|
static code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
2964
3071
|
code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
2965
|
-
constructor(
|
|
2966
|
-
super(
|
|
3072
|
+
constructor(message2 = "multiple matching keys found in the JSON Web Key Set", options) {
|
|
3073
|
+
super(message2, options);
|
|
2967
3074
|
}
|
|
2968
3075
|
};
|
|
2969
3076
|
JWKSTimeout = class JWKSTimeout extends JOSEError {
|
|
2970
3077
|
static code = "ERR_JWKS_TIMEOUT";
|
|
2971
3078
|
code = "ERR_JWKS_TIMEOUT";
|
|
2972
|
-
constructor(
|
|
2973
|
-
super(
|
|
3079
|
+
constructor(message2 = "request timed out", options) {
|
|
3080
|
+
super(message2, options);
|
|
2974
3081
|
}
|
|
2975
3082
|
};
|
|
2976
3083
|
JWSSignatureVerificationFailed = class JWSSignatureVerificationFailed extends JOSEError {
|
|
2977
3084
|
static code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
2978
3085
|
code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
2979
|
-
constructor(
|
|
2980
|
-
super(
|
|
3086
|
+
constructor(message2 = "signature verification failed", options) {
|
|
3087
|
+
super(message2, options);
|
|
2981
3088
|
}
|
|
2982
3089
|
};
|
|
2983
3090
|
});
|
|
2984
3091
|
|
|
2985
|
-
// ../../node_modules/jose/dist/webapi/lib/crypto_key.js
|
|
2986
|
-
function getHashLength(hash) {
|
|
2987
|
-
return parseInt(hash.name.slice(4), 10);
|
|
2988
|
-
}
|
|
2989
|
-
function getNamedCurve(alg) {
|
|
2990
|
-
switch (alg) {
|
|
2991
|
-
case "ES256":
|
|
2992
|
-
return "P-256";
|
|
2993
|
-
case "ES384":
|
|
2994
|
-
return "P-384";
|
|
2995
|
-
case "ES512":
|
|
2996
|
-
return "P-521";
|
|
2997
|
-
default:
|
|
2998
|
-
throw new Error("unreachable");
|
|
2999
|
-
}
|
|
3000
|
-
}
|
|
3001
|
-
function checkUsage(key, usage) {
|
|
3002
|
-
if (usage && !key.usages.includes(usage)) {
|
|
3003
|
-
throw new TypeError(`CryptoKey does not support this operation, its usages must include ${usage}.`);
|
|
3004
|
-
}
|
|
3005
|
-
}
|
|
3006
|
-
function checkSigCryptoKey(key, alg, usage) {
|
|
3007
|
-
switch (alg) {
|
|
3008
|
-
case "HS256":
|
|
3009
|
-
case "HS384":
|
|
3010
|
-
case "HS512": {
|
|
3011
|
-
if (!isAlgorithm(key.algorithm, "HMAC"))
|
|
3012
|
-
throw unusable("HMAC");
|
|
3013
|
-
const expected = parseInt(alg.slice(2), 10);
|
|
3014
|
-
const actual = getHashLength(key.algorithm.hash);
|
|
3015
|
-
if (actual !== expected)
|
|
3016
|
-
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
3017
|
-
break;
|
|
3018
|
-
}
|
|
3019
|
-
case "RS256":
|
|
3020
|
-
case "RS384":
|
|
3021
|
-
case "RS512": {
|
|
3022
|
-
if (!isAlgorithm(key.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
3023
|
-
throw unusable("RSASSA-PKCS1-v1_5");
|
|
3024
|
-
const expected = parseInt(alg.slice(2), 10);
|
|
3025
|
-
const actual = getHashLength(key.algorithm.hash);
|
|
3026
|
-
if (actual !== expected)
|
|
3027
|
-
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
3028
|
-
break;
|
|
3029
|
-
}
|
|
3030
|
-
case "PS256":
|
|
3031
|
-
case "PS384":
|
|
3032
|
-
case "PS512": {
|
|
3033
|
-
if (!isAlgorithm(key.algorithm, "RSA-PSS"))
|
|
3034
|
-
throw unusable("RSA-PSS");
|
|
3035
|
-
const expected = parseInt(alg.slice(2), 10);
|
|
3036
|
-
const actual = getHashLength(key.algorithm.hash);
|
|
3037
|
-
if (actual !== expected)
|
|
3038
|
-
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
3039
|
-
break;
|
|
3040
|
-
}
|
|
3041
|
-
case "Ed25519":
|
|
3042
|
-
case "EdDSA": {
|
|
3043
|
-
if (!isAlgorithm(key.algorithm, "Ed25519"))
|
|
3044
|
-
throw unusable("Ed25519");
|
|
3045
|
-
break;
|
|
3046
|
-
}
|
|
3047
|
-
case "ML-DSA-44":
|
|
3048
|
-
case "ML-DSA-65":
|
|
3049
|
-
case "ML-DSA-87": {
|
|
3050
|
-
if (!isAlgorithm(key.algorithm, alg))
|
|
3051
|
-
throw unusable(alg);
|
|
3052
|
-
break;
|
|
3053
|
-
}
|
|
3054
|
-
case "ES256":
|
|
3055
|
-
case "ES384":
|
|
3056
|
-
case "ES512": {
|
|
3057
|
-
if (!isAlgorithm(key.algorithm, "ECDSA"))
|
|
3058
|
-
throw unusable("ECDSA");
|
|
3059
|
-
const expected = getNamedCurve(alg);
|
|
3060
|
-
const actual = key.algorithm.namedCurve;
|
|
3061
|
-
if (actual !== expected)
|
|
3062
|
-
throw unusable(expected, "algorithm.namedCurve");
|
|
3063
|
-
break;
|
|
3064
|
-
}
|
|
3065
|
-
default:
|
|
3066
|
-
throw new TypeError("CryptoKey does not support this operation");
|
|
3067
|
-
}
|
|
3068
|
-
checkUsage(key, usage);
|
|
3069
|
-
}
|
|
3070
|
-
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;
|
|
3071
|
-
|
|
3072
|
-
// ../../node_modules/jose/dist/webapi/lib/invalid_key_input.js
|
|
3073
|
-
function message(msg, actual, ...types) {
|
|
3074
|
-
types = types.filter(Boolean);
|
|
3075
|
-
if (types.length > 2) {
|
|
3076
|
-
const last = types.pop();
|
|
3077
|
-
msg += `one of type ${types.join(", ")}, or ${last}.`;
|
|
3078
|
-
} else if (types.length === 2) {
|
|
3079
|
-
msg += `one of type ${types[0]} or ${types[1]}.`;
|
|
3080
|
-
} else {
|
|
3081
|
-
msg += `of type ${types[0]}.`;
|
|
3082
|
-
}
|
|
3083
|
-
if (actual == null) {
|
|
3084
|
-
msg += ` Received ${actual}`;
|
|
3085
|
-
} else if (typeof actual === "function" && actual.name) {
|
|
3086
|
-
msg += ` Received function ${actual.name}`;
|
|
3087
|
-
} else if (typeof actual === "object" && actual != null) {
|
|
3088
|
-
if (actual.constructor?.name) {
|
|
3089
|
-
msg += ` Received an instance of ${actual.constructor.name}`;
|
|
3090
|
-
}
|
|
3091
|
-
}
|
|
3092
|
-
return msg;
|
|
3093
|
-
}
|
|
3094
|
-
var invalidKeyInput = (actual, ...types) => message("Key must be ", actual, ...types), withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);
|
|
3095
|
-
|
|
3096
3092
|
// ../../node_modules/jose/dist/webapi/lib/is_key_like.js
|
|
3097
3093
|
var isCryptoKey = (key) => {
|
|
3098
3094
|
if (key?.[Symbol.toStringTag] === "CryptoKey")
|
|
@@ -3104,7 +3100,34 @@ var isCryptoKey = (key) => {
|
|
|
3104
3100
|
}
|
|
3105
3101
|
}, isKeyObject = (key) => key?.[Symbol.toStringTag] === "KeyObject", isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);
|
|
3106
3102
|
|
|
3107
|
-
// ../../node_modules/jose/dist/webapi/lib/
|
|
3103
|
+
// ../../node_modules/jose/dist/webapi/lib/helpers.js
|
|
3104
|
+
function decodeBase64url(value, label, ErrorClass) {
|
|
3105
|
+
try {
|
|
3106
|
+
return decode(value);
|
|
3107
|
+
} catch {
|
|
3108
|
+
throw new ErrorClass(`Failed to base64url decode the ${label}`);
|
|
3109
|
+
}
|
|
3110
|
+
}
|
|
3111
|
+
var unprotected;
|
|
3112
|
+
var init_helpers = __esm(() => {
|
|
3113
|
+
init_base64url();
|
|
3114
|
+
unprotected = Symbol();
|
|
3115
|
+
});
|
|
3116
|
+
|
|
3117
|
+
// ../../node_modules/jose/dist/webapi/lib/type_checks.js
|
|
3118
|
+
function isObject(input) {
|
|
3119
|
+
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
3120
|
+
return false;
|
|
3121
|
+
}
|
|
3122
|
+
if (Object.getPrototypeOf(input) === null) {
|
|
3123
|
+
return true;
|
|
3124
|
+
}
|
|
3125
|
+
let proto = input;
|
|
3126
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
3127
|
+
proto = Object.getPrototypeOf(proto);
|
|
3128
|
+
}
|
|
3129
|
+
return Object.getPrototypeOf(input) === proto;
|
|
3130
|
+
}
|
|
3108
3131
|
function isDisjoint(...headers) {
|
|
3109
3132
|
const sources = headers.filter(Boolean);
|
|
3110
3133
|
if (sources.length === 0 || sources.length === 1) {
|
|
@@ -3126,24 +3149,9 @@ function isDisjoint(...headers) {
|
|
|
3126
3149
|
}
|
|
3127
3150
|
return true;
|
|
3128
3151
|
}
|
|
3152
|
+
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";
|
|
3129
3153
|
|
|
3130
|
-
// ../../node_modules/jose/dist/webapi/lib/
|
|
3131
|
-
function isObject(input) {
|
|
3132
|
-
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
3133
|
-
return false;
|
|
3134
|
-
}
|
|
3135
|
-
if (Object.getPrototypeOf(input) === null) {
|
|
3136
|
-
return true;
|
|
3137
|
-
}
|
|
3138
|
-
let proto = input;
|
|
3139
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
|
3140
|
-
proto = Object.getPrototypeOf(proto);
|
|
3141
|
-
}
|
|
3142
|
-
return Object.getPrototypeOf(input) === proto;
|
|
3143
|
-
}
|
|
3144
|
-
var isObjectLike = (value) => typeof value === "object" && value !== null;
|
|
3145
|
-
|
|
3146
|
-
// ../../node_modules/jose/dist/webapi/lib/check_key_length.js
|
|
3154
|
+
// ../../node_modules/jose/dist/webapi/lib/signing.js
|
|
3147
3155
|
function checkKeyLength(alg, key) {
|
|
3148
3156
|
if (alg.startsWith("RS") || alg.startsWith("PS")) {
|
|
3149
3157
|
const { modulusLength } = key.algorithm;
|
|
@@ -3152,6 +3160,59 @@ function checkKeyLength(alg, key) {
|
|
|
3152
3160
|
}
|
|
3153
3161
|
}
|
|
3154
3162
|
}
|
|
3163
|
+
function subtleAlgorithm(alg, algorithm) {
|
|
3164
|
+
const hash = `SHA-${alg.slice(-3)}`;
|
|
3165
|
+
switch (alg) {
|
|
3166
|
+
case "HS256":
|
|
3167
|
+
case "HS384":
|
|
3168
|
+
case "HS512":
|
|
3169
|
+
return { hash, name: "HMAC" };
|
|
3170
|
+
case "PS256":
|
|
3171
|
+
case "PS384":
|
|
3172
|
+
case "PS512":
|
|
3173
|
+
return { hash, name: "RSA-PSS", saltLength: parseInt(alg.slice(-3), 10) >> 3 };
|
|
3174
|
+
case "RS256":
|
|
3175
|
+
case "RS384":
|
|
3176
|
+
case "RS512":
|
|
3177
|
+
return { hash, name: "RSASSA-PKCS1-v1_5" };
|
|
3178
|
+
case "ES256":
|
|
3179
|
+
case "ES384":
|
|
3180
|
+
case "ES512":
|
|
3181
|
+
return { hash, name: "ECDSA", namedCurve: algorithm.namedCurve };
|
|
3182
|
+
case "Ed25519":
|
|
3183
|
+
case "EdDSA":
|
|
3184
|
+
return { name: "Ed25519" };
|
|
3185
|
+
case "ML-DSA-44":
|
|
3186
|
+
case "ML-DSA-65":
|
|
3187
|
+
case "ML-DSA-87":
|
|
3188
|
+
return { name: alg };
|
|
3189
|
+
default:
|
|
3190
|
+
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
async function getSigKey(alg, key, usage) {
|
|
3194
|
+
if (key instanceof Uint8Array) {
|
|
3195
|
+
if (!alg.startsWith("HS")) {
|
|
3196
|
+
throw new TypeError(invalidKeyInput(key, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
3197
|
+
}
|
|
3198
|
+
return crypto.subtle.importKey("raw", key, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage]);
|
|
3199
|
+
}
|
|
3200
|
+
checkSigCryptoKey(key, alg, usage);
|
|
3201
|
+
return key;
|
|
3202
|
+
}
|
|
3203
|
+
async function verify(alg, key, signature, data) {
|
|
3204
|
+
const cryptoKey = await getSigKey(alg, key, "verify");
|
|
3205
|
+
checkKeyLength(alg, cryptoKey);
|
|
3206
|
+
const algorithm = subtleAlgorithm(alg, cryptoKey.algorithm);
|
|
3207
|
+
try {
|
|
3208
|
+
return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
|
|
3209
|
+
} catch {
|
|
3210
|
+
return false;
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
var init_signing = __esm(() => {
|
|
3214
|
+
init_errors2();
|
|
3215
|
+
});
|
|
3155
3216
|
|
|
3156
3217
|
// ../../node_modules/jose/dist/webapi/lib/jwk_to_key.js
|
|
3157
3218
|
function subtleMapping(jwk) {
|
|
@@ -3167,7 +3228,7 @@ function subtleMapping(jwk) {
|
|
|
3167
3228
|
keyUsages = jwk.priv ? ["sign"] : ["verify"];
|
|
3168
3229
|
break;
|
|
3169
3230
|
default:
|
|
3170
|
-
throw new JOSENotSupported(
|
|
3231
|
+
throw new JOSENotSupported(unsupportedAlg);
|
|
3171
3232
|
}
|
|
3172
3233
|
break;
|
|
3173
3234
|
}
|
|
@@ -3196,22 +3257,19 @@ function subtleMapping(jwk) {
|
|
|
3196
3257
|
keyUsages = jwk.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
|
|
3197
3258
|
break;
|
|
3198
3259
|
default:
|
|
3199
|
-
throw new JOSENotSupported(
|
|
3260
|
+
throw new JOSENotSupported(unsupportedAlg);
|
|
3200
3261
|
}
|
|
3201
3262
|
break;
|
|
3202
3263
|
}
|
|
3203
3264
|
case "EC": {
|
|
3204
3265
|
switch (jwk.alg) {
|
|
3205
3266
|
case "ES256":
|
|
3206
|
-
algorithm = { name: "ECDSA", namedCurve: "P-256" };
|
|
3207
|
-
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
3208
|
-
break;
|
|
3209
3267
|
case "ES384":
|
|
3210
|
-
algorithm = { name: "ECDSA", namedCurve: "P-384" };
|
|
3211
|
-
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
3212
|
-
break;
|
|
3213
3268
|
case "ES512":
|
|
3214
|
-
algorithm = {
|
|
3269
|
+
algorithm = {
|
|
3270
|
+
name: "ECDSA",
|
|
3271
|
+
namedCurve: { ES256: "P-256", ES384: "P-384", ES512: "P-521" }[jwk.alg]
|
|
3272
|
+
};
|
|
3215
3273
|
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
3216
3274
|
break;
|
|
3217
3275
|
case "ECDH-ES":
|
|
@@ -3222,7 +3280,7 @@ function subtleMapping(jwk) {
|
|
|
3222
3280
|
keyUsages = jwk.d ? ["deriveBits"] : [];
|
|
3223
3281
|
break;
|
|
3224
3282
|
default:
|
|
3225
|
-
throw new JOSENotSupported(
|
|
3283
|
+
throw new JOSENotSupported(unsupportedAlg);
|
|
3226
3284
|
}
|
|
3227
3285
|
break;
|
|
3228
3286
|
}
|
|
@@ -3241,7 +3299,7 @@ function subtleMapping(jwk) {
|
|
|
3241
3299
|
keyUsages = jwk.d ? ["deriveBits"] : [];
|
|
3242
3300
|
break;
|
|
3243
3301
|
default:
|
|
3244
|
-
throw new JOSENotSupported(
|
|
3302
|
+
throw new JOSENotSupported(unsupportedAlg);
|
|
3245
3303
|
}
|
|
3246
3304
|
break;
|
|
3247
3305
|
}
|
|
@@ -3262,100 +3320,11 @@ async function jwkToKey(jwk) {
|
|
|
3262
3320
|
delete keyData.use;
|
|
3263
3321
|
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);
|
|
3264
3322
|
}
|
|
3323
|
+
var unsupportedAlg = 'Invalid or unsupported JWK "alg" (Algorithm) Parameter value';
|
|
3265
3324
|
var init_jwk_to_key = __esm(() => {
|
|
3266
3325
|
init_errors2();
|
|
3267
3326
|
});
|
|
3268
3327
|
|
|
3269
|
-
// ../../node_modules/jose/dist/webapi/key/import.js
|
|
3270
|
-
async function importJWK(jwk, alg, options) {
|
|
3271
|
-
if (!isObject(jwk)) {
|
|
3272
|
-
throw new TypeError("JWK must be an object");
|
|
3273
|
-
}
|
|
3274
|
-
let ext;
|
|
3275
|
-
alg ??= jwk.alg;
|
|
3276
|
-
ext ??= options?.extractable ?? jwk.ext;
|
|
3277
|
-
switch (jwk.kty) {
|
|
3278
|
-
case "oct":
|
|
3279
|
-
if (typeof jwk.k !== "string" || !jwk.k) {
|
|
3280
|
-
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
3281
|
-
}
|
|
3282
|
-
return decode(jwk.k);
|
|
3283
|
-
case "RSA":
|
|
3284
|
-
if ("oth" in jwk && jwk.oth !== undefined) {
|
|
3285
|
-
throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
|
|
3286
|
-
}
|
|
3287
|
-
return jwkToKey({ ...jwk, alg, ext });
|
|
3288
|
-
case "AKP": {
|
|
3289
|
-
if (typeof jwk.alg !== "string" || !jwk.alg) {
|
|
3290
|
-
throw new TypeError('missing "alg" (Algorithm) Parameter value');
|
|
3291
|
-
}
|
|
3292
|
-
if (alg !== undefined && alg !== jwk.alg) {
|
|
3293
|
-
throw new TypeError("JWK alg and alg option value mismatch");
|
|
3294
|
-
}
|
|
3295
|
-
return jwkToKey({ ...jwk, ext });
|
|
3296
|
-
}
|
|
3297
|
-
case "EC":
|
|
3298
|
-
case "OKP":
|
|
3299
|
-
return jwkToKey({ ...jwk, alg, ext });
|
|
3300
|
-
default:
|
|
3301
|
-
throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value');
|
|
3302
|
-
}
|
|
3303
|
-
}
|
|
3304
|
-
var init_import = __esm(() => {
|
|
3305
|
-
init_base64url();
|
|
3306
|
-
init_jwk_to_key();
|
|
3307
|
-
init_errors2();
|
|
3308
|
-
});
|
|
3309
|
-
|
|
3310
|
-
// ../../node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
3311
|
-
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
3312
|
-
if (joseHeader.crit !== undefined && protectedHeader?.crit === undefined) {
|
|
3313
|
-
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
3314
|
-
}
|
|
3315
|
-
if (!protectedHeader || protectedHeader.crit === undefined) {
|
|
3316
|
-
return new Set;
|
|
3317
|
-
}
|
|
3318
|
-
if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== "string" || input.length === 0)) {
|
|
3319
|
-
throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
|
|
3320
|
-
}
|
|
3321
|
-
let recognized;
|
|
3322
|
-
if (recognizedOption !== undefined) {
|
|
3323
|
-
recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
|
|
3324
|
-
} else {
|
|
3325
|
-
recognized = recognizedDefault;
|
|
3326
|
-
}
|
|
3327
|
-
for (const parameter of protectedHeader.crit) {
|
|
3328
|
-
if (!recognized.has(parameter)) {
|
|
3329
|
-
throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);
|
|
3330
|
-
}
|
|
3331
|
-
if (joseHeader[parameter] === undefined) {
|
|
3332
|
-
throw new Err(`Extension Header Parameter "${parameter}" is missing`);
|
|
3333
|
-
}
|
|
3334
|
-
if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {
|
|
3335
|
-
throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);
|
|
3336
|
-
}
|
|
3337
|
-
}
|
|
3338
|
-
return new Set(protectedHeader.crit);
|
|
3339
|
-
}
|
|
3340
|
-
var init_validate_crit = __esm(() => {
|
|
3341
|
-
init_errors2();
|
|
3342
|
-
});
|
|
3343
|
-
|
|
3344
|
-
// ../../node_modules/jose/dist/webapi/lib/validate_algorithms.js
|
|
3345
|
-
function validateAlgorithms(option, algorithms) {
|
|
3346
|
-
if (algorithms !== undefined && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
3347
|
-
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
3348
|
-
}
|
|
3349
|
-
if (!algorithms) {
|
|
3350
|
-
return;
|
|
3351
|
-
}
|
|
3352
|
-
return new Set(algorithms);
|
|
3353
|
-
}
|
|
3354
|
-
|
|
3355
|
-
// ../../node_modules/jose/dist/webapi/lib/is_jwk.js
|
|
3356
|
-
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";
|
|
3357
|
-
var init_is_jwk = () => {};
|
|
3358
|
-
|
|
3359
3328
|
// ../../node_modules/jose/dist/webapi/lib/normalize_key.js
|
|
3360
3329
|
async function normalizeKey(key, alg) {
|
|
3361
3330
|
if (key instanceof Uint8Array) {
|
|
@@ -3388,7 +3357,7 @@ async function normalizeKey(key, alg) {
|
|
|
3388
3357
|
}
|
|
3389
3358
|
throw new Error("unreachable");
|
|
3390
3359
|
}
|
|
3391
|
-
var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
3360
|
+
var unusableForAlg = "given KeyObject instance cannot be used for this algorithm", cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
3392
3361
|
cache ||= new WeakMap;
|
|
3393
3362
|
let cached = cache.get(key);
|
|
3394
3363
|
if (cached?.[alg]) {
|
|
@@ -3420,13 +3389,13 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
3420
3389
|
case "ECDH-ES+A256KW":
|
|
3421
3390
|
break;
|
|
3422
3391
|
default:
|
|
3423
|
-
throw new TypeError(
|
|
3392
|
+
throw new TypeError(unusableForAlg);
|
|
3424
3393
|
}
|
|
3425
3394
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, isPublic ? [] : ["deriveBits"]);
|
|
3426
3395
|
}
|
|
3427
3396
|
if (keyObject.asymmetricKeyType === "ed25519") {
|
|
3428
3397
|
if (alg !== "EdDSA" && alg !== "Ed25519") {
|
|
3429
|
-
throw new TypeError(
|
|
3398
|
+
throw new TypeError(unusableForAlg);
|
|
3430
3399
|
}
|
|
3431
3400
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
|
|
3432
3401
|
isPublic ? "verify" : "sign"
|
|
@@ -3437,7 +3406,7 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
3437
3406
|
case "ml-dsa-65":
|
|
3438
3407
|
case "ml-dsa-87": {
|
|
3439
3408
|
if (alg !== keyObject.asymmetricKeyType.toUpperCase()) {
|
|
3440
|
-
throw new TypeError(
|
|
3409
|
+
throw new TypeError(unusableForAlg);
|
|
3441
3410
|
}
|
|
3442
3411
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
|
|
3443
3412
|
isPublic ? "verify" : "sign"
|
|
@@ -3466,7 +3435,7 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
3466
3435
|
hash = "SHA-512";
|
|
3467
3436
|
break;
|
|
3468
3437
|
default:
|
|
3469
|
-
throw new TypeError(
|
|
3438
|
+
throw new TypeError(unusableForAlg);
|
|
3470
3439
|
}
|
|
3471
3440
|
if (alg.startsWith("RSA-OAEP")) {
|
|
3472
3441
|
return keyObject.toCryptoKey({
|
|
@@ -3487,21 +3456,10 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
3487
3456
|
]);
|
|
3488
3457
|
const namedCurve = nist.get(keyObject.asymmetricKeyDetails?.namedCurve);
|
|
3489
3458
|
if (!namedCurve) {
|
|
3490
|
-
throw new TypeError(
|
|
3491
|
-
}
|
|
3492
|
-
if (alg === "ES256" && namedCurve === "P-256") {
|
|
3493
|
-
cryptoKey = keyObject.toCryptoKey({
|
|
3494
|
-
name: "ECDSA",
|
|
3495
|
-
namedCurve
|
|
3496
|
-
}, extractable, [isPublic ? "verify" : "sign"]);
|
|
3497
|
-
}
|
|
3498
|
-
if (alg === "ES384" && namedCurve === "P-384") {
|
|
3499
|
-
cryptoKey = keyObject.toCryptoKey({
|
|
3500
|
-
name: "ECDSA",
|
|
3501
|
-
namedCurve
|
|
3502
|
-
}, extractable, [isPublic ? "verify" : "sign"]);
|
|
3459
|
+
throw new TypeError(unusableForAlg);
|
|
3503
3460
|
}
|
|
3504
|
-
|
|
3461
|
+
const expectedCurve = { ES256: "P-256", ES384: "P-384", ES512: "P-521" };
|
|
3462
|
+
if (expectedCurve[alg] && namedCurve === expectedCurve[alg]) {
|
|
3505
3463
|
cryptoKey = keyObject.toCryptoKey({
|
|
3506
3464
|
name: "ECDSA",
|
|
3507
3465
|
namedCurve
|
|
@@ -3515,7 +3473,7 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
3515
3473
|
}
|
|
3516
3474
|
}
|
|
3517
3475
|
if (!cryptoKey) {
|
|
3518
|
-
throw new TypeError(
|
|
3476
|
+
throw new TypeError(unusableForAlg);
|
|
3519
3477
|
}
|
|
3520
3478
|
if (!cached) {
|
|
3521
3479
|
cache.set(keyObject, { [alg]: cryptoKey });
|
|
@@ -3525,11 +3483,96 @@ var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
3525
3483
|
return cryptoKey;
|
|
3526
3484
|
};
|
|
3527
3485
|
var init_normalize_key = __esm(() => {
|
|
3528
|
-
init_is_jwk();
|
|
3529
3486
|
init_base64url();
|
|
3530
3487
|
init_jwk_to_key();
|
|
3531
3488
|
});
|
|
3532
3489
|
|
|
3490
|
+
// ../../node_modules/jose/dist/webapi/key/import.js
|
|
3491
|
+
async function importJWK(jwk, alg, options) {
|
|
3492
|
+
if (!isObject(jwk)) {
|
|
3493
|
+
throw new TypeError("JWK must be an object");
|
|
3494
|
+
}
|
|
3495
|
+
let ext;
|
|
3496
|
+
alg ??= jwk.alg;
|
|
3497
|
+
ext ??= options?.extractable ?? jwk.ext;
|
|
3498
|
+
switch (jwk.kty) {
|
|
3499
|
+
case "oct":
|
|
3500
|
+
if (typeof jwk.k !== "string" || !jwk.k) {
|
|
3501
|
+
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
3502
|
+
}
|
|
3503
|
+
return decode(jwk.k);
|
|
3504
|
+
case "RSA":
|
|
3505
|
+
if ("oth" in jwk && jwk.oth !== undefined) {
|
|
3506
|
+
throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
|
|
3507
|
+
}
|
|
3508
|
+
return jwkToKey({ ...jwk, alg, ext });
|
|
3509
|
+
case "AKP": {
|
|
3510
|
+
if (typeof jwk.alg !== "string" || !jwk.alg) {
|
|
3511
|
+
throw new TypeError('missing "alg" (Algorithm) Parameter value');
|
|
3512
|
+
}
|
|
3513
|
+
if (alg !== undefined && alg !== jwk.alg) {
|
|
3514
|
+
throw new TypeError("JWK alg and alg option value mismatch");
|
|
3515
|
+
}
|
|
3516
|
+
return jwkToKey({ ...jwk, ext });
|
|
3517
|
+
}
|
|
3518
|
+
case "EC":
|
|
3519
|
+
case "OKP":
|
|
3520
|
+
return jwkToKey({ ...jwk, alg, ext });
|
|
3521
|
+
default:
|
|
3522
|
+
throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value');
|
|
3523
|
+
}
|
|
3524
|
+
}
|
|
3525
|
+
var init_import = __esm(() => {
|
|
3526
|
+
init_base64url();
|
|
3527
|
+
init_jwk_to_key();
|
|
3528
|
+
init_errors2();
|
|
3529
|
+
});
|
|
3530
|
+
|
|
3531
|
+
// ../../node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
3532
|
+
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
3533
|
+
if (joseHeader.crit !== undefined && protectedHeader?.crit === undefined) {
|
|
3534
|
+
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
3535
|
+
}
|
|
3536
|
+
if (!protectedHeader || protectedHeader.crit === undefined) {
|
|
3537
|
+
return new Set;
|
|
3538
|
+
}
|
|
3539
|
+
if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== "string" || input.length === 0)) {
|
|
3540
|
+
throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
|
|
3541
|
+
}
|
|
3542
|
+
let recognized;
|
|
3543
|
+
if (recognizedOption !== undefined) {
|
|
3544
|
+
recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
|
|
3545
|
+
} else {
|
|
3546
|
+
recognized = recognizedDefault;
|
|
3547
|
+
}
|
|
3548
|
+
for (const parameter of protectedHeader.crit) {
|
|
3549
|
+
if (!recognized.has(parameter)) {
|
|
3550
|
+
throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);
|
|
3551
|
+
}
|
|
3552
|
+
if (joseHeader[parameter] === undefined) {
|
|
3553
|
+
throw new Err(`Extension Header Parameter "${parameter}" is missing`);
|
|
3554
|
+
}
|
|
3555
|
+
if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {
|
|
3556
|
+
throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);
|
|
3557
|
+
}
|
|
3558
|
+
}
|
|
3559
|
+
return new Set(protectedHeader.crit);
|
|
3560
|
+
}
|
|
3561
|
+
var init_validate_crit = __esm(() => {
|
|
3562
|
+
init_errors2();
|
|
3563
|
+
});
|
|
3564
|
+
|
|
3565
|
+
// ../../node_modules/jose/dist/webapi/lib/validate_algorithms.js
|
|
3566
|
+
function validateAlgorithms(option, algorithms) {
|
|
3567
|
+
if (algorithms !== undefined && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
3568
|
+
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
3569
|
+
}
|
|
3570
|
+
if (!algorithms) {
|
|
3571
|
+
return;
|
|
3572
|
+
}
|
|
3573
|
+
return new Set(algorithms);
|
|
3574
|
+
}
|
|
3575
|
+
|
|
3533
3576
|
// ../../node_modules/jose/dist/webapi/lib/check_key_type.js
|
|
3534
3577
|
function checkKeyType(alg, key, usage) {
|
|
3535
3578
|
switch (alg.substring(0, 2)) {
|
|
@@ -3646,73 +3689,7 @@ var tag = (key) => key?.[Symbol.toStringTag], jwkMatchesOp = (alg, key, usage) =
|
|
|
3646
3689
|
}
|
|
3647
3690
|
}
|
|
3648
3691
|
};
|
|
3649
|
-
var init_check_key_type =
|
|
3650
|
-
init_is_jwk();
|
|
3651
|
-
});
|
|
3652
|
-
|
|
3653
|
-
// ../../node_modules/jose/dist/webapi/lib/subtle_dsa.js
|
|
3654
|
-
function subtleAlgorithm(alg, algorithm) {
|
|
3655
|
-
const hash = `SHA-${alg.slice(-3)}`;
|
|
3656
|
-
switch (alg) {
|
|
3657
|
-
case "HS256":
|
|
3658
|
-
case "HS384":
|
|
3659
|
-
case "HS512":
|
|
3660
|
-
return { hash, name: "HMAC" };
|
|
3661
|
-
case "PS256":
|
|
3662
|
-
case "PS384":
|
|
3663
|
-
case "PS512":
|
|
3664
|
-
return { hash, name: "RSA-PSS", saltLength: parseInt(alg.slice(-3), 10) >> 3 };
|
|
3665
|
-
case "RS256":
|
|
3666
|
-
case "RS384":
|
|
3667
|
-
case "RS512":
|
|
3668
|
-
return { hash, name: "RSASSA-PKCS1-v1_5" };
|
|
3669
|
-
case "ES256":
|
|
3670
|
-
case "ES384":
|
|
3671
|
-
case "ES512":
|
|
3672
|
-
return { hash, name: "ECDSA", namedCurve: algorithm.namedCurve };
|
|
3673
|
-
case "Ed25519":
|
|
3674
|
-
case "EdDSA":
|
|
3675
|
-
return { name: "Ed25519" };
|
|
3676
|
-
case "ML-DSA-44":
|
|
3677
|
-
case "ML-DSA-65":
|
|
3678
|
-
case "ML-DSA-87":
|
|
3679
|
-
return { name: alg };
|
|
3680
|
-
default:
|
|
3681
|
-
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
3682
|
-
}
|
|
3683
|
-
}
|
|
3684
|
-
var init_subtle_dsa = __esm(() => {
|
|
3685
|
-
init_errors2();
|
|
3686
|
-
});
|
|
3687
|
-
|
|
3688
|
-
// ../../node_modules/jose/dist/webapi/lib/get_sign_verify_key.js
|
|
3689
|
-
async function getSigKey(alg, key, usage) {
|
|
3690
|
-
if (key instanceof Uint8Array) {
|
|
3691
|
-
if (!alg.startsWith("HS")) {
|
|
3692
|
-
throw new TypeError(invalidKeyInput(key, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
3693
|
-
}
|
|
3694
|
-
return crypto.subtle.importKey("raw", key, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage]);
|
|
3695
|
-
}
|
|
3696
|
-
checkSigCryptoKey(key, alg, usage);
|
|
3697
|
-
return key;
|
|
3698
|
-
}
|
|
3699
|
-
var init_get_sign_verify_key = () => {};
|
|
3700
|
-
|
|
3701
|
-
// ../../node_modules/jose/dist/webapi/lib/verify.js
|
|
3702
|
-
async function verify(alg, key, signature, data) {
|
|
3703
|
-
const cryptoKey = await getSigKey(alg, key, "verify");
|
|
3704
|
-
checkKeyLength(alg, cryptoKey);
|
|
3705
|
-
const algorithm = subtleAlgorithm(alg, cryptoKey.algorithm);
|
|
3706
|
-
try {
|
|
3707
|
-
return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
|
|
3708
|
-
} catch {
|
|
3709
|
-
return false;
|
|
3710
|
-
}
|
|
3711
|
-
}
|
|
3712
|
-
var init_verify = __esm(() => {
|
|
3713
|
-
init_subtle_dsa();
|
|
3714
|
-
init_get_sign_verify_key();
|
|
3715
|
-
});
|
|
3692
|
+
var init_check_key_type = () => {};
|
|
3716
3693
|
|
|
3717
3694
|
// ../../node_modules/jose/dist/webapi/jws/flattened/verify.js
|
|
3718
3695
|
async function flattenedVerify(jws, key, options) {
|
|
@@ -3780,12 +3757,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
3780
3757
|
}
|
|
3781
3758
|
checkKeyType(alg, key, "verify");
|
|
3782
3759
|
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);
|
|
3783
|
-
|
|
3784
|
-
try {
|
|
3785
|
-
signature = decode(jws.signature);
|
|
3786
|
-
} catch {
|
|
3787
|
-
throw new JWSInvalid("Failed to base64url decode the signature");
|
|
3788
|
-
}
|
|
3760
|
+
const signature = decodeBase64url(jws.signature, "signature", JWSInvalid);
|
|
3789
3761
|
const k = await normalizeKey(key, alg);
|
|
3790
3762
|
const verified = await verify(alg, k, signature, data);
|
|
3791
3763
|
if (!verified) {
|
|
@@ -3793,11 +3765,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
3793
3765
|
}
|
|
3794
3766
|
let payload;
|
|
3795
3767
|
if (b64) {
|
|
3796
|
-
|
|
3797
|
-
payload = decode(jws.payload);
|
|
3798
|
-
} catch {
|
|
3799
|
-
throw new JWSInvalid("Failed to base64url decode the payload");
|
|
3800
|
-
}
|
|
3768
|
+
payload = decodeBase64url(jws.payload, "payload", JWSInvalid);
|
|
3801
3769
|
} else if (typeof jws.payload === "string") {
|
|
3802
3770
|
payload = encoder.encode(jws.payload);
|
|
3803
3771
|
} else {
|
|
@@ -3815,11 +3783,12 @@ async function flattenedVerify(jws, key, options) {
|
|
|
3815
3783
|
}
|
|
3816
3784
|
return result;
|
|
3817
3785
|
}
|
|
3818
|
-
var
|
|
3786
|
+
var init_verify = __esm(() => {
|
|
3819
3787
|
init_base64url();
|
|
3820
|
-
|
|
3788
|
+
init_signing();
|
|
3821
3789
|
init_errors2();
|
|
3822
3790
|
init_buffer_utils();
|
|
3791
|
+
init_helpers();
|
|
3823
3792
|
init_check_key_type();
|
|
3824
3793
|
init_validate_crit();
|
|
3825
3794
|
init_normalize_key();
|
|
@@ -3844,8 +3813,8 @@ async function compactVerify(jws, key, options) {
|
|
|
3844
3813
|
}
|
|
3845
3814
|
return result;
|
|
3846
3815
|
}
|
|
3847
|
-
var
|
|
3848
|
-
|
|
3816
|
+
var init_verify2 = __esm(() => {
|
|
3817
|
+
init_verify();
|
|
3849
3818
|
init_errors2();
|
|
3850
3819
|
init_buffer_utils();
|
|
3851
3820
|
});
|
|
@@ -4089,8 +4058,8 @@ async function jwtVerify(jwt, key, options) {
|
|
|
4089
4058
|
}
|
|
4090
4059
|
return result;
|
|
4091
4060
|
}
|
|
4092
|
-
var
|
|
4093
|
-
|
|
4061
|
+
var init_verify3 = __esm(() => {
|
|
4062
|
+
init_verify2();
|
|
4094
4063
|
init_jwt_claims_set();
|
|
4095
4064
|
init_errors2();
|
|
4096
4065
|
});
|
|
@@ -4375,7 +4344,7 @@ var init_remote = __esm(() => {
|
|
|
4375
4344
|
init_local();
|
|
4376
4345
|
if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
|
|
4377
4346
|
const NAME = "jose";
|
|
4378
|
-
const VERSION = "v6.1
|
|
4347
|
+
const VERSION = "v6.2.1";
|
|
4379
4348
|
USER_AGENT = `${NAME}/${VERSION}`;
|
|
4380
4349
|
}
|
|
4381
4350
|
customFetch = Symbol();
|
|
@@ -4384,7 +4353,7 @@ var init_remote = __esm(() => {
|
|
|
4384
4353
|
|
|
4385
4354
|
// ../../node_modules/jose/dist/webapi/index.js
|
|
4386
4355
|
var init_webapi = __esm(() => {
|
|
4387
|
-
|
|
4356
|
+
init_verify3();
|
|
4388
4357
|
init_local();
|
|
4389
4358
|
init_remote();
|
|
4390
4359
|
init_errors2();
|
|
@@ -12130,6 +12099,11 @@ function decode2(input) {
|
|
|
12130
12099
|
function getHashLength2(hash) {
|
|
12131
12100
|
return parseInt(hash.name.slice(4), 10);
|
|
12132
12101
|
}
|
|
12102
|
+
function checkHashLength2(algorithm, expected) {
|
|
12103
|
+
const actual = getHashLength2(algorithm.hash);
|
|
12104
|
+
if (actual !== expected)
|
|
12105
|
+
throw unusable2(`SHA-${expected}`, "algorithm.hash");
|
|
12106
|
+
}
|
|
12133
12107
|
function getNamedCurve2(alg) {
|
|
12134
12108
|
switch (alg) {
|
|
12135
12109
|
case "ES256":
|
|
@@ -12154,10 +12128,7 @@ function checkSigCryptoKey2(key, alg, usage) {
|
|
|
12154
12128
|
case "HS512": {
|
|
12155
12129
|
if (!isAlgorithm2(key.algorithm, "HMAC"))
|
|
12156
12130
|
throw unusable2("HMAC");
|
|
12157
|
-
|
|
12158
|
-
const actual = getHashLength2(key.algorithm.hash);
|
|
12159
|
-
if (actual !== expected)
|
|
12160
|
-
throw unusable2(`SHA-${expected}`, "algorithm.hash");
|
|
12131
|
+
checkHashLength2(key.algorithm, parseInt(alg.slice(2), 10));
|
|
12161
12132
|
break;
|
|
12162
12133
|
}
|
|
12163
12134
|
case "RS256":
|
|
@@ -12165,10 +12136,7 @@ function checkSigCryptoKey2(key, alg, usage) {
|
|
|
12165
12136
|
case "RS512": {
|
|
12166
12137
|
if (!isAlgorithm2(key.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
12167
12138
|
throw unusable2("RSASSA-PKCS1-v1_5");
|
|
12168
|
-
|
|
12169
|
-
const actual = getHashLength2(key.algorithm.hash);
|
|
12170
|
-
if (actual !== expected)
|
|
12171
|
-
throw unusable2(`SHA-${expected}`, "algorithm.hash");
|
|
12139
|
+
checkHashLength2(key.algorithm, parseInt(alg.slice(2), 10));
|
|
12172
12140
|
break;
|
|
12173
12141
|
}
|
|
12174
12142
|
case "PS256":
|
|
@@ -12176,10 +12144,7 @@ function checkSigCryptoKey2(key, alg, usage) {
|
|
|
12176
12144
|
case "PS512": {
|
|
12177
12145
|
if (!isAlgorithm2(key.algorithm, "RSA-PSS"))
|
|
12178
12146
|
throw unusable2("RSA-PSS");
|
|
12179
|
-
|
|
12180
|
-
const actual = getHashLength2(key.algorithm.hash);
|
|
12181
|
-
if (actual !== expected)
|
|
12182
|
-
throw unusable2(`SHA-${expected}`, "algorithm.hash");
|
|
12147
|
+
checkHashLength2(key.algorithm, parseInt(alg.slice(2), 10));
|
|
12183
12148
|
break;
|
|
12184
12149
|
}
|
|
12185
12150
|
case "Ed25519":
|
|
@@ -12232,6 +12197,26 @@ function message2(msg, actual, ...types2) {
|
|
|
12232
12197
|
}
|
|
12233
12198
|
return msg;
|
|
12234
12199
|
}
|
|
12200
|
+
function decodeBase64url2(value, label, ErrorClass) {
|
|
12201
|
+
try {
|
|
12202
|
+
return decode2(value);
|
|
12203
|
+
} catch {
|
|
12204
|
+
throw new ErrorClass(`Failed to base64url decode the ${label}`);
|
|
12205
|
+
}
|
|
12206
|
+
}
|
|
12207
|
+
function isObject2(input) {
|
|
12208
|
+
if (!isObjectLike2(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
12209
|
+
return false;
|
|
12210
|
+
}
|
|
12211
|
+
if (Object.getPrototypeOf(input) === null) {
|
|
12212
|
+
return true;
|
|
12213
|
+
}
|
|
12214
|
+
let proto = input;
|
|
12215
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
12216
|
+
proto = Object.getPrototypeOf(proto);
|
|
12217
|
+
}
|
|
12218
|
+
return Object.getPrototypeOf(input) === proto;
|
|
12219
|
+
}
|
|
12235
12220
|
function isDisjoint2(...headers) {
|
|
12236
12221
|
const sources = headers.filter(Boolean);
|
|
12237
12222
|
if (sources.length === 0 || sources.length === 1) {
|
|
@@ -12253,19 +12238,6 @@ function isDisjoint2(...headers) {
|
|
|
12253
12238
|
}
|
|
12254
12239
|
return true;
|
|
12255
12240
|
}
|
|
12256
|
-
function isObject2(input) {
|
|
12257
|
-
if (!isObjectLike2(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
12258
|
-
return false;
|
|
12259
|
-
}
|
|
12260
|
-
if (Object.getPrototypeOf(input) === null) {
|
|
12261
|
-
return true;
|
|
12262
|
-
}
|
|
12263
|
-
let proto = input;
|
|
12264
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
|
12265
|
-
proto = Object.getPrototypeOf(proto);
|
|
12266
|
-
}
|
|
12267
|
-
return Object.getPrototypeOf(input) === proto;
|
|
12268
|
-
}
|
|
12269
12241
|
function checkKeyLength2(alg, key) {
|
|
12270
12242
|
if (alg.startsWith("RS") || alg.startsWith("PS")) {
|
|
12271
12243
|
const { modulusLength } = key.algorithm;
|
|
@@ -12274,6 +12246,56 @@ function checkKeyLength2(alg, key) {
|
|
|
12274
12246
|
}
|
|
12275
12247
|
}
|
|
12276
12248
|
}
|
|
12249
|
+
function subtleAlgorithm2(alg, algorithm) {
|
|
12250
|
+
const hash = `SHA-${alg.slice(-3)}`;
|
|
12251
|
+
switch (alg) {
|
|
12252
|
+
case "HS256":
|
|
12253
|
+
case "HS384":
|
|
12254
|
+
case "HS512":
|
|
12255
|
+
return { hash, name: "HMAC" };
|
|
12256
|
+
case "PS256":
|
|
12257
|
+
case "PS384":
|
|
12258
|
+
case "PS512":
|
|
12259
|
+
return { hash, name: "RSA-PSS", saltLength: parseInt(alg.slice(-3), 10) >> 3 };
|
|
12260
|
+
case "RS256":
|
|
12261
|
+
case "RS384":
|
|
12262
|
+
case "RS512":
|
|
12263
|
+
return { hash, name: "RSASSA-PKCS1-v1_5" };
|
|
12264
|
+
case "ES256":
|
|
12265
|
+
case "ES384":
|
|
12266
|
+
case "ES512":
|
|
12267
|
+
return { hash, name: "ECDSA", namedCurve: algorithm.namedCurve };
|
|
12268
|
+
case "Ed25519":
|
|
12269
|
+
case "EdDSA":
|
|
12270
|
+
return { name: "Ed25519" };
|
|
12271
|
+
case "ML-DSA-44":
|
|
12272
|
+
case "ML-DSA-65":
|
|
12273
|
+
case "ML-DSA-87":
|
|
12274
|
+
return { name: alg };
|
|
12275
|
+
default:
|
|
12276
|
+
throw new JOSENotSupported2(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
12277
|
+
}
|
|
12278
|
+
}
|
|
12279
|
+
async function getSigKey2(alg, key, usage) {
|
|
12280
|
+
if (key instanceof Uint8Array) {
|
|
12281
|
+
if (!alg.startsWith("HS")) {
|
|
12282
|
+
throw new TypeError(invalidKeyInput2(key, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
12283
|
+
}
|
|
12284
|
+
return crypto.subtle.importKey("raw", key, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage]);
|
|
12285
|
+
}
|
|
12286
|
+
checkSigCryptoKey2(key, alg, usage);
|
|
12287
|
+
return key;
|
|
12288
|
+
}
|
|
12289
|
+
async function verify2(alg, key, signature, data) {
|
|
12290
|
+
const cryptoKey = await getSigKey2(alg, key, "verify");
|
|
12291
|
+
checkKeyLength2(alg, cryptoKey);
|
|
12292
|
+
const algorithm = subtleAlgorithm2(alg, cryptoKey.algorithm);
|
|
12293
|
+
try {
|
|
12294
|
+
return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
|
|
12295
|
+
} catch {
|
|
12296
|
+
return false;
|
|
12297
|
+
}
|
|
12298
|
+
}
|
|
12277
12299
|
function subtleMapping2(jwk) {
|
|
12278
12300
|
let algorithm;
|
|
12279
12301
|
let keyUsages;
|
|
@@ -12287,7 +12309,7 @@ function subtleMapping2(jwk) {
|
|
|
12287
12309
|
keyUsages = jwk.priv ? ["sign"] : ["verify"];
|
|
12288
12310
|
break;
|
|
12289
12311
|
default:
|
|
12290
|
-
throw new JOSENotSupported2(
|
|
12312
|
+
throw new JOSENotSupported2(unsupportedAlg2);
|
|
12291
12313
|
}
|
|
12292
12314
|
break;
|
|
12293
12315
|
}
|
|
@@ -12316,22 +12338,19 @@ function subtleMapping2(jwk) {
|
|
|
12316
12338
|
keyUsages = jwk.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
|
|
12317
12339
|
break;
|
|
12318
12340
|
default:
|
|
12319
|
-
throw new JOSENotSupported2(
|
|
12341
|
+
throw new JOSENotSupported2(unsupportedAlg2);
|
|
12320
12342
|
}
|
|
12321
12343
|
break;
|
|
12322
12344
|
}
|
|
12323
12345
|
case "EC": {
|
|
12324
12346
|
switch (jwk.alg) {
|
|
12325
12347
|
case "ES256":
|
|
12326
|
-
algorithm = { name: "ECDSA", namedCurve: "P-256" };
|
|
12327
|
-
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
12328
|
-
break;
|
|
12329
12348
|
case "ES384":
|
|
12330
|
-
algorithm = { name: "ECDSA", namedCurve: "P-384" };
|
|
12331
|
-
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
12332
|
-
break;
|
|
12333
12349
|
case "ES512":
|
|
12334
|
-
algorithm = {
|
|
12350
|
+
algorithm = {
|
|
12351
|
+
name: "ECDSA",
|
|
12352
|
+
namedCurve: { ES256: "P-256", ES384: "P-384", ES512: "P-521" }[jwk.alg]
|
|
12353
|
+
};
|
|
12335
12354
|
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
12336
12355
|
break;
|
|
12337
12356
|
case "ECDH-ES":
|
|
@@ -12342,7 +12361,7 @@ function subtleMapping2(jwk) {
|
|
|
12342
12361
|
keyUsages = jwk.d ? ["deriveBits"] : [];
|
|
12343
12362
|
break;
|
|
12344
12363
|
default:
|
|
12345
|
-
throw new JOSENotSupported2(
|
|
12364
|
+
throw new JOSENotSupported2(unsupportedAlg2);
|
|
12346
12365
|
}
|
|
12347
12366
|
break;
|
|
12348
12367
|
}
|
|
@@ -12361,7 +12380,7 @@ function subtleMapping2(jwk) {
|
|
|
12361
12380
|
keyUsages = jwk.d ? ["deriveBits"] : [];
|
|
12362
12381
|
break;
|
|
12363
12382
|
default:
|
|
12364
|
-
throw new JOSENotSupported2(
|
|
12383
|
+
throw new JOSENotSupported2(unsupportedAlg2);
|
|
12365
12384
|
}
|
|
12366
12385
|
break;
|
|
12367
12386
|
}
|
|
@@ -12382,6 +12401,37 @@ async function jwkToKey2(jwk) {
|
|
|
12382
12401
|
delete keyData.use;
|
|
12383
12402
|
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);
|
|
12384
12403
|
}
|
|
12404
|
+
async function normalizeKey2(key, alg) {
|
|
12405
|
+
if (key instanceof Uint8Array) {
|
|
12406
|
+
return key;
|
|
12407
|
+
}
|
|
12408
|
+
if (isCryptoKey2(key)) {
|
|
12409
|
+
return key;
|
|
12410
|
+
}
|
|
12411
|
+
if (isKeyObject2(key)) {
|
|
12412
|
+
if (key.type === "secret") {
|
|
12413
|
+
return key.export();
|
|
12414
|
+
}
|
|
12415
|
+
if ("toCryptoKey" in key && typeof key.toCryptoKey === "function") {
|
|
12416
|
+
try {
|
|
12417
|
+
return handleKeyObject2(key, alg);
|
|
12418
|
+
} catch (err) {
|
|
12419
|
+
if (err instanceof TypeError) {
|
|
12420
|
+
throw err;
|
|
12421
|
+
}
|
|
12422
|
+
}
|
|
12423
|
+
}
|
|
12424
|
+
let jwk = key.export({ format: "jwk" });
|
|
12425
|
+
return handleJWK2(key, jwk, alg);
|
|
12426
|
+
}
|
|
12427
|
+
if (isJWK2(key)) {
|
|
12428
|
+
if (key.k) {
|
|
12429
|
+
return decode2(key.k);
|
|
12430
|
+
}
|
|
12431
|
+
return handleJWK2(key, key, alg, true);
|
|
12432
|
+
}
|
|
12433
|
+
throw new Error("unreachable");
|
|
12434
|
+
}
|
|
12385
12435
|
async function importJWK2(jwk, alg, options) {
|
|
12386
12436
|
if (!isObject2(jwk)) {
|
|
12387
12437
|
throw new TypeError("JWK must be an object");
|
|
@@ -12454,37 +12504,6 @@ function validateAlgorithms2(option, algorithms) {
|
|
|
12454
12504
|
}
|
|
12455
12505
|
return new Set(algorithms);
|
|
12456
12506
|
}
|
|
12457
|
-
async function normalizeKey2(key, alg) {
|
|
12458
|
-
if (key instanceof Uint8Array) {
|
|
12459
|
-
return key;
|
|
12460
|
-
}
|
|
12461
|
-
if (isCryptoKey2(key)) {
|
|
12462
|
-
return key;
|
|
12463
|
-
}
|
|
12464
|
-
if (isKeyObject2(key)) {
|
|
12465
|
-
if (key.type === "secret") {
|
|
12466
|
-
return key.export();
|
|
12467
|
-
}
|
|
12468
|
-
if ("toCryptoKey" in key && typeof key.toCryptoKey === "function") {
|
|
12469
|
-
try {
|
|
12470
|
-
return handleKeyObject2(key, alg);
|
|
12471
|
-
} catch (err) {
|
|
12472
|
-
if (err instanceof TypeError) {
|
|
12473
|
-
throw err;
|
|
12474
|
-
}
|
|
12475
|
-
}
|
|
12476
|
-
}
|
|
12477
|
-
let jwk = key.export({ format: "jwk" });
|
|
12478
|
-
return handleJWK2(key, jwk, alg);
|
|
12479
|
-
}
|
|
12480
|
-
if (isJWK2(key)) {
|
|
12481
|
-
if (key.k) {
|
|
12482
|
-
return decode2(key.k);
|
|
12483
|
-
}
|
|
12484
|
-
return handleJWK2(key, key, alg, true);
|
|
12485
|
-
}
|
|
12486
|
-
throw new Error("unreachable");
|
|
12487
|
-
}
|
|
12488
12507
|
function checkKeyType2(alg, key, usage) {
|
|
12489
12508
|
switch (alg.substring(0, 2)) {
|
|
12490
12509
|
case "A1":
|
|
@@ -12498,56 +12517,6 @@ function checkKeyType2(alg, key, usage) {
|
|
|
12498
12517
|
asymmetricTypeCheck2(alg, key, usage);
|
|
12499
12518
|
}
|
|
12500
12519
|
}
|
|
12501
|
-
function subtleAlgorithm2(alg, algorithm) {
|
|
12502
|
-
const hash = `SHA-${alg.slice(-3)}`;
|
|
12503
|
-
switch (alg) {
|
|
12504
|
-
case "HS256":
|
|
12505
|
-
case "HS384":
|
|
12506
|
-
case "HS512":
|
|
12507
|
-
return { hash, name: "HMAC" };
|
|
12508
|
-
case "PS256":
|
|
12509
|
-
case "PS384":
|
|
12510
|
-
case "PS512":
|
|
12511
|
-
return { hash, name: "RSA-PSS", saltLength: parseInt(alg.slice(-3), 10) >> 3 };
|
|
12512
|
-
case "RS256":
|
|
12513
|
-
case "RS384":
|
|
12514
|
-
case "RS512":
|
|
12515
|
-
return { hash, name: "RSASSA-PKCS1-v1_5" };
|
|
12516
|
-
case "ES256":
|
|
12517
|
-
case "ES384":
|
|
12518
|
-
case "ES512":
|
|
12519
|
-
return { hash, name: "ECDSA", namedCurve: algorithm.namedCurve };
|
|
12520
|
-
case "Ed25519":
|
|
12521
|
-
case "EdDSA":
|
|
12522
|
-
return { name: "Ed25519" };
|
|
12523
|
-
case "ML-DSA-44":
|
|
12524
|
-
case "ML-DSA-65":
|
|
12525
|
-
case "ML-DSA-87":
|
|
12526
|
-
return { name: alg };
|
|
12527
|
-
default:
|
|
12528
|
-
throw new JOSENotSupported2(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
12529
|
-
}
|
|
12530
|
-
}
|
|
12531
|
-
async function getSigKey2(alg, key, usage) {
|
|
12532
|
-
if (key instanceof Uint8Array) {
|
|
12533
|
-
if (!alg.startsWith("HS")) {
|
|
12534
|
-
throw new TypeError(invalidKeyInput2(key, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
12535
|
-
}
|
|
12536
|
-
return crypto.subtle.importKey("raw", key, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage]);
|
|
12537
|
-
}
|
|
12538
|
-
checkSigCryptoKey2(key, alg, usage);
|
|
12539
|
-
return key;
|
|
12540
|
-
}
|
|
12541
|
-
async function verify2(alg, key, signature, data) {
|
|
12542
|
-
const cryptoKey = await getSigKey2(alg, key, "verify");
|
|
12543
|
-
checkKeyLength2(alg, cryptoKey);
|
|
12544
|
-
const algorithm = subtleAlgorithm2(alg, cryptoKey.algorithm);
|
|
12545
|
-
try {
|
|
12546
|
-
return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
|
|
12547
|
-
} catch {
|
|
12548
|
-
return false;
|
|
12549
|
-
}
|
|
12550
|
-
}
|
|
12551
12520
|
async function flattenedVerify2(jws, key, options) {
|
|
12552
12521
|
if (!isObject2(jws)) {
|
|
12553
12522
|
throw new JWSInvalid2("Flattened JWS must be an object");
|
|
@@ -12613,12 +12582,7 @@ async function flattenedVerify2(jws, key, options) {
|
|
|
12613
12582
|
}
|
|
12614
12583
|
checkKeyType2(alg, key, "verify");
|
|
12615
12584
|
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);
|
|
12616
|
-
|
|
12617
|
-
try {
|
|
12618
|
-
signature = decode2(jws.signature);
|
|
12619
|
-
} catch {
|
|
12620
|
-
throw new JWSInvalid2("Failed to base64url decode the signature");
|
|
12621
|
-
}
|
|
12585
|
+
const signature = decodeBase64url2(jws.signature, "signature", JWSInvalid2);
|
|
12622
12586
|
const k = await normalizeKey2(key, alg);
|
|
12623
12587
|
const verified = await verify2(alg, k, signature, data);
|
|
12624
12588
|
if (!verified) {
|
|
@@ -12626,11 +12590,7 @@ async function flattenedVerify2(jws, key, options) {
|
|
|
12626
12590
|
}
|
|
12627
12591
|
let payload;
|
|
12628
12592
|
if (b64) {
|
|
12629
|
-
|
|
12630
|
-
payload = decode2(jws.payload);
|
|
12631
|
-
} catch {
|
|
12632
|
-
throw new JWSInvalid2("Failed to base64url decode the payload");
|
|
12633
|
-
}
|
|
12593
|
+
payload = decodeBase64url2(jws.payload, "payload", JWSInvalid2);
|
|
12634
12594
|
} else if (typeof jws.payload === "string") {
|
|
12635
12595
|
payload = encoder2.encode(jws.payload);
|
|
12636
12596
|
} else {
|
|
@@ -18382,7 +18342,7 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18382
18342
|
func.exportReturns = exportReturns2(functionDefinition);
|
|
18383
18343
|
func._handler = handler;
|
|
18384
18344
|
return func;
|
|
18385
|
-
}, 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,
|
|
18345
|
+
}, 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) => {
|
|
18386
18346
|
if (key?.[Symbol.toStringTag] === "CryptoKey")
|
|
18387
18347
|
return true;
|
|
18388
18348
|
try {
|
|
@@ -18390,7 +18350,7 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18390
18350
|
} catch {
|
|
18391
18351
|
return false;
|
|
18392
18352
|
}
|
|
18393
|
-
}, isKeyObject2 = (key) => key?.[Symbol.toStringTag] === "KeyObject", isKeyLike2 = (key) => isCryptoKey2(key) || isKeyObject2(key), isObjectLike2 = (value) => typeof value === "object" && value !== null,
|
|
18353
|
+
}, 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) => {
|
|
18394
18354
|
cache2 ||= new WeakMap;
|
|
18395
18355
|
let cached = cache2.get(key);
|
|
18396
18356
|
if (cached?.[alg]) {
|
|
@@ -18422,13 +18382,13 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18422
18382
|
case "ECDH-ES+A256KW":
|
|
18423
18383
|
break;
|
|
18424
18384
|
default:
|
|
18425
|
-
throw new TypeError(
|
|
18385
|
+
throw new TypeError(unusableForAlg2);
|
|
18426
18386
|
}
|
|
18427
18387
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, isPublic ? [] : ["deriveBits"]);
|
|
18428
18388
|
}
|
|
18429
18389
|
if (keyObject.asymmetricKeyType === "ed25519") {
|
|
18430
18390
|
if (alg !== "EdDSA" && alg !== "Ed25519") {
|
|
18431
|
-
throw new TypeError(
|
|
18391
|
+
throw new TypeError(unusableForAlg2);
|
|
18432
18392
|
}
|
|
18433
18393
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
|
|
18434
18394
|
isPublic ? "verify" : "sign"
|
|
@@ -18439,7 +18399,7 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18439
18399
|
case "ml-dsa-65":
|
|
18440
18400
|
case "ml-dsa-87": {
|
|
18441
18401
|
if (alg !== keyObject.asymmetricKeyType.toUpperCase()) {
|
|
18442
|
-
throw new TypeError(
|
|
18402
|
+
throw new TypeError(unusableForAlg2);
|
|
18443
18403
|
}
|
|
18444
18404
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
|
|
18445
18405
|
isPublic ? "verify" : "sign"
|
|
@@ -18468,7 +18428,7 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18468
18428
|
hash = "SHA-512";
|
|
18469
18429
|
break;
|
|
18470
18430
|
default:
|
|
18471
|
-
throw new TypeError(
|
|
18431
|
+
throw new TypeError(unusableForAlg2);
|
|
18472
18432
|
}
|
|
18473
18433
|
if (alg.startsWith("RSA-OAEP")) {
|
|
18474
18434
|
return keyObject.toCryptoKey({
|
|
@@ -18489,21 +18449,10 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18489
18449
|
]);
|
|
18490
18450
|
const namedCurve = nist.get(keyObject.asymmetricKeyDetails?.namedCurve);
|
|
18491
18451
|
if (!namedCurve) {
|
|
18492
|
-
throw new TypeError(
|
|
18493
|
-
}
|
|
18494
|
-
if (alg === "ES256" && namedCurve === "P-256") {
|
|
18495
|
-
cryptoKey = keyObject.toCryptoKey({
|
|
18496
|
-
name: "ECDSA",
|
|
18497
|
-
namedCurve
|
|
18498
|
-
}, extractable, [isPublic ? "verify" : "sign"]);
|
|
18499
|
-
}
|
|
18500
|
-
if (alg === "ES384" && namedCurve === "P-384") {
|
|
18501
|
-
cryptoKey = keyObject.toCryptoKey({
|
|
18502
|
-
name: "ECDSA",
|
|
18503
|
-
namedCurve
|
|
18504
|
-
}, extractable, [isPublic ? "verify" : "sign"]);
|
|
18452
|
+
throw new TypeError(unusableForAlg2);
|
|
18505
18453
|
}
|
|
18506
|
-
|
|
18454
|
+
const expectedCurve = { ES256: "P-256", ES384: "P-384", ES512: "P-521" };
|
|
18455
|
+
if (expectedCurve[alg] && namedCurve === expectedCurve[alg]) {
|
|
18507
18456
|
cryptoKey = keyObject.toCryptoKey({
|
|
18508
18457
|
name: "ECDSA",
|
|
18509
18458
|
namedCurve
|
|
@@ -18517,7 +18466,7 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18517
18466
|
}
|
|
18518
18467
|
}
|
|
18519
18468
|
if (!cryptoKey) {
|
|
18520
|
-
throw new TypeError(
|
|
18469
|
+
throw new TypeError(unusableForAlg2);
|
|
18521
18470
|
}
|
|
18522
18471
|
if (!cached) {
|
|
18523
18472
|
cache2.set(keyObject, { [alg]: cryptoKey });
|
|
@@ -18525,7 +18474,7 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18525
18474
|
cached[alg] = cryptoKey;
|
|
18526
18475
|
}
|
|
18527
18476
|
return cryptoKey;
|
|
18528
|
-
}, init_normalize_key2, tag2 = (key) => key?.[Symbol.toStringTag], jwkMatchesOp2 = (alg, key, usage) => {
|
|
18477
|
+
}, init_normalize_key2, init_import2, init_validate_crit2, tag2 = (key) => key?.[Symbol.toStringTag], jwkMatchesOp2 = (alg, key, usage) => {
|
|
18529
18478
|
if (key.use !== undefined) {
|
|
18530
18479
|
let expected;
|
|
18531
18480
|
switch (usage) {
|
|
@@ -18626,7 +18575,7 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18626
18575
|
throw new TypeError(`${tag2(key)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
18627
18576
|
}
|
|
18628
18577
|
}
|
|
18629
|
-
}, init_check_key_type2
|
|
18578
|
+
}, init_check_key_type2 = () => {}, init_verify4, init_verify22, epoch2 = (date) => Math.floor(date.getTime() / 1000), minute2 = 60, hour2, day2, week2, year2, REGEX2, normalizeTyp2 = (value) => {
|
|
18630
18579
|
if (value.includes("/")) {
|
|
18631
18580
|
return value.toLowerCase();
|
|
18632
18581
|
}
|
|
@@ -18639,7 +18588,7 @@ var __defProp11, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
|
|
|
18639
18588
|
return audOption.some(Set.prototype.has.bind(new Set(audPayload)));
|
|
18640
18589
|
}
|
|
18641
18590
|
return false;
|
|
18642
|
-
}, init_jwt_claims_set2,
|
|
18591
|
+
}, 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 = `
|
|
18643
18592
|
CREATE VIRTUAL TABLE IF NOT EXISTS search_indexes USING fts5(
|
|
18644
18593
|
index_id UNINDEXED,
|
|
18645
18594
|
document_id UNINDEXED,
|
|
@@ -19702,8 +19651,8 @@ var init_dist = __esm(() => {
|
|
|
19702
19651
|
JOSEError2 = class JOSEError3 extends Error {
|
|
19703
19652
|
static code = "ERR_JOSE_GENERIC";
|
|
19704
19653
|
code = "ERR_JOSE_GENERIC";
|
|
19705
|
-
constructor(
|
|
19706
|
-
super(
|
|
19654
|
+
constructor(message22, options) {
|
|
19655
|
+
super(message22, options);
|
|
19707
19656
|
this.name = this.constructor.name;
|
|
19708
19657
|
Error.captureStackTrace?.(this, this.constructor);
|
|
19709
19658
|
}
|
|
@@ -19714,8 +19663,8 @@ var init_dist = __esm(() => {
|
|
|
19714
19663
|
claim;
|
|
19715
19664
|
reason;
|
|
19716
19665
|
payload;
|
|
19717
|
-
constructor(
|
|
19718
|
-
super(
|
|
19666
|
+
constructor(message22, payload, claim = "unspecified", reason = "unspecified") {
|
|
19667
|
+
super(message22, { cause: { claim, reason, payload } });
|
|
19719
19668
|
this.claim = claim;
|
|
19720
19669
|
this.reason = reason;
|
|
19721
19670
|
this.payload = payload;
|
|
@@ -19727,8 +19676,8 @@ var init_dist = __esm(() => {
|
|
|
19727
19676
|
claim;
|
|
19728
19677
|
reason;
|
|
19729
19678
|
payload;
|
|
19730
|
-
constructor(
|
|
19731
|
-
super(
|
|
19679
|
+
constructor(message22, payload, claim = "unspecified", reason = "unspecified") {
|
|
19680
|
+
super(message22, { cause: { claim, reason, payload } });
|
|
19732
19681
|
this.claim = claim;
|
|
19733
19682
|
this.reason = reason;
|
|
19734
19683
|
this.payload = payload;
|
|
@@ -19745,8 +19694,8 @@ var init_dist = __esm(() => {
|
|
|
19745
19694
|
JWEDecryptionFailed2 = class JWEDecryptionFailed3 extends JOSEError2 {
|
|
19746
19695
|
static code = "ERR_JWE_DECRYPTION_FAILED";
|
|
19747
19696
|
code = "ERR_JWE_DECRYPTION_FAILED";
|
|
19748
|
-
constructor(
|
|
19749
|
-
super(
|
|
19697
|
+
constructor(message22 = "decryption operation failed", options) {
|
|
19698
|
+
super(message22, options);
|
|
19750
19699
|
}
|
|
19751
19700
|
};
|
|
19752
19701
|
JWEInvalid2 = class JWEInvalid3 extends JOSEError2 {
|
|
@@ -19772,70 +19721,67 @@ var init_dist = __esm(() => {
|
|
|
19772
19721
|
JWKSNoMatchingKey2 = class JWKSNoMatchingKey3 extends JOSEError2 {
|
|
19773
19722
|
static code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
19774
19723
|
code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
19775
|
-
constructor(
|
|
19776
|
-
super(
|
|
19724
|
+
constructor(message22 = "no applicable key found in the JSON Web Key Set", options) {
|
|
19725
|
+
super(message22, options);
|
|
19777
19726
|
}
|
|
19778
19727
|
};
|
|
19779
19728
|
JWKSMultipleMatchingKeys2 = class JWKSMultipleMatchingKeys3 extends JOSEError2 {
|
|
19780
19729
|
[Symbol.asyncIterator];
|
|
19781
19730
|
static code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
19782
19731
|
code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
19783
|
-
constructor(
|
|
19784
|
-
super(
|
|
19732
|
+
constructor(message22 = "multiple matching keys found in the JSON Web Key Set", options) {
|
|
19733
|
+
super(message22, options);
|
|
19785
19734
|
}
|
|
19786
19735
|
};
|
|
19787
19736
|
JWKSTimeout2 = class JWKSTimeout3 extends JOSEError2 {
|
|
19788
19737
|
static code = "ERR_JWKS_TIMEOUT";
|
|
19789
19738
|
code = "ERR_JWKS_TIMEOUT";
|
|
19790
|
-
constructor(
|
|
19791
|
-
super(
|
|
19739
|
+
constructor(message22 = "request timed out", options) {
|
|
19740
|
+
super(message22, options);
|
|
19792
19741
|
}
|
|
19793
19742
|
};
|
|
19794
19743
|
JWSSignatureVerificationFailed2 = class JWSSignatureVerificationFailed3 extends JOSEError2 {
|
|
19795
19744
|
static code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
19796
19745
|
code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
19797
|
-
constructor(
|
|
19798
|
-
super(
|
|
19746
|
+
constructor(message22 = "signature verification failed", options) {
|
|
19747
|
+
super(message22, options);
|
|
19799
19748
|
}
|
|
19800
19749
|
};
|
|
19801
19750
|
});
|
|
19802
|
-
|
|
19803
|
-
init_errors22();
|
|
19804
|
-
});
|
|
19805
|
-
init_import2 = __esm2(() => {
|
|
19751
|
+
init_helpers2 = __esm2(() => {
|
|
19806
19752
|
init_base64url2();
|
|
19807
|
-
|
|
19753
|
+
unprotected2 = Symbol();
|
|
19754
|
+
});
|
|
19755
|
+
init_signing2 = __esm2(() => {
|
|
19808
19756
|
init_errors22();
|
|
19809
19757
|
});
|
|
19810
|
-
|
|
19758
|
+
init_jwk_to_key2 = __esm2(() => {
|
|
19811
19759
|
init_errors22();
|
|
19812
19760
|
});
|
|
19813
19761
|
init_normalize_key2 = __esm2(() => {
|
|
19814
|
-
init_is_jwk2();
|
|
19815
19762
|
init_base64url2();
|
|
19816
19763
|
init_jwk_to_key2();
|
|
19817
19764
|
});
|
|
19818
|
-
|
|
19819
|
-
|
|
19820
|
-
|
|
19821
|
-
init_subtle_dsa2 = __esm2(() => {
|
|
19765
|
+
init_import2 = __esm2(() => {
|
|
19766
|
+
init_base64url2();
|
|
19767
|
+
init_jwk_to_key2();
|
|
19822
19768
|
init_errors22();
|
|
19823
19769
|
});
|
|
19824
|
-
|
|
19825
|
-
|
|
19826
|
-
init_get_sign_verify_key2();
|
|
19770
|
+
init_validate_crit2 = __esm2(() => {
|
|
19771
|
+
init_errors22();
|
|
19827
19772
|
});
|
|
19828
|
-
|
|
19773
|
+
init_verify4 = __esm2(() => {
|
|
19829
19774
|
init_base64url2();
|
|
19830
|
-
|
|
19775
|
+
init_signing2();
|
|
19831
19776
|
init_errors22();
|
|
19832
19777
|
init_buffer_utils2();
|
|
19778
|
+
init_helpers2();
|
|
19833
19779
|
init_check_key_type2();
|
|
19834
19780
|
init_validate_crit2();
|
|
19835
19781
|
init_normalize_key2();
|
|
19836
19782
|
});
|
|
19837
|
-
|
|
19838
|
-
|
|
19783
|
+
init_verify22 = __esm2(() => {
|
|
19784
|
+
init_verify4();
|
|
19839
19785
|
init_errors22();
|
|
19840
19786
|
init_buffer_utils2();
|
|
19841
19787
|
});
|
|
@@ -19848,8 +19794,8 @@ var init_dist = __esm(() => {
|
|
|
19848
19794
|
year2 = day2 * 365.25;
|
|
19849
19795
|
REGEX2 = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;
|
|
19850
19796
|
});
|
|
19851
|
-
|
|
19852
|
-
|
|
19797
|
+
init_verify32 = __esm2(() => {
|
|
19798
|
+
init_verify22();
|
|
19853
19799
|
init_jwt_claims_set2();
|
|
19854
19800
|
init_errors22();
|
|
19855
19801
|
});
|
|
@@ -19862,14 +19808,14 @@ var init_dist = __esm(() => {
|
|
|
19862
19808
|
init_local2();
|
|
19863
19809
|
if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
|
|
19864
19810
|
const NAME = "jose";
|
|
19865
|
-
const VERSION = "v6.1
|
|
19811
|
+
const VERSION = "v6.2.1";
|
|
19866
19812
|
USER_AGENT2 = `${NAME}/${VERSION}`;
|
|
19867
19813
|
}
|
|
19868
19814
|
customFetch2 = Symbol();
|
|
19869
19815
|
jwksCache2 = Symbol();
|
|
19870
19816
|
});
|
|
19871
19817
|
init_webapi2 = __esm2(() => {
|
|
19872
|
-
|
|
19818
|
+
init_verify32();
|
|
19873
19819
|
init_local2();
|
|
19874
19820
|
init_remote2();
|
|
19875
19821
|
init_errors22();
|
|
@@ -25970,6 +25916,27 @@ function notFoundHttpResponse() {
|
|
|
25970
25916
|
}
|
|
25971
25917
|
});
|
|
25972
25918
|
}
|
|
25919
|
+
function isMissingModuleError(error, moduleName) {
|
|
25920
|
+
if (!error) {
|
|
25921
|
+
return false;
|
|
25922
|
+
}
|
|
25923
|
+
const errorString = String(error);
|
|
25924
|
+
const moduleSpecifiers = [moduleName, `convex/${moduleName}`];
|
|
25925
|
+
const hasDirectMissingMessage = moduleSpecifiers.some((specifier) => errorString.includes(`Module not found: ${specifier}`));
|
|
25926
|
+
if (hasDirectMissingMessage || errorString.toLowerCase().includes("failed to load convex module")) {
|
|
25927
|
+
return true;
|
|
25928
|
+
}
|
|
25929
|
+
const hasResolutionMessage = moduleSpecifiers.some((specifier) => errorString.includes(`Unable to resolve module "${specifier}"`));
|
|
25930
|
+
const causes = error.causes;
|
|
25931
|
+
if (Array.isArray(causes) && causes.length > 0) {
|
|
25932
|
+
return hasResolutionMessage ? causes.every((cause2) => isMissingModuleError(cause2, moduleName)) : causes.some((cause2) => isMissingModuleError(cause2, moduleName));
|
|
25933
|
+
}
|
|
25934
|
+
const cause = error.cause;
|
|
25935
|
+
if (cause) {
|
|
25936
|
+
return isMissingModuleError(cause, moduleName);
|
|
25937
|
+
}
|
|
25938
|
+
return hasResolutionMessage;
|
|
25939
|
+
}
|
|
25973
25940
|
function getHttpRouteRank(routePath) {
|
|
25974
25941
|
if (routePath.endsWith("*")) {
|
|
25975
25942
|
return { kind: 0, length: routePath.length - 1 };
|
|
@@ -26141,8 +26108,7 @@ class InlineUdfExecutor {
|
|
|
26141
26108
|
try {
|
|
26142
26109
|
return await loadConvexModule(moduleName, { componentPath });
|
|
26143
26110
|
} catch (error) {
|
|
26144
|
-
|
|
26145
|
-
if (message2 && (message2.includes("module not found") || message2.includes("failed to load convex module"))) {
|
|
26111
|
+
if (isMissingModuleError(error, moduleName)) {
|
|
26146
26112
|
throw new Error(`UDF module not found: ${moduleName}`);
|
|
26147
26113
|
}
|
|
26148
26114
|
throw error;
|