@scaleway/sdk-key-manager 1.2.2 → 1.3.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.
@@ -205,7 +205,7 @@ class API extends sdkClient.API {
205
205
  marshalling_gen.unmarshalDataKey
206
206
  );
207
207
  /**
208
- * Encrypt a payload. Encrypt a payload using an existing key, specified by the `key_id` parameter. Only keys with a usage set to `symmetric_encryption` are supported by this method. The maximum payload size that can be encrypted is 64 KB of plaintext.
208
+ * Encrypt a payload. Encrypt a payload using an existing key, specified by the `key_id` parameter. The maximum payload size that can be encrypted is 64 KB of plaintext.
209
209
  *
210
210
  * @param request - The request {@link EncryptRequest}
211
211
  * @returns A Promise of EncryptResponse
@@ -313,5 +313,19 @@ class API extends sdkClient.API {
313
313
  },
314
314
  marshalling_gen.unmarshalKey
315
315
  );
316
+ /**
317
+ * List all available algorithms. Lists all cryptographic algorithms supported by the Key Manager service.
318
+ *
319
+ * @param request - The request {@link ListAlgorithmsRequest}
320
+ * @returns A Promise of ListAlgorithmsResponse
321
+ */
322
+ listAlgorithms = (request = {}) => this.client.fetch(
323
+ {
324
+ method: "GET",
325
+ path: `/key-manager/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/algorithms`,
326
+ urlParams: sdkClient.urlParams(["usages", request.usages])
327
+ },
328
+ marshalling_gen.unmarshalListAlgorithmsResponse
329
+ );
316
330
  }
317
331
  exports.API = API;
@@ -1,6 +1,6 @@
1
- import { API as ParentAPI } from '@scaleway/sdk-client';
2
1
  import type { ApiLocality } from '@scaleway/sdk-client';
3
- import type { CreateKeyRequest, DataKey, DecryptRequest, DecryptResponse, DeleteKeyMaterialRequest, DeleteKeyRequest, DisableKeyRequest, EnableKeyRequest, EncryptRequest, EncryptResponse, GenerateDataKeyRequest, GetKeyRequest, GetPublicKeyRequest, ImportKeyMaterialRequest, Key, ListKeysRequest, ListKeysResponse, ProtectKeyRequest, PublicKey, RestoreKeyRequest, RotateKeyRequest, SignRequest, SignResponse, UnprotectKeyRequest, UpdateKeyRequest, VerifyRequest, VerifyResponse } from './types.gen';
2
+ import { API as ParentAPI } from '@scaleway/sdk-client';
3
+ import type { CreateKeyRequest, DataKey, DecryptRequest, DecryptResponse, DeleteKeyMaterialRequest, DeleteKeyRequest, DisableKeyRequest, EnableKeyRequest, EncryptRequest, EncryptResponse, GenerateDataKeyRequest, GetKeyRequest, GetPublicKeyRequest, ImportKeyMaterialRequest, Key, ListAlgorithmsRequest, ListAlgorithmsResponse, ListKeysRequest, ListKeysResponse, ProtectKeyRequest, PublicKey, RestoreKeyRequest, RotateKeyRequest, SignRequest, SignResponse, UnprotectKeyRequest, UpdateKeyRequest, VerifyRequest, VerifyResponse } from './types.gen';
4
4
  /**
5
5
  * Key Manager API.
6
6
 
@@ -102,7 +102,7 @@ export declare class API extends ParentAPI {
102
102
  */
103
103
  generateDataKey: (request: Readonly<GenerateDataKeyRequest>) => Promise<DataKey>;
104
104
  /**
105
- * Encrypt a payload. Encrypt a payload using an existing key, specified by the `key_id` parameter. Only keys with a usage set to `symmetric_encryption` are supported by this method. The maximum payload size that can be encrypted is 64 KB of plaintext.
105
+ * Encrypt a payload. Encrypt a payload using an existing key, specified by the `key_id` parameter. The maximum payload size that can be encrypted is 64 KB of plaintext.
106
106
  *
107
107
  * @param request - The request {@link EncryptRequest}
108
108
  * @returns A Promise of EncryptResponse
@@ -149,4 +149,11 @@ export declare class API extends ParentAPI {
149
149
  * @returns A Promise of Key
150
150
  */
151
151
  restoreKey: (request: Readonly<RestoreKeyRequest>) => Promise<Key>;
152
+ /**
153
+ * List all available algorithms. Lists all cryptographic algorithms supported by the Key Manager service.
154
+ *
155
+ * @param request - The request {@link ListAlgorithmsRequest}
156
+ * @returns A Promise of ListAlgorithmsResponse
157
+ */
158
+ listAlgorithms: (request?: Readonly<ListAlgorithmsRequest>) => Promise<ListAlgorithmsResponse>;
152
159
  }
@@ -1,5 +1,5 @@
1
1
  import { API as API$1, toApiLocality, validatePathParam, urlParams, enrichForPagination } from "@scaleway/sdk-client";
2
- import { marshalCreateKeyRequest, unmarshalKey, unmarshalPublicKey, marshalUpdateKeyRequest, unmarshalListKeysResponse, marshalGenerateDataKeyRequest, unmarshalDataKey, marshalEncryptRequest, unmarshalEncryptResponse, marshalDecryptRequest, unmarshalDecryptResponse, marshalSignRequest, unmarshalSignResponse, marshalVerifyRequest, unmarshalVerifyResponse, marshalImportKeyMaterialRequest } from "./marshalling.gen.js";
2
+ import { marshalCreateKeyRequest, unmarshalKey, unmarshalPublicKey, marshalUpdateKeyRequest, unmarshalListKeysResponse, marshalGenerateDataKeyRequest, unmarshalDataKey, marshalEncryptRequest, unmarshalEncryptResponse, marshalDecryptRequest, unmarshalDecryptResponse, marshalSignRequest, unmarshalSignResponse, marshalVerifyRequest, unmarshalVerifyResponse, marshalImportKeyMaterialRequest, unmarshalListAlgorithmsResponse } from "./marshalling.gen.js";
3
3
  const jsonContentHeaders = {
4
4
  "Content-Type": "application/json; charset=utf-8"
5
5
  };
@@ -203,7 +203,7 @@ class API extends API$1 {
203
203
  unmarshalDataKey
204
204
  );
205
205
  /**
206
- * Encrypt a payload. Encrypt a payload using an existing key, specified by the `key_id` parameter. Only keys with a usage set to `symmetric_encryption` are supported by this method. The maximum payload size that can be encrypted is 64 KB of plaintext.
206
+ * Encrypt a payload. Encrypt a payload using an existing key, specified by the `key_id` parameter. The maximum payload size that can be encrypted is 64 KB of plaintext.
207
207
  *
208
208
  * @param request - The request {@link EncryptRequest}
209
209
  * @returns A Promise of EncryptResponse
@@ -311,6 +311,20 @@ class API extends API$1 {
311
311
  },
312
312
  unmarshalKey
313
313
  );
314
+ /**
315
+ * List all available algorithms. Lists all cryptographic algorithms supported by the Key Manager service.
316
+ *
317
+ * @param request - The request {@link ListAlgorithmsRequest}
318
+ * @returns A Promise of ListAlgorithmsResponse
319
+ */
320
+ listAlgorithms = (request = {}) => this.client.fetch(
321
+ {
322
+ method: "GET",
323
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/algorithms`,
324
+ urlParams: urlParams(["usages", request.usages])
325
+ },
326
+ unmarshalListAlgorithmsResponse
327
+ );
314
328
  }
315
329
  export {
316
330
  API
@@ -15,6 +15,7 @@ exports.unmarshalDataKey = marshalling_gen.unmarshalDataKey;
15
15
  exports.unmarshalDecryptResponse = marshalling_gen.unmarshalDecryptResponse;
16
16
  exports.unmarshalEncryptResponse = marshalling_gen.unmarshalEncryptResponse;
17
17
  exports.unmarshalKey = marshalling_gen.unmarshalKey;
18
+ exports.unmarshalListAlgorithmsResponse = marshalling_gen.unmarshalListAlgorithmsResponse;
18
19
  exports.unmarshalListKeysResponse = marshalling_gen.unmarshalListKeysResponse;
19
20
  exports.unmarshalPublicKey = marshalling_gen.unmarshalPublicKey;
20
21
  exports.unmarshalSignResponse = marshalling_gen.unmarshalSignResponse;
@@ -1,3 +1,3 @@
1
1
  export { API } from './api.gen';
2
2
  export * from './marshalling.gen';
3
- export type { CreateKeyRequest, DataKey, DataKeyAlgorithmSymmetricEncryption, DecryptRequest, DecryptResponse, DeleteKeyMaterialRequest, DeleteKeyRequest, DisableKeyRequest, EnableKeyRequest, EncryptRequest, EncryptResponse, GenerateDataKeyRequest, GetKeyRequest, GetPublicKeyRequest, ImportKeyMaterialRequest, Key, KeyAlgorithmAsymmetricEncryption, KeyAlgorithmAsymmetricSigning, KeyAlgorithmSymmetricEncryption, KeyOrigin, KeyRotationPolicy, KeyState, KeyUsage, ListKeysRequest, ListKeysRequestOrderBy, ListKeysRequestUsage, ListKeysResponse, ProtectKeyRequest, PublicKey, RestoreKeyRequest, RotateKeyRequest, SignRequest, SignResponse, UnprotectKeyRequest, UpdateKeyRequest, VerifyRequest, VerifyResponse, } from './types.gen';
3
+ export type { CreateKeyRequest, DataKey, DataKeyAlgorithmSymmetricEncryption, DecryptRequest, DecryptResponse, DeleteKeyMaterialRequest, DeleteKeyRequest, DisableKeyRequest, EnableKeyRequest, EncryptRequest, EncryptResponse, GenerateDataKeyRequest, GetKeyRequest, GetPublicKeyRequest, ImportKeyMaterialRequest, Key, KeyAlgorithmAsymmetricEncryption, KeyAlgorithmAsymmetricSigning, KeyAlgorithmSymmetricEncryption, KeyOrigin, KeyRotationPolicy, KeyState, KeyUsage, ListAlgorithmsRequest, ListAlgorithmsRequestUsage, ListAlgorithmsResponse, ListAlgorithmsResponseAlgorithm, ListKeysRequest, ListKeysRequestOrderBy, ListKeysRequestUsage, ListKeysResponse, ProtectKeyRequest, PublicKey, RestoreKeyRequest, RotateKeyRequest, SignRequest, SignResponse, UnprotectKeyRequest, UpdateKeyRequest, VerifyRequest, VerifyResponse, } from './types.gen';
@@ -1,5 +1,5 @@
1
1
  import { API } from "./api.gen.js";
2
- import { marshalCreateKeyRequest, marshalDecryptRequest, marshalEncryptRequest, marshalGenerateDataKeyRequest, marshalImportKeyMaterialRequest, marshalSignRequest, marshalUpdateKeyRequest, marshalVerifyRequest, unmarshalDataKey, unmarshalDecryptResponse, unmarshalEncryptResponse, unmarshalKey, unmarshalListKeysResponse, unmarshalPublicKey, unmarshalSignResponse, unmarshalVerifyResponse } from "./marshalling.gen.js";
2
+ import { marshalCreateKeyRequest, marshalDecryptRequest, marshalEncryptRequest, marshalGenerateDataKeyRequest, marshalImportKeyMaterialRequest, marshalSignRequest, marshalUpdateKeyRequest, marshalVerifyRequest, unmarshalDataKey, unmarshalDecryptResponse, unmarshalEncryptResponse, unmarshalKey, unmarshalListAlgorithmsResponse, unmarshalListKeysResponse, unmarshalPublicKey, unmarshalSignResponse, unmarshalVerifyResponse } from "./marshalling.gen.js";
3
3
  export {
4
4
  API,
5
5
  marshalCreateKeyRequest,
@@ -14,6 +14,7 @@ export {
14
14
  unmarshalDecryptResponse,
15
15
  unmarshalEncryptResponse,
16
16
  unmarshalKey,
17
+ unmarshalListAlgorithmsResponse,
17
18
  unmarshalListKeysResponse,
18
19
  unmarshalPublicKey,
19
20
  unmarshalSignResponse,
@@ -87,6 +87,31 @@ const unmarshalEncryptResponse = (data) => {
87
87
  keyId: data.key_id
88
88
  };
89
89
  };
90
+ const unmarshalListAlgorithmsResponseAlgorithm = (data) => {
91
+ if (!sdkClient.isJSONObject(data)) {
92
+ throw new TypeError(
93
+ `Unmarshalling the type 'ListAlgorithmsResponseAlgorithm' failed as data isn't a dictionary.`
94
+ );
95
+ }
96
+ return {
97
+ name: data.name,
98
+ recommended: data.recommended,
99
+ usage: data.usage
100
+ };
101
+ };
102
+ const unmarshalListAlgorithmsResponse = (data) => {
103
+ if (!sdkClient.isJSONObject(data)) {
104
+ throw new TypeError(
105
+ `Unmarshalling the type 'ListAlgorithmsResponse' failed as data isn't a dictionary.`
106
+ );
107
+ }
108
+ return {
109
+ algorithms: sdkClient.unmarshalArrayOfObject(
110
+ data.algorithms,
111
+ unmarshalListAlgorithmsResponseAlgorithm
112
+ )
113
+ };
114
+ };
90
115
  const unmarshalListKeysResponse = (data) => {
91
116
  if (!sdkClient.isJSONObject(data)) {
92
117
  throw new TypeError(
@@ -192,6 +217,7 @@ exports.unmarshalDataKey = unmarshalDataKey;
192
217
  exports.unmarshalDecryptResponse = unmarshalDecryptResponse;
193
218
  exports.unmarshalEncryptResponse = unmarshalEncryptResponse;
194
219
  exports.unmarshalKey = unmarshalKey;
220
+ exports.unmarshalListAlgorithmsResponse = unmarshalListAlgorithmsResponse;
195
221
  exports.unmarshalListKeysResponse = unmarshalListKeysResponse;
196
222
  exports.unmarshalPublicKey = unmarshalPublicKey;
197
223
  exports.unmarshalSignResponse = unmarshalSignResponse;
@@ -1,9 +1,10 @@
1
1
  import type { DefaultValues } from '@scaleway/sdk-client';
2
- import type { CreateKeyRequest, DataKey, DecryptRequest, DecryptResponse, EncryptRequest, EncryptResponse, GenerateDataKeyRequest, ImportKeyMaterialRequest, Key, ListKeysResponse, PublicKey, SignRequest, SignResponse, UpdateKeyRequest, VerifyRequest, VerifyResponse } from './types.gen';
2
+ import type { CreateKeyRequest, DataKey, DecryptRequest, DecryptResponse, EncryptRequest, EncryptResponse, GenerateDataKeyRequest, ImportKeyMaterialRequest, Key, ListAlgorithmsResponse, ListKeysResponse, PublicKey, SignRequest, SignResponse, UpdateKeyRequest, VerifyRequest, VerifyResponse } from './types.gen';
3
3
  export declare const unmarshalKey: (data: unknown) => Key;
4
4
  export declare const unmarshalDataKey: (data: unknown) => DataKey;
5
5
  export declare const unmarshalDecryptResponse: (data: unknown) => DecryptResponse;
6
6
  export declare const unmarshalEncryptResponse: (data: unknown) => EncryptResponse;
7
+ export declare const unmarshalListAlgorithmsResponse: (data: unknown) => ListAlgorithmsResponse;
7
8
  export declare const unmarshalListKeysResponse: (data: unknown) => ListKeysResponse;
8
9
  export declare const unmarshalPublicKey: (data: unknown) => PublicKey;
9
10
  export declare const unmarshalSignResponse: (data: unknown) => SignResponse;
@@ -85,6 +85,31 @@ const unmarshalEncryptResponse = (data) => {
85
85
  keyId: data.key_id
86
86
  };
87
87
  };
88
+ const unmarshalListAlgorithmsResponseAlgorithm = (data) => {
89
+ if (!isJSONObject(data)) {
90
+ throw new TypeError(
91
+ `Unmarshalling the type 'ListAlgorithmsResponseAlgorithm' failed as data isn't a dictionary.`
92
+ );
93
+ }
94
+ return {
95
+ name: data.name,
96
+ recommended: data.recommended,
97
+ usage: data.usage
98
+ };
99
+ };
100
+ const unmarshalListAlgorithmsResponse = (data) => {
101
+ if (!isJSONObject(data)) {
102
+ throw new TypeError(
103
+ `Unmarshalling the type 'ListAlgorithmsResponse' failed as data isn't a dictionary.`
104
+ );
105
+ }
106
+ return {
107
+ algorithms: unmarshalArrayOfObject(
108
+ data.algorithms,
109
+ unmarshalListAlgorithmsResponseAlgorithm
110
+ )
111
+ };
112
+ };
88
113
  const unmarshalListKeysResponse = (data) => {
89
114
  if (!isJSONObject(data)) {
90
115
  throw new TypeError(
@@ -191,6 +216,7 @@ export {
191
216
  unmarshalDecryptResponse,
192
217
  unmarshalEncryptResponse,
193
218
  unmarshalKey,
219
+ unmarshalListAlgorithmsResponse,
194
220
  unmarshalListKeysResponse,
195
221
  unmarshalPublicKey,
196
222
  unmarshalSignResponse,
@@ -4,7 +4,8 @@ export type KeyAlgorithmAsymmetricEncryption = 'unknown_asymmetric_encryption' |
4
4
  export type KeyAlgorithmAsymmetricSigning = 'unknown_asymmetric_signing' | 'ec_p256_sha256' | 'ec_p384_sha384' | 'rsa_pss_2048_sha256' | 'rsa_pss_3072_sha256' | 'rsa_pss_4096_sha256' | 'rsa_pkcs1_2048_sha256' | 'rsa_pkcs1_3072_sha256' | 'rsa_pkcs1_4096_sha256';
5
5
  export type KeyAlgorithmSymmetricEncryption = 'unknown_symmetric_encryption' | 'aes_256_gcm';
6
6
  export type KeyOrigin = 'unknown_origin' | 'scaleway_kms' | 'external';
7
- export type KeyState = 'unknown_state' | 'enabled' | 'disabled' | 'pending_key_material';
7
+ export type KeyState = 'unknown_state' | 'enabled' | 'disabled' | 'pending_key_material' | 'scheduled_for_deletion';
8
+ export type ListAlgorithmsRequestUsage = 'unknown_usage' | 'symmetric_encryption' | 'asymmetric_encryption' | 'asymmetric_signing';
8
9
  export type ListKeysRequestOrderBy = 'name_asc' | 'name_desc' | 'created_at_asc' | 'created_at_desc' | 'updated_at_asc' | 'updated_at_desc';
9
10
  export type ListKeysRequestUsage = 'unknown_usage' | 'symmetric_encryption' | 'asymmetric_encryption' | 'asymmetric_signing';
10
11
  export interface KeyRotationPolicy {
@@ -35,6 +36,11 @@ export interface KeyUsage {
35
36
  */
36
37
  asymmetricSigning?: KeyAlgorithmAsymmetricSigning;
37
38
  }
39
+ export interface ListAlgorithmsResponseAlgorithm {
40
+ usage: string;
41
+ name: string;
42
+ recommended: boolean;
43
+ }
38
44
  export interface Key {
39
45
  /**
40
46
  * ID of the key.
@@ -322,6 +328,22 @@ export type ImportKeyMaterialRequest = {
322
328
  */
323
329
  salt?: string;
324
330
  };
331
+ export type ListAlgorithmsRequest = {
332
+ /**
333
+ * Region to target. If none is passed will use default region from the config.
334
+ */
335
+ region?: ScwRegion;
336
+ /**
337
+ * Filter by key usage.
338
+ */
339
+ usages?: ListAlgorithmsRequestUsage[];
340
+ };
341
+ export interface ListAlgorithmsResponse {
342
+ /**
343
+ * Returns a list of algorithms matching the requested criteria.
344
+ */
345
+ algorithms: ListAlgorithmsResponseAlgorithm[];
346
+ }
325
347
  export type ListKeysRequest = {
326
348
  /**
327
349
  * Region to target. If none is passed will use default region from the config.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-key-manager",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "Scaleway SDK key-manager",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
@@ -26,17 +26,17 @@
26
26
  "directory": "packages_generated/key-manager"
27
27
  },
28
28
  "engines": {
29
- "node": ">=20.19.1"
29
+ "node": ">=20.19.4"
30
30
  },
31
31
  "dependencies": {
32
- "@scaleway/random-name": "5.1.1",
33
- "@scaleway/sdk-std": "1.0.5"
32
+ "@scaleway/random-name": "5.1.2",
33
+ "@scaleway/sdk-std": "1.0.6"
34
34
  },
35
35
  "peerDependencies": {
36
- "@scaleway/sdk-client": "^1.3.0"
36
+ "@scaleway/sdk-client": "^1.3.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@scaleway/sdk-client": "^1.3.0"
39
+ "@scaleway/sdk-client": "^1.3.1"
40
40
  },
41
41
  "scripts": {
42
42
  "package:check": "pnpm publint",