jose 5.9.6 → 6.0.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 +21 -19
- package/dist/types/index.d.ts +5 -5
- package/dist/types/jwe/compact/decrypt.d.ts +4 -4
- package/dist/types/jwe/compact/encrypt.d.ts +4 -4
- package/dist/types/jwe/flattened/decrypt.d.ts +4 -4
- package/dist/types/jwe/flattened/encrypt.d.ts +6 -6
- package/dist/types/jwe/general/decrypt.d.ts +4 -4
- package/dist/types/jwe/general/encrypt.d.ts +7 -7
- package/dist/types/jwk/embedded.d.ts +2 -2
- package/dist/types/jwk/thumbprint.d.ts +5 -5
- package/dist/types/jwks/local.d.ts +2 -2
- package/dist/types/jwks/remote.d.ts +104 -25
- package/dist/types/jws/compact/sign.d.ts +4 -4
- package/dist/types/jws/compact/verify.d.ts +4 -4
- package/dist/types/jws/flattened/sign.d.ts +4 -4
- package/dist/types/jws/flattened/verify.d.ts +4 -4
- package/dist/types/jws/general/sign.d.ts +6 -6
- package/dist/types/jws/general/verify.d.ts +4 -4
- package/dist/types/jwt/decrypt.d.ts +5 -5
- package/dist/types/jwt/encrypt.d.ts +4 -4
- package/dist/types/jwt/produce.d.ts +3 -3
- package/dist/types/jwt/sign.d.ts +3 -3
- package/dist/types/jwt/unsecured.d.ts +5 -5
- package/dist/types/jwt/verify.d.ts +5 -5
- package/dist/types/key/export.d.ts +10 -12
- package/dist/types/key/generate_key_pair.d.ts +10 -11
- package/dist/types/key/generate_secret.d.ts +6 -9
- package/dist/types/key/import.d.ts +20 -27
- package/dist/types/types.d.ts +38 -59
- package/dist/types/util/decode_jwt.d.ts +2 -2
- package/dist/types/util/decode_protected_header.d.ts +2 -2
- package/dist/types/util/errors.d.ts +6 -6
- package/dist/{browser → webapi}/index.js +2 -2
- package/dist/{node/esm → webapi}/jwe/flattened/decrypt.js +8 -4
- package/dist/{node/esm → webapi}/jwe/flattened/encrypt.js +7 -3
- package/dist/{node/esm → webapi}/jwe/general/encrypt.js +8 -3
- package/dist/{node/esm → webapi}/jwk/thumbprint.js +18 -8
- package/dist/{node/esm → webapi}/jwks/local.js +4 -6
- package/dist/{node/esm → webapi}/jwks/remote.js +34 -6
- package/dist/{node/esm → webapi}/jws/flattened/sign.js +7 -5
- package/dist/{browser → webapi}/jws/flattened/verify.js +8 -14
- package/dist/{browser → webapi}/jwt/unsecured.js +1 -1
- package/dist/{node/esm → webapi}/key/export.js +2 -3
- package/dist/{browser/runtime/generate.js → webapi/key/generate_key_pair.js} +5 -54
- package/dist/webapi/key/generate_secret.js +40 -0
- package/dist/{browser → webapi}/key/import.js +9 -7
- package/dist/{node/esm → webapi}/lib/aesgcmkw.js +3 -3
- package/dist/{browser/runtime → webapi/lib}/aeskw.js +9 -16
- package/dist/{browser/runtime → webapi/lib}/asn1.js +25 -17
- package/dist/{browser/runtime → webapi/lib}/base64url.js +17 -9
- package/dist/{browser → webapi}/lib/buffer_utils.js +4 -19
- package/dist/{browser → webapi}/lib/cek.js +1 -2
- package/dist/{browser/runtime → webapi/lib}/check_cek_length.js +1 -2
- package/dist/{browser → webapi}/lib/check_iv_length.js +1 -2
- package/dist/webapi/lib/check_key_type.js +126 -0
- package/dist/{node/esm → webapi}/lib/crypto_key.js +11 -23
- package/dist/{browser/runtime → webapi/lib}/decrypt.js +26 -10
- package/dist/{node/esm → webapi}/lib/decrypt_key_management.js +22 -24
- package/dist/{browser/runtime → webapi/lib}/digest.js +1 -3
- package/dist/webapi/lib/ecdhes.js +46 -0
- package/dist/{browser/runtime → webapi/lib}/encrypt.js +8 -10
- package/dist/{node/esm → webapi}/lib/encrypt_key_management.js +26 -23
- package/dist/webapi/lib/get_sign_verify_key.js +12 -0
- package/dist/{node/esm → webapi}/lib/is_disjoint.js +1 -2
- package/dist/{browser → webapi}/lib/is_jwk.js +1 -1
- package/dist/webapi/lib/is_key_like.js +14 -0
- package/dist/{browser → webapi}/lib/is_object.js +2 -2
- package/dist/{node/esm → webapi}/lib/iv.js +1 -2
- package/dist/{browser/runtime → webapi/lib}/jwk_to_key.js +4 -10
- package/dist/webapi/lib/key_to_jwk.js +27 -0
- package/dist/webapi/lib/normalize_key.js +164 -0
- package/dist/webapi/lib/pbes2kw.js +37 -0
- package/dist/webapi/lib/rsaes.js +24 -0
- package/dist/{browser/runtime → webapi/lib}/sign.js +1 -3
- package/dist/{browser/runtime → webapi/lib}/subtle_dsa.js +5 -4
- package/dist/{browser → webapi}/lib/validate_algorithms.js +1 -2
- package/dist/{node/esm → webapi}/lib/validate_crit.js +3 -4
- package/dist/{browser/runtime → webapi/lib}/verify.js +1 -3
- package/dist/{node/esm → webapi}/util/base64url.js +1 -1
- package/package.json +36 -219
- package/dist/browser/jwe/compact/encrypt.js +0 -26
- package/dist/browser/jwe/flattened/decrypt.js +0 -161
- package/dist/browser/jwe/flattened/encrypt.js +0 -153
- package/dist/browser/jwe/general/encrypt.js +0 -174
- package/dist/browser/jwk/thumbprint.js +0 -53
- package/dist/browser/jwks/local.js +0 -121
- package/dist/browser/jwks/remote.js +0 -139
- package/dist/browser/jws/compact/sign.js +0 -17
- package/dist/browser/jws/flattened/sign.js +0 -81
- package/dist/browser/jws/general/sign.js +0 -67
- package/dist/browser/jwt/encrypt.js +0 -68
- package/dist/browser/jwt/produce.js +0 -75
- package/dist/browser/jwt/sign.js +0 -20
- package/dist/browser/key/export.js +0 -12
- package/dist/browser/key/generate_key_pair.js +0 -4
- package/dist/browser/key/generate_secret.js +0 -4
- package/dist/browser/lib/aesgcmkw.js +0 -16
- package/dist/browser/lib/check_key_type.js +0 -77
- package/dist/browser/lib/check_p2s.js +0 -6
- package/dist/browser/lib/crypto_key.js +0 -152
- package/dist/browser/lib/decrypt_key_management.js +0 -129
- package/dist/browser/lib/encrypt_key_management.js +0 -89
- package/dist/browser/lib/format_pem.js +0 -4
- package/dist/browser/lib/is_disjoint.js +0 -22
- package/dist/browser/lib/iv.js +0 -20
- package/dist/browser/lib/validate_crit.js +0 -34
- package/dist/browser/package.json +0 -1
- package/dist/browser/runtime/bogus.js +0 -6
- package/dist/browser/runtime/ecdhes.js +0 -47
- package/dist/browser/runtime/fetch_jwks.js +0 -34
- package/dist/browser/runtime/get_sign_verify_key.js +0 -24
- package/dist/browser/runtime/is_key_like.js +0 -8
- package/dist/browser/runtime/key_to_jwk.js +0 -21
- package/dist/browser/runtime/normalize_key.js +0 -68
- package/dist/browser/runtime/pbes2kw.js +0 -51
- package/dist/browser/runtime/random.js +0 -2
- package/dist/browser/runtime/rsaes.js +0 -37
- package/dist/browser/runtime/runtime.js +0 -1
- package/dist/browser/runtime/subtle_rsaes.js +0 -12
- package/dist/browser/runtime/timing_safe_equal.js +0 -19
- package/dist/browser/runtime/webcrypto.js +0 -2
- package/dist/browser/util/base64url.js +0 -3
- package/dist/browser/util/errors.js +0 -114
- package/dist/browser/util/runtime.js +0 -2
- package/dist/node/cjs/index.js +0 -69
- package/dist/node/cjs/jwe/compact/decrypt.js +0 -30
- package/dist/node/cjs/jwe/compact/encrypt.js +0 -31
- package/dist/node/cjs/jwe/flattened/decrypt.js +0 -164
- package/dist/node/cjs/jwe/flattened/encrypt.js +0 -165
- package/dist/node/cjs/jwe/general/decrypt.js +0 -34
- package/dist/node/cjs/jwe/general/encrypt.js +0 -186
- package/dist/node/cjs/jwk/embedded.js +0 -20
- package/dist/node/cjs/jwk/thumbprint.js +0 -57
- package/dist/node/cjs/jwks/local.js +0 -125
- package/dist/node/cjs/jwks/remote.js +0 -152
- package/dist/node/cjs/jws/compact/sign.js +0 -22
- package/dist/node/cjs/jws/compact/verify.js +0 -24
- package/dist/node/cjs/jws/flattened/sign.js +0 -88
- package/dist/node/cjs/jws/flattened/verify.js +0 -125
- package/dist/node/cjs/jws/general/sign.js +0 -77
- package/dist/node/cjs/jws/general/verify.js +0 -27
- package/dist/node/cjs/jwt/decrypt.js +0 -26
- package/dist/node/cjs/jwt/encrypt.js +0 -79
- package/dist/node/cjs/jwt/produce.js +0 -80
- package/dist/node/cjs/jwt/sign.js +0 -25
- package/dist/node/cjs/jwt/unsecured.js +0 -36
- package/dist/node/cjs/jwt/verify.js +0 -18
- package/dist/node/cjs/key/export.js +0 -17
- package/dist/node/cjs/key/generate_key_pair.js +0 -7
- package/dist/node/cjs/key/generate_secret.js +0 -7
- package/dist/node/cjs/key/import.js +0 -51
- package/dist/node/cjs/lib/aesgcmkw.js +0 -20
- package/dist/node/cjs/lib/buffer_utils.js +0 -60
- package/dist/node/cjs/lib/cek.js +0 -23
- package/dist/node/cjs/lib/check_iv_length.js +0 -10
- package/dist/node/cjs/lib/check_key_type.js +0 -80
- package/dist/node/cjs/lib/check_p2s.js +0 -9
- package/dist/node/cjs/lib/crypto_key.js +0 -156
- package/dist/node/cjs/lib/decrypt_key_management.js +0 -131
- package/dist/node/cjs/lib/encrypt_key_management.js +0 -91
- package/dist/node/cjs/lib/epoch.js +0 -3
- package/dist/node/cjs/lib/invalid_key_input.js +0 -34
- package/dist/node/cjs/lib/is_disjoint.js +0 -24
- package/dist/node/cjs/lib/is_jwk.js +0 -19
- package/dist/node/cjs/lib/is_object.js +0 -19
- package/dist/node/cjs/lib/iv.js +0 -23
- package/dist/node/cjs/lib/jwt_claims_set.js +0 -106
- package/dist/node/cjs/lib/private_symbols.js +0 -4
- package/dist/node/cjs/lib/secs.js +0 -57
- package/dist/node/cjs/lib/validate_algorithms.js +0 -13
- package/dist/node/cjs/lib/validate_crit.js +0 -36
- package/dist/node/cjs/runtime/aeskw.js +0 -55
- package/dist/node/cjs/runtime/asn1.js +0 -54
- package/dist/node/cjs/runtime/base64url.js +0 -20
- package/dist/node/cjs/runtime/cbc_tag.js +0 -11
- package/dist/node/cjs/runtime/check_cek_length.js +0 -37
- package/dist/node/cjs/runtime/check_key_length.js +0 -18
- package/dist/node/cjs/runtime/ciphers.js +0 -8
- package/dist/node/cjs/runtime/decrypt.js +0 -103
- package/dist/node/cjs/runtime/digest.js +0 -5
- package/dist/node/cjs/runtime/dsa_digest.js +0 -25
- package/dist/node/cjs/runtime/ecdhes.js +0 -70
- package/dist/node/cjs/runtime/encrypt.js +0 -80
- package/dist/node/cjs/runtime/fetch_jwks.js +0 -45
- package/dist/node/cjs/runtime/generate.js +0 -101
- package/dist/node/cjs/runtime/get_named_curve.js +0 -61
- package/dist/node/cjs/runtime/get_sign_verify_key.js +0 -31
- package/dist/node/cjs/runtime/hmac_digest.js +0 -16
- package/dist/node/cjs/runtime/is_key_like.js +0 -11
- package/dist/node/cjs/runtime/is_key_object.js +0 -4
- package/dist/node/cjs/runtime/jwk_to_key.js +0 -10
- package/dist/node/cjs/runtime/key_to_jwk.js +0 -36
- package/dist/node/cjs/runtime/node_key.js +0 -106
- package/dist/node/cjs/runtime/normalize_key.js +0 -3
- package/dist/node/cjs/runtime/pbes2kw.js +0 -48
- package/dist/node/cjs/runtime/random.js +0 -5
- package/dist/node/cjs/runtime/rsaes.js +0 -71
- package/dist/node/cjs/runtime/runtime.js +0 -3
- package/dist/node/cjs/runtime/sign.js +0 -19
- package/dist/node/cjs/runtime/timing_safe_equal.js +0 -5
- package/dist/node/cjs/runtime/verify.js +0 -31
- package/dist/node/cjs/runtime/webcrypto.js +0 -9
- package/dist/node/cjs/util/base64url.js +0 -6
- package/dist/node/cjs/util/decode_jwt.js +0 -35
- package/dist/node/cjs/util/decode_protected_header.js +0 -37
- package/dist/node/cjs/util/errors.js +0 -117
- package/dist/node/cjs/util/runtime.js +0 -4
- package/dist/node/esm/index.js +0 -30
- package/dist/node/esm/jwe/compact/decrypt.js +0 -27
- package/dist/node/esm/jwe/general/decrypt.js +0 -31
- package/dist/node/esm/jwk/embedded.js +0 -17
- package/dist/node/esm/jws/compact/verify.js +0 -21
- package/dist/node/esm/jws/flattened/verify.js +0 -122
- package/dist/node/esm/jws/general/verify.js +0 -24
- package/dist/node/esm/jwt/decrypt.js +0 -23
- package/dist/node/esm/jwt/unsecured.js +0 -32
- package/dist/node/esm/jwt/verify.js +0 -15
- package/dist/node/esm/key/generate_key_pair.js +0 -4
- package/dist/node/esm/key/generate_secret.js +0 -4
- package/dist/node/esm/key/import.js +0 -45
- package/dist/node/esm/lib/buffer_utils.js +0 -51
- package/dist/node/esm/lib/cek.js +0 -20
- package/dist/node/esm/lib/check_iv_length.js +0 -8
- package/dist/node/esm/lib/check_key_type.js +0 -77
- package/dist/node/esm/lib/check_p2s.js +0 -6
- package/dist/node/esm/lib/epoch.js +0 -1
- package/dist/node/esm/lib/invalid_key_input.js +0 -31
- package/dist/node/esm/lib/is_jwk.js +0 -13
- package/dist/node/esm/lib/is_object.js +0 -16
- package/dist/node/esm/lib/jwt_claims_set.js +0 -104
- package/dist/node/esm/lib/private_symbols.js +0 -1
- package/dist/node/esm/lib/secs.js +0 -55
- package/dist/node/esm/lib/validate_algorithms.js +0 -11
- package/dist/node/esm/package.json +0 -1
- package/dist/node/esm/runtime/aeskw.js +0 -50
- package/dist/node/esm/runtime/asn1.js +0 -46
- package/dist/node/esm/runtime/base64url.js +0 -14
- package/dist/node/esm/runtime/cbc_tag.js +0 -8
- package/dist/node/esm/runtime/check_cek_length.js +0 -35
- package/dist/node/esm/runtime/check_key_length.js +0 -16
- package/dist/node/esm/runtime/ciphers.js +0 -6
- package/dist/node/esm/runtime/decrypt.js +0 -101
- package/dist/node/esm/runtime/digest.js +0 -3
- package/dist/node/esm/runtime/dsa_digest.js +0 -22
- package/dist/node/esm/runtime/ecdhes.js +0 -64
- package/dist/node/esm/runtime/encrypt.js +0 -78
- package/dist/node/esm/runtime/fetch_jwks.js +0 -43
- package/dist/node/esm/runtime/generate.js +0 -97
- package/dist/node/esm/runtime/get_named_curve.js +0 -58
- package/dist/node/esm/runtime/get_sign_verify_key.js +0 -28
- package/dist/node/esm/runtime/hmac_digest.js +0 -13
- package/dist/node/esm/runtime/is_key_like.js +0 -8
- package/dist/node/esm/runtime/is_key_object.js +0 -2
- package/dist/node/esm/runtime/jwk_to_key.js +0 -8
- package/dist/node/esm/runtime/key_to_jwk.js +0 -34
- package/dist/node/esm/runtime/node_key.js +0 -103
- package/dist/node/esm/runtime/normalize_key.js +0 -1
- package/dist/node/esm/runtime/pbes2kw.js +0 -43
- package/dist/node/esm/runtime/random.js +0 -1
- package/dist/node/esm/runtime/rsaes.js +0 -66
- package/dist/node/esm/runtime/runtime.js +0 -1
- package/dist/node/esm/runtime/sign.js +0 -17
- package/dist/node/esm/runtime/timing_safe_equal.js +0 -3
- package/dist/node/esm/runtime/verify.js +0 -29
- package/dist/node/esm/runtime/webcrypto.js +0 -5
- package/dist/node/esm/util/decode_jwt.js +0 -32
- package/dist/node/esm/util/decode_protected_header.js +0 -34
- package/dist/node/esm/util/runtime.js +0 -2
- package/dist/types/util/runtime.d.ts +0 -3
- /package/dist/{browser → webapi}/jwe/compact/decrypt.js +0 -0
- /package/dist/{node/esm → webapi}/jwe/compact/encrypt.js +0 -0
- /package/dist/{browser → webapi}/jwe/general/decrypt.js +0 -0
- /package/dist/{browser → webapi}/jwk/embedded.js +0 -0
- /package/dist/{node/esm → webapi}/jws/compact/sign.js +0 -0
- /package/dist/{browser → webapi}/jws/compact/verify.js +0 -0
- /package/dist/{node/esm → webapi}/jws/general/sign.js +0 -0
- /package/dist/{browser → webapi}/jws/general/verify.js +0 -0
- /package/dist/{browser → webapi}/jwt/decrypt.js +0 -0
- /package/dist/{node/esm → webapi}/jwt/encrypt.js +0 -0
- /package/dist/{node/esm → webapi}/jwt/produce.js +0 -0
- /package/dist/{node/esm → webapi}/jwt/sign.js +0 -0
- /package/dist/{browser → webapi}/jwt/verify.js +0 -0
- /package/dist/{browser/runtime → webapi/lib}/check_key_length.js +0 -0
- /package/dist/{browser → webapi}/lib/epoch.js +0 -0
- /package/dist/{browser → webapi}/lib/invalid_key_input.js +0 -0
- /package/dist/{browser → webapi}/lib/jwt_claims_set.js +0 -0
- /package/dist/{browser → webapi}/lib/private_symbols.js +0 -0
- /package/dist/{browser → webapi}/lib/secs.js +0 -0
- /package/dist/{browser → webapi}/util/decode_jwt.js +0 -0
- /package/dist/{browser → webapi}/util/decode_protected_header.js +0 -0
- /package/dist/{node/esm → webapi}/util/errors.js +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as types from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Interface for Flattened JWS Verification dynamic key resolution. No token components have been
|
|
4
4
|
* verified at the time of this function call.
|
|
5
5
|
*
|
|
6
6
|
* @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
|
|
7
7
|
*/
|
|
8
|
-
export interface FlattenedVerifyGetKey extends GenericGetKeyFunction<JWSHeaderParameters | undefined, FlattenedJWSInput,
|
|
8
|
+
export interface FlattenedVerifyGetKey extends types.GenericGetKeyFunction<types.JWSHeaderParameters | undefined, types.FlattenedJWSInput, types.CryptoKey | types.KeyObject | types.JWK | Uint8Array> {
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Verifies the signature and format of and afterwards decodes the Flattened JWS.
|
|
@@ -18,11 +18,11 @@ export interface FlattenedVerifyGetKey extends GenericGetKeyFunction<JWSHeaderPa
|
|
|
18
18
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
19
19
|
* @param options JWS Verify options.
|
|
20
20
|
*/
|
|
21
|
-
export declare function flattenedVerify(jws: FlattenedJWSInput, key:
|
|
21
|
+
export declare function flattenedVerify(jws: types.FlattenedJWSInput, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.VerifyOptions): Promise<types.FlattenedVerifyResult>;
|
|
22
22
|
/**
|
|
23
23
|
* @param jws Flattened JWS.
|
|
24
24
|
* @param getKey Function resolving a key to verify the JWS with. See
|
|
25
25
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
26
26
|
* @param options JWS Verify options.
|
|
27
27
|
*/
|
|
28
|
-
export declare function flattenedVerify
|
|
28
|
+
export declare function flattenedVerify(jws: types.FlattenedJWSInput, getKey: FlattenedVerifyGetKey, options?: types.VerifyOptions): Promise<types.FlattenedVerifyResult & types.ResolvedKey>;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as types from '../../types';
|
|
2
2
|
export interface Signature {
|
|
3
3
|
/**
|
|
4
4
|
* Sets the JWS Protected Header on the Signature object.
|
|
5
5
|
*
|
|
6
6
|
* @param protectedHeader JWS Protected Header.
|
|
7
7
|
*/
|
|
8
|
-
setProtectedHeader(protectedHeader: JWSHeaderParameters): Signature;
|
|
8
|
+
setProtectedHeader(protectedHeader: types.JWSHeaderParameters): Signature;
|
|
9
9
|
/**
|
|
10
10
|
* Sets the JWS Unprotected Header on the Signature object.
|
|
11
11
|
*
|
|
12
12
|
* @param unprotectedHeader JWS Unprotected Header.
|
|
13
13
|
*/
|
|
14
|
-
setUnprotectedHeader(unprotectedHeader: JWSHeaderParameters): Signature;
|
|
14
|
+
setUnprotectedHeader(unprotectedHeader: types.JWSHeaderParameters): Signature;
|
|
15
15
|
/** A shorthand for calling addSignature() on the enclosing GeneralSign instance */
|
|
16
16
|
addSignature(...args: Parameters<GeneralSign['addSignature']>): Signature;
|
|
17
17
|
/** A shorthand for calling encrypt() on the enclosing GeneralSign instance */
|
|
18
|
-
sign(...args: Parameters<GeneralSign['sign']>): Promise<GeneralJWS>;
|
|
18
|
+
sign(...args: Parameters<GeneralSign['sign']>): Promise<types.GeneralJWS>;
|
|
19
19
|
/** Returns the enclosing GeneralSign */
|
|
20
20
|
done(): GeneralSign;
|
|
21
21
|
}
|
|
@@ -38,7 +38,7 @@ export declare class GeneralSign {
|
|
|
38
38
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
39
39
|
* @param options JWS Sign options.
|
|
40
40
|
*/
|
|
41
|
-
addSignature(key:
|
|
41
|
+
addSignature(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.SignOptions): Signature;
|
|
42
42
|
/** Signs and resolves the value of the General JWS object. */
|
|
43
|
-
sign(): Promise<GeneralJWS>;
|
|
43
|
+
sign(): Promise<types.GeneralJWS>;
|
|
44
44
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as types from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Interface for General JWS Verification dynamic key resolution. No token components have been
|
|
4
4
|
* verified at the time of this function call.
|
|
5
5
|
*
|
|
6
6
|
* @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
|
|
7
7
|
*/
|
|
8
|
-
export interface GeneralVerifyGetKey extends GenericGetKeyFunction<JWSHeaderParameters, FlattenedJWSInput,
|
|
8
|
+
export interface GeneralVerifyGetKey extends types.GenericGetKeyFunction<types.JWSHeaderParameters, types.FlattenedJWSInput, types.CryptoKey | types.KeyObject | types.JWK | Uint8Array> {
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Verifies the signature and format of and afterwards decodes the General JWS.
|
|
@@ -18,11 +18,11 @@ export interface GeneralVerifyGetKey extends GenericGetKeyFunction<JWSHeaderPara
|
|
|
18
18
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
19
19
|
* @param options JWS Verify options.
|
|
20
20
|
*/
|
|
21
|
-
export declare function generalVerify(jws: GeneralJWSInput, key:
|
|
21
|
+
export declare function generalVerify(jws: types.GeneralJWSInput, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.VerifyOptions): Promise<types.GeneralVerifyResult>;
|
|
22
22
|
/**
|
|
23
23
|
* @param jws General JWS.
|
|
24
24
|
* @param getKey Function resolving a key to verify the JWS with. See
|
|
25
25
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
26
26
|
* @param options JWS Verify options.
|
|
27
27
|
*/
|
|
28
|
-
export declare function generalVerify
|
|
28
|
+
export declare function generalVerify(jws: types.GeneralJWSInput, getKey: GeneralVerifyGetKey, options?: types.VerifyOptions): Promise<types.GeneralVerifyResult & types.ResolvedKey>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as types from '../types';
|
|
2
2
|
/** Combination of JWE Decryption options and JWT Claims Set verification options. */
|
|
3
|
-
export interface JWTDecryptOptions extends DecryptOptions, JWTClaimVerificationOptions {
|
|
3
|
+
export interface JWTDecryptOptions extends types.DecryptOptions, types.JWTClaimVerificationOptions {
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* Interface for JWT Decryption dynamic key resolution. No token components have been verified at
|
|
7
7
|
* the time of this function call.
|
|
8
8
|
*/
|
|
9
|
-
export interface JWTDecryptGetKey extends GetKeyFunction<CompactJWEHeaderParameters, FlattenedJWE> {
|
|
9
|
+
export interface JWTDecryptGetKey extends types.GetKeyFunction<types.CompactJWEHeaderParameters, types.FlattenedJWE> {
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Verifies the JWT format (to be a JWE Compact format), decrypts the ciphertext, validates the JWT
|
|
@@ -20,11 +20,11 @@ export interface JWTDecryptGetKey extends GetKeyFunction<CompactJWEHeaderParamet
|
|
|
20
20
|
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
21
21
|
* @param options JWT Decryption and JWT Claims Set validation options.
|
|
22
22
|
*/
|
|
23
|
-
export declare function jwtDecrypt<PayloadType = JWTPayload>(jwt: string | Uint8Array, key:
|
|
23
|
+
export declare function jwtDecrypt<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: JWTDecryptOptions): Promise<types.JWTDecryptResult<PayloadType>>;
|
|
24
24
|
/**
|
|
25
25
|
* @param jwt JSON Web Token value (encoded as JWE).
|
|
26
26
|
* @param getKey Function resolving Private Key or Secret to decrypt and verify the JWT with. See
|
|
27
27
|
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
28
28
|
* @param options JWT Decryption and JWT Claims Set validation options.
|
|
29
29
|
*/
|
|
30
|
-
export declare function jwtDecrypt<PayloadType = JWTPayload
|
|
30
|
+
export declare function jwtDecrypt<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, getKey: JWTDecryptGetKey, options?: JWTDecryptOptions): Promise<types.JWTDecryptResult<PayloadType> & types.ResolvedKey>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as types from '../types';
|
|
2
2
|
import { ProduceJWT } from './produce';
|
|
3
3
|
/**
|
|
4
4
|
* The EncryptJWT class is used to build and encrypt Compact JWE formatted JSON Web Tokens.
|
|
@@ -21,7 +21,7 @@ export declare class EncryptJWT extends ProduceJWT {
|
|
|
21
21
|
* @param protectedHeader JWE Protected Header. Must contain an "alg" (JWE Algorithm) and "enc"
|
|
22
22
|
* (JWE Encryption Algorithm) properties.
|
|
23
23
|
*/
|
|
24
|
-
setProtectedHeader(protectedHeader: CompactJWEHeaderParameters): this;
|
|
24
|
+
setProtectedHeader(protectedHeader: types.CompactJWEHeaderParameters): this;
|
|
25
25
|
/**
|
|
26
26
|
* Sets the JWE Key Management parameters to be used when encrypting. Use of this is method is
|
|
27
27
|
* really only needed for ECDH based algorithms when utilizing the Agreement PartyUInfo or
|
|
@@ -30,7 +30,7 @@ export declare class EncryptJWT extends ProduceJWT {
|
|
|
30
30
|
*
|
|
31
31
|
* @param parameters JWE Key Management parameters.
|
|
32
32
|
*/
|
|
33
|
-
setKeyManagementParameters(parameters: JWEKeyManagementHeaderParameters): this;
|
|
33
|
+
setKeyManagementParameters(parameters: types.JWEKeyManagementHeaderParameters): this;
|
|
34
34
|
/**
|
|
35
35
|
* Sets a content encryption key to use, by default a random suitable one is generated for the JWE
|
|
36
36
|
* enc" (Encryption Algorithm) Header Parameter.
|
|
@@ -76,5 +76,5 @@ export declare class EncryptJWT extends ProduceJWT {
|
|
|
76
76
|
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
77
77
|
* @param options JWE Encryption options.
|
|
78
78
|
*/
|
|
79
|
-
encrypt(key:
|
|
79
|
+
encrypt(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.EncryptOptions): Promise<string>;
|
|
80
80
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as types from '../types';
|
|
2
2
|
/** Generic class for JWT producing. */
|
|
3
3
|
export declare class ProduceJWT {
|
|
4
|
-
protected _payload: JWTPayload;
|
|
4
|
+
protected _payload: types.JWTPayload;
|
|
5
5
|
/** @param payload The JWT Claims Set object. Defaults to an empty object. */
|
|
6
|
-
constructor(payload?: JWTPayload);
|
|
6
|
+
constructor(payload?: types.JWTPayload);
|
|
7
7
|
/**
|
|
8
8
|
* Set the "iss" (Issuer) Claim.
|
|
9
9
|
*
|
package/dist/types/jwt/sign.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as types from '../types';
|
|
2
2
|
import { ProduceJWT } from './produce';
|
|
3
3
|
/**
|
|
4
4
|
* The SignJWT class is used to build and sign Compact JWS formatted JSON Web Tokens.
|
|
@@ -14,7 +14,7 @@ export declare class SignJWT extends ProduceJWT {
|
|
|
14
14
|
*
|
|
15
15
|
* @param protectedHeader JWS Protected Header. Must contain an "alg" (JWS Algorithm) property.
|
|
16
16
|
*/
|
|
17
|
-
setProtectedHeader(protectedHeader: JWTHeaderParameters): this;
|
|
17
|
+
setProtectedHeader(protectedHeader: types.JWTHeaderParameters): this;
|
|
18
18
|
/**
|
|
19
19
|
* Signs and returns the JWT.
|
|
20
20
|
*
|
|
@@ -22,5 +22,5 @@ export declare class SignJWT extends ProduceJWT {
|
|
|
22
22
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
23
23
|
* @param options JWT Sign options.
|
|
24
24
|
*/
|
|
25
|
-
sign(key:
|
|
25
|
+
sign(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.SignOptions): Promise<string>;
|
|
26
26
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as types from '../types';
|
|
2
2
|
import { ProduceJWT } from './produce';
|
|
3
|
-
export interface UnsecuredResult<PayloadType = JWTPayload> {
|
|
4
|
-
payload: PayloadType & JWTPayload;
|
|
5
|
-
header: JWSHeaderParameters;
|
|
3
|
+
export interface UnsecuredResult<PayloadType = types.JWTPayload> {
|
|
4
|
+
payload: PayloadType & types.JWTPayload;
|
|
5
|
+
header: types.JWSHeaderParameters;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* The UnsecuredJWT class is a utility for dealing with `{ "alg": "none" }` Unsecured JWTs.
|
|
@@ -20,5 +20,5 @@ export declare class UnsecuredJWT extends ProduceJWT {
|
|
|
20
20
|
* @param jwt Unsecured JWT to decode the payload of.
|
|
21
21
|
* @param options JWT Claims Set validation options.
|
|
22
22
|
*/
|
|
23
|
-
static decode<PayloadType = JWTPayload>(jwt: string, options?: JWTClaimVerificationOptions): UnsecuredResult<PayloadType>;
|
|
23
|
+
static decode<PayloadType = types.JWTPayload>(jwt: string, options?: types.JWTClaimVerificationOptions): UnsecuredResult<PayloadType>;
|
|
24
24
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as types from '../types';
|
|
2
2
|
/** Combination of JWS Verification options and JWT Claims Set verification options. */
|
|
3
|
-
export interface JWTVerifyOptions extends VerifyOptions, JWTClaimVerificationOptions {
|
|
3
|
+
export interface JWTVerifyOptions extends types.VerifyOptions, types.JWTClaimVerificationOptions {
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* Interface for JWT Verification dynamic key resolution. No token components have been verified at
|
|
@@ -8,7 +8,7 @@ export interface JWTVerifyOptions extends VerifyOptions, JWTClaimVerificationOpt
|
|
|
8
8
|
*
|
|
9
9
|
* @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
|
|
10
10
|
*/
|
|
11
|
-
export interface JWTVerifyGetKey extends GenericGetKeyFunction<JWTHeaderParameters, FlattenedJWSInput,
|
|
11
|
+
export interface JWTVerifyGetKey extends types.GenericGetKeyFunction<types.JWTHeaderParameters, types.FlattenedJWSInput, types.CryptoKey | types.KeyObject | types.JWK | Uint8Array> {
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Verifies the JWT format (to be a JWS Compact format), verifies the JWS signature, validates the
|
|
@@ -22,11 +22,11 @@ export interface JWTVerifyGetKey extends GenericGetKeyFunction<JWTHeaderParamete
|
|
|
22
22
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
23
23
|
* @param options JWT Decryption and JWT Claims Set validation options.
|
|
24
24
|
*/
|
|
25
|
-
export declare function jwtVerify<PayloadType = JWTPayload>(jwt: string | Uint8Array, key:
|
|
25
|
+
export declare function jwtVerify<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: JWTVerifyOptions): Promise<types.JWTVerifyResult<PayloadType>>;
|
|
26
26
|
/**
|
|
27
27
|
* @param jwt JSON Web Token value (encoded as JWS).
|
|
28
28
|
* @param getKey Function resolving a key to verify the JWT with. See
|
|
29
29
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
30
30
|
* @param options JWT Decryption and JWT Claims Set validation options.
|
|
31
31
|
*/
|
|
32
|
-
export declare function jwtVerify<PayloadType = JWTPayload
|
|
32
|
+
export declare function jwtVerify<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, getKey: JWTVerifyGetKey, options?: JWTVerifyOptions): Promise<types.JWTVerifyResult<PayloadType> & types.ResolvedKey>;
|
|
@@ -1,30 +1,28 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as types from '../types';
|
|
2
2
|
/**
|
|
3
|
-
* Exports a
|
|
4
|
-
* a PEM-encoded SPKI string format.
|
|
3
|
+
* Exports a public {@link !CryptoKey} or {@link !KeyObject} to a PEM-encoded SPKI string format.
|
|
5
4
|
*
|
|
6
5
|
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
7
6
|
* as from its subpath export `'jose/key/export'`.
|
|
8
7
|
*
|
|
9
|
-
* @param key Key
|
|
8
|
+
* @param key Key to export to a PEM-encoded SPKI string format.
|
|
10
9
|
*/
|
|
11
|
-
export declare function exportSPKI(key:
|
|
10
|
+
export declare function exportSPKI(key: types.CryptoKey | types.KeyObject): Promise<string>;
|
|
12
11
|
/**
|
|
13
|
-
* Exports a
|
|
14
|
-
* a PEM-encoded PKCS8 string format.
|
|
12
|
+
* Exports a private {@link !CryptoKey} or {@link !KeyObject} to a PEM-encoded PKCS8 string format.
|
|
15
13
|
*
|
|
16
14
|
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
17
15
|
* as from its subpath export `'jose/key/export'`.
|
|
18
16
|
*
|
|
19
|
-
* @param key Key
|
|
17
|
+
* @param key Key to export to a PEM-encoded PKCS8 string format.
|
|
20
18
|
*/
|
|
21
|
-
export declare function exportPKCS8(key:
|
|
19
|
+
export declare function exportPKCS8(key: types.CryptoKey | types.KeyObject): Promise<string>;
|
|
22
20
|
/**
|
|
23
|
-
* Exports a
|
|
21
|
+
* Exports a {@link !CryptoKey}, {@link !KeyObject}, or {@link !Uint8Array} to a JWK.
|
|
24
22
|
*
|
|
25
23
|
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
26
24
|
* as from its subpath export `'jose/key/export'`.
|
|
27
25
|
*
|
|
28
|
-
* @param key Key
|
|
26
|
+
* @param key Key to export as JWK.
|
|
29
27
|
*/
|
|
30
|
-
export declare function exportJWK(key:
|
|
28
|
+
export declare function exportJWK(key: types.CryptoKey | types.KeyObject | Uint8Array): Promise<types.JWK>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export interface GenerateKeyPairResult
|
|
1
|
+
import type * as types from '../types';
|
|
2
|
+
export interface GenerateKeyPairResult {
|
|
3
3
|
/** The generated Private Key. */
|
|
4
|
-
privateKey:
|
|
4
|
+
privateKey: types.CryptoKey;
|
|
5
5
|
/** Public Key corresponding to the generated Private Key. */
|
|
6
|
-
publicKey:
|
|
6
|
+
publicKey: types.CryptoKey;
|
|
7
7
|
}
|
|
8
8
|
export interface GenerateKeyPairOptions {
|
|
9
9
|
/**
|
|
@@ -17,8 +17,7 @@ export interface GenerateKeyPairOptions {
|
|
|
17
17
|
*/
|
|
18
18
|
modulusLength?: number;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
* {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false.
|
|
20
|
+
* The value to use as {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false.
|
|
22
21
|
*
|
|
23
22
|
*/
|
|
24
23
|
extractable?: boolean;
|
|
@@ -27,14 +26,14 @@ export interface GenerateKeyPairOptions {
|
|
|
27
26
|
* Generates a private and a public key for a given JWA algorithm identifier. This can only generate
|
|
28
27
|
* asymmetric key pairs. For symmetric secrets use the `generateSecret` function.
|
|
29
28
|
*
|
|
30
|
-
* Note:
|
|
31
|
-
*
|
|
32
|
-
* `privateKey`.
|
|
29
|
+
* Note: The `privateKey` is generated with `extractable` set to `false` by default. See
|
|
30
|
+
* {@link GenerateKeyPairOptions.extractable} to generate an extractable `privateKey`.
|
|
33
31
|
*
|
|
34
32
|
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
35
33
|
* as from its subpath export `'jose/generate/keypair'`.
|
|
36
34
|
*
|
|
37
|
-
* @param alg JWA Algorithm Identifier to be used with the generated key pair.
|
|
35
|
+
* @param alg JWA Algorithm Identifier to be used with the generated key pair. See
|
|
36
|
+
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
|
|
38
37
|
* @param options Additional options passed down to the key pair generation.
|
|
39
38
|
*/
|
|
40
|
-
export declare function generateKeyPair
|
|
39
|
+
export declare function generateKeyPair(alg: string, options?: GenerateKeyPairOptions): Promise<GenerateKeyPairResult>;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as types from '../types';
|
|
2
2
|
export interface GenerateSecretOptions {
|
|
3
|
-
/**
|
|
4
|
-
* (Only effective in Web Crypto API runtimes) The value to use as
|
|
5
|
-
* {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false.
|
|
6
|
-
*/
|
|
3
|
+
/** The value to use as {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false. */
|
|
7
4
|
extractable?: boolean;
|
|
8
5
|
}
|
|
9
6
|
/**
|
|
10
7
|
* Generates a symmetric secret key for a given JWA algorithm identifier.
|
|
11
8
|
*
|
|
12
|
-
* Note:
|
|
13
|
-
* by default.
|
|
9
|
+
* Note: The secret key is generated with `extractable` set to `false` by default.
|
|
14
10
|
*
|
|
15
11
|
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
16
12
|
* as from its subpath export `'jose/generate/secret'`.
|
|
17
13
|
*
|
|
18
|
-
* @param alg JWA Algorithm Identifier to be used with the generated secret.
|
|
14
|
+
* @param alg JWA Algorithm Identifier to be used with the generated secret. See
|
|
15
|
+
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
|
|
19
16
|
* @param options Additional options passed down to the secret generation.
|
|
20
17
|
*/
|
|
21
|
-
export declare function generateSecret
|
|
18
|
+
export declare function generateSecret(alg: string, options?: GenerateSecretOptions): Promise<types.CryptoKey | Uint8Array>;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export interface
|
|
1
|
+
import type * as types from '../types';
|
|
2
|
+
export interface KeyImportOptions {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The value to use as {@link !SubtleCrypto.importKey} `extractable` argument. Default is false for
|
|
5
|
+
* private and secret keys, true otherwise.
|
|
6
6
|
*/
|
|
7
7
|
extractable?: boolean;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* Imports a PEM-encoded SPKI string as a
|
|
11
|
-
* ({@link !KeyObject} or {@link !CryptoKey}).
|
|
10
|
+
* Imports a PEM-encoded SPKI string as a {@link !CryptoKey}.
|
|
12
11
|
*
|
|
13
12
|
* Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
|
|
14
13
|
* {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
|
|
@@ -18,14 +17,12 @@ export interface PEMImportOptions {
|
|
|
18
17
|
* as from its subpath export `'jose/key/import'`.
|
|
19
18
|
*
|
|
20
19
|
* @param spki PEM-encoded SPKI string
|
|
21
|
-
* @param alg
|
|
22
|
-
* with the imported key, its presence is only enforced in Web Crypto API runtimes. See
|
|
20
|
+
* @param alg JSON Web Algorithm identifier to be used with the imported key. See
|
|
23
21
|
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
|
|
24
22
|
*/
|
|
25
|
-
export declare function importSPKI
|
|
23
|
+
export declare function importSPKI(spki: string, alg: string, options?: KeyImportOptions): Promise<types.CryptoKey>;
|
|
26
24
|
/**
|
|
27
|
-
* Imports the SPKI from an X.509 string certificate as a
|
|
28
|
-
* ({@link !KeyObject} or {@link !CryptoKey}).
|
|
25
|
+
* Imports the SPKI from an X.509 string certificate as a {@link !CryptoKey}.
|
|
29
26
|
*
|
|
30
27
|
* Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
|
|
31
28
|
* {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
|
|
@@ -35,14 +32,12 @@ export declare function importSPKI<KeyLikeType extends KeyLike = KeyLike>(spki:
|
|
|
35
32
|
* as from its subpath export `'jose/key/import'`.
|
|
36
33
|
*
|
|
37
34
|
* @param x509 X.509 certificate string
|
|
38
|
-
* @param alg
|
|
39
|
-
* with the imported key, its presence is only enforced in Web Crypto API runtimes. See
|
|
35
|
+
* @param alg JSON Web Algorithm identifier to be used with the imported key. See
|
|
40
36
|
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
|
|
41
37
|
*/
|
|
42
|
-
export declare function importX509
|
|
38
|
+
export declare function importX509(x509: string, alg: string, options?: KeyImportOptions): Promise<types.CryptoKey>;
|
|
43
39
|
/**
|
|
44
|
-
* Imports a PEM-encoded PKCS#8 string as a
|
|
45
|
-
* ({@link !KeyObject} or {@link !CryptoKey}).
|
|
40
|
+
* Imports a PEM-encoded PKCS#8 string as a {@link !CryptoKey}.
|
|
46
41
|
*
|
|
47
42
|
* Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
|
|
48
43
|
* {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
|
|
@@ -52,25 +47,23 @@ export declare function importX509<KeyLikeType extends KeyLike = KeyLike>(x509:
|
|
|
52
47
|
* as from its subpath export `'jose/key/import'`.
|
|
53
48
|
*
|
|
54
49
|
* @param pkcs8 PEM-encoded PKCS#8 string
|
|
55
|
-
* @param alg
|
|
56
|
-
* with the imported key, its presence is only enforced in Web Crypto API runtimes. See
|
|
50
|
+
* @param alg JSON Web Algorithm identifier to be used with the imported key. See
|
|
57
51
|
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
|
|
58
52
|
*/
|
|
59
|
-
export declare function importPKCS8
|
|
53
|
+
export declare function importPKCS8(pkcs8: string, alg: string, options?: KeyImportOptions): Promise<types.CryptoKey>;
|
|
60
54
|
/**
|
|
61
|
-
* Imports a JWK to a
|
|
62
|
-
*
|
|
55
|
+
* Imports a JWK to a {@link !CryptoKey}. Either the JWK "alg" (Algorithm) Parameter, or the optional
|
|
56
|
+
* "alg" argument, must be present.
|
|
63
57
|
*
|
|
64
|
-
* Note:
|
|
65
|
-
*
|
|
58
|
+
* Note: The JSON Web Key parameters "use", "key_ops", and "ext" are also used in the
|
|
59
|
+
* {@link !CryptoKey} import process.
|
|
66
60
|
*
|
|
67
61
|
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
68
62
|
* as from its subpath export `'jose/key/import'`.
|
|
69
63
|
*
|
|
70
64
|
* @param jwk JSON Web Key.
|
|
71
|
-
* @param alg
|
|
72
|
-
*
|
|
73
|
-
* in Web Crypto API runtimes. See
|
|
65
|
+
* @param alg JSON Web Algorithm identifier to be used with the imported key. Default is the "alg"
|
|
66
|
+
* property on the JWK. See
|
|
74
67
|
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
|
|
75
68
|
*/
|
|
76
|
-
export declare function importJWK
|
|
69
|
+
export declare function importJWK(jwk: types.JWK, alg?: string, options?: KeyImportOptions): Promise<types.CryptoKey | Uint8Array>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* KeyLike are runtime-specific classes representing asymmetric keys or symmetric secrets. These are
|
|
3
|
-
* instances of {@link !CryptoKey} and additionally {@link !KeyObject} in Node.js runtime.
|
|
4
|
-
* {@link !Uint8Array} instances are also accepted as symmetric secret representation only.
|
|
5
|
-
*
|
|
6
|
-
* {@link key/import Key Import Functions} can be used to import PEM, or JWK formatted asymmetric
|
|
7
|
-
* keys and certificates to these runtime-specific representations.
|
|
8
|
-
*
|
|
9
|
-
* In Node.js the {@link !Buffer} class is a subclass of {@link !Uint8Array} and so {@link !Buffer} can
|
|
10
|
-
* be provided for symmetric secrets as well.
|
|
11
|
-
*
|
|
12
|
-
* {@link !KeyObject} is a representation of a key/secret available in the Node.js runtime. In
|
|
13
|
-
* addition to the {@link key/import Key Import Functions} you may use the runtime APIs
|
|
14
|
-
* {@link !createPublicKey}, {@link !createPrivateKey}, and {@link !createSecretKey} to obtain a
|
|
15
|
-
* {@link !KeyObject} from your existing key material.
|
|
16
|
-
*
|
|
17
|
-
* {@link !CryptoKey} is a representation of a key/secret available in the Browser and
|
|
18
|
-
* Web-interoperable runtimes. In addition to the {@link key/import Key Import Functions} you may use
|
|
19
|
-
* the {@link !SubtleCrypto.importKey} API to obtain a {@link !CryptoKey} from your existing key
|
|
20
|
-
* material.
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
export type KeyLike = { type: string }
|
|
24
|
-
|
|
25
1
|
/** Generic JSON Web Key Parameters. */
|
|
26
2
|
export interface JWKParameters {
|
|
27
3
|
/** JWK "kty" (Key Type) Parameter */
|
|
@@ -96,16 +72,6 @@ export interface JWK_RSA_Private extends JWK_RSA_Public, JWKParameters {
|
|
|
96
72
|
dp: string
|
|
97
73
|
/** RSA JWK "dq" (Second Factor CRT Exponent) Parameter */
|
|
98
74
|
dq: string
|
|
99
|
-
/**
|
|
100
|
-
* RSA JWK "oth" (Other Primes Info) Parameter
|
|
101
|
-
*
|
|
102
|
-
* This parameter is not supported
|
|
103
|
-
*/
|
|
104
|
-
oth?: Array<{
|
|
105
|
-
d?: string
|
|
106
|
-
r?: string
|
|
107
|
-
t?: string
|
|
108
|
-
}>
|
|
109
75
|
/** RSA JWK "p" (First Prime Factor) Parameter */
|
|
110
76
|
p: string
|
|
111
77
|
/** RSA JWK "q" (Second Prime Factor) Parameter */
|
|
@@ -154,16 +120,6 @@ export interface JWK extends JWKParameters {
|
|
|
154
120
|
k?: string
|
|
155
121
|
/** RSA JWK "n" (Modulus) Parameter */
|
|
156
122
|
n?: string
|
|
157
|
-
/**
|
|
158
|
-
* Private RSA JWK "oth" (Other Primes Info) Parameter
|
|
159
|
-
*
|
|
160
|
-
* This parameter is not supported
|
|
161
|
-
*/
|
|
162
|
-
oth?: Array<{
|
|
163
|
-
d?: string
|
|
164
|
-
r?: string
|
|
165
|
-
t?: string
|
|
166
|
-
}>
|
|
167
123
|
/** Private RSA JWK "p" (First Prime Factor) Parameter */
|
|
168
124
|
p?: string
|
|
169
125
|
/** Private RSA JWK "q" (Second Prime Factor) Parameter */
|
|
@@ -204,7 +160,11 @@ export interface GenericGetKeyFunction<IProtectedHeader, IToken, ReturnKeyTypes>
|
|
|
204
160
|
* @param IToken Type definition of the consumed JWE or JWS token.
|
|
205
161
|
*/
|
|
206
162
|
export interface GetKeyFunction<IProtectedHeader, IToken>
|
|
207
|
-
extends GenericGetKeyFunction<
|
|
163
|
+
extends GenericGetKeyFunction<
|
|
164
|
+
IProtectedHeader,
|
|
165
|
+
IToken,
|
|
166
|
+
CryptoKey | KeyObject | JWK | Uint8Array
|
|
167
|
+
> {}
|
|
208
168
|
|
|
209
169
|
/**
|
|
210
170
|
* Flattened JWS definition for verify function inputs, allows payload as {@link !Uint8Array} for
|
|
@@ -344,7 +304,7 @@ export interface JWEKeyManagementHeaderParameters {
|
|
|
344
304
|
* @deprecated You should not use this parameter. It is only really intended for test and vector
|
|
345
305
|
* validation purposes.
|
|
346
306
|
*/
|
|
347
|
-
epk?:
|
|
307
|
+
epk?: CryptoKey | KeyObject
|
|
348
308
|
}
|
|
349
309
|
|
|
350
310
|
/** Flattened JWE definition. */
|
|
@@ -499,10 +459,13 @@ export interface JWTClaimVerificationOptions {
|
|
|
499
459
|
audience?: string | string[]
|
|
500
460
|
|
|
501
461
|
/**
|
|
502
|
-
*
|
|
462
|
+
* Clock skew tolerance
|
|
503
463
|
*
|
|
504
464
|
* - In seconds when number (e.g. 5)
|
|
505
|
-
* -
|
|
465
|
+
* - Resolved into a number of seconds when a string (e.g. "5 seconds", "10 minutes", "2 hours").
|
|
466
|
+
*
|
|
467
|
+
* Used when validating the JWT "nbf" (Not Before) and "exp" (Expiration Time) claims, and when
|
|
468
|
+
* validating the "iat" (Issued At) claim if the {@link maxTokenAge `maxTokenAge` option} is set.
|
|
506
469
|
*/
|
|
507
470
|
clockTolerance?: string | number
|
|
508
471
|
|
|
@@ -517,7 +480,7 @@ export interface JWTClaimVerificationOptions {
|
|
|
517
480
|
* Maximum time elapsed (in seconds) from the JWT "iat" (Issued At) Claim value.
|
|
518
481
|
*
|
|
519
482
|
* - In seconds when number (e.g. 5)
|
|
520
|
-
* -
|
|
483
|
+
* - Resolved into a number of seconds when a string (e.g. "5 seconds", "10 minutes", "2 hours").
|
|
521
484
|
*
|
|
522
485
|
* This option makes the JWT "iat" (Issued At) Claim presence required.
|
|
523
486
|
*/
|
|
@@ -542,13 +505,11 @@ export interface JWTClaimVerificationOptions {
|
|
|
542
505
|
|
|
543
506
|
/**
|
|
544
507
|
* Array of required Claim Names that must be present in the JWT Claims Set. Default is that: if
|
|
545
|
-
* the {@link
|
|
546
|
-
*
|
|
547
|
-
* set, then JWT "
|
|
548
|
-
* {@link
|
|
549
|
-
*
|
|
550
|
-
* {@link JWTClaimVerificationOptions.maxTokenAge `maxTokenAge` option} is set, then JWT "iat"
|
|
551
|
-
* (Issued At) Claim must be present.
|
|
508
|
+
* the {@link issuer `issuer` option} is set, then JWT "iss" (Issuer) Claim must be present; if the
|
|
509
|
+
* {@link audience `audience` option} is set, then JWT "aud" (Audience) Claim must be present; if
|
|
510
|
+
* the {@link subject `subject` option} is set, then JWT "sub" (Subject) Claim must be present; if
|
|
511
|
+
* the {@link maxTokenAge `maxTokenAge` option} is set, then JWT "iat" (Issued At) Claim must be
|
|
512
|
+
* present.
|
|
552
513
|
*/
|
|
553
514
|
requiredClaims?: string[]
|
|
554
515
|
}
|
|
@@ -686,9 +647,9 @@ export interface JWTDecryptResult<PayloadType = JWTPayload> {
|
|
|
686
647
|
protectedHeader: CompactJWEHeaderParameters
|
|
687
648
|
}
|
|
688
649
|
|
|
689
|
-
export interface ResolvedKey
|
|
650
|
+
export interface ResolvedKey {
|
|
690
651
|
/** Key resolved from the key resolver function. */
|
|
691
|
-
key:
|
|
652
|
+
key: CryptoKey | Uint8Array
|
|
692
653
|
}
|
|
693
654
|
|
|
694
655
|
/** Recognized Compact JWS Header Parameters, any other Header Members may also be present. */
|
|
@@ -712,4 +673,22 @@ export interface JSONWebKeySet {
|
|
|
712
673
|
keys: JWK[]
|
|
713
674
|
}
|
|
714
675
|
|
|
715
|
-
|
|
676
|
+
/**
|
|
677
|
+
* {@link !KeyObject} is a representation of a key/secret available in the Node.js runtime. You may
|
|
678
|
+
* use the Node.js runtime APIs {@link !createPublicKey}, {@link !createPrivateKey}, and
|
|
679
|
+
* {@link !createSecretKey} to obtain a {@link !KeyObject} from your existing key material.
|
|
680
|
+
*/
|
|
681
|
+
export interface KeyObject {
|
|
682
|
+
type: string
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* {@link !CryptoKey} is a representation of a key/secret available in all supported runtimes. In
|
|
687
|
+
* addition to the {@link key/import Key Import Functions} you may use the
|
|
688
|
+
* {@link !SubtleCrypto.importKey} API to obtain a {@link !CryptoKey} from your existing key
|
|
689
|
+
* material.
|
|
690
|
+
*/
|
|
691
|
+
export type CryptoKey = Extract<
|
|
692
|
+
Awaited<ReturnType<typeof crypto.subtle.generateKey>>,
|
|
693
|
+
{ type: string }
|
|
694
|
+
>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as types from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Decodes a signed JSON Web Token payload. This does not validate the JWT Claims Set types or
|
|
4
4
|
* values. This does not validate the JWS Signature. For a proper Signed JWT Claims Set validation
|
|
@@ -10,4 +10,4 @@ import type { JWTPayload } from '../types';
|
|
|
10
10
|
*
|
|
11
11
|
* @param jwt JWT token in compact JWS serialization.
|
|
12
12
|
*/
|
|
13
|
-
export declare function decodeJwt<PayloadType = JWTPayload>(jwt: string): PayloadType & JWTPayload;
|
|
13
|
+
export declare function decodeJwt<PayloadType = types.JWTPayload>(jwt: string): PayloadType & types.JWTPayload;
|