@scaleway/sdk-key-manager 2.2.0 → 2.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.
package/README.md CHANGED
@@ -83,6 +83,7 @@ const api = new KeyManager.v1.API(client)
83
83
  ## Support
84
84
 
85
85
  We love feedback! Feel free to reach us on:
86
+
86
87
  - [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
87
88
  - [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
88
89
 
@@ -93,4 +94,3 @@ This repository is at its early stage and is still in active development. If you
93
94
  ## License
94
95
 
95
96
  This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
96
-
@@ -0,0 +1,11 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __exportAll = (all, no_symbols) => {
3
+ let target = {};
4
+ for (var name in all) __defProp(target, name, {
5
+ get: all[name],
6
+ enumerable: true
7
+ });
8
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
9
+ return target;
10
+ };
11
+ export { __exportAll };
package/dist/index.gen.js CHANGED
@@ -1,4 +1,2 @@
1
- import * as index_gen from "./v1alpha1/index.gen.js";
2
- export {
3
- index_gen as KeyManagerv1alpha1
4
- };
1
+ import { index_gen_exports } from "./v1alpha1/index.gen.js";
2
+ export { index_gen_exports as KeyManagerv1alpha1 };
@@ -1,331 +1,253 @@
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, unmarshalListAlgorithmsResponse } from "./marshalling.gen.js";
3
- const jsonContentHeaders = {
4
- "Content-Type": "application/json; charset=utf-8"
5
- };
6
- class API extends API$1 {
7
- /**
8
- * Locality of this API.
9
- * type {'zone','region','global','unspecified'}
10
- */
11
- static LOCALITY = toApiLocality({
12
- regions: ["fr-par", "nl-ams", "pl-waw"]
13
- });
14
- /**
15
- * Create a key. Create a key in a given region specified by the `region` parameter. You can use keys to encrypt or decrypt arbitrary payloads, to sign and verify messages or to generate data encryption keys. **Data encryption keys are not stored in Key Manager**.
16
- *
17
- * @param request - The request {@link CreateKeyRequest}
18
- * @returns A Promise of Key
19
- */
20
- createKey = (request) => this.client.fetch(
21
- {
22
- body: JSON.stringify(
23
- marshalCreateKeyRequest(request, this.client.settings)
24
- ),
25
- headers: jsonContentHeaders,
26
- method: "POST",
27
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys`
28
- },
29
- unmarshalKey
30
- );
31
- /**
32
- * Get key metadata. Retrieve metadata for a specified key using the `region` and `key_id` parameters.
33
- *
34
- * @param request - The request {@link GetKeyRequest}
35
- * @returns A Promise of Key
36
- */
37
- getKey = (request) => this.client.fetch(
38
- {
39
- method: "GET",
40
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}`
41
- },
42
- unmarshalKey
43
- );
44
- /**
45
- * Get the public key in PEM format.. Retrieves the public portion of an asymmetric cryptographic key in PEM format.
46
- *
47
- * @param request - The request {@link GetPublicKeyRequest}
48
- * @returns A Promise of PublicKey
49
- */
50
- getPublicKey = (request) => this.client.fetch(
51
- {
52
- method: "GET",
53
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/public-key`
54
- },
55
- unmarshalPublicKey
56
- );
57
- /**
58
- * Update a key. Modify a key's metadata including name, description and tags, specified by the `key_id` and `region` parameters.
59
- *
60
- * @param request - The request {@link UpdateKeyRequest}
61
- * @returns A Promise of Key
62
- */
63
- updateKey = (request) => this.client.fetch(
64
- {
65
- body: JSON.stringify(
66
- marshalUpdateKeyRequest(request, this.client.settings)
67
- ),
68
- headers: jsonContentHeaders,
69
- method: "PATCH",
70
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}`
71
- },
72
- unmarshalKey
73
- );
74
- /**
75
- * Delete a key. Permanently delete a key specified by the `region` and `key_id` parameters. This action is irreversible. Any data encrypted with this key, including data encryption keys, will no longer be decipherable.
76
- *
77
- * @param request - The request {@link DeleteKeyRequest}
78
- */
79
- deleteKey = (request) => this.client.fetch({
80
- method: "DELETE",
81
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}`
82
- });
83
- /**
84
- * Rotate a key. Generate a new version of an existing key with new key material. Previous key versions remain usable to decrypt previously encrypted data, but the key's new version will be used for subsequent encryption operations and data key generation.
85
- *
86
- * @param request - The request {@link RotateKeyRequest}
87
- * @returns A Promise of Key
88
- */
89
- rotateKey = (request) => this.client.fetch(
90
- {
91
- body: "{}",
92
- headers: jsonContentHeaders,
93
- method: "POST",
94
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/rotate`
95
- },
96
- unmarshalKey
97
- );
98
- /**
99
- * Apply key protection. Apply protection to a given key specified by the `key_id` parameter. Applying key protection means that your key can be used and modified, but it cannot be deleted.
100
- *
101
- * @param request - The request {@link ProtectKeyRequest}
102
- * @returns A Promise of Key
103
- */
104
- protectKey = (request) => this.client.fetch(
105
- {
106
- body: "{}",
107
- headers: jsonContentHeaders,
108
- method: "POST",
109
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/protect`
110
- },
111
- unmarshalKey
112
- );
113
- /**
114
- * Remove key protection. Remove key protection from a given key specified by the `key_id` parameter. Removing key protection means that your key can be deleted anytime.
115
- *
116
- * @param request - The request {@link UnprotectKeyRequest}
117
- * @returns A Promise of Key
118
- */
119
- unprotectKey = (request) => this.client.fetch(
120
- {
121
- body: "{}",
122
- headers: jsonContentHeaders,
123
- method: "POST",
124
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/unprotect`
125
- },
126
- unmarshalKey
127
- );
128
- /**
129
- * Enable key. Enable a given key to be used for cryptographic operations. Enabling a key allows you to make a disabled key usable again. You must specify the `region` and `key_id` parameters.
130
- *
131
- * @param request - The request {@link EnableKeyRequest}
132
- * @returns A Promise of Key
133
- */
134
- enableKey = (request) => this.client.fetch(
135
- {
136
- body: "{}",
137
- headers: jsonContentHeaders,
138
- method: "POST",
139
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/enable`
140
- },
141
- unmarshalKey
142
- );
143
- /**
144
- * Disable key. Disable a given key, preventing it to be used for cryptographic operations. Disabling a key renders it unusable. You must specify the `region` and `key_id` parameters.
145
- *
146
- * @param request - The request {@link DisableKeyRequest}
147
- * @returns A Promise of Key
148
- */
149
- disableKey = (request) => this.client.fetch(
150
- {
151
- body: "{}",
152
- headers: jsonContentHeaders,
153
- method: "POST",
154
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/disable`
155
- },
156
- unmarshalKey
157
- );
158
- pageOfListKeys = (request) => this.client.fetch(
159
- {
160
- method: "GET",
161
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys`,
162
- urlParams: urlParams(
163
- ["name", request.name],
164
- ["order_by", request.orderBy],
165
- ["organization_id", request.organizationId],
166
- ["page", request.page],
167
- [
168
- "page_size",
169
- request.pageSize ?? this.client.settings.defaultPageSize
170
- ],
171
- ["project_id", request.projectId],
172
- ["scheduled_for_deletion", request.scheduledForDeletion],
173
- ["tags", request.tags],
174
- ["usage", request.usage]
175
- )
176
- },
177
- unmarshalListKeysResponse
178
- );
179
- /**
180
- * List keys. Retrieve a list of keys across all Projects in an Organization or within a specific Project. You must specify the `region`, and either the `organization_id` or the `project_id`.
181
- *
182
- * @param request - The request {@link ListKeysRequest}
183
- * @returns A Promise of ListKeysResponse
184
- */
185
- listKeys = (request) => enrichForPagination("keys", this.pageOfListKeys, request);
186
- /**
187
- * Create a data encryption key. Create a new data encryption key for cryptographic operations outside of Key Manager. The data encryption key is encrypted and must be decrypted using the key you have created in Key Manager.
188
-
189
- The data encryption key is returned in plaintext and ciphertext but it should only be stored in its encrypted form (ciphertext). Key Manager does not store your data encryption key. To retrieve your key's plaintext, use the `Decrypt` method with your key's ID and ciphertext.
190
- *
191
- * @param request - The request {@link GenerateDataKeyRequest}
192
- * @returns A Promise of DataKey
193
- */
194
- generateDataKey = (request) => this.client.fetch(
195
- {
196
- body: JSON.stringify(
197
- marshalGenerateDataKeyRequest(request, this.client.settings)
198
- ),
199
- headers: jsonContentHeaders,
200
- method: "POST",
201
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/generate-data-key`
202
- },
203
- unmarshalDataKey
204
- );
205
- /**
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
- *
208
- * @param request - The request {@link EncryptRequest}
209
- * @returns A Promise of EncryptResponse
210
- */
211
- encrypt = (request) => this.client.fetch(
212
- {
213
- body: JSON.stringify(
214
- marshalEncryptRequest(request, this.client.settings)
215
- ),
216
- headers: jsonContentHeaders,
217
- method: "POST",
218
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/encrypt`
219
- },
220
- unmarshalEncryptResponse
221
- );
222
- /**
223
- * Decrypt an encrypted payload. Decrypt an encrypted payload using an existing key, specified by the `key_id` parameter. The maximum payload size that can be decrypted is equivalent to the encrypted output of 64 KB of data (around 131 KB).
224
- *
225
- * @param request - The request {@link DecryptRequest}
226
- * @returns A Promise of DecryptResponse
227
- */
228
- decrypt = (request) => this.client.fetch(
229
- {
230
- body: JSON.stringify(
231
- marshalDecryptRequest(request, this.client.settings)
232
- ),
233
- headers: jsonContentHeaders,
234
- method: "POST",
235
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/decrypt`
236
- },
237
- unmarshalDecryptResponse
238
- );
239
- /**
240
- * Sign a message digest. Use a given key to sign a message digest. The key must have its usage set to `asymmetric_signing`. The digest must be created using the same digest algorithm that is defined in the key's algorithm configuration.
241
- *
242
- * @param request - The request {@link SignRequest}
243
- * @returns A Promise of SignResponse
244
- */
245
- sign = (request) => this.client.fetch(
246
- {
247
- body: JSON.stringify(marshalSignRequest(request, this.client.settings)),
248
- headers: jsonContentHeaders,
249
- method: "POST",
250
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/sign`
251
- },
252
- unmarshalSignResponse
253
- );
254
- /**
255
- * Verify a message signature. Use a given key to verify a message signature against a message digest. The key must have its usage set to `asymmetric_signing`. The message digest must be generated using the same digest algorithm that is defined in the key's algorithm configuration.
256
- *
257
- * @param request - The request {@link VerifyRequest}
258
- * @returns A Promise of VerifyResponse
259
- */
260
- verify = (request) => this.client.fetch(
261
- {
262
- body: JSON.stringify(
263
- marshalVerifyRequest(request, this.client.settings)
264
- ),
265
- headers: jsonContentHeaders,
266
- method: "POST",
267
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/verify`
268
- },
269
- unmarshalVerifyResponse
270
- );
271
- /**
272
- * Import key material. Import externally generated key material into Key Manager to derive a new cryptographic key. The key's origin must be `external`.
273
- *
274
- * @param request - The request {@link ImportKeyMaterialRequest}
275
- * @returns A Promise of Key
276
- */
277
- importKeyMaterial = (request) => this.client.fetch(
278
- {
279
- body: JSON.stringify(
280
- marshalImportKeyMaterialRequest(request, this.client.settings)
281
- ),
282
- headers: jsonContentHeaders,
283
- method: "POST",
284
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/import-key-material`
285
- },
286
- unmarshalKey
287
- );
288
- /**
289
- * Delete key material. Delete previously imported key material. This renders the associated cryptographic key unusable for any operation. The key's origin must be `external`.
290
- *
291
- * @param request - The request {@link DeleteKeyMaterialRequest}
292
- */
293
- deleteKeyMaterial = (request) => this.client.fetch({
294
- body: "{}",
295
- headers: jsonContentHeaders,
296
- method: "POST",
297
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/delete-key-material`
298
- });
299
- /**
300
- * Restore a key. Restore a key and all its rotations scheduled for deletion specified by the `region` and `key_id` parameters.
301
- *
302
- * @param request - The request {@link RestoreKeyRequest}
303
- * @returns A Promise of Key
304
- */
305
- restoreKey = (request) => this.client.fetch(
306
- {
307
- body: "{}",
308
- headers: jsonContentHeaders,
309
- method: "POST",
310
- path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/restore`
311
- },
312
- unmarshalKey
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
- );
328
- }
329
- export {
330
- API
1
+ import { marshalCreateKeyRequest, marshalDecryptRequest, marshalEncryptRequest, marshalGenerateDataKeyRequest, marshalImportKeyMaterialRequest, marshalSignRequest, marshalUpdateKeyRequest, marshalVerifyRequest, unmarshalDataKey, unmarshalDecryptResponse, unmarshalEncryptResponse, unmarshalKey, unmarshalListAlgorithmsResponse, unmarshalListKeysResponse, unmarshalPublicKey, unmarshalSignResponse, unmarshalVerifyResponse } from "./marshalling.gen.js";
2
+ import { API, enrichForPagination, toApiLocality, urlParams, validatePathParam } from "@scaleway/sdk-client";
3
+ var jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
4
+ /**
5
+ * Key Manager API.
6
+
7
+ This API allows you to create, manage and use cryptographic keys in a centralized and secure service.
8
+ */
9
+ var API$1 = class extends API {
10
+ /**
11
+ * Locality of this API.
12
+ * type ∈ {'zone','region','global','unspecified'}
13
+ */
14
+ static LOCALITY = toApiLocality({ regions: [
15
+ "fr-par",
16
+ "nl-ams",
17
+ "pl-waw"
18
+ ] });
19
+ /**
20
+ * Create a key. Create a key in a given region specified by the `region` parameter. You can use keys to encrypt or decrypt arbitrary payloads, to sign and verify messages or to generate data encryption keys. **Data encryption keys are not stored in Key Manager**.
21
+ *
22
+ * @param request - The request {@link CreateKeyRequest}
23
+ * @returns A Promise of Key
24
+ */
25
+ createKey = (request) => this.client.fetch({
26
+ body: JSON.stringify(marshalCreateKeyRequest(request, this.client.settings)),
27
+ headers: jsonContentHeaders,
28
+ method: "POST",
29
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys`
30
+ }, unmarshalKey);
31
+ /**
32
+ * Get key metadata. Retrieve metadata for a specified key using the `region` and `key_id` parameters.
33
+ *
34
+ * @param request - The request {@link GetKeyRequest}
35
+ * @returns A Promise of Key
36
+ */
37
+ getKey = (request) => this.client.fetch({
38
+ method: "GET",
39
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}`
40
+ }, unmarshalKey);
41
+ /**
42
+ * Get the public key in PEM format.. Retrieves the public portion of an asymmetric cryptographic key in PEM format.
43
+ *
44
+ * @param request - The request {@link GetPublicKeyRequest}
45
+ * @returns A Promise of PublicKey
46
+ */
47
+ getPublicKey = (request) => this.client.fetch({
48
+ method: "GET",
49
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/public-key`
50
+ }, unmarshalPublicKey);
51
+ /**
52
+ * Update a key. Modify a key's metadata including name, description and tags, specified by the `key_id` and `region` parameters.
53
+ *
54
+ * @param request - The request {@link UpdateKeyRequest}
55
+ * @returns A Promise of Key
56
+ */
57
+ updateKey = (request) => this.client.fetch({
58
+ body: JSON.stringify(marshalUpdateKeyRequest(request, this.client.settings)),
59
+ headers: jsonContentHeaders,
60
+ method: "PATCH",
61
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}`
62
+ }, unmarshalKey);
63
+ /**
64
+ * Delete a key. Permanently delete a key specified by the `region` and `key_id` parameters. This action is irreversible. Any data encrypted with this key, including data encryption keys, will no longer be decipherable.
65
+ *
66
+ * @param request - The request {@link DeleteKeyRequest}
67
+ */
68
+ deleteKey = (request) => this.client.fetch({
69
+ method: "DELETE",
70
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}`
71
+ });
72
+ /**
73
+ * Rotate a key. Generate a new version of an existing key with new key material. Previous key versions remain usable to decrypt previously encrypted data, but the key's new version will be used for subsequent encryption operations and data key generation.
74
+ *
75
+ * @param request - The request {@link RotateKeyRequest}
76
+ * @returns A Promise of Key
77
+ */
78
+ rotateKey = (request) => this.client.fetch({
79
+ body: "{}",
80
+ headers: jsonContentHeaders,
81
+ method: "POST",
82
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/rotate`
83
+ }, unmarshalKey);
84
+ /**
85
+ * Apply key protection. Apply protection to a given key specified by the `key_id` parameter. Applying key protection means that your key can be used and modified, but it cannot be deleted.
86
+ *
87
+ * @param request - The request {@link ProtectKeyRequest}
88
+ * @returns A Promise of Key
89
+ */
90
+ protectKey = (request) => this.client.fetch({
91
+ body: "{}",
92
+ headers: jsonContentHeaders,
93
+ method: "POST",
94
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/protect`
95
+ }, unmarshalKey);
96
+ /**
97
+ * Remove key protection. Remove key protection from a given key specified by the `key_id` parameter. Removing key protection means that your key can be deleted anytime.
98
+ *
99
+ * @param request - The request {@link UnprotectKeyRequest}
100
+ * @returns A Promise of Key
101
+ */
102
+ unprotectKey = (request) => this.client.fetch({
103
+ body: "{}",
104
+ headers: jsonContentHeaders,
105
+ method: "POST",
106
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/unprotect`
107
+ }, unmarshalKey);
108
+ /**
109
+ * Enable key. Enable a given key to be used for cryptographic operations. Enabling a key allows you to make a disabled key usable again. You must specify the `region` and `key_id` parameters.
110
+ *
111
+ * @param request - The request {@link EnableKeyRequest}
112
+ * @returns A Promise of Key
113
+ */
114
+ enableKey = (request) => this.client.fetch({
115
+ body: "{}",
116
+ headers: jsonContentHeaders,
117
+ method: "POST",
118
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/enable`
119
+ }, unmarshalKey);
120
+ /**
121
+ * Disable key. Disable a given key, preventing it to be used for cryptographic operations. Disabling a key renders it unusable. You must specify the `region` and `key_id` parameters.
122
+ *
123
+ * @param request - The request {@link DisableKeyRequest}
124
+ * @returns A Promise of Key
125
+ */
126
+ disableKey = (request) => this.client.fetch({
127
+ body: "{}",
128
+ headers: jsonContentHeaders,
129
+ method: "POST",
130
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/disable`
131
+ }, unmarshalKey);
132
+ pageOfListKeys = (request) => this.client.fetch({
133
+ method: "GET",
134
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys`,
135
+ urlParams: urlParams(["name", request.name], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId], ["scheduled_for_deletion", request.scheduledForDeletion], ["tags", request.tags], ["usage", request.usage])
136
+ }, unmarshalListKeysResponse);
137
+ /**
138
+ * List keys. Retrieve a list of keys across all Projects in an Organization or within a specific Project. You must specify the `region`, and either the `organization_id` or the `project_id`.
139
+ *
140
+ * @param request - The request {@link ListKeysRequest}
141
+ * @returns A Promise of ListKeysResponse
142
+ */
143
+ listKeys = (request) => enrichForPagination("keys", this.pageOfListKeys, request);
144
+ /**
145
+ * Create a data encryption key. Create a new data encryption key for cryptographic operations outside of Key Manager. The data encryption key is encrypted and must be decrypted using the key you have created in Key Manager.
146
+
147
+ The data encryption key is returned in plaintext and ciphertext but it should only be stored in its encrypted form (ciphertext). Key Manager does not store your data encryption key. To retrieve your key's plaintext, use the `Decrypt` method with your key's ID and ciphertext.
148
+ *
149
+ * @param request - The request {@link GenerateDataKeyRequest}
150
+ * @returns A Promise of DataKey
151
+ */
152
+ generateDataKey = (request) => this.client.fetch({
153
+ body: JSON.stringify(marshalGenerateDataKeyRequest(request, this.client.settings)),
154
+ headers: jsonContentHeaders,
155
+ method: "POST",
156
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/generate-data-key`
157
+ }, unmarshalDataKey);
158
+ /**
159
+ * 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.
160
+ *
161
+ * @param request - The request {@link EncryptRequest}
162
+ * @returns A Promise of EncryptResponse
163
+ */
164
+ encrypt = (request) => this.client.fetch({
165
+ body: JSON.stringify(marshalEncryptRequest(request, this.client.settings)),
166
+ headers: jsonContentHeaders,
167
+ method: "POST",
168
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/encrypt`
169
+ }, unmarshalEncryptResponse);
170
+ /**
171
+ * Decrypt an encrypted payload. Decrypt an encrypted payload using an existing key, specified by the `key_id` parameter. The maximum payload size that can be decrypted is equivalent to the encrypted output of 64 KB of data (around 131 KB).
172
+ *
173
+ * @param request - The request {@link DecryptRequest}
174
+ * @returns A Promise of DecryptResponse
175
+ */
176
+ decrypt = (request) => this.client.fetch({
177
+ body: JSON.stringify(marshalDecryptRequest(request, this.client.settings)),
178
+ headers: jsonContentHeaders,
179
+ method: "POST",
180
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/decrypt`
181
+ }, unmarshalDecryptResponse);
182
+ /**
183
+ * Sign a message digest. Use a given key to sign a message digest. The key must have its usage set to `asymmetric_signing`. The digest must be created using the same digest algorithm that is defined in the key's algorithm configuration.
184
+ *
185
+ * @param request - The request {@link SignRequest}
186
+ * @returns A Promise of SignResponse
187
+ */
188
+ sign = (request) => this.client.fetch({
189
+ body: JSON.stringify(marshalSignRequest(request, this.client.settings)),
190
+ headers: jsonContentHeaders,
191
+ method: "POST",
192
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/sign`
193
+ }, unmarshalSignResponse);
194
+ /**
195
+ * Verify a message signature. Use a given key to verify a message signature against a message digest. The key must have its usage set to `asymmetric_signing`. The message digest must be generated using the same digest algorithm that is defined in the key's algorithm configuration.
196
+ *
197
+ * @param request - The request {@link VerifyRequest}
198
+ * @returns A Promise of VerifyResponse
199
+ */
200
+ verify = (request) => this.client.fetch({
201
+ body: JSON.stringify(marshalVerifyRequest(request, this.client.settings)),
202
+ headers: jsonContentHeaders,
203
+ method: "POST",
204
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/verify`
205
+ }, unmarshalVerifyResponse);
206
+ /**
207
+ * Import key material. Import externally generated key material into Key Manager to derive a new cryptographic key. The key's origin must be `external`.
208
+ *
209
+ * @param request - The request {@link ImportKeyMaterialRequest}
210
+ * @returns A Promise of Key
211
+ */
212
+ importKeyMaterial = (request) => this.client.fetch({
213
+ body: JSON.stringify(marshalImportKeyMaterialRequest(request, this.client.settings)),
214
+ headers: jsonContentHeaders,
215
+ method: "POST",
216
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/import-key-material`
217
+ }, unmarshalKey);
218
+ /**
219
+ * Delete key material. Delete previously imported key material. This renders the associated cryptographic key unusable for any operation. The key's origin must be `external`.
220
+ *
221
+ * @param request - The request {@link DeleteKeyMaterialRequest}
222
+ */
223
+ deleteKeyMaterial = (request) => this.client.fetch({
224
+ body: "{}",
225
+ headers: jsonContentHeaders,
226
+ method: "POST",
227
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/delete-key-material`
228
+ });
229
+ /**
230
+ * Restore a key. Restore a key and all its rotations scheduled for deletion specified by the `region` and `key_id` parameters.
231
+ *
232
+ * @param request - The request {@link RestoreKeyRequest}
233
+ * @returns A Promise of Key
234
+ */
235
+ restoreKey = (request) => this.client.fetch({
236
+ body: "{}",
237
+ headers: jsonContentHeaders,
238
+ method: "POST",
239
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/restore`
240
+ }, unmarshalKey);
241
+ /**
242
+ * List all available algorithms. Lists all cryptographic algorithms supported by the Key Manager service.
243
+ *
244
+ * @param request - The request {@link ListAlgorithmsRequest}
245
+ * @returns A Promise of ListAlgorithmsResponse
246
+ */
247
+ listAlgorithms = (request = {}) => this.client.fetch({
248
+ method: "GET",
249
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/algorithms`,
250
+ urlParams: urlParams(["usages", request.usages])
251
+ }, unmarshalListAlgorithmsResponse);
331
252
  };
253
+ export { API$1 as API };
@@ -1,3 +1,3 @@
1
- export { API } from './api.gen.js';
1
+ export { API, } from './api.gen.js';
2
2
  export * from './marshalling.gen.js';
3
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.js';
@@ -1,22 +1,24 @@
1
- import { API } from "./api.gen.js";
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
2
  import { marshalCreateKeyRequest, marshalDecryptRequest, marshalEncryptRequest, marshalGenerateDataKeyRequest, marshalImportKeyMaterialRequest, marshalSignRequest, marshalUpdateKeyRequest, marshalVerifyRequest, unmarshalDataKey, unmarshalDecryptResponse, unmarshalEncryptResponse, unmarshalKey, unmarshalListAlgorithmsResponse, unmarshalListKeysResponse, unmarshalPublicKey, unmarshalSignResponse, unmarshalVerifyResponse } from "./marshalling.gen.js";
3
- export {
4
- API,
5
- marshalCreateKeyRequest,
6
- marshalDecryptRequest,
7
- marshalEncryptRequest,
8
- marshalGenerateDataKeyRequest,
9
- marshalImportKeyMaterialRequest,
10
- marshalSignRequest,
11
- marshalUpdateKeyRequest,
12
- marshalVerifyRequest,
13
- unmarshalDataKey,
14
- unmarshalDecryptResponse,
15
- unmarshalEncryptResponse,
16
- unmarshalKey,
17
- unmarshalListAlgorithmsResponse,
18
- unmarshalListKeysResponse,
19
- unmarshalPublicKey,
20
- unmarshalSignResponse,
21
- unmarshalVerifyResponse
22
- };
3
+ import { API } from "./api.gen.js";
4
+ var index_gen_exports = /* @__PURE__ */ __exportAll({
5
+ API: () => API,
6
+ marshalCreateKeyRequest: () => marshalCreateKeyRequest,
7
+ marshalDecryptRequest: () => marshalDecryptRequest,
8
+ marshalEncryptRequest: () => marshalEncryptRequest,
9
+ marshalGenerateDataKeyRequest: () => marshalGenerateDataKeyRequest,
10
+ marshalImportKeyMaterialRequest: () => marshalImportKeyMaterialRequest,
11
+ marshalSignRequest: () => marshalSignRequest,
12
+ marshalUpdateKeyRequest: () => marshalUpdateKeyRequest,
13
+ marshalVerifyRequest: () => marshalVerifyRequest,
14
+ unmarshalDataKey: () => unmarshalDataKey,
15
+ unmarshalDecryptResponse: () => unmarshalDecryptResponse,
16
+ unmarshalEncryptResponse: () => unmarshalEncryptResponse,
17
+ unmarshalKey: () => unmarshalKey,
18
+ unmarshalListAlgorithmsResponse: () => unmarshalListAlgorithmsResponse,
19
+ unmarshalListKeysResponse: () => unmarshalListKeysResponse,
20
+ unmarshalPublicKey: () => unmarshalPublicKey,
21
+ unmarshalSignResponse: () => unmarshalSignResponse,
22
+ unmarshalVerifyResponse: () => unmarshalVerifyResponse
23
+ });
24
+ export { index_gen_exports };
@@ -1,224 +1,156 @@
1
- import { resolveOneOf, isJSONObject, unmarshalDate, unmarshalArrayOfObject } from "@scaleway/sdk-client";
2
- const unmarshalKeyRotationPolicy = (data) => {
3
- if (!isJSONObject(data)) {
4
- throw new TypeError(
5
- `Unmarshalling the type 'KeyRotationPolicy' failed as data isn't a dictionary.`
6
- );
7
- }
8
- return {
9
- nextRotationAt: unmarshalDate(data.next_rotation_at),
10
- rotationPeriod: data.rotation_period
11
- };
1
+ import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
2
+ var unmarshalKeyRotationPolicy = (data) => {
3
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'KeyRotationPolicy' failed as data isn't a dictionary.`);
4
+ return {
5
+ nextRotationAt: unmarshalDate(data.next_rotation_at),
6
+ rotationPeriod: data.rotation_period
7
+ };
12
8
  };
13
- const unmarshalKeyUsage = (data) => {
14
- if (!isJSONObject(data)) {
15
- throw new TypeError(
16
- `Unmarshalling the type 'KeyUsage' failed as data isn't a dictionary.`
17
- );
18
- }
19
- return {
20
- asymmetricEncryption: data.asymmetric_encryption ? data.asymmetric_encryption : void 0,
21
- asymmetricSigning: data.asymmetric_signing ? data.asymmetric_signing : void 0,
22
- symmetricEncryption: data.symmetric_encryption ? data.symmetric_encryption : void 0
23
- };
9
+ var unmarshalKeyUsage = (data) => {
10
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'KeyUsage' failed as data isn't a dictionary.`);
11
+ return {
12
+ asymmetricEncryption: data.asymmetric_encryption ? data.asymmetric_encryption : void 0,
13
+ asymmetricSigning: data.asymmetric_signing ? data.asymmetric_signing : void 0,
14
+ symmetricEncryption: data.symmetric_encryption ? data.symmetric_encryption : void 0
15
+ };
24
16
  };
25
17
  const unmarshalKey = (data) => {
26
- if (!isJSONObject(data)) {
27
- throw new TypeError(
28
- `Unmarshalling the type 'Key' failed as data isn't a dictionary.`
29
- );
30
- }
31
- return {
32
- createdAt: unmarshalDate(data.created_at),
33
- deletionRequestedAt: unmarshalDate(data.deletion_requested_at),
34
- description: data.description,
35
- id: data.id,
36
- locked: data.locked,
37
- name: data.name,
38
- origin: data.origin,
39
- projectId: data.project_id,
40
- protected: data.protected,
41
- region: data.region,
42
- rotatedAt: unmarshalDate(data.rotated_at),
43
- rotationCount: data.rotation_count,
44
- rotationPolicy: data.rotation_policy ? unmarshalKeyRotationPolicy(data.rotation_policy) : void 0,
45
- state: data.state,
46
- tags: data.tags,
47
- updatedAt: unmarshalDate(data.updated_at),
48
- usage: data.usage ? unmarshalKeyUsage(data.usage) : void 0
49
- };
18
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Key' failed as data isn't a dictionary.`);
19
+ return {
20
+ createdAt: unmarshalDate(data.created_at),
21
+ deletionRequestedAt: unmarshalDate(data.deletion_requested_at),
22
+ description: data.description,
23
+ id: data.id,
24
+ locked: data.locked,
25
+ name: data.name,
26
+ origin: data.origin,
27
+ projectId: data.project_id,
28
+ protected: data.protected,
29
+ region: data.region,
30
+ rotatedAt: unmarshalDate(data.rotated_at),
31
+ rotationCount: data.rotation_count,
32
+ rotationPolicy: data.rotation_policy ? unmarshalKeyRotationPolicy(data.rotation_policy) : void 0,
33
+ state: data.state,
34
+ tags: data.tags,
35
+ updatedAt: unmarshalDate(data.updated_at),
36
+ usage: data.usage ? unmarshalKeyUsage(data.usage) : void 0
37
+ };
50
38
  };
51
39
  const unmarshalDataKey = (data) => {
52
- if (!isJSONObject(data)) {
53
- throw new TypeError(
54
- `Unmarshalling the type 'DataKey' failed as data isn't a dictionary.`
55
- );
56
- }
57
- return {
58
- algorithm: data.algorithm,
59
- ciphertext: data.ciphertext,
60
- createdAt: unmarshalDate(data.created_at),
61
- keyId: data.key_id,
62
- plaintext: data.plaintext
63
- };
40
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DataKey' failed as data isn't a dictionary.`);
41
+ return {
42
+ algorithm: data.algorithm,
43
+ ciphertext: data.ciphertext,
44
+ createdAt: unmarshalDate(data.created_at),
45
+ keyId: data.key_id,
46
+ plaintext: data.plaintext
47
+ };
64
48
  };
65
49
  const unmarshalDecryptResponse = (data) => {
66
- if (!isJSONObject(data)) {
67
- throw new TypeError(
68
- `Unmarshalling the type 'DecryptResponse' failed as data isn't a dictionary.`
69
- );
70
- }
71
- return {
72
- ciphertext: data.ciphertext,
73
- keyId: data.key_id,
74
- plaintext: data.plaintext
75
- };
50
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DecryptResponse' failed as data isn't a dictionary.`);
51
+ return {
52
+ ciphertext: data.ciphertext,
53
+ keyId: data.key_id,
54
+ plaintext: data.plaintext
55
+ };
76
56
  };
77
57
  const unmarshalEncryptResponse = (data) => {
78
- if (!isJSONObject(data)) {
79
- throw new TypeError(
80
- `Unmarshalling the type 'EncryptResponse' failed as data isn't a dictionary.`
81
- );
82
- }
83
- return {
84
- ciphertext: data.ciphertext,
85
- keyId: data.key_id
86
- };
58
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EncryptResponse' failed as data isn't a dictionary.`);
59
+ return {
60
+ ciphertext: data.ciphertext,
61
+ keyId: data.key_id
62
+ };
87
63
  };
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
- };
64
+ var unmarshalListAlgorithmsResponseAlgorithm = (data) => {
65
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListAlgorithmsResponseAlgorithm' failed as data isn't a dictionary.`);
66
+ return {
67
+ name: data.name,
68
+ recommended: data.recommended,
69
+ usage: data.usage
70
+ };
99
71
  };
100
72
  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
- };
73
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListAlgorithmsResponse' failed as data isn't a dictionary.`);
74
+ return { algorithms: unmarshalArrayOfObject(data.algorithms, unmarshalListAlgorithmsResponseAlgorithm) };
112
75
  };
113
76
  const unmarshalListKeysResponse = (data) => {
114
- if (!isJSONObject(data)) {
115
- throw new TypeError(
116
- `Unmarshalling the type 'ListKeysResponse' failed as data isn't a dictionary.`
117
- );
118
- }
119
- return {
120
- keys: unmarshalArrayOfObject(data.keys, unmarshalKey),
121
- totalCount: data.total_count
122
- };
77
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListKeysResponse' failed as data isn't a dictionary.`);
78
+ return {
79
+ keys: unmarshalArrayOfObject(data.keys, unmarshalKey),
80
+ totalCount: data.total_count
81
+ };
123
82
  };
124
83
  const unmarshalPublicKey = (data) => {
125
- if (!isJSONObject(data)) {
126
- throw new TypeError(
127
- `Unmarshalling the type 'PublicKey' failed as data isn't a dictionary.`
128
- );
129
- }
130
- return {
131
- pem: data.pem
132
- };
84
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'PublicKey' failed as data isn't a dictionary.`);
85
+ return { pem: data.pem };
133
86
  };
134
87
  const unmarshalSignResponse = (data) => {
135
- if (!isJSONObject(data)) {
136
- throw new TypeError(
137
- `Unmarshalling the type 'SignResponse' failed as data isn't a dictionary.`
138
- );
139
- }
140
- return {
141
- keyId: data.key_id,
142
- signature: data.signature
143
- };
88
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SignResponse' failed as data isn't a dictionary.`);
89
+ return {
90
+ keyId: data.key_id,
91
+ signature: data.signature
92
+ };
144
93
  };
145
94
  const unmarshalVerifyResponse = (data) => {
146
- if (!isJSONObject(data)) {
147
- throw new TypeError(
148
- `Unmarshalling the type 'VerifyResponse' failed as data isn't a dictionary.`
149
- );
150
- }
151
- return {
152
- keyId: data.key_id,
153
- valid: data.valid
154
- };
95
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'VerifyResponse' failed as data isn't a dictionary.`);
96
+ return {
97
+ keyId: data.key_id,
98
+ valid: data.valid
99
+ };
155
100
  };
156
- const marshalKeyRotationPolicy = (request, defaults) => ({
157
- next_rotation_at: request.nextRotationAt,
158
- rotation_period: request.rotationPeriod
159
- });
160
- const marshalKeyUsage = (request, defaults) => ({
161
- ...resolveOneOf([
162
- { param: "symmetric_encryption", value: request.symmetricEncryption },
163
- { param: "asymmetric_encryption", value: request.asymmetricEncryption },
164
- { param: "asymmetric_signing", value: request.asymmetricSigning }
165
- ])
101
+ var marshalKeyRotationPolicy = (request, defaults) => ({
102
+ next_rotation_at: request.nextRotationAt,
103
+ rotation_period: request.rotationPeriod
166
104
  });
105
+ var marshalKeyUsage = (request, defaults) => ({ ...resolveOneOf([
106
+ {
107
+ param: "symmetric_encryption",
108
+ value: request.symmetricEncryption
109
+ },
110
+ {
111
+ param: "asymmetric_encryption",
112
+ value: request.asymmetricEncryption
113
+ },
114
+ {
115
+ param: "asymmetric_signing",
116
+ value: request.asymmetricSigning
117
+ }
118
+ ]) });
167
119
  const marshalCreateKeyRequest = (request, defaults) => ({
168
- description: request.description,
169
- name: request.name,
170
- origin: request.origin,
171
- project_id: request.projectId ?? defaults.defaultProjectId,
172
- rotation_policy: request.rotationPolicy !== void 0 ? marshalKeyRotationPolicy(request.rotationPolicy) : void 0,
173
- tags: request.tags,
174
- unprotected: request.unprotected,
175
- usage: request.usage !== void 0 ? marshalKeyUsage(request.usage) : void 0
120
+ description: request.description,
121
+ name: request.name,
122
+ origin: request.origin,
123
+ project_id: request.projectId ?? defaults.defaultProjectId,
124
+ rotation_policy: request.rotationPolicy !== void 0 ? marshalKeyRotationPolicy(request.rotationPolicy, defaults) : void 0,
125
+ tags: request.tags,
126
+ unprotected: request.unprotected,
127
+ usage: request.usage !== void 0 ? marshalKeyUsage(request.usage, defaults) : void 0
176
128
  });
177
129
  const marshalDecryptRequest = (request, defaults) => ({
178
- associated_data: request.associatedData,
179
- ciphertext: request.ciphertext
130
+ associated_data: request.associatedData,
131
+ ciphertext: request.ciphertext
180
132
  });
181
133
  const marshalEncryptRequest = (request, defaults) => ({
182
- associated_data: request.associatedData,
183
- plaintext: request.plaintext
134
+ associated_data: request.associatedData,
135
+ plaintext: request.plaintext
184
136
  });
185
137
  const marshalGenerateDataKeyRequest = (request, defaults) => ({
186
- algorithm: request.algorithm,
187
- without_plaintext: request.withoutPlaintext
138
+ algorithm: request.algorithm,
139
+ without_plaintext: request.withoutPlaintext
188
140
  });
189
141
  const marshalImportKeyMaterialRequest = (request, defaults) => ({
190
- key_material: request.keyMaterial,
191
- salt: request.salt
192
- });
193
- const marshalSignRequest = (request, defaults) => ({
194
- digest: request.digest
142
+ key_material: request.keyMaterial,
143
+ salt: request.salt
195
144
  });
145
+ const marshalSignRequest = (request, defaults) => ({ digest: request.digest });
196
146
  const marshalUpdateKeyRequest = (request, defaults) => ({
197
- description: request.description,
198
- name: request.name,
199
- rotation_policy: request.rotationPolicy !== void 0 ? marshalKeyRotationPolicy(request.rotationPolicy) : void 0,
200
- tags: request.tags
147
+ description: request.description,
148
+ name: request.name,
149
+ rotation_policy: request.rotationPolicy !== void 0 ? marshalKeyRotationPolicy(request.rotationPolicy, defaults) : void 0,
150
+ tags: request.tags
201
151
  });
202
152
  const marshalVerifyRequest = (request, defaults) => ({
203
- digest: request.digest,
204
- signature: request.signature
153
+ digest: request.digest,
154
+ signature: request.signature
205
155
  });
206
- export {
207
- marshalCreateKeyRequest,
208
- marshalDecryptRequest,
209
- marshalEncryptRequest,
210
- marshalGenerateDataKeyRequest,
211
- marshalImportKeyMaterialRequest,
212
- marshalSignRequest,
213
- marshalUpdateKeyRequest,
214
- marshalVerifyRequest,
215
- unmarshalDataKey,
216
- unmarshalDecryptResponse,
217
- unmarshalEncryptResponse,
218
- unmarshalKey,
219
- unmarshalListAlgorithmsResponse,
220
- unmarshalListKeysResponse,
221
- unmarshalPublicKey,
222
- unmarshalSignResponse,
223
- unmarshalVerifyResponse
224
- };
156
+ export { marshalCreateKeyRequest, marshalDecryptRequest, marshalEncryptRequest, marshalGenerateDataKeyRequest, marshalImportKeyMaterialRequest, marshalSignRequest, marshalUpdateKeyRequest, marshalVerifyRequest, unmarshalDataKey, unmarshalDecryptResponse, unmarshalEncryptResponse, unmarshalKey, unmarshalListAlgorithmsResponse, unmarshalListKeysResponse, unmarshalPublicKey, unmarshalSignResponse, unmarshalVerifyResponse };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-key-manager",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Scaleway SDK key-manager",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
@@ -27,13 +27,13 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@scaleway/random-name": "5.1.2",
30
- "@scaleway/sdk-std": "2.1.0"
30
+ "@scaleway/sdk-std": "2.2.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "@scaleway/sdk-client": "^2.1.0"
33
+ "@scaleway/sdk-client": "^2.2.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@scaleway/sdk-client": "^2.1.0"
36
+ "@scaleway/sdk-client": "^2.2.0"
37
37
  },
38
38
  "scripts": {
39
39
  "package:check": "pnpm publint",