@origincloud/kms 0.27.0 → 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/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 +3 -3
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { type CallOptions, type Client, type Empty, type Service } from "@origincloud/core";
|
|
2
|
+
/**
|
|
3
|
+
* Calls GrantService.
|
|
4
|
+
*
|
|
5
|
+
* A key's grants.
|
|
6
|
+
*
|
|
7
|
+
* Making, renewing and deleting a grant needs `kms.grant.create`,
|
|
8
|
+
* `kms.grant.update` and `kms.grant.delete` on the key's project, which the
|
|
9
|
+
* platform's own services hold where you let them use your keys; none of
|
|
10
|
+
* them lets the holder use the key itself. Reading and listing need
|
|
11
|
+
* `kms.grant.get` and `kms.grant.list`.
|
|
12
|
+
*/
|
|
13
|
+
export declare class GrantClient {
|
|
14
|
+
/**
|
|
15
|
+
* The endpoint the client sends its calls to, which also serves the
|
|
16
|
+
* operations its methods answer with.
|
|
17
|
+
*/
|
|
18
|
+
readonly service: Service;
|
|
19
|
+
/** A client of GrantService that sends its calls through `client`. */
|
|
20
|
+
constructor(client: Client);
|
|
21
|
+
/**
|
|
22
|
+
* Returns a grant that hasn't expired; an expired one is `NOT_FOUND`. A
|
|
23
|
+
* grant made moments ago may be refused with `SERVICE_UNAVAILABLE`,
|
|
24
|
+
* retryable, until its zone's change arrives. Needs `kms.grant.get` on
|
|
25
|
+
* the project.
|
|
26
|
+
*/
|
|
27
|
+
getGrant(request: GetGrantRequest, options?: CallOptions): Promise<Grant>;
|
|
28
|
+
/**
|
|
29
|
+
* Lists a key's grants that haven't expired, in every zone, ordered by
|
|
30
|
+
* name. A grant made moments ago may be missing from the list until its
|
|
31
|
+
* zone's change arrives. Needs `kms.grant.list` on the project.
|
|
32
|
+
*/
|
|
33
|
+
listGrants(request: ListGrantsRequest, options?: CallOptions): Promise<ListGrantsResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* Iterates over everything listGrants lists from the request's page on,
|
|
36
|
+
* fetching the next page as the loop reaches it. A page that fails ends
|
|
37
|
+
* the iteration with its error.
|
|
38
|
+
*/
|
|
39
|
+
allGrants(request: ListGrantsRequest, options?: CallOptions): AsyncGenerator<Grant, void, undefined>;
|
|
40
|
+
/**
|
|
41
|
+
* Makes a grant on an `ENCRYPT_DECRYPT` key for one host, refused with
|
|
42
|
+
* `BAD_REQUEST` for a key of another purpose, a host that isn't one of
|
|
43
|
+
* the region's, an empty encryption context, or a `ttl` outside 1 to 60
|
|
44
|
+
* minutes, and with `CONFLICT` for a key that isn't enabled. Needs
|
|
45
|
+
* `kms.grant.create` on the project.
|
|
46
|
+
*/
|
|
47
|
+
createGrant(request: CreateGrantRequest, options?: CallOptions): Promise<Grant>;
|
|
48
|
+
/**
|
|
49
|
+
* Extends a grant that hasn't expired to `ttl` from now. An expired
|
|
50
|
+
* grant isn't renewed: `CONFLICT`, and a new one is made instead. Needs
|
|
51
|
+
* `kms.grant.update` on the project.
|
|
52
|
+
*/
|
|
53
|
+
renewGrant(request: RenewGrantRequest, options?: CallOptions): Promise<Grant>;
|
|
54
|
+
/**
|
|
55
|
+
* Ends a grant before it expires: from then on it opens nothing. Needs
|
|
56
|
+
* `kms.grant.delete` on the project.
|
|
57
|
+
*/
|
|
58
|
+
deleteGrant(request: DeleteGrantRequest, options?: CallOptions): Promise<Empty>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A grant: one host may use one key for one operation, with exactly one
|
|
62
|
+
* encryption context, until `expireTime`.
|
|
63
|
+
*/
|
|
64
|
+
export interface Grant {
|
|
65
|
+
/** The grant's resource name. */
|
|
66
|
+
name?: string;
|
|
67
|
+
/** What the host may do with the key. */
|
|
68
|
+
operation?: Grant_Operation;
|
|
69
|
+
/**
|
|
70
|
+
* The platform host the grant is for, by the SPIFFE ID its certificate
|
|
71
|
+
* names, which ends in `/zones/{zone}/hosts/{host}`.
|
|
72
|
+
*/
|
|
73
|
+
grantee?: string;
|
|
74
|
+
/** The encryption context a use must carry, exactly; never empty. */
|
|
75
|
+
encryptionContext?: Record<string, string>;
|
|
76
|
+
/** How long the grant lives from now: 1 to 60 minutes. */
|
|
77
|
+
ttl?: string;
|
|
78
|
+
/** The zone that keeps the grant: its host's. */
|
|
79
|
+
zone?: string;
|
|
80
|
+
/** Who made the grant. */
|
|
81
|
+
delegate?: string;
|
|
82
|
+
/** When the grant was made. */
|
|
83
|
+
createTime?: string;
|
|
84
|
+
/** When the grant was last renewed, or made. */
|
|
85
|
+
renewTime?: string;
|
|
86
|
+
/** When the grant stops opening anything unless renewed before. */
|
|
87
|
+
expireTime?: string;
|
|
88
|
+
}
|
|
89
|
+
/** What a grant lets its host do. */
|
|
90
|
+
export declare const Grant_Operation: {
|
|
91
|
+
/** Not set. */
|
|
92
|
+
readonly OPERATION_UNSPECIFIED: "OPERATION_UNSPECIFIED";
|
|
93
|
+
/**
|
|
94
|
+
* Decrypt ciphertexts made under the key with the grant's encryption
|
|
95
|
+
* context.
|
|
96
|
+
*/
|
|
97
|
+
readonly DECRYPT: "DECRYPT";
|
|
98
|
+
};
|
|
99
|
+
/** What a grant lets its host do. */
|
|
100
|
+
export type Grant_Operation = (typeof Grant_Operation)[keyof typeof Grant_Operation];
|
|
101
|
+
/** The request for GetGrant. */
|
|
102
|
+
export interface GetGrantRequest {
|
|
103
|
+
/** The grant to return. */
|
|
104
|
+
name?: string;
|
|
105
|
+
}
|
|
106
|
+
/** The request for ListGrants. */
|
|
107
|
+
export interface ListGrantsRequest {
|
|
108
|
+
/** The key whose grants to list. */
|
|
109
|
+
parent?: string;
|
|
110
|
+
/**
|
|
111
|
+
* The most grants to return; the server clamps it, and 0 means its
|
|
112
|
+
* default.
|
|
113
|
+
*/
|
|
114
|
+
pageSize?: number;
|
|
115
|
+
/** A previous response's `nextPageToken`, for the page after it. */
|
|
116
|
+
pageToken?: string;
|
|
117
|
+
}
|
|
118
|
+
/** The response for ListGrants. */
|
|
119
|
+
export interface ListGrantsResponse {
|
|
120
|
+
/** The grants on this page. */
|
|
121
|
+
grants?: Grant[];
|
|
122
|
+
/** The token for the next page; empty on the last one. */
|
|
123
|
+
nextPageToken?: string;
|
|
124
|
+
}
|
|
125
|
+
/** The request for CreateGrant. */
|
|
126
|
+
export interface CreateGrantRequest {
|
|
127
|
+
/** The key to grant. */
|
|
128
|
+
parent?: string;
|
|
129
|
+
/** The grant to make: its operation, host, encryption context and `ttl`. */
|
|
130
|
+
grant?: Grant;
|
|
131
|
+
/**
|
|
132
|
+
* A UUID; a repeat with the same id within a day returns the grant the
|
|
133
|
+
* first request made, instead of making a second.
|
|
134
|
+
*/
|
|
135
|
+
requestId?: string;
|
|
136
|
+
}
|
|
137
|
+
/** The request for RenewGrant. */
|
|
138
|
+
export interface RenewGrantRequest {
|
|
139
|
+
/** The grant to renew. */
|
|
140
|
+
name?: string;
|
|
141
|
+
/** How long the grant lives from now: 1 to 60 minutes. */
|
|
142
|
+
ttl?: string;
|
|
143
|
+
}
|
|
144
|
+
/** The request for DeleteGrant. */
|
|
145
|
+
export interface DeleteGrantRequest {
|
|
146
|
+
/** The grant to end. */
|
|
147
|
+
name?: string;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=grant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant.d.ts","sourceRoot":"","sources":["../../src/v1beta1/grant.ts"],"names":[],"mappings":"AAGA,OAAO,EACL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D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,mCAAmC;AACnC,MAAM,WAAW,kBAAkB;IACjC,wBAAwB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// Code generated by the SDK's generator (generator/). DO NOT EDIT.
|
|
2
|
+
// source: origincloud/kms/v1beta1/grant.proto
|
|
3
|
+
import { newRequestId, pathValue, query, } from "@origincloud/core";
|
|
4
|
+
/**
|
|
5
|
+
* Calls GrantService.
|
|
6
|
+
*
|
|
7
|
+
* A key's grants.
|
|
8
|
+
*
|
|
9
|
+
* Making, renewing and deleting a grant needs `kms.grant.create`,
|
|
10
|
+
* `kms.grant.update` and `kms.grant.delete` on the key's project, which the
|
|
11
|
+
* platform's own services hold where you let them use your keys; none of
|
|
12
|
+
* them lets the holder use the key itself. Reading and listing need
|
|
13
|
+
* `kms.grant.get` and `kms.grant.list`.
|
|
14
|
+
*/
|
|
15
|
+
export class GrantClient {
|
|
16
|
+
/**
|
|
17
|
+
* The endpoint the client sends its calls to, which also serves the
|
|
18
|
+
* operations its methods answer with.
|
|
19
|
+
*/
|
|
20
|
+
service;
|
|
21
|
+
/** A client of GrantService that sends its calls through `client`. */
|
|
22
|
+
constructor(client) {
|
|
23
|
+
this.service = client.service("kms", true);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns a grant that hasn't expired; an expired one is `NOT_FOUND`. A
|
|
27
|
+
* grant made moments ago may be refused with `SERVICE_UNAVAILABLE`,
|
|
28
|
+
* retryable, until its zone's change arrives. Needs `kms.grant.get` on
|
|
29
|
+
* the project.
|
|
30
|
+
*/
|
|
31
|
+
async getGrant(request, options) {
|
|
32
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*/grants/*");
|
|
33
|
+
return this.service.call({
|
|
34
|
+
method: "GET",
|
|
35
|
+
path: `/v1beta1/${p0}`,
|
|
36
|
+
query: query(request, ["name"]),
|
|
37
|
+
idempotent: true,
|
|
38
|
+
}, options);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Lists a key's grants that haven't expired, in every zone, ordered by
|
|
42
|
+
* name. A grant made moments ago may be missing from the list until its
|
|
43
|
+
* zone's change arrives. Needs `kms.grant.list` on the project.
|
|
44
|
+
*/
|
|
45
|
+
async listGrants(request, options) {
|
|
46
|
+
const p0 = pathValue("parent", request.parent, "projects/*/regions/*/keys/*");
|
|
47
|
+
return this.service.call({
|
|
48
|
+
method: "GET",
|
|
49
|
+
path: `/v1beta1/${p0}/grants`,
|
|
50
|
+
query: query(request, ["parent"]),
|
|
51
|
+
idempotent: true,
|
|
52
|
+
}, options);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Iterates over everything listGrants lists from the request's page on,
|
|
56
|
+
* fetching the next page as the loop reaches it. A page that fails ends
|
|
57
|
+
* the iteration with its error.
|
|
58
|
+
*/
|
|
59
|
+
async *allGrants(request, options) {
|
|
60
|
+
for (let page = request;;) {
|
|
61
|
+
const response = await this.listGrants(page, options);
|
|
62
|
+
yield* response.grants ?? [];
|
|
63
|
+
if (!response.nextPageToken)
|
|
64
|
+
return;
|
|
65
|
+
page = { ...page, pageToken: response.nextPageToken };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Makes a grant on an `ENCRYPT_DECRYPT` key for one host, refused with
|
|
70
|
+
* `BAD_REQUEST` for a key of another purpose, a host that isn't one of
|
|
71
|
+
* the region's, an empty encryption context, or a `ttl` outside 1 to 60
|
|
72
|
+
* minutes, and with `CONFLICT` for a key that isn't enabled. Needs
|
|
73
|
+
* `kms.grant.create` on the project.
|
|
74
|
+
*/
|
|
75
|
+
async createGrant(request, options) {
|
|
76
|
+
if (!request.requestId)
|
|
77
|
+
request = { ...request, requestId: newRequestId() };
|
|
78
|
+
const p0 = pathValue("parent", request.parent, "projects/*/regions/*/keys/*");
|
|
79
|
+
return this.service.call({
|
|
80
|
+
method: "POST",
|
|
81
|
+
path: `/v1beta1/${p0}/grants`,
|
|
82
|
+
body: request.grant,
|
|
83
|
+
query: query(request, ["parent", "grant"]),
|
|
84
|
+
idempotent: true,
|
|
85
|
+
}, options);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Extends a grant that hasn't expired to `ttl` from now. An expired
|
|
89
|
+
* grant isn't renewed: `CONFLICT`, and a new one is made instead. Needs
|
|
90
|
+
* `kms.grant.update` on the project.
|
|
91
|
+
*/
|
|
92
|
+
async renewGrant(request, options) {
|
|
93
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*/grants/*");
|
|
94
|
+
return this.service.call({
|
|
95
|
+
method: "POST",
|
|
96
|
+
path: `/v1beta1/${p0}:renew`,
|
|
97
|
+
body: request,
|
|
98
|
+
}, options);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Ends a grant before it expires: from then on it opens nothing. Needs
|
|
102
|
+
* `kms.grant.delete` on the project.
|
|
103
|
+
*/
|
|
104
|
+
async deleteGrant(request, options) {
|
|
105
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*/grants/*");
|
|
106
|
+
return this.service.call({
|
|
107
|
+
method: "DELETE",
|
|
108
|
+
path: `/v1beta1/${p0}`,
|
|
109
|
+
query: query(request, ["name"]),
|
|
110
|
+
}, options);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** What a grant lets its host do. */
|
|
114
|
+
export const Grant_Operation = {
|
|
115
|
+
/** Not set. */
|
|
116
|
+
OPERATION_UNSPECIFIED: "OPERATION_UNSPECIFIED",
|
|
117
|
+
/**
|
|
118
|
+
* Decrypt ciphertexts made under the key with the grant's encryption
|
|
119
|
+
* context.
|
|
120
|
+
*/
|
|
121
|
+
DECRYPT: "DECRYPT",
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=grant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant.js","source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AAC;IAED;;;OAGG;IACH,KAAK,CAAC,WAAW,CAAC,OAA2B,EAAE,OAAqB;QAClE,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,sCAAsC,CAAC,CAAC;QACnF,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB;YACE,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,YAAY,EAAE,EAAE;YACtB,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC;SAChC,EACD,OAAO,CACR,CAAC;IACJ,CAAC;CACF;AAgCD,qCAAqC;AACrC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,eAAe;IACf,qBAAqB,EAAE,uBAAuB;IAC9C;;;OAGG;IACH,OAAO,EAAE,SAAS;CACV,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v1beta1/index.ts"],"names":[],"mappings":"AAEA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1beta1/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import { type CallOptions, type Client, type Service } from "@origincloud/core";
|
|
2
|
+
/**
|
|
3
|
+
* Calls KeyService.
|
|
4
|
+
*
|
|
5
|
+
* Keys and the operations made with them.
|
|
6
|
+
*
|
|
7
|
+
* An `ENCRYPT_DECRYPT` key encrypts with AES-256-GCM-SIV. Its ciphertext
|
|
8
|
+
* names the key version that made it but not the key: Decrypt names the
|
|
9
|
+
* key, and a ciphertext decrypts only under the key and the encryption
|
|
10
|
+
* context it was made with. A signing key signs with ECDSA over P-256 and
|
|
11
|
+
* SHA-256 (ASN.1 DER signatures) or with Ed25519; its public keys are read
|
|
12
|
+
* with GetPublicKey.
|
|
13
|
+
*/
|
|
14
|
+
export declare class KeyClient {
|
|
15
|
+
/**
|
|
16
|
+
* The endpoint the client sends its calls to, which also serves the
|
|
17
|
+
* operations its methods answer with.
|
|
18
|
+
*/
|
|
19
|
+
readonly service: Service;
|
|
20
|
+
/** A client of KeyService that sends its calls through `client`. */
|
|
21
|
+
constructor(client: Client);
|
|
22
|
+
/** Returns a key, deleted or not. Needs `kms.key.get` on the project. */
|
|
23
|
+
getKey(request: GetKeyRequest, options?: CallOptions): Promise<Key>;
|
|
24
|
+
/**
|
|
25
|
+
* Lists a project's keys in a region, ordered by name. Deleted ones are
|
|
26
|
+
* listed only when `showDeleted` is set, so a page may hold fewer keys
|
|
27
|
+
* than `pageSize` and still be followed by another. Needs `kms.key.list`
|
|
28
|
+
* on the project.
|
|
29
|
+
*/
|
|
30
|
+
listKeys(request: ListKeysRequest, options?: CallOptions): Promise<ListKeysResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Iterates over everything listKeys lists from the request's page on,
|
|
33
|
+
* fetching the next page as the loop reaches it. A page that fails ends
|
|
34
|
+
* the iteration with its error.
|
|
35
|
+
*/
|
|
36
|
+
allKeys(request: ListKeysRequest, options?: CallOptions): AsyncGenerator<Key, void, undefined>;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a key, `ENABLED`, with its first version as the primary. The
|
|
39
|
+
* platform assigns its id, which its `name` returns; an id is never used
|
|
40
|
+
* again. Needs `kms.key.create` on the project.
|
|
41
|
+
*/
|
|
42
|
+
createKey(request: CreateKeyRequest, options?: CallOptions): Promise<Key>;
|
|
43
|
+
/**
|
|
44
|
+
* Enables or disables a key, or changes its tags: `state` and `tags` are
|
|
45
|
+
* the fields it changes. A disabled key refuses every operation but
|
|
46
|
+
* GetPublicKey with `CONFLICT` until it is enabled again. Setting the
|
|
47
|
+
* state or the tags the key has already succeeds and changes nothing. A
|
|
48
|
+
* deleted key can't be changed: undelete it first. A key the platform
|
|
49
|
+
* manages (`platformManaged`) is refused with `FORBIDDEN`, even when the
|
|
50
|
+
* request would change nothing. Needs
|
|
51
|
+
* `kms.key.update` on the project.
|
|
52
|
+
*/
|
|
53
|
+
updateKey(request: UpdateKeyRequest, options?: CallOptions): Promise<Key>;
|
|
54
|
+
/**
|
|
55
|
+
* Deletes a key: it becomes `DELETED` at once, refuses every operation
|
|
56
|
+
* but GetPublicKey, and its material is destroyed at `purgeTime`, after
|
|
57
|
+
* `destroyDelay`. Until then UndeleteKey restores it, disabled. After it,
|
|
58
|
+
* nothing it encrypted can ever be decrypted again. Deleting a deleted key
|
|
59
|
+
* succeeds and changes nothing. A key the platform manages is refused with
|
|
60
|
+
* `FORBIDDEN`, deleted or not. Needs `kms.key.delete` on the project.
|
|
61
|
+
*/
|
|
62
|
+
deleteKey(request: DeleteKeyRequest, options?: CallOptions): Promise<Key>;
|
|
63
|
+
/**
|
|
64
|
+
* Restores a deleted key whose material isn't destroyed yet: it becomes
|
|
65
|
+
* `DISABLED`, to be enabled with UpdateKey. Refused with `CONFLICT` for a
|
|
66
|
+
* key that isn't deleted, or whose `purgeTime` has passed, and with
|
|
67
|
+
* `FORBIDDEN` for a key the platform manages. Needs `kms.key.delete` on
|
|
68
|
+
* the project.
|
|
69
|
+
*/
|
|
70
|
+
undeleteKey(request: UndeleteKeyRequest, options?: CallOptions): Promise<Key>;
|
|
71
|
+
/**
|
|
72
|
+
* Adds a new version to a key and makes it the primary: new ciphertexts
|
|
73
|
+
* and signatures use it, and every earlier version still decrypts and
|
|
74
|
+
* its public key stays readable. Refused with `CONFLICT` for a key that
|
|
75
|
+
* isn't enabled, and with `FORBIDDEN` for a key the platform manages.
|
|
76
|
+
* Needs `kms.key.rotate` on the project.
|
|
77
|
+
*/
|
|
78
|
+
rotateKey(request: RotateKeyRequest, options?: CallOptions): Promise<Key>;
|
|
79
|
+
/**
|
|
80
|
+
* Encrypts up to 64 KiB with an `ENCRYPT_DECRYPT` key's primary version,
|
|
81
|
+
* bound to the encryption context. For more data, encrypt it yourself
|
|
82
|
+
* with a data key from GenerateDataKey. Refused with `CONFLICT` for a key
|
|
83
|
+
* that isn't enabled, and with `BAD_REQUEST` for a signing key. Needs
|
|
84
|
+
* `kms.key.encrypt` on the project.
|
|
85
|
+
*/
|
|
86
|
+
encrypt(request: EncryptRequest, options?: CallOptions): Promise<EncryptResponse>;
|
|
87
|
+
/**
|
|
88
|
+
* Decrypts a ciphertext Encrypt or GenerateDataKey made with this key,
|
|
89
|
+
* given the same encryption context. Refused with `BAD_REQUEST` for a
|
|
90
|
+
* ciphertext that doesn't decrypt under this key and context, and with
|
|
91
|
+
* `CONFLICT` for a key that isn't enabled. Needs `kms.key.decrypt` on the
|
|
92
|
+
* project.
|
|
93
|
+
*/
|
|
94
|
+
decrypt(request: DecryptRequest, options?: CallOptions): Promise<DecryptResponse>;
|
|
95
|
+
/**
|
|
96
|
+
* Returns a new random 256-bit data key, in plaintext and encrypted under
|
|
97
|
+
* an `ENCRYPT_DECRYPT` key's primary version with the encryption context.
|
|
98
|
+
* Encrypt your data with the plaintext, keep only the ciphertext beside
|
|
99
|
+
* it, and recover the data key with Decrypt when you need it. Needs
|
|
100
|
+
* `kms.key.generate_data_key` on the project.
|
|
101
|
+
*/
|
|
102
|
+
generateDataKey(request: GenerateDataKeyRequest, options?: CallOptions): Promise<GenerateDataKeyResponse>;
|
|
103
|
+
/**
|
|
104
|
+
* Signs up to 64 KiB with a signing key's primary version, or the
|
|
105
|
+
* version `keyVersion` names. ECDSA hashes
|
|
106
|
+
* the data with SHA-256 itself: send the data, not a digest. Refused with
|
|
107
|
+
* `CONFLICT` for a key that isn't enabled, and with `BAD_REQUEST` for an
|
|
108
|
+
* `ENCRYPT_DECRYPT` key. Needs `kms.key.sign` on the project.
|
|
109
|
+
*/
|
|
110
|
+
sign(request: SignRequest, options?: CallOptions): Promise<SignResponse>;
|
|
111
|
+
/**
|
|
112
|
+
* Returns a signing key version's public key, to verify its signatures
|
|
113
|
+
* with. Answered for a disabled or deleted key too, until its material is
|
|
114
|
+
* destroyed. Refused with `BAD_REQUEST` for an `ENCRYPT_DECRYPT` key.
|
|
115
|
+
* Needs `kms.key.get_public_key` on the project.
|
|
116
|
+
*/
|
|
117
|
+
getPublicKey(request: GetPublicKeyRequest, options?: CallOptions): Promise<PublicKey>;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A key: its versions' material is kept by the platform and never leaves
|
|
121
|
+
* it.
|
|
122
|
+
*/
|
|
123
|
+
export interface Key {
|
|
124
|
+
/** The key's resource name. */
|
|
125
|
+
name?: string;
|
|
126
|
+
/** What the key is for. */
|
|
127
|
+
purpose?: Key_Purpose;
|
|
128
|
+
/**
|
|
129
|
+
* Whether the key can be used. A new key is `ENABLED`; UpdateKey sets it
|
|
130
|
+
* to `ENABLED` or `DISABLED`, and DeleteKey makes it `DELETED`.
|
|
131
|
+
*/
|
|
132
|
+
state?: Key_State;
|
|
133
|
+
/** The version new ciphertexts and signatures use. */
|
|
134
|
+
primaryVersion?: string;
|
|
135
|
+
/** Every version, oldest first. RotateKey adds one. */
|
|
136
|
+
versions?: Key_Version[];
|
|
137
|
+
/** When the key was created. */
|
|
138
|
+
createTime?: string;
|
|
139
|
+
/** When the key last changed. */
|
|
140
|
+
updateTime?: string;
|
|
141
|
+
/**
|
|
142
|
+
* When a deleted key's material is destroyed, or was; unset unless the
|
|
143
|
+
* key is `DELETED`.
|
|
144
|
+
*/
|
|
145
|
+
purgeTime?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Labels of your own, at most 50. The `origin:name` tag is the name the
|
|
148
|
+
* console shows.
|
|
149
|
+
*/
|
|
150
|
+
tags?: Record<string, string>;
|
|
151
|
+
/**
|
|
152
|
+
* Whether the platform manages the key: it made the key in your project
|
|
153
|
+
* for its own use of the project's data, such as the key, tagged
|
|
154
|
+
* `origin:name=volumes`, that protects your volumes' data keys. You see it,
|
|
155
|
+
* its grants and its audit log entries like any key of yours, but
|
|
156
|
+
* UpdateKey, DeleteKey, UndeleteKey and RotateKey refuse it with
|
|
157
|
+
* `FORBIDDEN`, whatever roles you hold.
|
|
158
|
+
*/
|
|
159
|
+
platformManaged?: boolean;
|
|
160
|
+
}
|
|
161
|
+
/** What a key is for, and the algorithm it uses. */
|
|
162
|
+
export declare const Key_Purpose: {
|
|
163
|
+
/** Not set. */
|
|
164
|
+
readonly PURPOSE_UNSPECIFIED: "PURPOSE_UNSPECIFIED";
|
|
165
|
+
/** Encrypt, Decrypt and GenerateDataKey, with AES-256-GCM-SIV. */
|
|
166
|
+
readonly ENCRYPT_DECRYPT: "ENCRYPT_DECRYPT";
|
|
167
|
+
/** Sign with ECDSA over P-256 and SHA-256; signatures are ASN.1 DER. */
|
|
168
|
+
readonly SIGN_ECDSA_P256_SHA256: "SIGN_ECDSA_P256_SHA256";
|
|
169
|
+
/** Sign with Ed25519; signatures are 64 bytes. */
|
|
170
|
+
readonly SIGN_ED25519: "SIGN_ED25519";
|
|
171
|
+
};
|
|
172
|
+
/** What a key is for, and the algorithm it uses. */
|
|
173
|
+
export type Key_Purpose = (typeof Key_Purpose)[keyof typeof Key_Purpose];
|
|
174
|
+
/** Whether a key can be used. */
|
|
175
|
+
export declare const Key_State: {
|
|
176
|
+
/** Not set. */
|
|
177
|
+
readonly STATE_UNSPECIFIED: "STATE_UNSPECIFIED";
|
|
178
|
+
/** Serves every operation of its purpose. */
|
|
179
|
+
readonly ENABLED: "ENABLED";
|
|
180
|
+
/** Refuses every operation but GetPublicKey until enabled again. */
|
|
181
|
+
readonly DISABLED: "DISABLED";
|
|
182
|
+
/**
|
|
183
|
+
* Deleted: refuses every operation but GetPublicKey. Until
|
|
184
|
+
* `purgeTime` UndeleteKey restores it; after it, its material is
|
|
185
|
+
* destroyed.
|
|
186
|
+
*/
|
|
187
|
+
readonly DELETED: "DELETED";
|
|
188
|
+
};
|
|
189
|
+
/** Whether a key can be used. */
|
|
190
|
+
export type Key_State = (typeof Key_State)[keyof typeof Key_State];
|
|
191
|
+
/** A version of the key: one generation of its material. */
|
|
192
|
+
export interface Key_Version {
|
|
193
|
+
/**
|
|
194
|
+
* The version's resource name,
|
|
195
|
+
* `projects/{project}/regions/{region}/keys/{key}/versions/{version}`,
|
|
196
|
+
* numbered from 1.
|
|
197
|
+
*/
|
|
198
|
+
keyVersion?: string;
|
|
199
|
+
/** When the version was created. */
|
|
200
|
+
createTime?: string;
|
|
201
|
+
}
|
|
202
|
+
/** A signing key version's public key. */
|
|
203
|
+
export interface PublicKey {
|
|
204
|
+
/**
|
|
205
|
+
* The public key's resource name: its version's, followed by
|
|
206
|
+
* `/publicKey`.
|
|
207
|
+
*/
|
|
208
|
+
name?: string;
|
|
209
|
+
/** The algorithm the key version signs with. */
|
|
210
|
+
algorithm?: Key_Purpose;
|
|
211
|
+
/**
|
|
212
|
+
* The public key as a PEM-encoded SubjectPublicKeyInfo, which OpenSSL and
|
|
213
|
+
* most libraries read.
|
|
214
|
+
*/
|
|
215
|
+
pem?: string;
|
|
216
|
+
}
|
|
217
|
+
/** The request for GetKey. */
|
|
218
|
+
export interface GetKeyRequest {
|
|
219
|
+
/** The key to return. */
|
|
220
|
+
name?: string;
|
|
221
|
+
}
|
|
222
|
+
/** The request for ListKeys. */
|
|
223
|
+
export interface ListKeysRequest {
|
|
224
|
+
/**
|
|
225
|
+
* The project and region whose keys to list,
|
|
226
|
+
* `projects/{project}/regions/{region}`.
|
|
227
|
+
*/
|
|
228
|
+
parent?: string;
|
|
229
|
+
/**
|
|
230
|
+
* The most keys to return; the server clamps it, and 0 means its
|
|
231
|
+
* default.
|
|
232
|
+
*/
|
|
233
|
+
pageSize?: number;
|
|
234
|
+
/** A previous response's `nextPageToken`, for the page after it. */
|
|
235
|
+
pageToken?: string;
|
|
236
|
+
/** Whether deleted keys are listed too. */
|
|
237
|
+
showDeleted?: boolean;
|
|
238
|
+
}
|
|
239
|
+
/** The response for ListKeys. */
|
|
240
|
+
export interface ListKeysResponse {
|
|
241
|
+
/** The keys on this page. */
|
|
242
|
+
keys?: Key[];
|
|
243
|
+
/** The token for the next page; empty on the last one. */
|
|
244
|
+
nextPageToken?: string;
|
|
245
|
+
}
|
|
246
|
+
/** The request for CreateKey. */
|
|
247
|
+
export interface CreateKeyRequest {
|
|
248
|
+
/**
|
|
249
|
+
* The project and region to create the key in,
|
|
250
|
+
* `projects/{project}/regions/{region}`.
|
|
251
|
+
*/
|
|
252
|
+
parent?: string;
|
|
253
|
+
/** The key to create: its `purpose`, and optionally its tags. */
|
|
254
|
+
key?: Key;
|
|
255
|
+
/**
|
|
256
|
+
* A UUID; a repeat with the same id within a day returns the key the
|
|
257
|
+
* first request created, as it was then, instead of creating a second
|
|
258
|
+
* one.
|
|
259
|
+
*/
|
|
260
|
+
requestId?: string;
|
|
261
|
+
}
|
|
262
|
+
/** The request for UpdateKey. */
|
|
263
|
+
export interface UpdateKeyRequest {
|
|
264
|
+
/**
|
|
265
|
+
* The key, by its name, with the state to set (`ENABLED` or `DISABLED`)
|
|
266
|
+
* or the tags to replace its tags with.
|
|
267
|
+
*/
|
|
268
|
+
key?: Key;
|
|
269
|
+
/** The fields to change: `state`, `tags`, or both. `*` is both. */
|
|
270
|
+
updateMask?: string;
|
|
271
|
+
/**
|
|
272
|
+
* A UUID; a repeat with the same id within a day returns the key as the
|
|
273
|
+
* first request left it, instead of changing it again.
|
|
274
|
+
*/
|
|
275
|
+
requestId?: string;
|
|
276
|
+
}
|
|
277
|
+
/** The request for DeleteKey. */
|
|
278
|
+
export interface DeleteKeyRequest {
|
|
279
|
+
/** The key to delete. */
|
|
280
|
+
name?: string;
|
|
281
|
+
/**
|
|
282
|
+
* How long until the key's material is destroyed: whole days, from 1 to
|
|
283
|
+
* 90; 30 days when unset.
|
|
284
|
+
*/
|
|
285
|
+
destroyDelay?: string;
|
|
286
|
+
/**
|
|
287
|
+
* A UUID; a repeat with the same id within a day returns the key as the
|
|
288
|
+
* first request left it.
|
|
289
|
+
*/
|
|
290
|
+
requestId?: string;
|
|
291
|
+
}
|
|
292
|
+
/** The request for UndeleteKey. */
|
|
293
|
+
export interface UndeleteKeyRequest {
|
|
294
|
+
/** The deleted key to restore. */
|
|
295
|
+
name?: string;
|
|
296
|
+
/**
|
|
297
|
+
* A UUID; a repeat with the same id within a day returns the key as the
|
|
298
|
+
* first request left it, instead of answering `CONFLICT`.
|
|
299
|
+
*/
|
|
300
|
+
requestId?: string;
|
|
301
|
+
}
|
|
302
|
+
/** The request for RotateKey. */
|
|
303
|
+
export interface RotateKeyRequest {
|
|
304
|
+
/** The key to rotate. */
|
|
305
|
+
name?: string;
|
|
306
|
+
/**
|
|
307
|
+
* A UUID; a repeat with the same id within a day returns the key as the
|
|
308
|
+
* first request left it, instead of adding another version.
|
|
309
|
+
*/
|
|
310
|
+
requestId?: string;
|
|
311
|
+
}
|
|
312
|
+
/** The request for Encrypt. */
|
|
313
|
+
export interface EncryptRequest {
|
|
314
|
+
/** The `ENCRYPT_DECRYPT` key to encrypt with. */
|
|
315
|
+
name?: string;
|
|
316
|
+
/** The data to encrypt, at most 64 KiB. */
|
|
317
|
+
plaintext?: string;
|
|
318
|
+
/**
|
|
319
|
+
* Pairs bound into the ciphertext, which Decrypt must be given again,
|
|
320
|
+
* exactly. They aren't secret: the audit log records them. At most 16
|
|
321
|
+
* pairs, each key and value 1 to 256 bytes.
|
|
322
|
+
*/
|
|
323
|
+
encryptionContext?: Record<string, string>;
|
|
324
|
+
}
|
|
325
|
+
/** The response for Encrypt. */
|
|
326
|
+
export interface EncryptResponse {
|
|
327
|
+
/** The ciphertext, to store and pass to Decrypt. */
|
|
328
|
+
ciphertext?: string;
|
|
329
|
+
/** The key version that encrypted it. */
|
|
330
|
+
keyVersion?: string;
|
|
331
|
+
}
|
|
332
|
+
/** The request for Decrypt. */
|
|
333
|
+
export interface DecryptRequest {
|
|
334
|
+
/** The key the ciphertext was made with. */
|
|
335
|
+
name?: string;
|
|
336
|
+
/** What Encrypt or GenerateDataKey returned as `ciphertext`. */
|
|
337
|
+
ciphertext?: string;
|
|
338
|
+
/** The encryption context the ciphertext was made with. */
|
|
339
|
+
encryptionContext?: Record<string, string>;
|
|
340
|
+
}
|
|
341
|
+
/** The response for Decrypt. */
|
|
342
|
+
export interface DecryptResponse {
|
|
343
|
+
/** The decrypted data. */
|
|
344
|
+
plaintext?: string;
|
|
345
|
+
/** The key version that decrypted it. */
|
|
346
|
+
keyVersion?: string;
|
|
347
|
+
}
|
|
348
|
+
/** The request for GenerateDataKey. */
|
|
349
|
+
export interface GenerateDataKeyRequest {
|
|
350
|
+
/** The `ENCRYPT_DECRYPT` key to encrypt the data key with. */
|
|
351
|
+
name?: string;
|
|
352
|
+
/** Pairs bound into the data key's ciphertext, as Encrypt's. */
|
|
353
|
+
encryptionContext?: Record<string, string>;
|
|
354
|
+
}
|
|
355
|
+
/** The response for GenerateDataKey. */
|
|
356
|
+
export interface GenerateDataKeyResponse {
|
|
357
|
+
/** The 32-byte data key. Use it, then discard it: never store it. */
|
|
358
|
+
plaintext?: string;
|
|
359
|
+
/**
|
|
360
|
+
* The data key encrypted under the key, to store beside your data and
|
|
361
|
+
* pass to Decrypt.
|
|
362
|
+
*/
|
|
363
|
+
ciphertext?: string;
|
|
364
|
+
/** The key version that encrypted it. */
|
|
365
|
+
keyVersion?: string;
|
|
366
|
+
}
|
|
367
|
+
/** The request for Sign. */
|
|
368
|
+
export interface SignRequest {
|
|
369
|
+
/** The signing key to sign with. */
|
|
370
|
+
name?: string;
|
|
371
|
+
/** The data to sign, at most 64 KiB. */
|
|
372
|
+
data?: string;
|
|
373
|
+
/**
|
|
374
|
+
* The version of `name` to sign with, `{name}/versions/{version}`.
|
|
375
|
+
* Without it, the key's primary version signs. Name it when the
|
|
376
|
+
* signature's verifiers must know the version before the signature
|
|
377
|
+
* exists, for example a token whose header names its key: the primary
|
|
378
|
+
* can change between reading it and signing. Refused with `BAD_REQUEST`
|
|
379
|
+
* for a version of another key or a destroyed version.
|
|
380
|
+
*/
|
|
381
|
+
keyVersion?: string;
|
|
382
|
+
}
|
|
383
|
+
/** The response for Sign. */
|
|
384
|
+
export interface SignResponse {
|
|
385
|
+
/** The signature: ASN.1 DER for ECDSA, 64 bytes for Ed25519. */
|
|
386
|
+
signature?: string;
|
|
387
|
+
/** The key version that signed, whose public key verifies it. */
|
|
388
|
+
keyVersion?: string;
|
|
389
|
+
}
|
|
390
|
+
/** The request for GetPublicKey. */
|
|
391
|
+
export interface GetPublicKeyRequest {
|
|
392
|
+
/**
|
|
393
|
+
* The public key to return: a key version's name followed by
|
|
394
|
+
* `/publicKey`.
|
|
395
|
+
*/
|
|
396
|
+
name?: string;
|
|
397
|
+
}
|
|
398
|
+
//# sourceMappingURL=key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key.d.ts","sourceRoot":"","sources":["../../src/v1beta1/key.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,OAAO,EAIb,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;GAWG;AACH,qBAAa,SAAS;IACpB;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B,oEAAoE;gBACxD,MAAM,EAAE,MAAM;IAI1B,yEAAyE;IACnE,MAAM,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC;IAazE;;;;;OAKG;IACG,QAAQ,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAa1F;;;;OAIG;IACI,OAAO,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC;IASrG;;;;OAIG;IACG,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,WAAW,GAA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AAE,MAAM,CAAC;CACrB;AAED,4BAA4B;AAC5B,MAAM,WAAW,WAAW;IAC1B,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,6BAA6B;AAC7B,MAAM,WAAW,YAAY;IAC3B,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,oCAAoC;AACpC,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
// Code generated by the SDK's generator (generator/). DO NOT EDIT.
|
|
2
|
+
// source: origincloud/kms/v1beta1/key.proto
|
|
3
|
+
import { newRequestId, pathValue, query, } from "@origincloud/core";
|
|
4
|
+
/**
|
|
5
|
+
* Calls KeyService.
|
|
6
|
+
*
|
|
7
|
+
* Keys and the operations made with them.
|
|
8
|
+
*
|
|
9
|
+
* An `ENCRYPT_DECRYPT` key encrypts with AES-256-GCM-SIV. Its ciphertext
|
|
10
|
+
* names the key version that made it but not the key: Decrypt names the
|
|
11
|
+
* key, and a ciphertext decrypts only under the key and the encryption
|
|
12
|
+
* context it was made with. A signing key signs with ECDSA over P-256 and
|
|
13
|
+
* SHA-256 (ASN.1 DER signatures) or with Ed25519; its public keys are read
|
|
14
|
+
* with GetPublicKey.
|
|
15
|
+
*/
|
|
16
|
+
export class KeyClient {
|
|
17
|
+
/**
|
|
18
|
+
* The endpoint the client sends its calls to, which also serves the
|
|
19
|
+
* operations its methods answer with.
|
|
20
|
+
*/
|
|
21
|
+
service;
|
|
22
|
+
/** A client of KeyService that sends its calls through `client`. */
|
|
23
|
+
constructor(client) {
|
|
24
|
+
this.service = client.service("kms", true);
|
|
25
|
+
}
|
|
26
|
+
/** Returns a key, deleted or not. Needs `kms.key.get` on the project. */
|
|
27
|
+
async getKey(request, options) {
|
|
28
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*");
|
|
29
|
+
return this.service.call({
|
|
30
|
+
method: "GET",
|
|
31
|
+
path: `/v1beta1/${p0}`,
|
|
32
|
+
query: query(request, ["name"]),
|
|
33
|
+
idempotent: true,
|
|
34
|
+
}, options);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Lists a project's keys in a region, ordered by name. Deleted ones are
|
|
38
|
+
* listed only when `showDeleted` is set, so a page may hold fewer keys
|
|
39
|
+
* than `pageSize` and still be followed by another. Needs `kms.key.list`
|
|
40
|
+
* on the project.
|
|
41
|
+
*/
|
|
42
|
+
async listKeys(request, options) {
|
|
43
|
+
const p0 = pathValue("parent", request.parent, "projects/*/regions/*");
|
|
44
|
+
return this.service.call({
|
|
45
|
+
method: "GET",
|
|
46
|
+
path: `/v1beta1/${p0}/keys`,
|
|
47
|
+
query: query(request, ["parent"]),
|
|
48
|
+
idempotent: true,
|
|
49
|
+
}, options);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Iterates over everything listKeys lists from the request's page on,
|
|
53
|
+
* fetching the next page as the loop reaches it. A page that fails ends
|
|
54
|
+
* the iteration with its error.
|
|
55
|
+
*/
|
|
56
|
+
async *allKeys(request, options) {
|
|
57
|
+
for (let page = request;;) {
|
|
58
|
+
const response = await this.listKeys(page, options);
|
|
59
|
+
yield* response.keys ?? [];
|
|
60
|
+
if (!response.nextPageToken)
|
|
61
|
+
return;
|
|
62
|
+
page = { ...page, pageToken: response.nextPageToken };
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Creates a key, `ENABLED`, with its first version as the primary. The
|
|
67
|
+
* platform assigns its id, which its `name` returns; an id is never used
|
|
68
|
+
* again. Needs `kms.key.create` on the project.
|
|
69
|
+
*/
|
|
70
|
+
async createKey(request, options) {
|
|
71
|
+
if (!request.requestId)
|
|
72
|
+
request = { ...request, requestId: newRequestId() };
|
|
73
|
+
const p0 = pathValue("parent", request.parent, "projects/*/regions/*");
|
|
74
|
+
return this.service.call({
|
|
75
|
+
method: "POST",
|
|
76
|
+
path: `/v1beta1/${p0}/keys`,
|
|
77
|
+
body: request.key,
|
|
78
|
+
query: query(request, ["parent", "key"]),
|
|
79
|
+
idempotent: true,
|
|
80
|
+
}, options);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Enables or disables a key, or changes its tags: `state` and `tags` are
|
|
84
|
+
* the fields it changes. A disabled key refuses every operation but
|
|
85
|
+
* GetPublicKey with `CONFLICT` until it is enabled again. Setting the
|
|
86
|
+
* state or the tags the key has already succeeds and changes nothing. A
|
|
87
|
+
* deleted key can't be changed: undelete it first. A key the platform
|
|
88
|
+
* manages (`platformManaged`) is refused with `FORBIDDEN`, even when the
|
|
89
|
+
* request would change nothing. Needs
|
|
90
|
+
* `kms.key.update` on the project.
|
|
91
|
+
*/
|
|
92
|
+
async updateKey(request, options) {
|
|
93
|
+
if (!request.requestId)
|
|
94
|
+
request = { ...request, requestId: newRequestId() };
|
|
95
|
+
const p0 = pathValue("key.name", request.key?.name, "projects/*/regions/*/keys/*");
|
|
96
|
+
return this.service.call({
|
|
97
|
+
method: "PATCH",
|
|
98
|
+
path: `/v1beta1/${p0}`,
|
|
99
|
+
body: request.key,
|
|
100
|
+
query: query(request, ["key.name", "key"]),
|
|
101
|
+
idempotent: true,
|
|
102
|
+
}, options);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Deletes a key: it becomes `DELETED` at once, refuses every operation
|
|
106
|
+
* but GetPublicKey, and its material is destroyed at `purgeTime`, after
|
|
107
|
+
* `destroyDelay`. Until then UndeleteKey restores it, disabled. After it,
|
|
108
|
+
* nothing it encrypted can ever be decrypted again. Deleting a deleted key
|
|
109
|
+
* succeeds and changes nothing. A key the platform manages is refused with
|
|
110
|
+
* `FORBIDDEN`, deleted or not. Needs `kms.key.delete` on the project.
|
|
111
|
+
*/
|
|
112
|
+
async deleteKey(request, options) {
|
|
113
|
+
if (!request.requestId)
|
|
114
|
+
request = { ...request, requestId: newRequestId() };
|
|
115
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*");
|
|
116
|
+
return this.service.call({
|
|
117
|
+
method: "DELETE",
|
|
118
|
+
path: `/v1beta1/${p0}`,
|
|
119
|
+
query: query(request, ["name"]),
|
|
120
|
+
idempotent: true,
|
|
121
|
+
}, options);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Restores a deleted key whose material isn't destroyed yet: it becomes
|
|
125
|
+
* `DISABLED`, to be enabled with UpdateKey. Refused with `CONFLICT` for a
|
|
126
|
+
* key that isn't deleted, or whose `purgeTime` has passed, and with
|
|
127
|
+
* `FORBIDDEN` for a key the platform manages. Needs `kms.key.delete` on
|
|
128
|
+
* the project.
|
|
129
|
+
*/
|
|
130
|
+
async undeleteKey(request, options) {
|
|
131
|
+
if (!request.requestId)
|
|
132
|
+
request = { ...request, requestId: newRequestId() };
|
|
133
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*");
|
|
134
|
+
return this.service.call({
|
|
135
|
+
method: "POST",
|
|
136
|
+
path: `/v1beta1/${p0}:undelete`,
|
|
137
|
+
body: request,
|
|
138
|
+
idempotent: true,
|
|
139
|
+
}, options);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Adds a new version to a key and makes it the primary: new ciphertexts
|
|
143
|
+
* and signatures use it, and every earlier version still decrypts and
|
|
144
|
+
* its public key stays readable. Refused with `CONFLICT` for a key that
|
|
145
|
+
* isn't enabled, and with `FORBIDDEN` for a key the platform manages.
|
|
146
|
+
* Needs `kms.key.rotate` on the project.
|
|
147
|
+
*/
|
|
148
|
+
async rotateKey(request, options) {
|
|
149
|
+
if (!request.requestId)
|
|
150
|
+
request = { ...request, requestId: newRequestId() };
|
|
151
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*");
|
|
152
|
+
return this.service.call({
|
|
153
|
+
method: "POST",
|
|
154
|
+
path: `/v1beta1/${p0}:rotate`,
|
|
155
|
+
body: request,
|
|
156
|
+
idempotent: true,
|
|
157
|
+
}, options);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Encrypts up to 64 KiB with an `ENCRYPT_DECRYPT` key's primary version,
|
|
161
|
+
* bound to the encryption context. For more data, encrypt it yourself
|
|
162
|
+
* with a data key from GenerateDataKey. Refused with `CONFLICT` for a key
|
|
163
|
+
* that isn't enabled, and with `BAD_REQUEST` for a signing key. Needs
|
|
164
|
+
* `kms.key.encrypt` on the project.
|
|
165
|
+
*/
|
|
166
|
+
async encrypt(request, options) {
|
|
167
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*");
|
|
168
|
+
return this.service.call({
|
|
169
|
+
method: "POST",
|
|
170
|
+
path: `/v1beta1/${p0}:encrypt`,
|
|
171
|
+
body: request,
|
|
172
|
+
}, options);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Decrypts a ciphertext Encrypt or GenerateDataKey made with this key,
|
|
176
|
+
* given the same encryption context. Refused with `BAD_REQUEST` for a
|
|
177
|
+
* ciphertext that doesn't decrypt under this key and context, and with
|
|
178
|
+
* `CONFLICT` for a key that isn't enabled. Needs `kms.key.decrypt` on the
|
|
179
|
+
* project.
|
|
180
|
+
*/
|
|
181
|
+
async decrypt(request, options) {
|
|
182
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*");
|
|
183
|
+
return this.service.call({
|
|
184
|
+
method: "POST",
|
|
185
|
+
path: `/v1beta1/${p0}:decrypt`,
|
|
186
|
+
body: request,
|
|
187
|
+
}, options);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Returns a new random 256-bit data key, in plaintext and encrypted under
|
|
191
|
+
* an `ENCRYPT_DECRYPT` key's primary version with the encryption context.
|
|
192
|
+
* Encrypt your data with the plaintext, keep only the ciphertext beside
|
|
193
|
+
* it, and recover the data key with Decrypt when you need it. Needs
|
|
194
|
+
* `kms.key.generate_data_key` on the project.
|
|
195
|
+
*/
|
|
196
|
+
async generateDataKey(request, options) {
|
|
197
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*");
|
|
198
|
+
return this.service.call({
|
|
199
|
+
method: "POST",
|
|
200
|
+
path: `/v1beta1/${p0}:generateDataKey`,
|
|
201
|
+
body: request,
|
|
202
|
+
}, options);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Signs up to 64 KiB with a signing key's primary version, or the
|
|
206
|
+
* version `keyVersion` names. ECDSA hashes
|
|
207
|
+
* the data with SHA-256 itself: send the data, not a digest. Refused with
|
|
208
|
+
* `CONFLICT` for a key that isn't enabled, and with `BAD_REQUEST` for an
|
|
209
|
+
* `ENCRYPT_DECRYPT` key. Needs `kms.key.sign` on the project.
|
|
210
|
+
*/
|
|
211
|
+
async sign(request, options) {
|
|
212
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*");
|
|
213
|
+
return this.service.call({
|
|
214
|
+
method: "POST",
|
|
215
|
+
path: `/v1beta1/${p0}:sign`,
|
|
216
|
+
body: request,
|
|
217
|
+
}, options);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Returns a signing key version's public key, to verify its signatures
|
|
221
|
+
* with. Answered for a disabled or deleted key too, until its material is
|
|
222
|
+
* destroyed. Refused with `BAD_REQUEST` for an `ENCRYPT_DECRYPT` key.
|
|
223
|
+
* Needs `kms.key.get_public_key` on the project.
|
|
224
|
+
*/
|
|
225
|
+
async getPublicKey(request, options) {
|
|
226
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*/versions/*/publicKey");
|
|
227
|
+
return this.service.call({
|
|
228
|
+
method: "GET",
|
|
229
|
+
path: `/v1beta1/${p0}`,
|
|
230
|
+
query: query(request, ["name"]),
|
|
231
|
+
idempotent: true,
|
|
232
|
+
}, options);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/** What a key is for, and the algorithm it uses. */
|
|
236
|
+
export const Key_Purpose = {
|
|
237
|
+
/** Not set. */
|
|
238
|
+
PURPOSE_UNSPECIFIED: "PURPOSE_UNSPECIFIED",
|
|
239
|
+
/** Encrypt, Decrypt and GenerateDataKey, with AES-256-GCM-SIV. */
|
|
240
|
+
ENCRYPT_DECRYPT: "ENCRYPT_DECRYPT",
|
|
241
|
+
/** Sign with ECDSA over P-256 and SHA-256; signatures are ASN.1 DER. */
|
|
242
|
+
SIGN_ECDSA_P256_SHA256: "SIGN_ECDSA_P256_SHA256",
|
|
243
|
+
/** Sign with Ed25519; signatures are 64 bytes. */
|
|
244
|
+
SIGN_ED25519: "SIGN_ED25519",
|
|
245
|
+
};
|
|
246
|
+
/** Whether a key can be used. */
|
|
247
|
+
export const Key_State = {
|
|
248
|
+
/** Not set. */
|
|
249
|
+
STATE_UNSPECIFIED: "STATE_UNSPECIFIED",
|
|
250
|
+
/** Serves every operation of its purpose. */
|
|
251
|
+
ENABLED: "ENABLED",
|
|
252
|
+
/** Refuses every operation but GetPublicKey until enabled again. */
|
|
253
|
+
DISABLED: "DISABLED",
|
|
254
|
+
/**
|
|
255
|
+
* Deleted: refuses every operation but GetPublicKey. Until
|
|
256
|
+
* `purgeTime` UndeleteKey restores it; after it, its material is
|
|
257
|
+
* destroyed.
|
|
258
|
+
*/
|
|
259
|
+
DELETED: "DELETED",
|
|
260
|
+
};
|
|
261
|
+
//# sourceMappingURL=key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key.js","sourceRoot":"","sources":["../../src/v1beta1/key.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,4CAA4C;AAE5C,OAAO,EAIL,YAAY,EACZ,SAAS,EACT,KAAK,GACN,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,SAAS;IACpB;;;O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@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@origincloud/kms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Origin Cloud's KMS service: grants: permission for one platform host to use one key for one operation and one encryption context, for at most an hour at a time.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/origincloudhq/sdk-typescript#readme",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"!dist/**/*.tsbuildinfo"
|
|
35
35
|
],
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@origincloud/core": "^0.
|
|
37
|
+
"@origincloud/core": "^0.28.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@origincloud/core": "^0.
|
|
40
|
+
"@origincloud/core": "^0.28.0"
|
|
41
41
|
}
|
|
42
42
|
}
|