@bitwarden/sdk-internal 0.2.0-main.71 → 0.2.0-main.710
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/VERSION +1 -1
- package/bitwarden_wasm_internal.d.ts +4380 -253
- package/bitwarden_wasm_internal.js +6 -1
- package/bitwarden_wasm_internal_bg.js +6164 -1120
- package/bitwarden_wasm_internal_bg.wasm +0 -0
- package/bitwarden_wasm_internal_bg.wasm.d.ts +631 -29
- package/bitwarden_wasm_internal_bg.wasm.js +1 -1
- package/node/bitwarden_wasm_internal.d.ts +4380 -253
- package/node/bitwarden_wasm_internal.js +6404 -1256
- package/node/bitwarden_wasm_internal_bg.wasm +0 -0
- package/node/bitwarden_wasm_internal_bg.wasm.d.ts +631 -29
- package/package.json +12 -2
|
@@ -1,32 +1,3775 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
import { Tagged } from "type-fest";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A string that **MUST** be a valid UUID.
|
|
8
|
+
*
|
|
9
|
+
* Never create or cast to this type directly, use the `uuid<T>()` function instead.
|
|
10
|
+
*/
|
|
11
|
+
export type Uuid = unknown;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* RFC3339 compliant date-time string.
|
|
15
|
+
* @typeParam T - Not used in JavaScript.
|
|
16
|
+
*/
|
|
17
|
+
export type DateTime<T = unknown> = string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* UTC date-time string. Not used in JavaScript.
|
|
21
|
+
*/
|
|
22
|
+
export type Utc = unknown;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* An integer that is known not to equal zero.
|
|
26
|
+
*/
|
|
27
|
+
export type NonZeroU32 = number;
|
|
28
|
+
|
|
29
|
+
export interface AccountCryptographyInitializationError extends Error {
|
|
30
|
+
name: "AccountCryptographyInitializationError";
|
|
31
|
+
variant:
|
|
32
|
+
| "WrongUserKeyType"
|
|
33
|
+
| "WrongUserKey"
|
|
34
|
+
| "CorruptData"
|
|
35
|
+
| "TamperedData"
|
|
36
|
+
| "KeyStoreAlreadyInitialized"
|
|
37
|
+
| "GenericCrypto";
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function isAccountCryptographyInitializationError(
|
|
41
|
+
error: any,
|
|
42
|
+
): error is AccountCryptographyInitializationError;
|
|
43
|
+
|
|
44
|
+
export interface AcquireCookieError extends Error {
|
|
45
|
+
name: "AcquireCookieError";
|
|
46
|
+
variant:
|
|
47
|
+
| "Cancelled"
|
|
48
|
+
| "UnsupportedConfiguration"
|
|
49
|
+
| "CookieNameMismatch"
|
|
50
|
+
| "RepositoryGetError"
|
|
51
|
+
| "RepositorySaveError";
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function isAcquireCookieError(error: any): error is AcquireCookieError;
|
|
55
|
+
|
|
56
|
+
export interface AlreadyRunningError extends Error {
|
|
57
|
+
name: "AlreadyRunningError";
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function isAlreadyRunningError(error: any): error is AlreadyRunningError;
|
|
61
|
+
|
|
62
|
+
export interface CallError extends Error {
|
|
63
|
+
name: "CallError";
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function isCallError(error: any): error is CallError;
|
|
67
|
+
|
|
68
|
+
export interface ChannelError extends Error {
|
|
69
|
+
name: "ChannelError";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function isChannelError(error: any): error is ChannelError;
|
|
73
|
+
|
|
74
|
+
export interface CipherDeleteAttachmentError extends Error {
|
|
75
|
+
name: "CipherDeleteAttachmentError";
|
|
76
|
+
variant: "Api" | "Repository" | "MissingField" | "VaultParse";
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function isCipherDeleteAttachmentError(error: any): error is CipherDeleteAttachmentError;
|
|
80
|
+
|
|
81
|
+
export interface CipherError extends Error {
|
|
82
|
+
name: "CipherError";
|
|
83
|
+
variant:
|
|
84
|
+
| "MissingField"
|
|
85
|
+
| "Crypto"
|
|
86
|
+
| "Decrypt"
|
|
87
|
+
| "Encrypt"
|
|
88
|
+
| "AttachmentsWithoutKeys"
|
|
89
|
+
| "OrganizationAlreadySet"
|
|
90
|
+
| "Repository"
|
|
91
|
+
| "Chrono"
|
|
92
|
+
| "SerdeJson"
|
|
93
|
+
| "Api";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function isCipherError(error: any): error is CipherError;
|
|
97
|
+
|
|
98
|
+
export interface CipherRiskError extends Error {
|
|
99
|
+
name: "CipherRiskError";
|
|
100
|
+
variant: "Reqwest";
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function isCipherRiskError(error: any): error is CipherRiskError;
|
|
104
|
+
|
|
105
|
+
export interface CollectionDecryptError extends Error {
|
|
106
|
+
name: "CollectionDecryptError";
|
|
107
|
+
variant: "Crypto";
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function isCollectionDecryptError(error: any): error is CollectionDecryptError;
|
|
111
|
+
|
|
112
|
+
export interface CreateCipherAdminError extends Error {
|
|
113
|
+
name: "CreateCipherAdminError";
|
|
114
|
+
variant: "Crypto" | "Api" | "VaultParse" | "MissingField" | "NotAuthenticated";
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function isCreateCipherAdminError(error: any): error is CreateCipherAdminError;
|
|
118
|
+
|
|
119
|
+
export interface CreateCipherError extends Error {
|
|
120
|
+
name: "CreateCipherError";
|
|
121
|
+
variant: "Crypto" | "Api" | "VaultParse" | "MissingField" | "NotAuthenticated" | "Repository";
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function isCreateCipherError(error: any): error is CreateCipherError;
|
|
125
|
+
|
|
126
|
+
export interface CreateFolderError extends Error {
|
|
127
|
+
name: "CreateFolderError";
|
|
128
|
+
variant: "Crypto" | "Api" | "VaultParse" | "MissingField" | "Repository";
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function isCreateFolderError(error: any): error is CreateFolderError;
|
|
132
|
+
|
|
133
|
+
export interface CreateSendError extends Error {
|
|
134
|
+
name: "CreateSendError";
|
|
135
|
+
variant: "Api" | "Crypto" | "EmptyEmailList" | "MissingField" | "Repository" | "SendParse";
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function isCreateSendError(error: any): error is CreateSendError;
|
|
139
|
+
|
|
140
|
+
export interface CryptoClientError extends Error {
|
|
141
|
+
name: "CryptoClientError";
|
|
142
|
+
variant:
|
|
143
|
+
| "NotAuthenticated"
|
|
144
|
+
| "Crypto"
|
|
145
|
+
| "InvalidKdfSettings"
|
|
146
|
+
| "PasswordProtectedKeyEnvelope"
|
|
147
|
+
| "InvalidPrfInput"
|
|
148
|
+
| "InvalidUpgradeToken"
|
|
149
|
+
| "UpgradeTokenRequired"
|
|
150
|
+
| "InvalidKeyType";
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function isCryptoClientError(error: any): error is CryptoClientError;
|
|
154
|
+
|
|
155
|
+
export interface CryptoError extends Error {
|
|
156
|
+
name: "CryptoError";
|
|
157
|
+
variant:
|
|
158
|
+
| "Decrypt"
|
|
159
|
+
| "InvalidKey"
|
|
160
|
+
| "KeyDecrypt"
|
|
161
|
+
| "InvalidKeyLen"
|
|
162
|
+
| "InvalidUtf8String"
|
|
163
|
+
| "MissingKey"
|
|
164
|
+
| "MissingField"
|
|
165
|
+
| "MissingKeyId"
|
|
166
|
+
| "KeyOperationNotSupported"
|
|
167
|
+
| "ReadOnlyKeyStore"
|
|
168
|
+
| "InvalidKeyStoreOperation"
|
|
169
|
+
| "InsufficientKdfParameters"
|
|
170
|
+
| "EncString"
|
|
171
|
+
| "Rsa"
|
|
172
|
+
| "Fingerprint"
|
|
173
|
+
| "Argon"
|
|
174
|
+
| "ZeroNumber"
|
|
175
|
+
| "OperationNotSupported"
|
|
176
|
+
| "WrongKeyType"
|
|
177
|
+
| "WrongCoseKeyId"
|
|
178
|
+
| "InvalidNonceLength"
|
|
179
|
+
| "InvalidPadding"
|
|
180
|
+
| "Signature"
|
|
181
|
+
| "Encoding";
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export function isCryptoError(error: any): error is CryptoError;
|
|
185
|
+
|
|
186
|
+
export interface DatabaseError extends Error {
|
|
187
|
+
name: "DatabaseError";
|
|
188
|
+
variant: "UnsupportedConfiguration" | "ThreadBoundRunner" | "Serialization" | "JS" | "Internal";
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export function isDatabaseError(error: any): error is DatabaseError;
|
|
192
|
+
|
|
193
|
+
export interface DecryptError extends Error {
|
|
194
|
+
name: "DecryptError";
|
|
195
|
+
variant: "Crypto";
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export function isDecryptError(error: any): error is DecryptError;
|
|
199
|
+
|
|
200
|
+
export interface DecryptFileError extends Error {
|
|
201
|
+
name: "DecryptFileError";
|
|
202
|
+
variant: "Decrypt" | "Io";
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export function isDecryptFileError(error: any): error is DecryptFileError;
|
|
206
|
+
|
|
207
|
+
export interface DeleteAttachmentAdminError extends Error {
|
|
208
|
+
name: "DeleteAttachmentAdminError";
|
|
209
|
+
variant: "Api";
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export function isDeleteAttachmentAdminError(error: any): error is DeleteAttachmentAdminError;
|
|
213
|
+
|
|
214
|
+
export interface DeleteCipherAdminError extends Error {
|
|
215
|
+
name: "DeleteCipherAdminError";
|
|
216
|
+
variant: "Api";
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export function isDeleteCipherAdminError(error: any): error is DeleteCipherAdminError;
|
|
220
|
+
|
|
221
|
+
export interface DeleteCipherError extends Error {
|
|
222
|
+
name: "DeleteCipherError";
|
|
223
|
+
variant: "Api" | "Repository";
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export function isDeleteCipherError(error: any): error is DeleteCipherError;
|
|
227
|
+
|
|
228
|
+
export interface DeriveKeyConnectorError extends Error {
|
|
229
|
+
name: "DeriveKeyConnectorError";
|
|
230
|
+
variant: "WrongPassword" | "Crypto";
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export function isDeriveKeyConnectorError(error: any): error is DeriveKeyConnectorError;
|
|
234
|
+
|
|
235
|
+
export interface DeserializeError extends Error {
|
|
236
|
+
name: "DeserializeError";
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export function isDeserializeError(error: any): error is DeserializeError;
|
|
240
|
+
|
|
241
|
+
export interface EditCipherAdminError extends Error {
|
|
242
|
+
name: "EditCipherAdminError";
|
|
243
|
+
variant:
|
|
244
|
+
| "ItemNotFound"
|
|
245
|
+
| "Crypto"
|
|
246
|
+
| "Api"
|
|
247
|
+
| "VaultParse"
|
|
248
|
+
| "MissingField"
|
|
249
|
+
| "NotAuthenticated"
|
|
250
|
+
| "Repository"
|
|
251
|
+
| "Uuid"
|
|
252
|
+
| "Decrypt";
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export function isEditCipherAdminError(error: any): error is EditCipherAdminError;
|
|
256
|
+
|
|
257
|
+
export interface EditCipherError extends Error {
|
|
258
|
+
name: "EditCipherError";
|
|
259
|
+
variant:
|
|
260
|
+
| "ItemNotFound"
|
|
261
|
+
| "Crypto"
|
|
262
|
+
| "Api"
|
|
263
|
+
| "VaultParse"
|
|
264
|
+
| "MissingField"
|
|
265
|
+
| "NotAuthenticated"
|
|
266
|
+
| "Repository"
|
|
267
|
+
| "Uuid";
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export function isEditCipherError(error: any): error is EditCipherError;
|
|
271
|
+
|
|
272
|
+
export interface EditFolderError extends Error {
|
|
273
|
+
name: "EditFolderError";
|
|
274
|
+
variant:
|
|
275
|
+
| "ItemNotFound"
|
|
276
|
+
| "Crypto"
|
|
277
|
+
| "Api"
|
|
278
|
+
| "VaultParse"
|
|
279
|
+
| "MissingField"
|
|
280
|
+
| "Repository"
|
|
281
|
+
| "Uuid";
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export function isEditFolderError(error: any): error is EditFolderError;
|
|
285
|
+
|
|
286
|
+
export interface EditSendError extends Error {
|
|
287
|
+
name: "EditSendError";
|
|
288
|
+
variant:
|
|
289
|
+
| "ItemNotFound"
|
|
290
|
+
| "Crypto"
|
|
291
|
+
| "Api"
|
|
292
|
+
| "EmptyEmailList"
|
|
293
|
+
| "MissingField"
|
|
294
|
+
| "Repository"
|
|
295
|
+
| "Uuid"
|
|
296
|
+
| "SendParse"
|
|
297
|
+
| "IdMismatch";
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export function isEditSendError(error: any): error is EditSendError;
|
|
301
|
+
|
|
302
|
+
export interface EncryptError extends Error {
|
|
303
|
+
name: "EncryptError";
|
|
304
|
+
variant: "Crypto" | "MissingUserId";
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export function isEncryptError(error: any): error is EncryptError;
|
|
308
|
+
|
|
309
|
+
export interface EncryptFileError extends Error {
|
|
310
|
+
name: "EncryptFileError";
|
|
311
|
+
variant: "Encrypt" | "Io";
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export function isEncryptFileError(error: any): error is EncryptFileError;
|
|
315
|
+
|
|
316
|
+
export interface EncryptionSettingsError extends Error {
|
|
317
|
+
name: "EncryptionSettingsError";
|
|
318
|
+
variant:
|
|
319
|
+
| "Crypto"
|
|
320
|
+
| "CryptoInitialization"
|
|
321
|
+
| "MissingPrivateKey"
|
|
322
|
+
| "UserIdAlreadySet"
|
|
323
|
+
| "WrongPin"
|
|
324
|
+
| "UserKeyStateUpdateFailed"
|
|
325
|
+
| "UserKeyStateRetrievalFailed"
|
|
326
|
+
| "InvalidUpgradeToken"
|
|
327
|
+
| "KeyConnectorRetrievalFailed"
|
|
328
|
+
| "LocalUserDataKeyInitFailed"
|
|
329
|
+
| "LocalUserDataKeyLoadFailed";
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export function isEncryptionSettingsError(error: any): error is EncryptionSettingsError;
|
|
333
|
+
|
|
334
|
+
export interface EnrollAdminPasswordResetError extends Error {
|
|
335
|
+
name: "EnrollAdminPasswordResetError";
|
|
336
|
+
variant: "Crypto";
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export function isEnrollAdminPasswordResetError(error: any): error is EnrollAdminPasswordResetError;
|
|
340
|
+
|
|
341
|
+
export interface ExportError extends Error {
|
|
342
|
+
name: "ExportError";
|
|
343
|
+
variant:
|
|
344
|
+
| "MissingField"
|
|
345
|
+
| "NotAuthenticated"
|
|
346
|
+
| "Csv"
|
|
347
|
+
| "Cxf"
|
|
348
|
+
| "Json"
|
|
349
|
+
| "EncryptedJson"
|
|
350
|
+
| "BitwardenCrypto"
|
|
351
|
+
| "Cipher";
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export function isExportError(error: any): error is ExportError;
|
|
355
|
+
|
|
356
|
+
export interface GetCipherError extends Error {
|
|
357
|
+
name: "GetCipherError";
|
|
358
|
+
variant: "ItemNotFound" | "Crypto" | "Repository";
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export function isGetCipherError(error: any): error is GetCipherError;
|
|
362
|
+
|
|
363
|
+
export interface GetFolderError extends Error {
|
|
364
|
+
name: "GetFolderError";
|
|
365
|
+
variant: "ItemNotFound" | "Crypto" | "Repository";
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export function isGetFolderError(error: any): error is GetFolderError;
|
|
369
|
+
|
|
370
|
+
export interface GetOrganizationCiphersAdminError extends Error {
|
|
371
|
+
name: "GetOrganizationCiphersAdminError";
|
|
372
|
+
variant: "Crypto" | "VaultParse" | "Api";
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export function isGetOrganizationCiphersAdminError(
|
|
376
|
+
error: any,
|
|
377
|
+
): error is GetOrganizationCiphersAdminError;
|
|
378
|
+
|
|
379
|
+
export interface GetSendError extends Error {
|
|
380
|
+
name: "GetSendError";
|
|
381
|
+
variant: "ItemNotFound" | "Crypto" | "MissingField" | "Repository";
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export function isGetSendError(error: any): error is GetSendError;
|
|
385
|
+
|
|
386
|
+
export interface KeyGenerationError extends Error {
|
|
387
|
+
name: "KeyGenerationError";
|
|
388
|
+
variant: "KeyGeneration" | "KeyConversion";
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export function isKeyGenerationError(error: any): error is KeyGenerationError;
|
|
392
|
+
|
|
393
|
+
export interface MakeKeysError extends Error {
|
|
394
|
+
name: "MakeKeysError";
|
|
395
|
+
variant:
|
|
396
|
+
| "AccountCryptographyInitialization"
|
|
397
|
+
| "MasterPasswordDerivation"
|
|
398
|
+
| "RequestModelCreation"
|
|
399
|
+
| "Crypto";
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export function isMakeKeysError(error: any): error is MakeKeysError;
|
|
403
|
+
|
|
404
|
+
export interface MasterPasswordError extends Error {
|
|
405
|
+
name: "MasterPasswordError";
|
|
406
|
+
variant:
|
|
407
|
+
| "EncryptionKeyMalformed"
|
|
408
|
+
| "KdfMalformed"
|
|
409
|
+
| "InvalidKdfConfiguration"
|
|
410
|
+
| "MissingField"
|
|
411
|
+
| "Crypto"
|
|
412
|
+
| "WrongPassword";
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export function isMasterPasswordError(error: any): error is MasterPasswordError;
|
|
416
|
+
|
|
417
|
+
export interface MigrateToKeyConnectorError extends Error {
|
|
418
|
+
name: "MigrateToKeyConnectorError";
|
|
419
|
+
variant: "UserKeyNotAvailable" | "CryptoError" | "ApiError" | "KeyConnectorApiError";
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export function isMigrateToKeyConnectorError(error: any): error is MigrateToKeyConnectorError;
|
|
423
|
+
|
|
424
|
+
export interface PasswordError extends Error {
|
|
425
|
+
name: "PasswordError";
|
|
426
|
+
variant: "NoCharacterSetEnabled" | "InvalidLength";
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
export function isPasswordError(error: any): error is PasswordError;
|
|
430
|
+
|
|
431
|
+
export interface PasswordLoginError extends Error {
|
|
432
|
+
name: "PasswordLoginError";
|
|
433
|
+
variant: "InvalidUsernameOrPassword" | "PasswordAuthenticationDataDerivation" | "Unknown";
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export function isPasswordLoginError(error: any): error is PasswordLoginError;
|
|
437
|
+
|
|
438
|
+
export interface PasswordPreloginError extends Error {
|
|
439
|
+
name: "PasswordPreloginError";
|
|
440
|
+
variant: "Api" | "Unknown";
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
export function isPasswordPreloginError(error: any): error is PasswordPreloginError;
|
|
444
|
+
|
|
445
|
+
export interface ReceiveError extends Error {
|
|
446
|
+
name: "ReceiveError";
|
|
447
|
+
variant: "Channel" | "Timeout" | "Cancelled";
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
export function isReceiveError(error: any): error is ReceiveError;
|
|
451
|
+
|
|
452
|
+
export interface RegistrationError extends Error {
|
|
453
|
+
name: "RegistrationError";
|
|
454
|
+
variant: "KeyConnectorApi" | "Api" | "Crypto";
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
export function isRegistrationError(error: any): error is RegistrationError;
|
|
458
|
+
|
|
459
|
+
export interface RequestError extends Error {
|
|
460
|
+
name: "RequestError";
|
|
461
|
+
variant: "Subscribe" | "Receive" | "Timeout" | "Send" | "Rpc";
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export function isRequestError(error: any): error is RequestError;
|
|
465
|
+
|
|
466
|
+
export interface RestoreCipherAdminError extends Error {
|
|
467
|
+
name: "RestoreCipherAdminError";
|
|
468
|
+
variant: "Api" | "VaultParse" | "Crypto";
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export function isRestoreCipherAdminError(error: any): error is RestoreCipherAdminError;
|
|
472
|
+
|
|
473
|
+
export interface RestoreCipherError extends Error {
|
|
474
|
+
name: "RestoreCipherError";
|
|
475
|
+
variant: "Api" | "VaultParse" | "Repository" | "Crypto";
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
export function isRestoreCipherError(error: any): error is RestoreCipherError;
|
|
479
|
+
|
|
480
|
+
export interface RotateCryptographyStateError extends Error {
|
|
481
|
+
name: "RotateCryptographyStateError";
|
|
482
|
+
variant: "KeyMissing" | "InvalidData";
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
export function isRotateCryptographyStateError(error: any): error is RotateCryptographyStateError;
|
|
486
|
+
|
|
487
|
+
export interface RotateUserKeysError extends Error {
|
|
488
|
+
name: "RotateUserKeysError";
|
|
489
|
+
variant:
|
|
490
|
+
| "ApiError"
|
|
491
|
+
| "CryptoError"
|
|
492
|
+
| "InvalidPublicKey"
|
|
493
|
+
| "UntrustedKeyError"
|
|
494
|
+
| "UnimplementedKeyRotationMethod";
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
export function isRotateUserKeysError(error: any): error is RotateUserKeysError;
|
|
498
|
+
|
|
499
|
+
export interface ServerCommunicationConfigRepositoryError extends Error {
|
|
500
|
+
name: "ServerCommunicationConfigRepositoryError";
|
|
501
|
+
variant: "GetError" | "SaveError";
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export function isServerCommunicationConfigRepositoryError(
|
|
505
|
+
error: any,
|
|
506
|
+
): error is ServerCommunicationConfigRepositoryError;
|
|
507
|
+
|
|
508
|
+
export interface SshKeyExportError extends Error {
|
|
509
|
+
name: "SshKeyExportError";
|
|
510
|
+
variant: "KeyConversion";
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
export function isSshKeyExportError(error: any): error is SshKeyExportError;
|
|
514
|
+
|
|
515
|
+
export interface SshKeyImportError extends Error {
|
|
516
|
+
name: "SshKeyImportError";
|
|
517
|
+
variant: "Parsing" | "PasswordRequired" | "WrongPassword" | "UnsupportedKeyType";
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
export function isSshKeyImportError(error: any): error is SshKeyImportError;
|
|
521
|
+
|
|
522
|
+
export interface StateRegistryError extends Error {
|
|
523
|
+
name: "StateRegistryError";
|
|
524
|
+
variant: "DatabaseAlreadyInitialized" | "DatabaseNotInitialized" | "Database";
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
export function isStateRegistryError(error: any): error is StateRegistryError;
|
|
528
|
+
|
|
529
|
+
export interface StatefulCryptoError extends Error {
|
|
530
|
+
name: "StatefulCryptoError";
|
|
531
|
+
variant: "MissingSecurityState" | "WrongAccountCryptoVersion" | "Crypto";
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
export function isStatefulCryptoError(error: any): error is StatefulCryptoError;
|
|
535
|
+
|
|
536
|
+
export interface SubscribeError extends Error {
|
|
537
|
+
name: "SubscribeError";
|
|
538
|
+
variant: "NotStarted";
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
export function isSubscribeError(error: any): error is SubscribeError;
|
|
542
|
+
|
|
543
|
+
export interface SyncError extends Error {
|
|
544
|
+
name: "SyncError";
|
|
545
|
+
variant: "NetworkError" | "DataError";
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export function isSyncError(error: any): error is SyncError;
|
|
549
|
+
|
|
550
|
+
export interface TestError extends Error {
|
|
551
|
+
name: "TestError";
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
export function isTestError(error: any): error is TestError;
|
|
555
|
+
|
|
556
|
+
export interface TotpError extends Error {
|
|
557
|
+
name: "TotpError";
|
|
558
|
+
variant: "InvalidOtpauth" | "MissingSecret" | "Crypto";
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
export function isTotpError(error: any): error is TotpError;
|
|
562
|
+
|
|
563
|
+
export interface TypedReceiveError extends Error {
|
|
564
|
+
name: "TypedReceiveError";
|
|
565
|
+
variant: "Channel" | "Timeout" | "Cancelled" | "Typing";
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
export function isTypedReceiveError(error: any): error is TypedReceiveError;
|
|
569
|
+
|
|
570
|
+
export interface UsernameError extends Error {
|
|
571
|
+
name: "UsernameError";
|
|
572
|
+
variant: "InvalidApiKey" | "Unknown" | "ResponseContent" | "Reqwest";
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
export function isUsernameError(error: any): error is UsernameError;
|
|
576
|
+
|
|
577
|
+
export type UnsignedSharedKey = Tagged<string, "UnsignedSharedKey">;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* @deprecated Use PasswordManagerClient instead
|
|
581
|
+
*/
|
|
582
|
+
export type BitwardenClient = PasswordManagerClient;
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Platform API interface for acquiring SSO cookies.
|
|
586
|
+
*
|
|
587
|
+
* Platform clients implement this interface to handle cookie acquisition
|
|
588
|
+
* through browser redirects or other platform-specific mechanisms.
|
|
589
|
+
*/
|
|
590
|
+
export interface ServerCommunicationConfigPlatformApi {
|
|
591
|
+
/**
|
|
592
|
+
* Acquires cookies using the provided vault URL.
|
|
593
|
+
*
|
|
594
|
+
* This typically involves redirecting to an IdP login page and extracting
|
|
595
|
+
* cookies from the load balancer response. For sharded cookies, returns
|
|
596
|
+
* multiple entries with names like "CookieName-0", "CookieName-1", etc.
|
|
597
|
+
*
|
|
598
|
+
* @param vaultUrl The full vault URL (e.g., "https://vault.bitwarden.com" or "https://localhost:8000")
|
|
599
|
+
* @returns An array of AcquiredCookie objects, or undefined if acquisition failed or was cancelled
|
|
600
|
+
*/
|
|
601
|
+
acquireCookies(vaultUrl: string): Promise<AcquiredCookie[] | undefined>;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Repository interface for storing server communication configuration.
|
|
606
|
+
*
|
|
607
|
+
* Implementations use StateProvider (or equivalent storage mechanism) to
|
|
608
|
+
* persist configuration across sessions. The domain is typically the vault
|
|
609
|
+
* server's domain name (e.g., "vault.acme.com").
|
|
610
|
+
*/
|
|
611
|
+
export interface ServerCommunicationConfigRepository {
|
|
612
|
+
/**
|
|
613
|
+
* Retrieves the server communication configuration for a given domain.
|
|
614
|
+
*
|
|
615
|
+
* @param domain The server domain (e.g., "vault.acme.com")
|
|
616
|
+
* @returns The configuration if it exists, undefined otherwise
|
|
617
|
+
*/
|
|
618
|
+
get(domain: string): Promise<ServerCommunicationConfig | undefined>;
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Saves the server communication configuration for a given domain.
|
|
622
|
+
*
|
|
623
|
+
* @param domain The server domain (e.g., "vault.acme.com")
|
|
624
|
+
* @param config The configuration to store
|
|
625
|
+
*/
|
|
626
|
+
save(domain: string, config: ServerCommunicationConfig): Promise<void>;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
export interface IpcCommunicationBackendSender {
|
|
630
|
+
send(message: OutgoingMessage): Promise<void>;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
export interface IpcSessionRepository {
|
|
634
|
+
get(endpoint: Endpoint): Promise<any | undefined>;
|
|
635
|
+
save(endpoint: Endpoint, session: any): Promise<void>;
|
|
636
|
+
remove(endpoint: Endpoint): Promise<void>;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
export interface Repository<T> {
|
|
640
|
+
get(id: string): Promise<T | null>;
|
|
641
|
+
list(): Promise<T[]>;
|
|
642
|
+
set(id: string, value: T): Promise<void>;
|
|
643
|
+
setBulk(values: [string, T][]): Promise<void>;
|
|
644
|
+
remove(id: string): Promise<void>;
|
|
645
|
+
removeBulk(keys: string[]): Promise<void>;
|
|
646
|
+
removeAll(): Promise<void>;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
export interface TokenProvider {
|
|
650
|
+
get_access_token(): Promise<string | undefined>;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
export type DataEnvelope = Tagged<string, "DataEnvelope">;
|
|
654
|
+
|
|
655
|
+
export type EncString = Tagged<string, "EncString">;
|
|
656
|
+
|
|
657
|
+
export type PasswordProtectedKeyEnvelope = Tagged<string, "PasswordProtectedKeyEnvelope">;
|
|
658
|
+
|
|
659
|
+
export type PublicKey = Tagged<string, "PublicKey">;
|
|
660
|
+
|
|
661
|
+
export type SignedPublicKey = Tagged<string, "SignedPublicKey">;
|
|
662
|
+
|
|
663
|
+
export type SignedSecurityState = string;
|
|
664
|
+
|
|
665
|
+
export type SymmetricKeyEnvelope = Tagged<string, "SymmetricKeyEnvelope">;
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* A cookie acquired from the platform
|
|
669
|
+
*
|
|
670
|
+
* Represents a single cookie name/value pair as received from the browser or HTTP client.
|
|
671
|
+
* For sharded cookies (AWS ALB pattern), each shard is a separate `AcquiredCookie` with
|
|
672
|
+
* its own name including the `-{N}` suffix (e.g., `AWSELBAuthSessionCookie-0`).
|
|
673
|
+
*/
|
|
674
|
+
export interface AcquiredCookie {
|
|
675
|
+
/**
|
|
676
|
+
* Cookie name
|
|
677
|
+
*
|
|
678
|
+
* For sharded cookies, this includes the shard suffix (e.g., `AWSELBAuthSessionCookie-0`)
|
|
679
|
+
* For unsharded cookies, this is the cookie name without any suffix.
|
|
680
|
+
*/
|
|
681
|
+
name: string;
|
|
682
|
+
/**
|
|
683
|
+
* Cookie value
|
|
684
|
+
*/
|
|
685
|
+
value: string;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* A persisted organization encryption key.
|
|
690
|
+
*
|
|
691
|
+
* Stored in a Repository keyed by [`OrganizationId`].
|
|
692
|
+
* The `org_id` is included in the struct so it can be recovered from `Repository::list()`.
|
|
693
|
+
*/
|
|
694
|
+
export interface OrganizationSharedKey {
|
|
695
|
+
/**
|
|
696
|
+
* The organization this key belongs to.
|
|
697
|
+
*/
|
|
698
|
+
org_id: OrganizationId;
|
|
699
|
+
/**
|
|
700
|
+
* The organization\'s shared encryption key.
|
|
701
|
+
*/
|
|
702
|
+
key: UnsignedSharedKey;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* A request structure for requesting a send access token from the API.
|
|
707
|
+
*/
|
|
708
|
+
export interface SendAccessTokenRequest {
|
|
709
|
+
/**
|
|
710
|
+
* The id of the send for which the access token is requested.
|
|
711
|
+
*/
|
|
712
|
+
sendId: string;
|
|
713
|
+
/**
|
|
714
|
+
* The optional send access credentials.
|
|
715
|
+
*/
|
|
716
|
+
sendAccessCredentials?: SendAccessCredentials;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* A send access token which can be used to access a send.
|
|
721
|
+
*/
|
|
722
|
+
export interface SendAccessTokenResponse {
|
|
723
|
+
/**
|
|
724
|
+
* The actual token string.
|
|
725
|
+
*/
|
|
726
|
+
token: string;
|
|
727
|
+
/**
|
|
728
|
+
* The timestamp in milliseconds when the token expires.
|
|
729
|
+
*/
|
|
730
|
+
expiresAt: number;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* A set of keys where a given `DownstreamKey` is protected by an encrypted public/private
|
|
735
|
+
* key-pair. The `DownstreamKey` is used to encrypt/decrypt data, while the public/private key-pair
|
|
736
|
+
* is used to rotate the `DownstreamKey`.
|
|
737
|
+
*
|
|
738
|
+
* The `PrivateKey` is protected by an `UpstreamKey`, such as a `DeviceKey`, or `PrfKey`,
|
|
739
|
+
* and the `PublicKey` is protected by the `DownstreamKey`. This setup allows:
|
|
740
|
+
*
|
|
741
|
+
* - Access to `DownstreamKey` by knowing the `UpstreamKey`
|
|
742
|
+
* - Rotation to a `NewDownstreamKey` by knowing the current `DownstreamKey`, without needing
|
|
743
|
+
* access to the `UpstreamKey`
|
|
744
|
+
*/
|
|
745
|
+
export interface RotateableKeySet {
|
|
746
|
+
/**
|
|
747
|
+
* `DownstreamKey` protected by encapsulation key
|
|
748
|
+
*/
|
|
749
|
+
encapsulatedDownstreamKey: UnsignedSharedKey;
|
|
750
|
+
/**
|
|
751
|
+
* Encapsulation key protected by `DownstreamKey`
|
|
752
|
+
*/
|
|
753
|
+
encryptedEncapsulationKey: EncString;
|
|
754
|
+
/**
|
|
755
|
+
* Decapsulation key protected by `UpstreamKey`
|
|
756
|
+
*/
|
|
757
|
+
encryptedDecapsulationKey: EncString;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* A single log event captured by the Flight Recorder.
|
|
762
|
+
*/
|
|
763
|
+
export interface FlightRecorderEvent {
|
|
764
|
+
/**
|
|
765
|
+
* Unix timestamp in milliseconds.
|
|
766
|
+
*/
|
|
767
|
+
timestamp: number;
|
|
768
|
+
/**
|
|
769
|
+
* Log level (e.g. \"DEBUG\", \"INFO\", \"WARN\", \"ERROR\").
|
|
770
|
+
*/
|
|
771
|
+
level: string;
|
|
772
|
+
/**
|
|
773
|
+
* Target module path (e.g. \"bitwarden_core::client\").
|
|
774
|
+
*/
|
|
775
|
+
target: string;
|
|
776
|
+
/**
|
|
777
|
+
* Primary log message.
|
|
778
|
+
*/
|
|
779
|
+
message: string;
|
|
780
|
+
/**
|
|
781
|
+
* Structured fields from the tracing event.
|
|
782
|
+
*/
|
|
783
|
+
fields: Record<string, string>;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* Active feature flags for the SDK.
|
|
788
|
+
*/
|
|
789
|
+
export interface FeatureFlags extends Map<string, boolean> {}
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* Any keys / cryptographic protection \"downstream\" from the account symmetric key (user key).
|
|
793
|
+
* Private keys are protected by the user key.
|
|
794
|
+
*/
|
|
795
|
+
export type WrappedAccountCryptographicState =
|
|
796
|
+
| { V1: { private_key: EncString } }
|
|
797
|
+
| {
|
|
798
|
+
V2: {
|
|
799
|
+
private_key: EncString;
|
|
800
|
+
signed_public_key: SignedPublicKey | undefined;
|
|
801
|
+
signing_key: EncString;
|
|
802
|
+
security_state: SignedSecurityState;
|
|
803
|
+
};
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Any unexpected error that occurs when making requests to identity. This could be
|
|
808
|
+
* local/transport/decoding failure from the HTTP client (DNS/TLS/connect/read timeout,
|
|
809
|
+
* connection reset, or JSON decode failure on a success response) or non-2xx response with an
|
|
810
|
+
* unexpected body or status. Used when decoding the server\'s error payload into
|
|
811
|
+
* `SendAccessTokenApiErrorResponse` fails, or for 5xx responses where no structured error is
|
|
812
|
+
* available.
|
|
813
|
+
*/
|
|
814
|
+
export type UnexpectedIdentityError = string;
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* Auth requests supports multiple initialization methods.
|
|
818
|
+
*/
|
|
819
|
+
export type AuthRequestMethod =
|
|
820
|
+
| { userKey: { protected_user_key: UnsignedSharedKey } }
|
|
821
|
+
| { masterKey: { protected_master_key: UnsignedSharedKey; auth_request_key: EncString } };
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Available fields on a cipher and can be copied from a the list view in the UI.
|
|
825
|
+
*/
|
|
826
|
+
export type CopyableCipherFields =
|
|
827
|
+
| "LoginUsername"
|
|
828
|
+
| "LoginPassword"
|
|
829
|
+
| "LoginTotp"
|
|
830
|
+
| "CardNumber"
|
|
831
|
+
| "CardSecurityCode"
|
|
832
|
+
| "IdentityUsername"
|
|
833
|
+
| "IdentityEmail"
|
|
834
|
+
| "IdentityPhone"
|
|
835
|
+
| "IdentityAddress"
|
|
836
|
+
| "SshKey"
|
|
837
|
+
| "SecureNotes"
|
|
838
|
+
| "BankAccountAccountNumber"
|
|
839
|
+
| "BankAccountRoutingNumber"
|
|
840
|
+
| "BankAccountPin"
|
|
841
|
+
| "BankAccountIban";
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* Base64 encoded data
|
|
845
|
+
*
|
|
846
|
+
* Is indifferent about padding when decoding, but always produces padding when encoding.
|
|
847
|
+
*/
|
|
848
|
+
export type B64 = string;
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* Basic client behavior settings. These settings specify the various targets and behavior of the
|
|
852
|
+
* Bitwarden Client. They are optional and uneditable once the client is initialized.
|
|
853
|
+
*
|
|
854
|
+
* Defaults to
|
|
855
|
+
*
|
|
856
|
+
* ```
|
|
857
|
+
* # use bitwarden_core::{ClientSettings, DeviceType};
|
|
858
|
+
* let settings = ClientSettings {
|
|
859
|
+
* identity_url: \"https://identity.bitwarden.com\".to_string(),
|
|
860
|
+
* api_url: \"https://api.bitwarden.com\".to_string(),
|
|
861
|
+
* user_agent: \"Bitwarden Rust-SDK\".to_string(),
|
|
862
|
+
* device_type: DeviceType::SDK,
|
|
863
|
+
* bitwarden_client_version: None,
|
|
864
|
+
* bitwarden_package_type: None,
|
|
865
|
+
* device_identifier: None,
|
|
866
|
+
* };
|
|
867
|
+
* let default = ClientSettings::default();
|
|
868
|
+
* ```
|
|
869
|
+
*/
|
|
870
|
+
export interface ClientSettings {
|
|
871
|
+
/**
|
|
872
|
+
* The identity url of the targeted Bitwarden instance. Defaults to `https://identity.bitwarden.com`
|
|
873
|
+
*/
|
|
874
|
+
identityUrl?: string;
|
|
875
|
+
/**
|
|
876
|
+
* The api url of the targeted Bitwarden instance. Defaults to `https://api.bitwarden.com`
|
|
877
|
+
*/
|
|
878
|
+
apiUrl?: string;
|
|
879
|
+
/**
|
|
880
|
+
* The user_agent to sent to Bitwarden. Defaults to `Bitwarden Rust-SDK`
|
|
881
|
+
*/
|
|
882
|
+
userAgent?: string;
|
|
883
|
+
/**
|
|
884
|
+
* Device type to send to Bitwarden. Defaults to SDK
|
|
885
|
+
*/
|
|
886
|
+
deviceType?: DeviceType;
|
|
887
|
+
/**
|
|
888
|
+
* Device identifier to send to Bitwarden. Optional for now in transition period.
|
|
889
|
+
*/
|
|
890
|
+
deviceIdentifier?: string | undefined;
|
|
891
|
+
/**
|
|
892
|
+
* Bitwarden Client Version to send to Bitwarden. Optional for now in transition period.
|
|
893
|
+
*/
|
|
894
|
+
bitwardenClientVersion?: string | undefined;
|
|
895
|
+
/**
|
|
896
|
+
* Bitwarden Package Type to send to Bitwarden. We should evaluate this field to see if it
|
|
897
|
+
* should be optional later.
|
|
898
|
+
*/
|
|
899
|
+
bitwardenPackageType?: string | undefined;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* Bootstrap configuration for server communication
|
|
904
|
+
*/
|
|
905
|
+
export type BootstrapConfig =
|
|
906
|
+
| { type: "direct" }
|
|
907
|
+
| ({ type: "ssoCookieVendor" } & SsoCookieVendorConfig);
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Bootstrap configuration variant for [`SetCommunicationTypeRequest`]
|
|
911
|
+
*/
|
|
912
|
+
export type BootstrapConfigRequest =
|
|
913
|
+
| { type: "direct" }
|
|
914
|
+
| ({ type: "ssoCookieVendor" } & SsoCookieVendorConfigRequest);
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* Common login response model used across different login methods.
|
|
918
|
+
*/
|
|
919
|
+
export type LoginResponse = { Authenticated: LoginSuccessResponse };
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* Configures the email forwarding service to use.
|
|
923
|
+
* For instructions on how to configure each service, see the documentation:
|
|
924
|
+
* <https://bitwarden.com/help/generator/#username-types>
|
|
925
|
+
*/
|
|
926
|
+
export type ForwarderServiceType =
|
|
927
|
+
| { addyIo: { api_token: string; domain: string; base_url: string } }
|
|
928
|
+
| { duckDuckGo: { token: string } }
|
|
929
|
+
| { firefox: { api_token: string } }
|
|
930
|
+
| { fastmail: { api_token: string } }
|
|
931
|
+
| { forwardEmail: { api_token: string; domain: string } }
|
|
932
|
+
| { simpleLogin: { api_key: string; base_url: string } };
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* Credentials for getting a send access token using an email and OTP.
|
|
936
|
+
*/
|
|
937
|
+
export interface SendEmailOtpCredentials {
|
|
938
|
+
/**
|
|
939
|
+
* The email address to which the OTP will be sent.
|
|
940
|
+
*/
|
|
941
|
+
email: string;
|
|
942
|
+
/**
|
|
943
|
+
* The one-time password (OTP) that the user has received via email.
|
|
944
|
+
*/
|
|
945
|
+
otp: string;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* Credentials for sending an OTP to the user\'s email address.
|
|
950
|
+
* This is used when the send requires email verification with an OTP.
|
|
951
|
+
*/
|
|
952
|
+
export interface SendEmailCredentials {
|
|
953
|
+
/**
|
|
954
|
+
* The email address to which the OTP will be sent.
|
|
955
|
+
*/
|
|
956
|
+
email: string;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* Credentials for sending password secured access requests.
|
|
961
|
+
* Clone auto implements the standard lib\'s Clone trait, allowing us to create copies of this
|
|
962
|
+
* struct.
|
|
963
|
+
*/
|
|
964
|
+
export interface SendPasswordCredentials {
|
|
965
|
+
/**
|
|
966
|
+
* A Base64-encoded hash of the password protecting the send.
|
|
967
|
+
*/
|
|
968
|
+
passwordHashB64: string;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* Describes the source of an incoming IPC message with per-variant metadata.
|
|
973
|
+
*
|
|
974
|
+
* `Source` mirrors [`Endpoint`] but carries additional context about the sender
|
|
975
|
+
* that the application layer needs for security decisions (e.g., checking `origin`
|
|
976
|
+
* for web sources). Use [`From<Source> for Endpoint`] to convert a source into an
|
|
977
|
+
* addressable endpoint (dropping the metadata).
|
|
978
|
+
*/
|
|
979
|
+
export type Source =
|
|
980
|
+
| { Web: { tab_id: number; document_id: string; origin: string } }
|
|
981
|
+
| { BrowserForeground: { id: number } }
|
|
982
|
+
| { BrowserBackground: { id: HostId } }
|
|
983
|
+
| "DesktopRenderer"
|
|
984
|
+
| "DesktopMain";
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* Device information for login requests.
|
|
988
|
+
* This is common across all login mechanisms and describes the device
|
|
989
|
+
* making the authentication request.
|
|
990
|
+
*/
|
|
991
|
+
export interface LoginDeviceRequest {
|
|
992
|
+
/**
|
|
993
|
+
* The type of device making the login request
|
|
994
|
+
* Note: today, we already have the DeviceType on the ApiConfigurations
|
|
995
|
+
* but we do not have the other device fields so we will accept the device data at login time
|
|
996
|
+
* for now. In the future, we might refactor the unauthN client to instantiate with full
|
|
997
|
+
* device info which would deprecate this struct. However, using the device_type here
|
|
998
|
+
* allows us to avoid any timing issues in scenarios where the device type could change
|
|
999
|
+
* between client instantiation and login (unlikely but possible).
|
|
1000
|
+
*/
|
|
1001
|
+
deviceType: DeviceType;
|
|
1002
|
+
/**
|
|
1003
|
+
* Unique identifier for the device
|
|
1004
|
+
*/
|
|
1005
|
+
deviceIdentifier: string;
|
|
1006
|
+
/**
|
|
1007
|
+
* Human-readable name of the device
|
|
1008
|
+
*/
|
|
1009
|
+
deviceName: string;
|
|
1010
|
+
/**
|
|
1011
|
+
* Push notification token for the device (only for mobile devices)
|
|
1012
|
+
*/
|
|
1013
|
+
devicePushToken: string | undefined;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
/**
|
|
1017
|
+
* File-based send content
|
|
1018
|
+
*/
|
|
1019
|
+
export interface SendFile {
|
|
1020
|
+
/**
|
|
1021
|
+
* The file\'s ID
|
|
1022
|
+
*/
|
|
1023
|
+
id: string | undefined;
|
|
1024
|
+
/**
|
|
1025
|
+
* The encrypted file name
|
|
1026
|
+
*/
|
|
1027
|
+
fileName: EncString;
|
|
1028
|
+
/**
|
|
1029
|
+
* The file size in bytes as a string
|
|
1030
|
+
*/
|
|
1031
|
+
size: string | undefined;
|
|
1032
|
+
/**
|
|
1033
|
+
* Readable size, ex: \"4.2 KB\" or \"1.43 GB\
|
|
1034
|
+
*/
|
|
1035
|
+
sizeName: string | undefined;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* Holds both V1 and V2 user keys, each wrapped by the other.
|
|
1040
|
+
*/
|
|
1041
|
+
export interface V2UpgradeToken {
|
|
1042
|
+
/**
|
|
1043
|
+
* V1 user key encrypted with V2 key (Cose_Encrypt0_B64 format)
|
|
1044
|
+
*/
|
|
1045
|
+
wrapped_user_key_1: EncString;
|
|
1046
|
+
/**
|
|
1047
|
+
* V2 user key encrypted with V1 key (Aes256Cbc_HmacSha256_B64 format)
|
|
1048
|
+
*/
|
|
1049
|
+
wrapped_user_key_2: EncString;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* IPC destination/source endpoint for SDK clients.
|
|
1054
|
+
*
|
|
1055
|
+
* Endpoints are categorized by their role in the connection topology:
|
|
1056
|
+
* - **Host endpoints** ([`HostId`]): Connection hubs that can be addressed relationally or
|
|
1057
|
+
* specifically. ([`BrowserBackground`](Endpoint::BrowserBackground))
|
|
1058
|
+
* - **Leaf endpoints**: Addressed by transport-assigned IDs. ([`Web`](Endpoint::Web),
|
|
1059
|
+
* [`BrowserForeground`](Endpoint::BrowserForeground))
|
|
1060
|
+
* - **Singleton endpoints**: Exactly one instance globally, no ID needed.
|
|
1061
|
+
* ([`DesktopMain`](Endpoint::DesktopMain), [`DesktopRenderer`](Endpoint::DesktopRenderer))
|
|
1062
|
+
*/
|
|
1063
|
+
export type Endpoint =
|
|
1064
|
+
| { Web: { tab_id: number; document_id: string } }
|
|
1065
|
+
| { BrowserForeground: { id: number } }
|
|
1066
|
+
| { BrowserBackground: { id: HostId } }
|
|
1067
|
+
| "DesktopRenderer"
|
|
1068
|
+
| "DesktopMain";
|
|
1069
|
+
|
|
1070
|
+
/**
|
|
1071
|
+
* Identifies a host endpoint, one that manages connections for other endpoints.
|
|
1072
|
+
*
|
|
1073
|
+
* Host endpoints can be addressed relationally (when the sender has a direct connection
|
|
1074
|
+
* and there is only one from their perspective) or by a specific transport-assigned ID
|
|
1075
|
+
* (when distinguishing between multiple instances).
|
|
1076
|
+
*/
|
|
1077
|
+
export type HostId = "Own" | { Id: number };
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* Indicates the authentication strategy to use when accessing a Send
|
|
1081
|
+
*/
|
|
1082
|
+
export type AuthType = "Email" | "Password" | "None";
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* Invalid grant errors - typically due to invalid credentials.
|
|
1086
|
+
*/
|
|
1087
|
+
export type SendAccessTokenInvalidGrantError =
|
|
1088
|
+
| "send_id_invalid"
|
|
1089
|
+
| "password_hash_b64_invalid"
|
|
1090
|
+
| "unknown";
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* Invalid request errors - typically due to missing parameters.
|
|
1094
|
+
*/
|
|
1095
|
+
export type SendAccessTokenInvalidRequestError =
|
|
1096
|
+
| "send_id_required"
|
|
1097
|
+
| "password_hash_b64_required"
|
|
1098
|
+
| "email_required"
|
|
1099
|
+
| "email_and_otp_required"
|
|
1100
|
+
| "unknown";
|
|
1101
|
+
|
|
1102
|
+
/**
|
|
1103
|
+
* Key Derivation Function for Bitwarden Account
|
|
1104
|
+
*
|
|
1105
|
+
* In Bitwarden accounts can use multiple KDFs to derive their master key from their password. This
|
|
1106
|
+
* Enum represents all the possible KDFs.
|
|
1107
|
+
*/
|
|
1108
|
+
export type Kdf =
|
|
1109
|
+
| { pBKDF2: { iterations: NonZeroU32 } }
|
|
1110
|
+
| { argon2id: { iterations: NonZeroU32; memory: NonZeroU32; parallelism: NonZeroU32 } };
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1113
|
+
* Login cipher data needed for risk evaluation.
|
|
1114
|
+
*/
|
|
1115
|
+
export interface CipherLoginDetails {
|
|
1116
|
+
/**
|
|
1117
|
+
* Cipher ID to identify which cipher in results.
|
|
1118
|
+
*/
|
|
1119
|
+
id: CipherId;
|
|
1120
|
+
/**
|
|
1121
|
+
* The decrypted password to evaluate.
|
|
1122
|
+
*/
|
|
1123
|
+
password: string;
|
|
1124
|
+
/**
|
|
1125
|
+
* Username or email (login ciphers only have one field).
|
|
1126
|
+
*/
|
|
1127
|
+
username: string | undefined;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
/**
|
|
1131
|
+
* Minimal CardView only including the needed details for list views
|
|
1132
|
+
*/
|
|
1133
|
+
export interface CardListView {
|
|
1134
|
+
/**
|
|
1135
|
+
* The brand of the card, e.g. Visa, Mastercard, etc.
|
|
1136
|
+
*/
|
|
1137
|
+
brand: string | undefined;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Minimal field view for list/search operations.
|
|
1142
|
+
* Contains only the fields needed for search indexing.
|
|
1143
|
+
*/
|
|
1144
|
+
export interface FieldListView {
|
|
1145
|
+
/**
|
|
1146
|
+
* Only populated if the field has a name.
|
|
1147
|
+
*/
|
|
1148
|
+
name: string | undefined;
|
|
1149
|
+
/**
|
|
1150
|
+
* Only populated for [FieldType::Text] fields.
|
|
1151
|
+
*/
|
|
1152
|
+
value: string | undefined;
|
|
1153
|
+
/**
|
|
1154
|
+
* The field type.
|
|
1155
|
+
*/
|
|
1156
|
+
type: FieldType;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
/**
|
|
1160
|
+
* NewType wrapper for `CipherId`
|
|
1161
|
+
*/
|
|
1162
|
+
export type CipherId = Tagged<Uuid, "CipherId">;
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* NewType wrapper for `CollectionId`
|
|
1166
|
+
*/
|
|
1167
|
+
export type CollectionId = Tagged<Uuid, "CollectionId">;
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* NewType wrapper for `FolderId`
|
|
1171
|
+
*/
|
|
1172
|
+
export type FolderId = Tagged<Uuid, "FolderId">;
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* NewType wrapper for `OrganizationId`
|
|
1176
|
+
*/
|
|
1177
|
+
export type OrganizationId = Tagged<Uuid, "OrganizationId">;
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* NewType wrapper for `SendId`
|
|
1181
|
+
*/
|
|
1182
|
+
export type SendId = Tagged<Uuid, "SendId">;
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* NewType wrapper for `UserId`
|
|
1186
|
+
*/
|
|
1187
|
+
export type UserId = Tagged<Uuid, "UserId">;
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* Options for configuring risk computation.
|
|
1191
|
+
*/
|
|
1192
|
+
export interface CipherRiskOptions {
|
|
1193
|
+
/**
|
|
1194
|
+
* Pre-computed password reuse map (password → count).
|
|
1195
|
+
* If provided, enables reuse detection across ciphers.
|
|
1196
|
+
*/
|
|
1197
|
+
passwordMap?: PasswordReuseMap | undefined;
|
|
1198
|
+
/**
|
|
1199
|
+
* Whether to check passwords against Have I Been Pwned API.
|
|
1200
|
+
* When true, makes network requests to check for exposed passwords.
|
|
1201
|
+
*/
|
|
1202
|
+
checkExposed?: boolean;
|
|
1203
|
+
/**
|
|
1204
|
+
* Optional HIBP API base URL override. When None, uses the production HIBP URL.
|
|
1205
|
+
* Can be used for testing or alternative password breach checking services.
|
|
1206
|
+
*/
|
|
1207
|
+
hibpBaseUrl?: string | undefined;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
/**
|
|
1211
|
+
* Passphrase generator request options.
|
|
1212
|
+
*/
|
|
1213
|
+
export interface PassphraseGeneratorRequest {
|
|
1214
|
+
/**
|
|
1215
|
+
* Number of words in the generated passphrase.
|
|
1216
|
+
* This value must be between 3 and 20.
|
|
1217
|
+
*/
|
|
1218
|
+
numWords: number;
|
|
1219
|
+
/**
|
|
1220
|
+
* Character separator between words in the generated passphrase. The value cannot be empty.
|
|
1221
|
+
*/
|
|
1222
|
+
wordSeparator: string;
|
|
1223
|
+
/**
|
|
1224
|
+
* When set to true, capitalize the first letter of each word in the generated passphrase.
|
|
1225
|
+
*/
|
|
1226
|
+
capitalize: boolean;
|
|
1227
|
+
/**
|
|
1228
|
+
* When set to true, include a number at the end of one of the words in the generated
|
|
1229
|
+
* passphrase.
|
|
1230
|
+
*/
|
|
1231
|
+
includeNumber: boolean;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Password generator request options.
|
|
1236
|
+
*/
|
|
1237
|
+
export interface PasswordGeneratorRequest {
|
|
1238
|
+
/**
|
|
1239
|
+
* Include lowercase characters (a-z).
|
|
1240
|
+
*/
|
|
1241
|
+
lowercase: boolean;
|
|
1242
|
+
/**
|
|
1243
|
+
* Include uppercase characters (A-Z).
|
|
1244
|
+
*/
|
|
1245
|
+
uppercase: boolean;
|
|
1246
|
+
/**
|
|
1247
|
+
* Include numbers (0-9).
|
|
1248
|
+
*/
|
|
1249
|
+
numbers: boolean;
|
|
1250
|
+
/**
|
|
1251
|
+
* Include special characters: ! @ # $ % ^ & *
|
|
1252
|
+
*/
|
|
1253
|
+
special: boolean;
|
|
1254
|
+
/**
|
|
1255
|
+
* The length of the generated password.
|
|
1256
|
+
* Note that the password length must be greater than the sum of all the minimums.
|
|
1257
|
+
*/
|
|
1258
|
+
length: number;
|
|
1259
|
+
/**
|
|
1260
|
+
* When set to true, the generated password will not contain ambiguous characters.
|
|
1261
|
+
* The ambiguous characters are: I, O, l, 0, 1
|
|
1262
|
+
*/
|
|
1263
|
+
avoidAmbiguous: boolean;
|
|
1264
|
+
/**
|
|
1265
|
+
* The minimum number of lowercase characters in the generated password.
|
|
1266
|
+
* When set, the value must be between 1 and 9. This value is ignored if lowercase is false.
|
|
1267
|
+
*/
|
|
1268
|
+
minLowercase: number | undefined;
|
|
1269
|
+
/**
|
|
1270
|
+
* The minimum number of uppercase characters in the generated password.
|
|
1271
|
+
* When set, the value must be between 1 and 9. This value is ignored if uppercase is false.
|
|
1272
|
+
*/
|
|
1273
|
+
minUppercase: number | undefined;
|
|
1274
|
+
/**
|
|
1275
|
+
* The minimum number of numbers in the generated password.
|
|
1276
|
+
* When set, the value must be between 1 and 9. This value is ignored if numbers is false.
|
|
1277
|
+
*/
|
|
1278
|
+
minNumber: number | undefined;
|
|
1279
|
+
/**
|
|
1280
|
+
* The minimum number of special characters in the generated password.
|
|
1281
|
+
* When set, the value must be between 1 and 9. This value is ignored if special is false.
|
|
1282
|
+
*/
|
|
1283
|
+
minSpecial: number | undefined;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
/**
|
|
1287
|
+
* Password reuse map wrapper for WASM compatibility.
|
|
1288
|
+
*/
|
|
1289
|
+
export type PasswordReuseMap = Record<string, number>;
|
|
1290
|
+
|
|
1291
|
+
/**
|
|
1292
|
+
* Public SDK request model for logging in via password
|
|
1293
|
+
*/
|
|
1294
|
+
export interface PasswordLoginRequest {
|
|
1295
|
+
/**
|
|
1296
|
+
* Common login request fields
|
|
1297
|
+
*/
|
|
1298
|
+
loginRequest: LoginRequest;
|
|
1299
|
+
/**
|
|
1300
|
+
* User\'s email address
|
|
1301
|
+
*/
|
|
1302
|
+
email: string;
|
|
1303
|
+
/**
|
|
1304
|
+
* User\'s master password
|
|
1305
|
+
*/
|
|
1306
|
+
password: string;
|
|
1307
|
+
/**
|
|
1308
|
+
* Prelogin data required for password authentication
|
|
1309
|
+
* (e.g., KDF configuration for deriving the master key)
|
|
1310
|
+
*/
|
|
1311
|
+
preloginResponse: PasswordPreloginResponse;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
/**
|
|
1315
|
+
* Represents errors that can occur when requesting a send access token.
|
|
1316
|
+
* It includes expected and unexpected API errors.
|
|
1317
|
+
*/
|
|
1318
|
+
export type SendAccessTokenError =
|
|
1319
|
+
| { kind: "unexpected"; data: UnexpectedIdentityError }
|
|
1320
|
+
| { kind: "expected"; data: SendAccessTokenApiErrorResponse };
|
|
1321
|
+
|
|
1322
|
+
/**
|
|
1323
|
+
* Represents the PIN envelope in memory, when ephemeral PIN unlock is used.
|
|
1324
|
+
*/
|
|
1325
|
+
export interface EphemeralPinEnvelopeState {
|
|
1326
|
+
pin_envelope: PasswordProtectedKeyEnvelope;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
/**
|
|
1330
|
+
* Represents the data required to authenticate with the master password.
|
|
1331
|
+
*/
|
|
1332
|
+
export interface MasterPasswordAuthenticationData {
|
|
1333
|
+
kdf: Kdf;
|
|
1334
|
+
salt: string;
|
|
1335
|
+
masterPasswordAuthenticationHash: B64;
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
/**
|
|
1339
|
+
* Represents the data required to unlock with the master password.
|
|
1340
|
+
*/
|
|
1341
|
+
export interface MasterPasswordUnlockData {
|
|
1342
|
+
/**
|
|
1343
|
+
* The key derivation function used to derive the master key
|
|
1344
|
+
*/
|
|
1345
|
+
kdf: Kdf;
|
|
1346
|
+
/**
|
|
1347
|
+
* The master key wrapped user key
|
|
1348
|
+
*/
|
|
1349
|
+
masterKeyWrappedUserKey: EncString;
|
|
1350
|
+
/**
|
|
1351
|
+
* The salt used in the KDF, typically the user\'s email
|
|
1352
|
+
*/
|
|
1353
|
+
salt: string;
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
/**
|
|
1357
|
+
* Represents the decrypted symmetric user-key of a user. This is held in ephemeral state of the
|
|
1358
|
+
* client.
|
|
1359
|
+
*/
|
|
1360
|
+
export interface UserKeyState {
|
|
1361
|
+
decrypted_user_key: B64;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
/**
|
|
1365
|
+
* Represents the inner data of a cipher view.
|
|
1366
|
+
*/
|
|
1367
|
+
export type CipherViewType =
|
|
1368
|
+
| { login: LoginView }
|
|
1369
|
+
| { card: CardView }
|
|
1370
|
+
| { identity: IdentityView }
|
|
1371
|
+
| { secureNote: SecureNoteView }
|
|
1372
|
+
| { sshKey: SshKeyView }
|
|
1373
|
+
| { bankAccount: BankAccountView };
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* Represents the local user data key, wrapped by user key.
|
|
1377
|
+
* This key is used to encrypt local user data (e.g., password generator history).
|
|
1378
|
+
*/
|
|
1379
|
+
export interface LocalUserDataKeyState {
|
|
1380
|
+
wrapped_key: EncString;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
/**
|
|
1384
|
+
* Represents the possible, expected errors that can occur when requesting a send access token.
|
|
1385
|
+
*/
|
|
1386
|
+
export type SendAccessTokenApiErrorResponse =
|
|
1387
|
+
| {
|
|
1388
|
+
error: "invalid_request";
|
|
1389
|
+
error_description?: string;
|
|
1390
|
+
send_access_error_type?: SendAccessTokenInvalidRequestError;
|
|
1391
|
+
}
|
|
1392
|
+
| {
|
|
1393
|
+
error: "invalid_grant";
|
|
1394
|
+
error_description?: string;
|
|
1395
|
+
send_access_error_type?: SendAccessTokenInvalidGrantError;
|
|
1396
|
+
}
|
|
1397
|
+
| { error: "invalid_client"; error_description?: string }
|
|
1398
|
+
| { error: "unauthorized_client"; error_description?: string }
|
|
1399
|
+
| { error: "unsupported_grant_type"; error_description?: string }
|
|
1400
|
+
| { error: "invalid_scope"; error_description?: string }
|
|
1401
|
+
| { error: "invalid_target"; error_description?: string };
|
|
1402
|
+
|
|
1403
|
+
/**
|
|
1404
|
+
* Represents the request to initialize the user\'s organizational cryptographic state.
|
|
1405
|
+
*/
|
|
1406
|
+
export interface InitOrgCryptoRequest {
|
|
1407
|
+
/**
|
|
1408
|
+
* The encryption keys for all the organizations the user is a part of
|
|
1409
|
+
*/
|
|
1410
|
+
organizationKeys: Map<OrganizationId, UnsignedSharedKey>;
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
/**
|
|
1414
|
+
* Represents the result of decrypting a list of ciphers.
|
|
1415
|
+
*
|
|
1416
|
+
* This struct contains two vectors: `successes` and `failures`.
|
|
1417
|
+
* `successes` contains the decrypted `CipherListView` objects,
|
|
1418
|
+
* while `failures` contains the original `Cipher` objects that failed to decrypt.
|
|
1419
|
+
*/
|
|
1420
|
+
export interface DecryptCipherListResult {
|
|
1421
|
+
/**
|
|
1422
|
+
* The decrypted `CipherListView` objects.
|
|
1423
|
+
*/
|
|
1424
|
+
successes: CipherListView[];
|
|
1425
|
+
/**
|
|
1426
|
+
* The original `Cipher` objects that failed to decrypt.
|
|
1427
|
+
*/
|
|
1428
|
+
failures: Cipher[];
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
/**
|
|
1432
|
+
* Represents the result of decrypting a list of ciphers.
|
|
1433
|
+
*
|
|
1434
|
+
* This struct contains two vectors: `successes` and `failures`.
|
|
1435
|
+
* `successes` contains the decrypted `CipherView` objects,
|
|
1436
|
+
* while `failures` contains the original `Cipher` objects that failed to decrypt.
|
|
1437
|
+
*/
|
|
1438
|
+
export interface DecryptCipherResult {
|
|
1439
|
+
/**
|
|
1440
|
+
* The decrypted `CipherView` objects.
|
|
1441
|
+
*/
|
|
1442
|
+
successes: CipherView[];
|
|
1443
|
+
/**
|
|
1444
|
+
* The original `Cipher` objects that failed to decrypt.
|
|
1445
|
+
*/
|
|
1446
|
+
failures: Cipher[];
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
/**
|
|
1450
|
+
* Represents the result of fetching and decrypting all ciphers for an organization.
|
|
1451
|
+
*
|
|
1452
|
+
* Contains the encrypted ciphers from the API alongside their decrypted list views.
|
|
1453
|
+
*/
|
|
1454
|
+
export interface ListOrganizationCiphersResult {
|
|
1455
|
+
/**
|
|
1456
|
+
* All encrypted ciphers returned from the API.
|
|
1457
|
+
*/
|
|
1458
|
+
ciphers: Cipher[];
|
|
1459
|
+
/**
|
|
1460
|
+
* Successfully decrypted `CipherListView` objects.
|
|
1461
|
+
*/
|
|
1462
|
+
listViews: CipherListView[];
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
/**
|
|
1466
|
+
* Request for `verify_asymmetric_keys`.
|
|
1467
|
+
*/
|
|
1468
|
+
export interface VerifyAsymmetricKeysRequest {
|
|
1469
|
+
/**
|
|
1470
|
+
* The user\'s user key
|
|
1471
|
+
*/
|
|
1472
|
+
userKey: B64;
|
|
1473
|
+
/**
|
|
1474
|
+
* The user\'s public key
|
|
1475
|
+
*/
|
|
1476
|
+
userPublicKey: B64;
|
|
1477
|
+
/**
|
|
1478
|
+
* User\'s private key, encrypted with the user key
|
|
1479
|
+
*/
|
|
1480
|
+
userKeyEncryptedPrivateKey: EncString;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
/**
|
|
1484
|
+
* Request for deriving a pin protected user key
|
|
1485
|
+
*/
|
|
1486
|
+
export interface DerivePinKeyResponse {
|
|
1487
|
+
/**
|
|
1488
|
+
* [UserKey] protected by PIN
|
|
1489
|
+
*/
|
|
1490
|
+
pinProtectedUserKey: EncString;
|
|
1491
|
+
/**
|
|
1492
|
+
* PIN protected by [UserKey]
|
|
1493
|
+
*/
|
|
1494
|
+
encryptedPin: EncString;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
/**
|
|
1498
|
+
* Request for deriving a pin protected user key
|
|
1499
|
+
*/
|
|
1500
|
+
export interface EnrollPinResponse {
|
|
1501
|
+
/**
|
|
1502
|
+
* [UserKey] protected by PIN
|
|
1503
|
+
*/
|
|
1504
|
+
pinProtectedUserKeyEnvelope: PasswordProtectedKeyEnvelope;
|
|
1505
|
+
/**
|
|
1506
|
+
* PIN protected by [UserKey]
|
|
1507
|
+
*/
|
|
1508
|
+
userKeyEncryptedPin: EncString;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
/**
|
|
1512
|
+
* Request for migrating an account from password to key connector.
|
|
1513
|
+
*/
|
|
1514
|
+
export interface DeriveKeyConnectorRequest {
|
|
1515
|
+
/**
|
|
1516
|
+
* Encrypted user key, used to validate the master key
|
|
1517
|
+
*/
|
|
1518
|
+
userKeyEncrypted: EncString;
|
|
1519
|
+
/**
|
|
1520
|
+
* The user\'s master password
|
|
1521
|
+
*/
|
|
1522
|
+
password: string;
|
|
1523
|
+
/**
|
|
1524
|
+
* The KDF parameters used to derive the master key
|
|
1525
|
+
*/
|
|
1526
|
+
kdf: Kdf;
|
|
1527
|
+
/**
|
|
1528
|
+
* The user\'s email address
|
|
1529
|
+
*/
|
|
1530
|
+
email: string;
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
/**
|
|
1534
|
+
* Request model for creating a new Send.
|
|
1535
|
+
*/
|
|
1536
|
+
export interface SendAddRequest {
|
|
1537
|
+
/**
|
|
1538
|
+
* The name of the Send.
|
|
1539
|
+
*/
|
|
1540
|
+
name: string;
|
|
1541
|
+
/**
|
|
1542
|
+
* Optional notes visible to the sender.
|
|
1543
|
+
*/
|
|
1544
|
+
notes: string | undefined;
|
|
1545
|
+
/**
|
|
1546
|
+
* The type and content of the Send.
|
|
1547
|
+
*/
|
|
1548
|
+
viewType: SendViewType;
|
|
1549
|
+
/**
|
|
1550
|
+
* Maximum number of times the Send can be accessed.
|
|
1551
|
+
*/
|
|
1552
|
+
maxAccessCount: number | undefined;
|
|
1553
|
+
/**
|
|
1554
|
+
* Whether the Send is disabled and cannot be accessed.
|
|
1555
|
+
*/
|
|
1556
|
+
disabled: boolean;
|
|
1557
|
+
/**
|
|
1558
|
+
* Whether to hide the sender\'s email from recipients.
|
|
1559
|
+
*/
|
|
1560
|
+
hideEmail: boolean;
|
|
1561
|
+
/**
|
|
1562
|
+
* Date and time when the Send will be permanently deleted.
|
|
1563
|
+
*/
|
|
1564
|
+
deletionDate: DateTime<Utc>;
|
|
1565
|
+
/**
|
|
1566
|
+
* Optional date and time when the Send expires and can no longer be accessed.
|
|
1567
|
+
*/
|
|
1568
|
+
expirationDate: DateTime<Utc> | undefined;
|
|
1569
|
+
/**
|
|
1570
|
+
* Authentication method for accessing this Send.
|
|
1571
|
+
*/
|
|
1572
|
+
auth: SendAuthType;
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
/**
|
|
1576
|
+
* Request model for editing an existing Send.
|
|
1577
|
+
*/
|
|
1578
|
+
export interface SendEditRequest {
|
|
1579
|
+
/**
|
|
1580
|
+
* The name of the Send.
|
|
1581
|
+
*/
|
|
1582
|
+
name: string;
|
|
1583
|
+
/**
|
|
1584
|
+
* Optional notes visible to the sender.
|
|
1585
|
+
*/
|
|
1586
|
+
notes: string | undefined;
|
|
1587
|
+
/**
|
|
1588
|
+
* The type and content of the Send.
|
|
1589
|
+
*/
|
|
1590
|
+
viewType: SendViewType;
|
|
1591
|
+
/**
|
|
1592
|
+
* Maximum number of times the Send can be accessed.
|
|
1593
|
+
*/
|
|
1594
|
+
maxAccessCount: number | undefined;
|
|
1595
|
+
/**
|
|
1596
|
+
* Whether the Send is disabled and cannot be accessed.
|
|
1597
|
+
*/
|
|
1598
|
+
disabled: boolean;
|
|
1599
|
+
/**
|
|
1600
|
+
* Whether to hide the sender\'s email from recipients.
|
|
1601
|
+
*/
|
|
1602
|
+
hideEmail: boolean;
|
|
1603
|
+
/**
|
|
1604
|
+
* Date and time when the Send will be permanently deleted.
|
|
1605
|
+
*/
|
|
1606
|
+
deletionDate: DateTime<Utc>;
|
|
1607
|
+
/**
|
|
1608
|
+
* Optional date and time when the Send expires and can no longer be accessed.
|
|
1609
|
+
*/
|
|
1610
|
+
expirationDate: DateTime<Utc> | undefined;
|
|
1611
|
+
/**
|
|
1612
|
+
* Authentication method for accessing this Send.
|
|
1613
|
+
*/
|
|
1614
|
+
auth: SendAuthType;
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
/**
|
|
1618
|
+
* Request parameters for SSO JIT master password registration.
|
|
1619
|
+
*/
|
|
1620
|
+
export interface JitMasterPasswordRegistrationRequest {
|
|
1621
|
+
/**
|
|
1622
|
+
* Organization ID to enroll in
|
|
1623
|
+
*/
|
|
1624
|
+
org_id: OrganizationId;
|
|
1625
|
+
/**
|
|
1626
|
+
* Organization\'s public key for encrypting the reset password key. This should be verified by
|
|
1627
|
+
* the client and not verifying may compromise the security of the user\'s account.
|
|
1628
|
+
*/
|
|
1629
|
+
org_public_key: B64;
|
|
1630
|
+
/**
|
|
1631
|
+
* Organization SSO identifier
|
|
1632
|
+
*/
|
|
1633
|
+
organization_sso_identifier: string;
|
|
1634
|
+
/**
|
|
1635
|
+
* User ID for the account being initialized
|
|
1636
|
+
*/
|
|
1637
|
+
user_id: UserId;
|
|
1638
|
+
/**
|
|
1639
|
+
* Salt for master password hashing, usually email
|
|
1640
|
+
*/
|
|
1641
|
+
salt: string;
|
|
1642
|
+
/**
|
|
1643
|
+
* Master password for the account
|
|
1644
|
+
*/
|
|
1645
|
+
master_password: string;
|
|
1646
|
+
/**
|
|
1647
|
+
* Optional hint for the master password
|
|
1648
|
+
*/
|
|
1649
|
+
master_password_hint: string | undefined;
|
|
1650
|
+
/**
|
|
1651
|
+
* Should enroll user into admin password reset
|
|
1652
|
+
*/
|
|
1653
|
+
reset_password_enroll: boolean;
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
/**
|
|
1657
|
+
* Request parameters for TDE (Trusted Device Encryption) registration.
|
|
1658
|
+
*/
|
|
1659
|
+
export interface TdeRegistrationRequest {
|
|
1660
|
+
/**
|
|
1661
|
+
* Organization ID to enroll in
|
|
1662
|
+
*/
|
|
1663
|
+
org_id: OrganizationId;
|
|
1664
|
+
/**
|
|
1665
|
+
* Organization\'s public key for encrypting the reset password key. This should be verified by
|
|
1666
|
+
* the client and not verifying may compromise the security of the user\'s account.
|
|
1667
|
+
*/
|
|
1668
|
+
org_public_key: B64;
|
|
1669
|
+
/**
|
|
1670
|
+
* User ID for the account being initialized
|
|
1671
|
+
*/
|
|
1672
|
+
user_id: UserId;
|
|
1673
|
+
/**
|
|
1674
|
+
* Device identifier for TDE enrollment
|
|
1675
|
+
*/
|
|
1676
|
+
device_identifier: string;
|
|
1677
|
+
/**
|
|
1678
|
+
* Whether to trust this device for TDE
|
|
1679
|
+
*/
|
|
1680
|
+
trust_device: boolean;
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
/**
|
|
1684
|
+
* Request to add a cipher.
|
|
1685
|
+
*/
|
|
1686
|
+
export interface CipherCreateRequest {
|
|
1687
|
+
organizationId: OrganizationId | undefined;
|
|
1688
|
+
collectionIds: CollectionId[];
|
|
1689
|
+
folderId: FolderId | undefined;
|
|
1690
|
+
name: string;
|
|
1691
|
+
notes: string | undefined;
|
|
1692
|
+
favorite: boolean;
|
|
1693
|
+
reprompt: CipherRepromptType;
|
|
1694
|
+
type: CipherViewType;
|
|
1695
|
+
fields: FieldView[];
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
/**
|
|
1699
|
+
* Request to add or edit a folder.
|
|
1700
|
+
*/
|
|
1701
|
+
export interface FolderAddEditRequest {
|
|
1702
|
+
/**
|
|
1703
|
+
* The new name of the folder.
|
|
1704
|
+
*/
|
|
1705
|
+
name: string;
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
/**
|
|
1709
|
+
* Request to edit a cipher.
|
|
1710
|
+
*/
|
|
1711
|
+
export interface CipherEditRequest {
|
|
1712
|
+
id: CipherId;
|
|
1713
|
+
organizationId: OrganizationId | undefined;
|
|
1714
|
+
folderId: FolderId | undefined;
|
|
1715
|
+
favorite: boolean;
|
|
1716
|
+
reprompt: CipherRepromptType;
|
|
1717
|
+
name: string;
|
|
1718
|
+
notes: string | undefined;
|
|
1719
|
+
fields: FieldView[];
|
|
1720
|
+
type: CipherViewType;
|
|
1721
|
+
revisionDate: DateTime<Utc>;
|
|
1722
|
+
archivedDate: DateTime<Utc> | undefined;
|
|
1723
|
+
attachments: AttachmentView[];
|
|
1724
|
+
key: EncString | undefined;
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
/**
|
|
1728
|
+
* Request to set server communication configuration for a hostname
|
|
1729
|
+
*
|
|
1730
|
+
* This is the input type for
|
|
1731
|
+
* [`ServerCommunicationConfigClient::set_communication_type`](crate::ServerCommunicationConfigClient::set_communication_type).
|
|
1732
|
+
* Unlike [`ServerCommunicationConfig`], this type does not include acquired cookies,
|
|
1733
|
+
* since cookies are managed separately via
|
|
1734
|
+
* [`ServerCommunicationConfigClient::acquire_cookie`](crate::ServerCommunicationConfigClient::acquire_cookie).
|
|
1735
|
+
*/
|
|
1736
|
+
export interface SetCommunicationTypeRequest {
|
|
1737
|
+
/**
|
|
1738
|
+
* Bootstrap configuration determining how to establish server communication
|
|
1739
|
+
*/
|
|
1740
|
+
bootstrap: BootstrapConfigRequest;
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
/**
|
|
1744
|
+
* Response containing the data required before password-based authentication
|
|
1745
|
+
*/
|
|
1746
|
+
export interface PasswordPreloginResponse {
|
|
1747
|
+
/**
|
|
1748
|
+
* The Key Derivation Function (KDF) configuration for the user
|
|
1749
|
+
*/
|
|
1750
|
+
kdf: Kdf;
|
|
1751
|
+
/**
|
|
1752
|
+
* The salt used in the KDF process
|
|
1753
|
+
*/
|
|
1754
|
+
salt: string;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
/**
|
|
1758
|
+
* Response for `verify_asymmetric_keys`.
|
|
1759
|
+
*/
|
|
1760
|
+
export interface VerifyAsymmetricKeysResponse {
|
|
1761
|
+
/**
|
|
1762
|
+
* Whether the user\'s private key was decryptable by the user key.
|
|
1763
|
+
*/
|
|
1764
|
+
privateKeyDecryptable: boolean;
|
|
1765
|
+
/**
|
|
1766
|
+
* Whether the user\'s private key was a valid RSA key and matched the public key provided.
|
|
1767
|
+
*/
|
|
1768
|
+
validPrivateKey: boolean;
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
/**
|
|
1772
|
+
* Response for the `make_keys_for_user_crypto_v2`, containing a set of keys for a user
|
|
1773
|
+
*/
|
|
1774
|
+
export interface UserCryptoV2KeysResponse {
|
|
1775
|
+
/**
|
|
1776
|
+
* User key
|
|
1777
|
+
*/
|
|
1778
|
+
userKey: B64;
|
|
1779
|
+
/**
|
|
1780
|
+
* Wrapped private key
|
|
1781
|
+
*/
|
|
1782
|
+
privateKey: EncString;
|
|
1783
|
+
/**
|
|
1784
|
+
* Public key
|
|
1785
|
+
*/
|
|
1786
|
+
publicKey: B64;
|
|
1787
|
+
/**
|
|
1788
|
+
* The user\'s public key, signed by the signing key
|
|
1789
|
+
*/
|
|
1790
|
+
signedPublicKey: SignedPublicKey;
|
|
1791
|
+
/**
|
|
1792
|
+
* Signing key, encrypted with the user\'s symmetric key
|
|
1793
|
+
*/
|
|
1794
|
+
signingKey: EncString;
|
|
1795
|
+
/**
|
|
1796
|
+
* Base64 encoded verifying key
|
|
1797
|
+
*/
|
|
1798
|
+
verifyingKey: B64;
|
|
1799
|
+
/**
|
|
1800
|
+
* The user\'s signed security state
|
|
1801
|
+
*/
|
|
1802
|
+
securityState: SignedSecurityState;
|
|
1803
|
+
/**
|
|
1804
|
+
* The security state\'s version
|
|
1805
|
+
*/
|
|
1806
|
+
securityVersion: number;
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
/**
|
|
1810
|
+
* Response from the `make_key_pair` function
|
|
1811
|
+
*/
|
|
1812
|
+
export interface MakeKeyPairResponse {
|
|
1813
|
+
/**
|
|
1814
|
+
* The user\'s public key
|
|
1815
|
+
*/
|
|
1816
|
+
userPublicKey: B64;
|
|
1817
|
+
/**
|
|
1818
|
+
* User\'s private key, encrypted with the user key
|
|
1819
|
+
*/
|
|
1820
|
+
userKeyEncryptedPrivateKey: EncString;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
/**
|
|
1824
|
+
* Response from the `make_update_password` function
|
|
1825
|
+
*/
|
|
1826
|
+
export interface UpdatePasswordResponse {
|
|
1827
|
+
/**
|
|
1828
|
+
* Hash of the new password
|
|
1829
|
+
*/
|
|
1830
|
+
passwordHash: B64;
|
|
1831
|
+
/**
|
|
1832
|
+
* User key, encrypted with the new password
|
|
1833
|
+
*/
|
|
1834
|
+
newKey: EncString;
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
/**
|
|
1838
|
+
* Response from the `update_kdf` function
|
|
1839
|
+
*/
|
|
1840
|
+
export interface UpdateKdfResponse {
|
|
1841
|
+
/**
|
|
1842
|
+
* The authentication data for the new KDF setting
|
|
1843
|
+
*/
|
|
1844
|
+
masterPasswordAuthenticationData: MasterPasswordAuthenticationData;
|
|
1845
|
+
/**
|
|
1846
|
+
* The unlock data for the new KDF setting
|
|
1847
|
+
*/
|
|
1848
|
+
masterPasswordUnlockData: MasterPasswordUnlockData;
|
|
1849
|
+
/**
|
|
1850
|
+
* The authentication data for the KDF setting prior to the change
|
|
1851
|
+
*/
|
|
1852
|
+
oldMasterPasswordAuthenticationData: MasterPasswordAuthenticationData;
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
/**
|
|
1856
|
+
* Result of JIT master password registration process.
|
|
1857
|
+
*/
|
|
1858
|
+
export interface JitMasterPasswordRegistrationResponse {
|
|
1859
|
+
/**
|
|
1860
|
+
* The account cryptographic state of the user
|
|
1861
|
+
*/
|
|
1862
|
+
account_cryptographic_state: WrappedAccountCryptographicState;
|
|
1863
|
+
/**
|
|
1864
|
+
* The master password unlock data
|
|
1865
|
+
*/
|
|
1866
|
+
master_password_unlock: MasterPasswordUnlockData;
|
|
1867
|
+
/**
|
|
1868
|
+
* The decrypted user key.
|
|
1869
|
+
*/
|
|
1870
|
+
user_key: B64;
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
/**
|
|
1874
|
+
* Result of Key Connector registration process.
|
|
1875
|
+
*/
|
|
1876
|
+
export interface KeyConnectorRegistrationResult {
|
|
1877
|
+
/**
|
|
1878
|
+
* The account cryptographic state of the user.
|
|
1879
|
+
*/
|
|
1880
|
+
account_cryptographic_state: WrappedAccountCryptographicState;
|
|
1881
|
+
/**
|
|
1882
|
+
* The key connector key used for unlocking.
|
|
1883
|
+
*/
|
|
1884
|
+
key_connector_key: B64;
|
|
1885
|
+
/**
|
|
1886
|
+
* The encrypted user key, wrapped with the key connector key.
|
|
1887
|
+
*/
|
|
1888
|
+
key_connector_key_wrapped_user_key: EncString;
|
|
1889
|
+
/**
|
|
1890
|
+
* The decrypted user key. This can be used to get the consuming client to an unlocked state.
|
|
1891
|
+
*/
|
|
1892
|
+
user_key: B64;
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
/**
|
|
1896
|
+
* Result of TDE registration process.
|
|
1897
|
+
*/
|
|
1898
|
+
export interface TdeRegistrationResponse {
|
|
1899
|
+
/**
|
|
1900
|
+
* The account cryptographic state of the user
|
|
1901
|
+
*/
|
|
1902
|
+
account_cryptographic_state: WrappedAccountCryptographicState;
|
|
1903
|
+
/**
|
|
1904
|
+
* The device key
|
|
1905
|
+
*/
|
|
1906
|
+
device_key: B64;
|
|
1907
|
+
/**
|
|
1908
|
+
* The decrypted user key. This can be used to get the consuming client to an unlocked state.
|
|
1909
|
+
*/
|
|
1910
|
+
user_key: B64;
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
/**
|
|
1914
|
+
* Result of checking password exposure via HIBP API.
|
|
1915
|
+
*/
|
|
1916
|
+
export type ExposedPasswordResult =
|
|
1917
|
+
| { type: "NotChecked" }
|
|
1918
|
+
| { type: "Found"; value: number }
|
|
1919
|
+
| { type: "Error"; value: string };
|
|
1920
|
+
|
|
1921
|
+
/**
|
|
1922
|
+
* Risk evaluation result for a single cipher.
|
|
1923
|
+
*/
|
|
1924
|
+
export interface CipherRiskResult {
|
|
1925
|
+
/**
|
|
1926
|
+
* Cipher ID matching the input CipherLoginDetails.
|
|
1927
|
+
*/
|
|
1928
|
+
id: CipherId;
|
|
1929
|
+
/**
|
|
1930
|
+
* Password strength score from 0 (weakest) to 4 (strongest).
|
|
1931
|
+
* Calculated using zxcvbn with cipher-specific context.
|
|
1932
|
+
*/
|
|
1933
|
+
password_strength: number;
|
|
1934
|
+
/**
|
|
1935
|
+
* Result of checking password exposure via HIBP API.
|
|
1936
|
+
* - `NotChecked`: check_exposed was false, or password was empty
|
|
1937
|
+
* - `Found(n)`: Successfully checked, found in n breaches
|
|
1938
|
+
* - `Error(msg)`: HIBP API request failed for this cipher with the given error message
|
|
1939
|
+
*/
|
|
1940
|
+
exposed_result: ExposedPasswordResult;
|
|
1941
|
+
/**
|
|
1942
|
+
* Number of times this password appears in the provided password_map.
|
|
1943
|
+
* None if not found or if no password_map was provided.
|
|
1944
|
+
*/
|
|
1945
|
+
reuse_count: number | undefined;
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
/**
|
|
1949
|
+
* SDK domain model for Key Connector user decryption option.
|
|
1950
|
+
*/
|
|
1951
|
+
export interface KeyConnectorUserDecryptionOption {
|
|
1952
|
+
/**
|
|
1953
|
+
* URL of the Key Connector server to use for decryption.
|
|
1954
|
+
*/
|
|
1955
|
+
keyConnectorUrl: string;
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
/**
|
|
1959
|
+
* SDK domain model for Trusted Device user decryption option.
|
|
1960
|
+
*/
|
|
1961
|
+
export interface TrustedDeviceUserDecryptionOption {
|
|
1962
|
+
/**
|
|
1963
|
+
* Whether the user has admin approval for device login.
|
|
1964
|
+
*/
|
|
1965
|
+
hasAdminApproval: boolean;
|
|
1966
|
+
/**
|
|
1967
|
+
* Whether the user has a device that can approve logins.
|
|
1968
|
+
*/
|
|
1969
|
+
hasLoginApprovingDevice: boolean;
|
|
1970
|
+
/**
|
|
1971
|
+
* Whether the user has permission to manage password reset for other users.
|
|
1972
|
+
*/
|
|
1973
|
+
hasManageResetPasswordPermission: boolean;
|
|
1974
|
+
/**
|
|
1975
|
+
* Whether the user is in TDE offboarding.
|
|
1976
|
+
*/
|
|
1977
|
+
isTdeOffboarding: boolean;
|
|
1978
|
+
/**
|
|
1979
|
+
* The device key encrypted device private key. Only present if the device is trusted.
|
|
1980
|
+
*/
|
|
1981
|
+
encryptedPrivateKey?: EncString;
|
|
1982
|
+
/**
|
|
1983
|
+
* The device private key encrypted user key. Only present if the device is trusted.
|
|
1984
|
+
*/
|
|
1985
|
+
encryptedUserKey?: UnsignedSharedKey;
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
/**
|
|
1989
|
+
* SDK domain model for WebAuthn PRF user decryption option.
|
|
1990
|
+
*/
|
|
1991
|
+
export interface WebAuthnPrfUserDecryptionOption {
|
|
1992
|
+
/**
|
|
1993
|
+
* PRF key encrypted private key
|
|
1994
|
+
*/
|
|
1995
|
+
encryptedPrivateKey: EncString;
|
|
1996
|
+
/**
|
|
1997
|
+
* Public Key encrypted user key
|
|
1998
|
+
*/
|
|
1999
|
+
encryptedUserKey: UnsignedSharedKey;
|
|
2000
|
+
/**
|
|
2001
|
+
* Credential ID for this WebAuthn PRF credential.
|
|
2002
|
+
* TODO: PM-32163 - can remove `Option<T>` after 3 releases from server v2026.1.1
|
|
2003
|
+
*/
|
|
2004
|
+
credentialId: string | undefined;
|
|
2005
|
+
/**
|
|
2006
|
+
* Transport methods available for this credential (e.g., \"usb\", \"nfc\", \"ble\", \"internal\",
|
|
2007
|
+
* \"hybrid\").
|
|
2008
|
+
* TODO: PM-32163 - can remove `Option<T>` after 3 releases from server v2026.1.1
|
|
2009
|
+
*/
|
|
2010
|
+
transports: string[] | undefined;
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
/**
|
|
2014
|
+
* SDK domain model for master password policy requirements.
|
|
2015
|
+
* Defines the complexity requirements for a user\'s master password
|
|
2016
|
+
* when enforced by an organization policy.
|
|
2017
|
+
*/
|
|
2018
|
+
export interface MasterPasswordPolicyResponse {
|
|
2019
|
+
/**
|
|
2020
|
+
* The minimum complexity score required for the master password.
|
|
2021
|
+
* Complexity is calculated based on password strength metrics.
|
|
2022
|
+
*/
|
|
2023
|
+
minComplexity?: number;
|
|
2024
|
+
/**
|
|
2025
|
+
* The minimum length required for the master password.
|
|
2026
|
+
*/
|
|
2027
|
+
minLength?: number;
|
|
2028
|
+
/**
|
|
2029
|
+
* Whether the master password must contain at least one lowercase letter.
|
|
2030
|
+
*/
|
|
2031
|
+
requireLower?: boolean;
|
|
2032
|
+
/**
|
|
2033
|
+
* Whether the master password must contain at least one uppercase letter.
|
|
2034
|
+
*/
|
|
2035
|
+
requireUpper?: boolean;
|
|
2036
|
+
/**
|
|
2037
|
+
* Whether the master password must contain at least one numeric digit.
|
|
2038
|
+
*/
|
|
2039
|
+
requireNumbers?: boolean;
|
|
2040
|
+
/**
|
|
2041
|
+
* Whether the master password must contain at least one special character.
|
|
2042
|
+
*/
|
|
2043
|
+
requireSpecial?: boolean;
|
|
2044
|
+
/**
|
|
2045
|
+
* Whether this policy should be enforced when the user logs in.
|
|
2046
|
+
* If true, the user will be required to update their master password
|
|
2047
|
+
* if it doesn\'t meet the policy requirements.
|
|
2048
|
+
*/
|
|
2049
|
+
enforceOnLogin?: boolean;
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
/**
|
|
2053
|
+
* SDK domain model for user decryption options.
|
|
2054
|
+
* Provides the various methods available to unlock a user\'s vault.
|
|
2055
|
+
*/
|
|
2056
|
+
export interface UserDecryptionOptionsResponse {
|
|
2057
|
+
/**
|
|
2058
|
+
* Master password unlock option. None if user doesn\'t have a master password.
|
|
2059
|
+
*/
|
|
2060
|
+
masterPasswordUnlock?: MasterPasswordUnlockData;
|
|
2061
|
+
/**
|
|
2062
|
+
* Trusted Device decryption option.
|
|
2063
|
+
*/
|
|
2064
|
+
trustedDeviceOption?: TrustedDeviceUserDecryptionOption;
|
|
2065
|
+
/**
|
|
2066
|
+
* Key Connector decryption option.
|
|
2067
|
+
* Mutually exclusive with Trusted Device option.
|
|
2068
|
+
*/
|
|
2069
|
+
keyConnectorOption?: KeyConnectorUserDecryptionOption;
|
|
2070
|
+
/**
|
|
2071
|
+
* WebAuthn PRF decryption option.
|
|
2072
|
+
*/
|
|
2073
|
+
webauthnPrfOption?: WebAuthnPrfUserDecryptionOption;
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
/**
|
|
2077
|
+
* SDK response model for a successful login.
|
|
2078
|
+
* This is the model that will be exposed to consuming applications.
|
|
2079
|
+
*/
|
|
2080
|
+
export interface LoginSuccessResponse {
|
|
2081
|
+
/**
|
|
2082
|
+
* The access token string.
|
|
2083
|
+
*/
|
|
2084
|
+
accessToken: string;
|
|
2085
|
+
/**
|
|
2086
|
+
* The duration in seconds until the token expires.
|
|
2087
|
+
*/
|
|
2088
|
+
expiresIn: number;
|
|
2089
|
+
/**
|
|
2090
|
+
* The timestamp in milliseconds when the token expires.
|
|
2091
|
+
* We calculate this for more convenient token expiration handling.
|
|
2092
|
+
*/
|
|
2093
|
+
expiresAt: number;
|
|
2094
|
+
/**
|
|
2095
|
+
* The scope of the access token.
|
|
2096
|
+
* OAuth 2.0 RFC reference: <https://datatracker.ietf.org/doc/html/rfc6749#section-3.3>
|
|
2097
|
+
*/
|
|
2098
|
+
scope: string;
|
|
2099
|
+
/**
|
|
2100
|
+
* The type of the token.
|
|
2101
|
+
* This will be \"Bearer\" for send access tokens.
|
|
2102
|
+
* OAuth 2.0 RFC reference: <https://datatracker.ietf.org/doc/html/rfc6749#section-7.1>
|
|
2103
|
+
*/
|
|
2104
|
+
tokenType: string;
|
|
2105
|
+
/**
|
|
2106
|
+
* The optional refresh token string.
|
|
2107
|
+
* This token can be used to obtain new access tokens when the current one expires.
|
|
2108
|
+
*/
|
|
2109
|
+
refreshToken: string | undefined;
|
|
2110
|
+
/**
|
|
2111
|
+
* The user key wrapped user private key.
|
|
2112
|
+
* Note: previously known as \"private_key\".
|
|
2113
|
+
*/
|
|
2114
|
+
userKeyWrappedUserPrivateKey: string | undefined;
|
|
2115
|
+
/**
|
|
2116
|
+
* Two-factor authentication token for future requests.
|
|
2117
|
+
*/
|
|
2118
|
+
twoFactorToken: string | undefined;
|
|
2119
|
+
/**
|
|
2120
|
+
* Indicates whether an admin has reset the user\'s master password,
|
|
2121
|
+
* requiring them to set a new password upon next login.
|
|
2122
|
+
*/
|
|
2123
|
+
forcePasswordReset: boolean | undefined;
|
|
2124
|
+
/**
|
|
2125
|
+
* Indicates whether the user uses Key Connector and if the client should have a locally
|
|
2126
|
+
* configured Key Connector URL in their environment.
|
|
2127
|
+
* Note: This is currently only applicable for client_credential grant type logins and
|
|
2128
|
+
* is only expected to be relevant for the CLI
|
|
2129
|
+
*/
|
|
2130
|
+
apiUseKeyConnector: boolean | undefined;
|
|
2131
|
+
/**
|
|
2132
|
+
* The user\'s decryption options for unlocking their vault.
|
|
2133
|
+
*/
|
|
2134
|
+
userDecryptionOptions: UserDecryptionOptionsResponse;
|
|
2135
|
+
/**
|
|
2136
|
+
* If the user is subject to an organization master password policy,
|
|
2137
|
+
* this field contains the requirements of that policy.
|
|
2138
|
+
*/
|
|
2139
|
+
masterPasswordPolicy: MasterPasswordPolicyResponse | undefined;
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
/**
|
|
2143
|
+
* SSO cookie vendor configuration
|
|
2144
|
+
*
|
|
2145
|
+
* This configuration is provided by the server.
|
|
2146
|
+
*/
|
|
2147
|
+
export interface SsoCookieVendorConfig {
|
|
2148
|
+
/**
|
|
2149
|
+
* Identity provider login URL for browser redirect during bootstrap
|
|
2150
|
+
*/
|
|
2151
|
+
idpLoginUrl: string | undefined;
|
|
2152
|
+
/**
|
|
2153
|
+
* Cookie name (base name, without shard suffix)
|
|
2154
|
+
*/
|
|
2155
|
+
cookieName: string;
|
|
2156
|
+
/**
|
|
2157
|
+
* Cookie domain for validation
|
|
2158
|
+
*/
|
|
2159
|
+
cookieDomain: string;
|
|
2160
|
+
/**
|
|
2161
|
+
* Vault URL for cookie acquisition redirect
|
|
2162
|
+
*
|
|
2163
|
+
* This is the full vault URL (scheme + host + port) where the browser
|
|
2164
|
+
* should be redirected for SSO cookie acquisition.
|
|
2165
|
+
*/
|
|
2166
|
+
vaultUrl: string;
|
|
2167
|
+
/**
|
|
2168
|
+
* Acquired cookies
|
|
2169
|
+
*
|
|
2170
|
+
* For sharded cookies, this contains multiple entries with names like
|
|
2171
|
+
* `AWSELBAuthSessionCookie-0`, `AWSELBAuthSessionCookie-1`, etc.
|
|
2172
|
+
* For unsharded cookies, this contains a single entry with the base name.
|
|
2173
|
+
*/
|
|
2174
|
+
cookieValue: AcquiredCookie[] | undefined;
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
/**
|
|
2178
|
+
* SSO cookie vendor configuration for [`SetCommunicationTypeRequest`]
|
|
2179
|
+
*
|
|
2180
|
+
* Contains the server-provided configuration fields without acquired cookies.
|
|
2181
|
+
*/
|
|
2182
|
+
export interface SsoCookieVendorConfigRequest {
|
|
2183
|
+
/**
|
|
2184
|
+
* Identity provider login URL for browser redirect during bootstrap
|
|
2185
|
+
*/
|
|
2186
|
+
idpLoginUrl: string | undefined;
|
|
2187
|
+
/**
|
|
2188
|
+
* Cookie name (base name, without shard suffix)
|
|
2189
|
+
*/
|
|
2190
|
+
cookieName: string;
|
|
2191
|
+
/**
|
|
2192
|
+
* Cookie domain for validation
|
|
2193
|
+
*/
|
|
2194
|
+
cookieDomain: string;
|
|
2195
|
+
/**
|
|
2196
|
+
* Vault URL for cookie acquisition redirect
|
|
2197
|
+
*
|
|
2198
|
+
* This is the full vault URL (scheme + host + port) where the browser
|
|
2199
|
+
* should be redirected for SSO cookie acquisition.
|
|
2200
|
+
*/
|
|
2201
|
+
vaultUrl: string;
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
/**
|
|
2205
|
+
* Server communication configuration
|
|
2206
|
+
*/
|
|
2207
|
+
export interface ServerCommunicationConfig {
|
|
2208
|
+
/**
|
|
2209
|
+
* Bootstrap configuration determining how to establish server communication
|
|
2210
|
+
*/
|
|
2211
|
+
bootstrap: BootstrapConfig;
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
/**
|
|
2215
|
+
* State used for initializing the user cryptographic state.
|
|
2216
|
+
*/
|
|
2217
|
+
export interface InitUserCryptoRequest {
|
|
2218
|
+
/**
|
|
2219
|
+
* The user\'s ID.
|
|
2220
|
+
*/
|
|
2221
|
+
userId: UserId | undefined;
|
|
2222
|
+
/**
|
|
2223
|
+
* The user\'s KDF parameters, as received from the prelogin request
|
|
2224
|
+
*/
|
|
2225
|
+
kdfParams: Kdf;
|
|
2226
|
+
/**
|
|
2227
|
+
* The user\'s email address
|
|
2228
|
+
*/
|
|
2229
|
+
email: string;
|
|
2230
|
+
/**
|
|
2231
|
+
* The user\'s account cryptographic state, containing their signature and
|
|
2232
|
+
* public-key-encryption keys, along with the signed security state, protected by the user key
|
|
2233
|
+
*/
|
|
2234
|
+
accountCryptographicState: WrappedAccountCryptographicState;
|
|
2235
|
+
/**
|
|
2236
|
+
* The method to decrypt the user\'s account symmetric key (user key)
|
|
2237
|
+
*/
|
|
2238
|
+
method: InitUserCryptoMethod;
|
|
2239
|
+
/**
|
|
2240
|
+
* Optional V2 upgrade token for automatic key rotation from V1 to V2
|
|
2241
|
+
*/
|
|
2242
|
+
upgradeToken?: V2UpgradeToken;
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
/**
|
|
2246
|
+
* Temporary struct to hold metadata related to current account
|
|
2247
|
+
*
|
|
2248
|
+
* Eventually the SDK itself should have this state and we get rid of this struct.
|
|
2249
|
+
*/
|
|
2250
|
+
export interface Account {
|
|
2251
|
+
id: Uuid;
|
|
2252
|
+
email: string;
|
|
2253
|
+
name: string | undefined;
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
/**
|
|
2257
|
+
* Text-based send content
|
|
2258
|
+
*/
|
|
2259
|
+
export interface SendText {
|
|
2260
|
+
text: EncString | undefined;
|
|
2261
|
+
hidden: boolean;
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2264
|
+
/**
|
|
2265
|
+
* The common bucket of login fields to be re-used across all login mechanisms
|
|
2266
|
+
* (e.g., password, SSO, etc.). This will include handling client_id and 2FA.
|
|
2267
|
+
*/
|
|
2268
|
+
export interface LoginRequest {
|
|
2269
|
+
/**
|
|
2270
|
+
* OAuth client identifier
|
|
2271
|
+
*/
|
|
2272
|
+
clientId: string;
|
|
2273
|
+
/**
|
|
2274
|
+
* Device information for this login request
|
|
2275
|
+
*/
|
|
2276
|
+
device: LoginDeviceRequest;
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2279
|
+
/**
|
|
2280
|
+
* The credentials used for send access requests.
|
|
2281
|
+
*/
|
|
2282
|
+
export type SendAccessCredentials =
|
|
2283
|
+
| SendPasswordCredentials
|
|
2284
|
+
| SendEmailOtpCredentials
|
|
2285
|
+
| SendEmailCredentials;
|
|
2286
|
+
|
|
2287
|
+
/**
|
|
2288
|
+
* The crypto method used to initialize the user cryptographic state.
|
|
2289
|
+
*/
|
|
2290
|
+
export type InitUserCryptoMethod =
|
|
2291
|
+
| { masterPasswordUnlock: { password: string; master_password_unlock: MasterPasswordUnlockData } }
|
|
2292
|
+
| { clientManagedState: {} }
|
|
2293
|
+
| { decryptedKey: { decrypted_user_key: string } }
|
|
2294
|
+
| { pin: { pin: string; pin_protected_user_key: EncString } }
|
|
2295
|
+
| { pinEnvelope: { pin: string; pin_protected_user_key_envelope: PasswordProtectedKeyEnvelope } }
|
|
2296
|
+
| { authRequest: { request_private_key: B64; method: AuthRequestMethod } }
|
|
2297
|
+
| {
|
|
2298
|
+
deviceKey: {
|
|
2299
|
+
device_key: string;
|
|
2300
|
+
protected_device_private_key: EncString;
|
|
2301
|
+
device_protected_user_key: UnsignedSharedKey;
|
|
2302
|
+
};
|
|
2303
|
+
}
|
|
2304
|
+
| { keyConnector: { master_key: B64; user_key: EncString } }
|
|
2305
|
+
| { keyConnectorUrl: { url: string; key_connector_key_wrapped_user_key: EncString } };
|
|
2306
|
+
|
|
2307
|
+
/**
|
|
2308
|
+
* The data necessary to re-share the user-key to a V1 emergency access membership. Note: The
|
|
2309
|
+
* Public-key must be verified/trusted. Further, there is no sender authentication possible here.
|
|
2310
|
+
*/
|
|
2311
|
+
export interface V1EmergencyAccessMembership {
|
|
2312
|
+
id: Uuid;
|
|
2313
|
+
grantee_id: Uuid;
|
|
2314
|
+
name: string;
|
|
2315
|
+
public_key: PublicKey;
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
/**
|
|
2319
|
+
* The data necessary to re-share the user-key to a V1 organization membership. Note: The
|
|
2320
|
+
* Public-key must be verified/trusted. Further, there is no sender authentication possible here.
|
|
2321
|
+
*/
|
|
2322
|
+
export interface V1OrganizationMembership {
|
|
2323
|
+
organization_id: Uuid;
|
|
2324
|
+
name: string;
|
|
2325
|
+
public_key: PublicKey;
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
/**
|
|
2329
|
+
* The response to a discover/ping request.
|
|
2330
|
+
*/
|
|
2331
|
+
export interface DiscoverResponse {
|
|
2332
|
+
/**
|
|
2333
|
+
* The version of the client that responded to the discover request.
|
|
2334
|
+
*/
|
|
2335
|
+
version: string;
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
/**
|
|
2339
|
+
* The type of Send, either text or file
|
|
2340
|
+
*/
|
|
2341
|
+
export type SendType = "Text" | "File";
|
|
2342
|
+
|
|
2343
|
+
/**
|
|
2344
|
+
* The type of key / signature scheme used for signing and verifying.
|
|
2345
|
+
*/
|
|
2346
|
+
export type SignatureAlgorithm = "ed25519" | "mlDsa44";
|
|
2347
|
+
|
|
2348
|
+
/**
|
|
2349
|
+
* Type of collection
|
|
2350
|
+
*/
|
|
2351
|
+
export type CollectionType = "SharedCollection" | "DefaultUserCollection";
|
|
2352
|
+
|
|
2353
|
+
/**
|
|
2354
|
+
* Type-safe authentication method for a Send, including the authentication data.
|
|
2355
|
+
* This ensures that password and email authentication are mutually exclusive.
|
|
2356
|
+
*/
|
|
2357
|
+
export type SendAuthType =
|
|
2358
|
+
| { type: "none" }
|
|
2359
|
+
| { type: "password"; password: string }
|
|
2360
|
+
| { type: "emails"; emails: string[] };
|
|
2361
|
+
|
|
2362
|
+
/**
|
|
2363
|
+
* View model for decrypted Send type
|
|
2364
|
+
*/
|
|
2365
|
+
export type SendViewType = { File: SendFileView } | { Text: SendTextView };
|
|
2366
|
+
|
|
2367
|
+
/**
|
|
2368
|
+
* View model for decrypted SendFile
|
|
2369
|
+
*/
|
|
2370
|
+
export interface SendFileView {
|
|
2371
|
+
/**
|
|
2372
|
+
* The file\'s ID
|
|
2373
|
+
*/
|
|
2374
|
+
id: string | undefined;
|
|
2375
|
+
/**
|
|
2376
|
+
* The file name
|
|
2377
|
+
*/
|
|
2378
|
+
fileName: string;
|
|
2379
|
+
/**
|
|
2380
|
+
* The file size in bytes as a string
|
|
2381
|
+
*/
|
|
2382
|
+
size: string | undefined;
|
|
2383
|
+
/**
|
|
2384
|
+
* Readable size, ex: \"4.2 KB\" or \"1.43 GB\
|
|
2385
|
+
*/
|
|
2386
|
+
sizeName: string | undefined;
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
/**
|
|
2390
|
+
* View model for decrypted SendText
|
|
2391
|
+
*/
|
|
2392
|
+
export interface SendTextView {
|
|
2393
|
+
/**
|
|
2394
|
+
* The text content of the send
|
|
2395
|
+
*/
|
|
2396
|
+
text: string | undefined;
|
|
2397
|
+
/**
|
|
2398
|
+
* Whether the text is hidden-by-default (masked as ********).
|
|
2399
|
+
*/
|
|
2400
|
+
hidden: boolean;
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
export interface AncestorMap {
|
|
2404
|
+
ancestors: Map<CollectionId, string>;
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
export interface Attachment {
|
|
2408
|
+
id: string | undefined;
|
|
2409
|
+
url: string | undefined;
|
|
2410
|
+
size: string | undefined;
|
|
2411
|
+
/**
|
|
2412
|
+
* Readable size, ex: \"4.2 KB\" or \"1.43 GB\
|
|
2413
|
+
*/
|
|
2414
|
+
sizeName: string | undefined;
|
|
2415
|
+
fileName: EncString | undefined;
|
|
2416
|
+
key: EncString | undefined;
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
export interface AttachmentView {
|
|
2420
|
+
id: string | undefined;
|
|
2421
|
+
url: string | undefined;
|
|
2422
|
+
size: string | undefined;
|
|
2423
|
+
sizeName: string | undefined;
|
|
2424
|
+
fileName: string | undefined;
|
|
2425
|
+
key: EncString | undefined;
|
|
2426
|
+
/**
|
|
2427
|
+
* The decrypted attachmentkey in base64 format.
|
|
2428
|
+
*
|
|
2429
|
+
* **TEMPORARY FIELD**: This field is a temporary workaround to provide
|
|
2430
|
+
* decrypted attachment keys to the TypeScript client during the migration
|
|
2431
|
+
* process. It will be removed once the encryption/decryption logic is
|
|
2432
|
+
* fully migrated to the SDK.
|
|
2433
|
+
*
|
|
2434
|
+
* **Ticket**: <https://bitwarden.atlassian.net/browse/PM-23005>
|
|
2435
|
+
*
|
|
2436
|
+
* Do not rely on this field for long-term use.
|
|
2437
|
+
*/
|
|
2438
|
+
decryptedKey: string | undefined;
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
export interface BankAccount {
|
|
2442
|
+
bankName: EncString | undefined;
|
|
2443
|
+
nameOnAccount: EncString | undefined;
|
|
2444
|
+
accountType: EncString | undefined;
|
|
2445
|
+
accountNumber: EncString | undefined;
|
|
2446
|
+
routingNumber: EncString | undefined;
|
|
2447
|
+
branchNumber: EncString | undefined;
|
|
2448
|
+
pin: EncString | undefined;
|
|
2449
|
+
swiftCode: EncString | undefined;
|
|
2450
|
+
iban: EncString | undefined;
|
|
2451
|
+
bankContactPhone: EncString | undefined;
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
export interface BankAccountView {
|
|
2455
|
+
bankName: string | undefined;
|
|
2456
|
+
nameOnAccount: string | undefined;
|
|
2457
|
+
accountType: string | undefined;
|
|
2458
|
+
accountNumber: string | undefined;
|
|
2459
|
+
routingNumber: string | undefined;
|
|
2460
|
+
branchNumber: string | undefined;
|
|
2461
|
+
pin: string | undefined;
|
|
2462
|
+
swiftCode: string | undefined;
|
|
2463
|
+
iban: string | undefined;
|
|
2464
|
+
bankContactPhone: string | undefined;
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
export interface Card {
|
|
2468
|
+
cardholderName: EncString | undefined;
|
|
2469
|
+
expMonth: EncString | undefined;
|
|
2470
|
+
expYear: EncString | undefined;
|
|
2471
|
+
code: EncString | undefined;
|
|
2472
|
+
brand: EncString | undefined;
|
|
2473
|
+
number: EncString | undefined;
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2476
|
+
export interface CardView {
|
|
2477
|
+
cardholderName: string | undefined;
|
|
2478
|
+
expMonth: string | undefined;
|
|
2479
|
+
expYear: string | undefined;
|
|
2480
|
+
code: string | undefined;
|
|
2481
|
+
brand: string | undefined;
|
|
2482
|
+
number: string | undefined;
|
|
2483
|
+
}
|
|
2484
|
+
|
|
2485
|
+
export interface Cipher {
|
|
2486
|
+
id: CipherId | undefined;
|
|
2487
|
+
organizationId: OrganizationId | undefined;
|
|
2488
|
+
folderId: FolderId | undefined;
|
|
2489
|
+
collectionIds: CollectionId[];
|
|
2490
|
+
/**
|
|
2491
|
+
* More recent ciphers uses individual encryption keys to encrypt the other fields of the
|
|
2492
|
+
* Cipher.
|
|
2493
|
+
*/
|
|
2494
|
+
key: EncString | undefined;
|
|
2495
|
+
name: EncString;
|
|
2496
|
+
notes: EncString | undefined;
|
|
2497
|
+
type: CipherType;
|
|
2498
|
+
login: Login | undefined;
|
|
2499
|
+
identity: Identity | undefined;
|
|
2500
|
+
card: Card | undefined;
|
|
2501
|
+
secureNote: SecureNote | undefined;
|
|
2502
|
+
sshKey: SshKey | undefined;
|
|
2503
|
+
bankAccount: BankAccount | undefined;
|
|
2504
|
+
favorite: boolean;
|
|
2505
|
+
reprompt: CipherRepromptType;
|
|
2506
|
+
organizationUseTotp: boolean;
|
|
2507
|
+
edit: boolean;
|
|
2508
|
+
permissions: CipherPermissions | undefined;
|
|
2509
|
+
viewPassword: boolean;
|
|
2510
|
+
localData: LocalData | undefined;
|
|
2511
|
+
attachments: Attachment[] | undefined;
|
|
2512
|
+
fields: Field[] | undefined;
|
|
2513
|
+
passwordHistory: PasswordHistory[] | undefined;
|
|
2514
|
+
creationDate: DateTime<Utc>;
|
|
2515
|
+
deletedDate: DateTime<Utc> | undefined;
|
|
2516
|
+
revisionDate: DateTime<Utc>;
|
|
2517
|
+
archivedDate: DateTime<Utc> | undefined;
|
|
2518
|
+
data: string | undefined;
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
export interface CipherListView {
|
|
2522
|
+
id: CipherId | undefined;
|
|
2523
|
+
organizationId: OrganizationId | undefined;
|
|
2524
|
+
folderId: FolderId | undefined;
|
|
2525
|
+
collectionIds: CollectionId[];
|
|
2526
|
+
/**
|
|
2527
|
+
* Temporary, required to support calculating TOTP from CipherListView.
|
|
2528
|
+
*/
|
|
2529
|
+
key: EncString | undefined;
|
|
2530
|
+
name: string;
|
|
2531
|
+
subtitle: string;
|
|
2532
|
+
type: CipherListViewType;
|
|
2533
|
+
favorite: boolean;
|
|
2534
|
+
reprompt: CipherRepromptType;
|
|
2535
|
+
organizationUseTotp: boolean;
|
|
2536
|
+
edit: boolean;
|
|
2537
|
+
permissions: CipherPermissions | undefined;
|
|
2538
|
+
viewPassword: boolean;
|
|
2539
|
+
/**
|
|
2540
|
+
* The number of attachments
|
|
2541
|
+
*/
|
|
2542
|
+
attachments: number;
|
|
2543
|
+
/**
|
|
2544
|
+
* Indicates if the cipher has old attachments that need to be re-uploaded
|
|
2545
|
+
*/
|
|
2546
|
+
hasOldAttachments: boolean;
|
|
2547
|
+
creationDate: DateTime<Utc>;
|
|
2548
|
+
deletedDate: DateTime<Utc> | undefined;
|
|
2549
|
+
revisionDate: DateTime<Utc>;
|
|
2550
|
+
archivedDate: DateTime<Utc> | undefined;
|
|
2551
|
+
/**
|
|
2552
|
+
* Hints for the presentation layer for which fields can be copied.
|
|
2553
|
+
*/
|
|
2554
|
+
copyableFields: CopyableCipherFields[];
|
|
2555
|
+
localData: LocalDataView | undefined;
|
|
2556
|
+
/**
|
|
2557
|
+
* Decrypted cipher notes for search indexing.
|
|
2558
|
+
*/
|
|
2559
|
+
notes: string | undefined;
|
|
2560
|
+
/**
|
|
2561
|
+
* Decrypted cipher fields for search indexing.
|
|
2562
|
+
* Only includes name and value (for text fields only).
|
|
2563
|
+
*/
|
|
2564
|
+
fields: FieldListView[] | undefined;
|
|
2565
|
+
/**
|
|
2566
|
+
* Decrypted attachment filenames for search indexing.
|
|
2567
|
+
*/
|
|
2568
|
+
attachmentNames: string[] | undefined;
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
export interface CipherPermissions {
|
|
2572
|
+
delete: boolean;
|
|
2573
|
+
restore: boolean;
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
export interface CipherView {
|
|
2577
|
+
id: CipherId | undefined;
|
|
2578
|
+
organizationId: OrganizationId | undefined;
|
|
2579
|
+
folderId: FolderId | undefined;
|
|
2580
|
+
collectionIds: CollectionId[];
|
|
2581
|
+
/**
|
|
2582
|
+
* Temporary, required to support re-encrypting existing items.
|
|
2583
|
+
*/
|
|
2584
|
+
key: EncString | undefined;
|
|
2585
|
+
name: string;
|
|
2586
|
+
notes: string | undefined;
|
|
2587
|
+
type: CipherType;
|
|
2588
|
+
login: LoginView | undefined;
|
|
2589
|
+
identity: IdentityView | undefined;
|
|
2590
|
+
card: CardView | undefined;
|
|
2591
|
+
secureNote: SecureNoteView | undefined;
|
|
2592
|
+
sshKey: SshKeyView | undefined;
|
|
2593
|
+
bankAccount: BankAccountView | undefined;
|
|
2594
|
+
favorite: boolean;
|
|
2595
|
+
reprompt: CipherRepromptType;
|
|
2596
|
+
organizationUseTotp: boolean;
|
|
2597
|
+
edit: boolean;
|
|
2598
|
+
permissions: CipherPermissions | undefined;
|
|
2599
|
+
viewPassword: boolean;
|
|
2600
|
+
localData: LocalDataView | undefined;
|
|
2601
|
+
attachments: AttachmentView[] | undefined;
|
|
2602
|
+
/**
|
|
2603
|
+
* Attachments that failed to decrypt. Only present when there are decryption failures.
|
|
2604
|
+
*/
|
|
2605
|
+
attachmentDecryptionFailures?: AttachmentView[];
|
|
2606
|
+
fields: FieldView[] | undefined;
|
|
2607
|
+
passwordHistory: PasswordHistoryView[] | undefined;
|
|
2608
|
+
creationDate: DateTime<Utc>;
|
|
2609
|
+
deletedDate: DateTime<Utc> | undefined;
|
|
2610
|
+
revisionDate: DateTime<Utc>;
|
|
2611
|
+
archivedDate: DateTime<Utc> | undefined;
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2614
|
+
export interface Collection {
|
|
2615
|
+
id: CollectionId | undefined;
|
|
2616
|
+
organizationId: OrganizationId;
|
|
2617
|
+
name: EncString;
|
|
2618
|
+
externalId: string | undefined;
|
|
2619
|
+
hidePasswords: boolean;
|
|
2620
|
+
readOnly: boolean;
|
|
2621
|
+
manage: boolean;
|
|
2622
|
+
defaultUserCollectionEmail: string | undefined;
|
|
2623
|
+
type: CollectionType;
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
export interface CollectionView {
|
|
2627
|
+
id: CollectionId | undefined;
|
|
2628
|
+
organizationId: OrganizationId;
|
|
2629
|
+
name: string;
|
|
2630
|
+
externalId: string | undefined;
|
|
2631
|
+
hidePasswords: boolean;
|
|
2632
|
+
readOnly: boolean;
|
|
2633
|
+
manage: boolean;
|
|
2634
|
+
type: CollectionType;
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
export interface EncryptionContext {
|
|
2638
|
+
/**
|
|
2639
|
+
* The Id of the user that encrypted the cipher. It should always represent a UserId, even for
|
|
2640
|
+
* Organization-owned ciphers
|
|
2641
|
+
*/
|
|
2642
|
+
encryptedFor: UserId;
|
|
2643
|
+
cipher: Cipher;
|
|
2644
|
+
}
|
|
2645
|
+
|
|
2646
|
+
export interface Fido2Credential {
|
|
2647
|
+
credentialId: EncString;
|
|
2648
|
+
keyType: EncString;
|
|
2649
|
+
keyAlgorithm: EncString;
|
|
2650
|
+
keyCurve: EncString;
|
|
2651
|
+
keyValue: EncString;
|
|
2652
|
+
rpId: EncString;
|
|
2653
|
+
userHandle: EncString | undefined;
|
|
2654
|
+
userName: EncString | undefined;
|
|
2655
|
+
counter: EncString;
|
|
2656
|
+
rpName: EncString | undefined;
|
|
2657
|
+
userDisplayName: EncString | undefined;
|
|
2658
|
+
discoverable: EncString;
|
|
2659
|
+
creationDate: DateTime<Utc>;
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2662
|
+
export interface Fido2CredentialFullView {
|
|
2663
|
+
credentialId: string;
|
|
2664
|
+
keyType: string;
|
|
2665
|
+
keyAlgorithm: string;
|
|
2666
|
+
keyCurve: string;
|
|
2667
|
+
keyValue: string;
|
|
2668
|
+
rpId: string;
|
|
2669
|
+
userHandle: string | undefined;
|
|
2670
|
+
userName: string | undefined;
|
|
2671
|
+
counter: string;
|
|
2672
|
+
rpName: string | undefined;
|
|
2673
|
+
userDisplayName: string | undefined;
|
|
2674
|
+
discoverable: string;
|
|
2675
|
+
creationDate: DateTime<Utc>;
|
|
2676
|
+
}
|
|
2677
|
+
|
|
2678
|
+
export interface Fido2CredentialListView {
|
|
2679
|
+
credentialId: string;
|
|
2680
|
+
rpId: string;
|
|
2681
|
+
userHandle: string | undefined;
|
|
2682
|
+
userName: string | undefined;
|
|
2683
|
+
userDisplayName: string | undefined;
|
|
2684
|
+
counter: string;
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
export interface Fido2CredentialNewView {
|
|
2688
|
+
credentialId: string;
|
|
2689
|
+
keyType: string;
|
|
2690
|
+
keyAlgorithm: string;
|
|
2691
|
+
keyCurve: string;
|
|
2692
|
+
rpId: string;
|
|
2693
|
+
userHandle: string | undefined;
|
|
2694
|
+
userName: string | undefined;
|
|
2695
|
+
counter: string;
|
|
2696
|
+
rpName: string | undefined;
|
|
2697
|
+
userDisplayName: string | undefined;
|
|
2698
|
+
creationDate: DateTime<Utc>;
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
export interface Fido2CredentialView {
|
|
2702
|
+
credentialId: string;
|
|
2703
|
+
keyType: string;
|
|
2704
|
+
keyAlgorithm: string;
|
|
2705
|
+
keyCurve: string;
|
|
2706
|
+
keyValue: EncString;
|
|
2707
|
+
rpId: string;
|
|
2708
|
+
userHandle: string | undefined;
|
|
2709
|
+
userName: string | undefined;
|
|
2710
|
+
counter: string;
|
|
2711
|
+
rpName: string | undefined;
|
|
2712
|
+
userDisplayName: string | undefined;
|
|
2713
|
+
discoverable: string;
|
|
2714
|
+
creationDate: DateTime<Utc>;
|
|
2715
|
+
}
|
|
2716
|
+
|
|
2717
|
+
export interface Field {
|
|
2718
|
+
name: EncString | undefined;
|
|
2719
|
+
value: EncString | undefined;
|
|
2720
|
+
type: FieldType;
|
|
2721
|
+
linkedId: LinkedIdType | undefined;
|
|
2722
|
+
}
|
|
2723
|
+
|
|
2724
|
+
export interface FieldView {
|
|
2725
|
+
name: string | undefined;
|
|
2726
|
+
value: string | undefined;
|
|
2727
|
+
type: FieldType;
|
|
2728
|
+
linkedId: LinkedIdType | undefined;
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2731
|
+
export interface Folder {
|
|
2732
|
+
id: FolderId | undefined;
|
|
2733
|
+
name: EncString;
|
|
2734
|
+
revisionDate: DateTime<Utc>;
|
|
2735
|
+
}
|
|
2736
|
+
|
|
2737
|
+
export interface FolderView {
|
|
2738
|
+
id: FolderId | undefined;
|
|
2739
|
+
name: string;
|
|
2740
|
+
revisionDate: DateTime<Utc>;
|
|
2741
|
+
}
|
|
2742
|
+
|
|
2743
|
+
export interface Identity {
|
|
2744
|
+
title: EncString | undefined;
|
|
2745
|
+
firstName: EncString | undefined;
|
|
2746
|
+
middleName: EncString | undefined;
|
|
2747
|
+
lastName: EncString | undefined;
|
|
2748
|
+
address1: EncString | undefined;
|
|
2749
|
+
address2: EncString | undefined;
|
|
2750
|
+
address3: EncString | undefined;
|
|
2751
|
+
city: EncString | undefined;
|
|
2752
|
+
state: EncString | undefined;
|
|
2753
|
+
postalCode: EncString | undefined;
|
|
2754
|
+
country: EncString | undefined;
|
|
2755
|
+
company: EncString | undefined;
|
|
2756
|
+
email: EncString | undefined;
|
|
2757
|
+
phone: EncString | undefined;
|
|
2758
|
+
ssn: EncString | undefined;
|
|
2759
|
+
username: EncString | undefined;
|
|
2760
|
+
passportNumber: EncString | undefined;
|
|
2761
|
+
licenseNumber: EncString | undefined;
|
|
2762
|
+
}
|
|
2763
|
+
|
|
2764
|
+
export interface IdentityView {
|
|
2765
|
+
title: string | undefined;
|
|
2766
|
+
firstName: string | undefined;
|
|
2767
|
+
middleName: string | undefined;
|
|
2768
|
+
lastName: string | undefined;
|
|
2769
|
+
address1: string | undefined;
|
|
2770
|
+
address2: string | undefined;
|
|
2771
|
+
address3: string | undefined;
|
|
2772
|
+
city: string | undefined;
|
|
2773
|
+
state: string | undefined;
|
|
2774
|
+
postalCode: string | undefined;
|
|
2775
|
+
country: string | undefined;
|
|
2776
|
+
company: string | undefined;
|
|
2777
|
+
email: string | undefined;
|
|
2778
|
+
phone: string | undefined;
|
|
2779
|
+
ssn: string | undefined;
|
|
2780
|
+
username: string | undefined;
|
|
2781
|
+
passportNumber: string | undefined;
|
|
2782
|
+
licenseNumber: string | undefined;
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2785
|
+
export interface LocalData {
|
|
2786
|
+
lastUsedDate: DateTime<Utc> | undefined;
|
|
2787
|
+
lastLaunched: DateTime<Utc> | undefined;
|
|
2788
|
+
}
|
|
2789
|
+
|
|
2790
|
+
export interface LocalDataView {
|
|
2791
|
+
lastUsedDate: DateTime<Utc> | undefined;
|
|
2792
|
+
lastLaunched: DateTime<Utc> | undefined;
|
|
2793
|
+
}
|
|
2794
|
+
|
|
2795
|
+
export interface Login {
|
|
2796
|
+
username: EncString | undefined;
|
|
2797
|
+
password: EncString | undefined;
|
|
2798
|
+
passwordRevisionDate: DateTime<Utc> | undefined;
|
|
2799
|
+
uris: LoginUri[] | undefined;
|
|
2800
|
+
totp: EncString | undefined;
|
|
2801
|
+
autofillOnPageLoad: boolean | undefined;
|
|
2802
|
+
fido2Credentials: Fido2Credential[] | undefined;
|
|
2803
|
+
}
|
|
2804
|
+
|
|
2805
|
+
export interface LoginListView {
|
|
2806
|
+
fido2Credentials: Fido2CredentialListView[] | undefined;
|
|
2807
|
+
hasFido2: boolean;
|
|
2808
|
+
username: string | undefined;
|
|
2809
|
+
/**
|
|
2810
|
+
* The TOTP key is not decrypted. Useable as is with [`crate::generate_totp_cipher_view`].
|
|
2811
|
+
*/
|
|
2812
|
+
totp: EncString | undefined;
|
|
2813
|
+
uris: LoginUriView[] | undefined;
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
export interface LoginUri {
|
|
2817
|
+
uri: EncString | undefined;
|
|
2818
|
+
match: UriMatchType | undefined;
|
|
2819
|
+
uriChecksum: EncString | undefined;
|
|
2820
|
+
}
|
|
2821
|
+
|
|
2822
|
+
export interface LoginUriView {
|
|
2823
|
+
uri: string | undefined;
|
|
2824
|
+
match: UriMatchType | undefined;
|
|
2825
|
+
uriChecksum: string | undefined;
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2828
|
+
export interface LoginView {
|
|
2829
|
+
username: string | undefined;
|
|
2830
|
+
password: string | undefined;
|
|
2831
|
+
passwordRevisionDate: DateTime<Utc> | undefined;
|
|
2832
|
+
uris: LoginUriView[] | undefined;
|
|
2833
|
+
totp: string | undefined;
|
|
2834
|
+
autofillOnPageLoad: boolean | undefined;
|
|
2835
|
+
fido2Credentials: Fido2Credential[] | undefined;
|
|
2836
|
+
}
|
|
2837
|
+
|
|
2838
|
+
export interface PasswordChangeAndRotateUserKeysRequest {
|
|
2839
|
+
old_password: string;
|
|
2840
|
+
password: string;
|
|
2841
|
+
hint: string | undefined;
|
|
2842
|
+
trusted_emergency_access_public_keys: PublicKey[];
|
|
2843
|
+
trusted_organization_public_keys: PublicKey[];
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
export interface PasswordHistory {
|
|
2847
|
+
password: EncString;
|
|
2848
|
+
lastUsedDate: DateTime<Utc>;
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
export interface PasswordHistoryView {
|
|
2852
|
+
password: string;
|
|
2853
|
+
lastUsedDate: DateTime<Utc>;
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
export interface Repositories {
|
|
2857
|
+
cipher: Repository<Cipher> | null;
|
|
2858
|
+
folder: Repository<Folder> | null;
|
|
2859
|
+
user_key_state: Repository<UserKeyState> | null;
|
|
2860
|
+
local_user_data_key_state: Repository<LocalUserDataKeyState> | null;
|
|
2861
|
+
ephemeral_pin_envelope_state: Repository<EphemeralPinEnvelopeState> | null;
|
|
2862
|
+
organization_shared_key: Repository<OrganizationSharedKey> | null;
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
export interface RotateUserKeysRequest {
|
|
2866
|
+
key_rotation_method: KeyRotationMethod;
|
|
2867
|
+
trusted_emergency_access_public_keys: PublicKey[];
|
|
2868
|
+
trusted_organization_public_keys: PublicKey[];
|
|
2869
|
+
}
|
|
2870
|
+
|
|
2871
|
+
export interface SecureNote {
|
|
2872
|
+
type: SecureNoteType;
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2875
|
+
export interface SecureNoteView {
|
|
2876
|
+
type: SecureNoteType;
|
|
2877
|
+
}
|
|
2878
|
+
|
|
2879
|
+
export interface Send {
|
|
2880
|
+
id: SendId | undefined;
|
|
2881
|
+
accessId: string | undefined;
|
|
2882
|
+
name: EncString;
|
|
2883
|
+
notes: EncString | undefined;
|
|
2884
|
+
key: EncString;
|
|
2885
|
+
password: string | undefined;
|
|
2886
|
+
type: SendType;
|
|
2887
|
+
file: SendFile | undefined;
|
|
2888
|
+
text: SendText | undefined;
|
|
2889
|
+
maxAccessCount: number | undefined;
|
|
2890
|
+
accessCount: number;
|
|
2891
|
+
disabled: boolean;
|
|
2892
|
+
hideEmail: boolean;
|
|
2893
|
+
revisionDate: DateTime<Utc>;
|
|
2894
|
+
deletionDate: DateTime<Utc>;
|
|
2895
|
+
expirationDate: DateTime<Utc> | undefined;
|
|
2896
|
+
/**
|
|
2897
|
+
* Email addresses for OTP authentication (comma-separated).
|
|
2898
|
+
*
|
|
2899
|
+
* **Note**: Mutually exclusive with `password`. If both `password` and `emails` are
|
|
2900
|
+
* set, password authentication takes precedence and email OTP is ignored.
|
|
2901
|
+
*/
|
|
2902
|
+
emails: string | undefined;
|
|
2903
|
+
authType: AuthType;
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2906
|
+
export interface SendListView {
|
|
2907
|
+
id: SendId | undefined;
|
|
2908
|
+
accessId: string | undefined;
|
|
2909
|
+
name: string;
|
|
2910
|
+
type: SendType;
|
|
2911
|
+
disabled: boolean;
|
|
2912
|
+
revisionDate: DateTime<Utc>;
|
|
2913
|
+
deletionDate: DateTime<Utc>;
|
|
2914
|
+
expirationDate: DateTime<Utc> | undefined;
|
|
2915
|
+
authType: AuthType;
|
|
2916
|
+
}
|
|
2917
|
+
|
|
2918
|
+
export interface SendView {
|
|
2919
|
+
id: SendId | undefined;
|
|
2920
|
+
accessId: string | undefined;
|
|
2921
|
+
name: string;
|
|
2922
|
+
notes: string | undefined;
|
|
2923
|
+
/**
|
|
2924
|
+
* Base64 encoded key
|
|
2925
|
+
*/
|
|
2926
|
+
key: string | undefined;
|
|
2927
|
+
/**
|
|
2928
|
+
* Replace or add a password to an existing send. The SDK will always return None when
|
|
2929
|
+
* decrypting a [Send]
|
|
2930
|
+
* TODO: We should revisit this, one variant is to have `[Create, Update]SendView` DTOs.
|
|
2931
|
+
*/
|
|
2932
|
+
newPassword: string | undefined;
|
|
2933
|
+
/**
|
|
2934
|
+
* Denote if an existing send has a password. The SDK will ignore this value when creating or
|
|
2935
|
+
* updating sends.
|
|
2936
|
+
*/
|
|
2937
|
+
hasPassword: boolean;
|
|
2938
|
+
type: SendType;
|
|
2939
|
+
file: SendFileView | undefined;
|
|
2940
|
+
text: SendTextView | undefined;
|
|
2941
|
+
maxAccessCount: number | undefined;
|
|
2942
|
+
accessCount: number;
|
|
2943
|
+
disabled: boolean;
|
|
2944
|
+
hideEmail: boolean;
|
|
2945
|
+
revisionDate: DateTime<Utc>;
|
|
2946
|
+
deletionDate: DateTime<Utc>;
|
|
2947
|
+
expirationDate: DateTime<Utc> | undefined;
|
|
2948
|
+
/**
|
|
2949
|
+
* Email addresses for OTP authentication.
|
|
2950
|
+
* **Note**: Mutually exclusive with `new_password`. If both are set, only password
|
|
2951
|
+
* authentication will be used. When creating or editing sends, use [crate::SendAuthType]
|
|
2952
|
+
* to ensure mutual exclusivity at the type level.
|
|
2953
|
+
*/
|
|
2954
|
+
emails: string[];
|
|
2955
|
+
authType: AuthType;
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2958
|
+
export interface SshKey {
|
|
2959
|
+
/**
|
|
2960
|
+
* SSH private key (ed25519/rsa) in unencrypted openssh private key format [OpenSSH private key](https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key)
|
|
2961
|
+
*/
|
|
2962
|
+
privateKey: EncString;
|
|
2963
|
+
/**
|
|
2964
|
+
* SSH public key (ed25519/rsa) according to [RFC4253](https://datatracker.ietf.org/doc/html/rfc4253#section-6.6)
|
|
2965
|
+
*/
|
|
2966
|
+
publicKey: EncString;
|
|
2967
|
+
/**
|
|
2968
|
+
* SSH fingerprint using SHA256 in the format: `SHA256:BASE64_ENCODED_FINGERPRINT`
|
|
2969
|
+
*/
|
|
2970
|
+
fingerprint: EncString;
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2973
|
+
export interface SshKeyView {
|
|
2974
|
+
/**
|
|
2975
|
+
* SSH private key (ed25519/rsa) in unencrypted openssh private key format [OpenSSH private key](https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key)
|
|
2976
|
+
*/
|
|
2977
|
+
privateKey: string;
|
|
2978
|
+
/**
|
|
2979
|
+
* SSH public key (ed25519/rsa) according to [RFC4253](https://datatracker.ietf.org/doc/html/rfc4253#section-6.6)
|
|
2980
|
+
*/
|
|
2981
|
+
publicKey: string;
|
|
2982
|
+
/**
|
|
2983
|
+
* SSH fingerprint using SHA256 in the format: `SHA256:BASE64_ENCODED_FINGERPRINT`
|
|
2984
|
+
*/
|
|
2985
|
+
fingerprint: string;
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
export interface TotpResponse {
|
|
2989
|
+
/**
|
|
2990
|
+
* Generated TOTP code
|
|
2991
|
+
*/
|
|
2992
|
+
code: string;
|
|
2993
|
+
/**
|
|
2994
|
+
* Time period
|
|
2995
|
+
*/
|
|
2996
|
+
period: number;
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2999
|
+
export interface TrustDeviceResponse {
|
|
3000
|
+
/**
|
|
3001
|
+
* Base64 encoded device key
|
|
3002
|
+
*/
|
|
3003
|
+
device_key: B64;
|
|
3004
|
+
/**
|
|
3005
|
+
* UserKey encrypted with DevicePublicKey
|
|
3006
|
+
*/
|
|
3007
|
+
protected_user_key: UnsignedSharedKey;
|
|
3008
|
+
/**
|
|
3009
|
+
* DevicePrivateKey encrypted with [DeviceKey]
|
|
3010
|
+
*/
|
|
3011
|
+
protected_device_private_key: EncString;
|
|
3012
|
+
/**
|
|
3013
|
+
* DevicePublicKey encrypted with [UserKey](super::UserKey)
|
|
3014
|
+
*/
|
|
3015
|
+
protected_device_public_key: EncString;
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
export type AppendType = "random" | { websiteName: { website: string } };
|
|
3019
|
+
|
|
3020
|
+
export type CipherListViewType =
|
|
3021
|
+
| { login: LoginListView }
|
|
3022
|
+
| "secureNote"
|
|
3023
|
+
| { card: CardListView }
|
|
3024
|
+
| "identity"
|
|
3025
|
+
| "sshKey"
|
|
3026
|
+
| "bankAccount";
|
|
3027
|
+
|
|
3028
|
+
export type DeviceType =
|
|
3029
|
+
| "Android"
|
|
3030
|
+
| "iOS"
|
|
3031
|
+
| "ChromeExtension"
|
|
3032
|
+
| "FirefoxExtension"
|
|
3033
|
+
| "OperaExtension"
|
|
3034
|
+
| "EdgeExtension"
|
|
3035
|
+
| "WindowsDesktop"
|
|
3036
|
+
| "MacOsDesktop"
|
|
3037
|
+
| "LinuxDesktop"
|
|
3038
|
+
| "ChromeBrowser"
|
|
3039
|
+
| "FirefoxBrowser"
|
|
3040
|
+
| "OperaBrowser"
|
|
3041
|
+
| "EdgeBrowser"
|
|
3042
|
+
| "IEBrowser"
|
|
3043
|
+
| "UnknownBrowser"
|
|
3044
|
+
| "AndroidAmazon"
|
|
3045
|
+
| "UWP"
|
|
3046
|
+
| "SafariBrowser"
|
|
3047
|
+
| "VivaldiBrowser"
|
|
3048
|
+
| "VivaldiExtension"
|
|
3049
|
+
| "SafariExtension"
|
|
3050
|
+
| "SDK"
|
|
3051
|
+
| "Server"
|
|
3052
|
+
| "WindowsCLI"
|
|
3053
|
+
| "MacOsCLI"
|
|
3054
|
+
| "LinuxCLI"
|
|
3055
|
+
| "DuckDuckGoBrowser";
|
|
3056
|
+
|
|
3057
|
+
export type ExportFormat = "Csv" | "Json" | { EncryptedJson: { password: string } };
|
|
3058
|
+
|
|
3059
|
+
export type KeyAlgorithm = "Ed25519" | "Rsa3072" | "Rsa4096";
|
|
3060
|
+
|
|
3061
|
+
export type KeyRotationMethod = { Password: { password: string } } | "KeyConnector" | "Tde";
|
|
3062
|
+
|
|
3063
|
+
export type LinkedIdType = LoginLinkedIdType | CardLinkedIdType | IdentityLinkedIdType;
|
|
3064
|
+
|
|
3065
|
+
export type PassphraseError = { InvalidNumWords: { minimum: number; maximum: number } };
|
|
3066
|
+
|
|
3067
|
+
export type UsernameGeneratorRequest =
|
|
3068
|
+
| { word: { capitalize: boolean; include_number: boolean } }
|
|
3069
|
+
| { subaddress: { type: AppendType; email: string } }
|
|
3070
|
+
| { catchall: { type: AppendType; domain: string } }
|
|
3071
|
+
| { forwarded: { service: ForwarderServiceType; website: string | undefined } };
|
|
3072
|
+
|
|
3073
|
+
export class AttachmentsClient {
|
|
3074
|
+
private constructor();
|
|
3075
|
+
free(): void;
|
|
3076
|
+
[Symbol.dispose](): void;
|
|
3077
|
+
decrypt_buffer(
|
|
3078
|
+
cipher: Cipher,
|
|
3079
|
+
attachment: AttachmentView,
|
|
3080
|
+
encrypted_buffer: Uint8Array,
|
|
3081
|
+
): Uint8Array;
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
/**
|
|
3085
|
+
* Subclient containing auth functionality.
|
|
3086
|
+
*/
|
|
3087
|
+
export class AuthClient {
|
|
3088
|
+
private constructor();
|
|
3089
|
+
free(): void;
|
|
3090
|
+
[Symbol.dispose](): void;
|
|
3091
|
+
/**
|
|
3092
|
+
* Client for login functionality
|
|
3093
|
+
*/
|
|
3094
|
+
login(client_settings: ClientSettings): LoginClient;
|
|
3095
|
+
/**
|
|
3096
|
+
* Client for initializing user account cryptography and unlock methods after JIT provisioning
|
|
3097
|
+
*/
|
|
3098
|
+
registration(): RegistrationClient;
|
|
3099
|
+
/**
|
|
3100
|
+
* Client for send access functionality
|
|
3101
|
+
*/
|
|
3102
|
+
send_access(): SendAccessClient;
|
|
3103
|
+
}
|
|
3104
|
+
|
|
3105
|
+
export enum CardLinkedIdType {
|
|
3106
|
+
CardholderName = 300,
|
|
3107
|
+
ExpMonth = 301,
|
|
3108
|
+
ExpYear = 302,
|
|
3109
|
+
Code = 303,
|
|
3110
|
+
Brand = 304,
|
|
3111
|
+
Number = 305,
|
|
3112
|
+
}
|
|
3113
|
+
|
|
3114
|
+
/**
|
|
3115
|
+
* Client for performing admin operations on ciphers. Unlike the regular CiphersClient,
|
|
3116
|
+
* this client uses the admin server API endpoints, and does not modify local state.
|
|
3117
|
+
*/
|
|
3118
|
+
export class CipherAdminClient {
|
|
3119
|
+
private constructor();
|
|
3120
|
+
free(): void;
|
|
3121
|
+
[Symbol.dispose](): void;
|
|
3122
|
+
/**
|
|
3123
|
+
* Creates a new [Cipher] for an organization, using the admin server endpoints.
|
|
3124
|
+
* Creates the Cipher on the server only, does not store it to local state.
|
|
3125
|
+
*/
|
|
3126
|
+
create(request: CipherCreateRequest): Promise<CipherView>;
|
|
3127
|
+
/**
|
|
3128
|
+
* Deletes the Cipher with the matching CipherId from the server, using the admin endpoint.
|
|
3129
|
+
* Affects server data only, does not modify local state.
|
|
3130
|
+
*/
|
|
3131
|
+
delete(cipher_id: CipherId): Promise<void>;
|
|
3132
|
+
/**
|
|
3133
|
+
* Deletes an attachment from a cipher using the admin endpoint.
|
|
3134
|
+
* Affects server data only, does not modify local state.
|
|
3135
|
+
*/
|
|
3136
|
+
delete_attachment(cipher_id: CipherId, attachment_id: string): Promise<void>;
|
|
3137
|
+
/**
|
|
3138
|
+
* Deletes all Cipher objects with a matching CipherId from the server, using the admin
|
|
3139
|
+
* endpoint. Affects server data only, does not modify local state.
|
|
3140
|
+
*/
|
|
3141
|
+
delete_many(cipher_ids: CipherId[], organization_id: OrganizationId): Promise<void>;
|
|
3142
|
+
/**
|
|
3143
|
+
* Edit an existing [Cipher] and save it to the server.
|
|
3144
|
+
*/
|
|
3145
|
+
edit(request: CipherEditRequest, original_cipher_view: CipherView): Promise<CipherView>;
|
|
3146
|
+
list_org_ciphers(
|
|
3147
|
+
org_id: OrganizationId,
|
|
3148
|
+
include_member_items: boolean,
|
|
3149
|
+
): Promise<ListOrganizationCiphersResult>;
|
|
3150
|
+
/**
|
|
3151
|
+
* Restores a soft-deleted cipher on the server, using the admin endpoint.
|
|
3152
|
+
*/
|
|
3153
|
+
restore(cipher_id: CipherId): Promise<CipherView>;
|
|
3154
|
+
/**
|
|
3155
|
+
* Restores multiple soft-deleted ciphers on the server.
|
|
3156
|
+
*/
|
|
3157
|
+
restore_many(cipher_ids: CipherId[], org_id: OrganizationId): Promise<DecryptCipherListResult>;
|
|
3158
|
+
/**
|
|
3159
|
+
* Soft-deletes the Cipher with the matching CipherId from the server, using the admin
|
|
3160
|
+
* endpoint. Affects server data only, does not modify local state.
|
|
3161
|
+
*/
|
|
3162
|
+
soft_delete(cipher_id: CipherId): Promise<void>;
|
|
3163
|
+
/**
|
|
3164
|
+
* Soft-deletes all Cipher objects for the given CipherIds from the server, using the admin
|
|
3165
|
+
* endpoint. Affects server data only, does not modify local state.
|
|
3166
|
+
*/
|
|
3167
|
+
soft_delete_many(cipher_ids: CipherId[], organization_id: OrganizationId): Promise<void>;
|
|
3168
|
+
/**
|
|
3169
|
+
* Adds the cipher matched by [CipherId] to any number of collections on the server.
|
|
3170
|
+
*/
|
|
3171
|
+
update_collection(cipher_id: CipherId, collection_ids: CollectionId[]): Promise<CipherView>;
|
|
3172
|
+
}
|
|
3173
|
+
|
|
3174
|
+
export enum CipherRepromptType {
|
|
3175
|
+
None = 0,
|
|
3176
|
+
Password = 1,
|
|
3177
|
+
}
|
|
3178
|
+
|
|
3179
|
+
/**
|
|
3180
|
+
* Client for evaluating credential risk for login ciphers.
|
|
3181
|
+
*/
|
|
3182
|
+
export class CipherRiskClient {
|
|
3183
|
+
private constructor();
|
|
3184
|
+
free(): void;
|
|
3185
|
+
[Symbol.dispose](): void;
|
|
3186
|
+
/**
|
|
3187
|
+
* Evaluate security risks for multiple login ciphers concurrently.
|
|
3188
|
+
*
|
|
3189
|
+
* For each cipher:
|
|
3190
|
+
* 1. Calculates password strength (0-4) using zxcvbn with cipher-specific context
|
|
3191
|
+
* 2. Optionally checks if the password has been exposed via Have I Been Pwned API
|
|
3192
|
+
* 3. Counts how many times the password is reused in the provided `password_map`
|
|
3193
|
+
*
|
|
3194
|
+
* Returns a vector of `CipherRisk` results, one for each input cipher.
|
|
3195
|
+
*
|
|
3196
|
+
* ## HIBP Check Results (`exposed_result` field)
|
|
3197
|
+
*
|
|
3198
|
+
* The `exposed_result` field uses the `ExposedPasswordResult` enum with three possible states:
|
|
3199
|
+
* - `NotChecked`: Password exposure check was not performed because:
|
|
3200
|
+
* - `check_exposed` option was `false`, or
|
|
3201
|
+
* - Password was empty
|
|
3202
|
+
* - `Found(n)`: Successfully checked via HIBP API, password appears in `n` data breaches
|
|
3203
|
+
* - `Error(msg)`: HIBP API request failed with error message `msg`
|
|
3204
|
+
*
|
|
3205
|
+
* # Errors
|
|
3206
|
+
*
|
|
3207
|
+
* This method only returns `Err` for internal logic failures. HIBP API errors are
|
|
3208
|
+
* captured per-cipher in the `exposed_result` field as `ExposedPasswordResult::Error(msg)`.
|
|
3209
|
+
*/
|
|
3210
|
+
compute_risk(
|
|
3211
|
+
login_details: CipherLoginDetails[],
|
|
3212
|
+
options: CipherRiskOptions,
|
|
3213
|
+
): Promise<CipherRiskResult[]>;
|
|
3214
|
+
/**
|
|
3215
|
+
* Build password reuse map for a list of login ciphers.
|
|
3216
|
+
*
|
|
3217
|
+
* Returns a map where keys are passwords and values are the number of times
|
|
3218
|
+
* each password appears in the provided list. This map can be passed to `compute_risk()`
|
|
3219
|
+
* to enable password reuse detection.
|
|
3220
|
+
*/
|
|
3221
|
+
password_reuse_map(login_details: CipherLoginDetails[]): PasswordReuseMap;
|
|
3222
|
+
}
|
|
3223
|
+
|
|
3224
|
+
export enum CipherType {
|
|
3225
|
+
Login = 1,
|
|
3226
|
+
SecureNote = 2,
|
|
3227
|
+
Card = 3,
|
|
3228
|
+
Identity = 4,
|
|
3229
|
+
SshKey = 5,
|
|
3230
|
+
BankAccount = 6,
|
|
3231
|
+
}
|
|
3232
|
+
|
|
3233
|
+
export class CiphersClient {
|
|
3234
|
+
private constructor();
|
|
3235
|
+
free(): void;
|
|
3236
|
+
[Symbol.dispose](): void;
|
|
3237
|
+
/**
|
|
3238
|
+
* Returns a new client for performing admin operations.
|
|
3239
|
+
* Uses the admin server API endpoints and does not modify local state.
|
|
3240
|
+
*/
|
|
3241
|
+
admin(): CipherAdminClient;
|
|
3242
|
+
/**
|
|
3243
|
+
* Creates a new [Cipher] and saves it to the server.
|
|
3244
|
+
*/
|
|
3245
|
+
create(request: CipherCreateRequest): Promise<CipherView>;
|
|
3246
|
+
decrypt(cipher: Cipher): Promise<CipherView>;
|
|
3247
|
+
decrypt_fido2_credentials(cipher_view: CipherView): Fido2CredentialView[];
|
|
3248
|
+
decrypt_fido2_private_key(cipher_view: CipherView): string;
|
|
3249
|
+
decrypt_list(ciphers: Cipher[]): Promise<CipherListView[]>;
|
|
3250
|
+
/**
|
|
3251
|
+
* Decrypt full cipher list
|
|
3252
|
+
* Returns both successfully fully decrypted ciphers and any that failed to decrypt
|
|
3253
|
+
*/
|
|
3254
|
+
decrypt_list_full_with_failures(ciphers: Cipher[]): Promise<DecryptCipherResult>;
|
|
3255
|
+
/**
|
|
3256
|
+
* Decrypt cipher list with failures
|
|
3257
|
+
* Returns both successfully decrypted ciphers and any that failed to decrypt
|
|
3258
|
+
*/
|
|
3259
|
+
decrypt_list_with_failures(ciphers: Cipher[]): Promise<DecryptCipherListResult>;
|
|
3260
|
+
/**
|
|
3261
|
+
* Deletes the [Cipher] with the matching [CipherId] from the server.
|
|
3262
|
+
*/
|
|
3263
|
+
delete(cipher_id: CipherId): Promise<void>;
|
|
3264
|
+
/**
|
|
3265
|
+
* Deletes an attachment from a cipher, and updates the local repository with the new cipher
|
|
3266
|
+
* data returned from the API.
|
|
3267
|
+
*/
|
|
3268
|
+
delete_attachment(cipher_id: CipherId, attachment_id: string): Promise<Cipher>;
|
|
3269
|
+
/**
|
|
3270
|
+
* Deletes all [Cipher] objects with a matching [CipherId] from the server.
|
|
3271
|
+
*/
|
|
3272
|
+
delete_many(cipher_ids: CipherId[], organization_id?: OrganizationId | null): Promise<void>;
|
|
3273
|
+
/**
|
|
3274
|
+
* Edit an existing [Cipher] and save it to the server.
|
|
3275
|
+
*/
|
|
3276
|
+
edit(request: CipherEditRequest): Promise<CipherView>;
|
|
3277
|
+
encrypt(cipher_view: CipherView): Promise<EncryptionContext>;
|
|
3278
|
+
/**
|
|
3279
|
+
* Encrypt a cipher with the provided key. This should only be used when rotating encryption
|
|
3280
|
+
* keys in the Web client.
|
|
3281
|
+
*
|
|
3282
|
+
* Until key rotation is fully implemented in the SDK, this method must be provided the new
|
|
3283
|
+
* symmetric key in base64 format. See PM-23084
|
|
3284
|
+
*
|
|
3285
|
+
* If the cipher has a CipherKey, it will be re-encrypted with the new key.
|
|
3286
|
+
* If the cipher does not have a CipherKey and CipherKeyEncryption is enabled, one will be
|
|
3287
|
+
* generated using the new key. Otherwise, the cipher's data will be encrypted with the new
|
|
3288
|
+
* key directly.
|
|
3289
|
+
*/
|
|
3290
|
+
encrypt_cipher_for_rotation(cipher_view: CipherView, new_key: B64): Promise<EncryptionContext>;
|
|
3291
|
+
/**
|
|
3292
|
+
* Encrypt a list of cipher views.
|
|
3293
|
+
*
|
|
3294
|
+
* This method attempts to encrypt all ciphers in the list. If any cipher
|
|
3295
|
+
* fails to encrypt, the entire operation fails and an error is returned.
|
|
3296
|
+
*/
|
|
3297
|
+
encrypt_list(cipher_views: CipherView[]): Promise<EncryptionContext[]>;
|
|
3298
|
+
/**
|
|
3299
|
+
* Get [Cipher] by ID from state and decrypt it to a [CipherView].
|
|
3300
|
+
*/
|
|
3301
|
+
get(cipher_id: string): Promise<CipherView>;
|
|
3302
|
+
/**
|
|
3303
|
+
* Get all ciphers from state and decrypt them to full [CipherView], returning both
|
|
3304
|
+
* successes and failures. This method will not fail when some ciphers fail to decrypt,
|
|
3305
|
+
* allowing for graceful handling of corrupted or problematic cipher data.
|
|
3306
|
+
*/
|
|
3307
|
+
get_all(): Promise<DecryptCipherResult>;
|
|
3308
|
+
/**
|
|
3309
|
+
* Get all ciphers from state and decrypt them to [crate::CipherListView], returning both
|
|
3310
|
+
* successes and failures. This method will not fail when some ciphers fail to decrypt,
|
|
3311
|
+
* allowing for graceful handling of corrupted or problematic cipher data.
|
|
3312
|
+
*/
|
|
3313
|
+
list(): Promise<DecryptCipherListResult>;
|
|
3314
|
+
move_to_organization(cipher_view: CipherView, organization_id: OrganizationId): CipherView;
|
|
3315
|
+
/**
|
|
3316
|
+
* Restores a soft-deleted cipher on the server.
|
|
3317
|
+
*/
|
|
3318
|
+
restore(cipher_id: CipherId): Promise<CipherView>;
|
|
3319
|
+
/**
|
|
3320
|
+
* Restores multiple soft-deleted ciphers on the server.
|
|
3321
|
+
*/
|
|
3322
|
+
restore_many(cipher_ids: CipherId[]): Promise<DecryptCipherListResult>;
|
|
3323
|
+
/**
|
|
3324
|
+
* Temporary method used to re-encrypt FIDO2 credentials for a cipher view.
|
|
3325
|
+
* Necessary until the TS clients utilize the SDK entirely for FIDO2 credentials management.
|
|
3326
|
+
* TS clients create decrypted FIDO2 credentials that need to be encrypted manually when
|
|
3327
|
+
* encrypting the rest of the CipherView.
|
|
3328
|
+
* TODO: Remove once TS passkey provider implementation uses SDK - PM-8313
|
|
3329
|
+
*/
|
|
3330
|
+
set_fido2_credentials(
|
|
3331
|
+
cipher_view: CipherView,
|
|
3332
|
+
fido2_credentials: Fido2CredentialFullView[],
|
|
3333
|
+
): CipherView;
|
|
3334
|
+
/**
|
|
3335
|
+
* Moves a cipher into an organization, adds it to collections, and calls the share_cipher API.
|
|
3336
|
+
*/
|
|
3337
|
+
share_cipher(
|
|
3338
|
+
cipher_view: CipherView,
|
|
3339
|
+
organization_id: OrganizationId,
|
|
3340
|
+
collection_ids: CollectionId[],
|
|
3341
|
+
original_cipher_view?: CipherView | null,
|
|
3342
|
+
): Promise<CipherView>;
|
|
3343
|
+
/**
|
|
3344
|
+
* Moves a group of ciphers into an organization, adds them to collections, and calls the
|
|
3345
|
+
* share_ciphers API.
|
|
3346
|
+
*/
|
|
3347
|
+
share_ciphers_bulk(
|
|
3348
|
+
cipher_views: CipherView[],
|
|
3349
|
+
organization_id: OrganizationId,
|
|
3350
|
+
collection_ids: CollectionId[],
|
|
3351
|
+
): Promise<CipherView[]>;
|
|
3352
|
+
/**
|
|
3353
|
+
* Soft-deletes the [Cipher] with the matching [CipherId] from the server.
|
|
3354
|
+
*/
|
|
3355
|
+
soft_delete(cipher_id: CipherId): Promise<void>;
|
|
3356
|
+
/**
|
|
3357
|
+
* Soft-deletes all [Cipher] objects for the given [CipherId]s from the server.
|
|
3358
|
+
*/
|
|
3359
|
+
soft_delete_many(cipher_ids: CipherId[], organization_id?: OrganizationId | null): Promise<void>;
|
|
3360
|
+
/**
|
|
3361
|
+
* Adds the cipher matched by [CipherId] to any number of collections on the server.
|
|
3362
|
+
*/
|
|
3363
|
+
update_collection(
|
|
3364
|
+
cipher_id: CipherId,
|
|
3365
|
+
collection_ids: CollectionId[],
|
|
3366
|
+
is_admin: boolean,
|
|
3367
|
+
): Promise<CipherView>;
|
|
3368
|
+
}
|
|
3369
|
+
|
|
3370
|
+
export class CollectionViewNodeItem {
|
|
3371
|
+
private constructor();
|
|
3372
|
+
free(): void;
|
|
3373
|
+
[Symbol.dispose](): void;
|
|
3374
|
+
get_ancestors(): AncestorMap;
|
|
3375
|
+
get_children(): CollectionView[];
|
|
3376
|
+
get_item(): CollectionView;
|
|
3377
|
+
get_parent(): CollectionView | undefined;
|
|
3378
|
+
}
|
|
3379
|
+
|
|
3380
|
+
export class CollectionViewTree {
|
|
3381
|
+
private constructor();
|
|
3382
|
+
free(): void;
|
|
3383
|
+
[Symbol.dispose](): void;
|
|
3384
|
+
get_flat_items(): CollectionViewNodeItem[];
|
|
3385
|
+
get_item_for_view(collection_view: CollectionView): CollectionViewNodeItem | undefined;
|
|
3386
|
+
get_root_items(): CollectionViewNodeItem[];
|
|
3387
|
+
}
|
|
3388
|
+
|
|
3389
|
+
export class CollectionsClient {
|
|
3390
|
+
private constructor();
|
|
3391
|
+
free(): void;
|
|
3392
|
+
[Symbol.dispose](): void;
|
|
3393
|
+
decrypt(collection: Collection): CollectionView;
|
|
3394
|
+
decrypt_list(collections: Collection[]): CollectionView[];
|
|
3395
|
+
/**
|
|
3396
|
+
*
|
|
3397
|
+
* Returns the vector of CollectionView objects in a tree structure based on its implemented
|
|
3398
|
+
* path().
|
|
3399
|
+
*/
|
|
3400
|
+
get_collection_tree(collections: CollectionView[]): CollectionViewTree;
|
|
3401
|
+
}
|
|
3402
|
+
|
|
3403
|
+
/**
|
|
3404
|
+
* A client for the crypto operations.
|
|
3405
|
+
*/
|
|
3406
|
+
export class CryptoClient {
|
|
3407
|
+
private constructor();
|
|
3408
|
+
free(): void;
|
|
3409
|
+
[Symbol.dispose](): void;
|
|
3410
|
+
/**
|
|
3411
|
+
* A stop gap-solution for decrypting with the local user data key, until the WASM client's
|
|
3412
|
+
* password generator history encryption and email forwarders encryption is fully migrated to
|
|
3413
|
+
* SDK.
|
|
3414
|
+
*/
|
|
3415
|
+
decrypt_with_local_user_data_key(encrypted_plaintext: string): string;
|
|
3416
|
+
/**
|
|
3417
|
+
* A stop gap-solution for encrypting with the local user data key, until the WASM client's
|
|
3418
|
+
* password generator history encryption and email forwarders encryption is fully migrated to
|
|
3419
|
+
* SDK.
|
|
3420
|
+
*/
|
|
3421
|
+
encrypt_with_local_user_data_key(plaintext: string): string;
|
|
3422
|
+
/**
|
|
3423
|
+
* Protects the current user key with the provided PIN. The result can be stored and later
|
|
3424
|
+
* used to initialize another client instance by using the PIN and the PIN key with
|
|
3425
|
+
* `initialize_user_crypto`.
|
|
3426
|
+
*/
|
|
3427
|
+
enroll_pin(pin: string): EnrollPinResponse;
|
|
3428
|
+
/**
|
|
3429
|
+
* Protects the current user key with the provided PIN. The result can be stored and later
|
|
3430
|
+
* used to initialize another client instance by using the PIN and the PIN key with
|
|
3431
|
+
* `initialize_user_crypto`. The provided pin is encrypted with the user key.
|
|
3432
|
+
*/
|
|
3433
|
+
enroll_pin_with_encrypted_pin(encrypted_pin: string): EnrollPinResponse;
|
|
3434
|
+
/**
|
|
3435
|
+
* Takes a raw key and returns the corresponding key id. This is used for the biometrics
|
|
3436
|
+
* subsystem and should be removed after moving over biometric management to the SDK.
|
|
3437
|
+
*/
|
|
3438
|
+
get_key_id_for_symmetric_key(key: Uint8Array): Uint8Array | undefined;
|
|
3439
|
+
/**
|
|
3440
|
+
* ⚠️⚠️⚠️ HAZMAT WARNING: DO NOT USE THIS ⚠️⚠️⚠️
|
|
3441
|
+
*
|
|
3442
|
+
* Get the uses's decrypted encryption key. Note: It's very important
|
|
3443
|
+
* to keep this key safe, as it can be used to decrypt all of the user's data. It is
|
|
3444
|
+
* only permitted to use for a transition period where side effects such as biometrics
|
|
3445
|
+
* and never-lock are set from within the client code.
|
|
3446
|
+
*/
|
|
3447
|
+
get_user_encryption_key(): Promise<B64>;
|
|
3448
|
+
/**
|
|
3449
|
+
* Creates a rotated set of account keys for the current state
|
|
3450
|
+
*/
|
|
3451
|
+
get_v2_rotated_account_keys(): UserCryptoV2KeysResponse;
|
|
3452
|
+
/**
|
|
3453
|
+
* Initialization method for the organization crypto. Needs to be called after
|
|
3454
|
+
* `initialize_user_crypto` but before any other crypto operations.
|
|
3455
|
+
*/
|
|
3456
|
+
initialize_org_crypto(req: InitOrgCryptoRequest): Promise<void>;
|
|
3457
|
+
/**
|
|
3458
|
+
* Initialization method for the user crypto. Needs to be called before any other crypto
|
|
3459
|
+
* operations.
|
|
3460
|
+
*/
|
|
3461
|
+
initialize_user_crypto(req: InitUserCryptoRequest): Promise<void>;
|
|
3462
|
+
/**
|
|
3463
|
+
* Generates a new key pair and encrypts the private key with the provided user key.
|
|
3464
|
+
* Crypto initialization not required.
|
|
3465
|
+
*/
|
|
3466
|
+
make_key_pair(user_key: B64): MakeKeyPairResponse;
|
|
3467
|
+
/**
|
|
3468
|
+
* Makes a new signing key pair and signs the public key for the user
|
|
3469
|
+
*/
|
|
3470
|
+
make_keys_for_user_crypto_v2(): UserCryptoV2KeysResponse;
|
|
3471
|
+
/**
|
|
3472
|
+
* Create the data necessary to update the user's kdf settings. The user's encryption key is
|
|
3473
|
+
* re-encrypted for the password under the new kdf settings. This returns the re-encrypted
|
|
3474
|
+
* user key and the new password hash but does not update sdk state.
|
|
3475
|
+
*/
|
|
3476
|
+
make_update_kdf(password: string, kdf: Kdf): Promise<UpdateKdfResponse>;
|
|
3477
|
+
/**
|
|
3478
|
+
* Decrypts a `PasswordProtectedKeyEnvelope`, returning the user key, if successful.
|
|
3479
|
+
* This is a stop-gap solution, until initialization of the SDK is used.
|
|
3480
|
+
*/
|
|
3481
|
+
unseal_password_protected_key_envelope(pin: string, envelope: string): Uint8Array;
|
|
3482
|
+
/**
|
|
3483
|
+
* Verifies a user's asymmetric keys by decrypting the private key with the provided user
|
|
3484
|
+
* key. Returns if the private key is decryptable and if it is a valid matching key.
|
|
3485
|
+
* Crypto initialization not required.
|
|
3486
|
+
*/
|
|
3487
|
+
verify_asymmetric_keys(request: VerifyAsymmetricKeysRequest): VerifyAsymmetricKeysResponse;
|
|
3488
|
+
}
|
|
3489
|
+
|
|
3490
|
+
export class ExporterClient {
|
|
3491
|
+
private constructor();
|
|
3492
|
+
free(): void;
|
|
3493
|
+
[Symbol.dispose](): void;
|
|
3494
|
+
/**
|
|
3495
|
+
* Credential Exchange Format (CXF)
|
|
3496
|
+
*
|
|
3497
|
+
* *Warning:* Expect this API to be unstable, and it will change in the future.
|
|
3498
|
+
*
|
|
3499
|
+
* For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
|
|
3500
|
+
* Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
|
|
3501
|
+
*/
|
|
3502
|
+
export_cxf(account: Account, ciphers: Cipher[]): string;
|
|
3503
|
+
export_organization_vault(
|
|
3504
|
+
collections: Collection[],
|
|
3505
|
+
ciphers: Cipher[],
|
|
3506
|
+
format: ExportFormat,
|
|
3507
|
+
): string;
|
|
3508
|
+
export_vault(folders: Folder[], ciphers: Cipher[], format: ExportFormat): Promise<string>;
|
|
3509
|
+
/**
|
|
3510
|
+
* Credential Exchange Format (CXF)
|
|
3511
|
+
*
|
|
3512
|
+
* *Warning:* Expect this API to be unstable, and it will change in the future.
|
|
3513
|
+
*
|
|
3514
|
+
* For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
|
|
3515
|
+
* Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
|
|
3516
|
+
*/
|
|
3517
|
+
import_cxf(payload: string): Cipher[];
|
|
3518
|
+
}
|
|
3519
|
+
|
|
3
3520
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* # Arguments
|
|
7
|
-
* - `key_algorithm` - The algorithm to use for the key pair
|
|
8
|
-
*
|
|
9
|
-
* # Returns
|
|
10
|
-
* - `Ok(SshKey)` if the key was successfully generated
|
|
11
|
-
* - `Err(KeyGenerationError)` if the key could not be generated
|
|
3521
|
+
* Represents the type of a [FieldView].
|
|
12
3522
|
*/
|
|
13
|
-
export
|
|
3523
|
+
export enum FieldType {
|
|
3524
|
+
/**
|
|
3525
|
+
* Text field
|
|
3526
|
+
*/
|
|
3527
|
+
Text = 0,
|
|
3528
|
+
/**
|
|
3529
|
+
* Hidden text field
|
|
3530
|
+
*/
|
|
3531
|
+
Hidden = 1,
|
|
3532
|
+
/**
|
|
3533
|
+
* Boolean field
|
|
3534
|
+
*/
|
|
3535
|
+
Boolean = 2,
|
|
3536
|
+
/**
|
|
3537
|
+
* Linked field
|
|
3538
|
+
*/
|
|
3539
|
+
Linked = 3,
|
|
3540
|
+
}
|
|
3541
|
+
|
|
14
3542
|
/**
|
|
15
|
-
*
|
|
16
|
-
* to an OpenSSH private key with public key and fingerprint
|
|
17
|
-
*
|
|
18
|
-
* # Arguments
|
|
19
|
-
* - `imported_key` - The private key to convert
|
|
20
|
-
* - `password` - The password to use for decrypting the key
|
|
3543
|
+
* WASM client for reading Flight Recorder logs.
|
|
21
3544
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
3545
|
+
* The underlying buffer is global (initialized in [`init_sdk`](crate::init_sdk)),
|
|
3546
|
+
* so this client is a stateless handle for WASM access.
|
|
3547
|
+
*/
|
|
3548
|
+
export class FlightRecorderClient {
|
|
3549
|
+
free(): void;
|
|
3550
|
+
[Symbol.dispose](): void;
|
|
3551
|
+
/**
|
|
3552
|
+
* Get the current event count without reading event contents.
|
|
3553
|
+
*/
|
|
3554
|
+
count(): number;
|
|
3555
|
+
/**
|
|
3556
|
+
* Create a new `FlightRecorderClient`.
|
|
3557
|
+
*/
|
|
3558
|
+
constructor();
|
|
3559
|
+
/**
|
|
3560
|
+
* Read all events currently in the Flight Recorder buffer.
|
|
3561
|
+
*/
|
|
3562
|
+
read(): FlightRecorderEvent[];
|
|
3563
|
+
}
|
|
3564
|
+
|
|
3565
|
+
/**
|
|
3566
|
+
* Wrapper for folder specific functionality.
|
|
3567
|
+
*/
|
|
3568
|
+
export class FoldersClient {
|
|
3569
|
+
private constructor();
|
|
3570
|
+
free(): void;
|
|
3571
|
+
[Symbol.dispose](): void;
|
|
3572
|
+
/**
|
|
3573
|
+
* Create a new [Folder] and save it to the server.
|
|
3574
|
+
*/
|
|
3575
|
+
create(request: FolderAddEditRequest): Promise<FolderView>;
|
|
3576
|
+
/**
|
|
3577
|
+
* Encrypt a [Folder] to [FolderView].
|
|
3578
|
+
*/
|
|
3579
|
+
decrypt(folder: Folder): FolderView;
|
|
3580
|
+
/**
|
|
3581
|
+
* Decrypt a list of [Folder]s to a list of [FolderView]s.
|
|
3582
|
+
*/
|
|
3583
|
+
decrypt_list(folders: Folder[]): FolderView[];
|
|
3584
|
+
/**
|
|
3585
|
+
* Edit the [Folder] and save it to the server.
|
|
3586
|
+
*/
|
|
3587
|
+
edit(folder_id: FolderId, request: FolderAddEditRequest): Promise<FolderView>;
|
|
3588
|
+
/**
|
|
3589
|
+
* Encrypt a [FolderView] to a [Folder].
|
|
3590
|
+
*/
|
|
3591
|
+
encrypt(folder_view: FolderView): Folder;
|
|
3592
|
+
/**
|
|
3593
|
+
* Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
|
|
3594
|
+
*/
|
|
3595
|
+
get(folder_id: FolderId): Promise<FolderView>;
|
|
3596
|
+
/**
|
|
3597
|
+
* Get all folders from state and decrypt them to a list of [FolderView].
|
|
3598
|
+
*/
|
|
3599
|
+
list(): Promise<FolderView[]>;
|
|
3600
|
+
}
|
|
3601
|
+
|
|
3602
|
+
export class GeneratorClient {
|
|
3603
|
+
private constructor();
|
|
3604
|
+
free(): void;
|
|
3605
|
+
[Symbol.dispose](): void;
|
|
3606
|
+
/**
|
|
3607
|
+
* Generates a random passphrase.
|
|
3608
|
+
* A passphrase is a combination of random words separated by a character.
|
|
3609
|
+
* An example of passphrase is `correct horse battery staple`.
|
|
3610
|
+
*
|
|
3611
|
+
* The number of words and their case, the word separator, and the inclusion of
|
|
3612
|
+
* a number in the passphrase can be customized using the `input` parameter.
|
|
3613
|
+
*
|
|
3614
|
+
* # Examples
|
|
3615
|
+
*
|
|
3616
|
+
* ```
|
|
3617
|
+
* use bitwarden_core::Client;
|
|
3618
|
+
* use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
|
|
3619
|
+
*
|
|
3620
|
+
* async fn test() -> Result<(), PassphraseError> {
|
|
3621
|
+
* let input = PassphraseGeneratorRequest {
|
|
3622
|
+
* num_words: 4,
|
|
3623
|
+
* ..Default::default()
|
|
3624
|
+
* };
|
|
3625
|
+
* let passphrase = Client::new(None).generator().passphrase(input).unwrap();
|
|
3626
|
+
* println!("{}", passphrase);
|
|
3627
|
+
* Ok(())
|
|
3628
|
+
* }
|
|
3629
|
+
* ```
|
|
3630
|
+
*/
|
|
3631
|
+
passphrase(input: PassphraseGeneratorRequest): string;
|
|
3632
|
+
/**
|
|
3633
|
+
* Generates a random password.
|
|
3634
|
+
*
|
|
3635
|
+
* The character sets and password length can be customized using the `input` parameter.
|
|
3636
|
+
*
|
|
3637
|
+
* # Examples
|
|
3638
|
+
*
|
|
3639
|
+
* ```
|
|
3640
|
+
* use bitwarden_core::Client;
|
|
3641
|
+
* use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
|
|
3642
|
+
*
|
|
3643
|
+
* async fn test() -> Result<(), PassphraseError> {
|
|
3644
|
+
* let input = PasswordGeneratorRequest {
|
|
3645
|
+
* lowercase: true,
|
|
3646
|
+
* uppercase: true,
|
|
3647
|
+
* numbers: true,
|
|
3648
|
+
* length: 20,
|
|
3649
|
+
* ..Default::default()
|
|
3650
|
+
* };
|
|
3651
|
+
* let password = Client::new(None).generator().password(input).unwrap();
|
|
3652
|
+
* println!("{}", password);
|
|
3653
|
+
* Ok(())
|
|
3654
|
+
* }
|
|
3655
|
+
* ```
|
|
3656
|
+
*/
|
|
3657
|
+
password(input: PasswordGeneratorRequest): string;
|
|
3658
|
+
}
|
|
3659
|
+
|
|
3660
|
+
export enum IdentityLinkedIdType {
|
|
3661
|
+
Title = 400,
|
|
3662
|
+
MiddleName = 401,
|
|
3663
|
+
Address1 = 402,
|
|
3664
|
+
Address2 = 403,
|
|
3665
|
+
Address3 = 404,
|
|
3666
|
+
City = 405,
|
|
3667
|
+
State = 406,
|
|
3668
|
+
PostalCode = 407,
|
|
3669
|
+
Country = 408,
|
|
3670
|
+
Company = 409,
|
|
3671
|
+
Email = 410,
|
|
3672
|
+
Phone = 411,
|
|
3673
|
+
Ssn = 412,
|
|
3674
|
+
Username = 413,
|
|
3675
|
+
PassportNumber = 414,
|
|
3676
|
+
LicenseNumber = 415,
|
|
3677
|
+
FirstName = 416,
|
|
3678
|
+
LastName = 417,
|
|
3679
|
+
FullName = 418,
|
|
3680
|
+
}
|
|
3681
|
+
|
|
3682
|
+
/**
|
|
3683
|
+
* An untyped IPC message received from another endpoint.
|
|
3684
|
+
*/
|
|
3685
|
+
export class IncomingMessage {
|
|
3686
|
+
free(): void;
|
|
3687
|
+
[Symbol.dispose](): void;
|
|
3688
|
+
/**
|
|
3689
|
+
* Create an incoming IPC message from raw payload bytes.
|
|
3690
|
+
*/
|
|
3691
|
+
constructor(payload: Uint8Array, destination: Endpoint, source: Source, topic?: string | null);
|
|
3692
|
+
/**
|
|
3693
|
+
* Try to parse the payload as JSON.
|
|
3694
|
+
* @returns The parsed JSON value, or undefined if the payload is not valid JSON.
|
|
3695
|
+
*/
|
|
3696
|
+
parse_payload_as_json(): any;
|
|
3697
|
+
/**
|
|
3698
|
+
* Destination endpoint that received this message.
|
|
3699
|
+
*/
|
|
3700
|
+
destination: Endpoint;
|
|
3701
|
+
/**
|
|
3702
|
+
* Serialized payload bytes.
|
|
3703
|
+
*/
|
|
3704
|
+
payload: Uint8Array;
|
|
3705
|
+
/**
|
|
3706
|
+
* Source that sent this message, with per-variant metadata.
|
|
3707
|
+
*/
|
|
3708
|
+
source: Source;
|
|
3709
|
+
/**
|
|
3710
|
+
* Optional topic used for routing/dispatch.
|
|
3711
|
+
*/
|
|
3712
|
+
get topic(): string | undefined;
|
|
3713
|
+
/**
|
|
3714
|
+
* Optional topic used for routing/dispatch.
|
|
3715
|
+
*/
|
|
3716
|
+
set topic(value: string | null | undefined);
|
|
3717
|
+
}
|
|
3718
|
+
|
|
3719
|
+
/**
|
|
3720
|
+
* JavaScript wrapper around the IPC client. For more information, see the
|
|
3721
|
+
* [`IpcClient`] trait documentation.
|
|
3722
|
+
*/
|
|
3723
|
+
export class IpcClient {
|
|
3724
|
+
private constructor();
|
|
3725
|
+
free(): void;
|
|
3726
|
+
[Symbol.dispose](): void;
|
|
3727
|
+
isRunning(): boolean;
|
|
3728
|
+
/**
|
|
3729
|
+
* Create a new `IpcClient` instance with a client-managed session repository for saving
|
|
3730
|
+
* sessions using State Provider.
|
|
3731
|
+
*/
|
|
3732
|
+
static newWithClientManagedSessions(
|
|
3733
|
+
communication_provider: IpcCommunicationBackend,
|
|
3734
|
+
session_repository: IpcSessionRepository,
|
|
3735
|
+
): IpcClient;
|
|
3736
|
+
/**
|
|
3737
|
+
* Create a new `IpcClient` instance with an in-memory session repository for saving
|
|
3738
|
+
* sessions within the SDK.
|
|
3739
|
+
*/
|
|
3740
|
+
static newWithSdkInMemorySessions(communication_provider: IpcCommunicationBackend): IpcClient;
|
|
3741
|
+
send(message: OutgoingMessage): Promise<void>;
|
|
3742
|
+
start(abort_signal?: AbortSignal | null): Promise<void>;
|
|
3743
|
+
subscribe(): Promise<IpcClientSubscription>;
|
|
3744
|
+
}
|
|
3745
|
+
|
|
3746
|
+
/**
|
|
3747
|
+
* JavaScript wrapper around the IPC client subscription. For more information, see the
|
|
3748
|
+
* [IpcClientSubscription](crate::IpcClientSubscription) documentation.
|
|
3749
|
+
*/
|
|
3750
|
+
export class IpcClientSubscription {
|
|
3751
|
+
private constructor();
|
|
3752
|
+
free(): void;
|
|
3753
|
+
[Symbol.dispose](): void;
|
|
3754
|
+
receive(abort_signal?: AbortSignal | null): Promise<IncomingMessage>;
|
|
3755
|
+
}
|
|
3756
|
+
|
|
3757
|
+
/**
|
|
3758
|
+
* JavaScript implementation of the `CommunicationBackend` trait for IPC communication.
|
|
28
3759
|
*/
|
|
29
|
-
export
|
|
3760
|
+
export class IpcCommunicationBackend {
|
|
3761
|
+
free(): void;
|
|
3762
|
+
[Symbol.dispose](): void;
|
|
3763
|
+
/**
|
|
3764
|
+
* Creates a new instance of the JavaScript communication backend.
|
|
3765
|
+
*/
|
|
3766
|
+
constructor(sender: IpcCommunicationBackendSender);
|
|
3767
|
+
/**
|
|
3768
|
+
* Used by JavaScript to provide an incoming message to the IPC framework.
|
|
3769
|
+
*/
|
|
3770
|
+
receive(message: IncomingMessage): void;
|
|
3771
|
+
}
|
|
3772
|
+
|
|
30
3773
|
export enum LogLevel {
|
|
31
3774
|
Trace = 0,
|
|
32
3775
|
Debug = 1,
|
|
@@ -34,316 +3777,700 @@ export enum LogLevel {
|
|
|
34
3777
|
Warn = 3,
|
|
35
3778
|
Error = 4,
|
|
36
3779
|
}
|
|
37
|
-
|
|
3780
|
+
|
|
3781
|
+
/**
|
|
3782
|
+
* Client for authenticating Bitwarden users.
|
|
3783
|
+
*
|
|
3784
|
+
* Handles unauthenticated operations to obtain access tokens from the Identity API.
|
|
3785
|
+
* After successful authentication, use the returned tokens to create an authenticated core client.
|
|
3786
|
+
*
|
|
3787
|
+
* # Lifecycle
|
|
3788
|
+
*
|
|
3789
|
+
* 1. Create `LoginClient` via `AuthClient`
|
|
3790
|
+
* 2. Call login method
|
|
3791
|
+
* 3. Use returned tokens with authenticated core client
|
|
3792
|
+
*
|
|
3793
|
+
* # Password Login Example
|
|
3794
|
+
*
|
|
3795
|
+
* ```rust,no_run
|
|
3796
|
+
* # use bitwarden_auth::{AuthClient, login::login_via_password::PasswordLoginRequest};
|
|
3797
|
+
* # use bitwarden_auth::login::models::{LoginRequest, LoginDeviceRequest, LoginResponse};
|
|
3798
|
+
* # use bitwarden_core::{Client, ClientSettings, DeviceType};
|
|
3799
|
+
* # async fn example(email: String, password: String) -> Result<(), Box<dyn std::error::Error>> {
|
|
3800
|
+
* // Create auth client
|
|
3801
|
+
* let client = Client::new(None);
|
|
3802
|
+
* let auth_client = AuthClient::new(client);
|
|
3803
|
+
*
|
|
3804
|
+
* // Configure client settings and create login client
|
|
3805
|
+
* let settings = ClientSettings {
|
|
3806
|
+
* identity_url: "https://identity.bitwarden.com".to_string(),
|
|
3807
|
+
* api_url: "https://api.bitwarden.com".to_string(),
|
|
3808
|
+
* user_agent: "MyApp/1.0".to_string(),
|
|
3809
|
+
* device_type: DeviceType::SDK,
|
|
3810
|
+
* device_identifier: None,
|
|
3811
|
+
* bitwarden_client_version: None,
|
|
3812
|
+
* bitwarden_package_type: None,
|
|
3813
|
+
* };
|
|
3814
|
+
* let login_client = auth_client.login(settings);
|
|
3815
|
+
*
|
|
3816
|
+
* // Get user's KDF config
|
|
3817
|
+
* let prelogin = login_client.get_password_prelogin(email.clone()).await?;
|
|
3818
|
+
*
|
|
3819
|
+
* // Login with credentials
|
|
3820
|
+
* let response = login_client.login_via_password(PasswordLoginRequest {
|
|
3821
|
+
* login_request: LoginRequest {
|
|
3822
|
+
* client_id: "connector".to_string(),
|
|
3823
|
+
* device: LoginDeviceRequest {
|
|
3824
|
+
* device_type: DeviceType::SDK,
|
|
3825
|
+
* device_identifier: "device-id".to_string(),
|
|
3826
|
+
* device_name: "My Device".to_string(),
|
|
3827
|
+
* device_push_token: None,
|
|
3828
|
+
* },
|
|
3829
|
+
* },
|
|
3830
|
+
* email,
|
|
3831
|
+
* password,
|
|
3832
|
+
* prelogin_response: prelogin,
|
|
3833
|
+
* }).await?;
|
|
3834
|
+
*
|
|
3835
|
+
* // Use tokens from response for authenticated requests
|
|
3836
|
+
* match response {
|
|
3837
|
+
* LoginResponse::Authenticated(success) => {
|
|
3838
|
+
* let access_token = success.access_token;
|
|
3839
|
+
* // Use access_token for authenticated requests
|
|
3840
|
+
* }
|
|
3841
|
+
* }
|
|
3842
|
+
* # Ok(())
|
|
3843
|
+
* # }
|
|
3844
|
+
* ```
|
|
3845
|
+
*/
|
|
3846
|
+
export class LoginClient {
|
|
3847
|
+
private constructor();
|
|
3848
|
+
free(): void;
|
|
3849
|
+
[Symbol.dispose](): void;
|
|
38
3850
|
/**
|
|
39
|
-
*
|
|
3851
|
+
* Retrieves the data required before authenticating with a password.
|
|
3852
|
+
* This includes the user's KDF configuration needed to properly derive the master key.
|
|
40
3853
|
*/
|
|
41
|
-
|
|
3854
|
+
get_password_prelogin(email: string): Promise<PasswordPreloginResponse>;
|
|
42
3855
|
/**
|
|
43
|
-
*
|
|
3856
|
+
* Authenticates a user via email and master password.
|
|
3857
|
+
*
|
|
3858
|
+
* Derives the master password hash using KDF settings from prelogin, then sends
|
|
3859
|
+
* the authentication request to obtain access tokens and vault keys.
|
|
44
3860
|
*/
|
|
45
|
-
|
|
3861
|
+
login_via_password(request: PasswordLoginRequest): Promise<LoginResponse>;
|
|
3862
|
+
}
|
|
3863
|
+
|
|
3864
|
+
export enum LoginLinkedIdType {
|
|
3865
|
+
Username = 100,
|
|
3866
|
+
Password = 101,
|
|
3867
|
+
}
|
|
3868
|
+
|
|
3869
|
+
/**
|
|
3870
|
+
* An untyped IPC message to be sent to another endpoint.
|
|
3871
|
+
*/
|
|
3872
|
+
export class OutgoingMessage {
|
|
3873
|
+
free(): void;
|
|
3874
|
+
[Symbol.dispose](): void;
|
|
46
3875
|
/**
|
|
47
|
-
*
|
|
3876
|
+
* Create an outgoing IPC message from raw payload bytes.
|
|
48
3877
|
*/
|
|
49
|
-
|
|
3878
|
+
constructor(payload: Uint8Array, destination: Endpoint, topic?: string | null);
|
|
50
3879
|
/**
|
|
51
|
-
*
|
|
3880
|
+
* Create a new message and encode the payload as JSON.
|
|
52
3881
|
*/
|
|
53
|
-
|
|
3882
|
+
static new_json_payload(
|
|
3883
|
+
payload: any,
|
|
3884
|
+
destination: Endpoint,
|
|
3885
|
+
topic?: string | null,
|
|
3886
|
+
): OutgoingMessage;
|
|
3887
|
+
/**
|
|
3888
|
+
* Destination endpoint for this message.
|
|
3889
|
+
*/
|
|
3890
|
+
destination: Endpoint;
|
|
3891
|
+
/**
|
|
3892
|
+
* Serialized payload bytes.
|
|
3893
|
+
*/
|
|
3894
|
+
payload: Uint8Array;
|
|
3895
|
+
/**
|
|
3896
|
+
* Optional topic used for routing/dispatch.
|
|
3897
|
+
*/
|
|
3898
|
+
get topic(): string | undefined;
|
|
3899
|
+
/**
|
|
3900
|
+
* Optional topic used for routing/dispatch.
|
|
3901
|
+
*/
|
|
3902
|
+
set topic(value: string | null | undefined);
|
|
54
3903
|
}
|
|
55
3904
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
3905
|
+
/**
|
|
3906
|
+
* The main entry point for the Bitwarden SDK in WebAssembly environments
|
|
3907
|
+
*/
|
|
3908
|
+
export class PasswordManagerClient {
|
|
3909
|
+
free(): void;
|
|
3910
|
+
[Symbol.dispose](): void;
|
|
3911
|
+
/**
|
|
3912
|
+
* Auth related operations.
|
|
3913
|
+
*/
|
|
3914
|
+
auth(): AuthClient;
|
|
3915
|
+
/**
|
|
3916
|
+
* Crypto related operations.
|
|
3917
|
+
*/
|
|
3918
|
+
crypto(): CryptoClient;
|
|
3919
|
+
/**
|
|
3920
|
+
* Test method, echoes back the input
|
|
3921
|
+
*/
|
|
3922
|
+
echo(msg: string): string;
|
|
3923
|
+
/**
|
|
3924
|
+
* Exporter related operations.
|
|
3925
|
+
*/
|
|
3926
|
+
exporters(): ExporterClient;
|
|
3927
|
+
/**
|
|
3928
|
+
* Constructs a specific client for generating passwords and passphrases
|
|
3929
|
+
*/
|
|
3930
|
+
generator(): GeneratorClient;
|
|
3931
|
+
/**
|
|
3932
|
+
* Test method, calls http endpoint
|
|
3933
|
+
*/
|
|
3934
|
+
http_get(url: string): Promise<string>;
|
|
3935
|
+
/**
|
|
3936
|
+
* Initialize a new instance of the SDK client
|
|
3937
|
+
*/
|
|
3938
|
+
constructor(token_provider: any, settings?: ClientSettings | null);
|
|
3939
|
+
/**
|
|
3940
|
+
* Constructs a specific client for platform-specific functionality
|
|
3941
|
+
*/
|
|
3942
|
+
platform(): PlatformClient;
|
|
3943
|
+
/**
|
|
3944
|
+
* Send related operations.
|
|
3945
|
+
*/
|
|
3946
|
+
sends(): SendClient;
|
|
3947
|
+
/**
|
|
3948
|
+
* Test method, always throws an error
|
|
3949
|
+
*/
|
|
3950
|
+
throw(msg: string): void;
|
|
3951
|
+
/**
|
|
3952
|
+
* User crypto management related operations.
|
|
3953
|
+
*/
|
|
3954
|
+
user_crypto_management(): UserCryptoManagementClient;
|
|
3955
|
+
/**
|
|
3956
|
+
* Vault item related operations.
|
|
3957
|
+
*/
|
|
3958
|
+
vault(): VaultClient;
|
|
3959
|
+
/**
|
|
3960
|
+
* Returns the current SDK version
|
|
3961
|
+
*/
|
|
3962
|
+
version(): string;
|
|
3963
|
+
}
|
|
69
3964
|
|
|
70
|
-
export
|
|
71
|
-
|
|
72
|
-
|
|
3965
|
+
export class PlatformClient {
|
|
3966
|
+
private constructor();
|
|
3967
|
+
free(): void;
|
|
3968
|
+
[Symbol.dispose](): void;
|
|
3969
|
+
/**
|
|
3970
|
+
* Load feature flags into the client
|
|
3971
|
+
*/
|
|
3972
|
+
load_flags(flags: FeatureFlags): Promise<void>;
|
|
3973
|
+
state(): StateClient;
|
|
3974
|
+
}
|
|
73
3975
|
|
|
74
|
-
|
|
3976
|
+
/**
|
|
3977
|
+
* This module represents a stopgap solution to provide access to primitive crypto functions for JS
|
|
3978
|
+
* clients. It is not intended to be used outside of the JS clients and this pattern should not be
|
|
3979
|
+
* proliferated. It is necessary because we want to use SDK crypto prior to the SDK being fully
|
|
3980
|
+
* responsible for state and keys.
|
|
3981
|
+
*/
|
|
3982
|
+
export class PureCrypto {
|
|
3983
|
+
private constructor();
|
|
3984
|
+
free(): void;
|
|
3985
|
+
[Symbol.dispose](): void;
|
|
3986
|
+
/**
|
|
3987
|
+
* Decapsulates (decrypts) a symmetric key using an decapsulation-key/private-key in PKCS8
|
|
3988
|
+
* DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
|
|
3989
|
+
* recipient.
|
|
3990
|
+
*/
|
|
3991
|
+
static decapsulate_key_unsigned(
|
|
3992
|
+
encapsulated_key: string,
|
|
3993
|
+
decapsulation_key: Uint8Array,
|
|
3994
|
+
): Uint8Array;
|
|
3995
|
+
static decrypt_user_key_with_master_key(
|
|
3996
|
+
encrypted_user_key: string,
|
|
3997
|
+
master_key: Uint8Array,
|
|
3998
|
+
): Uint8Array;
|
|
3999
|
+
static decrypt_user_key_with_master_password(
|
|
4000
|
+
encrypted_user_key: string,
|
|
4001
|
+
master_password: string,
|
|
4002
|
+
email: string,
|
|
4003
|
+
kdf: Kdf,
|
|
4004
|
+
): Uint8Array;
|
|
4005
|
+
/**
|
|
4006
|
+
* Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
|
|
4007
|
+
*/
|
|
4008
|
+
static derive_kdf_material(password: Uint8Array, salt: Uint8Array, kdf: Kdf): Uint8Array;
|
|
4009
|
+
/**
|
|
4010
|
+
* Encapsulates (encrypts) a symmetric key using an public-key/encapsulation-key
|
|
4011
|
+
* in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
|
|
4012
|
+
* the sender's authenticity cannot be verified by the recipient.
|
|
4013
|
+
*/
|
|
4014
|
+
static encapsulate_key_unsigned(shared_key: Uint8Array, encapsulation_key: Uint8Array): string;
|
|
4015
|
+
static encrypt_user_key_with_master_password(
|
|
4016
|
+
user_key: Uint8Array,
|
|
4017
|
+
master_password: string,
|
|
4018
|
+
email: string,
|
|
4019
|
+
kdf: Kdf,
|
|
4020
|
+
): string;
|
|
4021
|
+
/**
|
|
4022
|
+
* Returns the algorithm used for the given verifying key.
|
|
4023
|
+
*/
|
|
4024
|
+
static key_algorithm_for_verifying_key(verifying_key: Uint8Array): SignatureAlgorithm;
|
|
4025
|
+
static make_user_key_aes256_cbc_hmac(): Uint8Array;
|
|
4026
|
+
static make_user_key_xchacha20_poly1305(): Uint8Array;
|
|
4027
|
+
/**
|
|
4028
|
+
* Generates a cryptographically secure random number between the given min and max
|
|
4029
|
+
* (inclusive).
|
|
4030
|
+
*/
|
|
4031
|
+
static random_number(min: number, max: number): number;
|
|
4032
|
+
/**
|
|
4033
|
+
* Decrypts data using RSAES-OAEP with SHA-1
|
|
4034
|
+
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
4035
|
+
*/
|
|
4036
|
+
static rsa_decrypt_data(encrypted_data: Uint8Array, private_key: Uint8Array): Uint8Array;
|
|
4037
|
+
/**
|
|
4038
|
+
* Encrypts data using RSAES-OAEP with SHA-1
|
|
4039
|
+
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
4040
|
+
*/
|
|
4041
|
+
static rsa_encrypt_data(plain_data: Uint8Array, public_key: Uint8Array): Uint8Array;
|
|
4042
|
+
/**
|
|
4043
|
+
* Given a decrypted private RSA key PKCS8 DER this
|
|
4044
|
+
* returns the corresponding public RSA key in DER format.
|
|
4045
|
+
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
4046
|
+
*/
|
|
4047
|
+
static rsa_extract_public_key(private_key: Uint8Array): Uint8Array;
|
|
4048
|
+
/**
|
|
4049
|
+
* Generates a new RSA key pair and returns the private key
|
|
4050
|
+
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
4051
|
+
*/
|
|
4052
|
+
static rsa_generate_keypair(): Uint8Array;
|
|
75
4053
|
/**
|
|
76
|
-
*
|
|
4054
|
+
* DEPRECATED: Use `symmetric_decrypt_string` instead.
|
|
4055
|
+
* Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
|
|
77
4056
|
*/
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface MakeKeyPairResponse {
|
|
4057
|
+
static symmetric_decrypt(enc_string: string, key: Uint8Array): string;
|
|
82
4058
|
/**
|
|
83
|
-
*
|
|
4059
|
+
* DEPRECATED: Use `symmetric_decrypt_filedata` instead.
|
|
4060
|
+
* Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
|
|
84
4061
|
*/
|
|
85
|
-
|
|
4062
|
+
static symmetric_decrypt_array_buffer(enc_bytes: Uint8Array, key: Uint8Array): Uint8Array;
|
|
4063
|
+
static symmetric_decrypt_bytes(enc_string: string, key: Uint8Array): Uint8Array;
|
|
4064
|
+
static symmetric_decrypt_filedata(enc_bytes: Uint8Array, key: Uint8Array): Uint8Array;
|
|
4065
|
+
static symmetric_decrypt_string(enc_string: string, key: Uint8Array): string;
|
|
86
4066
|
/**
|
|
87
|
-
*
|
|
4067
|
+
* DEPRECATED: Only used by send keys
|
|
88
4068
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
export interface VerifyAsymmetricKeysRequest {
|
|
4069
|
+
static symmetric_encrypt_bytes(plain: Uint8Array, key: Uint8Array): string;
|
|
4070
|
+
static symmetric_encrypt_filedata(plain: Uint8Array, key: Uint8Array): Uint8Array;
|
|
4071
|
+
static symmetric_encrypt_string(plain: string, key: Uint8Array): string;
|
|
93
4072
|
/**
|
|
94
|
-
*
|
|
4073
|
+
* Unwraps (decrypts) a wrapped PKCS8 DER encoded decapsulation (private) key using a symmetric
|
|
4074
|
+
* wrapping key.
|
|
95
4075
|
*/
|
|
96
|
-
|
|
4076
|
+
static unwrap_decapsulation_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
|
|
97
4077
|
/**
|
|
98
|
-
*
|
|
4078
|
+
* Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
|
|
4079
|
+
* wrapping key.
|
|
99
4080
|
*/
|
|
100
|
-
|
|
4081
|
+
static unwrap_encapsulation_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
|
|
101
4082
|
/**
|
|
102
|
-
*
|
|
4083
|
+
* Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
|
|
4084
|
+
* unwrapped key as a serialized byte array.
|
|
103
4085
|
*/
|
|
104
|
-
|
|
4086
|
+
static unwrap_symmetric_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
|
|
4087
|
+
/**
|
|
4088
|
+
* For a given signing identity (verifying key), this function verifies that the signing
|
|
4089
|
+
* identity claimed ownership of the public key. This is a one-sided claim and merely shows
|
|
4090
|
+
* that the signing identity has the intent to receive messages encrypted to the public
|
|
4091
|
+
* key.
|
|
4092
|
+
*/
|
|
4093
|
+
static verify_and_unwrap_signed_public_key(
|
|
4094
|
+
signed_public_key: Uint8Array,
|
|
4095
|
+
verifying_key: Uint8Array,
|
|
4096
|
+
): Uint8Array;
|
|
4097
|
+
/**
|
|
4098
|
+
* Given a wrapped signing key and the symmetric key it is wrapped with, this returns
|
|
4099
|
+
* the corresponding verifying key.
|
|
4100
|
+
*/
|
|
4101
|
+
static verifying_key_for_signing_key(signing_key: string, wrapping_key: Uint8Array): Uint8Array;
|
|
4102
|
+
/**
|
|
4103
|
+
* Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
|
|
4104
|
+
* key,
|
|
4105
|
+
*/
|
|
4106
|
+
static wrap_decapsulation_key(decapsulation_key: Uint8Array, wrapping_key: Uint8Array): string;
|
|
4107
|
+
/**
|
|
4108
|
+
* Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
|
|
4109
|
+
* key. Note: Usually, a public key is - by definition - public, so this should not be
|
|
4110
|
+
* used. The specific use-case for this function is to enable rotateable key sets, where
|
|
4111
|
+
* the "public key" is not public, with the intent of preventing the server from being able
|
|
4112
|
+
* to overwrite the user key unlocked by the rotateable keyset.
|
|
4113
|
+
*/
|
|
4114
|
+
static wrap_encapsulation_key(encapsulation_key: Uint8Array, wrapping_key: Uint8Array): string;
|
|
4115
|
+
/**
|
|
4116
|
+
* Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
|
|
4117
|
+
* as an EncString.
|
|
4118
|
+
*/
|
|
4119
|
+
static wrap_symmetric_key(key_to_be_wrapped: Uint8Array, wrapping_key: Uint8Array): string;
|
|
105
4120
|
}
|
|
106
4121
|
|
|
107
|
-
|
|
4122
|
+
/**
|
|
4123
|
+
* Client for initializing a user account.
|
|
4124
|
+
*/
|
|
4125
|
+
export class RegistrationClient {
|
|
4126
|
+
private constructor();
|
|
4127
|
+
free(): void;
|
|
4128
|
+
[Symbol.dispose](): void;
|
|
108
4129
|
/**
|
|
109
|
-
*
|
|
4130
|
+
* Initializes a new cryptographic state for a user and posts it to the server;
|
|
4131
|
+
* enrolls the user to master password unlock.
|
|
110
4132
|
*/
|
|
111
|
-
|
|
4133
|
+
post_keys_for_jit_password_registration(
|
|
4134
|
+
request: JitMasterPasswordRegistrationRequest,
|
|
4135
|
+
): Promise<JitMasterPasswordRegistrationResponse>;
|
|
112
4136
|
/**
|
|
113
|
-
*
|
|
4137
|
+
* Initializes a new cryptographic state for a user and posts it to the server; enrolls the
|
|
4138
|
+
* user to key connector unlock.
|
|
114
4139
|
*/
|
|
115
|
-
|
|
4140
|
+
post_keys_for_key_connector_registration(
|
|
4141
|
+
key_connector_url: string,
|
|
4142
|
+
sso_org_identifier: string,
|
|
4143
|
+
): Promise<KeyConnectorRegistrationResult>;
|
|
4144
|
+
/**
|
|
4145
|
+
* Initializes a new cryptographic state for a user and posts it to the server; enrolls in
|
|
4146
|
+
* admin password reset and finally enrolls the user to TDE unlock.
|
|
4147
|
+
*/
|
|
4148
|
+
post_keys_for_tde_registration(request: TdeRegistrationRequest): Promise<TdeRegistrationResponse>;
|
|
116
4149
|
}
|
|
117
4150
|
|
|
118
|
-
export
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
| "NotAuthenticated"
|
|
124
|
-
| "AccessTokenInvalid"
|
|
125
|
-
| "InvalidResponse"
|
|
126
|
-
| "Crypto"
|
|
127
|
-
| "IdentityFail"
|
|
128
|
-
| "Reqwest"
|
|
129
|
-
| "Serde"
|
|
130
|
-
| "Io"
|
|
131
|
-
| "InvalidBase64"
|
|
132
|
-
| "Chrono"
|
|
133
|
-
| "ResponseContent"
|
|
134
|
-
| "ValidationError"
|
|
135
|
-
| "InvalidStateFileVersion"
|
|
136
|
-
| "InvalidStateFile"
|
|
137
|
-
| "Internal"
|
|
138
|
-
| "EncryptionSettings";
|
|
4151
|
+
export enum RsaError {
|
|
4152
|
+
Decryption = 0,
|
|
4153
|
+
Encryption = 1,
|
|
4154
|
+
KeyParse = 2,
|
|
4155
|
+
KeySerialize = 3,
|
|
139
4156
|
}
|
|
140
4157
|
|
|
141
|
-
export
|
|
142
|
-
|
|
143
|
-
export interface EncryptionSettingsError extends Error {
|
|
144
|
-
name: "EncryptionSettingsError";
|
|
145
|
-
variant: "Crypto" | "InvalidBase64" | "VaultLocked" | "InvalidPrivateKey" | "MissingPrivateKey";
|
|
4158
|
+
export enum SecureNoteType {
|
|
4159
|
+
Generic = 0,
|
|
146
4160
|
}
|
|
147
4161
|
|
|
148
|
-
export function isEncryptionSettingsError(error: any): error is EncryptionSettingsError;
|
|
149
|
-
|
|
150
|
-
export type DeviceType =
|
|
151
|
-
| "Android"
|
|
152
|
-
| "iOS"
|
|
153
|
-
| "ChromeExtension"
|
|
154
|
-
| "FirefoxExtension"
|
|
155
|
-
| "OperaExtension"
|
|
156
|
-
| "EdgeExtension"
|
|
157
|
-
| "WindowsDesktop"
|
|
158
|
-
| "MacOsDesktop"
|
|
159
|
-
| "LinuxDesktop"
|
|
160
|
-
| "ChromeBrowser"
|
|
161
|
-
| "FirefoxBrowser"
|
|
162
|
-
| "OperaBrowser"
|
|
163
|
-
| "EdgeBrowser"
|
|
164
|
-
| "IEBrowser"
|
|
165
|
-
| "UnknownBrowser"
|
|
166
|
-
| "AndroidAmazon"
|
|
167
|
-
| "UWP"
|
|
168
|
-
| "SafariBrowser"
|
|
169
|
-
| "VivaldiBrowser"
|
|
170
|
-
| "VivaldiExtension"
|
|
171
|
-
| "SafariExtension"
|
|
172
|
-
| "SDK"
|
|
173
|
-
| "Server"
|
|
174
|
-
| "WindowsCLI"
|
|
175
|
-
| "MacOsCLI"
|
|
176
|
-
| "LinuxCLI";
|
|
177
|
-
|
|
178
4162
|
/**
|
|
179
|
-
*
|
|
180
|
-
* Bitwarden Client. They are optional and uneditable once the client is initialized.
|
|
181
|
-
*
|
|
182
|
-
* Defaults to
|
|
183
|
-
*
|
|
184
|
-
* ```
|
|
185
|
-
* # use bitwarden_core::{ClientSettings, DeviceType};
|
|
186
|
-
* let settings = ClientSettings {
|
|
187
|
-
* identity_url: \"https://identity.bitwarden.com\".to_string(),
|
|
188
|
-
* api_url: \"https://api.bitwarden.com\".to_string(),
|
|
189
|
-
* user_agent: \"Bitwarden Rust-SDK\".to_string(),
|
|
190
|
-
* device_type: DeviceType::SDK,
|
|
191
|
-
* };
|
|
192
|
-
* let default = ClientSettings::default();
|
|
193
|
-
* ```
|
|
4163
|
+
* The `SendAccessClient` is used to interact with the Bitwarden API to get send access tokens.
|
|
194
4164
|
*/
|
|
195
|
-
export
|
|
4165
|
+
export class SendAccessClient {
|
|
4166
|
+
private constructor();
|
|
4167
|
+
free(): void;
|
|
4168
|
+
[Symbol.dispose](): void;
|
|
196
4169
|
/**
|
|
197
|
-
*
|
|
4170
|
+
* Requests a new send access token.
|
|
198
4171
|
*/
|
|
199
|
-
|
|
4172
|
+
request_send_access_token(request: SendAccessTokenRequest): Promise<SendAccessTokenResponse>;
|
|
4173
|
+
}
|
|
4174
|
+
|
|
4175
|
+
export class SendClient {
|
|
4176
|
+
private constructor();
|
|
4177
|
+
free(): void;
|
|
4178
|
+
[Symbol.dispose](): void;
|
|
200
4179
|
/**
|
|
201
|
-
*
|
|
4180
|
+
* Create a new [Send] and save it to the server.
|
|
202
4181
|
*/
|
|
203
|
-
|
|
4182
|
+
create(request: SendAddRequest): Promise<SendView>;
|
|
204
4183
|
/**
|
|
205
|
-
*
|
|
4184
|
+
* Edit the [Send] and save it to the server.
|
|
206
4185
|
*/
|
|
207
|
-
|
|
4186
|
+
edit(send_id: SendId, request: SendEditRequest): Promise<SendView>;
|
|
208
4187
|
/**
|
|
209
|
-
*
|
|
4188
|
+
* Get a specific [Send] by its ID from state and decrypt it to a [SendView].
|
|
210
4189
|
*/
|
|
211
|
-
|
|
4190
|
+
get(send_id: SendId): Promise<SendView>;
|
|
4191
|
+
/**
|
|
4192
|
+
* Get all sends from state and decrypt them to a list of [SendView].
|
|
4193
|
+
*/
|
|
4194
|
+
list(): Promise<SendView[]>;
|
|
212
4195
|
}
|
|
213
4196
|
|
|
214
|
-
export type AsymmetricEncString = string;
|
|
215
|
-
|
|
216
|
-
export type EncString = string;
|
|
217
|
-
|
|
218
4197
|
/**
|
|
219
|
-
*
|
|
4198
|
+
* JavaScript wrapper for ServerCommunicationConfigClient
|
|
220
4199
|
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
4200
|
+
* This provides TypeScript access to the server communication configuration client,
|
|
4201
|
+
* allowing clients to check bootstrap requirements and retrieve cookies for HTTP requests.
|
|
223
4202
|
*/
|
|
224
|
-
export
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
export interface SshKey {
|
|
4203
|
+
export class ServerCommunicationConfigClient {
|
|
4204
|
+
free(): void;
|
|
4205
|
+
[Symbol.dispose](): void;
|
|
229
4206
|
/**
|
|
230
|
-
*
|
|
4207
|
+
* Acquires a cookie from the platform and saves it to the repository
|
|
4208
|
+
*
|
|
4209
|
+
* This method calls the platform API to trigger cookie acquisition (e.g., browser
|
|
4210
|
+
* redirect to IdP), then validates and stores the acquired cookie in the repository.
|
|
4211
|
+
*
|
|
4212
|
+
* # Arguments
|
|
4213
|
+
*
|
|
4214
|
+
* * `domain` - The server domain (e.g., "vault.acme.com")
|
|
4215
|
+
*
|
|
4216
|
+
* # Errors
|
|
4217
|
+
*
|
|
4218
|
+
* Returns an error if:
|
|
4219
|
+
* - Cookie acquisition was cancelled by the user
|
|
4220
|
+
* - Server configuration doesn't support SSO cookies (Direct bootstrap)
|
|
4221
|
+
* - Acquired cookie name doesn't match expected name
|
|
4222
|
+
* - Repository operations fail
|
|
231
4223
|
*/
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
4224
|
+
acquireCookie(domain: string): Promise<AcquiredCookie[]>;
|
|
4225
|
+
/**
|
|
4226
|
+
* Returns all cookies that should be included in requests to this server
|
|
4227
|
+
*
|
|
4228
|
+
* Returns an array of [cookie_name, cookie_value] pairs.
|
|
4229
|
+
*
|
|
4230
|
+
* # Arguments
|
|
4231
|
+
*
|
|
4232
|
+
* * `domain` - The server domain (e.g., "vault.acme.com")
|
|
4233
|
+
*/
|
|
4234
|
+
cookies(domain: string): Promise<any>;
|
|
4235
|
+
/**
|
|
4236
|
+
* Retrieves the server communication configuration for a domain
|
|
4237
|
+
*
|
|
4238
|
+
* If no configuration exists, returns a default Direct bootstrap configuration.
|
|
4239
|
+
*
|
|
4240
|
+
* # Arguments
|
|
4241
|
+
*
|
|
4242
|
+
* * `domain` - The server domain (e.g., "vault.acme.com")
|
|
4243
|
+
*
|
|
4244
|
+
* # Errors
|
|
4245
|
+
*
|
|
4246
|
+
* Returns an error if the repository fails to retrieve the configuration.
|
|
4247
|
+
*/
|
|
4248
|
+
getConfig(domain: string): Promise<ServerCommunicationConfig>;
|
|
4249
|
+
/**
|
|
4250
|
+
* Returns all cookies that should be included in requests to this server
|
|
4251
|
+
* and triggers cookie acquisition if needed
|
|
4252
|
+
*
|
|
4253
|
+
* # Arguments
|
|
4254
|
+
*
|
|
4255
|
+
* * `domain` - The server domain (e.g., "vault.acme.com")
|
|
4256
|
+
*/
|
|
4257
|
+
getCookies(domain: string): Promise<AcquiredCookie[]>;
|
|
4258
|
+
/**
|
|
4259
|
+
* Determines if cookie bootstrapping is needed for this domain
|
|
4260
|
+
*
|
|
4261
|
+
* # Arguments
|
|
4262
|
+
*
|
|
4263
|
+
* * `domain` - The server domain (e.g., "vault.acme.com")
|
|
4264
|
+
*/
|
|
4265
|
+
needsBootstrap(domain: string): Promise<boolean>;
|
|
4266
|
+
/**
|
|
4267
|
+
* Creates a new ServerCommunicationConfigClient with a JavaScript repository and platform API
|
|
4268
|
+
*
|
|
4269
|
+
* The repository should be backed by StateProvider (or equivalent
|
|
4270
|
+
* storage mechanism) for persistence.
|
|
4271
|
+
*
|
|
4272
|
+
* # Arguments
|
|
4273
|
+
*
|
|
4274
|
+
* * `repository` - JavaScript implementation of the repository interface
|
|
4275
|
+
* * `platform_api` - JavaScript implementation of the platform API interface
|
|
4276
|
+
*/
|
|
4277
|
+
constructor(
|
|
4278
|
+
repository: ServerCommunicationConfigRepository,
|
|
4279
|
+
platform_api: ServerCommunicationConfigPlatformApi,
|
|
4280
|
+
);
|
|
4281
|
+
/**
|
|
4282
|
+
* Sets the server communication configuration for a domain
|
|
4283
|
+
*
|
|
4284
|
+
* This method saves the provided communication configuration to the repository.
|
|
4285
|
+
* Typically called when receiving the `/api/config` response from the server.
|
|
4286
|
+
* Previously acquired cookies are preserved automatically.
|
|
4287
|
+
*
|
|
4288
|
+
* # Arguments
|
|
4289
|
+
*
|
|
4290
|
+
* * `domain` - The server domain (e.g., "vault.acme.com")
|
|
4291
|
+
* * `request` - The server communication configuration to store
|
|
4292
|
+
*
|
|
4293
|
+
* # Errors
|
|
4294
|
+
*
|
|
4295
|
+
* Returns an error if the repository save operation fails
|
|
4296
|
+
*/
|
|
4297
|
+
setCommunicationType(domain: string, request: SetCommunicationTypeRequest): Promise<void>;
|
|
4298
|
+
/**
|
|
4299
|
+
* Sets the server communication configuration using the domain from the config
|
|
4300
|
+
*
|
|
4301
|
+
* Extracts the `cookie_domain` from the `SsoCookieVendor` config and uses it as the
|
|
4302
|
+
* storage key. If the config is `Direct` or `cookie_domain` is not set, the call
|
|
4303
|
+
* is silently ignored.
|
|
4304
|
+
*
|
|
4305
|
+
* # Arguments
|
|
4306
|
+
*
|
|
4307
|
+
* * `config` - The server communication configuration to store
|
|
4308
|
+
*
|
|
4309
|
+
* # Errors
|
|
4310
|
+
*
|
|
4311
|
+
* Returns an error if the repository save operation fails
|
|
4312
|
+
*/
|
|
4313
|
+
setCommunicationTypeV2(request: SetCommunicationTypeRequest): Promise<void>;
|
|
256
4314
|
}
|
|
257
4315
|
|
|
258
|
-
export
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
4316
|
+
export class StateClient {
|
|
4317
|
+
private constructor();
|
|
4318
|
+
free(): void;
|
|
4319
|
+
[Symbol.dispose](): void;
|
|
4320
|
+
register_cipher_repository(cipher_repository: any): void;
|
|
4321
|
+
register_client_managed_repositories(repositories: Repositories): void;
|
|
4322
|
+
register_folder_repository(store: any): void;
|
|
264
4323
|
}
|
|
265
4324
|
|
|
266
|
-
export
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
4325
|
+
export class TotpClient {
|
|
4326
|
+
private constructor();
|
|
4327
|
+
free(): void;
|
|
4328
|
+
[Symbol.dispose](): void;
|
|
4329
|
+
/**
|
|
4330
|
+
* Generates a TOTP code from a provided key
|
|
4331
|
+
*
|
|
4332
|
+
* # Arguments
|
|
4333
|
+
* - `key` - Can be:
|
|
4334
|
+
* - A base32 encoded string
|
|
4335
|
+
* - OTP Auth URI
|
|
4336
|
+
* - Steam URI
|
|
4337
|
+
* - `time_ms` - Optional timestamp in milliseconds
|
|
4338
|
+
*/
|
|
4339
|
+
generate_totp(key: string, time_ms?: number | null): TotpResponse;
|
|
270
4340
|
}
|
|
271
4341
|
|
|
272
|
-
export
|
|
273
|
-
|
|
4342
|
+
export enum UriMatchType {
|
|
4343
|
+
Domain = 0,
|
|
4344
|
+
Host = 1,
|
|
4345
|
+
StartsWith = 2,
|
|
4346
|
+
Exact = 3,
|
|
4347
|
+
RegularExpression = 4,
|
|
4348
|
+
Never = 5,
|
|
274
4349
|
}
|
|
275
4350
|
|
|
276
|
-
export function isTestError(error: any): error is TestError;
|
|
277
|
-
|
|
278
|
-
export type Uuid = string;
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* RFC3339 compliant date-time string.
|
|
282
|
-
* @typeParam T - Not used in JavaScript.
|
|
283
|
-
*/
|
|
284
|
-
export type DateTime<T = unknown> = string;
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* UTC date-time string. Not used in JavaScript.
|
|
288
|
-
*/
|
|
289
|
-
export type Utc = unknown;
|
|
290
|
-
|
|
291
4351
|
/**
|
|
292
|
-
*
|
|
4352
|
+
* Client for managing the cryptographic machinery of a user account, including key-rotation.
|
|
293
4353
|
*/
|
|
294
|
-
export
|
|
295
|
-
|
|
296
|
-
export class BitwardenClient {
|
|
4354
|
+
export class UserCryptoManagementClient {
|
|
4355
|
+
private constructor();
|
|
297
4356
|
free(): void;
|
|
298
|
-
|
|
4357
|
+
[Symbol.dispose](): void;
|
|
299
4358
|
/**
|
|
300
|
-
*
|
|
4359
|
+
* Fetches the emergency access public keys for V1 emergency access memberships for the user.
|
|
4360
|
+
* These have to be trusted manually be the user before rotating.
|
|
301
4361
|
*/
|
|
302
|
-
|
|
303
|
-
version(): string;
|
|
304
|
-
throw(msg: string): void;
|
|
4362
|
+
get_untrusted_emergency_access_public_keys(): Promise<V1EmergencyAccessMembership[]>;
|
|
305
4363
|
/**
|
|
306
|
-
*
|
|
4364
|
+
* Fetches the organization public keys for V1 organization memberships for the user for
|
|
4365
|
+
* organizations for which reset password is enrolled.
|
|
4366
|
+
* These have to be trusted manually be the user before rotating.
|
|
307
4367
|
*/
|
|
308
|
-
|
|
309
|
-
crypto(): CryptoClient;
|
|
310
|
-
vault(): VaultClient;
|
|
311
|
-
}
|
|
312
|
-
export class ClientFolders {
|
|
313
|
-
private constructor();
|
|
314
|
-
free(): void;
|
|
4368
|
+
get_untrusted_organization_public_keys(): Promise<V1OrganizationMembership[]>;
|
|
315
4369
|
/**
|
|
316
|
-
*
|
|
4370
|
+
* Migrates an initialized account to Key Connector unlock.
|
|
4371
|
+
*
|
|
4372
|
+
* Requires the client to be unlocked so the current user key is available in memory.
|
|
317
4373
|
*/
|
|
318
|
-
|
|
4374
|
+
migrate_to_key_connector(key_connector_url: string): Promise<void>;
|
|
4375
|
+
/**
|
|
4376
|
+
* Combines a password change and user key rotation into a single request.
|
|
4377
|
+
*/
|
|
4378
|
+
password_change_and_rotate_user_keys(
|
|
4379
|
+
request: PasswordChangeAndRotateUserKeysRequest,
|
|
4380
|
+
): Promise<void>;
|
|
4381
|
+
/**
|
|
4382
|
+
* Rotates the user's encryption keys without a password change.
|
|
4383
|
+
*/
|
|
4384
|
+
rotate_user_keys(request: RotateUserKeysRequest): Promise<void>;
|
|
319
4385
|
}
|
|
320
|
-
|
|
4386
|
+
|
|
4387
|
+
export class VaultClient {
|
|
321
4388
|
private constructor();
|
|
322
4389
|
free(): void;
|
|
4390
|
+
[Symbol.dispose](): void;
|
|
323
4391
|
/**
|
|
324
|
-
*
|
|
325
|
-
* operations.
|
|
4392
|
+
* Attachment related operations.
|
|
326
4393
|
*/
|
|
327
|
-
|
|
4394
|
+
attachments(): AttachmentsClient;
|
|
328
4395
|
/**
|
|
329
|
-
*
|
|
330
|
-
* `initialize_user_crypto` but before any other crypto operations.
|
|
4396
|
+
* Cipher risk evaluation operations.
|
|
331
4397
|
*/
|
|
332
|
-
|
|
4398
|
+
cipher_risk(): CipherRiskClient;
|
|
333
4399
|
/**
|
|
334
|
-
*
|
|
335
|
-
* Crypto initialization not required.
|
|
4400
|
+
* Cipher related operations.
|
|
336
4401
|
*/
|
|
337
|
-
|
|
4402
|
+
ciphers(): CiphersClient;
|
|
338
4403
|
/**
|
|
339
|
-
*
|
|
340
|
-
* key. Returns if the private key is decryptable and if it is a valid matching key.
|
|
341
|
-
* Crypto initialization not required.
|
|
4404
|
+
* Collection related operations.
|
|
342
4405
|
*/
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
4406
|
+
collections(): CollectionsClient;
|
|
4407
|
+
/**
|
|
4408
|
+
* Folder related operations.
|
|
4409
|
+
*/
|
|
4410
|
+
folders(): FoldersClient;
|
|
4411
|
+
/**
|
|
4412
|
+
* TOTP related operations.
|
|
4413
|
+
*/
|
|
4414
|
+
totp(): TotpClient;
|
|
349
4415
|
}
|
|
4416
|
+
|
|
4417
|
+
/**
|
|
4418
|
+
* Generate a new SSH key pair
|
|
4419
|
+
*
|
|
4420
|
+
* # Arguments
|
|
4421
|
+
* - `key_algorithm` - The algorithm to use for the key pair
|
|
4422
|
+
*
|
|
4423
|
+
* # Returns
|
|
4424
|
+
* - `Ok(SshKey)` if the key was successfully generated
|
|
4425
|
+
* - `Err(KeyGenerationError)` if the key could not be generated
|
|
4426
|
+
*/
|
|
4427
|
+
export function generate_ssh_key(key_algorithm: KeyAlgorithm): SshKeyView;
|
|
4428
|
+
|
|
4429
|
+
/**
|
|
4430
|
+
* Convert a PCKS8 or OpenSSH encrypted or unencrypted private key
|
|
4431
|
+
* to an OpenSSH private key with public key and fingerprint
|
|
4432
|
+
*
|
|
4433
|
+
* # Arguments
|
|
4434
|
+
* - `imported_key` - The private key to convert
|
|
4435
|
+
* - `password` - The password to use for decrypting the key
|
|
4436
|
+
*
|
|
4437
|
+
* # Returns
|
|
4438
|
+
* - `Ok(SshKey)` if the key was successfully coneverted
|
|
4439
|
+
* - `Err(PasswordRequired)` if the key is encrypted and no password was provided
|
|
4440
|
+
* - `Err(WrongPassword)` if the password provided is incorrect
|
|
4441
|
+
* - `Err(ParsingError)` if the key could not be parsed
|
|
4442
|
+
* - `Err(UnsupportedKeyType)` if the key type is not supported
|
|
4443
|
+
*/
|
|
4444
|
+
export function import_ssh_key(imported_key: string, password?: string | null): SshKeyView;
|
|
4445
|
+
|
|
4446
|
+
/**
|
|
4447
|
+
* Initialize the SDK. Must be called before using any other API.
|
|
4448
|
+
* Only the first invocation has effect; subsequent calls are ignored.
|
|
4449
|
+
*
|
|
4450
|
+
* - `log_level`: Minimum level for console output. Defaults to `Info`.
|
|
4451
|
+
* - `flight_recorder_level`: Minimum level for the flight recorder. Defaults to `Info`.
|
|
4452
|
+
* - `flight_recorder_buffer_size`: Ring-buffer capacity for the flight recorder. Defaults to 1000.
|
|
4453
|
+
* Pass `0` to disable the flight recorder entirely.
|
|
4454
|
+
*/
|
|
4455
|
+
export function init_sdk(
|
|
4456
|
+
log_level?: LogLevel | null,
|
|
4457
|
+
flight_recorder_level?: LogLevel | null,
|
|
4458
|
+
flight_recorder_buffer_size?: number | null,
|
|
4459
|
+
): void;
|
|
4460
|
+
|
|
4461
|
+
/**
|
|
4462
|
+
* Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
|
|
4463
|
+
*/
|
|
4464
|
+
export function ipcRegisterDiscoverHandler(
|
|
4465
|
+
ipc_client: IpcClient,
|
|
4466
|
+
response: DiscoverResponse,
|
|
4467
|
+
): Promise<void>;
|
|
4468
|
+
|
|
4469
|
+
/**
|
|
4470
|
+
* Sends a DiscoverRequest to the specified destination and returns the response.
|
|
4471
|
+
*/
|
|
4472
|
+
export function ipcRequestDiscover(
|
|
4473
|
+
ipc_client: IpcClient,
|
|
4474
|
+
destination: Endpoint,
|
|
4475
|
+
abort_signal?: AbortSignal | null,
|
|
4476
|
+
): Promise<DiscoverResponse>;
|