jose 6.2.9 → 6.2.10
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/types/jwks/remote.d.ts +4 -4
- package/dist/types/jws/general/verify.d.ts +3 -3
- package/dist/types/jwt/encrypt.d.ts +8 -14
- package/dist/types/jwt/sign.d.ts +8 -14
- package/dist/types/jwt/unsecured.d.ts +9 -15
- package/dist/webapi/jwe/compact/encrypt.js +30 -8
- package/dist/webapi/jwe/flattened/decrypt.js +8 -4
- package/dist/webapi/jwe/flattened/encrypt.js +6 -13
- package/dist/webapi/jwe/general/decrypt.js +19 -19
- package/dist/webapi/jwe/general/encrypt.js +27 -20
- package/dist/webapi/jwk/embedded.js +15 -1
- package/dist/webapi/jwk/thumbprint.js +11 -5
- package/dist/webapi/jwks/local.js +45 -53
- package/dist/webapi/jwks/remote.js +82 -103
- package/dist/webapi/jws/compact/sign.js +10 -9
- package/dist/webapi/jws/flattened/sign.js +2 -1
- package/dist/webapi/jws/flattened/verify.js +8 -7
- package/dist/webapi/jws/general/sign.js +5 -3
- package/dist/webapi/jws/general/verify.js +51 -21
- package/dist/webapi/jwt/decrypt.js +7 -9
- package/dist/webapi/jwt/encrypt.js +21 -50
- package/dist/webapi/jwt/sign.js +8 -41
- package/dist/webapi/jwt/unsecured.js +21 -42
- package/dist/webapi/key/generate_key_pair.js +6 -2
- package/dist/webapi/key/generate_secret.js +7 -6
- package/dist/webapi/key/import.js +16 -12
- package/dist/webapi/lib/asn1.js +7 -2
- package/dist/webapi/lib/content_encryption.js +7 -15
- package/dist/webapi/lib/deflate.js +8 -0
- package/dist/webapi/lib/helpers.js +1 -1
- package/dist/webapi/lib/jwe_decrypt.js +85 -28
- package/dist/webapi/lib/jwe_encrypt.js +40 -12
- package/dist/webapi/lib/jwk_metadata.js +20 -0
- package/dist/webapi/lib/jws_sign.js +47 -36
- package/dist/webapi/lib/jws_verify.js +77 -45
- package/dist/webapi/lib/jwt_claims_set.js +82 -47
- package/dist/webapi/lib/key.js +24 -9
- package/dist/webapi/lib/key_management.js +10 -4
- package/dist/webapi/lib/key_options.js +6 -0
- package/dist/webapi/lib/options.js +26 -0
- package/dist/webapi/lib/type_checks.js +11 -13
- package/package.json +1 -1
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export function assertUint8Array(input, label) {
|
|
2
|
+
if (!(input instanceof Uint8Array)) {
|
|
3
|
+
throw new TypeError(`${label} must be an instance of Uint8Array`);
|
|
4
|
+
}
|
|
5
|
+
}
|
|
1
6
|
export function isObject(input) {
|
|
2
7
|
if (typeof input !== 'object' ||
|
|
3
8
|
input === null ||
|
|
@@ -5,14 +10,12 @@ export function isObject(input) {
|
|
|
5
10
|
return false;
|
|
6
11
|
}
|
|
7
12
|
const prototype = Object.getPrototypeOf(input);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
return prototype === proto;
|
|
13
|
+
return prototype === null || Object.getPrototypeOf(prototype) === null;
|
|
14
|
+
}
|
|
15
|
+
export function isJwkSet(input) {
|
|
16
|
+
return (isObject(input) &&
|
|
17
|
+
Array.isArray(input.keys) &&
|
|
18
|
+
Array.from(input.keys).every(isObject));
|
|
16
19
|
}
|
|
17
20
|
export function isDisjoint(...headers) {
|
|
18
21
|
const parameters = new Set();
|
|
@@ -28,8 +31,3 @@ export function isDisjoint(...headers) {
|
|
|
28
31
|
}
|
|
29
32
|
return true;
|
|
30
33
|
}
|
|
31
|
-
export const isJWK = (key) => isObject(key) && typeof key.kty === 'string';
|
|
32
|
-
export const isPrivateJWK = (key) => key.kty !== 'oct' &&
|
|
33
|
-
((key.kty === 'AKP' && typeof key.priv === 'string') || typeof key.d === 'string');
|
|
34
|
-
export const isPublicJWK = (key) => key.kty !== 'oct' && key.d === undefined && key.priv === undefined;
|
|
35
|
-
export const isSecretJWK = (key) => key.kty === 'oct' && typeof key.k === 'string';
|