@scaleway/sdk-key-manager 2.8.0 → 2.8.2

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.
@@ -1,158 +0,0 @@
1
- import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
2
- //#region src/v1alpha1/marshalling.gen.ts
3
- const unmarshalKeyRotationPolicy = (data) => {
4
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'KeyRotationPolicy' failed as data isn't a dictionary.`);
5
- return {
6
- nextRotationAt: unmarshalDate(data.next_rotation_at),
7
- rotationPeriod: data.rotation_period
8
- };
9
- };
10
- const unmarshalKeyUsage = (data) => {
11
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'KeyUsage' failed as data isn't a dictionary.`);
12
- return {
13
- asymmetricEncryption: data.asymmetric_encryption ? data.asymmetric_encryption : void 0,
14
- asymmetricSigning: data.asymmetric_signing ? data.asymmetric_signing : void 0,
15
- symmetricEncryption: data.symmetric_encryption ? data.symmetric_encryption : void 0
16
- };
17
- };
18
- const unmarshalKey = (data) => {
19
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Key' failed as data isn't a dictionary.`);
20
- return {
21
- createdAt: unmarshalDate(data.created_at),
22
- deletionRequestedAt: unmarshalDate(data.deletion_requested_at),
23
- description: data.description,
24
- id: data.id,
25
- locked: data.locked,
26
- name: data.name,
27
- origin: data.origin,
28
- projectId: data.project_id,
29
- protected: data.protected,
30
- region: data.region,
31
- rotatedAt: unmarshalDate(data.rotated_at),
32
- rotationCount: data.rotation_count,
33
- rotationPolicy: data.rotation_policy ? unmarshalKeyRotationPolicy(data.rotation_policy) : void 0,
34
- state: data.state,
35
- tags: data.tags,
36
- updatedAt: unmarshalDate(data.updated_at),
37
- usage: data.usage ? unmarshalKeyUsage(data.usage) : void 0
38
- };
39
- };
40
- const unmarshalDataKey = (data) => {
41
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DataKey' failed as data isn't a dictionary.`);
42
- return {
43
- algorithm: data.algorithm,
44
- ciphertext: data.ciphertext,
45
- createdAt: unmarshalDate(data.created_at),
46
- keyId: data.key_id,
47
- plaintext: data.plaintext
48
- };
49
- };
50
- const unmarshalDecryptResponse = (data) => {
51
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DecryptResponse' failed as data isn't a dictionary.`);
52
- return {
53
- ciphertext: data.ciphertext,
54
- keyId: data.key_id,
55
- plaintext: data.plaintext
56
- };
57
- };
58
- const unmarshalEncryptResponse = (data) => {
59
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EncryptResponse' failed as data isn't a dictionary.`);
60
- return {
61
- ciphertext: data.ciphertext,
62
- keyId: data.key_id
63
- };
64
- };
65
- const unmarshalListAlgorithmsResponseAlgorithm = (data) => {
66
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListAlgorithmsResponseAlgorithm' failed as data isn't a dictionary.`);
67
- return {
68
- name: data.name,
69
- recommended: data.recommended,
70
- usage: data.usage
71
- };
72
- };
73
- const unmarshalListAlgorithmsResponse = (data) => {
74
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListAlgorithmsResponse' failed as data isn't a dictionary.`);
75
- return { algorithms: unmarshalArrayOfObject(data.algorithms, unmarshalListAlgorithmsResponseAlgorithm) };
76
- };
77
- const unmarshalListKeysResponse = (data) => {
78
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListKeysResponse' failed as data isn't a dictionary.`);
79
- return {
80
- keys: unmarshalArrayOfObject(data.keys, unmarshalKey),
81
- totalCount: data.total_count
82
- };
83
- };
84
- const unmarshalPublicKey = (data) => {
85
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'PublicKey' failed as data isn't a dictionary.`);
86
- return { pem: data.pem };
87
- };
88
- const unmarshalSignResponse = (data) => {
89
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SignResponse' failed as data isn't a dictionary.`);
90
- return {
91
- keyId: data.key_id,
92
- signature: data.signature
93
- };
94
- };
95
- const unmarshalVerifyResponse = (data) => {
96
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'VerifyResponse' failed as data isn't a dictionary.`);
97
- return {
98
- keyId: data.key_id,
99
- valid: data.valid
100
- };
101
- };
102
- const marshalKeyRotationPolicy = (request, defaults) => ({
103
- next_rotation_at: request.nextRotationAt,
104
- rotation_period: request.rotationPeriod
105
- });
106
- const marshalKeyUsage = (request, defaults) => ({ ...resolveOneOf([
107
- {
108
- param: "symmetric_encryption",
109
- value: request.symmetricEncryption
110
- },
111
- {
112
- param: "asymmetric_encryption",
113
- value: request.asymmetricEncryption
114
- },
115
- {
116
- param: "asymmetric_signing",
117
- value: request.asymmetricSigning
118
- }
119
- ]) });
120
- const marshalCreateKeyRequest = (request, defaults) => ({
121
- description: request.description,
122
- name: request.name,
123
- origin: request.origin,
124
- project_id: request.projectId ?? defaults.defaultProjectId,
125
- rotation_policy: request.rotationPolicy !== void 0 ? marshalKeyRotationPolicy(request.rotationPolicy, defaults) : void 0,
126
- tags: request.tags,
127
- unprotected: request.unprotected,
128
- usage: request.usage !== void 0 ? marshalKeyUsage(request.usage, defaults) : void 0
129
- });
130
- const marshalDecryptRequest = (request, defaults) => ({
131
- associated_data: request.associatedData,
132
- ciphertext: request.ciphertext
133
- });
134
- const marshalEncryptRequest = (request, defaults) => ({
135
- associated_data: request.associatedData,
136
- plaintext: request.plaintext
137
- });
138
- const marshalGenerateDataKeyRequest = (request, defaults) => ({
139
- algorithm: request.algorithm,
140
- without_plaintext: request.withoutPlaintext
141
- });
142
- const marshalImportKeyMaterialRequest = (request, defaults) => ({
143
- key_material: request.keyMaterial,
144
- salt: request.salt
145
- });
146
- const marshalSignRequest = (request, defaults) => ({ digest: request.digest });
147
- const marshalUpdateKeyRequest = (request, defaults) => ({
148
- description: request.description,
149
- name: request.name,
150
- rotation_policy: request.rotationPolicy !== void 0 ? marshalKeyRotationPolicy(request.rotationPolicy, defaults) : void 0,
151
- tags: request.tags
152
- });
153
- const marshalVerifyRequest = (request, defaults) => ({
154
- digest: request.digest,
155
- signature: request.signature
156
- });
157
- //#endregion
158
- export { marshalCreateKeyRequest, marshalDecryptRequest, marshalEncryptRequest, marshalGenerateDataKeyRequest, marshalImportKeyMaterialRequest, marshalSignRequest, marshalUpdateKeyRequest, marshalVerifyRequest, unmarshalDataKey, unmarshalDecryptResponse, unmarshalEncryptResponse, unmarshalKey, unmarshalListAlgorithmsResponse, unmarshalListKeysResponse, unmarshalPublicKey, unmarshalSignResponse, unmarshalVerifyResponse };
@@ -1,48 +0,0 @@
1
- export declare const queriesMetadata: {
2
- readonly namespace: 'key_manager';
3
- readonly version: 'v1alpha1';
4
- readonly folderName: 'keyManagerv1alpha1';
5
- readonly services: readonly [{
6
- readonly apiClass: 'API';
7
- readonly methods: readonly [{
8
- readonly methodName: 'getKey';
9
- readonly protoName: 'GetKey';
10
- readonly paramsType: 'GetKeyRequest';
11
- readonly returnType: 'Key';
12
- readonly isList: false;
13
- readonly paginationType: 'none';
14
- readonly isPrivate: false;
15
- readonly description: '"';
16
- }, {
17
- readonly methodName: 'getPublicKey';
18
- readonly protoName: 'GetPublicKey';
19
- readonly paramsType: 'GetPublicKeyRequest';
20
- readonly returnType: 'PublicKey';
21
- readonly isList: false;
22
- readonly paginationType: 'none';
23
- readonly isPrivate: false;
24
- readonly description: '"';
25
- }, {
26
- readonly methodName: 'listKeys';
27
- readonly protoName: 'ListKeys';
28
- readonly paramsType: 'ListKeysRequest';
29
- readonly returnType: 'ListKeysResponse';
30
- readonly isList: true;
31
- readonly paginationType: 'offset';
32
- readonly pageParamKey: 'page';
33
- readonly listItemType: 'Key';
34
- readonly isPrivate: false;
35
- readonly description: '"';
36
- }, {
37
- readonly methodName: 'listAlgorithms';
38
- readonly protoName: 'ListAlgorithms';
39
- readonly paramsType: 'ListAlgorithmsRequest';
40
- readonly returnType: 'ListAlgorithmsResponse';
41
- readonly isList: false;
42
- readonly paginationType: 'none';
43
- readonly isPrivate: false;
44
- readonly description: '"';
45
- }];
46
- }];
47
- };
48
- export type QueriesMetadata = typeof queriesMetadata;
@@ -1,55 +0,0 @@
1
- //#region src/v1alpha1/metadata.gen.ts
2
- const queriesMetadata = {
3
- namespace: "key_manager",
4
- version: "v1alpha1",
5
- folderName: "keyManagerv1alpha1",
6
- services: [{
7
- apiClass: "API",
8
- methods: [
9
- {
10
- methodName: "getKey",
11
- protoName: "GetKey",
12
- paramsType: "GetKeyRequest",
13
- returnType: "Key",
14
- isList: false,
15
- paginationType: "none",
16
- isPrivate: false,
17
- description: "\""
18
- },
19
- {
20
- methodName: "getPublicKey",
21
- protoName: "GetPublicKey",
22
- paramsType: "GetPublicKeyRequest",
23
- returnType: "PublicKey",
24
- isList: false,
25
- paginationType: "none",
26
- isPrivate: false,
27
- description: "\""
28
- },
29
- {
30
- methodName: "listKeys",
31
- protoName: "ListKeys",
32
- paramsType: "ListKeysRequest",
33
- returnType: "ListKeysResponse",
34
- isList: true,
35
- paginationType: "offset",
36
- pageParamKey: "page",
37
- listItemType: "Key",
38
- isPrivate: false,
39
- description: "\""
40
- },
41
- {
42
- methodName: "listAlgorithms",
43
- protoName: "ListAlgorithms",
44
- paramsType: "ListAlgorithmsRequest",
45
- returnType: "ListAlgorithmsResponse",
46
- isList: false,
47
- paginationType: "none",
48
- isPrivate: false,
49
- description: "\""
50
- }
51
- ]
52
- }]
53
- };
54
- //#endregion
55
- export { queriesMetadata };