@origincloud/kms 0.0.0-stage → 0.28.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/LICENSE +202 -0
- package/README.md +24 -2
- package/dist/v1beta1/grant.d.ts +149 -0
- package/dist/v1beta1/grant.d.ts.map +1 -0
- package/dist/v1beta1/grant.js +123 -0
- package/dist/v1beta1/grant.js.map +1 -0
- package/dist/v1beta1/index.d.ts +3 -0
- package/dist/v1beta1/index.d.ts.map +1 -0
- package/dist/v1beta1/index.js +4 -0
- package/dist/v1beta1/index.js.map +1 -0
- package/dist/v1beta1/key.d.ts +398 -0
- package/dist/v1beta1/key.d.ts.map +1 -0
- package/dist/v1beta1/key.js +261 -0
- package/dist/v1beta1/key.js.map +1 -0
- package/package.json +40 -4
- package/src/v1beta1/grant.ts +240 -0
- package/src/v1beta1/index.ts +4 -0
- package/src/v1beta1/key.ts +590 -0
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
// Code generated by the SDK's generator (generator/). DO NOT EDIT.
|
|
2
|
+
// source: origincloud/kms/v1beta1/key.proto
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
type CallOptions,
|
|
6
|
+
type Client,
|
|
7
|
+
type Service,
|
|
8
|
+
newRequestId,
|
|
9
|
+
pathValue,
|
|
10
|
+
query,
|
|
11
|
+
} from "@origincloud/core";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Calls KeyService.
|
|
15
|
+
*
|
|
16
|
+
* Keys and the operations made with them.
|
|
17
|
+
*
|
|
18
|
+
* An `ENCRYPT_DECRYPT` key encrypts with AES-256-GCM-SIV. Its ciphertext
|
|
19
|
+
* names the key version that made it but not the key: Decrypt names the
|
|
20
|
+
* key, and a ciphertext decrypts only under the key and the encryption
|
|
21
|
+
* context it was made with. A signing key signs with ECDSA over P-256 and
|
|
22
|
+
* SHA-256 (ASN.1 DER signatures) or with Ed25519; its public keys are read
|
|
23
|
+
* with GetPublicKey.
|
|
24
|
+
*/
|
|
25
|
+
export class KeyClient {
|
|
26
|
+
/**
|
|
27
|
+
* The endpoint the client sends its calls to, which also serves the
|
|
28
|
+
* operations its methods answer with.
|
|
29
|
+
*/
|
|
30
|
+
readonly service: Service;
|
|
31
|
+
|
|
32
|
+
/** A client of KeyService that sends its calls through `client`. */
|
|
33
|
+
constructor(client: Client) {
|
|
34
|
+
this.service = client.service("kms", true);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Returns a key, deleted or not. Needs `kms.key.get` on the project. */
|
|
38
|
+
async getKey(request: GetKeyRequest, options?: CallOptions): Promise<Key> {
|
|
39
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*");
|
|
40
|
+
return this.service.call<Key>(
|
|
41
|
+
{
|
|
42
|
+
method: "GET",
|
|
43
|
+
path: `/v1beta1/${p0}`,
|
|
44
|
+
query: query(request, ["name"]),
|
|
45
|
+
idempotent: true,
|
|
46
|
+
},
|
|
47
|
+
options,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Lists a project's keys in a region, ordered by name. Deleted ones are
|
|
53
|
+
* listed only when `showDeleted` is set, so a page may hold fewer keys
|
|
54
|
+
* than `pageSize` and still be followed by another. Needs `kms.key.list`
|
|
55
|
+
* on the project.
|
|
56
|
+
*/
|
|
57
|
+
async listKeys(request: ListKeysRequest, options?: CallOptions): Promise<ListKeysResponse> {
|
|
58
|
+
const p0 = pathValue("parent", request.parent, "projects/*/regions/*");
|
|
59
|
+
return this.service.call<ListKeysResponse>(
|
|
60
|
+
{
|
|
61
|
+
method: "GET",
|
|
62
|
+
path: `/v1beta1/${p0}/keys`,
|
|
63
|
+
query: query(request, ["parent"]),
|
|
64
|
+
idempotent: true,
|
|
65
|
+
},
|
|
66
|
+
options,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Iterates over everything listKeys lists from the request's page on,
|
|
72
|
+
* fetching the next page as the loop reaches it. A page that fails ends
|
|
73
|
+
* the iteration with its error.
|
|
74
|
+
*/
|
|
75
|
+
async *allKeys(request: ListKeysRequest, options?: CallOptions): AsyncGenerator<Key, void, undefined> {
|
|
76
|
+
for (let page = request; ; ) {
|
|
77
|
+
const response = await this.listKeys(page, options);
|
|
78
|
+
yield* response.keys ?? [];
|
|
79
|
+
if (!response.nextPageToken) return;
|
|
80
|
+
page = { ...page, pageToken: response.nextPageToken };
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Creates a key, `ENABLED`, with its first version as the primary. The
|
|
86
|
+
* platform assigns its id, which its `name` returns; an id is never used
|
|
87
|
+
* again. Needs `kms.key.create` on the project.
|
|
88
|
+
*/
|
|
89
|
+
async createKey(request: CreateKeyRequest, options?: CallOptions): Promise<Key> {
|
|
90
|
+
if (!request.requestId) request = { ...request, requestId: newRequestId() };
|
|
91
|
+
const p0 = pathValue("parent", request.parent, "projects/*/regions/*");
|
|
92
|
+
return this.service.call<Key>(
|
|
93
|
+
{
|
|
94
|
+
method: "POST",
|
|
95
|
+
path: `/v1beta1/${p0}/keys`,
|
|
96
|
+
body: request.key,
|
|
97
|
+
query: query(request, ["parent", "key"]),
|
|
98
|
+
idempotent: true,
|
|
99
|
+
},
|
|
100
|
+
options,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Enables or disables a key, or changes its tags: `state` and `tags` are
|
|
106
|
+
* the fields it changes. A disabled key refuses every operation but
|
|
107
|
+
* GetPublicKey with `CONFLICT` until it is enabled again. Setting the
|
|
108
|
+
* state or the tags the key has already succeeds and changes nothing. A
|
|
109
|
+
* deleted key can't be changed: undelete it first. A key the platform
|
|
110
|
+
* manages (`platformManaged`) is refused with `FORBIDDEN`, even when the
|
|
111
|
+
* request would change nothing. Needs
|
|
112
|
+
* `kms.key.update` on the project.
|
|
113
|
+
*/
|
|
114
|
+
async updateKey(request: UpdateKeyRequest, options?: CallOptions): Promise<Key> {
|
|
115
|
+
if (!request.requestId) request = { ...request, requestId: newRequestId() };
|
|
116
|
+
const p0 = pathValue("key.name", request.key?.name, "projects/*/regions/*/keys/*");
|
|
117
|
+
return this.service.call<Key>(
|
|
118
|
+
{
|
|
119
|
+
method: "PATCH",
|
|
120
|
+
path: `/v1beta1/${p0}`,
|
|
121
|
+
body: request.key,
|
|
122
|
+
query: query(request, ["key.name", "key"]),
|
|
123
|
+
idempotent: true,
|
|
124
|
+
},
|
|
125
|
+
options,
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Deletes a key: it becomes `DELETED` at once, refuses every operation
|
|
131
|
+
* but GetPublicKey, and its material is destroyed at `purgeTime`, after
|
|
132
|
+
* `destroyDelay`. Until then UndeleteKey restores it, disabled. After it,
|
|
133
|
+
* nothing it encrypted can ever be decrypted again. Deleting a deleted key
|
|
134
|
+
* succeeds and changes nothing. A key the platform manages is refused with
|
|
135
|
+
* `FORBIDDEN`, deleted or not. Needs `kms.key.delete` on the project.
|
|
136
|
+
*/
|
|
137
|
+
async deleteKey(request: DeleteKeyRequest, options?: CallOptions): Promise<Key> {
|
|
138
|
+
if (!request.requestId) request = { ...request, requestId: newRequestId() };
|
|
139
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*");
|
|
140
|
+
return this.service.call<Key>(
|
|
141
|
+
{
|
|
142
|
+
method: "DELETE",
|
|
143
|
+
path: `/v1beta1/${p0}`,
|
|
144
|
+
query: query(request, ["name"]),
|
|
145
|
+
idempotent: true,
|
|
146
|
+
},
|
|
147
|
+
options,
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Restores a deleted key whose material isn't destroyed yet: it becomes
|
|
153
|
+
* `DISABLED`, to be enabled with UpdateKey. Refused with `CONFLICT` for a
|
|
154
|
+
* key that isn't deleted, or whose `purgeTime` has passed, and with
|
|
155
|
+
* `FORBIDDEN` for a key the platform manages. Needs `kms.key.delete` on
|
|
156
|
+
* the project.
|
|
157
|
+
*/
|
|
158
|
+
async undeleteKey(request: UndeleteKeyRequest, options?: CallOptions): Promise<Key> {
|
|
159
|
+
if (!request.requestId) request = { ...request, requestId: newRequestId() };
|
|
160
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*");
|
|
161
|
+
return this.service.call<Key>(
|
|
162
|
+
{
|
|
163
|
+
method: "POST",
|
|
164
|
+
path: `/v1beta1/${p0}:undelete`,
|
|
165
|
+
body: request,
|
|
166
|
+
idempotent: true,
|
|
167
|
+
},
|
|
168
|
+
options,
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Adds a new version to a key and makes it the primary: new ciphertexts
|
|
174
|
+
* and signatures use it, and every earlier version still decrypts and
|
|
175
|
+
* its public key stays readable. Refused with `CONFLICT` for a key that
|
|
176
|
+
* isn't enabled, and with `FORBIDDEN` for a key the platform manages.
|
|
177
|
+
* Needs `kms.key.rotate` on the project.
|
|
178
|
+
*/
|
|
179
|
+
async rotateKey(request: RotateKeyRequest, options?: CallOptions): Promise<Key> {
|
|
180
|
+
if (!request.requestId) request = { ...request, requestId: newRequestId() };
|
|
181
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*");
|
|
182
|
+
return this.service.call<Key>(
|
|
183
|
+
{
|
|
184
|
+
method: "POST",
|
|
185
|
+
path: `/v1beta1/${p0}:rotate`,
|
|
186
|
+
body: request,
|
|
187
|
+
idempotent: true,
|
|
188
|
+
},
|
|
189
|
+
options,
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Encrypts up to 64 KiB with an `ENCRYPT_DECRYPT` key's primary version,
|
|
195
|
+
* bound to the encryption context. For more data, encrypt it yourself
|
|
196
|
+
* with a data key from GenerateDataKey. Refused with `CONFLICT` for a key
|
|
197
|
+
* that isn't enabled, and with `BAD_REQUEST` for a signing key. Needs
|
|
198
|
+
* `kms.key.encrypt` on the project.
|
|
199
|
+
*/
|
|
200
|
+
async encrypt(request: EncryptRequest, options?: CallOptions): Promise<EncryptResponse> {
|
|
201
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*");
|
|
202
|
+
return this.service.call<EncryptResponse>(
|
|
203
|
+
{
|
|
204
|
+
method: "POST",
|
|
205
|
+
path: `/v1beta1/${p0}:encrypt`,
|
|
206
|
+
body: request,
|
|
207
|
+
},
|
|
208
|
+
options,
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Decrypts a ciphertext Encrypt or GenerateDataKey made with this key,
|
|
214
|
+
* given the same encryption context. Refused with `BAD_REQUEST` for a
|
|
215
|
+
* ciphertext that doesn't decrypt under this key and context, and with
|
|
216
|
+
* `CONFLICT` for a key that isn't enabled. Needs `kms.key.decrypt` on the
|
|
217
|
+
* project.
|
|
218
|
+
*/
|
|
219
|
+
async decrypt(request: DecryptRequest, options?: CallOptions): Promise<DecryptResponse> {
|
|
220
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*");
|
|
221
|
+
return this.service.call<DecryptResponse>(
|
|
222
|
+
{
|
|
223
|
+
method: "POST",
|
|
224
|
+
path: `/v1beta1/${p0}:decrypt`,
|
|
225
|
+
body: request,
|
|
226
|
+
},
|
|
227
|
+
options,
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Returns a new random 256-bit data key, in plaintext and encrypted under
|
|
233
|
+
* an `ENCRYPT_DECRYPT` key's primary version with the encryption context.
|
|
234
|
+
* Encrypt your data with the plaintext, keep only the ciphertext beside
|
|
235
|
+
* it, and recover the data key with Decrypt when you need it. Needs
|
|
236
|
+
* `kms.key.generate_data_key` on the project.
|
|
237
|
+
*/
|
|
238
|
+
async generateDataKey(request: GenerateDataKeyRequest, options?: CallOptions): Promise<GenerateDataKeyResponse> {
|
|
239
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*");
|
|
240
|
+
return this.service.call<GenerateDataKeyResponse>(
|
|
241
|
+
{
|
|
242
|
+
method: "POST",
|
|
243
|
+
path: `/v1beta1/${p0}:generateDataKey`,
|
|
244
|
+
body: request,
|
|
245
|
+
},
|
|
246
|
+
options,
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Signs up to 64 KiB with a signing key's primary version, or the
|
|
252
|
+
* version `keyVersion` names. ECDSA hashes
|
|
253
|
+
* the data with SHA-256 itself: send the data, not a digest. Refused with
|
|
254
|
+
* `CONFLICT` for a key that isn't enabled, and with `BAD_REQUEST` for an
|
|
255
|
+
* `ENCRYPT_DECRYPT` key. Needs `kms.key.sign` on the project.
|
|
256
|
+
*/
|
|
257
|
+
async sign(request: SignRequest, options?: CallOptions): Promise<SignResponse> {
|
|
258
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*");
|
|
259
|
+
return this.service.call<SignResponse>(
|
|
260
|
+
{
|
|
261
|
+
method: "POST",
|
|
262
|
+
path: `/v1beta1/${p0}:sign`,
|
|
263
|
+
body: request,
|
|
264
|
+
},
|
|
265
|
+
options,
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Returns a signing key version's public key, to verify its signatures
|
|
271
|
+
* with. Answered for a disabled or deleted key too, until its material is
|
|
272
|
+
* destroyed. Refused with `BAD_REQUEST` for an `ENCRYPT_DECRYPT` key.
|
|
273
|
+
* Needs `kms.key.get_public_key` on the project.
|
|
274
|
+
*/
|
|
275
|
+
async getPublicKey(request: GetPublicKeyRequest, options?: CallOptions): Promise<PublicKey> {
|
|
276
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*/versions/*/publicKey");
|
|
277
|
+
return this.service.call<PublicKey>(
|
|
278
|
+
{
|
|
279
|
+
method: "GET",
|
|
280
|
+
path: `/v1beta1/${p0}`,
|
|
281
|
+
query: query(request, ["name"]),
|
|
282
|
+
idempotent: true,
|
|
283
|
+
},
|
|
284
|
+
options,
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* A key: its versions' material is kept by the platform and never leaves
|
|
291
|
+
* it.
|
|
292
|
+
*/
|
|
293
|
+
export interface Key {
|
|
294
|
+
/** The key's resource name. */
|
|
295
|
+
name?: string;
|
|
296
|
+
/** What the key is for. */
|
|
297
|
+
purpose?: Key_Purpose;
|
|
298
|
+
/**
|
|
299
|
+
* Whether the key can be used. A new key is `ENABLED`; UpdateKey sets it
|
|
300
|
+
* to `ENABLED` or `DISABLED`, and DeleteKey makes it `DELETED`.
|
|
301
|
+
*/
|
|
302
|
+
state?: Key_State;
|
|
303
|
+
/** The version new ciphertexts and signatures use. */
|
|
304
|
+
primaryVersion?: string;
|
|
305
|
+
/** Every version, oldest first. RotateKey adds one. */
|
|
306
|
+
versions?: Key_Version[];
|
|
307
|
+
/** When the key was created. */
|
|
308
|
+
createTime?: string;
|
|
309
|
+
/** When the key last changed. */
|
|
310
|
+
updateTime?: string;
|
|
311
|
+
/**
|
|
312
|
+
* When a deleted key's material is destroyed, or was; unset unless the
|
|
313
|
+
* key is `DELETED`.
|
|
314
|
+
*/
|
|
315
|
+
purgeTime?: string;
|
|
316
|
+
/**
|
|
317
|
+
* Labels of your own, at most 50. The `origin:name` tag is the name the
|
|
318
|
+
* console shows.
|
|
319
|
+
*/
|
|
320
|
+
tags?: Record<string, string>;
|
|
321
|
+
/**
|
|
322
|
+
* Whether the platform manages the key: it made the key in your project
|
|
323
|
+
* for its own use of the project's data, such as the key, tagged
|
|
324
|
+
* `origin:name=volumes`, that protects your volumes' data keys. You see it,
|
|
325
|
+
* its grants and its audit log entries like any key of yours, but
|
|
326
|
+
* UpdateKey, DeleteKey, UndeleteKey and RotateKey refuse it with
|
|
327
|
+
* `FORBIDDEN`, whatever roles you hold.
|
|
328
|
+
*/
|
|
329
|
+
platformManaged?: boolean;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/** What a key is for, and the algorithm it uses. */
|
|
333
|
+
export const Key_Purpose = {
|
|
334
|
+
/** Not set. */
|
|
335
|
+
PURPOSE_UNSPECIFIED: "PURPOSE_UNSPECIFIED",
|
|
336
|
+
/** Encrypt, Decrypt and GenerateDataKey, with AES-256-GCM-SIV. */
|
|
337
|
+
ENCRYPT_DECRYPT: "ENCRYPT_DECRYPT",
|
|
338
|
+
/** Sign with ECDSA over P-256 and SHA-256; signatures are ASN.1 DER. */
|
|
339
|
+
SIGN_ECDSA_P256_SHA256: "SIGN_ECDSA_P256_SHA256",
|
|
340
|
+
/** Sign with Ed25519; signatures are 64 bytes. */
|
|
341
|
+
SIGN_ED25519: "SIGN_ED25519",
|
|
342
|
+
} as const;
|
|
343
|
+
|
|
344
|
+
/** What a key is for, and the algorithm it uses. */
|
|
345
|
+
export type Key_Purpose = (typeof Key_Purpose)[keyof typeof Key_Purpose];
|
|
346
|
+
|
|
347
|
+
/** Whether a key can be used. */
|
|
348
|
+
export const Key_State = {
|
|
349
|
+
/** Not set. */
|
|
350
|
+
STATE_UNSPECIFIED: "STATE_UNSPECIFIED",
|
|
351
|
+
/** Serves every operation of its purpose. */
|
|
352
|
+
ENABLED: "ENABLED",
|
|
353
|
+
/** Refuses every operation but GetPublicKey until enabled again. */
|
|
354
|
+
DISABLED: "DISABLED",
|
|
355
|
+
/**
|
|
356
|
+
* Deleted: refuses every operation but GetPublicKey. Until
|
|
357
|
+
* `purgeTime` UndeleteKey restores it; after it, its material is
|
|
358
|
+
* destroyed.
|
|
359
|
+
*/
|
|
360
|
+
DELETED: "DELETED",
|
|
361
|
+
} as const;
|
|
362
|
+
|
|
363
|
+
/** Whether a key can be used. */
|
|
364
|
+
export type Key_State = (typeof Key_State)[keyof typeof Key_State];
|
|
365
|
+
|
|
366
|
+
/** A version of the key: one generation of its material. */
|
|
367
|
+
export interface Key_Version {
|
|
368
|
+
/**
|
|
369
|
+
* The version's resource name,
|
|
370
|
+
* `projects/{project}/regions/{region}/keys/{key}/versions/{version}`,
|
|
371
|
+
* numbered from 1.
|
|
372
|
+
*/
|
|
373
|
+
keyVersion?: string;
|
|
374
|
+
/** When the version was created. */
|
|
375
|
+
createTime?: string;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/** A signing key version's public key. */
|
|
379
|
+
export interface PublicKey {
|
|
380
|
+
/**
|
|
381
|
+
* The public key's resource name: its version's, followed by
|
|
382
|
+
* `/publicKey`.
|
|
383
|
+
*/
|
|
384
|
+
name?: string;
|
|
385
|
+
/** The algorithm the key version signs with. */
|
|
386
|
+
algorithm?: Key_Purpose;
|
|
387
|
+
/**
|
|
388
|
+
* The public key as a PEM-encoded SubjectPublicKeyInfo, which OpenSSL and
|
|
389
|
+
* most libraries read.
|
|
390
|
+
*/
|
|
391
|
+
pem?: string;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/** The request for GetKey. */
|
|
395
|
+
export interface GetKeyRequest {
|
|
396
|
+
/** The key to return. */
|
|
397
|
+
name?: string;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/** The request for ListKeys. */
|
|
401
|
+
export interface ListKeysRequest {
|
|
402
|
+
/**
|
|
403
|
+
* The project and region whose keys to list,
|
|
404
|
+
* `projects/{project}/regions/{region}`.
|
|
405
|
+
*/
|
|
406
|
+
parent?: string;
|
|
407
|
+
/**
|
|
408
|
+
* The most keys to return; the server clamps it, and 0 means its
|
|
409
|
+
* default.
|
|
410
|
+
*/
|
|
411
|
+
pageSize?: number;
|
|
412
|
+
/** A previous response's `nextPageToken`, for the page after it. */
|
|
413
|
+
pageToken?: string;
|
|
414
|
+
/** Whether deleted keys are listed too. */
|
|
415
|
+
showDeleted?: boolean;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/** The response for ListKeys. */
|
|
419
|
+
export interface ListKeysResponse {
|
|
420
|
+
/** The keys on this page. */
|
|
421
|
+
keys?: Key[];
|
|
422
|
+
/** The token for the next page; empty on the last one. */
|
|
423
|
+
nextPageToken?: string;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/** The request for CreateKey. */
|
|
427
|
+
export interface CreateKeyRequest {
|
|
428
|
+
/**
|
|
429
|
+
* The project and region to create the key in,
|
|
430
|
+
* `projects/{project}/regions/{region}`.
|
|
431
|
+
*/
|
|
432
|
+
parent?: string;
|
|
433
|
+
/** The key to create: its `purpose`, and optionally its tags. */
|
|
434
|
+
key?: Key;
|
|
435
|
+
/**
|
|
436
|
+
* A UUID; a repeat with the same id within a day returns the key the
|
|
437
|
+
* first request created, as it was then, instead of creating a second
|
|
438
|
+
* one.
|
|
439
|
+
*/
|
|
440
|
+
requestId?: string;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/** The request for UpdateKey. */
|
|
444
|
+
export interface UpdateKeyRequest {
|
|
445
|
+
/**
|
|
446
|
+
* The key, by its name, with the state to set (`ENABLED` or `DISABLED`)
|
|
447
|
+
* or the tags to replace its tags with.
|
|
448
|
+
*/
|
|
449
|
+
key?: Key;
|
|
450
|
+
/** The fields to change: `state`, `tags`, or both. `*` is both. */
|
|
451
|
+
updateMask?: string;
|
|
452
|
+
/**
|
|
453
|
+
* A UUID; a repeat with the same id within a day returns the key as the
|
|
454
|
+
* first request left it, instead of changing it again.
|
|
455
|
+
*/
|
|
456
|
+
requestId?: string;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/** The request for DeleteKey. */
|
|
460
|
+
export interface DeleteKeyRequest {
|
|
461
|
+
/** The key to delete. */
|
|
462
|
+
name?: string;
|
|
463
|
+
/**
|
|
464
|
+
* How long until the key's material is destroyed: whole days, from 1 to
|
|
465
|
+
* 90; 30 days when unset.
|
|
466
|
+
*/
|
|
467
|
+
destroyDelay?: string;
|
|
468
|
+
/**
|
|
469
|
+
* A UUID; a repeat with the same id within a day returns the key as the
|
|
470
|
+
* first request left it.
|
|
471
|
+
*/
|
|
472
|
+
requestId?: string;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/** The request for UndeleteKey. */
|
|
476
|
+
export interface UndeleteKeyRequest {
|
|
477
|
+
/** The deleted key to restore. */
|
|
478
|
+
name?: string;
|
|
479
|
+
/**
|
|
480
|
+
* A UUID; a repeat with the same id within a day returns the key as the
|
|
481
|
+
* first request left it, instead of answering `CONFLICT`.
|
|
482
|
+
*/
|
|
483
|
+
requestId?: string;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/** The request for RotateKey. */
|
|
487
|
+
export interface RotateKeyRequest {
|
|
488
|
+
/** The key to rotate. */
|
|
489
|
+
name?: string;
|
|
490
|
+
/**
|
|
491
|
+
* A UUID; a repeat with the same id within a day returns the key as the
|
|
492
|
+
* first request left it, instead of adding another version.
|
|
493
|
+
*/
|
|
494
|
+
requestId?: string;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/** The request for Encrypt. */
|
|
498
|
+
export interface EncryptRequest {
|
|
499
|
+
/** The `ENCRYPT_DECRYPT` key to encrypt with. */
|
|
500
|
+
name?: string;
|
|
501
|
+
/** The data to encrypt, at most 64 KiB. */
|
|
502
|
+
plaintext?: string;
|
|
503
|
+
/**
|
|
504
|
+
* Pairs bound into the ciphertext, which Decrypt must be given again,
|
|
505
|
+
* exactly. They aren't secret: the audit log records them. At most 16
|
|
506
|
+
* pairs, each key and value 1 to 256 bytes.
|
|
507
|
+
*/
|
|
508
|
+
encryptionContext?: Record<string, string>;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/** The response for Encrypt. */
|
|
512
|
+
export interface EncryptResponse {
|
|
513
|
+
/** The ciphertext, to store and pass to Decrypt. */
|
|
514
|
+
ciphertext?: string;
|
|
515
|
+
/** The key version that encrypted it. */
|
|
516
|
+
keyVersion?: string;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
/** The request for Decrypt. */
|
|
520
|
+
export interface DecryptRequest {
|
|
521
|
+
/** The key the ciphertext was made with. */
|
|
522
|
+
name?: string;
|
|
523
|
+
/** What Encrypt or GenerateDataKey returned as `ciphertext`. */
|
|
524
|
+
ciphertext?: string;
|
|
525
|
+
/** The encryption context the ciphertext was made with. */
|
|
526
|
+
encryptionContext?: Record<string, string>;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/** The response for Decrypt. */
|
|
530
|
+
export interface DecryptResponse {
|
|
531
|
+
/** The decrypted data. */
|
|
532
|
+
plaintext?: string;
|
|
533
|
+
/** The key version that decrypted it. */
|
|
534
|
+
keyVersion?: string;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/** The request for GenerateDataKey. */
|
|
538
|
+
export interface GenerateDataKeyRequest {
|
|
539
|
+
/** The `ENCRYPT_DECRYPT` key to encrypt the data key with. */
|
|
540
|
+
name?: string;
|
|
541
|
+
/** Pairs bound into the data key's ciphertext, as Encrypt's. */
|
|
542
|
+
encryptionContext?: Record<string, string>;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/** The response for GenerateDataKey. */
|
|
546
|
+
export interface GenerateDataKeyResponse {
|
|
547
|
+
/** The 32-byte data key. Use it, then discard it: never store it. */
|
|
548
|
+
plaintext?: string;
|
|
549
|
+
/**
|
|
550
|
+
* The data key encrypted under the key, to store beside your data and
|
|
551
|
+
* pass to Decrypt.
|
|
552
|
+
*/
|
|
553
|
+
ciphertext?: string;
|
|
554
|
+
/** The key version that encrypted it. */
|
|
555
|
+
keyVersion?: string;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/** The request for Sign. */
|
|
559
|
+
export interface SignRequest {
|
|
560
|
+
/** The signing key to sign with. */
|
|
561
|
+
name?: string;
|
|
562
|
+
/** The data to sign, at most 64 KiB. */
|
|
563
|
+
data?: string;
|
|
564
|
+
/**
|
|
565
|
+
* The version of `name` to sign with, `{name}/versions/{version}`.
|
|
566
|
+
* Without it, the key's primary version signs. Name it when the
|
|
567
|
+
* signature's verifiers must know the version before the signature
|
|
568
|
+
* exists, for example a token whose header names its key: the primary
|
|
569
|
+
* can change between reading it and signing. Refused with `BAD_REQUEST`
|
|
570
|
+
* for a version of another key or a destroyed version.
|
|
571
|
+
*/
|
|
572
|
+
keyVersion?: string;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/** The response for Sign. */
|
|
576
|
+
export interface SignResponse {
|
|
577
|
+
/** The signature: ASN.1 DER for ECDSA, 64 bytes for Ed25519. */
|
|
578
|
+
signature?: string;
|
|
579
|
+
/** The key version that signed, whose public key verifies it. */
|
|
580
|
+
keyVersion?: string;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/** The request for GetPublicKey. */
|
|
584
|
+
export interface GetPublicKeyRequest {
|
|
585
|
+
/**
|
|
586
|
+
* The public key to return: a key version's name followed by
|
|
587
|
+
* `/publicKey`.
|
|
588
|
+
*/
|
|
589
|
+
name?: string;
|
|
590
|
+
}
|