jose 3.16.0 → 3.19.0
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 +22 -114
- package/dist/browser/jwe/compact/decrypt.js +5 -1
- package/dist/browser/jwe/flattened/decrypt.js +10 -5
- package/dist/browser/jwe/flattened/encrypt.js +5 -2
- package/dist/browser/jwk/embedded.js +2 -2
- package/dist/browser/jwk/from_key_like.js +2 -2
- package/dist/browser/jwk/parse.js +2 -31
- package/dist/browser/jwk/thumbprint.js +1 -1
- package/dist/browser/jwks/remote.js +2 -2
- package/dist/browser/jws/compact/verify.js +5 -1
- package/dist/browser/jws/flattened/sign.js +5 -2
- package/dist/browser/jws/flattened/verify.js +7 -2
- package/dist/browser/jwt/decrypt.js +5 -1
- package/dist/browser/jwt/unsecured.js +1 -1
- package/dist/browser/jwt/verify.js +5 -1
- package/dist/browser/key/export.js +12 -0
- package/dist/browser/key/import.js +119 -0
- package/dist/browser/lib/decrypt_key_management.js +4 -4
- package/dist/browser/lib/encrypt_key_management.js +3 -3
- package/dist/browser/lib/format_pem.js +4 -0
- package/dist/browser/runtime/aeskw.js +1 -1
- package/dist/browser/runtime/asn1.js +119 -0
- package/dist/browser/runtime/base64url.js +12 -7
- package/dist/browser/runtime/decrypt.js +1 -1
- package/dist/browser/runtime/encrypt.js +1 -1
- package/dist/browser/runtime/fetch_jwks.js +2 -2
- package/dist/browser/runtime/generate.js +18 -2
- package/dist/browser/runtime/global.js +17 -0
- package/dist/browser/runtime/jwk_to_key.js +29 -5
- package/dist/browser/runtime/sign.js +1 -1
- package/dist/browser/runtime/subtle_dsa.js +4 -1
- package/dist/browser/runtime/verify.js +1 -1
- package/dist/node/cjs/jwe/compact/decrypt.js +5 -1
- package/dist/node/cjs/jwe/flattened/decrypt.js +10 -5
- package/dist/node/cjs/jwe/flattened/encrypt.js +5 -2
- package/dist/node/cjs/jwk/embedded.js +2 -2
- package/dist/node/cjs/jwk/from_key_like.js +2 -2
- package/dist/node/cjs/jwk/parse.js +2 -31
- package/dist/node/cjs/jwk/thumbprint.js +1 -1
- package/dist/node/cjs/jwks/remote.js +2 -2
- package/dist/node/cjs/jws/compact/verify.js +5 -1
- package/dist/node/cjs/jws/flattened/sign.js +5 -2
- package/dist/node/cjs/jws/flattened/verify.js +7 -2
- package/dist/node/cjs/jwt/decrypt.js +5 -1
- package/dist/node/cjs/jwt/unsecured.js +1 -1
- package/dist/node/cjs/jwt/verify.js +5 -1
- package/dist/node/cjs/key/export.js +18 -0
- package/dist/node/cjs/key/import.js +126 -0
- package/dist/node/cjs/lib/decrypt_key_management.js +4 -4
- package/dist/node/cjs/lib/encrypt_key_management.js +3 -3
- package/dist/node/cjs/lib/format_pem.js +6 -0
- package/dist/node/cjs/runtime/aeskw.js +1 -1
- package/dist/node/cjs/runtime/asn1.js +46 -0
- package/dist/node/cjs/runtime/asn1_sequence_encoder.js +1 -1
- package/dist/node/cjs/runtime/base64url.js +5 -1
- package/dist/node/cjs/runtime/decrypt.js +1 -1
- package/dist/node/cjs/runtime/ecdhes.js +28 -16
- package/dist/node/cjs/runtime/encrypt.js +1 -1
- package/dist/node/cjs/runtime/generate.js +2 -2
- package/dist/node/cjs/runtime/get_named_curve.js +12 -8
- package/dist/node/cjs/runtime/is_key_object.js +3 -12
- package/dist/node/cjs/runtime/jwk_to_key.js +1 -1
- package/dist/node/cjs/runtime/key_to_jwk.js +3 -3
- package/dist/node/cjs/runtime/webcrypto.js +12 -18
- package/dist/node/esm/jwe/compact/decrypt.js +5 -1
- package/dist/node/esm/jwe/flattened/decrypt.js +10 -5
- package/dist/node/esm/jwe/flattened/encrypt.js +5 -2
- package/dist/node/esm/jwk/embedded.js +2 -2
- package/dist/node/esm/jwk/from_key_like.js +2 -2
- package/dist/node/esm/jwk/parse.js +2 -31
- package/dist/node/esm/jwk/thumbprint.js +1 -1
- package/dist/node/esm/jwks/remote.js +2 -2
- package/dist/node/esm/jws/compact/verify.js +5 -1
- package/dist/node/esm/jws/flattened/sign.js +5 -2
- package/dist/node/esm/jws/flattened/verify.js +7 -2
- package/dist/node/esm/jwt/decrypt.js +5 -1
- package/dist/node/esm/jwt/unsecured.js +1 -1
- package/dist/node/esm/jwt/verify.js +5 -1
- package/dist/node/esm/key/export.js +12 -0
- package/dist/node/esm/key/import.js +119 -0
- package/dist/node/esm/lib/decrypt_key_management.js +4 -4
- package/dist/node/esm/lib/encrypt_key_management.js +3 -3
- package/dist/node/esm/lib/format_pem.js +4 -0
- package/dist/node/esm/runtime/aeskw.js +1 -1
- package/dist/node/esm/runtime/asn1.js +39 -0
- package/dist/node/esm/runtime/asn1_sequence_encoder.js +1 -1
- package/dist/node/esm/runtime/base64url.js +2 -0
- package/dist/node/esm/runtime/decrypt.js +1 -1
- package/dist/node/esm/runtime/ecdhes.js +28 -16
- package/dist/node/esm/runtime/encrypt.js +1 -1
- package/dist/node/esm/runtime/generate.js +2 -2
- package/dist/node/esm/runtime/get_named_curve.js +12 -8
- package/dist/node/esm/runtime/is_key_object.js +3 -12
- package/dist/node/esm/runtime/jwk_to_key.js +1 -1
- package/dist/node/esm/runtime/key_to_jwk.js +3 -3
- package/dist/node/esm/runtime/webcrypto.js +12 -18
- package/dist/types/jwe/compact/decrypt.d.ts +3 -2
- package/dist/types/jwe/flattened/decrypt.d.ts +3 -2
- package/dist/types/jwe/general/decrypt.d.ts +3 -2
- package/dist/types/jws/compact/verify.d.ts +3 -2
- package/dist/types/jws/flattened/verify.d.ts +3 -2
- package/dist/types/jws/general/verify.d.ts +3 -2
- package/dist/types/jwt/decrypt.d.ts +3 -2
- package/dist/types/jwt/verify.d.ts +3 -2
- package/dist/types/key/export.d.ts +5 -0
- package/dist/types/key/import.d.ts +9 -0
- package/dist/types/types.d.ts +3 -0
- package/package.json +18 -115
|
@@ -17,18 +17,22 @@ const namedCurveToJOSE = (namedCurve) => {
|
|
|
17
17
|
case 'secp521r1':
|
|
18
18
|
return 'P-521';
|
|
19
19
|
case 'secp256k1':
|
|
20
|
-
return
|
|
20
|
+
return 'secp256k1';
|
|
21
21
|
default:
|
|
22
|
-
throw new JOSENotSupported('
|
|
22
|
+
throw new JOSENotSupported('Unsupported key curve for this operation');
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const getNamedCurve = (
|
|
25
|
+
const getNamedCurve = (kee, raw) => {
|
|
26
26
|
var _a;
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
let key;
|
|
28
|
+
if (isCryptoKey(kee)) {
|
|
29
|
+
key = getKeyObject(kee);
|
|
29
30
|
}
|
|
30
|
-
if (
|
|
31
|
-
|
|
31
|
+
else if (isKeyObject(kee)) {
|
|
32
|
+
key = kee;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
throw new TypeError(invalidKeyInput(kee, 'KeyObject', 'CryptoKey'));
|
|
32
36
|
}
|
|
33
37
|
if (key.type === 'secret') {
|
|
34
38
|
throw new TypeError('only "private" or "public" type keys can be used for this operation');
|
|
@@ -66,7 +70,7 @@ const getNamedCurve = (key, raw) => {
|
|
|
66
70
|
namedCurve = 'secp256k1';
|
|
67
71
|
}
|
|
68
72
|
else {
|
|
69
|
-
throw new JOSENotSupported('
|
|
73
|
+
throw new JOSENotSupported('Unsupported key curve for this operation');
|
|
70
74
|
}
|
|
71
75
|
}
|
|
72
76
|
if (raw)
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import { KeyObject } from 'crypto';
|
|
2
2
|
import * as util from 'util';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return util.types.isKeyObject(obj);
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
impl = function isKeyObject(obj) {
|
|
11
|
-
return obj != null && obj instanceof KeyObject;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export default impl;
|
|
3
|
+
export default util.types.isKeyObject
|
|
4
|
+
? (obj) => util.types.isKeyObject(obj)
|
|
5
|
+
: (obj) => obj != null && obj instanceof KeyObject;
|
|
@@ -113,7 +113,7 @@ const parse = (jwk) => {
|
|
|
113
113
|
return createPublicKey({ key: der, format: 'der', type: 'spki' });
|
|
114
114
|
}
|
|
115
115
|
default:
|
|
116
|
-
throw new JOSENotSupported('
|
|
116
|
+
throw new JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
119
|
export default parse;
|
|
@@ -92,7 +92,7 @@ const keyToJWK = (key) => {
|
|
|
92
92
|
correction = -3;
|
|
93
93
|
break;
|
|
94
94
|
default:
|
|
95
|
-
throw new JOSENotSupported('
|
|
95
|
+
throw new JOSENotSupported('Unsupported curve');
|
|
96
96
|
}
|
|
97
97
|
if (keyObject.type === 'public') {
|
|
98
98
|
const der = keyObject.export({ type: 'spki', format: 'der' });
|
|
@@ -147,11 +147,11 @@ const keyToJWK = (key) => {
|
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
149
|
default:
|
|
150
|
-
throw new JOSENotSupported('
|
|
150
|
+
throw new JOSENotSupported('Unsupported key asymmetricKeyType');
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
default:
|
|
154
|
-
throw new JOSENotSupported('
|
|
154
|
+
throw new JOSENotSupported('Unsupported key type');
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
157
|
export default keyToJWK;
|
|
@@ -2,21 +2,10 @@ import * as crypto from 'crypto';
|
|
|
2
2
|
import * as util from 'util';
|
|
3
3
|
const webcrypto = crypto.webcrypto;
|
|
4
4
|
export default webcrypto;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
else if (webcrypto) {
|
|
12
|
-
impl = function isCryptoKey(obj) {
|
|
13
|
-
return obj != null && obj instanceof webcrypto.CryptoKey;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
impl = (obj) => false;
|
|
18
|
-
}
|
|
19
|
-
export { impl as isCryptoKey };
|
|
5
|
+
export const isCryptoKey = util.types.isCryptoKey
|
|
6
|
+
? (obj) => util.types.isCryptoKey(obj)
|
|
7
|
+
:
|
|
8
|
+
(obj) => false;
|
|
20
9
|
function getHashLength(hash) {
|
|
21
10
|
return parseInt(hash === null || hash === void 0 ? void 0 : hash.name.substr(4), 10);
|
|
22
11
|
}
|
|
@@ -31,10 +20,9 @@ function getNamedCurve(alg) {
|
|
|
31
20
|
}
|
|
32
21
|
}
|
|
33
22
|
export function getKeyObject(key, alg, usage) {
|
|
34
|
-
if (!alg) {
|
|
35
|
-
return crypto.KeyObject.from(key);
|
|
36
|
-
}
|
|
37
23
|
switch (alg) {
|
|
24
|
+
case undefined:
|
|
25
|
+
break;
|
|
38
26
|
case 'HS256':
|
|
39
27
|
case 'HS384':
|
|
40
28
|
case 'HS512': {
|
|
@@ -74,6 +62,12 @@ export function getKeyObject(key, alg, usage) {
|
|
|
74
62
|
}
|
|
75
63
|
break;
|
|
76
64
|
}
|
|
65
|
+
case 'EdDSA': {
|
|
66
|
+
if (key.algorithm.name !== 'NODE-ED25519' && key.algorithm.name !== 'NODE-ED448') {
|
|
67
|
+
throw new TypeError(`CryptoKey does not support this operation, its algorithm.name must be NODE-ED25519 or NODE-ED448.`);
|
|
68
|
+
}
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
77
71
|
case 'ES256':
|
|
78
72
|
case 'ES384':
|
|
79
73
|
case 'ES512': {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { KeyLike, DecryptOptions, JWEHeaderParameters, GetKeyFunction, FlattenedJWE, CompactDecryptResult } from '../../types';
|
|
1
|
+
import type { KeyLike, DecryptOptions, JWEHeaderParameters, GetKeyFunction, FlattenedJWE, CompactDecryptResult, ResolvedKey } from '../../types';
|
|
2
2
|
export interface CompactDecryptGetKey extends GetKeyFunction<JWEHeaderParameters, FlattenedJWE> {
|
|
3
3
|
}
|
|
4
|
-
declare function compactDecrypt(jwe: string | Uint8Array, key: KeyLike
|
|
4
|
+
declare function compactDecrypt(jwe: string | Uint8Array, key: KeyLike, options?: DecryptOptions): Promise<CompactDecryptResult>;
|
|
5
|
+
declare function compactDecrypt(jwe: string | Uint8Array, getKey: CompactDecryptGetKey, options?: DecryptOptions): Promise<CompactDecryptResult & ResolvedKey>;
|
|
5
6
|
export { compactDecrypt };
|
|
6
7
|
export default compactDecrypt;
|
|
7
8
|
export type { KeyLike, DecryptOptions, CompactDecryptResult };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { FlattenedDecryptResult, KeyLike, FlattenedJWE, JWEHeaderParameters, DecryptOptions, GetKeyFunction } from '../../types';
|
|
1
|
+
import type { FlattenedDecryptResult, KeyLike, FlattenedJWE, JWEHeaderParameters, DecryptOptions, GetKeyFunction, ResolvedKey } from '../../types';
|
|
2
2
|
export interface FlattenedDecryptGetKey extends GetKeyFunction<JWEHeaderParameters | undefined, FlattenedJWE> {
|
|
3
3
|
}
|
|
4
|
-
declare function flattenedDecrypt(jwe: FlattenedJWE, key: KeyLike
|
|
4
|
+
declare function flattenedDecrypt(jwe: FlattenedJWE, key: KeyLike, options?: DecryptOptions): Promise<FlattenedDecryptResult>;
|
|
5
|
+
declare function flattenedDecrypt(jwe: FlattenedJWE, getKey: FlattenedDecryptGetKey, options?: DecryptOptions): Promise<FlattenedDecryptResult & ResolvedKey>;
|
|
5
6
|
export { flattenedDecrypt };
|
|
6
7
|
export default flattenedDecrypt;
|
|
7
8
|
export type { KeyLike, FlattenedJWE, JWEHeaderParameters, DecryptOptions, FlattenedDecryptResult };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { KeyLike, DecryptOptions, JWEHeaderParameters, GetKeyFunction, FlattenedJWE, GeneralJWE, GeneralDecryptResult } from '../../types';
|
|
1
|
+
import type { KeyLike, DecryptOptions, JWEHeaderParameters, GetKeyFunction, FlattenedJWE, GeneralJWE, GeneralDecryptResult, ResolvedKey } from '../../types';
|
|
2
2
|
export interface GeneralDecryptGetKey extends GetKeyFunction<JWEHeaderParameters, FlattenedJWE> {
|
|
3
3
|
}
|
|
4
|
-
declare function generalDecrypt(jwe: GeneralJWE, key: KeyLike
|
|
4
|
+
declare function generalDecrypt(jwe: GeneralJWE, key: KeyLike, options?: DecryptOptions): Promise<GeneralDecryptResult>;
|
|
5
|
+
declare function generalDecrypt(jwe: GeneralJWE, getKey: GeneralDecryptGetKey, options?: DecryptOptions): Promise<GeneralDecryptResult & ResolvedKey>;
|
|
5
6
|
export { generalDecrypt };
|
|
6
7
|
export default generalDecrypt;
|
|
7
8
|
export type { KeyLike, GeneralJWE, DecryptOptions, GeneralDecryptResult };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { CompactVerifyResult, FlattenedJWSInput, GetKeyFunction, JWSHeaderParameters, KeyLike, VerifyOptions } from '../../types';
|
|
1
|
+
import type { CompactVerifyResult, FlattenedJWSInput, GetKeyFunction, JWSHeaderParameters, KeyLike, VerifyOptions, ResolvedKey } from '../../types';
|
|
2
2
|
export interface CompactVerifyGetKey extends GetKeyFunction<JWSHeaderParameters, FlattenedJWSInput> {
|
|
3
3
|
}
|
|
4
|
-
declare function compactVerify(jws: string | Uint8Array, key: KeyLike
|
|
4
|
+
declare function compactVerify(jws: string | Uint8Array, key: KeyLike, options?: VerifyOptions): Promise<CompactVerifyResult>;
|
|
5
|
+
declare function compactVerify(jws: string | Uint8Array, getKey: CompactVerifyGetKey, options?: VerifyOptions): Promise<CompactVerifyResult & ResolvedKey>;
|
|
5
6
|
export { compactVerify };
|
|
6
7
|
export default compactVerify;
|
|
7
8
|
export type { KeyLike, VerifyOptions, CompactVerifyResult };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { FlattenedVerifyResult, KeyLike, FlattenedJWSInput, JWSHeaderParameters, VerifyOptions, GetKeyFunction } from '../../types';
|
|
1
|
+
import type { FlattenedVerifyResult, KeyLike, FlattenedJWSInput, JWSHeaderParameters, VerifyOptions, GetKeyFunction, ResolvedKey } from '../../types';
|
|
2
2
|
export interface FlattenedVerifyGetKey extends GetKeyFunction<JWSHeaderParameters | undefined, FlattenedJWSInput> {
|
|
3
3
|
}
|
|
4
|
-
declare function flattenedVerify(jws: FlattenedJWSInput, key: KeyLike
|
|
4
|
+
declare function flattenedVerify(jws: FlattenedJWSInput, key: KeyLike, options?: VerifyOptions): Promise<FlattenedVerifyResult>;
|
|
5
|
+
declare function flattenedVerify(jws: FlattenedJWSInput, getKey: FlattenedVerifyGetKey, options?: VerifyOptions): Promise<FlattenedVerifyResult & ResolvedKey>;
|
|
5
6
|
export { flattenedVerify };
|
|
6
7
|
export default flattenedVerify;
|
|
7
8
|
export type { KeyLike, FlattenedJWSInput, GetKeyFunction, JWSHeaderParameters, VerifyOptions, FlattenedVerifyResult, };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { GeneralJWSInput, GeneralVerifyResult, FlattenedJWSInput, GetKeyFunction, JWSHeaderParameters, KeyLike, VerifyOptions } from '../../types';
|
|
1
|
+
import type { GeneralJWSInput, GeneralVerifyResult, FlattenedJWSInput, GetKeyFunction, JWSHeaderParameters, KeyLike, VerifyOptions, ResolvedKey } from '../../types';
|
|
2
2
|
export interface GeneralVerifyGetKey extends GetKeyFunction<JWSHeaderParameters, FlattenedJWSInput> {
|
|
3
3
|
}
|
|
4
|
-
declare function generalVerify(jws: GeneralJWSInput, key: KeyLike
|
|
4
|
+
declare function generalVerify(jws: GeneralJWSInput, key: KeyLike, options?: VerifyOptions): Promise<GeneralVerifyResult>;
|
|
5
|
+
declare function generalVerify(jws: GeneralJWSInput, getKey: GeneralVerifyGetKey, options?: VerifyOptions): Promise<GeneralVerifyResult & ResolvedKey>;
|
|
5
6
|
export { generalVerify };
|
|
6
7
|
export default generalVerify;
|
|
7
8
|
export type { KeyLike, GeneralJWSInput, VerifyOptions, GeneralVerifyResult };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { KeyLike, DecryptOptions, JWTPayload, JWTClaimVerificationOptions, GetKeyFunction, JWEHeaderParameters, FlattenedJWE, JWTDecryptResult } from '../types';
|
|
1
|
+
import type { KeyLike, DecryptOptions, JWTPayload, JWTClaimVerificationOptions, GetKeyFunction, JWEHeaderParameters, FlattenedJWE, JWTDecryptResult, ResolvedKey } from '../types';
|
|
2
2
|
interface JWTDecryptOptions extends DecryptOptions, JWTClaimVerificationOptions {
|
|
3
3
|
}
|
|
4
4
|
export interface JWTDecryptGetKey extends GetKeyFunction<JWEHeaderParameters, FlattenedJWE> {
|
|
5
5
|
}
|
|
6
|
-
declare function jwtDecrypt(jwt: string | Uint8Array, key: KeyLike
|
|
6
|
+
declare function jwtDecrypt(jwt: string | Uint8Array, key: KeyLike, options?: JWTDecryptOptions): Promise<JWTDecryptResult>;
|
|
7
|
+
declare function jwtDecrypt(jwt: string | Uint8Array, getKey: JWTDecryptGetKey, options?: JWTDecryptOptions): Promise<JWTDecryptResult & ResolvedKey>;
|
|
7
8
|
export { jwtDecrypt };
|
|
8
9
|
export default jwtDecrypt;
|
|
9
10
|
export type { KeyLike, DecryptOptions, JWTPayload, JWTDecryptOptions, JWTDecryptResult };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { KeyLike, VerifyOptions, JWTPayload, JWTClaimVerificationOptions, JWSHeaderParameters, GetKeyFunction, FlattenedJWSInput, JWTVerifyResult } from '../types';
|
|
1
|
+
import type { KeyLike, VerifyOptions, JWTPayload, JWTClaimVerificationOptions, JWSHeaderParameters, GetKeyFunction, FlattenedJWSInput, JWTVerifyResult, ResolvedKey } from '../types';
|
|
2
2
|
interface JWTVerifyOptions extends VerifyOptions, JWTClaimVerificationOptions {
|
|
3
3
|
}
|
|
4
4
|
export interface JWTVerifyGetKey extends GetKeyFunction<JWSHeaderParameters, FlattenedJWSInput> {
|
|
5
5
|
}
|
|
6
|
-
declare function jwtVerify(jwt: string | Uint8Array, key: KeyLike
|
|
6
|
+
declare function jwtVerify(jwt: string | Uint8Array, key: KeyLike, options?: JWTVerifyOptions): Promise<JWTVerifyResult>;
|
|
7
|
+
declare function jwtVerify(jwt: string | Uint8Array, getKey: JWTVerifyGetKey, options?: JWTVerifyOptions): Promise<JWTVerifyResult & ResolvedKey>;
|
|
7
8
|
export { jwtVerify };
|
|
8
9
|
export default jwtVerify;
|
|
9
10
|
export type { KeyLike, JWTPayload, JWTVerifyOptions, JWSHeaderParameters, GetKeyFunction, JWTVerifyResult, };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { JWK, KeyLike } from '../types';
|
|
2
|
+
export declare function exportSPKI(key: Exclude<KeyLike, Uint8Array>): Promise<string>;
|
|
3
|
+
export declare function exportPKCS8(key: Exclude<KeyLike, Uint8Array>): Promise<string>;
|
|
4
|
+
export declare function exportJWK(key: KeyLike): Promise<JWK>;
|
|
5
|
+
export type { KeyLike, JWK };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { JWK, KeyLike } from '../types';
|
|
2
|
+
export interface PEMImportOptions {
|
|
3
|
+
extractable?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function importSPKI(spki: string, alg: string, options?: PEMImportOptions): Promise<Exclude<KeyLike, Uint8Array>>;
|
|
6
|
+
export declare function importX509(x509: string, alg: string, options?: PEMImportOptions): Promise<Exclude<KeyLike, Uint8Array>>;
|
|
7
|
+
export declare function importPKCS8(pkcs8: string, alg: string, options?: PEMImportOptions): Promise<Exclude<KeyLike, Uint8Array>>;
|
|
8
|
+
export declare function importJWK(jwk: JWK, alg?: string, octAsKeyObject?: boolean): Promise<KeyLike>;
|
|
9
|
+
export type { KeyLike, JWK };
|
package/dist/types/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jose",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.19.0",
|
|
4
4
|
"description": "Universal 'JSON Web Almost Everything' - JWA, JWS, JWE, JWT, JWK with no dependencies",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"browser",
|
|
7
|
+
"cloudflare",
|
|
7
8
|
"compact",
|
|
8
9
|
"decode",
|
|
9
10
|
"decrypt",
|
|
10
|
-
"detached",
|
|
11
11
|
"deno",
|
|
12
|
-
"
|
|
13
|
-
"workers",
|
|
12
|
+
"detached",
|
|
14
13
|
"ec",
|
|
15
14
|
"ecdsa",
|
|
16
15
|
"eddsa",
|
|
@@ -32,14 +31,19 @@
|
|
|
32
31
|
"oct",
|
|
33
32
|
"okp",
|
|
34
33
|
"payload",
|
|
34
|
+
"pem",
|
|
35
|
+
"pkcs8",
|
|
35
36
|
"rsa",
|
|
36
37
|
"secp256k1",
|
|
37
38
|
"sign",
|
|
38
39
|
"signature",
|
|
40
|
+
"spki",
|
|
39
41
|
"universal",
|
|
40
42
|
"validate",
|
|
41
43
|
"verify",
|
|
42
|
-
"webcrypto"
|
|
44
|
+
"webcrypto",
|
|
45
|
+
"workers",
|
|
46
|
+
"x509"
|
|
43
47
|
],
|
|
44
48
|
"homepage": "https://github.com/panva/jose",
|
|
45
49
|
"repository": "panva/jose",
|
|
@@ -55,250 +59,149 @@
|
|
|
55
59
|
"import": "./dist/node/esm/jwe/compact/decrypt.js",
|
|
56
60
|
"require": "./dist/node/cjs/jwe/compact/decrypt.js"
|
|
57
61
|
},
|
|
58
|
-
"./webcrypto/jwe/compact/decrypt": {
|
|
59
|
-
"import": "./dist/node/esm/jwe/compact/decrypt.js",
|
|
60
|
-
"require": "./dist/node/cjs/jwe/compact/decrypt.js"
|
|
61
|
-
},
|
|
62
62
|
"./jwe/compact/encrypt": {
|
|
63
63
|
"browser": "./dist/browser/jwe/compact/encrypt.js",
|
|
64
64
|
"import": "./dist/node/esm/jwe/compact/encrypt.js",
|
|
65
65
|
"require": "./dist/node/cjs/jwe/compact/encrypt.js"
|
|
66
66
|
},
|
|
67
|
-
"./webcrypto/jwe/compact/encrypt": {
|
|
68
|
-
"import": "./dist/node/esm/jwe/compact/encrypt.js",
|
|
69
|
-
"require": "./dist/node/cjs/jwe/compact/encrypt.js"
|
|
70
|
-
},
|
|
71
67
|
"./jwe/flattened/decrypt": {
|
|
72
68
|
"browser": "./dist/browser/jwe/flattened/decrypt.js",
|
|
73
69
|
"import": "./dist/node/esm/jwe/flattened/decrypt.js",
|
|
74
70
|
"require": "./dist/node/cjs/jwe/flattened/decrypt.js"
|
|
75
71
|
},
|
|
76
|
-
"./webcrypto/jwe/flattened/decrypt": {
|
|
77
|
-
"import": "./dist/node/esm/jwe/flattened/decrypt.js",
|
|
78
|
-
"require": "./dist/node/cjs/jwe/flattened/decrypt.js"
|
|
79
|
-
},
|
|
80
72
|
"./jwe/flattened/encrypt": {
|
|
81
73
|
"browser": "./dist/browser/jwe/flattened/encrypt.js",
|
|
82
74
|
"import": "./dist/node/esm/jwe/flattened/encrypt.js",
|
|
83
75
|
"require": "./dist/node/cjs/jwe/flattened/encrypt.js"
|
|
84
76
|
},
|
|
85
|
-
"./webcrypto/jwe/flattened/encrypt": {
|
|
86
|
-
"import": "./dist/node/esm/jwe/flattened/encrypt.js",
|
|
87
|
-
"require": "./dist/node/cjs/jwe/flattened/encrypt.js"
|
|
88
|
-
},
|
|
89
77
|
"./jwe/general/decrypt": {
|
|
90
78
|
"browser": "./dist/browser/jwe/general/decrypt.js",
|
|
91
79
|
"import": "./dist/node/esm/jwe/general/decrypt.js",
|
|
92
80
|
"require": "./dist/node/cjs/jwe/general/decrypt.js"
|
|
93
81
|
},
|
|
94
|
-
"./webcrypto/jwe/general/decrypt": {
|
|
95
|
-
"import": "./dist/node/esm/jwe/general/decrypt.js",
|
|
96
|
-
"require": "./dist/node/cjs/jwe/general/decrypt.js"
|
|
97
|
-
},
|
|
98
82
|
"./jwk/embedded": {
|
|
99
83
|
"browser": "./dist/browser/jwk/embedded.js",
|
|
100
84
|
"import": "./dist/node/esm/jwk/embedded.js",
|
|
101
85
|
"require": "./dist/node/cjs/jwk/embedded.js"
|
|
102
86
|
},
|
|
103
|
-
"./webcrypto/jwk/embedded": {
|
|
104
|
-
"import": "./dist/node/esm/jwk/embedded.js",
|
|
105
|
-
"require": "./dist/node/cjs/jwk/embedded.js"
|
|
106
|
-
},
|
|
107
87
|
"./jwk/from_key_like": {
|
|
108
88
|
"browser": "./dist/browser/jwk/from_key_like.js",
|
|
109
89
|
"import": "./dist/node/esm/jwk/from_key_like.js",
|
|
110
90
|
"require": "./dist/node/cjs/jwk/from_key_like.js"
|
|
111
91
|
},
|
|
112
|
-
"./webcrypto/jwk/from_key_like": {
|
|
113
|
-
"import": "./dist/node/esm/jwk/from_key_like.js",
|
|
114
|
-
"require": "./dist/node/cjs/jwk/from_key_like.js"
|
|
115
|
-
},
|
|
116
92
|
"./jwk/parse": {
|
|
117
93
|
"browser": "./dist/browser/jwk/parse.js",
|
|
118
94
|
"import": "./dist/node/esm/jwk/parse.js",
|
|
119
95
|
"require": "./dist/node/cjs/jwk/parse.js"
|
|
120
96
|
},
|
|
121
|
-
"./webcrypto/jwk/parse": {
|
|
122
|
-
"import": "./dist/node/esm/jwk/parse.js",
|
|
123
|
-
"require": "./dist/node/cjs/jwk/parse.js"
|
|
124
|
-
},
|
|
125
97
|
"./jwk/thumbprint": {
|
|
126
98
|
"browser": "./dist/browser/jwk/thumbprint.js",
|
|
127
99
|
"import": "./dist/node/esm/jwk/thumbprint.js",
|
|
128
100
|
"require": "./dist/node/cjs/jwk/thumbprint.js"
|
|
129
101
|
},
|
|
130
|
-
"./webcrypto/jwk/thumbprint": {
|
|
131
|
-
"import": "./dist/node/esm/jwk/thumbprint.js",
|
|
132
|
-
"require": "./dist/node/cjs/jwk/thumbprint.js"
|
|
133
|
-
},
|
|
134
102
|
"./jwks/remote": {
|
|
135
103
|
"browser": "./dist/browser/jwks/remote.js",
|
|
136
104
|
"import": "./dist/node/esm/jwks/remote.js",
|
|
137
105
|
"require": "./dist/node/cjs/jwks/remote.js"
|
|
138
106
|
},
|
|
139
|
-
"./webcrypto/jwks/remote": {
|
|
140
|
-
"import": "./dist/node/esm/jwks/remote.js",
|
|
141
|
-
"require": "./dist/node/cjs/jwks/remote.js"
|
|
142
|
-
},
|
|
143
107
|
"./jws/compact/sign": {
|
|
144
108
|
"browser": "./dist/browser/jws/compact/sign.js",
|
|
145
109
|
"import": "./dist/node/esm/jws/compact/sign.js",
|
|
146
110
|
"require": "./dist/node/cjs/jws/compact/sign.js"
|
|
147
111
|
},
|
|
148
|
-
"./webcrypto/jws/compact/sign": {
|
|
149
|
-
"import": "./dist/node/esm/jws/compact/sign.js",
|
|
150
|
-
"require": "./dist/node/cjs/jws/compact/sign.js"
|
|
151
|
-
},
|
|
152
112
|
"./jws/compact/verify": {
|
|
153
113
|
"browser": "./dist/browser/jws/compact/verify.js",
|
|
154
114
|
"import": "./dist/node/esm/jws/compact/verify.js",
|
|
155
115
|
"require": "./dist/node/cjs/jws/compact/verify.js"
|
|
156
116
|
},
|
|
157
|
-
"./webcrypto/jws/compact/verify": {
|
|
158
|
-
"import": "./dist/node/esm/jws/compact/verify.js",
|
|
159
|
-
"require": "./dist/node/cjs/jws/compact/verify.js"
|
|
160
|
-
},
|
|
161
117
|
"./jws/flattened/sign": {
|
|
162
118
|
"browser": "./dist/browser/jws/flattened/sign.js",
|
|
163
119
|
"import": "./dist/node/esm/jws/flattened/sign.js",
|
|
164
120
|
"require": "./dist/node/cjs/jws/flattened/sign.js"
|
|
165
121
|
},
|
|
166
|
-
"./webcrypto/jws/flattened/sign": {
|
|
167
|
-
"import": "./dist/node/esm/jws/flattened/sign.js",
|
|
168
|
-
"require": "./dist/node/cjs/jws/flattened/sign.js"
|
|
169
|
-
},
|
|
170
122
|
"./jws/flattened/verify": {
|
|
171
123
|
"browser": "./dist/browser/jws/flattened/verify.js",
|
|
172
124
|
"import": "./dist/node/esm/jws/flattened/verify.js",
|
|
173
125
|
"require": "./dist/node/cjs/jws/flattened/verify.js"
|
|
174
126
|
},
|
|
175
|
-
"./webcrypto/jws/flattened/verify": {
|
|
176
|
-
"import": "./dist/node/esm/jws/flattened/verify.js",
|
|
177
|
-
"require": "./dist/node/cjs/jws/flattened/verify.js"
|
|
178
|
-
},
|
|
179
127
|
"./jws/general/sign": {
|
|
180
128
|
"browser": "./dist/browser/jws/general/sign.js",
|
|
181
129
|
"import": "./dist/node/esm/jws/general/sign.js",
|
|
182
130
|
"require": "./dist/node/cjs/jws/general/sign.js"
|
|
183
131
|
},
|
|
184
|
-
"./webcrypto/jws/general/sign": {
|
|
185
|
-
"import": "./dist/node/esm/jws/general/sign.js",
|
|
186
|
-
"require": "./dist/node/cjs/jws/general/sign.js"
|
|
187
|
-
},
|
|
188
132
|
"./jws/general/verify": {
|
|
189
133
|
"browser": "./dist/browser/jws/general/verify.js",
|
|
190
134
|
"import": "./dist/node/esm/jws/general/verify.js",
|
|
191
135
|
"require": "./dist/node/cjs/jws/general/verify.js"
|
|
192
136
|
},
|
|
193
|
-
"./webcrypto/jws/general/verify": {
|
|
194
|
-
"import": "./dist/node/esm/jws/general/verify.js",
|
|
195
|
-
"require": "./dist/node/cjs/jws/general/verify.js"
|
|
196
|
-
},
|
|
197
137
|
"./jwt/decrypt": {
|
|
198
138
|
"browser": "./dist/browser/jwt/decrypt.js",
|
|
199
139
|
"import": "./dist/node/esm/jwt/decrypt.js",
|
|
200
140
|
"require": "./dist/node/cjs/jwt/decrypt.js"
|
|
201
141
|
},
|
|
202
|
-
"./webcrypto/jwt/decrypt": {
|
|
203
|
-
"import": "./dist/node/esm/jwt/decrypt.js",
|
|
204
|
-
"require": "./dist/node/cjs/jwt/decrypt.js"
|
|
205
|
-
},
|
|
206
142
|
"./jwt/encrypt": {
|
|
207
143
|
"browser": "./dist/browser/jwt/encrypt.js",
|
|
208
144
|
"import": "./dist/node/esm/jwt/encrypt.js",
|
|
209
145
|
"require": "./dist/node/cjs/jwt/encrypt.js"
|
|
210
146
|
},
|
|
211
|
-
"./webcrypto/jwt/encrypt": {
|
|
212
|
-
"import": "./dist/node/esm/jwt/encrypt.js",
|
|
213
|
-
"require": "./dist/node/cjs/jwt/encrypt.js"
|
|
214
|
-
},
|
|
215
147
|
"./jwt/sign": {
|
|
216
148
|
"browser": "./dist/browser/jwt/sign.js",
|
|
217
149
|
"import": "./dist/node/esm/jwt/sign.js",
|
|
218
150
|
"require": "./dist/node/cjs/jwt/sign.js"
|
|
219
151
|
},
|
|
220
|
-
"./webcrypto/jwt/sign": {
|
|
221
|
-
"import": "./dist/node/esm/jwt/sign.js",
|
|
222
|
-
"require": "./dist/node/cjs/jwt/sign.js"
|
|
223
|
-
},
|
|
224
152
|
"./jwt/unsecured": {
|
|
225
153
|
"browser": "./dist/browser/jwt/unsecured.js",
|
|
226
154
|
"import": "./dist/node/esm/jwt/unsecured.js",
|
|
227
155
|
"require": "./dist/node/cjs/jwt/unsecured.js"
|
|
228
156
|
},
|
|
229
|
-
"./webcrypto/jwt/unsecured": {
|
|
230
|
-
"import": "./dist/node/esm/jwt/unsecured.js",
|
|
231
|
-
"require": "./dist/node/cjs/jwt/unsecured.js"
|
|
232
|
-
},
|
|
233
157
|
"./jwt/verify": {
|
|
234
158
|
"browser": "./dist/browser/jwt/verify.js",
|
|
235
159
|
"import": "./dist/node/esm/jwt/verify.js",
|
|
236
160
|
"require": "./dist/node/cjs/jwt/verify.js"
|
|
237
161
|
},
|
|
238
|
-
"./
|
|
239
|
-
"
|
|
240
|
-
"
|
|
162
|
+
"./key/export": {
|
|
163
|
+
"browser": "./dist/browser/key/export.js",
|
|
164
|
+
"import": "./dist/node/esm/key/export.js",
|
|
165
|
+
"require": "./dist/node/cjs/key/export.js"
|
|
166
|
+
},
|
|
167
|
+
"./key/import": {
|
|
168
|
+
"browser": "./dist/browser/key/import.js",
|
|
169
|
+
"import": "./dist/node/esm/key/import.js",
|
|
170
|
+
"require": "./dist/node/cjs/key/import.js"
|
|
241
171
|
},
|
|
242
172
|
"./util/base64url": {
|
|
243
173
|
"browser": "./dist/browser/util/base64url.js",
|
|
244
174
|
"import": "./dist/node/esm/util/base64url.js",
|
|
245
175
|
"require": "./dist/node/cjs/util/base64url.js"
|
|
246
176
|
},
|
|
247
|
-
"./webcrypto/util/base64url": {
|
|
248
|
-
"import": "./dist/node/esm/util/base64url.js",
|
|
249
|
-
"require": "./dist/node/cjs/util/base64url.js"
|
|
250
|
-
},
|
|
251
177
|
"./util/decode_protected_header": {
|
|
252
178
|
"browser": "./dist/browser/util/decode_protected_header.js",
|
|
253
179
|
"import": "./dist/node/esm/util/decode_protected_header.js",
|
|
254
180
|
"require": "./dist/node/cjs/util/decode_protected_header.js"
|
|
255
181
|
},
|
|
256
|
-
"./webcrypto/util/decode_protected_header": {
|
|
257
|
-
"import": "./dist/node/esm/util/decode_protected_header.js",
|
|
258
|
-
"require": "./dist/node/cjs/util/decode_protected_header.js"
|
|
259
|
-
},
|
|
260
182
|
"./util/errors": {
|
|
261
183
|
"browser": "./dist/browser/util/errors.js",
|
|
262
184
|
"import": "./dist/node/esm/util/errors.js",
|
|
263
185
|
"require": "./dist/node/cjs/util/errors.js"
|
|
264
186
|
},
|
|
265
|
-
"./webcrypto/util/errors": {
|
|
266
|
-
"import": "./dist/node/esm/util/errors.js",
|
|
267
|
-
"require": "./dist/node/cjs/util/errors.js"
|
|
268
|
-
},
|
|
269
187
|
"./util/generate_key_pair": {
|
|
270
188
|
"browser": "./dist/browser/util/generate_key_pair.js",
|
|
271
189
|
"import": "./dist/node/esm/util/generate_key_pair.js",
|
|
272
190
|
"require": "./dist/node/cjs/util/generate_key_pair.js"
|
|
273
191
|
},
|
|
274
|
-
"./webcrypto/util/generate_key_pair": {
|
|
275
|
-
"import": "./dist/node/esm/util/generate_key_pair.js",
|
|
276
|
-
"require": "./dist/node/cjs/util/generate_key_pair.js"
|
|
277
|
-
},
|
|
278
192
|
"./util/generate_secret": {
|
|
279
193
|
"browser": "./dist/browser/util/generate_secret.js",
|
|
280
194
|
"import": "./dist/node/esm/util/generate_secret.js",
|
|
281
195
|
"require": "./dist/node/cjs/util/generate_secret.js"
|
|
282
196
|
},
|
|
283
|
-
"./webcrypto/util/generate_secret": {
|
|
284
|
-
"import": "./dist/node/esm/util/generate_secret.js",
|
|
285
|
-
"require": "./dist/node/cjs/util/generate_secret.js"
|
|
286
|
-
},
|
|
287
197
|
"./util/random": {
|
|
288
198
|
"browser": "./dist/browser/util/random.js",
|
|
289
199
|
"import": "./dist/node/esm/util/random.js",
|
|
290
200
|
"require": "./dist/node/cjs/util/random.js"
|
|
291
|
-
},
|
|
292
|
-
"./webcrypto/util/random": {
|
|
293
|
-
"import": "./dist/node/esm/util/random.js",
|
|
294
|
-
"require": "./dist/node/cjs/util/random.js"
|
|
295
201
|
}
|
|
296
202
|
},
|
|
297
203
|
"typesVersions": {
|
|
298
204
|
"*": {
|
|
299
|
-
"webcrypto/*": [
|
|
300
|
-
"./dist/types/*"
|
|
301
|
-
],
|
|
302
205
|
"*": [
|
|
303
206
|
"./dist/types/*"
|
|
304
207
|
]
|