@suveren/gateway 0.4.0 → 0.5.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 +59 -0
- package/content/integrations/calendar.json +116 -22
- package/content/integrations/gmail.json +3 -0
- package/dist/control-plane/index.mjs +67 -7
- package/dist/mcp-server/http.mjs +98 -17
- package/dist/ui/assets/index-DedRWpBs.js +105 -0
- package/dist/ui/index.html +1 -1
- package/lib/autostart-templates.d.mts +37 -0
- package/lib/autostart-templates.mjs +208 -0
- 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 +242 -223
- 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 +3 -21
- 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 +33 -48
- package/node_modules/jose/dist/webapi/jwk/embedded.js +5 -3
- package/node_modules/jose/dist/webapi/jwks/local.js +27 -47
- package/node_modules/jose/dist/webapi/jwks/remote.js +3 -3
- package/node_modules/jose/dist/webapi/jws/compact/sign.js +5 -2
- package/node_modules/jose/dist/webapi/jws/compact/verify.js +3 -15
- package/node_modules/jose/dist/webapi/jws/flattened/sign.js +7 -57
- package/node_modules/jose/dist/webapi/jws/flattened/verify.js +3 -89
- package/node_modules/jose/dist/webapi/jws/general/sign.js +18 -5
- package/node_modules/jose/dist/webapi/jws/general/verify.js +21 -3
- package/node_modules/jose/dist/webapi/jwt/decrypt.js +4 -4
- 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 +5 -5
- package/node_modules/jose/dist/webapi/key/export.js +34 -1
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +32 -82
- package/node_modules/jose/dist/webapi/key/import.js +8 -8
- package/node_modules/jose/dist/webapi/lib/asn1.js +29 -65
- package/node_modules/jose/dist/webapi/lib/buffer_utils.js +1 -0
- package/node_modules/jose/dist/webapi/lib/content_encryption.js +20 -77
- package/node_modules/jose/dist/webapi/lib/crypto_key.js +13 -127
- package/node_modules/jose/dist/webapi/lib/helpers.js +23 -0
- package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +143 -0
- package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +181 -0
- package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +109 -0
- package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +11 -96
- package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +74 -0
- package/node_modules/jose/dist/webapi/lib/jws_sign.js +68 -0
- package/node_modules/jose/dist/webapi/lib/jws_verify.js +108 -0
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +9 -8
- package/node_modules/jose/dist/webapi/lib/key.js +170 -0
- package/node_modules/jose/dist/webapi/lib/key_algorithm.js +16 -0
- package/node_modules/jose/dist/webapi/lib/key_descriptor.js +7 -0
- package/node_modules/jose/dist/webapi/lib/key_management.js +186 -29
- package/node_modules/jose/dist/webapi/lib/{validate_crit.js → options.js} +18 -0
- package/node_modules/jose/dist/webapi/lib/signing.js +20 -52
- package/node_modules/jose/dist/webapi/util/base64url.js +11 -3
- 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 -1
- package/profiles/email/0.4.profile.json +2 -1
- package/dist/ui/assets/index-BDQY7Z3H.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
|
@@ -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>>;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
import type * as types from '../types.d.ts';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @
|
|
3
|
+
* Resolves what {@link importJWK} returns for a given JWK type. The "kty" (Key Type) Parameter fully
|
|
4
|
+
* determines the outcome at runtime: `"oct"` yields a {@link !Uint8Array} secret, every other
|
|
5
|
+
* supported key type yields a {@link types.CryptoKey CryptoKey}. When "kty" is not statically known
|
|
6
|
+
* — the usual case for a JWK parsed from JSON, or for a value typed as {@link types.JWK JWK} — this
|
|
7
|
+
* resolves to their union.
|
|
5
8
|
*/
|
|
6
|
-
|
|
9
|
+
export type ImportedJWK<JWKType extends types.JWK> = JWKType extends {
|
|
10
|
+
kty: 'oct';
|
|
11
|
+
} ? Uint8Array : JWKType extends {
|
|
12
|
+
kty: 'AKP' | 'EC' | 'OKP' | 'RSA';
|
|
13
|
+
} ? types.CryptoKey : types.CryptoKey | Uint8Array;
|
|
7
14
|
/** Key Import Function options. */
|
|
8
15
|
export interface KeyImportOptions {
|
|
9
16
|
/**
|
|
@@ -15,14 +22,10 @@ export interface KeyImportOptions {
|
|
|
15
22
|
/**
|
|
16
23
|
* Imports a PEM-encoded SPKI string as a {@link !CryptoKey}.
|
|
17
24
|
*
|
|
18
|
-
* >
|
|
19
|
-
* > The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
|
|
25
|
+
* > Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
|
|
20
26
|
* > {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
|
|
21
27
|
* > (1.2.840.113549.1.1.1) instead for all RSA algorithms.
|
|
22
28
|
*
|
|
23
|
-
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
24
|
-
* as from its subpath export `'jose/key/import'`.
|
|
25
|
-
*
|
|
26
29
|
* @param spki PEM-encoded SPKI string
|
|
27
30
|
* @param alg JSON Web Algorithm identifier to be used with the imported key. See
|
|
28
31
|
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
|
|
@@ -31,14 +34,10 @@ export declare function importSPKI(spki: string, alg: string, options?: KeyImpor
|
|
|
31
34
|
/**
|
|
32
35
|
* Imports the SPKI from an X.509 string certificate as a {@link !CryptoKey}.
|
|
33
36
|
*
|
|
34
|
-
* >
|
|
35
|
-
* > The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
|
|
37
|
+
* > Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
|
|
36
38
|
* > {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
|
|
37
39
|
* > (1.2.840.113549.1.1.1) instead for all RSA algorithms.
|
|
38
40
|
*
|
|
39
|
-
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
40
|
-
* as from its subpath export `'jose/key/import'`.
|
|
41
|
-
*
|
|
42
41
|
* @param x509 X.509 certificate string
|
|
43
42
|
* @param alg JSON Web Algorithm identifier to be used with the imported key. See
|
|
44
43
|
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
|
|
@@ -47,14 +46,10 @@ export declare function importX509(x509: string, alg: string, options?: KeyImpor
|
|
|
47
46
|
/**
|
|
48
47
|
* Imports a PEM-encoded PKCS#8 string as a {@link !CryptoKey}.
|
|
49
48
|
*
|
|
50
|
-
* >
|
|
51
|
-
* > The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
|
|
49
|
+
* > Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
|
|
52
50
|
* > {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
|
|
53
51
|
* > (1.2.840.113549.1.1.1) instead for all RSA algorithms.
|
|
54
52
|
*
|
|
55
|
-
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
56
|
-
* as from its subpath export `'jose/key/import'`.
|
|
57
|
-
*
|
|
58
53
|
* @param pkcs8 PEM-encoded PKCS#8 string
|
|
59
54
|
* @param alg JSON Web Algorithm identifier to be used with the imported key. See
|
|
60
55
|
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
|
|
@@ -64,20 +59,15 @@ export declare function importPKCS8(pkcs8: string, alg: string, options?: KeyImp
|
|
|
64
59
|
* Imports a JWK to a {@link !CryptoKey}. Either the JWK "alg" (Algorithm) Parameter, or the optional
|
|
65
60
|
* "alg" argument, must be present for asymmetric JSON Web Key imports.
|
|
66
61
|
*
|
|
67
|
-
* >
|
|
68
|
-
* >
|
|
69
|
-
* > import process.
|
|
62
|
+
* > Note: The JSON Web Key parameters "key_ops" and "ext" are also used in the {@link !CryptoKey} import
|
|
63
|
+
* > process.
|
|
70
64
|
*
|
|
71
|
-
* >
|
|
72
|
-
* > Symmetric JSON Web Keys (i.e. `kty: "oct"`) yield back an {@link !Uint8Array} instead of a
|
|
65
|
+
* > Note: Symmetric JSON Web Keys (i.e. `kty: "oct"`) yield back an {@link !Uint8Array} instead of a
|
|
73
66
|
* > {@link !CryptoKey}.
|
|
74
67
|
*
|
|
75
|
-
* This function is exported (as a named export) from the main `'jose'` module entry point as well
|
|
76
|
-
* as from its subpath export `'jose/key/import'`.
|
|
77
|
-
*
|
|
78
68
|
* @param jwk JSON Web Key.
|
|
79
69
|
* @param alg JSON Web Algorithm identifier to be used with the imported key. Default is the "alg"
|
|
80
70
|
* property on the JWK. See
|
|
81
71
|
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
|
|
82
72
|
*/
|
|
83
|
-
export declare function importJWK(jwk:
|
|
73
|
+
export declare function importJWK<JWKType extends types.JWK>(jwk: JWKType, alg?: string, options?: KeyImportOptions): Promise<ImportedJWK<JWKType>>;
|