@suveren/gateway 0.4.1 → 0.6.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/bin/suveren-gateway.js +86 -5
- package/content/integrations/calendar.json +116 -22
- package/content/integrations/deploy-github.json +164 -0
- package/content/integrations/gmail.json +13 -4
- package/content/integrations/index.json +2 -1
- package/dist/control-plane/index.mjs +84 -7
- package/dist/mcp-server/http.mjs +147 -21
- package/dist/ui/assets/index-DecSrutK.js +105 -0
- package/dist/ui/index.html +1 -1
- package/node_modules/@hap/core/dist/index.d.mts +21 -0
- package/node_modules/@hap/core/dist/index.d.ts +21 -0
- package/node_modules/@hap/core/dist/index.js +17 -0
- package/node_modules/@hap/core/dist/index.mjs +17 -0
- package/node_modules/@hap/core/package.json +1 -1
- package/node_modules/@hap/core/src/gatekeeper.ts +28 -0
- package/node_modules/@hap/core/src/types.ts +21 -0
- package/node_modules/fast-uri/index.js +37 -1
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/security.test.js +136 -0
- package/node_modules/hono/dist/cjs/helper/proxy/index.js +4 -0
- package/node_modules/hono/dist/cjs/jsx/base.js +1 -9
- package/node_modules/hono/dist/cjs/jsx/hooks/index.js +14 -11
- package/node_modules/hono/dist/cjs/middleware/cors/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/language/language.js +10 -6
- package/node_modules/hono/dist/cjs/utils/cookie.js +2 -1
- package/node_modules/hono/dist/helper/proxy/index.js +4 -0
- package/node_modules/hono/dist/jsx/base.js +1 -9
- package/node_modules/hono/dist/jsx/hooks/index.js +14 -11
- package/node_modules/hono/dist/middleware/cors/index.js +1 -1
- package/node_modules/hono/dist/middleware/language/language.js +10 -6
- package/node_modules/hono/dist/utils/cookie.js +2 -1
- package/node_modules/hono/package.json +2 -3
- package/node_modules/ip-address/README.md +142 -128
- package/node_modules/ip-address/dist/common.d.ts +6 -0
- package/node_modules/ip-address/dist/common.js +17 -1
- package/node_modules/ip-address/dist/common.js.map +1 -1
- package/node_modules/ip-address/dist/ipv4.js +3 -12
- package/node_modules/ip-address/dist/ipv4.js.map +1 -1
- package/node_modules/ip-address/dist/ipv6.d.ts +9 -2
- package/node_modules/ip-address/dist/ipv6.js +35 -16
- package/node_modules/ip-address/dist/ipv6.js.map +1 -1
- package/node_modules/ip-address/package.json +5 -3
- package/node_modules/jose/README.md +13 -13
- package/node_modules/jose/dist/types/index.d.ts +6 -5
- package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +17 -11
- package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +7 -19
- package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +17 -11
- package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +7 -19
- package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +18 -13
- package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +20 -21
- package/node_modules/jose/dist/types/jwk/embedded.d.ts +8 -12
- package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +0 -15
- package/node_modules/jose/dist/types/jwks/local.d.ts +12 -21
- package/node_modules/jose/dist/types/jwks/remote.d.ts +34 -165
- package/node_modules/jose/dist/types/jws/compact/sign.d.ts +2 -13
- package/node_modules/jose/dist/types/jws/compact/verify.d.ts +17 -13
- package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +2 -13
- package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +17 -13
- package/node_modules/jose/dist/types/jws/general/sign.d.ts +16 -17
- package/node_modules/jose/dist/types/jws/general/verify.d.ts +18 -15
- package/node_modules/jose/dist/types/jwt/decrypt.d.ts +17 -11
- package/node_modules/jose/dist/types/jwt/encrypt.d.ts +10 -34
- package/node_modules/jose/dist/types/jwt/sign.d.ts +2 -13
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +4 -13
- package/node_modules/jose/dist/types/jwt/verify.d.ts +14 -13
- package/node_modules/jose/dist/types/key/export.d.ts +0 -14
- package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +7 -14
- package/node_modules/jose/dist/types/key/generate_secret.d.ts +16 -14
- package/node_modules/jose/dist/types/key/import.d.ts +18 -28
- package/node_modules/jose/dist/types/types.d.ts +239 -222
- package/node_modules/jose/dist/types/util/base64url.d.ts +11 -4
- package/node_modules/jose/dist/types/util/decode_jwt.d.ts +1 -9
- package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +0 -8
- package/node_modules/jose/dist/types/util/errors.d.ts +128 -121
- package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +4 -22
- package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +5 -153
- package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +16 -111
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +15 -3
- package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +65 -81
- package/node_modules/jose/dist/webapi/jwk/embedded.js +5 -3
- package/node_modules/jose/dist/webapi/jwks/local.js +31 -72
- package/node_modules/jose/dist/webapi/jwks/remote.js +19 -28
- package/node_modules/jose/dist/webapi/jws/compact/sign.js +5 -2
- package/node_modules/jose/dist/webapi/jws/compact/verify.js +4 -16
- package/node_modules/jose/dist/webapi/jws/flattened/sign.js +7 -65
- package/node_modules/jose/dist/webapi/jws/flattened/verify.js +3 -89
- package/node_modules/jose/dist/webapi/jws/general/sign.js +19 -15
- package/node_modules/jose/dist/webapi/jws/general/verify.js +29 -9
- package/node_modules/jose/dist/webapi/jwt/decrypt.js +5 -5
- package/node_modules/jose/dist/webapi/jwt/sign.js +2 -3
- package/node_modules/jose/dist/webapi/jwt/unsecured.js +4 -3
- package/node_modules/jose/dist/webapi/jwt/verify.js +6 -6
- package/node_modules/jose/dist/webapi/key/export.js +37 -4
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +33 -82
- package/node_modules/jose/dist/webapi/key/import.js +8 -8
- package/node_modules/jose/dist/webapi/lib/asn1.js +53 -122
- package/node_modules/jose/dist/webapi/lib/buffer_utils.js +1 -0
- package/node_modules/jose/dist/webapi/lib/content_encryption.js +34 -109
- package/node_modules/jose/dist/webapi/lib/crypto_key.js +18 -126
- package/node_modules/jose/dist/webapi/lib/helpers.js +23 -0
- package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +0 -1
- package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +116 -0
- package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +186 -0
- package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +110 -0
- package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +8 -98
- package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +76 -0
- package/node_modules/jose/dist/webapi/lib/jws_sign.js +74 -0
- package/node_modules/jose/dist/webapi/lib/jws_verify.js +107 -0
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +68 -109
- package/node_modules/jose/dist/webapi/lib/key.js +132 -0
- package/node_modules/jose/dist/webapi/lib/key_algorithm.js +10 -0
- package/node_modules/jose/dist/webapi/lib/key_descriptor.js +7 -0
- package/node_modules/jose/dist/webapi/lib/key_management.js +162 -92
- package/node_modules/jose/dist/webapi/lib/options.js +48 -0
- package/node_modules/jose/dist/webapi/lib/signing.js +14 -56
- package/node_modules/jose/dist/webapi/lib/type_checks.js +13 -18
- package/node_modules/jose/dist/webapi/util/base64url.js +13 -4
- package/node_modules/jose/dist/webapi/util/decode_jwt.js +2 -2
- package/node_modules/jose/dist/webapi/util/decode_protected_header.js +5 -15
- package/node_modules/jose/dist/webapi/util/errors.js +1 -1
- package/node_modules/jose/package.json +2 -4
- package/package.json +2 -2
- package/profiles/deploy/0.6.profile.json +168 -0
- package/profiles/deploy/0.7.profile.json +168 -0
- package/profiles/email/0.4.profile.json +9 -2
- package/profiles/index.json +3 -1
- package/dist/ui/assets/index-Cog54HOo.js +0 -105
- package/node_modules/jose/dist/webapi/lib/aesgcmkw.js +0 -15
- package/node_modules/jose/dist/webapi/lib/aeskw.js +0 -25
- package/node_modules/jose/dist/webapi/lib/check_key_type.js +0 -122
- package/node_modules/jose/dist/webapi/lib/ecdhes.js +0 -52
- package/node_modules/jose/dist/webapi/lib/key_to_jwk.js +0 -34
- package/node_modules/jose/dist/webapi/lib/normalize_key.js +0 -166
- package/node_modules/jose/dist/webapi/lib/pbes2kw.js +0 -42
- package/node_modules/jose/dist/webapi/lib/rsaes.js +0 -24
- package/node_modules/jose/dist/webapi/lib/validate_algorithms.js +0 -10
- package/node_modules/jose/dist/webapi/lib/validate_crit.js +0 -33
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Verifying JSON Web Signature (JWS) in Compact Serialization
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
1
|
import type * as types from '../../types.d.ts';
|
|
7
2
|
/**
|
|
8
3
|
* Interface for Compact JWS Verification dynamic key resolution. No token components have been
|
|
9
4
|
* verified at the time of this function call.
|
|
10
|
-
*
|
|
11
|
-
* @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
|
|
12
5
|
*/
|
|
13
|
-
export interface CompactVerifyGetKey extends types.
|
|
6
|
+
export interface CompactVerifyGetKey<KeyType extends types.CryptoKey | Uint8Array = types.CryptoKey | Uint8Array> extends types.GetKeyFunction<types.CompactJWSHeaderParameters, types.FlattenedJWSInput, KeyType | types.KeyObject | types.JWK> {
|
|
14
7
|
}
|
|
15
8
|
/**
|
|
16
9
|
* Verifies the signature and format of and afterwards decodes the Compact JWS.
|
|
17
10
|
*
|
|
18
|
-
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
19
|
-
* as from its subpath export `'jose/jws/compact/verify'`.
|
|
20
|
-
*
|
|
21
11
|
* @param jws Compact JWS.
|
|
22
12
|
* @param key Key to verify the JWS with. See
|
|
23
13
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
24
14
|
* @param options JWS Verify options.
|
|
25
15
|
*/
|
|
26
|
-
export declare function compactVerify(jws: string | Uint8Array, key: types.
|
|
16
|
+
export declare function compactVerify(jws: string | Uint8Array, key: types.KeyInput, options?: types.VerifyOptions): Promise<types.CompactVerifyResult>;
|
|
27
17
|
/**
|
|
18
|
+
* Verifies the signature and format of and afterwards decodes the Compact JWS, resolving the key
|
|
19
|
+
* dynamically. The result additionally carries the {@link types.ResolvedKey.key resolved key}.
|
|
20
|
+
*
|
|
28
21
|
* @param jws Compact JWS.
|
|
29
22
|
* @param getKey Function resolving a key to verify the JWS with. See
|
|
30
23
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
31
24
|
* @param options JWS Verify options.
|
|
32
25
|
*/
|
|
33
|
-
export declare function compactVerify(jws: string | Uint8Array, getKey: CompactVerifyGetKey
|
|
26
|
+
export declare function compactVerify<KeyType extends types.CryptoKey | Uint8Array = types.CryptoKey | Uint8Array>(jws: string | Uint8Array, getKey: CompactVerifyGetKey<KeyType>, options?: types.VerifyOptions): Promise<types.CompactVerifyResult & types.ResolvedKey<KeyType>>;
|
|
27
|
+
/**
|
|
28
|
+
* Accepts either form of the `key` argument. Use this overload when forwarding a value that may be
|
|
29
|
+
* either a key or a key resolution function; `key` is present on the result only when a resolution
|
|
30
|
+
* function was used.
|
|
31
|
+
*
|
|
32
|
+
* @param jws Compact JWS.
|
|
33
|
+
* @param key Key, or function resolving a key, to verify the JWS with. See
|
|
34
|
+
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
35
|
+
* @param options JWS Verify options.
|
|
36
|
+
*/
|
|
37
|
+
export declare function compactVerify(jws: string | Uint8Array, key: types.KeyInput | CompactVerifyGetKey, options?: types.VerifyOptions): Promise<types.CompactVerifyResult & Partial<types.ResolvedKey>>;
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Signing JSON Web Signature (JWS) in Flattened JSON Serialization
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
1
|
import type * as types from '../../types.d.ts';
|
|
7
|
-
/**
|
|
8
|
-
* The FlattenedSign class is used to build and sign Flattened JWS objects.
|
|
9
|
-
*
|
|
10
|
-
* This class is exported (as a named export) from the main `'jose'` module entry point as well as
|
|
11
|
-
* from its subpath export `'jose/jws/flattened/sign'`.
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
2
|
+
/** The FlattenedSign class is used to build and sign Flattened JWS objects. */
|
|
14
3
|
export declare class FlattenedSign {
|
|
15
4
|
#private;
|
|
16
5
|
/**
|
|
@@ -38,5 +27,5 @@ export declare class FlattenedSign {
|
|
|
38
27
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
39
28
|
* @param options JWS Sign options.
|
|
40
29
|
*/
|
|
41
|
-
sign(key: types.
|
|
30
|
+
sign(key: types.KeyInput, options?: types.SignOptions): Promise<types.FlattenedJWS>;
|
|
42
31
|
}
|
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Verifying JSON Web Signature (JWS) in Flattened JSON Serialization
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
1
|
import type * as types from '../../types.d.ts';
|
|
7
2
|
/**
|
|
8
3
|
* Interface for Flattened JWS Verification dynamic key resolution. No token components have been
|
|
9
4
|
* verified at the time of this function call.
|
|
10
|
-
*
|
|
11
|
-
* @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
|
|
12
5
|
*/
|
|
13
|
-
export interface FlattenedVerifyGetKey extends types.
|
|
6
|
+
export interface FlattenedVerifyGetKey<KeyType extends types.CryptoKey | Uint8Array = types.CryptoKey | Uint8Array> extends types.GetKeyFunction<types.JWSHeaderParameters, types.FlattenedJWSInput, KeyType | types.KeyObject | types.JWK> {
|
|
14
7
|
}
|
|
15
8
|
/**
|
|
16
9
|
* Verifies the signature and format of and afterwards decodes the Flattened JWS.
|
|
17
10
|
*
|
|
18
|
-
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
19
|
-
* as from its subpath export `'jose/jws/flattened/verify'`.
|
|
20
|
-
*
|
|
21
11
|
* @param jws Flattened JWS.
|
|
22
12
|
* @param key Key to verify the JWS with. See
|
|
23
13
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
24
14
|
* @param options JWS Verify options.
|
|
25
15
|
*/
|
|
26
|
-
export declare function flattenedVerify(jws: types.FlattenedJWSInput, key: types.
|
|
16
|
+
export declare function flattenedVerify(jws: types.FlattenedJWSInput, key: types.KeyInput, options?: types.VerifyOptions): Promise<types.FlattenedVerifyResult>;
|
|
27
17
|
/**
|
|
18
|
+
* Verifies the signature and format of and afterwards decodes the Flattened JWS, resolving the key
|
|
19
|
+
* dynamically. The result additionally carries the {@link types.ResolvedKey.key resolved key}.
|
|
20
|
+
*
|
|
28
21
|
* @param jws Flattened JWS.
|
|
29
22
|
* @param getKey Function resolving a key to verify the JWS with. See
|
|
30
23
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
31
24
|
* @param options JWS Verify options.
|
|
32
25
|
*/
|
|
33
|
-
export declare function flattenedVerify(jws: types.FlattenedJWSInput, getKey: FlattenedVerifyGetKey
|
|
26
|
+
export declare function flattenedVerify<KeyType extends types.CryptoKey | Uint8Array = types.CryptoKey | Uint8Array>(jws: types.FlattenedJWSInput, getKey: FlattenedVerifyGetKey<KeyType>, options?: types.VerifyOptions): Promise<types.FlattenedVerifyResult & types.ResolvedKey<KeyType>>;
|
|
27
|
+
/**
|
|
28
|
+
* Accepts either form of the `key` argument. Use this overload when forwarding a value that may be
|
|
29
|
+
* either a key or a key resolution function; `key` is present on the result only when a resolution
|
|
30
|
+
* function was used.
|
|
31
|
+
*
|
|
32
|
+
* @param jws Flattened JWS.
|
|
33
|
+
* @param key Key, or function resolving a key, to verify the JWS with. See
|
|
34
|
+
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
35
|
+
* @param options JWS Verify options.
|
|
36
|
+
*/
|
|
37
|
+
export declare function flattenedVerify(jws: types.FlattenedJWSInput, key: types.KeyInput | FlattenedVerifyGetKey, options?: types.VerifyOptions): Promise<types.FlattenedVerifyResult & Partial<types.ResolvedKey>>;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Signing JSON Web Signature (JWS) in General JSON Serialization
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
1
|
import type * as types from '../../types.d.ts';
|
|
7
2
|
/** Used to build General JWS object's individual signatures. */
|
|
8
3
|
export interface Signature {
|
|
@@ -18,20 +13,24 @@ export interface Signature {
|
|
|
18
13
|
* @param unprotectedHeader JWS Unprotected Header.
|
|
19
14
|
*/
|
|
20
15
|
setUnprotectedHeader(unprotectedHeader: types.JWSHeaderParameters): Signature;
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
/**
|
|
17
|
+
* A shorthand for calling {@link GeneralSign.addSignature addSignature()} on the enclosing
|
|
18
|
+
* {@link GeneralSign} instance.
|
|
19
|
+
*
|
|
20
|
+
* @param key Private Key or Secret to sign the individual JWS signature with. See
|
|
21
|
+
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
22
|
+
* @param options JWS Sign options.
|
|
23
|
+
*/
|
|
24
|
+
addSignature(key: types.KeyInput, options?: types.SignOptions): Signature;
|
|
25
|
+
/**
|
|
26
|
+
* A shorthand for calling {@link GeneralSign.sign sign()} on the enclosing {@link GeneralSign}
|
|
27
|
+
* instance. Takes no arguments — each signature's key is supplied to {@link addSignature}.
|
|
28
|
+
*/
|
|
29
|
+
sign(): Promise<types.GeneralJWS>;
|
|
25
30
|
/** Returns the enclosing {@link GeneralSign} instance */
|
|
26
31
|
done(): GeneralSign;
|
|
27
32
|
}
|
|
28
|
-
/**
|
|
29
|
-
* The GeneralSign class is used to build and sign General JWS objects.
|
|
30
|
-
*
|
|
31
|
-
* This class is exported (as a named export) from the main `'jose'` module entry point as well as
|
|
32
|
-
* from its subpath export `'jose/jws/general/sign'`.
|
|
33
|
-
*
|
|
34
|
-
*/
|
|
33
|
+
/** The GeneralSign class is used to build and sign General JWS objects. */
|
|
35
34
|
export declare class GeneralSign {
|
|
36
35
|
#private;
|
|
37
36
|
/**
|
|
@@ -47,7 +46,7 @@ export declare class GeneralSign {
|
|
|
47
46
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
48
47
|
* @param options JWS Sign options.
|
|
49
48
|
*/
|
|
50
|
-
addSignature(key: types.
|
|
49
|
+
addSignature(key: types.KeyInput, options?: types.SignOptions): Signature;
|
|
51
50
|
/** Signs and resolves the value of the General JWS object. */
|
|
52
51
|
sign(): Promise<types.GeneralJWS>;
|
|
53
52
|
}
|
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Verifying JSON Web Signature (JWS) in General JSON Serialization
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
1
|
import type * as types from '../../types.d.ts';
|
|
7
2
|
/**
|
|
8
3
|
* Interface for General JWS Verification dynamic key resolution. No token components have been
|
|
9
4
|
* verified at the time of this function call.
|
|
10
|
-
*
|
|
11
|
-
* @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
|
|
12
5
|
*/
|
|
13
|
-
export interface GeneralVerifyGetKey extends types.
|
|
6
|
+
export interface GeneralVerifyGetKey<KeyType extends types.CryptoKey | Uint8Array = types.CryptoKey | Uint8Array> extends types.GetKeyFunction<types.JWSHeaderParameters, types.FlattenedJWSInput, KeyType | types.KeyObject | types.JWK> {
|
|
14
7
|
}
|
|
15
8
|
/**
|
|
16
9
|
* Verifies the signature and format of and afterwards decodes the General JWS.
|
|
17
10
|
*
|
|
18
|
-
*
|
|
19
|
-
* as from its subpath export `'jose/jws/general/verify'`.
|
|
20
|
-
*
|
|
21
|
-
* > [!NOTE]\
|
|
22
|
-
* > The function iterates over the `signatures` array in the General JWS and returns the verification
|
|
11
|
+
* > Note: The function iterates over the `signatures` array in the General JWS and returns the verification
|
|
23
12
|
* > result of the first signature entry that can be successfully verified. The result only contains
|
|
24
13
|
* > the payload, protected header, and unprotected header of that successfully verified signature
|
|
25
14
|
* > entry. Other signature entries in the General JWS are not validated, and their headers are not
|
|
@@ -31,11 +20,25 @@ export interface GeneralVerifyGetKey extends types.GenericGetKeyFunction<types.J
|
|
|
31
20
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
32
21
|
* @param options JWS Verify options.
|
|
33
22
|
*/
|
|
34
|
-
export declare function generalVerify(jws: types.GeneralJWSInput, key: types.
|
|
23
|
+
export declare function generalVerify(jws: types.GeneralJWSInput, key: types.KeyInput, options?: types.VerifyOptions): Promise<types.GeneralVerifyResult>;
|
|
35
24
|
/**
|
|
25
|
+
* Verifies the signature and format of and afterwards decodes the General JWS, resolving the key
|
|
26
|
+
* dynamically. The result additionally carries the {@link types.ResolvedKey.key resolved key}.
|
|
27
|
+
*
|
|
36
28
|
* @param jws General JWS.
|
|
37
29
|
* @param getKey Function resolving a key to verify the JWS with. See
|
|
38
30
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
39
31
|
* @param options JWS Verify options.
|
|
40
32
|
*/
|
|
41
|
-
export declare function generalVerify(jws: types.GeneralJWSInput, getKey: GeneralVerifyGetKey
|
|
33
|
+
export declare function generalVerify<KeyType extends types.CryptoKey | Uint8Array = types.CryptoKey | Uint8Array>(jws: types.GeneralJWSInput, getKey: GeneralVerifyGetKey<KeyType>, options?: types.VerifyOptions): Promise<types.GeneralVerifyResult & types.ResolvedKey<KeyType>>;
|
|
34
|
+
/**
|
|
35
|
+
* Accepts either form of the `key` argument. Use this overload when forwarding a value that may be
|
|
36
|
+
* either a key or a key resolution function; `key` is present on the result only when a resolution
|
|
37
|
+
* function was used.
|
|
38
|
+
*
|
|
39
|
+
* @param jws General JWS.
|
|
40
|
+
* @param key Key, or function resolving a key, to verify the JWS with. See
|
|
41
|
+
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
42
|
+
* @param options JWS Verify options.
|
|
43
|
+
*/
|
|
44
|
+
export declare function generalVerify(jws: types.GeneralJWSInput, key: types.KeyInput | GeneralVerifyGetKey, options?: types.VerifyOptions): Promise<types.GeneralVerifyResult & Partial<types.ResolvedKey>>;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON Web Token (JWT) Decryption (JWT is in JWE format)
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
1
|
import type * as types from '../types.d.ts';
|
|
7
2
|
/** Combination of JWE Decryption options and JWT Claims Set verification options. */
|
|
8
3
|
export interface JWTDecryptOptions extends types.DecryptOptions, types.JWTClaimVerificationOptions {
|
|
@@ -11,25 +6,36 @@ export interface JWTDecryptOptions extends types.DecryptOptions, types.JWTClaimV
|
|
|
11
6
|
* Interface for JWT Decryption dynamic key resolution. No token components have been verified at
|
|
12
7
|
* the time of this function call.
|
|
13
8
|
*/
|
|
14
|
-
export interface JWTDecryptGetKey extends types.GetKeyFunction<types.CompactJWEHeaderParameters, types.FlattenedJWE> {
|
|
9
|
+
export interface JWTDecryptGetKey<KeyType extends types.CryptoKey | Uint8Array = types.CryptoKey | Uint8Array> extends types.GetKeyFunction<types.CompactJWEHeaderParameters, types.FlattenedJWE, KeyType | types.KeyObject | types.JWK> {
|
|
15
10
|
}
|
|
16
11
|
/**
|
|
17
12
|
* Verifies the JWT format (to be a JWE Compact format), decrypts the ciphertext, validates the JWT
|
|
18
13
|
* Claims Set.
|
|
19
14
|
*
|
|
20
|
-
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
21
|
-
* as from its subpath export `'jose/jwt/decrypt'`.
|
|
22
|
-
*
|
|
23
15
|
* @param jwt JSON Web Token value (encoded as JWE).
|
|
24
16
|
* @param key Private Key or Secret to decrypt and verify the JWT with. See
|
|
25
17
|
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
26
18
|
* @param options JWT Decryption and JWT Claims Set validation options.
|
|
27
19
|
*/
|
|
28
|
-
export declare function jwtDecrypt<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, key: types.
|
|
20
|
+
export declare function jwtDecrypt<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, key: types.KeyInput, options?: JWTDecryptOptions): Promise<types.JWTDecryptResult<PayloadType>>;
|
|
29
21
|
/**
|
|
22
|
+
* Decrypts a JWT and validates its JWT Claims Set, resolving the key dynamically. The result
|
|
23
|
+
* additionally carries the {@link types.ResolvedKey.key resolved key}.
|
|
24
|
+
*
|
|
30
25
|
* @param jwt JSON Web Token value (encoded as JWE).
|
|
31
26
|
* @param getKey Function resolving Private Key or Secret to decrypt and verify the JWT with. See
|
|
32
27
|
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
33
28
|
* @param options JWT Decryption and JWT Claims Set validation options.
|
|
34
29
|
*/
|
|
35
|
-
export declare function jwtDecrypt<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, getKey: JWTDecryptGetKey
|
|
30
|
+
export declare function jwtDecrypt<PayloadType = types.JWTPayload, KeyType extends types.CryptoKey | Uint8Array = types.CryptoKey | Uint8Array>(jwt: string | Uint8Array, getKey: JWTDecryptGetKey<KeyType>, options?: JWTDecryptOptions): Promise<types.JWTDecryptResult<PayloadType> & types.ResolvedKey<KeyType>>;
|
|
31
|
+
/**
|
|
32
|
+
* Accepts either form of the `key` argument. Use this overload when forwarding a value that may be
|
|
33
|
+
* either a key or a key resolution function; `key` is present on the result only when a resolution
|
|
34
|
+
* function was used.
|
|
35
|
+
*
|
|
36
|
+
* @param jwt JSON Web Token value (encoded as JWE).
|
|
37
|
+
* @param key Private Key or Secret, or a function resolving one, to decrypt and verify the JWT
|
|
38
|
+
* with. See {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
39
|
+
* @param options JWT Decryption and JWT Claims Set validation options.
|
|
40
|
+
*/
|
|
41
|
+
export declare function jwtDecrypt<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, key: types.KeyInput | JWTDecryptGetKey, options?: JWTDecryptOptions): Promise<types.JWTDecryptResult<PayloadType> & Partial<types.ResolvedKey>>;
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON Web Token (JWT) Encryption (JWT is in JWE format)
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
1
|
import type * as types from '../types.d.ts';
|
|
7
|
-
/**
|
|
8
|
-
* The EncryptJWT class is used to build and encrypt Compact JWE formatted JSON Web Tokens.
|
|
9
|
-
*
|
|
10
|
-
* This class is exported (as a named export) from the main `'jose'` module entry point as well as
|
|
11
|
-
* from its subpath export `'jose/jwt/encrypt'`.
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
2
|
+
/** The EncryptJWT class is used to build and encrypt Compact JWE formatted JSON Web Tokens. */
|
|
14
3
|
export declare class EncryptJWT implements types.ProduceJWT {
|
|
15
4
|
#private;
|
|
16
5
|
/**
|
|
@@ -34,17 +23,16 @@ export declare class EncryptJWT implements types.ProduceJWT {
|
|
|
34
23
|
*/
|
|
35
24
|
setProtectedHeader(protectedHeader: types.CompactJWEHeaderParameters): this;
|
|
36
25
|
/**
|
|
37
|
-
* Sets the JWE Key Management parameters to be used when encrypting.
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* PartyUInfo) or "apv" (Agreement PartyVInfo) parameters.
|
|
26
|
+
* Sets the JWE Key Management parameters to be used when encrypting. For ECDH based algorithms,
|
|
27
|
+
* use this method to set the "apu" (Agreement PartyUInfo) or "apv" (Agreement PartyVInfo)
|
|
28
|
+
* parameters.
|
|
41
29
|
*
|
|
42
30
|
* @param parameters JWE Key Management parameters.
|
|
43
31
|
*/
|
|
44
32
|
setKeyManagementParameters(parameters: types.JWEKeyManagementHeaderParameters): this;
|
|
45
33
|
/**
|
|
46
34
|
* Sets a content encryption key to use, by default a random suitable one is generated for the JWE
|
|
47
|
-
* enc" (Encryption Algorithm) Header Parameter.
|
|
35
|
+
* "enc" (Encryption Algorithm) Header Parameter.
|
|
48
36
|
*
|
|
49
37
|
* @deprecated You should not use this method. It is only really intended for test and vector
|
|
50
38
|
* validation purposes.
|
|
@@ -54,7 +42,7 @@ export declare class EncryptJWT implements types.ProduceJWT {
|
|
|
54
42
|
setContentEncryptionKey(cek: Uint8Array): this;
|
|
55
43
|
/**
|
|
56
44
|
* Sets the JWE Initialization Vector to use for content encryption, by default a random suitable
|
|
57
|
-
* one is generated for the JWE enc" (Encryption Algorithm) Header Parameter.
|
|
45
|
+
* one is generated for the JWE "enc" (Encryption Algorithm) Header Parameter.
|
|
58
46
|
*
|
|
59
47
|
* @deprecated You should not use this method. It is only really intended for test and vector
|
|
60
48
|
* validation purposes.
|
|
@@ -62,23 +50,11 @@ export declare class EncryptJWT implements types.ProduceJWT {
|
|
|
62
50
|
* @param iv JWE Initialization Vector.
|
|
63
51
|
*/
|
|
64
52
|
setInitializationVector(iv: Uint8Array): this;
|
|
65
|
-
/**
|
|
66
|
-
* Replicates the "iss" (Issuer) Claim as a JWE Protected Header Parameter.
|
|
67
|
-
*
|
|
68
|
-
* @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-5.3 RFC7519#section-5.3}
|
|
69
|
-
*/
|
|
53
|
+
/** Replicates the "iss" (Issuer) Claim as a JWE Protected Header Parameter. */
|
|
70
54
|
replicateIssuerAsHeader(): this;
|
|
71
|
-
/**
|
|
72
|
-
* Replicates the "sub" (Subject) Claim as a JWE Protected Header Parameter.
|
|
73
|
-
*
|
|
74
|
-
* @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-5.3 RFC7519#section-5.3}
|
|
75
|
-
*/
|
|
55
|
+
/** Replicates the "sub" (Subject) Claim as a JWE Protected Header Parameter. */
|
|
76
56
|
replicateSubjectAsHeader(): this;
|
|
77
|
-
/**
|
|
78
|
-
* Replicates the "aud" (Audience) Claim as a JWE Protected Header Parameter.
|
|
79
|
-
*
|
|
80
|
-
* @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-5.3 RFC7519#section-5.3}
|
|
81
|
-
*/
|
|
57
|
+
/** Replicates the "aud" (Audience) Claim as a JWE Protected Header Parameter. */
|
|
82
58
|
replicateAudienceAsHeader(): this;
|
|
83
59
|
/**
|
|
84
60
|
* Encrypts and returns the JWT.
|
|
@@ -87,5 +63,5 @@ export declare class EncryptJWT implements types.ProduceJWT {
|
|
|
87
63
|
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
|
|
88
64
|
* @param options JWE Encryption options.
|
|
89
65
|
*/
|
|
90
|
-
encrypt(key: types.
|
|
66
|
+
encrypt(key: types.KeyInput, options?: types.EncryptOptions): Promise<string>;
|
|
91
67
|
}
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON Web Token (JWT) Signing (JWT is in JWS format)
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
1
|
import type * as types from '../types.d.ts';
|
|
7
|
-
/**
|
|
8
|
-
* The SignJWT class is used to build and sign Compact JWS formatted JSON Web Tokens.
|
|
9
|
-
*
|
|
10
|
-
* This class is exported (as a named export) from the main `'jose'` module entry point as well as
|
|
11
|
-
* from its subpath export `'jose/jwt/sign'`.
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
2
|
+
/** The SignJWT class is used to build and sign Compact JWS formatted JSON Web Tokens. */
|
|
14
3
|
export declare class SignJWT implements types.ProduceJWT {
|
|
15
4
|
#private;
|
|
16
5
|
/**
|
|
@@ -39,5 +28,5 @@ export declare class SignJWT implements types.ProduceJWT {
|
|
|
39
28
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
40
29
|
* @param options JWT Sign options.
|
|
41
30
|
*/
|
|
42
|
-
sign(key: types.
|
|
31
|
+
sign(key: types.KeyInput, options?: types.SignOptions): Promise<string>;
|
|
43
32
|
}
|
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unsecured (unsigned & unencrypted) JSON Web Tokens (JWT)
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
1
|
import type * as types from '../types.d.ts';
|
|
7
2
|
/** Result of decoding an Unsecured JWT. */
|
|
8
3
|
export interface UnsecuredResult<PayloadType = types.JWTPayload> {
|
|
9
|
-
|
|
4
|
+
/** JWT Claims Set. */
|
|
5
|
+
payload: PayloadType & types.JWTPayload & ([PayloadType] extends [object] ? unknown : unknown extends PayloadType ? unknown : never);
|
|
6
|
+
/** The decoded JOSE Header; always `{ "alg": "none" }` for an Unsecured JWT. */
|
|
10
7
|
header: types.JWSHeaderParameters;
|
|
11
8
|
}
|
|
12
|
-
/**
|
|
13
|
-
* The UnsecuredJWT class is a utility for dealing with `{ "alg": "none" }` Unsecured JWTs.
|
|
14
|
-
*
|
|
15
|
-
* This class is exported (as a named export) from the main `'jose'` module entry point as well as
|
|
16
|
-
* from its subpath export `'jose/jwt/unsecured'`.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
9
|
+
/** The UnsecuredJWT class is a utility for dealing with `{ "alg": "none" }` Unsecured JWTs. */
|
|
19
10
|
export declare class UnsecuredJWT implements types.ProduceJWT {
|
|
20
11
|
#private;
|
|
21
12
|
/**
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON Web Token (JWT) Verification (JWT is in JWS format)
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
1
|
import type * as types from '../types.d.ts';
|
|
7
2
|
/** Combination of JWS Verification options and JWT Claims Set verification options. */
|
|
8
3
|
export interface JWTVerifyOptions extends types.VerifyOptions, types.JWTClaimVerificationOptions {
|
|
@@ -10,28 +5,34 @@ export interface JWTVerifyOptions extends types.VerifyOptions, types.JWTClaimVer
|
|
|
10
5
|
/**
|
|
11
6
|
* Interface for JWT Verification dynamic key resolution. No token components have been verified at
|
|
12
7
|
* the time of this function call.
|
|
13
|
-
*
|
|
14
|
-
* @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
|
|
15
8
|
*/
|
|
16
|
-
export interface JWTVerifyGetKey extends types.
|
|
9
|
+
export interface JWTVerifyGetKey<KeyType extends types.CryptoKey | Uint8Array = types.CryptoKey | Uint8Array> extends types.GetKeyFunction<types.CompactJWSHeaderParameters, types.FlattenedJWSInput, KeyType | types.KeyObject | types.JWK> {
|
|
17
10
|
}
|
|
18
11
|
/**
|
|
19
12
|
* Verifies the JWT format (to be a JWS Compact format), verifies the JWS signature, validates the
|
|
20
13
|
* JWT Claims Set.
|
|
21
14
|
*
|
|
22
|
-
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
23
|
-
* as from its subpath export `'jose/jwt/verify'`.
|
|
24
|
-
*
|
|
25
15
|
* @param jwt JSON Web Token value (encoded as JWS).
|
|
26
16
|
* @param key Key to verify the JWT with. See
|
|
27
17
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
28
18
|
* @param options JWT Decryption and JWT Claims Set validation options.
|
|
29
19
|
*/
|
|
30
|
-
export declare function jwtVerify<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, key: types.
|
|
20
|
+
export declare function jwtVerify<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, key: types.KeyInput, options?: JWTVerifyOptions): Promise<types.JWTVerifyResult<PayloadType>>;
|
|
31
21
|
/**
|
|
32
22
|
* @param jwt JSON Web Token value (encoded as JWS).
|
|
33
23
|
* @param getKey Function resolving a key to verify the JWT with. See
|
|
34
24
|
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
35
25
|
* @param options JWT Decryption and JWT Claims Set validation options.
|
|
36
26
|
*/
|
|
37
|
-
export declare function jwtVerify<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, getKey: JWTVerifyGetKey
|
|
27
|
+
export declare function jwtVerify<PayloadType = types.JWTPayload, KeyType extends types.CryptoKey | Uint8Array = types.CryptoKey | Uint8Array>(jwt: string | Uint8Array, getKey: JWTVerifyGetKey<KeyType>, options?: JWTVerifyOptions): Promise<types.JWTVerifyResult<PayloadType> & types.ResolvedKey<KeyType>>;
|
|
28
|
+
/**
|
|
29
|
+
* Accepts either form of the `key` argument. Use this overload when forwarding a value that may be
|
|
30
|
+
* either a key or a key resolution function; `key` is present on the result only when a resolution
|
|
31
|
+
* function was used.
|
|
32
|
+
*
|
|
33
|
+
* @param jwt JSON Web Token value (encoded as JWS).
|
|
34
|
+
* @param key Key, or function resolving a key, to verify the JWT with. See
|
|
35
|
+
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
|
|
36
|
+
* @param options JWT Decryption and JWT Claims Set validation options.
|
|
37
|
+
*/
|
|
38
|
+
export declare function jwtVerify<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, key: types.KeyInput | JWTVerifyGetKey, options?: JWTVerifyOptions): Promise<types.JWTVerifyResult<PayloadType> & Partial<types.ResolvedKey>>;
|
|
@@ -1,33 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cryptographic key export functions
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
1
|
import type * as types from '../types.d.ts';
|
|
7
2
|
/**
|
|
8
3
|
* Exports a public {@link !CryptoKey} or {@link !KeyObject} to a PEM-encoded SPKI string format.
|
|
9
4
|
*
|
|
10
|
-
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
11
|
-
* as from its subpath export `'jose/key/export'`.
|
|
12
|
-
*
|
|
13
5
|
* @param key Key to export to a PEM-encoded SPKI string format.
|
|
14
6
|
*/
|
|
15
7
|
export declare function exportSPKI(key: types.CryptoKey | types.KeyObject): Promise<string>;
|
|
16
8
|
/**
|
|
17
9
|
* Exports a private {@link !CryptoKey} or {@link !KeyObject} to a PEM-encoded PKCS8 string format.
|
|
18
10
|
*
|
|
19
|
-
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
20
|
-
* as from its subpath export `'jose/key/export'`.
|
|
21
|
-
*
|
|
22
11
|
* @param key Key to export to a PEM-encoded PKCS8 string format.
|
|
23
12
|
*/
|
|
24
13
|
export declare function exportPKCS8(key: types.CryptoKey | types.KeyObject): Promise<string>;
|
|
25
14
|
/**
|
|
26
15
|
* Exports a {@link !CryptoKey}, {@link !KeyObject}, or {@link !Uint8Array} to a JWK.
|
|
27
16
|
*
|
|
28
|
-
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
29
|
-
* as from its subpath export `'jose/key/export'`.
|
|
30
|
-
*
|
|
31
17
|
* @param key Key to export as JWK.
|
|
32
18
|
*/
|
|
33
19
|
export declare function exportJWK(key: types.CryptoKey | types.KeyObject | Uint8Array): Promise<types.JWK>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type * as types from '../types.d.ts';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
3
|
+
* JWA Algorithm Identifiers that {@link generateKeyPair} is able to generate a key pair for, subject
|
|
4
|
+
* to runtime support.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
export type GenerateKeyPairAlgorithm = 'PS256' | 'PS384' | 'PS512' | 'RS256' | 'RS384' | 'RS512' | 'RSA-OAEP' | 'RSA-OAEP-256' | 'RSA-OAEP-384' | 'RSA-OAEP-512' | 'ES256' | 'ES384' | 'ES512' | 'Ed25519' | 'EdDSA' | 'ML-DSA-44' | 'ML-DSA-65' | 'ML-DSA-87' | 'ECDH-ES' | 'ECDH-ES+A128KW' | 'ECDH-ES+A192KW' | 'ECDH-ES+A256KW' | (string & {});
|
|
7
7
|
/** Asymmetric key pair generation function result. */
|
|
8
8
|
export interface GenerateKeyPairResult {
|
|
9
9
|
/** The generated Private Key. */
|
|
@@ -23,25 +23,18 @@ export interface GenerateKeyPairOptions {
|
|
|
23
23
|
* JOSE requires 2048 bits or larger. Default is 2048.
|
|
24
24
|
*/
|
|
25
25
|
modulusLength?: number;
|
|
26
|
-
/**
|
|
27
|
-
* The value to use as {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false.
|
|
28
|
-
*
|
|
29
|
-
*/
|
|
26
|
+
/** The value to use as {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false. */
|
|
30
27
|
extractable?: boolean;
|
|
31
28
|
}
|
|
32
29
|
/**
|
|
33
30
|
* Generates a private and a public key for a given JWA algorithm identifier. This can only generate
|
|
34
31
|
* asymmetric key pairs. For symmetric secrets use the `generateSecret` function.
|
|
35
32
|
*
|
|
36
|
-
* >
|
|
37
|
-
* > The `privateKey` is generated with `extractable` set to `false` by default. See
|
|
33
|
+
* > Note: The `privateKey` is generated with `extractable` set to `false` by default. See
|
|
38
34
|
* > {@link GenerateKeyPairOptions.extractable} to generate an extractable `privateKey`.
|
|
39
35
|
*
|
|
40
|
-
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
41
|
-
* as from its subpath export `'jose/generate/keypair'`.
|
|
42
|
-
*
|
|
43
36
|
* @param alg JWA Algorithm Identifier to be used with the generated key pair. See
|
|
44
37
|
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
|
|
45
38
|
* @param options Additional options passed down to the key pair generation.
|
|
46
39
|
*/
|
|
47
|
-
export declare function generateKeyPair(alg:
|
|
40
|
+
export declare function generateKeyPair(alg: GenerateKeyPairAlgorithm, options?: GenerateKeyPairOptions): Promise<GenerateKeyPairResult>;
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
+
import type * as types from '../types.d.ts';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
3
|
+
* JWA Algorithm Identifiers that {@link generateSecret} is able to generate a secret for, subject to
|
|
4
|
+
* runtime support.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
export type GenerateSecretAlgorithm = 'HS256' | 'HS384' | 'HS512' | 'A128CBC-HS256' | 'A192CBC-HS384' | 'A256CBC-HS512' | 'A128KW' | 'A192KW' | 'A256KW' | 'A128GCMKW' | 'A192GCMKW' | 'A256GCMKW' | 'A128GCM' | 'A192GCM' | 'A256GCM' | (string & {});
|
|
7
|
+
/**
|
|
8
|
+
* Resolves what {@link generateSecret} returns for a given JWA Algorithm Identifier. The
|
|
9
|
+
* AES_CBC_HMAC_SHA2 content encryption algorithms have no {@link !CryptoKey} representation, so they
|
|
10
|
+
* yield a {@link !Uint8Array}; every other supported identifier yields a
|
|
11
|
+
* {@link types.CryptoKey CryptoKey}. When the identifier is not statically known this resolves to
|
|
12
|
+
* their union.
|
|
13
|
+
*/
|
|
14
|
+
export type GeneratedSecret<Alg extends string> = Alg extends 'A128CBC-HS256' | 'A192CBC-HS384' | 'A256CBC-HS512' ? Uint8Array : string extends Alg ? types.CryptoKey | Uint8Array : types.CryptoKey;
|
|
7
15
|
/** Secret generation function options. */
|
|
8
16
|
export interface GenerateSecretOptions {
|
|
9
17
|
/**
|
|
10
18
|
* The value to use as {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false.
|
|
11
19
|
*
|
|
12
|
-
* >
|
|
13
|
-
* > Because A128CBC-HS256, A192CBC-HS384, and A256CBC-HS512 secrets cannot be represented as
|
|
20
|
+
* > Note: Because A128CBC-HS256, A192CBC-HS384, and A256CBC-HS512 secrets cannot be represented as
|
|
14
21
|
* > {@link !CryptoKey} this option has no effect for them.
|
|
15
22
|
*/
|
|
16
23
|
extractable?: boolean;
|
|
@@ -18,18 +25,13 @@ export interface GenerateSecretOptions {
|
|
|
18
25
|
/**
|
|
19
26
|
* Generates a symmetric secret key for a given JWA algorithm identifier.
|
|
20
27
|
*
|
|
21
|
-
* >
|
|
22
|
-
* > The secret key is generated with `extractable` set to `false` by default.
|
|
28
|
+
* > Note: The secret key is generated with `extractable` set to `false` by default.
|
|
23
29
|
*
|
|
24
|
-
* >
|
|
25
|
-
* > Because A128CBC-HS256, A192CBC-HS384, and A256CBC-HS512 secrets cannot be represented as
|
|
30
|
+
* > Note: Because A128CBC-HS256, A192CBC-HS384, and A256CBC-HS512 secrets cannot be represented as
|
|
26
31
|
* > {@link !CryptoKey} this method yields a {@link !Uint8Array} for them instead.
|
|
27
32
|
*
|
|
28
|
-
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
29
|
-
* as from its subpath export `'jose/generate/secret'`.
|
|
30
|
-
*
|
|
31
33
|
* @param alg JWA Algorithm Identifier to be used with the generated secret. See
|
|
32
34
|
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
|
|
33
35
|
* @param options Additional options passed down to the secret generation.
|
|
34
36
|
*/
|
|
35
|
-
export declare function generateSecret(alg:
|
|
37
|
+
export declare function generateSecret<Alg extends GenerateSecretAlgorithm>(alg: Alg, options?: GenerateSecretOptions): Promise<GeneratedSecret<Alg>>;
|