jose 6.2.11 → 6.2.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/README.md +2 -2
- package/dist/types/index.d.ts +1 -2
- package/dist/types/jwe/compact/decrypt.d.ts +9 -12
- package/dist/types/jwe/compact/encrypt.d.ts +14 -17
- package/dist/types/jwe/flattened/decrypt.d.ts +9 -12
- package/dist/types/jwe/flattened/encrypt.d.ts +17 -20
- package/dist/types/jwe/general/decrypt.d.ts +12 -17
- package/dist/types/jwe/general/encrypt.d.ts +19 -22
- package/dist/types/jwk/embedded.d.ts +3 -1
- package/dist/types/jwk/thumbprint.d.ts +4 -6
- package/dist/types/jwks/local.d.ts +5 -4
- package/dist/types/jwks/remote.d.ts +20 -21
- package/dist/types/jws/compact/sign.d.ts +7 -6
- package/dist/types/jws/compact/verify.d.ts +9 -12
- package/dist/types/jws/flattened/sign.d.ts +8 -7
- package/dist/types/jws/flattened/verify.d.ts +10 -12
- package/dist/types/jws/general/sign.d.ts +16 -17
- package/dist/types/jws/general/verify.d.ts +14 -18
- package/dist/types/jwt/decrypt.d.ts +15 -11
- package/dist/types/jwt/encrypt.d.ts +25 -23
- package/dist/types/jwt/sign.d.ts +4 -8
- package/dist/types/jwt/unsecured.d.ts +3 -7
- package/dist/types/jwt/verify.d.ts +12 -7
- package/dist/types/key/export.d.ts +6 -6
- package/dist/types/key/generate_key_pair.d.ts +9 -14
- package/dist/types/key/generate_secret.d.ts +10 -10
- package/dist/types/key/import.d.ts +21 -20
- package/dist/types/types.d.ts +217 -254
- package/dist/types/util/base64url.d.ts +7 -7
- package/dist/types/util/decode_jwt.d.ts +6 -1
- package/dist/types/util/decode_protected_header.d.ts +4 -3
- package/dist/types/util/errors.d.ts +30 -41
- package/dist/webapi/jwe/compact/decrypt.js +1 -2
- package/dist/webapi/jwe/compact/encrypt.js +9 -26
- package/dist/webapi/jwe/flattened/decrypt.js +3 -3
- package/dist/webapi/jwe/flattened/encrypt.js +11 -30
- package/dist/webapi/jwe/general/decrypt.js +6 -6
- package/dist/webapi/jwe/general/encrypt.js +36 -60
- package/dist/webapi/jwk/embedded.js +3 -4
- package/dist/webapi/jwk/thumbprint.js +11 -14
- package/dist/webapi/jwks/local.js +18 -11
- package/dist/webapi/jwks/remote.js +5 -5
- package/dist/webapi/jws/compact/sign.js +2 -4
- package/dist/webapi/jws/compact/verify.js +2 -2
- package/dist/webapi/jws/flattened/sign.js +8 -15
- package/dist/webapi/jws/flattened/verify.js +4 -14
- package/dist/webapi/jws/general/sign.js +6 -13
- package/dist/webapi/jws/general/verify.js +8 -10
- package/dist/webapi/jwt/decrypt.js +2 -3
- package/dist/webapi/jwt/encrypt.js +13 -27
- package/dist/webapi/jwt/sign.js +3 -3
- package/dist/webapi/jwt/unsecured.js +4 -5
- package/dist/webapi/jwt/verify.js +4 -4
- package/dist/webapi/key/export.js +12 -16
- package/dist/webapi/key/generate_key_pair.js +4 -13
- package/dist/webapi/key/generate_secret.js +5 -5
- package/dist/webapi/key/import.js +5 -9
- package/dist/webapi/lib/asn1.js +4 -6
- package/dist/webapi/lib/buffer_utils.js +39 -4
- package/dist/webapi/lib/content_encryption.js +29 -37
- package/dist/webapi/lib/deflate.js +9 -19
- package/dist/webapi/lib/jwe_algorithms.js +0 -4
- package/dist/webapi/lib/jwe_decrypt.js +30 -63
- package/dist/webapi/lib/jwe_encrypt.js +27 -60
- package/dist/webapi/lib/jws_algorithms.js +2 -2
- package/dist/webapi/lib/jws_sign.js +31 -45
- package/dist/webapi/lib/jws_verify.js +43 -48
- package/dist/webapi/lib/jwt_claims_set.js +45 -44
- package/dist/webapi/lib/key.js +122 -62
- package/dist/webapi/lib/key_management.js +57 -92
- package/dist/webapi/lib/{options.js → validate.js} +64 -3
- package/dist/webapi/util/base64url.js +5 -19
- package/dist/webapi/util/decode_jwt.js +13 -13
- package/dist/webapi/util/decode_protected_header.js +6 -6
- package/package.json +1 -1
- package/dist/webapi/lib/base64.js +0 -20
- package/dist/webapi/lib/crypto_key.js +0 -27
- package/dist/webapi/lib/helpers.js +0 -45
- package/dist/webapi/lib/invalid_key_input.js +0 -12
- package/dist/webapi/lib/is_key_like.js +0 -19
- package/dist/webapi/lib/jwk_metadata.js +0 -19
- package/dist/webapi/lib/jwk_to_key.js +0 -10
- package/dist/webapi/lib/key_options.js +0 -8
- package/dist/webapi/lib/signing.js +0 -22
- package/dist/webapi/lib/type_checks.js +0 -30
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { checkCryptoKey, checkModulusLength } from "./crypto_key.js";
|
|
2
|
-
async function getSigKey(entry, key, usage) {
|
|
3
|
-
return key instanceof Uint8Array ? crypto.subtle.importKey("raw", key, entry.subtle, !1, [
|
|
4
|
-
usage
|
|
5
|
-
]) : (checkCryptoKey(key, entry.subtle, usage), entry.minRsaBits && checkModulusLength(entry.alg, key), key);
|
|
6
|
-
}
|
|
7
|
-
async function sign(entry, key, data) {
|
|
8
|
-
const cryptoKey = await getSigKey(entry, key, "sign"), signature = await crypto.subtle.sign(entry.signing, cryptoKey, data);
|
|
9
|
-
return new Uint8Array(signature);
|
|
10
|
-
}
|
|
11
|
-
async function verify(entry, key, signature, data) {
|
|
12
|
-
const cryptoKey = await getSigKey(entry, key, "verify");
|
|
13
|
-
try {
|
|
14
|
-
return await crypto.subtle.verify(entry.signing, cryptoKey, signature, data);
|
|
15
|
-
} catch {
|
|
16
|
-
return !1;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
sign,
|
|
21
|
-
verify
|
|
22
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
function assertUint8Array(input, label) {
|
|
2
|
-
if (!(input instanceof Uint8Array))
|
|
3
|
-
throw new TypeError(`${label} must be an instance of Uint8Array`);
|
|
4
|
-
}
|
|
5
|
-
function isObject(input) {
|
|
6
|
-
if (typeof input != "object" || input === null || Object.prototype.toString.call(input) !== "[object Object]")
|
|
7
|
-
return !1;
|
|
8
|
-
const prototype = Object.getPrototypeOf(input);
|
|
9
|
-
return prototype === null || Object.getPrototypeOf(prototype) === null;
|
|
10
|
-
}
|
|
11
|
-
function isJwkSet(input) {
|
|
12
|
-
return isObject(input) && Array.isArray(input.keys) && Array.from(input.keys).every(isObject);
|
|
13
|
-
}
|
|
14
|
-
function isDisjoint(...headers) {
|
|
15
|
-
const parameters = /* @__PURE__ */ new Set();
|
|
16
|
-
for (const header of headers)
|
|
17
|
-
if (header)
|
|
18
|
-
for (const parameter of Object.keys(header)) {
|
|
19
|
-
if (parameters.has(parameter))
|
|
20
|
-
return !1;
|
|
21
|
-
parameters.add(parameter);
|
|
22
|
-
}
|
|
23
|
-
return !0;
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
assertUint8Array,
|
|
27
|
-
isDisjoint,
|
|
28
|
-
isJwkSet,
|
|
29
|
-
isObject
|
|
30
|
-
};
|