@cipherstash/stack 0.1.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/CHANGELOG.md +7 -0
- package/LICENSE.md +21 -0
- package/README.md +670 -0
- package/dist/bin/stash.js +5049 -0
- package/dist/bin/stash.js.map +1 -0
- package/dist/chunk-2GZMIJFO.js +2400 -0
- package/dist/chunk-2GZMIJFO.js.map +1 -0
- package/dist/chunk-5DCT6YU2.js +138 -0
- package/dist/chunk-5DCT6YU2.js.map +1 -0
- package/dist/chunk-7XRPN2KX.js +336 -0
- package/dist/chunk-7XRPN2KX.js.map +1 -0
- package/dist/chunk-SJ7JO4ME.js +28 -0
- package/dist/chunk-SJ7JO4ME.js.map +1 -0
- package/dist/chunk-SUYMGQBY.js +67 -0
- package/dist/chunk-SUYMGQBY.js.map +1 -0
- package/dist/client-BxJG56Ey.d.cts +647 -0
- package/dist/client-DtGq9dJp.d.ts +647 -0
- package/dist/client.cjs +347 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +7 -0
- package/dist/client.d.ts +7 -0
- package/dist/client.js +11 -0
- package/dist/client.js.map +1 -0
- package/dist/drizzle/index.cjs +1528 -0
- package/dist/drizzle/index.cjs.map +1 -0
- package/dist/drizzle/index.d.cts +350 -0
- package/dist/drizzle/index.d.ts +350 -0
- package/dist/drizzle/index.js +1212 -0
- package/dist/drizzle/index.js.map +1 -0
- package/dist/dynamodb/index.cjs +382 -0
- package/dist/dynamodb/index.cjs.map +1 -0
- package/dist/dynamodb/index.d.cts +125 -0
- package/dist/dynamodb/index.d.ts +125 -0
- package/dist/dynamodb/index.js +355 -0
- package/dist/dynamodb/index.js.map +1 -0
- package/dist/identity/index.cjs +271 -0
- package/dist/identity/index.cjs.map +1 -0
- package/dist/identity/index.d.cts +3 -0
- package/dist/identity/index.d.ts +3 -0
- package/dist/identity/index.js +117 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/index-9-Ya3fDK.d.cts +169 -0
- package/dist/index-9-Ya3fDK.d.ts +169 -0
- package/dist/index.cjs +2915 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/schema/index.cjs +368 -0
- package/dist/schema/index.cjs.map +1 -0
- package/dist/schema/index.d.cts +4 -0
- package/dist/schema/index.d.ts +4 -0
- package/dist/schema/index.js +23 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/secrets/index.cjs +3207 -0
- package/dist/secrets/index.cjs.map +1 -0
- package/dist/secrets/index.d.cts +227 -0
- package/dist/secrets/index.d.ts +227 -0
- package/dist/secrets/index.js +323 -0
- package/dist/secrets/index.js.map +1 -0
- package/dist/supabase/index.cjs +1113 -0
- package/dist/supabase/index.cjs.map +1 -0
- package/dist/supabase/index.d.cts +144 -0
- package/dist/supabase/index.d.ts +144 -0
- package/dist/supabase/index.js +864 -0
- package/dist/supabase/index.js.map +1 -0
- package/dist/types-public-BCj1L4fi.d.cts +1013 -0
- package/dist/types-public-BCj1L4fi.d.ts +1013 -0
- package/dist/types-public.cjs +40 -0
- package/dist/types-public.cjs.map +1 -0
- package/dist/types-public.d.cts +4 -0
- package/dist/types-public.d.ts +4 -0
- package/dist/types-public.js +7 -0
- package/dist/types-public.js.map +1 -0
- package/package.json +202 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { h as Encrypted } from '../types-public-BCj1L4fi.cjs';
|
|
2
|
+
import { Result } from '@byteslice/result';
|
|
3
|
+
import 'zod';
|
|
4
|
+
import 'evlog';
|
|
5
|
+
import '@cipherstash/protect-ffi';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Placeholder: Corrected Secrets client interface
|
|
9
|
+
*
|
|
10
|
+
* This file reflects the actual dashboard API endpoints as implemented in:
|
|
11
|
+
* apps/dashboard/src/app/api/secrets/{get,set,list,get-many,delete}/route.ts
|
|
12
|
+
*
|
|
13
|
+
* Key corrections from the original interface:
|
|
14
|
+
* 1. get, list, get-many are GET endpoints (not POST) with query params
|
|
15
|
+
* 2. get-many takes a comma-separated `names` string (not a JSON array)
|
|
16
|
+
* 3. set and delete return { success, message } (not void)
|
|
17
|
+
* 4. SecretMetadata fields (id, createdAt, updatedAt) are non-optional
|
|
18
|
+
* 5. GetSecretResponse fields (createdAt, updatedAt) are non-optional
|
|
19
|
+
* 6. get-many enforces min 2 names (comma required) and max 100 names
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
type SecretName = string;
|
|
23
|
+
type SecretValue = string;
|
|
24
|
+
/**
|
|
25
|
+
* Discriminated error type for secrets operations.
|
|
26
|
+
*/
|
|
27
|
+
type SecretsErrorType = 'ApiError' | 'NetworkError' | 'ClientError' | 'EncryptionError' | 'DecryptionError';
|
|
28
|
+
/**
|
|
29
|
+
* Error returned by secrets operations.
|
|
30
|
+
*/
|
|
31
|
+
interface SecretsError {
|
|
32
|
+
type: SecretsErrorType;
|
|
33
|
+
message: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Configuration options for initializing the Stash client
|
|
37
|
+
*/
|
|
38
|
+
interface SecretsConfig {
|
|
39
|
+
workspaceCRN: string;
|
|
40
|
+
clientId: string;
|
|
41
|
+
clientKey: string;
|
|
42
|
+
environment: string;
|
|
43
|
+
apiKey: string;
|
|
44
|
+
accessKey?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Secret metadata returned from the API (list endpoint).
|
|
48
|
+
* All fields are always present in API responses.
|
|
49
|
+
*/
|
|
50
|
+
interface SecretMetadata {
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
environment: string;
|
|
54
|
+
createdAt: string;
|
|
55
|
+
updatedAt: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* API response for listing secrets.
|
|
59
|
+
* GET /api/secrets/list?workspaceId=...&environment=...
|
|
60
|
+
*/
|
|
61
|
+
interface ListSecretsResponse {
|
|
62
|
+
environment: string;
|
|
63
|
+
secrets: SecretMetadata[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* API response for getting a single secret.
|
|
67
|
+
* GET /api/secrets/get?workspaceId=...&environment=...&name=...
|
|
68
|
+
*
|
|
69
|
+
* The `encryptedValue` is the raw value stored in the vault's `value` column,
|
|
70
|
+
* which is the `{ data: Encrypted }` object that was passed to the set endpoint.
|
|
71
|
+
*/
|
|
72
|
+
interface GetSecretResponse {
|
|
73
|
+
name: string;
|
|
74
|
+
environment: string;
|
|
75
|
+
encryptedValue: {
|
|
76
|
+
data: Encrypted;
|
|
77
|
+
};
|
|
78
|
+
createdAt: string;
|
|
79
|
+
updatedAt: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* API response for getting multiple secrets.
|
|
83
|
+
* GET /api/secrets/get-many?workspaceId=...&environment=...&names=name1,name2,...
|
|
84
|
+
*
|
|
85
|
+
* Returns an array of GetSecretResponse objects.
|
|
86
|
+
* Constraints:
|
|
87
|
+
* - `names` must be comma-separated (minimum 2 names)
|
|
88
|
+
* - Maximum 100 names per request
|
|
89
|
+
*/
|
|
90
|
+
type GetManySecretsResponse = GetSecretResponse[];
|
|
91
|
+
/**
|
|
92
|
+
* API response for setting a secret.
|
|
93
|
+
* POST /api/secrets/set
|
|
94
|
+
*/
|
|
95
|
+
interface SetSecretResponse {
|
|
96
|
+
success: true;
|
|
97
|
+
message: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* API request body for setting a secret.
|
|
101
|
+
* POST /api/secrets/set
|
|
102
|
+
*/
|
|
103
|
+
interface SetSecretRequest {
|
|
104
|
+
workspaceId: string;
|
|
105
|
+
environment: string;
|
|
106
|
+
name: string;
|
|
107
|
+
encryptedValue: {
|
|
108
|
+
data: Encrypted;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* API response for deleting a secret.
|
|
113
|
+
* POST /api/secrets/delete
|
|
114
|
+
*/
|
|
115
|
+
interface DeleteSecretResponse {
|
|
116
|
+
success: true;
|
|
117
|
+
message: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* API request body for deleting a secret.
|
|
121
|
+
* POST /api/secrets/delete
|
|
122
|
+
*/
|
|
123
|
+
interface DeleteSecretRequest {
|
|
124
|
+
workspaceId: string;
|
|
125
|
+
environment: string;
|
|
126
|
+
name: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* API error response for plan limit violations (403).
|
|
130
|
+
* Returned by POST /api/secrets/set when the workspace has reached its secret limit.
|
|
131
|
+
*/
|
|
132
|
+
interface PlanLimitError {
|
|
133
|
+
error: string;
|
|
134
|
+
code: 'PLAN_LIMIT_REACHED';
|
|
135
|
+
}
|
|
136
|
+
interface DecryptedSecretResponse {
|
|
137
|
+
name: string;
|
|
138
|
+
environment: string;
|
|
139
|
+
value: string;
|
|
140
|
+
createdAt: string;
|
|
141
|
+
updatedAt: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* The Secrets client provides a high-level API for managing encrypted secrets
|
|
145
|
+
* stored in CipherStash. Secrets are encrypted locally before being sent to
|
|
146
|
+
* the API, ensuring end-to-end encryption.
|
|
147
|
+
*/
|
|
148
|
+
declare class Secrets {
|
|
149
|
+
private encryptionClient;
|
|
150
|
+
private config;
|
|
151
|
+
private readonly apiBaseUrl;
|
|
152
|
+
private readonly secretsSchema;
|
|
153
|
+
constructor(config: SecretsConfig);
|
|
154
|
+
private initPromise;
|
|
155
|
+
/**
|
|
156
|
+
* Initialize the Secrets client and underlying Encryption client
|
|
157
|
+
*/
|
|
158
|
+
private ensureInitialized;
|
|
159
|
+
private _doInit;
|
|
160
|
+
/**
|
|
161
|
+
* Get the authorization header for API requests
|
|
162
|
+
*/
|
|
163
|
+
private getAuthHeader;
|
|
164
|
+
/**
|
|
165
|
+
* Make an API request with error handling.
|
|
166
|
+
*
|
|
167
|
+
* For GET requests, `params` are appended as URL query parameters.
|
|
168
|
+
* For POST requests, `body` is sent as JSON in the request body.
|
|
169
|
+
*/
|
|
170
|
+
private apiRequest;
|
|
171
|
+
/**
|
|
172
|
+
* Store an encrypted secret in the vault.
|
|
173
|
+
* The value is encrypted locally before being sent to the API.
|
|
174
|
+
*
|
|
175
|
+
* API: POST /api/secrets/set
|
|
176
|
+
*
|
|
177
|
+
* @param name - The name of the secret
|
|
178
|
+
* @param value - The plaintext value to encrypt and store
|
|
179
|
+
* @returns A Result containing the API response or an error
|
|
180
|
+
*/
|
|
181
|
+
set(name: SecretName, value: SecretValue): Promise<Result<SetSecretResponse, SecretsError>>;
|
|
182
|
+
/**
|
|
183
|
+
* Retrieve and decrypt a secret from the vault.
|
|
184
|
+
* The secret is decrypted locally after retrieval.
|
|
185
|
+
*
|
|
186
|
+
* API: GET /api/secrets/get?workspaceId=...&environment=...&name=...
|
|
187
|
+
*
|
|
188
|
+
* @param name - The name of the secret to retrieve
|
|
189
|
+
* @returns A Result containing the decrypted value or an error
|
|
190
|
+
*/
|
|
191
|
+
get(name: SecretName): Promise<Result<SecretValue, SecretsError>>;
|
|
192
|
+
/**
|
|
193
|
+
* Retrieve and decrypt many secrets from the vault.
|
|
194
|
+
* The secrets are decrypted locally after retrieval.
|
|
195
|
+
* This method only triggers a single network request to the ZeroKMS.
|
|
196
|
+
*
|
|
197
|
+
* API: GET /api/secrets/get-many?workspaceId=...&environment=...&names=name1,name2,...
|
|
198
|
+
*
|
|
199
|
+
* Constraints:
|
|
200
|
+
* - Minimum 2 secret names required
|
|
201
|
+
* - Maximum 100 secret names per request
|
|
202
|
+
*
|
|
203
|
+
* @param names - The names of the secrets to retrieve (min 2, max 100)
|
|
204
|
+
* @returns A Result containing an object mapping secret names to their decrypted values
|
|
205
|
+
*/
|
|
206
|
+
getMany(names: SecretName[]): Promise<Result<Record<SecretName, SecretValue>, SecretsError>>;
|
|
207
|
+
/**
|
|
208
|
+
* List all secrets in the environment.
|
|
209
|
+
* Only names and metadata are returned; values remain encrypted.
|
|
210
|
+
*
|
|
211
|
+
* API: GET /api/secrets/list?workspaceId=...&environment=...
|
|
212
|
+
*
|
|
213
|
+
* @returns A Result containing the list of secrets or an error
|
|
214
|
+
*/
|
|
215
|
+
list(): Promise<Result<SecretMetadata[], SecretsError>>;
|
|
216
|
+
/**
|
|
217
|
+
* Delete a secret from the vault.
|
|
218
|
+
*
|
|
219
|
+
* API: POST /api/secrets/delete
|
|
220
|
+
*
|
|
221
|
+
* @param name - The name of the secret to delete
|
|
222
|
+
* @returns A Result containing the API response or an error
|
|
223
|
+
*/
|
|
224
|
+
delete(name: SecretName): Promise<Result<DeleteSecretResponse, SecretsError>>;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export { type DecryptedSecretResponse, type DeleteSecretRequest, type DeleteSecretResponse, type GetManySecretsResponse, type GetSecretResponse, type ListSecretsResponse, type PlanLimitError, type SecretMetadata, type SecretName, type SecretValue, Secrets, type SecretsConfig, type SecretsError, type SecretsErrorType, type SetSecretRequest, type SetSecretResponse };
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { h as Encrypted } from '../types-public-BCj1L4fi.js';
|
|
2
|
+
import { Result } from '@byteslice/result';
|
|
3
|
+
import 'zod';
|
|
4
|
+
import 'evlog';
|
|
5
|
+
import '@cipherstash/protect-ffi';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Placeholder: Corrected Secrets client interface
|
|
9
|
+
*
|
|
10
|
+
* This file reflects the actual dashboard API endpoints as implemented in:
|
|
11
|
+
* apps/dashboard/src/app/api/secrets/{get,set,list,get-many,delete}/route.ts
|
|
12
|
+
*
|
|
13
|
+
* Key corrections from the original interface:
|
|
14
|
+
* 1. get, list, get-many are GET endpoints (not POST) with query params
|
|
15
|
+
* 2. get-many takes a comma-separated `names` string (not a JSON array)
|
|
16
|
+
* 3. set and delete return { success, message } (not void)
|
|
17
|
+
* 4. SecretMetadata fields (id, createdAt, updatedAt) are non-optional
|
|
18
|
+
* 5. GetSecretResponse fields (createdAt, updatedAt) are non-optional
|
|
19
|
+
* 6. get-many enforces min 2 names (comma required) and max 100 names
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
type SecretName = string;
|
|
23
|
+
type SecretValue = string;
|
|
24
|
+
/**
|
|
25
|
+
* Discriminated error type for secrets operations.
|
|
26
|
+
*/
|
|
27
|
+
type SecretsErrorType = 'ApiError' | 'NetworkError' | 'ClientError' | 'EncryptionError' | 'DecryptionError';
|
|
28
|
+
/**
|
|
29
|
+
* Error returned by secrets operations.
|
|
30
|
+
*/
|
|
31
|
+
interface SecretsError {
|
|
32
|
+
type: SecretsErrorType;
|
|
33
|
+
message: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Configuration options for initializing the Stash client
|
|
37
|
+
*/
|
|
38
|
+
interface SecretsConfig {
|
|
39
|
+
workspaceCRN: string;
|
|
40
|
+
clientId: string;
|
|
41
|
+
clientKey: string;
|
|
42
|
+
environment: string;
|
|
43
|
+
apiKey: string;
|
|
44
|
+
accessKey?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Secret metadata returned from the API (list endpoint).
|
|
48
|
+
* All fields are always present in API responses.
|
|
49
|
+
*/
|
|
50
|
+
interface SecretMetadata {
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
environment: string;
|
|
54
|
+
createdAt: string;
|
|
55
|
+
updatedAt: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* API response for listing secrets.
|
|
59
|
+
* GET /api/secrets/list?workspaceId=...&environment=...
|
|
60
|
+
*/
|
|
61
|
+
interface ListSecretsResponse {
|
|
62
|
+
environment: string;
|
|
63
|
+
secrets: SecretMetadata[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* API response for getting a single secret.
|
|
67
|
+
* GET /api/secrets/get?workspaceId=...&environment=...&name=...
|
|
68
|
+
*
|
|
69
|
+
* The `encryptedValue` is the raw value stored in the vault's `value` column,
|
|
70
|
+
* which is the `{ data: Encrypted }` object that was passed to the set endpoint.
|
|
71
|
+
*/
|
|
72
|
+
interface GetSecretResponse {
|
|
73
|
+
name: string;
|
|
74
|
+
environment: string;
|
|
75
|
+
encryptedValue: {
|
|
76
|
+
data: Encrypted;
|
|
77
|
+
};
|
|
78
|
+
createdAt: string;
|
|
79
|
+
updatedAt: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* API response for getting multiple secrets.
|
|
83
|
+
* GET /api/secrets/get-many?workspaceId=...&environment=...&names=name1,name2,...
|
|
84
|
+
*
|
|
85
|
+
* Returns an array of GetSecretResponse objects.
|
|
86
|
+
* Constraints:
|
|
87
|
+
* - `names` must be comma-separated (minimum 2 names)
|
|
88
|
+
* - Maximum 100 names per request
|
|
89
|
+
*/
|
|
90
|
+
type GetManySecretsResponse = GetSecretResponse[];
|
|
91
|
+
/**
|
|
92
|
+
* API response for setting a secret.
|
|
93
|
+
* POST /api/secrets/set
|
|
94
|
+
*/
|
|
95
|
+
interface SetSecretResponse {
|
|
96
|
+
success: true;
|
|
97
|
+
message: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* API request body for setting a secret.
|
|
101
|
+
* POST /api/secrets/set
|
|
102
|
+
*/
|
|
103
|
+
interface SetSecretRequest {
|
|
104
|
+
workspaceId: string;
|
|
105
|
+
environment: string;
|
|
106
|
+
name: string;
|
|
107
|
+
encryptedValue: {
|
|
108
|
+
data: Encrypted;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* API response for deleting a secret.
|
|
113
|
+
* POST /api/secrets/delete
|
|
114
|
+
*/
|
|
115
|
+
interface DeleteSecretResponse {
|
|
116
|
+
success: true;
|
|
117
|
+
message: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* API request body for deleting a secret.
|
|
121
|
+
* POST /api/secrets/delete
|
|
122
|
+
*/
|
|
123
|
+
interface DeleteSecretRequest {
|
|
124
|
+
workspaceId: string;
|
|
125
|
+
environment: string;
|
|
126
|
+
name: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* API error response for plan limit violations (403).
|
|
130
|
+
* Returned by POST /api/secrets/set when the workspace has reached its secret limit.
|
|
131
|
+
*/
|
|
132
|
+
interface PlanLimitError {
|
|
133
|
+
error: string;
|
|
134
|
+
code: 'PLAN_LIMIT_REACHED';
|
|
135
|
+
}
|
|
136
|
+
interface DecryptedSecretResponse {
|
|
137
|
+
name: string;
|
|
138
|
+
environment: string;
|
|
139
|
+
value: string;
|
|
140
|
+
createdAt: string;
|
|
141
|
+
updatedAt: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* The Secrets client provides a high-level API for managing encrypted secrets
|
|
145
|
+
* stored in CipherStash. Secrets are encrypted locally before being sent to
|
|
146
|
+
* the API, ensuring end-to-end encryption.
|
|
147
|
+
*/
|
|
148
|
+
declare class Secrets {
|
|
149
|
+
private encryptionClient;
|
|
150
|
+
private config;
|
|
151
|
+
private readonly apiBaseUrl;
|
|
152
|
+
private readonly secretsSchema;
|
|
153
|
+
constructor(config: SecretsConfig);
|
|
154
|
+
private initPromise;
|
|
155
|
+
/**
|
|
156
|
+
* Initialize the Secrets client and underlying Encryption client
|
|
157
|
+
*/
|
|
158
|
+
private ensureInitialized;
|
|
159
|
+
private _doInit;
|
|
160
|
+
/**
|
|
161
|
+
* Get the authorization header for API requests
|
|
162
|
+
*/
|
|
163
|
+
private getAuthHeader;
|
|
164
|
+
/**
|
|
165
|
+
* Make an API request with error handling.
|
|
166
|
+
*
|
|
167
|
+
* For GET requests, `params` are appended as URL query parameters.
|
|
168
|
+
* For POST requests, `body` is sent as JSON in the request body.
|
|
169
|
+
*/
|
|
170
|
+
private apiRequest;
|
|
171
|
+
/**
|
|
172
|
+
* Store an encrypted secret in the vault.
|
|
173
|
+
* The value is encrypted locally before being sent to the API.
|
|
174
|
+
*
|
|
175
|
+
* API: POST /api/secrets/set
|
|
176
|
+
*
|
|
177
|
+
* @param name - The name of the secret
|
|
178
|
+
* @param value - The plaintext value to encrypt and store
|
|
179
|
+
* @returns A Result containing the API response or an error
|
|
180
|
+
*/
|
|
181
|
+
set(name: SecretName, value: SecretValue): Promise<Result<SetSecretResponse, SecretsError>>;
|
|
182
|
+
/**
|
|
183
|
+
* Retrieve and decrypt a secret from the vault.
|
|
184
|
+
* The secret is decrypted locally after retrieval.
|
|
185
|
+
*
|
|
186
|
+
* API: GET /api/secrets/get?workspaceId=...&environment=...&name=...
|
|
187
|
+
*
|
|
188
|
+
* @param name - The name of the secret to retrieve
|
|
189
|
+
* @returns A Result containing the decrypted value or an error
|
|
190
|
+
*/
|
|
191
|
+
get(name: SecretName): Promise<Result<SecretValue, SecretsError>>;
|
|
192
|
+
/**
|
|
193
|
+
* Retrieve and decrypt many secrets from the vault.
|
|
194
|
+
* The secrets are decrypted locally after retrieval.
|
|
195
|
+
* This method only triggers a single network request to the ZeroKMS.
|
|
196
|
+
*
|
|
197
|
+
* API: GET /api/secrets/get-many?workspaceId=...&environment=...&names=name1,name2,...
|
|
198
|
+
*
|
|
199
|
+
* Constraints:
|
|
200
|
+
* - Minimum 2 secret names required
|
|
201
|
+
* - Maximum 100 secret names per request
|
|
202
|
+
*
|
|
203
|
+
* @param names - The names of the secrets to retrieve (min 2, max 100)
|
|
204
|
+
* @returns A Result containing an object mapping secret names to their decrypted values
|
|
205
|
+
*/
|
|
206
|
+
getMany(names: SecretName[]): Promise<Result<Record<SecretName, SecretValue>, SecretsError>>;
|
|
207
|
+
/**
|
|
208
|
+
* List all secrets in the environment.
|
|
209
|
+
* Only names and metadata are returned; values remain encrypted.
|
|
210
|
+
*
|
|
211
|
+
* API: GET /api/secrets/list?workspaceId=...&environment=...
|
|
212
|
+
*
|
|
213
|
+
* @returns A Result containing the list of secrets or an error
|
|
214
|
+
*/
|
|
215
|
+
list(): Promise<Result<SecretMetadata[], SecretsError>>;
|
|
216
|
+
/**
|
|
217
|
+
* Delete a secret from the vault.
|
|
218
|
+
*
|
|
219
|
+
* API: POST /api/secrets/delete
|
|
220
|
+
*
|
|
221
|
+
* @param name - The name of the secret to delete
|
|
222
|
+
* @returns A Result containing the API response or an error
|
|
223
|
+
*/
|
|
224
|
+
delete(name: SecretName): Promise<Result<DeleteSecretResponse, SecretsError>>;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export { type DecryptedSecretResponse, type DeleteSecretRequest, type DeleteSecretResponse, type GetManySecretsResponse, type GetSecretResponse, type ListSecretsResponse, type PlanLimitError, type SecretMetadata, type SecretName, type SecretValue, Secrets, type SecretsConfig, type SecretsError, type SecretsErrorType, type SetSecretRequest, type SetSecretResponse };
|