@scaleway/sdk-key-manager 1.2.1 → 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.
- package/dist/v1alpha1/api.gen.cjs +40 -9
- package/dist/v1alpha1/api.gen.d.ts +24 -7
- package/dist/v1alpha1/api.gen.js +42 -11
- package/dist/v1alpha1/index.gen.cjs +1 -0
- package/dist/v1alpha1/index.gen.d.ts +1 -1
- package/dist/v1alpha1/index.gen.js +2 -1
- package/dist/v1alpha1/marshalling.gen.cjs +27 -0
- package/dist/v1alpha1/marshalling.gen.d.ts +2 -1
- package/dist/v1alpha1/marshalling.gen.js +27 -0
- package/dist/v1alpha1/types.gen.d.ts +38 -1
- package/package.json +6 -6
|
@@ -6,12 +6,13 @@ const jsonContentHeaders = {
|
|
|
6
6
|
"Content-Type": "application/json; charset=utf-8"
|
|
7
7
|
};
|
|
8
8
|
class API extends sdkClient.API {
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Locality of this API.
|
|
11
|
+
* type ∈ {'zone','region','global','unspecified'}
|
|
12
|
+
*/
|
|
13
|
+
static LOCALITY = sdkClient.toApiLocality({
|
|
14
|
+
regions: ["fr-par", "nl-ams", "pl-waw"]
|
|
15
|
+
});
|
|
15
16
|
/**
|
|
16
17
|
* Create a key. Create a key in a given region specified by the `region` parameter. Keys only support symmetric encryption. You can use keys to encrypt or decrypt arbitrary payloads, or to generate data encryption keys. **Data encryption keys are not stored in Key Manager**.
|
|
17
18
|
*
|
|
@@ -156,7 +157,7 @@ class API extends sdkClient.API {
|
|
|
156
157
|
},
|
|
157
158
|
marshalling_gen.unmarshalKey
|
|
158
159
|
);
|
|
159
|
-
pageOfListKeys = (request
|
|
160
|
+
pageOfListKeys = (request) => this.client.fetch(
|
|
160
161
|
{
|
|
161
162
|
method: "GET",
|
|
162
163
|
path: `/key-manager/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys`,
|
|
@@ -170,6 +171,7 @@ class API extends sdkClient.API {
|
|
|
170
171
|
request.pageSize ?? this.client.settings.defaultPageSize
|
|
171
172
|
],
|
|
172
173
|
["project_id", request.projectId],
|
|
174
|
+
["scheduled_for_deletion", request.scheduledForDeletion],
|
|
173
175
|
["tags", request.tags],
|
|
174
176
|
["usage", request.usage]
|
|
175
177
|
)
|
|
@@ -182,7 +184,7 @@ class API extends sdkClient.API {
|
|
|
182
184
|
* @param request - The request {@link ListKeysRequest}
|
|
183
185
|
* @returns A Promise of ListKeysResponse
|
|
184
186
|
*/
|
|
185
|
-
listKeys = (request
|
|
187
|
+
listKeys = (request) => sdkClient.enrichForPagination("keys", this.pageOfListKeys, request);
|
|
186
188
|
/**
|
|
187
189
|
* 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
190
|
|
|
@@ -203,7 +205,7 @@ class API extends sdkClient.API {
|
|
|
203
205
|
marshalling_gen.unmarshalDataKey
|
|
204
206
|
);
|
|
205
207
|
/**
|
|
206
|
-
* Encrypt a payload. Encrypt a payload using an existing key, specified by the `key_id` parameter.
|
|
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.
|
|
207
209
|
*
|
|
208
210
|
* @param request - The request {@link EncryptRequest}
|
|
209
211
|
* @returns A Promise of EncryptResponse
|
|
@@ -296,5 +298,34 @@ class API extends sdkClient.API {
|
|
|
296
298
|
method: "POST",
|
|
297
299
|
path: `/key-manager/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${sdkClient.validatePathParam("keyId", request.keyId)}/delete-key-material`
|
|
298
300
|
});
|
|
301
|
+
/**
|
|
302
|
+
* Restore a key. Restore a key and all its rotations scheduled for deletion specified by the `region` and `key_id` parameters.
|
|
303
|
+
*
|
|
304
|
+
* @param request - The request {@link RestoreKeyRequest}
|
|
305
|
+
* @returns A Promise of Key
|
|
306
|
+
*/
|
|
307
|
+
restoreKey = (request) => this.client.fetch(
|
|
308
|
+
{
|
|
309
|
+
body: "{}",
|
|
310
|
+
headers: jsonContentHeaders,
|
|
311
|
+
method: "POST",
|
|
312
|
+
path: `/key-manager/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${sdkClient.validatePathParam("keyId", request.keyId)}/restore`
|
|
313
|
+
},
|
|
314
|
+
marshalling_gen.unmarshalKey
|
|
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
|
+
);
|
|
299
330
|
}
|
|
300
331
|
exports.API = API;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import type { ApiLocality } from '@scaleway/sdk-client';
|
|
1
2
|
import { API as ParentAPI } from '@scaleway/sdk-client';
|
|
2
|
-
import type {
|
|
3
|
-
import type { CreateKeyRequest, DataKey, DecryptRequest, DecryptResponse, DeleteKeyMaterialRequest, DeleteKeyRequest, DisableKeyRequest, EnableKeyRequest, EncryptRequest, EncryptResponse, GenerateDataKeyRequest, GetKeyRequest, GetPublicKeyRequest, ImportKeyMaterialRequest, Key, ListKeysRequest, ListKeysResponse, ProtectKeyRequest, PublicKey, RotateKeyRequest, SignRequest, SignResponse, UnprotectKeyRequest, UpdateKeyRequest, VerifyRequest, VerifyResponse } from './types.gen';
|
|
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
|
|
|
7
7
|
This API allows you to create, manage and use cryptographic keys in a centralized and secure service.
|
|
8
8
|
*/
|
|
9
9
|
export declare class API extends ParentAPI {
|
|
10
|
-
/**
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Locality of this API.
|
|
12
|
+
* type ∈ {'zone','region','global','unspecified'}
|
|
13
|
+
*/
|
|
14
|
+
static readonly LOCALITY: ApiLocality;
|
|
12
15
|
/**
|
|
13
16
|
* Create a key. Create a key in a given region specified by the `region` parameter. Keys only support symmetric encryption. You can use keys to encrypt or decrypt arbitrary payloads, or to generate data encryption keys. **Data encryption keys are not stored in Key Manager**.
|
|
14
17
|
*
|
|
@@ -78,14 +81,14 @@ export declare class API extends ParentAPI {
|
|
|
78
81
|
* @returns A Promise of Key
|
|
79
82
|
*/
|
|
80
83
|
disableKey: (request: Readonly<DisableKeyRequest>) => Promise<Key>;
|
|
81
|
-
protected pageOfListKeys: (request
|
|
84
|
+
protected pageOfListKeys: (request: Readonly<ListKeysRequest>) => Promise<ListKeysResponse>;
|
|
82
85
|
/**
|
|
83
86
|
* 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`.
|
|
84
87
|
*
|
|
85
88
|
* @param request - The request {@link ListKeysRequest}
|
|
86
89
|
* @returns A Promise of ListKeysResponse
|
|
87
90
|
*/
|
|
88
|
-
listKeys: (request
|
|
91
|
+
listKeys: (request: Readonly<ListKeysRequest>) => Promise<ListKeysResponse> & {
|
|
89
92
|
all: () => Promise<Key[]>;
|
|
90
93
|
[Symbol.asyncIterator]: () => AsyncGenerator<Key[], void, void>;
|
|
91
94
|
};
|
|
@@ -99,7 +102,7 @@ export declare class API extends ParentAPI {
|
|
|
99
102
|
*/
|
|
100
103
|
generateDataKey: (request: Readonly<GenerateDataKeyRequest>) => Promise<DataKey>;
|
|
101
104
|
/**
|
|
102
|
-
* Encrypt a payload. Encrypt a payload using an existing key, specified by the `key_id` parameter.
|
|
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.
|
|
103
106
|
*
|
|
104
107
|
* @param request - The request {@link EncryptRequest}
|
|
105
108
|
* @returns A Promise of EncryptResponse
|
|
@@ -139,4 +142,18 @@ export declare class API extends ParentAPI {
|
|
|
139
142
|
* @param request - The request {@link DeleteKeyMaterialRequest}
|
|
140
143
|
*/
|
|
141
144
|
deleteKeyMaterial: (request: Readonly<DeleteKeyMaterialRequest>) => Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Restore a key. Restore a key and all its rotations scheduled for deletion specified by the `region` and `key_id` parameters.
|
|
147
|
+
*
|
|
148
|
+
* @param request - The request {@link RestoreKeyRequest}
|
|
149
|
+
* @returns A Promise of Key
|
|
150
|
+
*/
|
|
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>;
|
|
142
159
|
}
|
package/dist/v1alpha1/api.gen.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { API as API$1, 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";
|
|
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
3
|
const jsonContentHeaders = {
|
|
4
4
|
"Content-Type": "application/json; charset=utf-8"
|
|
5
5
|
};
|
|
6
6
|
class API extends API$1 {
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
});
|
|
13
14
|
/**
|
|
14
15
|
* Create a key. Create a key in a given region specified by the `region` parameter. Keys only support symmetric encryption. You can use keys to encrypt or decrypt arbitrary payloads, or to generate data encryption keys. **Data encryption keys are not stored in Key Manager**.
|
|
15
16
|
*
|
|
@@ -154,7 +155,7 @@ class API extends API$1 {
|
|
|
154
155
|
},
|
|
155
156
|
unmarshalKey
|
|
156
157
|
);
|
|
157
|
-
pageOfListKeys = (request
|
|
158
|
+
pageOfListKeys = (request) => this.client.fetch(
|
|
158
159
|
{
|
|
159
160
|
method: "GET",
|
|
160
161
|
path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys`,
|
|
@@ -168,6 +169,7 @@ class API extends API$1 {
|
|
|
168
169
|
request.pageSize ?? this.client.settings.defaultPageSize
|
|
169
170
|
],
|
|
170
171
|
["project_id", request.projectId],
|
|
172
|
+
["scheduled_for_deletion", request.scheduledForDeletion],
|
|
171
173
|
["tags", request.tags],
|
|
172
174
|
["usage", request.usage]
|
|
173
175
|
)
|
|
@@ -180,7 +182,7 @@ class API extends API$1 {
|
|
|
180
182
|
* @param request - The request {@link ListKeysRequest}
|
|
181
183
|
* @returns A Promise of ListKeysResponse
|
|
182
184
|
*/
|
|
183
|
-
listKeys = (request
|
|
185
|
+
listKeys = (request) => enrichForPagination("keys", this.pageOfListKeys, request);
|
|
184
186
|
/**
|
|
185
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.
|
|
186
188
|
|
|
@@ -201,7 +203,7 @@ class API extends API$1 {
|
|
|
201
203
|
unmarshalDataKey
|
|
202
204
|
);
|
|
203
205
|
/**
|
|
204
|
-
* Encrypt a payload. Encrypt a payload using an existing key, specified by the `key_id` parameter.
|
|
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.
|
|
205
207
|
*
|
|
206
208
|
* @param request - The request {@link EncryptRequest}
|
|
207
209
|
* @returns A Promise of EncryptResponse
|
|
@@ -294,6 +296,35 @@ class API extends API$1 {
|
|
|
294
296
|
method: "POST",
|
|
295
297
|
path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/delete-key-material`
|
|
296
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
|
+
);
|
|
297
328
|
}
|
|
298
329
|
export {
|
|
299
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, 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,
|
|
@@ -32,6 +32,7 @@ const unmarshalKey = (data) => {
|
|
|
32
32
|
}
|
|
33
33
|
return {
|
|
34
34
|
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
35
|
+
deletionRequestedAt: sdkClient.unmarshalDate(data.deletion_requested_at),
|
|
35
36
|
description: data.description,
|
|
36
37
|
id: data.id,
|
|
37
38
|
locked: data.locked,
|
|
@@ -86,6 +87,31 @@ const unmarshalEncryptResponse = (data) => {
|
|
|
86
87
|
keyId: data.key_id
|
|
87
88
|
};
|
|
88
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
|
+
};
|
|
89
115
|
const unmarshalListKeysResponse = (data) => {
|
|
90
116
|
if (!sdkClient.isJSONObject(data)) {
|
|
91
117
|
throw new TypeError(
|
|
@@ -191,6 +217,7 @@ exports.unmarshalDataKey = unmarshalDataKey;
|
|
|
191
217
|
exports.unmarshalDecryptResponse = unmarshalDecryptResponse;
|
|
192
218
|
exports.unmarshalEncryptResponse = unmarshalEncryptResponse;
|
|
193
219
|
exports.unmarshalKey = unmarshalKey;
|
|
220
|
+
exports.unmarshalListAlgorithmsResponse = unmarshalListAlgorithmsResponse;
|
|
194
221
|
exports.unmarshalListKeysResponse = unmarshalListKeysResponse;
|
|
195
222
|
exports.unmarshalPublicKey = unmarshalPublicKey;
|
|
196
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;
|
|
@@ -30,6 +30,7 @@ const unmarshalKey = (data) => {
|
|
|
30
30
|
}
|
|
31
31
|
return {
|
|
32
32
|
createdAt: unmarshalDate(data.created_at),
|
|
33
|
+
deletionRequestedAt: unmarshalDate(data.deletion_requested_at),
|
|
33
34
|
description: data.description,
|
|
34
35
|
id: data.id,
|
|
35
36
|
locked: data.locked,
|
|
@@ -84,6 +85,31 @@ const unmarshalEncryptResponse = (data) => {
|
|
|
84
85
|
keyId: data.key_id
|
|
85
86
|
};
|
|
86
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
|
+
};
|
|
87
113
|
const unmarshalListKeysResponse = (data) => {
|
|
88
114
|
if (!isJSONObject(data)) {
|
|
89
115
|
throw new TypeError(
|
|
@@ -190,6 +216,7 @@ export {
|
|
|
190
216
|
unmarshalDecryptResponse,
|
|
191
217
|
unmarshalEncryptResponse,
|
|
192
218
|
unmarshalKey,
|
|
219
|
+
unmarshalListAlgorithmsResponse,
|
|
193
220
|
unmarshalListKeysResponse,
|
|
194
221
|
unmarshalPublicKey,
|
|
195
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.
|
|
@@ -96,6 +102,10 @@ export interface Key {
|
|
|
96
102
|
* Refer to the `Key.Origin` enum for a description of values.
|
|
97
103
|
*/
|
|
98
104
|
origin: KeyOrigin;
|
|
105
|
+
/**
|
|
106
|
+
* Returns the time at which deletion was requested.
|
|
107
|
+
*/
|
|
108
|
+
deletionRequestedAt?: Date;
|
|
99
109
|
/**
|
|
100
110
|
* Region where the key is stored.
|
|
101
111
|
*/
|
|
@@ -318,6 +328,22 @@ export type ImportKeyMaterialRequest = {
|
|
|
318
328
|
*/
|
|
319
329
|
salt?: string;
|
|
320
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
|
+
}
|
|
321
347
|
export type ListKeysRequest = {
|
|
322
348
|
/**
|
|
323
349
|
* Region to target. If none is passed will use default region from the config.
|
|
@@ -346,6 +372,10 @@ export type ListKeysRequest = {
|
|
|
346
372
|
* Select from symmetric encryption, asymmetric encryption, or asymmetric signing.
|
|
347
373
|
*/
|
|
348
374
|
usage?: ListKeysRequestUsage;
|
|
375
|
+
/**
|
|
376
|
+
* Filter keys based on their deletion status. By default, only keys not scheduled for deletion are returned in the output.
|
|
377
|
+
*/
|
|
378
|
+
scheduledForDeletion: boolean;
|
|
349
379
|
};
|
|
350
380
|
export interface ListKeysResponse {
|
|
351
381
|
/**
|
|
@@ -370,6 +400,13 @@ export type ProtectKeyRequest = {
|
|
|
370
400
|
export interface PublicKey {
|
|
371
401
|
pem: string;
|
|
372
402
|
}
|
|
403
|
+
export type RestoreKeyRequest = {
|
|
404
|
+
/**
|
|
405
|
+
* Region to target. If none is passed will use default region from the config.
|
|
406
|
+
*/
|
|
407
|
+
region?: ScwRegion;
|
|
408
|
+
keyId: string;
|
|
409
|
+
};
|
|
373
410
|
export type RotateKeyRequest = {
|
|
374
411
|
/**
|
|
375
412
|
* 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.
|
|
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.
|
|
29
|
+
"node": ">=20.19.4"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@scaleway/random-name": "5.1.
|
|
33
|
-
"@scaleway/sdk-std": "1.0.
|
|
32
|
+
"@scaleway/random-name": "5.1.2",
|
|
33
|
+
"@scaleway/sdk-std": "1.0.6"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@scaleway/sdk-client": "^1.
|
|
36
|
+
"@scaleway/sdk-client": "^1.3.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@scaleway/sdk-client": "^1.
|
|
39
|
+
"@scaleway/sdk-client": "^1.3.1"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"package:check": "pnpm publint",
|