@scaleway/sdk-key-manager 1.0.1
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/LICENSE +191 -0
- package/dist/index.gen.cjs +4 -0
- package/dist/index.gen.d.ts +5 -0
- package/dist/index.gen.js +4 -0
- package/dist/v1alpha1/api.gen.cjs +254 -0
- package/dist/v1alpha1/api.gen.d.ts +121 -0
- package/dist/v1alpha1/api.gen.js +254 -0
- package/dist/v1alpha1/index.gen.cjs +16 -0
- package/dist/v1alpha1/index.gen.d.ts +3 -0
- package/dist/v1alpha1/index.gen.js +16 -0
- package/dist/v1alpha1/marshalling.gen.cjs +149 -0
- package/dist/v1alpha1/marshalling.gen.d.ts +13 -0
- package/dist/v1alpha1/marshalling.gen.js +149 -0
- package/dist/v1alpha1/types.gen.d.ts +388 -0
- package/package.json +51 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import type { Region as ScwRegion } from '@scaleway/sdk-client';
|
|
2
|
+
export type DataKeyAlgorithmSymmetricEncryption = 'unknown_symmetric_encryption' | 'aes_256_gcm';
|
|
3
|
+
export type KeyAlgorithmSymmetricEncryption = 'unknown_symmetric_encryption' | 'aes_256_gcm';
|
|
4
|
+
export type KeyOrigin = 'unknown_origin' | 'scaleway_kms' | 'external';
|
|
5
|
+
export type KeyState = 'unknown_state' | 'enabled' | 'disabled' | 'pending_key_material';
|
|
6
|
+
export type ListKeysRequestOrderBy = 'name_asc' | 'name_desc' | 'created_at_asc' | 'created_at_desc' | 'updated_at_asc' | 'updated_at_desc';
|
|
7
|
+
export interface KeyRotationPolicy {
|
|
8
|
+
/**
|
|
9
|
+
* Time interval between two key rotations. The minimum duration is 24 hours and the maximum duration is 1 year (876000 hours).
|
|
10
|
+
*/
|
|
11
|
+
rotationPeriod?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Timestamp indicating the next scheduled rotation.
|
|
14
|
+
*/
|
|
15
|
+
nextRotationAt?: Date;
|
|
16
|
+
}
|
|
17
|
+
export interface KeyUsage {
|
|
18
|
+
/**
|
|
19
|
+
* See the `Key.Algorithm.SymmetricEncryption` enum for a description of values.
|
|
20
|
+
*
|
|
21
|
+
* One-of ('usage'): at most one of 'symmetricEncryption' could be set.
|
|
22
|
+
*/
|
|
23
|
+
symmetricEncryption?: KeyAlgorithmSymmetricEncryption;
|
|
24
|
+
}
|
|
25
|
+
export interface Key {
|
|
26
|
+
/**
|
|
27
|
+
* ID of the key.
|
|
28
|
+
*/
|
|
29
|
+
id: string;
|
|
30
|
+
/**
|
|
31
|
+
* ID of the Project containing the key.
|
|
32
|
+
*/
|
|
33
|
+
projectId: string;
|
|
34
|
+
/**
|
|
35
|
+
* Name of the key.
|
|
36
|
+
*/
|
|
37
|
+
name: string;
|
|
38
|
+
/**
|
|
39
|
+
* Keys with a usage set to `symmetric_encryption` can encrypt and decrypt data using the `AES-256-GCM` key algorithm. Key Manager currently only supports `AES-256-GCM`.
|
|
40
|
+
*/
|
|
41
|
+
usage?: KeyUsage;
|
|
42
|
+
/**
|
|
43
|
+
* See the `Key.State` enum for a description of possible values.
|
|
44
|
+
*/
|
|
45
|
+
state: KeyState;
|
|
46
|
+
/**
|
|
47
|
+
* The rotation count tracks the number of times the key has been rotated.
|
|
48
|
+
*/
|
|
49
|
+
rotationCount: number;
|
|
50
|
+
/**
|
|
51
|
+
* Key creation date.
|
|
52
|
+
*/
|
|
53
|
+
createdAt?: Date;
|
|
54
|
+
/**
|
|
55
|
+
* Key last modification date.
|
|
56
|
+
*/
|
|
57
|
+
updatedAt?: Date;
|
|
58
|
+
/**
|
|
59
|
+
* Returns `true` if key protection is applied to the key.
|
|
60
|
+
*/
|
|
61
|
+
protected: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Returns `true` if the key is locked.
|
|
64
|
+
*/
|
|
65
|
+
locked: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Description of the key.
|
|
68
|
+
*/
|
|
69
|
+
description?: string;
|
|
70
|
+
/**
|
|
71
|
+
* List of the key's tags.
|
|
72
|
+
*/
|
|
73
|
+
tags: string[];
|
|
74
|
+
/**
|
|
75
|
+
* Key last rotation date.
|
|
76
|
+
*/
|
|
77
|
+
rotatedAt?: Date;
|
|
78
|
+
/**
|
|
79
|
+
* Key rotation policy.
|
|
80
|
+
*/
|
|
81
|
+
rotationPolicy?: KeyRotationPolicy;
|
|
82
|
+
/**
|
|
83
|
+
* Refer to the `Key.Origin` enum for a description of values.
|
|
84
|
+
*/
|
|
85
|
+
origin: KeyOrigin;
|
|
86
|
+
/**
|
|
87
|
+
* Region where the key is stored.
|
|
88
|
+
*/
|
|
89
|
+
region: ScwRegion;
|
|
90
|
+
}
|
|
91
|
+
export type CreateKeyRequest = {
|
|
92
|
+
/**
|
|
93
|
+
* Region to target. If none is passed will use default region from the config.
|
|
94
|
+
*/
|
|
95
|
+
region?: ScwRegion;
|
|
96
|
+
/**
|
|
97
|
+
* ID of the Project containing the key.
|
|
98
|
+
*/
|
|
99
|
+
projectId?: string;
|
|
100
|
+
/**
|
|
101
|
+
* (Optional) Name of the key.
|
|
102
|
+
*/
|
|
103
|
+
name?: string;
|
|
104
|
+
/**
|
|
105
|
+
* See the `Key.Algorithm.SymmetricEncryption` enum for a description of values.
|
|
106
|
+
*/
|
|
107
|
+
usage?: KeyUsage;
|
|
108
|
+
/**
|
|
109
|
+
* (Optional) Description of the key.
|
|
110
|
+
*/
|
|
111
|
+
description?: string;
|
|
112
|
+
/**
|
|
113
|
+
* (Optional) List of the key's tags.
|
|
114
|
+
*/
|
|
115
|
+
tags?: string[];
|
|
116
|
+
/**
|
|
117
|
+
* If not specified, no rotation policy will be applied to the key.
|
|
118
|
+
*/
|
|
119
|
+
rotationPolicy?: KeyRotationPolicy;
|
|
120
|
+
/**
|
|
121
|
+
* Default value is `false`.
|
|
122
|
+
*/
|
|
123
|
+
unprotected: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Refer to the `Key.Origin` enum for a description of values.
|
|
126
|
+
*/
|
|
127
|
+
origin?: KeyOrigin;
|
|
128
|
+
};
|
|
129
|
+
export interface DataKey {
|
|
130
|
+
/**
|
|
131
|
+
* ID of the data encryption key.
|
|
132
|
+
*/
|
|
133
|
+
keyId: string;
|
|
134
|
+
/**
|
|
135
|
+
* Symmetric encryption algorithm of the data encryption key (`AES-256-GCM`).
|
|
136
|
+
*/
|
|
137
|
+
algorithm: DataKeyAlgorithmSymmetricEncryption;
|
|
138
|
+
/**
|
|
139
|
+
* Your data encryption key's ciphertext can be stored safely. It can only be decrypted through the keys you create in Key Manager, using the relevant key ID.
|
|
140
|
+
*/
|
|
141
|
+
ciphertext: string;
|
|
142
|
+
/**
|
|
143
|
+
* (Optional) Your data encryption key's plaintext allows you to use the key immediately upon creation. It must neither be stored or shared.
|
|
144
|
+
*/
|
|
145
|
+
plaintext?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Data encryption key creation date.
|
|
148
|
+
*/
|
|
149
|
+
createdAt?: Date;
|
|
150
|
+
}
|
|
151
|
+
export type DecryptRequest = {
|
|
152
|
+
/**
|
|
153
|
+
* Region to target. If none is passed will use default region from the config.
|
|
154
|
+
*/
|
|
155
|
+
region?: ScwRegion;
|
|
156
|
+
/**
|
|
157
|
+
* ID of the key to decrypt.
|
|
158
|
+
*/
|
|
159
|
+
keyId: string;
|
|
160
|
+
/**
|
|
161
|
+
* Data size must be between 1 and 131071 bytes.
|
|
162
|
+
*/
|
|
163
|
+
ciphertext: string;
|
|
164
|
+
/**
|
|
165
|
+
* The additional data must match the value passed in the encryption request.
|
|
166
|
+
*/
|
|
167
|
+
associatedData?: string;
|
|
168
|
+
};
|
|
169
|
+
export interface DecryptResponse {
|
|
170
|
+
/**
|
|
171
|
+
* ID of the key used for decryption.
|
|
172
|
+
*/
|
|
173
|
+
keyId: string;
|
|
174
|
+
/**
|
|
175
|
+
* Key's decrypted data.
|
|
176
|
+
*/
|
|
177
|
+
plaintext: string;
|
|
178
|
+
/**
|
|
179
|
+
* If the data was already encrypted with the latest key rotation, no output will be returned in the response object.
|
|
180
|
+
*/
|
|
181
|
+
ciphertext?: string;
|
|
182
|
+
}
|
|
183
|
+
export type DeleteKeyMaterialRequest = {
|
|
184
|
+
/**
|
|
185
|
+
* Region to target. If none is passed will use default region from the config.
|
|
186
|
+
*/
|
|
187
|
+
region?: ScwRegion;
|
|
188
|
+
/**
|
|
189
|
+
* ID of the key of which to delete the key material.
|
|
190
|
+
*/
|
|
191
|
+
keyId: string;
|
|
192
|
+
};
|
|
193
|
+
export type DeleteKeyRequest = {
|
|
194
|
+
/**
|
|
195
|
+
* Region to target. If none is passed will use default region from the config.
|
|
196
|
+
*/
|
|
197
|
+
region?: ScwRegion;
|
|
198
|
+
/**
|
|
199
|
+
* ID of the key to delete.
|
|
200
|
+
*/
|
|
201
|
+
keyId: string;
|
|
202
|
+
};
|
|
203
|
+
export type DisableKeyRequest = {
|
|
204
|
+
/**
|
|
205
|
+
* Region to target. If none is passed will use default region from the config.
|
|
206
|
+
*/
|
|
207
|
+
region?: ScwRegion;
|
|
208
|
+
/**
|
|
209
|
+
* ID of the key to disable.
|
|
210
|
+
*/
|
|
211
|
+
keyId: string;
|
|
212
|
+
};
|
|
213
|
+
export type EnableKeyRequest = {
|
|
214
|
+
/**
|
|
215
|
+
* Region to target. If none is passed will use default region from the config.
|
|
216
|
+
*/
|
|
217
|
+
region?: ScwRegion;
|
|
218
|
+
/**
|
|
219
|
+
* ID of the key to enable.
|
|
220
|
+
*/
|
|
221
|
+
keyId: string;
|
|
222
|
+
};
|
|
223
|
+
export type EncryptRequest = {
|
|
224
|
+
/**
|
|
225
|
+
* Region to target. If none is passed will use default region from the config.
|
|
226
|
+
*/
|
|
227
|
+
region?: ScwRegion;
|
|
228
|
+
/**
|
|
229
|
+
* ID of the key to encrypt.
|
|
230
|
+
*/
|
|
231
|
+
keyId: string;
|
|
232
|
+
/**
|
|
233
|
+
* Data size must be between 1 and 65535 bytes.
|
|
234
|
+
*/
|
|
235
|
+
plaintext: string;
|
|
236
|
+
/**
|
|
237
|
+
* Additional data which will not be encrypted, but authenticated and appended to the encrypted payload.
|
|
238
|
+
*/
|
|
239
|
+
associatedData?: string;
|
|
240
|
+
};
|
|
241
|
+
export interface EncryptResponse {
|
|
242
|
+
/**
|
|
243
|
+
* ID of the key used for encryption.
|
|
244
|
+
*/
|
|
245
|
+
keyId: string;
|
|
246
|
+
/**
|
|
247
|
+
* Key's encrypted data.
|
|
248
|
+
*/
|
|
249
|
+
ciphertext: string;
|
|
250
|
+
}
|
|
251
|
+
export type GenerateDataKeyRequest = {
|
|
252
|
+
/**
|
|
253
|
+
* Region to target. If none is passed will use default region from the config.
|
|
254
|
+
*/
|
|
255
|
+
region?: ScwRegion;
|
|
256
|
+
/**
|
|
257
|
+
* ID of the key.
|
|
258
|
+
*/
|
|
259
|
+
keyId: string;
|
|
260
|
+
/**
|
|
261
|
+
* See the `DataKey.Algorithm.SymmetricEncryption` enum for a description of values.
|
|
262
|
+
*/
|
|
263
|
+
algorithm?: DataKeyAlgorithmSymmetricEncryption;
|
|
264
|
+
/**
|
|
265
|
+
* Default value is `false`, meaning that the plaintext is returned.
|
|
266
|
+
Set it to `true` if you do not wish the plaintext to be returned in the response object.
|
|
267
|
+
*/
|
|
268
|
+
withoutPlaintext: boolean;
|
|
269
|
+
};
|
|
270
|
+
export type GetKeyRequest = {
|
|
271
|
+
/**
|
|
272
|
+
* Region to target. If none is passed will use default region from the config.
|
|
273
|
+
*/
|
|
274
|
+
region?: ScwRegion;
|
|
275
|
+
/**
|
|
276
|
+
* ID of the key to target.
|
|
277
|
+
*/
|
|
278
|
+
keyId: string;
|
|
279
|
+
};
|
|
280
|
+
export type ImportKeyMaterialRequest = {
|
|
281
|
+
/**
|
|
282
|
+
* Region to target. If none is passed will use default region from the config.
|
|
283
|
+
*/
|
|
284
|
+
region?: ScwRegion;
|
|
285
|
+
/**
|
|
286
|
+
* The key's origin must be `external`.
|
|
287
|
+
*/
|
|
288
|
+
keyId: string;
|
|
289
|
+
/**
|
|
290
|
+
* The key material The key material is a random sequence of bytes used to derive a cryptographic key.
|
|
291
|
+
*/
|
|
292
|
+
keyMaterial: string;
|
|
293
|
+
/**
|
|
294
|
+
* A salt is random data added to key material to ensure unique derived keys, even if the input is similar. It helps strengthen security when the key material has low randomness (low entropy).
|
|
295
|
+
*/
|
|
296
|
+
salt?: string;
|
|
297
|
+
};
|
|
298
|
+
export type ListKeysRequest = {
|
|
299
|
+
/**
|
|
300
|
+
* Region to target. If none is passed will use default region from the config.
|
|
301
|
+
*/
|
|
302
|
+
region?: ScwRegion;
|
|
303
|
+
/**
|
|
304
|
+
* (Optional) Filter by Organization ID.
|
|
305
|
+
*/
|
|
306
|
+
organizationId?: string;
|
|
307
|
+
/**
|
|
308
|
+
* (Optional) Filter by Project ID.
|
|
309
|
+
*/
|
|
310
|
+
projectId?: string;
|
|
311
|
+
orderBy?: ListKeysRequestOrderBy;
|
|
312
|
+
page?: number;
|
|
313
|
+
pageSize?: number;
|
|
314
|
+
/**
|
|
315
|
+
* (Optional) List of tags to filter on.
|
|
316
|
+
*/
|
|
317
|
+
tags?: string[];
|
|
318
|
+
/**
|
|
319
|
+
* (Optional) Filter by key name.
|
|
320
|
+
*/
|
|
321
|
+
name?: string;
|
|
322
|
+
};
|
|
323
|
+
export interface ListKeysResponse {
|
|
324
|
+
/**
|
|
325
|
+
* Single page of keys matching the requested criteria.
|
|
326
|
+
*/
|
|
327
|
+
keys: Key[];
|
|
328
|
+
/**
|
|
329
|
+
* Total count of keys matching the requested criteria.
|
|
330
|
+
*/
|
|
331
|
+
totalCount: number;
|
|
332
|
+
}
|
|
333
|
+
export type ProtectKeyRequest = {
|
|
334
|
+
/**
|
|
335
|
+
* Region to target. If none is passed will use default region from the config.
|
|
336
|
+
*/
|
|
337
|
+
region?: ScwRegion;
|
|
338
|
+
/**
|
|
339
|
+
* ID of the key to apply key protection to.
|
|
340
|
+
*/
|
|
341
|
+
keyId: string;
|
|
342
|
+
};
|
|
343
|
+
export type RotateKeyRequest = {
|
|
344
|
+
/**
|
|
345
|
+
* Region to target. If none is passed will use default region from the config.
|
|
346
|
+
*/
|
|
347
|
+
region?: ScwRegion;
|
|
348
|
+
/**
|
|
349
|
+
* ID of the key to rotate.
|
|
350
|
+
*/
|
|
351
|
+
keyId: string;
|
|
352
|
+
};
|
|
353
|
+
export type UnprotectKeyRequest = {
|
|
354
|
+
/**
|
|
355
|
+
* Region to target. If none is passed will use default region from the config.
|
|
356
|
+
*/
|
|
357
|
+
region?: ScwRegion;
|
|
358
|
+
/**
|
|
359
|
+
* ID of the key to remove key protection from.
|
|
360
|
+
*/
|
|
361
|
+
keyId: string;
|
|
362
|
+
};
|
|
363
|
+
export type UpdateKeyRequest = {
|
|
364
|
+
/**
|
|
365
|
+
* Region to target. If none is passed will use default region from the config.
|
|
366
|
+
*/
|
|
367
|
+
region?: ScwRegion;
|
|
368
|
+
/**
|
|
369
|
+
* ID of the key to update.
|
|
370
|
+
*/
|
|
371
|
+
keyId: string;
|
|
372
|
+
/**
|
|
373
|
+
* (Optional) Updated name of the key.
|
|
374
|
+
*/
|
|
375
|
+
name?: string;
|
|
376
|
+
/**
|
|
377
|
+
* (Optional) Updated description of the key.
|
|
378
|
+
*/
|
|
379
|
+
description?: string;
|
|
380
|
+
/**
|
|
381
|
+
* (Optional) Updated list of the key's tags.
|
|
382
|
+
*/
|
|
383
|
+
tags?: string[];
|
|
384
|
+
/**
|
|
385
|
+
* If not specified, the key's existing rotation policy applies.
|
|
386
|
+
*/
|
|
387
|
+
rotationPolicy?: KeyRotationPolicy;
|
|
388
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@scaleway/sdk-key-manager",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Scaleway SDK key-manager",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"type": "module",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.gen.d.ts",
|
|
13
|
+
"import": "./dist/index.gen.js",
|
|
14
|
+
"require": "./dist/index.gen.cjs",
|
|
15
|
+
"default": "./dist/index.gen.js"
|
|
16
|
+
},
|
|
17
|
+
"./*": {
|
|
18
|
+
"types": "./dist/*/index.gen.d.ts",
|
|
19
|
+
"import": "./dist/*/index.gen.js",
|
|
20
|
+
"require": "./dist/*/index.gen.cjs",
|
|
21
|
+
"default": "./dist/*/index.gen.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"directory": "packages_generated/key-manager"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=20.18.3"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@scaleway/random-name": "5.1.1",
|
|
33
|
+
"@scaleway/sdk-std": "1.0.1"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@scaleway/sdk-client": "^1.2.1"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@scaleway/sdk-client": "^1.2.1"
|
|
40
|
+
},
|
|
41
|
+
"bundledDependencies": [
|
|
42
|
+
"@scaleway/random-name"
|
|
43
|
+
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"package:check": "pnpm publint",
|
|
46
|
+
"typecheck": "tsc --noEmit",
|
|
47
|
+
"type:generate": "tsc --declaration -p tsconfig.build.json",
|
|
48
|
+
"build": "vite build --config vite.config.ts && pnpm run type:generate",
|
|
49
|
+
"build:profile": "npx vite-bundle-visualizer -c vite.config.ts"
|
|
50
|
+
}
|
|
51
|
+
}
|