@zuplo/cli 6.73.27 → 6.73.28

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.
Files changed (92) hide show
  1. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/README.md +13 -13
  2. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/index.d.ts +6 -5
  3. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +17 -11
  4. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +7 -19
  5. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +17 -11
  6. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +7 -19
  7. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +18 -13
  8. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +20 -21
  9. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwk/embedded.d.ts +8 -12
  10. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwk/thumbprint.d.ts +0 -15
  11. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwks/local.d.ts +12 -21
  12. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwks/remote.d.ts +34 -165
  13. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/compact/sign.d.ts +2 -13
  14. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/compact/verify.d.ts +17 -13
  15. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/flattened/sign.d.ts +2 -13
  16. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/flattened/verify.d.ts +17 -13
  17. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/general/sign.d.ts +16 -17
  18. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jws/general/verify.d.ts +18 -15
  19. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/decrypt.d.ts +17 -11
  20. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/encrypt.d.ts +10 -34
  21. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/sign.d.ts +2 -13
  22. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/unsecured.d.ts +4 -13
  23. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/verify.d.ts +14 -13
  24. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/export.d.ts +0 -14
  25. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/generate_key_pair.d.ts +7 -14
  26. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/generate_secret.d.ts +16 -14
  27. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/key/import.d.ts +18 -28
  28. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/types.d.ts +242 -223
  29. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/base64url.d.ts +11 -4
  30. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/decode_jwt.d.ts +1 -9
  31. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/decode_protected_header.d.ts +0 -8
  32. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/errors.d.ts +128 -121
  33. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +3 -21
  34. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +5 -153
  35. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +16 -111
  36. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/decrypt.js +15 -3
  37. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/encrypt.js +33 -48
  38. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwk/embedded.js +5 -3
  39. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/local.js +27 -47
  40. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +3 -3
  41. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/compact/sign.js +5 -2
  42. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/compact/verify.js +3 -15
  43. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/flattened/sign.js +7 -57
  44. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/flattened/verify.js +3 -89
  45. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/general/sign.js +18 -5
  46. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/general/verify.js +21 -3
  47. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/decrypt.js +4 -4
  48. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/sign.js +2 -3
  49. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/unsecured.js +4 -3
  50. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/verify.js +5 -5
  51. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/export.js +34 -1
  52. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/generate_key_pair.js +32 -82
  53. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/key/import.js +8 -8
  54. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/asn1.js +29 -65
  55. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/buffer_utils.js +1 -0
  56. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/content_encryption.js +20 -77
  57. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/crypto_key.js +13 -127
  58. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/helpers.js +23 -0
  59. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +143 -0
  60. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +181 -0
  61. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +109 -0
  62. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwk_to_key.js +11 -96
  63. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_algorithms.js +74 -0
  64. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_sign.js +68 -0
  65. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jws_verify.js +108 -0
  66. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +9 -8
  67. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key.js +170 -0
  68. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_algorithm.js +16 -0
  69. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_descriptor.js +7 -0
  70. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_management.js +186 -29
  71. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/{validate_crit.js → options.js} +18 -0
  72. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/signing.js +20 -52
  73. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/base64url.js +11 -3
  74. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/decode_jwt.js +2 -2
  75. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/decode_protected_header.js +5 -15
  76. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/util/errors.js +1 -1
  77. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/package.json +2 -4
  78. package/node_modules/@zuplo/core/package.json +1 -1
  79. package/node_modules/@zuplo/graphql/package.json +1 -1
  80. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  81. package/node_modules/@zuplo/otel/package.json +1 -1
  82. package/node_modules/@zuplo/runtime/package.json +1 -1
  83. package/package.json +6 -6
  84. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/aesgcmkw.js +0 -15
  85. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/aeskw.js +0 -25
  86. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/check_key_type.js +0 -122
  87. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/ecdhes.js +0 -52
  88. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_to_jwk.js +0 -34
  89. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/normalize_key.js +0 -166
  90. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/pbes2kw.js +0 -42
  91. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/rsaes.js +0 -24
  92. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/validate_algorithms.js +0 -10
@@ -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
- payload: PayloadType & types.JWTPayload;
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.GenericGetKeyFunction<types.JWTHeaderParameters, types.FlattenedJWSInput, types.CryptoKey | types.KeyObject | types.JWK | Uint8Array> {
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.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: JWTVerifyOptions): Promise<types.JWTVerifyResult<PayloadType>>;
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, options?: JWTVerifyOptions): Promise<types.JWTVerifyResult<PayloadType> & types.ResolvedKey>;
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
- * Asymmetric key generation
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
- import type * as types from '../types.d.ts';
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
- * > [!NOTE]\
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: string, options?: GenerateKeyPairOptions): Promise<GenerateKeyPairResult>;
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
- * Symmetric key generation
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
- import type * as types from '../types.d.ts';
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
- * > [!NOTE]\
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
- * > [!NOTE]\
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
- * > [!NOTE]\
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: string, options?: GenerateSecretOptions): Promise<types.CryptoKey | Uint8Array>;
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
- * Cryptographic key import functions
3
- *
4
- * @module
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
- import type * as types from '../types.d.ts';
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
- * > [!NOTE]\
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
- * > [!NOTE]\
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
- * > [!NOTE]\
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
- * > [!NOTE]\
68
- * > The JSON Web Key parameters "use", "key_ops", and "ext" are also used in the {@link !CryptoKey}
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
- * > [!NOTE]\
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: types.JWK, alg?: string, options?: KeyImportOptions): Promise<types.CryptoKey | Uint8Array>;
73
+ export declare function importJWK<JWKType extends types.JWK>(jwk: JWKType, alg?: string, options?: KeyImportOptions): Promise<ImportedJWK<JWKType>>;