@bitwarden/sdk-internal 0.2.0-main.410 → 0.2.0-main.411
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 +1116 -1116
- package/bitwarden_wasm_internal_bg.js +1096 -1095
- package/bitwarden_wasm_internal_bg.wasm +0 -0
- package/bitwarden_wasm_internal_bg.wasm.d.ts +168 -168
- package/bitwarden_wasm_internal_bg.wasm.js +1 -1
- package/node/bitwarden_wasm_internal.d.ts +1116 -1116
- package/node/bitwarden_wasm_internal.js +1096 -1095
- package/node/bitwarden_wasm_internal_bg.wasm +0 -0
- package/node/bitwarden_wasm_internal_bg.wasm.d.ts +168 -168
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
export function init_sdk(log_level?: LogLevel | null): void;
|
|
4
3
|
/**
|
|
5
4
|
* Generate a new SSH key pair
|
|
6
5
|
*
|
|
@@ -28,13 +27,7 @@ export function generate_ssh_key(key_algorithm: KeyAlgorithm): SshKeyView;
|
|
|
28
27
|
* - `Err(UnsupportedKeyType)` if the key type is not supported
|
|
29
28
|
*/
|
|
30
29
|
export function import_ssh_key(imported_key: string, password?: string | null): SshKeyView;
|
|
31
|
-
|
|
32
|
-
* Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
|
|
33
|
-
*/
|
|
34
|
-
export function ipcRegisterDiscoverHandler(
|
|
35
|
-
ipc_client: IpcClient,
|
|
36
|
-
response: DiscoverResponse,
|
|
37
|
-
): Promise<void>;
|
|
30
|
+
export function init_sdk(log_level?: LogLevel | null): void;
|
|
38
31
|
/**
|
|
39
32
|
* Sends a DiscoverRequest to the specified destination and returns the response.
|
|
40
33
|
*/
|
|
@@ -43,6 +36,13 @@ export function ipcRequestDiscover(
|
|
|
43
36
|
destination: Endpoint,
|
|
44
37
|
abort_signal?: AbortSignal | null,
|
|
45
38
|
): Promise<DiscoverResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
|
|
41
|
+
*/
|
|
42
|
+
export function ipcRegisterDiscoverHandler(
|
|
43
|
+
ipc_client: IpcClient,
|
|
44
|
+
response: DiscoverResponse,
|
|
45
|
+
): Promise<void>;
|
|
46
46
|
export enum CardLinkedIdType {
|
|
47
47
|
CardholderName = 300,
|
|
48
48
|
ExpMonth = 301,
|
|
@@ -133,11 +133,6 @@ export enum UriMatchType {
|
|
|
133
133
|
Never = 5,
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
/**
|
|
137
|
-
* @deprecated Use PasswordManagerClient instead
|
|
138
|
-
*/
|
|
139
|
-
export type BitwardenClient = PasswordManagerClient;
|
|
140
|
-
|
|
141
136
|
import { Tagged } from "type-fest";
|
|
142
137
|
|
|
143
138
|
/**
|
|
@@ -163,6 +158,17 @@ export type Utc = unknown;
|
|
|
163
158
|
*/
|
|
164
159
|
export type NonZeroU32 = number;
|
|
165
160
|
|
|
161
|
+
/**
|
|
162
|
+
* @deprecated Use PasswordManagerClient instead
|
|
163
|
+
*/
|
|
164
|
+
export type BitwardenClient = PasswordManagerClient;
|
|
165
|
+
|
|
166
|
+
export interface TestError extends Error {
|
|
167
|
+
name: "TestError";
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export function isTestError(error: any): error is TestError;
|
|
171
|
+
|
|
166
172
|
export interface Repository<T> {
|
|
167
173
|
get(id: string): Promise<T | null>;
|
|
168
174
|
list(): Promise<T[]>;
|
|
@@ -188,62 +194,64 @@ export interface IndexedDbConfiguration {
|
|
|
188
194
|
db_name: string;
|
|
189
195
|
}
|
|
190
196
|
|
|
191
|
-
|
|
192
|
-
|
|
197
|
+
/**
|
|
198
|
+
* Credentials for getting a send access token using an email and OTP.
|
|
199
|
+
*/
|
|
200
|
+
export interface SendEmailOtpCredentials {
|
|
201
|
+
/**
|
|
202
|
+
* The email address to which the OTP will be sent.
|
|
203
|
+
*/
|
|
204
|
+
email: string;
|
|
205
|
+
/**
|
|
206
|
+
* The one-time password (OTP) that the user has received via email.
|
|
207
|
+
*/
|
|
208
|
+
otp: string;
|
|
193
209
|
}
|
|
194
210
|
|
|
195
|
-
export function isTestError(error: any): error is TestError;
|
|
196
|
-
|
|
197
211
|
/**
|
|
198
|
-
*
|
|
212
|
+
* Credentials for sending password secured access requests.
|
|
213
|
+
* Clone auto implements the standard lib\'s Clone trait, allowing us to create copies of this
|
|
214
|
+
* struct.
|
|
199
215
|
*/
|
|
200
|
-
export
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
| {
|
|
207
|
-
error: "invalid_grant";
|
|
208
|
-
error_description?: string;
|
|
209
|
-
send_access_error_type?: SendAccessTokenInvalidGrantError;
|
|
210
|
-
}
|
|
211
|
-
| { error: "invalid_client"; error_description?: string }
|
|
212
|
-
| { error: "unauthorized_client"; error_description?: string }
|
|
213
|
-
| { error: "unsupported_grant_type"; error_description?: string }
|
|
214
|
-
| { error: "invalid_scope"; error_description?: string }
|
|
215
|
-
| { error: "invalid_target"; error_description?: string };
|
|
216
|
+
export interface SendPasswordCredentials {
|
|
217
|
+
/**
|
|
218
|
+
* A Base64-encoded hash of the password protecting the send.
|
|
219
|
+
*/
|
|
220
|
+
passwordHashB64: string;
|
|
221
|
+
}
|
|
216
222
|
|
|
217
223
|
/**
|
|
218
|
-
*
|
|
224
|
+
* Credentials for sending an OTP to the user\'s email address.
|
|
225
|
+
* This is used when the send requires email verification with an OTP.
|
|
219
226
|
*/
|
|
220
|
-
export
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
| "unknown";
|
|
227
|
+
export interface SendEmailCredentials {
|
|
228
|
+
/**
|
|
229
|
+
* The email address to which the OTP will be sent.
|
|
230
|
+
*/
|
|
231
|
+
email: string;
|
|
232
|
+
}
|
|
227
233
|
|
|
228
234
|
/**
|
|
229
|
-
*
|
|
235
|
+
* The credentials used for send access requests.
|
|
230
236
|
*/
|
|
231
|
-
export type
|
|
232
|
-
|
|
|
233
|
-
|
|
|
234
|
-
|
|
|
235
|
-
| "email_and_otp_required_otp_sent"
|
|
236
|
-
| "unknown";
|
|
237
|
+
export type SendAccessCredentials =
|
|
238
|
+
| SendPasswordCredentials
|
|
239
|
+
| SendEmailOtpCredentials
|
|
240
|
+
| SendEmailCredentials;
|
|
237
241
|
|
|
238
242
|
/**
|
|
239
|
-
*
|
|
240
|
-
* local/transport/decoding failure from the HTTP client (DNS/TLS/connect/read timeout,
|
|
241
|
-
* connection reset, or JSON decode failure on a success response) or non-2xx response with an
|
|
242
|
-
* unexpected body or status. Used when decoding the server\'s error payload into
|
|
243
|
-
* `SendAccessTokenApiErrorResponse` fails, or for 5xx responses where no structured error is
|
|
244
|
-
* available.
|
|
243
|
+
* A request structure for requesting a send access token from the API.
|
|
245
244
|
*/
|
|
246
|
-
export
|
|
245
|
+
export interface SendAccessTokenRequest {
|
|
246
|
+
/**
|
|
247
|
+
* The id of the send for which the access token is requested.
|
|
248
|
+
*/
|
|
249
|
+
sendId: string;
|
|
250
|
+
/**
|
|
251
|
+
* The optional send access credentials.
|
|
252
|
+
*/
|
|
253
|
+
sendAccessCredentials?: SendAccessCredentials;
|
|
254
|
+
}
|
|
247
255
|
|
|
248
256
|
/**
|
|
249
257
|
* Represents errors that can occur when requesting a send access token.
|
|
@@ -268,96 +276,88 @@ export interface SendAccessTokenResponse {
|
|
|
268
276
|
}
|
|
269
277
|
|
|
270
278
|
/**
|
|
271
|
-
*
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
sendId: string;
|
|
278
|
-
/**
|
|
279
|
-
* The optional send access credentials.
|
|
280
|
-
*/
|
|
281
|
-
sendAccessCredentials?: SendAccessCredentials;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* The credentials used for send access requests.
|
|
279
|
+
* Any unexpected error that occurs when making requests to identity. This could be
|
|
280
|
+
* local/transport/decoding failure from the HTTP client (DNS/TLS/connect/read timeout,
|
|
281
|
+
* connection reset, or JSON decode failure on a success response) or non-2xx response with an
|
|
282
|
+
* unexpected body or status. Used when decoding the server\'s error payload into
|
|
283
|
+
* `SendAccessTokenApiErrorResponse` fails, or for 5xx responses where no structured error is
|
|
284
|
+
* available.
|
|
286
285
|
*/
|
|
287
|
-
export type
|
|
288
|
-
| SendPasswordCredentials
|
|
289
|
-
| SendEmailOtpCredentials
|
|
290
|
-
| SendEmailCredentials;
|
|
286
|
+
export type UnexpectedIdentityError = string;
|
|
291
287
|
|
|
292
288
|
/**
|
|
293
|
-
*
|
|
289
|
+
* Invalid request errors - typically due to missing parameters.
|
|
294
290
|
*/
|
|
295
|
-
export
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
* The one-time password (OTP) that the user has received via email.
|
|
302
|
-
*/
|
|
303
|
-
otp: string;
|
|
304
|
-
}
|
|
291
|
+
export type SendAccessTokenInvalidRequestError =
|
|
292
|
+
| "send_id_required"
|
|
293
|
+
| "password_hash_b64_required"
|
|
294
|
+
| "email_required"
|
|
295
|
+
| "email_and_otp_required_otp_sent"
|
|
296
|
+
| "unknown";
|
|
305
297
|
|
|
306
298
|
/**
|
|
307
|
-
*
|
|
308
|
-
* This is used when the send requires email verification with an OTP.
|
|
299
|
+
* Invalid grant errors - typically due to invalid credentials.
|
|
309
300
|
*/
|
|
310
|
-
export
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
301
|
+
export type SendAccessTokenInvalidGrantError =
|
|
302
|
+
| "send_id_invalid"
|
|
303
|
+
| "password_hash_b64_invalid"
|
|
304
|
+
| "email_invalid"
|
|
305
|
+
| "otp_invalid"
|
|
306
|
+
| "otp_generation_failed"
|
|
307
|
+
| "unknown";
|
|
316
308
|
|
|
317
309
|
/**
|
|
318
|
-
*
|
|
319
|
-
* Clone auto implements the standard lib\'s Clone trait, allowing us to create copies of this
|
|
320
|
-
* struct.
|
|
310
|
+
* Represents the possible, expected errors that can occur when requesting a send access token.
|
|
321
311
|
*/
|
|
322
|
-
export
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}
|
|
312
|
+
export type SendAccessTokenApiErrorResponse =
|
|
313
|
+
| {
|
|
314
|
+
error: "invalid_request";
|
|
315
|
+
error_description?: string;
|
|
316
|
+
send_access_error_type?: SendAccessTokenInvalidRequestError;
|
|
317
|
+
}
|
|
318
|
+
| {
|
|
319
|
+
error: "invalid_grant";
|
|
320
|
+
error_description?: string;
|
|
321
|
+
send_access_error_type?: SendAccessTokenInvalidGrantError;
|
|
322
|
+
}
|
|
323
|
+
| { error: "invalid_client"; error_description?: string }
|
|
324
|
+
| { error: "unauthorized_client"; error_description?: string }
|
|
325
|
+
| { error: "unsupported_grant_type"; error_description?: string }
|
|
326
|
+
| { error: "invalid_scope"; error_description?: string }
|
|
327
|
+
| { error: "invalid_target"; error_description?: string };
|
|
328
328
|
|
|
329
329
|
/**
|
|
330
|
-
*
|
|
330
|
+
* Type of collection
|
|
331
331
|
*/
|
|
332
|
-
export type
|
|
332
|
+
export type CollectionType = "SharedCollection" | "DefaultUserCollection";
|
|
333
333
|
|
|
334
|
-
export interface
|
|
334
|
+
export interface CollectionView {
|
|
335
335
|
id: CollectionId | undefined;
|
|
336
336
|
organizationId: OrganizationId;
|
|
337
|
-
name:
|
|
337
|
+
name: string;
|
|
338
338
|
externalId: string | undefined;
|
|
339
339
|
hidePasswords: boolean;
|
|
340
340
|
readOnly: boolean;
|
|
341
341
|
manage: boolean;
|
|
342
|
-
defaultUserCollectionEmail: string | undefined;
|
|
343
342
|
type: CollectionType;
|
|
344
343
|
}
|
|
345
344
|
|
|
346
|
-
export interface
|
|
345
|
+
export interface Collection {
|
|
347
346
|
id: CollectionId | undefined;
|
|
348
347
|
organizationId: OrganizationId;
|
|
349
|
-
name:
|
|
348
|
+
name: EncString;
|
|
350
349
|
externalId: string | undefined;
|
|
351
350
|
hidePasswords: boolean;
|
|
352
351
|
readOnly: boolean;
|
|
353
352
|
manage: boolean;
|
|
353
|
+
defaultUserCollectionEmail: string | undefined;
|
|
354
354
|
type: CollectionType;
|
|
355
355
|
}
|
|
356
356
|
|
|
357
357
|
/**
|
|
358
|
-
*
|
|
358
|
+
* NewType wrapper for `CollectionId`
|
|
359
359
|
*/
|
|
360
|
-
export type
|
|
360
|
+
export type CollectionId = Tagged<Uuid, "CollectionId">;
|
|
361
361
|
|
|
362
362
|
export interface CollectionDecryptError extends Error {
|
|
363
363
|
name: "CollectionDecryptError";
|
|
@@ -366,163 +366,194 @@ export interface CollectionDecryptError extends Error {
|
|
|
366
366
|
|
|
367
367
|
export function isCollectionDecryptError(error: any): error is CollectionDecryptError;
|
|
368
368
|
|
|
369
|
+
export type SignedSecurityState = string;
|
|
370
|
+
|
|
369
371
|
/**
|
|
370
|
-
*
|
|
372
|
+
* Represents the data required to unlock with the master password.
|
|
371
373
|
*/
|
|
372
|
-
export interface
|
|
373
|
-
/**
|
|
374
|
-
* The user\'s ID.
|
|
375
|
-
*/
|
|
376
|
-
userId: UserId | undefined;
|
|
377
|
-
/**
|
|
378
|
-
* The user\'s KDF parameters, as received from the prelogin request
|
|
379
|
-
*/
|
|
380
|
-
kdfParams: Kdf;
|
|
374
|
+
export interface MasterPasswordUnlockData {
|
|
381
375
|
/**
|
|
382
|
-
* The
|
|
376
|
+
* The key derivation function used to derive the master key
|
|
383
377
|
*/
|
|
384
|
-
|
|
378
|
+
kdf: Kdf;
|
|
385
379
|
/**
|
|
386
|
-
* The
|
|
387
|
-
* public-key-encryption keys, along with the signed security state, protected by the user key
|
|
380
|
+
* The master key wrapped user key
|
|
388
381
|
*/
|
|
389
|
-
|
|
382
|
+
masterKeyWrappedUserKey: EncString;
|
|
390
383
|
/**
|
|
391
|
-
* The
|
|
384
|
+
* The salt used in the KDF, typically the user\'s email
|
|
392
385
|
*/
|
|
393
|
-
|
|
386
|
+
salt: string;
|
|
394
387
|
}
|
|
395
388
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
deviceKey: {
|
|
408
|
-
device_key: string;
|
|
409
|
-
protected_device_private_key: EncString;
|
|
410
|
-
device_protected_user_key: UnsignedSharedKey;
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
| { keyConnector: { master_key: B64; user_key: EncString } };
|
|
389
|
+
export interface MasterPasswordError extends Error {
|
|
390
|
+
name: "MasterPasswordError";
|
|
391
|
+
variant:
|
|
392
|
+
| "EncryptionKeyMalformed"
|
|
393
|
+
| "KdfMalformed"
|
|
394
|
+
| "InvalidKdfConfiguration"
|
|
395
|
+
| "MissingField"
|
|
396
|
+
| "Crypto";
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export function isMasterPasswordError(error: any): error is MasterPasswordError;
|
|
414
400
|
|
|
415
401
|
/**
|
|
416
|
-
*
|
|
402
|
+
* Represents the data required to authenticate with the master password.
|
|
417
403
|
*/
|
|
418
|
-
export
|
|
419
|
-
|
|
420
|
-
|
|
404
|
+
export interface MasterPasswordAuthenticationData {
|
|
405
|
+
kdf: Kdf;
|
|
406
|
+
salt: string;
|
|
407
|
+
masterPasswordAuthenticationHash: B64;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export interface AccountCryptographyInitializationError extends Error {
|
|
411
|
+
name: "AccountCryptographyInitializationError";
|
|
412
|
+
variant:
|
|
413
|
+
| "WrongUserKeyType"
|
|
414
|
+
| "WrongUserKey"
|
|
415
|
+
| "CorruptData"
|
|
416
|
+
| "TamperedData"
|
|
417
|
+
| "KeyStoreAlreadyInitialized"
|
|
418
|
+
| "GenericCrypto";
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
export function isAccountCryptographyInitializationError(
|
|
422
|
+
error: any,
|
|
423
|
+
): error is AccountCryptographyInitializationError;
|
|
421
424
|
|
|
422
425
|
/**
|
|
423
|
-
*
|
|
426
|
+
* Any keys / cryptographic protection \"downstream\" from the account symmetric key (user key).
|
|
427
|
+
* Private keys are protected by the user key.
|
|
424
428
|
*/
|
|
425
|
-
export
|
|
429
|
+
export type WrappedAccountCryptographicState =
|
|
430
|
+
| { V1: { private_key: EncString } }
|
|
431
|
+
| {
|
|
432
|
+
V2: {
|
|
433
|
+
private_key: EncString;
|
|
434
|
+
signed_public_key: SignedPublicKey | undefined;
|
|
435
|
+
signing_key: EncString;
|
|
436
|
+
security_state: SignedSecurityState;
|
|
437
|
+
};
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Request for migrating an account from password to key connector.
|
|
442
|
+
*/
|
|
443
|
+
export interface DeriveKeyConnectorRequest {
|
|
426
444
|
/**
|
|
427
|
-
*
|
|
445
|
+
* Encrypted user key, used to validate the master key
|
|
428
446
|
*/
|
|
429
|
-
|
|
447
|
+
userKeyEncrypted: EncString;
|
|
448
|
+
/**
|
|
449
|
+
* The user\'s master password
|
|
450
|
+
*/
|
|
451
|
+
password: string;
|
|
452
|
+
/**
|
|
453
|
+
* The KDF parameters used to derive the master key
|
|
454
|
+
*/
|
|
455
|
+
kdf: Kdf;
|
|
456
|
+
/**
|
|
457
|
+
* The user\'s email address
|
|
458
|
+
*/
|
|
459
|
+
email: string;
|
|
430
460
|
}
|
|
431
461
|
|
|
432
462
|
/**
|
|
433
|
-
*
|
|
463
|
+
* Request for deriving a pin protected user key
|
|
434
464
|
*/
|
|
435
|
-
export interface
|
|
436
|
-
/**
|
|
437
|
-
* The authentication data for the new KDF setting
|
|
438
|
-
*/
|
|
439
|
-
masterPasswordAuthenticationData: MasterPasswordAuthenticationData;
|
|
465
|
+
export interface DerivePinKeyResponse {
|
|
440
466
|
/**
|
|
441
|
-
*
|
|
467
|
+
* [UserKey] protected by PIN
|
|
442
468
|
*/
|
|
443
|
-
|
|
469
|
+
pinProtectedUserKey: EncString;
|
|
444
470
|
/**
|
|
445
|
-
*
|
|
471
|
+
* PIN protected by [UserKey]
|
|
446
472
|
*/
|
|
447
|
-
|
|
473
|
+
encryptedPin: EncString;
|
|
448
474
|
}
|
|
449
475
|
|
|
450
476
|
/**
|
|
451
|
-
* Response from the `
|
|
477
|
+
* Response from the `make_key_pair` function
|
|
452
478
|
*/
|
|
453
|
-
export interface
|
|
479
|
+
export interface MakeKeyPairResponse {
|
|
454
480
|
/**
|
|
455
|
-
*
|
|
481
|
+
* The user\'s public key
|
|
456
482
|
*/
|
|
457
|
-
|
|
483
|
+
userPublicKey: B64;
|
|
458
484
|
/**
|
|
459
|
-
* User key, encrypted with the
|
|
485
|
+
* User\'s private key, encrypted with the user key
|
|
460
486
|
*/
|
|
461
|
-
|
|
487
|
+
userKeyEncryptedPrivateKey: EncString;
|
|
462
488
|
}
|
|
463
489
|
|
|
464
490
|
/**
|
|
465
|
-
*
|
|
491
|
+
* Response for `verify_asymmetric_keys`.
|
|
466
492
|
*/
|
|
467
|
-
export interface
|
|
493
|
+
export interface VerifyAsymmetricKeysResponse {
|
|
468
494
|
/**
|
|
469
|
-
*
|
|
495
|
+
* Whether the user\'s private key was decryptable by the user key.
|
|
470
496
|
*/
|
|
471
|
-
|
|
497
|
+
privateKeyDecryptable: boolean;
|
|
472
498
|
/**
|
|
473
|
-
*
|
|
499
|
+
* Whether the user\'s private key was a valid RSA key and matched the public key provided.
|
|
474
500
|
*/
|
|
475
|
-
|
|
501
|
+
validPrivateKey: boolean;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export interface EnrollAdminPasswordResetError extends Error {
|
|
505
|
+
name: "EnrollAdminPasswordResetError";
|
|
506
|
+
variant: "Crypto";
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
export function isEnrollAdminPasswordResetError(error: any): error is EnrollAdminPasswordResetError;
|
|
510
|
+
|
|
511
|
+
export interface CryptoClientError extends Error {
|
|
512
|
+
name: "CryptoClientError";
|
|
513
|
+
variant: "NotAuthenticated" | "Crypto" | "InvalidKdfSettings" | "PasswordProtectedKeyEnvelope";
|
|
476
514
|
}
|
|
477
515
|
|
|
516
|
+
export function isCryptoClientError(error: any): error is CryptoClientError;
|
|
517
|
+
|
|
478
518
|
/**
|
|
479
519
|
* Request for deriving a pin protected user key
|
|
480
520
|
*/
|
|
481
|
-
export interface
|
|
521
|
+
export interface EnrollPinResponse {
|
|
482
522
|
/**
|
|
483
523
|
* [UserKey] protected by PIN
|
|
484
524
|
*/
|
|
485
|
-
|
|
525
|
+
pinProtectedUserKeyEnvelope: PasswordProtectedKeyEnvelope;
|
|
486
526
|
/**
|
|
487
527
|
* PIN protected by [UserKey]
|
|
488
528
|
*/
|
|
489
|
-
|
|
529
|
+
userKeyEncryptedPin: EncString;
|
|
490
530
|
}
|
|
491
531
|
|
|
492
532
|
/**
|
|
493
|
-
*
|
|
533
|
+
* State used for initializing the user cryptographic state.
|
|
494
534
|
*/
|
|
495
|
-
export interface
|
|
496
|
-
/**
|
|
497
|
-
* Encrypted user key, used to validate the master key
|
|
498
|
-
*/
|
|
499
|
-
userKeyEncrypted: EncString;
|
|
535
|
+
export interface InitUserCryptoRequest {
|
|
500
536
|
/**
|
|
501
|
-
* The user\'s
|
|
537
|
+
* The user\'s ID.
|
|
502
538
|
*/
|
|
503
|
-
|
|
539
|
+
userId: UserId | undefined;
|
|
504
540
|
/**
|
|
505
|
-
* The KDF parameters
|
|
541
|
+
* The user\'s KDF parameters, as received from the prelogin request
|
|
506
542
|
*/
|
|
507
|
-
|
|
543
|
+
kdfParams: Kdf;
|
|
508
544
|
/**
|
|
509
545
|
* The user\'s email address
|
|
510
546
|
*/
|
|
511
547
|
email: string;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
/**
|
|
515
|
-
* Response from the `make_key_pair` function
|
|
516
|
-
*/
|
|
517
|
-
export interface MakeKeyPairResponse {
|
|
518
548
|
/**
|
|
519
|
-
* The user\'s
|
|
549
|
+
* The user\'s account cryptographic state, containing their signature and
|
|
550
|
+
* public-key-encryption keys, along with the signed security state, protected by the user key
|
|
520
551
|
*/
|
|
521
|
-
|
|
552
|
+
accountCryptographicState: WrappedAccountCryptographicState;
|
|
522
553
|
/**
|
|
523
|
-
*
|
|
554
|
+
* The method to decrypt the user\'s account symmetric key (user key)
|
|
524
555
|
*/
|
|
525
|
-
|
|
556
|
+
method: InitUserCryptoMethod;
|
|
526
557
|
}
|
|
527
558
|
|
|
528
559
|
/**
|
|
@@ -544,19 +575,80 @@ export interface VerifyAsymmetricKeysRequest {
|
|
|
544
575
|
}
|
|
545
576
|
|
|
546
577
|
/**
|
|
547
|
-
* Response
|
|
578
|
+
* Response from the `make_update_password` function
|
|
548
579
|
*/
|
|
549
|
-
export interface
|
|
580
|
+
export interface UpdatePasswordResponse {
|
|
550
581
|
/**
|
|
551
|
-
*
|
|
582
|
+
* Hash of the new password
|
|
552
583
|
*/
|
|
553
|
-
|
|
584
|
+
passwordHash: B64;
|
|
554
585
|
/**
|
|
555
|
-
*
|
|
586
|
+
* User key, encrypted with the new password
|
|
556
587
|
*/
|
|
557
|
-
|
|
588
|
+
newKey: EncString;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Represents the request to initialize the user\'s organizational cryptographic state.
|
|
593
|
+
*/
|
|
594
|
+
export interface InitOrgCryptoRequest {
|
|
595
|
+
/**
|
|
596
|
+
* The encryption keys for all the organizations the user is a part of
|
|
597
|
+
*/
|
|
598
|
+
organizationKeys: Map<OrganizationId, UnsignedSharedKey>;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Auth requests supports multiple initialization methods.
|
|
603
|
+
*/
|
|
604
|
+
export type AuthRequestMethod =
|
|
605
|
+
| { userKey: { protected_user_key: UnsignedSharedKey } }
|
|
606
|
+
| { masterKey: { protected_master_key: UnsignedSharedKey; auth_request_key: EncString } };
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Response from the `update_kdf` function
|
|
610
|
+
*/
|
|
611
|
+
export interface UpdateKdfResponse {
|
|
612
|
+
/**
|
|
613
|
+
* The authentication data for the new KDF setting
|
|
614
|
+
*/
|
|
615
|
+
masterPasswordAuthenticationData: MasterPasswordAuthenticationData;
|
|
616
|
+
/**
|
|
617
|
+
* The unlock data for the new KDF setting
|
|
618
|
+
*/
|
|
619
|
+
masterPasswordUnlockData: MasterPasswordUnlockData;
|
|
620
|
+
/**
|
|
621
|
+
* The authentication data for the KDF setting prior to the change
|
|
622
|
+
*/
|
|
623
|
+
oldMasterPasswordAuthenticationData: MasterPasswordAuthenticationData;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
export interface DeriveKeyConnectorError extends Error {
|
|
627
|
+
name: "DeriveKeyConnectorError";
|
|
628
|
+
variant: "WrongPassword" | "Crypto";
|
|
558
629
|
}
|
|
559
630
|
|
|
631
|
+
export function isDeriveKeyConnectorError(error: any): error is DeriveKeyConnectorError;
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* The crypto method used to initialize the user cryptographic state.
|
|
635
|
+
*/
|
|
636
|
+
export type InitUserCryptoMethod =
|
|
637
|
+
| { password: { password: string; user_key: EncString } }
|
|
638
|
+
| { masterPasswordUnlock: { password: string; master_password_unlock: MasterPasswordUnlockData } }
|
|
639
|
+
| { decryptedKey: { decrypted_user_key: string } }
|
|
640
|
+
| { pin: { pin: string; pin_protected_user_key: EncString } }
|
|
641
|
+
| { pinEnvelope: { pin: string; pin_protected_user_key_envelope: PasswordProtectedKeyEnvelope } }
|
|
642
|
+
| { authRequest: { request_private_key: B64; method: AuthRequestMethod } }
|
|
643
|
+
| {
|
|
644
|
+
deviceKey: {
|
|
645
|
+
device_key: string;
|
|
646
|
+
protected_device_private_key: EncString;
|
|
647
|
+
device_protected_user_key: UnsignedSharedKey;
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
| { keyConnector: { master_key: B64; user_key: EncString } };
|
|
651
|
+
|
|
560
652
|
/**
|
|
561
653
|
* Response for the `make_keys_for_user_crypto_v2`, containing a set of keys for a user
|
|
562
654
|
*/
|
|
@@ -596,107 +688,15 @@ export interface UserCryptoV2KeysResponse {
|
|
|
596
688
|
}
|
|
597
689
|
|
|
598
690
|
/**
|
|
599
|
-
*
|
|
691
|
+
* NewType wrapper for `OrganizationId`
|
|
600
692
|
*/
|
|
601
|
-
export
|
|
602
|
-
/**
|
|
603
|
-
* The key derivation function used to derive the master key
|
|
604
|
-
*/
|
|
605
|
-
kdf: Kdf;
|
|
606
|
-
/**
|
|
607
|
-
* The master key wrapped user key
|
|
608
|
-
*/
|
|
609
|
-
masterKeyWrappedUserKey: EncString;
|
|
610
|
-
/**
|
|
611
|
-
* The salt used in the KDF, typically the user\'s email
|
|
612
|
-
*/
|
|
613
|
-
salt: string;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
/**
|
|
617
|
-
* Represents the data required to authenticate with the master password.
|
|
618
|
-
*/
|
|
619
|
-
export interface MasterPasswordAuthenticationData {
|
|
620
|
-
kdf: Kdf;
|
|
621
|
-
salt: string;
|
|
622
|
-
masterPasswordAuthenticationHash: B64;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
export type SignedSecurityState = string;
|
|
693
|
+
export type OrganizationId = Tagged<Uuid, "OrganizationId">;
|
|
626
694
|
|
|
627
695
|
/**
|
|
628
696
|
* NewType wrapper for `UserId`
|
|
629
697
|
*/
|
|
630
698
|
export type UserId = Tagged<Uuid, "UserId">;
|
|
631
699
|
|
|
632
|
-
/**
|
|
633
|
-
* NewType wrapper for `OrganizationId`
|
|
634
|
-
*/
|
|
635
|
-
export type OrganizationId = Tagged<Uuid, "OrganizationId">;
|
|
636
|
-
|
|
637
|
-
export interface MasterPasswordError extends Error {
|
|
638
|
-
name: "MasterPasswordError";
|
|
639
|
-
variant:
|
|
640
|
-
| "EncryptionKeyMalformed"
|
|
641
|
-
| "KdfMalformed"
|
|
642
|
-
| "InvalidKdfConfiguration"
|
|
643
|
-
| "MissingField"
|
|
644
|
-
| "Crypto";
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
export function isMasterPasswordError(error: any): error is MasterPasswordError;
|
|
648
|
-
|
|
649
|
-
export interface DeriveKeyConnectorError extends Error {
|
|
650
|
-
name: "DeriveKeyConnectorError";
|
|
651
|
-
variant: "WrongPassword" | "Crypto";
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
export function isDeriveKeyConnectorError(error: any): error is DeriveKeyConnectorError;
|
|
655
|
-
|
|
656
|
-
export interface EnrollAdminPasswordResetError extends Error {
|
|
657
|
-
name: "EnrollAdminPasswordResetError";
|
|
658
|
-
variant: "Crypto";
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
export function isEnrollAdminPasswordResetError(error: any): error is EnrollAdminPasswordResetError;
|
|
662
|
-
|
|
663
|
-
export interface CryptoClientError extends Error {
|
|
664
|
-
name: "CryptoClientError";
|
|
665
|
-
variant: "NotAuthenticated" | "Crypto" | "InvalidKdfSettings" | "PasswordProtectedKeyEnvelope";
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
export function isCryptoClientError(error: any): error is CryptoClientError;
|
|
669
|
-
|
|
670
|
-
/**
|
|
671
|
-
* Any keys / cryptographic protection \"downstream\" from the account symmetric key (user key).
|
|
672
|
-
* Private keys are protected by the user key.
|
|
673
|
-
*/
|
|
674
|
-
export type WrappedAccountCryptographicState =
|
|
675
|
-
| { V1: { private_key: EncString } }
|
|
676
|
-
| {
|
|
677
|
-
V2: {
|
|
678
|
-
private_key: EncString;
|
|
679
|
-
signed_public_key: SignedPublicKey | undefined;
|
|
680
|
-
signing_key: EncString;
|
|
681
|
-
security_state: SignedSecurityState;
|
|
682
|
-
};
|
|
683
|
-
};
|
|
684
|
-
|
|
685
|
-
export interface AccountCryptographyInitializationError extends Error {
|
|
686
|
-
name: "AccountCryptographyInitializationError";
|
|
687
|
-
variant:
|
|
688
|
-
| "WrongUserKeyType"
|
|
689
|
-
| "WrongUserKey"
|
|
690
|
-
| "CorruptData"
|
|
691
|
-
| "TamperedData"
|
|
692
|
-
| "KeyStoreAlreadyInitialized"
|
|
693
|
-
| "GenericCrypto";
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
export function isAccountCryptographyInitializationError(
|
|
697
|
-
error: any,
|
|
698
|
-
): error is AccountCryptographyInitializationError;
|
|
699
|
-
|
|
700
700
|
export interface StatefulCryptoError extends Error {
|
|
701
701
|
name: "StatefulCryptoError";
|
|
702
702
|
variant: "MissingSecurityState" | "WrongAccountCryptoVersion" | "Crypto";
|
|
@@ -704,18 +704,6 @@ export interface StatefulCryptoError extends Error {
|
|
|
704
704
|
|
|
705
705
|
export function isStatefulCryptoError(error: any): error is StatefulCryptoError;
|
|
706
706
|
|
|
707
|
-
export interface EncryptionSettingsError extends Error {
|
|
708
|
-
name: "EncryptionSettingsError";
|
|
709
|
-
variant:
|
|
710
|
-
| "Crypto"
|
|
711
|
-
| "CryptoInitialization"
|
|
712
|
-
| "MissingPrivateKey"
|
|
713
|
-
| "UserIdAlreadySet"
|
|
714
|
-
| "WrongPin";
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
export function isEncryptionSettingsError(error: any): error is EncryptionSettingsError;
|
|
718
|
-
|
|
719
707
|
export type DeviceType =
|
|
720
708
|
| "Android"
|
|
721
709
|
| "iOS"
|
|
@@ -786,21 +774,24 @@ export interface ClientSettings {
|
|
|
786
774
|
bitwardenClientVersion?: string | undefined;
|
|
787
775
|
}
|
|
788
776
|
|
|
777
|
+
export interface EncryptionSettingsError extends Error {
|
|
778
|
+
name: "EncryptionSettingsError";
|
|
779
|
+
variant:
|
|
780
|
+
| "Crypto"
|
|
781
|
+
| "CryptoInitialization"
|
|
782
|
+
| "MissingPrivateKey"
|
|
783
|
+
| "UserIdAlreadySet"
|
|
784
|
+
| "WrongPin";
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
export function isEncryptionSettingsError(error: any): error is EncryptionSettingsError;
|
|
788
|
+
|
|
789
789
|
export type UnsignedSharedKey = Tagged<string, "UnsignedSharedKey">;
|
|
790
790
|
|
|
791
791
|
export type EncString = Tagged<string, "EncString">;
|
|
792
792
|
|
|
793
793
|
export type SignedPublicKey = Tagged<string, "SignedPublicKey">;
|
|
794
794
|
|
|
795
|
-
export type PasswordProtectedKeyEnvelope = Tagged<string, "PasswordProtectedKeyEnvelope">;
|
|
796
|
-
|
|
797
|
-
export type DataEnvelope = Tagged<string, "DataEnvelope">;
|
|
798
|
-
|
|
799
|
-
/**
|
|
800
|
-
* The type of key / signature scheme used for signing and verifying.
|
|
801
|
-
*/
|
|
802
|
-
export type SignatureAlgorithm = "ed25519";
|
|
803
|
-
|
|
804
795
|
/**
|
|
805
796
|
* Key Derivation Function for Bitwarden Account
|
|
806
797
|
*
|
|
@@ -811,6 +802,10 @@ export type Kdf =
|
|
|
811
802
|
| { pBKDF2: { iterations: NonZeroU32 } }
|
|
812
803
|
| { argon2id: { iterations: NonZeroU32; memory: NonZeroU32; parallelism: NonZeroU32 } };
|
|
813
804
|
|
|
805
|
+
export type DataEnvelope = Tagged<string, "DataEnvelope">;
|
|
806
|
+
|
|
807
|
+
export type PasswordProtectedKeyEnvelope = Tagged<string, "PasswordProtectedKeyEnvelope">;
|
|
808
|
+
|
|
814
809
|
export interface CryptoError extends Error {
|
|
815
810
|
name: "CryptoError";
|
|
816
811
|
variant:
|
|
@@ -843,6 +838,11 @@ export interface CryptoError extends Error {
|
|
|
843
838
|
|
|
844
839
|
export function isCryptoError(error: any): error is CryptoError;
|
|
845
840
|
|
|
841
|
+
/**
|
|
842
|
+
* The type of key / signature scheme used for signing and verifying.
|
|
843
|
+
*/
|
|
844
|
+
export type SignatureAlgorithm = "ed25519";
|
|
845
|
+
|
|
846
846
|
/**
|
|
847
847
|
* Base64 encoded data
|
|
848
848
|
*
|
|
@@ -850,6 +850,8 @@ export function isCryptoError(error: any): error is CryptoError;
|
|
|
850
850
|
*/
|
|
851
851
|
export type B64 = string;
|
|
852
852
|
|
|
853
|
+
export type ExportFormat = "Csv" | "Json" | { EncryptedJson: { password: string } };
|
|
854
|
+
|
|
853
855
|
/**
|
|
854
856
|
* Temporary struct to hold metadata related to current account
|
|
855
857
|
*
|
|
@@ -861,8 +863,6 @@ export interface Account {
|
|
|
861
863
|
name: string | undefined;
|
|
862
864
|
}
|
|
863
865
|
|
|
864
|
-
export type ExportFormat = "Csv" | "Json" | { EncryptedJson: { password: string } };
|
|
865
|
-
|
|
866
866
|
export interface ExportError extends Error {
|
|
867
867
|
name: "ExportError";
|
|
868
868
|
variant:
|
|
@@ -878,33 +878,38 @@ export interface ExportError extends Error {
|
|
|
878
878
|
|
|
879
879
|
export function isExportError(error: any): error is ExportError;
|
|
880
880
|
|
|
881
|
-
export type
|
|
882
|
-
| { word: { capitalize: boolean; include_number: boolean } }
|
|
883
|
-
| { subaddress: { type: AppendType; email: string } }
|
|
884
|
-
| { catchall: { type: AppendType; domain: string } }
|
|
885
|
-
| { forwarded: { service: ForwarderServiceType; website: string | undefined } };
|
|
881
|
+
export type PassphraseError = { InvalidNumWords: { minimum: number; maximum: number } };
|
|
886
882
|
|
|
887
883
|
/**
|
|
888
|
-
*
|
|
889
|
-
* For instructions on how to configure each service, see the documentation:
|
|
890
|
-
* <https://bitwarden.com/help/generator/#username-types>
|
|
884
|
+
* Passphrase generator request options.
|
|
891
885
|
*/
|
|
892
|
-
export
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
886
|
+
export interface PassphraseGeneratorRequest {
|
|
887
|
+
/**
|
|
888
|
+
* Number of words in the generated passphrase.
|
|
889
|
+
* This value must be between 3 and 20.
|
|
890
|
+
*/
|
|
891
|
+
numWords: number;
|
|
892
|
+
/**
|
|
893
|
+
* Character separator between words in the generated passphrase. The value cannot be empty.
|
|
894
|
+
*/
|
|
895
|
+
wordSeparator: string;
|
|
896
|
+
/**
|
|
897
|
+
* When set to true, capitalize the first letter of each word in the generated passphrase.
|
|
898
|
+
*/
|
|
899
|
+
capitalize: boolean;
|
|
900
|
+
/**
|
|
901
|
+
* When set to true, include a number at the end of one of the words in the generated
|
|
902
|
+
* passphrase.
|
|
903
|
+
*/
|
|
904
|
+
includeNumber: boolean;
|
|
905
|
+
}
|
|
901
906
|
|
|
902
|
-
export interface
|
|
903
|
-
name: "
|
|
904
|
-
variant: "
|
|
907
|
+
export interface PasswordError extends Error {
|
|
908
|
+
name: "PasswordError";
|
|
909
|
+
variant: "NoCharacterSetEnabled" | "InvalidLength";
|
|
905
910
|
}
|
|
906
911
|
|
|
907
|
-
export function
|
|
912
|
+
export function isPasswordError(error: any): error is PasswordError;
|
|
908
913
|
|
|
909
914
|
/**
|
|
910
915
|
* Password generator request options.
|
|
@@ -958,65 +963,65 @@ export interface PasswordGeneratorRequest {
|
|
|
958
963
|
minSpecial: number | undefined;
|
|
959
964
|
}
|
|
960
965
|
|
|
961
|
-
export interface
|
|
962
|
-
name: "
|
|
963
|
-
variant: "
|
|
966
|
+
export interface UsernameError extends Error {
|
|
967
|
+
name: "UsernameError";
|
|
968
|
+
variant: "InvalidApiKey" | "Unknown" | "ResponseContent" | "Reqwest";
|
|
964
969
|
}
|
|
965
970
|
|
|
966
|
-
export function
|
|
971
|
+
export function isUsernameError(error: any): error is UsernameError;
|
|
972
|
+
|
|
973
|
+
export type UsernameGeneratorRequest =
|
|
974
|
+
| { word: { capitalize: boolean; include_number: boolean } }
|
|
975
|
+
| { subaddress: { type: AppendType; email: string } }
|
|
976
|
+
| { catchall: { type: AppendType; domain: string } }
|
|
977
|
+
| { forwarded: { service: ForwarderServiceType; website: string | undefined } };
|
|
978
|
+
|
|
979
|
+
export type AppendType = "random" | { websiteName: { website: string } };
|
|
967
980
|
|
|
968
981
|
/**
|
|
969
|
-
*
|
|
982
|
+
* Configures the email forwarding service to use.
|
|
983
|
+
* For instructions on how to configure each service, see the documentation:
|
|
984
|
+
* <https://bitwarden.com/help/generator/#username-types>
|
|
970
985
|
*/
|
|
971
|
-
export
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
* When set to true, capitalize the first letter of each word in the generated passphrase.
|
|
983
|
-
*/
|
|
984
|
-
capitalize: boolean;
|
|
985
|
-
/**
|
|
986
|
-
* When set to true, include a number at the end of one of the words in the generated
|
|
987
|
-
* passphrase.
|
|
988
|
-
*/
|
|
989
|
-
includeNumber: boolean;
|
|
986
|
+
export type ForwarderServiceType =
|
|
987
|
+
| { addyIo: { api_token: string; domain: string; base_url: string } }
|
|
988
|
+
| { duckDuckGo: { token: string } }
|
|
989
|
+
| { firefox: { api_token: string } }
|
|
990
|
+
| { fastmail: { api_token: string } }
|
|
991
|
+
| { forwardEmail: { api_token: string; domain: string } }
|
|
992
|
+
| { simpleLogin: { api_key: string; base_url: string } };
|
|
993
|
+
|
|
994
|
+
export interface RequestError extends Error {
|
|
995
|
+
name: "RequestError";
|
|
996
|
+
variant: "Subscribe" | "Receive" | "Timeout" | "Send" | "Rpc";
|
|
990
997
|
}
|
|
991
998
|
|
|
992
|
-
export
|
|
999
|
+
export function isRequestError(error: any): error is RequestError;
|
|
993
1000
|
|
|
994
|
-
export interface
|
|
995
|
-
|
|
1001
|
+
export interface SubscribeError extends Error {
|
|
1002
|
+
name: "SubscribeError";
|
|
1003
|
+
variant: "NotStarted";
|
|
996
1004
|
}
|
|
997
1005
|
|
|
998
|
-
export
|
|
999
|
-
| { Web: { id: number } }
|
|
1000
|
-
| "BrowserForeground"
|
|
1001
|
-
| "BrowserBackground"
|
|
1002
|
-
| "DesktopRenderer"
|
|
1003
|
-
| "DesktopMain";
|
|
1006
|
+
export function isSubscribeError(error: any): error is SubscribeError;
|
|
1004
1007
|
|
|
1005
|
-
export interface
|
|
1006
|
-
|
|
1008
|
+
export interface ReceiveError extends Error {
|
|
1009
|
+
name: "ReceiveError";
|
|
1010
|
+
variant: "Channel" | "Timeout" | "Cancelled";
|
|
1007
1011
|
}
|
|
1008
1012
|
|
|
1009
|
-
export
|
|
1010
|
-
get(endpoint: Endpoint): Promise<any | undefined>;
|
|
1011
|
-
save(endpoint: Endpoint, session: any): Promise<void>;
|
|
1012
|
-
remove(endpoint: Endpoint): Promise<void>;
|
|
1013
|
-
}
|
|
1013
|
+
export function isReceiveError(error: any): error is ReceiveError;
|
|
1014
1014
|
|
|
1015
|
-
export interface
|
|
1016
|
-
name: "
|
|
1015
|
+
export interface TypedReceiveError extends Error {
|
|
1016
|
+
name: "TypedReceiveError";
|
|
1017
|
+
variant: "Channel" | "Timeout" | "Cancelled" | "Typing";
|
|
1017
1018
|
}
|
|
1018
1019
|
|
|
1019
|
-
export function
|
|
1020
|
+
export function isTypedReceiveError(error: any): error is TypedReceiveError;
|
|
1021
|
+
|
|
1022
|
+
export interface IpcCommunicationBackendSender {
|
|
1023
|
+
send(message: OutgoingMessage): Promise<void>;
|
|
1024
|
+
}
|
|
1020
1025
|
|
|
1021
1026
|
export interface DeserializeError extends Error {
|
|
1022
1027
|
name: "DeserializeError";
|
|
@@ -1024,42 +1029,35 @@ export interface DeserializeError extends Error {
|
|
|
1024
1029
|
|
|
1025
1030
|
export function isDeserializeError(error: any): error is DeserializeError;
|
|
1026
1031
|
|
|
1027
|
-
export interface
|
|
1028
|
-
name: "
|
|
1029
|
-
variant: "Subscribe" | "Receive" | "Timeout" | "Send" | "Rpc";
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
export function isRequestError(error: any): error is RequestError;
|
|
1033
|
-
|
|
1034
|
-
export interface TypedReceiveError extends Error {
|
|
1035
|
-
name: "TypedReceiveError";
|
|
1036
|
-
variant: "Channel" | "Timeout" | "Cancelled" | "Typing";
|
|
1032
|
+
export interface ChannelError extends Error {
|
|
1033
|
+
name: "ChannelError";
|
|
1037
1034
|
}
|
|
1038
1035
|
|
|
1039
|
-
export function
|
|
1036
|
+
export function isChannelError(error: any): error is ChannelError;
|
|
1040
1037
|
|
|
1041
|
-
export interface
|
|
1042
|
-
|
|
1043
|
-
|
|
1038
|
+
export interface IpcSessionRepository {
|
|
1039
|
+
get(endpoint: Endpoint): Promise<any | undefined>;
|
|
1040
|
+
save(endpoint: Endpoint, session: any): Promise<void>;
|
|
1041
|
+
remove(endpoint: Endpoint): Promise<void>;
|
|
1044
1042
|
}
|
|
1045
1043
|
|
|
1046
|
-
export
|
|
1047
|
-
|
|
1048
|
-
export interface SubscribeError extends Error {
|
|
1049
|
-
name: "SubscribeError";
|
|
1050
|
-
variant: "NotStarted";
|
|
1044
|
+
export interface DiscoverResponse {
|
|
1045
|
+
version: string;
|
|
1051
1046
|
}
|
|
1052
1047
|
|
|
1053
|
-
export
|
|
1054
|
-
|
|
1055
|
-
|
|
1048
|
+
export type Endpoint =
|
|
1049
|
+
| { Web: { id: number } }
|
|
1050
|
+
| "BrowserForeground"
|
|
1051
|
+
| "BrowserBackground"
|
|
1052
|
+
| "DesktopRenderer"
|
|
1053
|
+
| "DesktopMain";
|
|
1056
1054
|
|
|
1057
|
-
export interface
|
|
1058
|
-
name: "
|
|
1059
|
-
variant: "KeyConversion";
|
|
1055
|
+
export interface KeyGenerationError extends Error {
|
|
1056
|
+
name: "KeyGenerationError";
|
|
1057
|
+
variant: "KeyGeneration" | "KeyConversion";
|
|
1060
1058
|
}
|
|
1061
1059
|
|
|
1062
|
-
export function
|
|
1060
|
+
export function isKeyGenerationError(error: any): error is KeyGenerationError;
|
|
1063
1061
|
|
|
1064
1062
|
export interface SshKeyImportError extends Error {
|
|
1065
1063
|
name: "SshKeyImportError";
|
|
@@ -1068,12 +1066,14 @@ export interface SshKeyImportError extends Error {
|
|
|
1068
1066
|
|
|
1069
1067
|
export function isSshKeyImportError(error: any): error is SshKeyImportError;
|
|
1070
1068
|
|
|
1071
|
-
export interface
|
|
1072
|
-
name: "
|
|
1073
|
-
variant: "
|
|
1069
|
+
export interface SshKeyExportError extends Error {
|
|
1070
|
+
name: "SshKeyExportError";
|
|
1071
|
+
variant: "KeyConversion";
|
|
1074
1072
|
}
|
|
1075
1073
|
|
|
1076
|
-
export function
|
|
1074
|
+
export function isSshKeyExportError(error: any): error is SshKeyExportError;
|
|
1075
|
+
|
|
1076
|
+
export type KeyAlgorithm = "Ed25519" | "Rsa3072" | "Rsa4096";
|
|
1077
1077
|
|
|
1078
1078
|
export interface DatabaseError extends Error {
|
|
1079
1079
|
name: "DatabaseError";
|
|
@@ -1095,180 +1095,212 @@ export interface CallError extends Error {
|
|
|
1095
1095
|
|
|
1096
1096
|
export function isCallError(error: any): error is CallError;
|
|
1097
1097
|
|
|
1098
|
+
export interface CipherRiskError extends Error {
|
|
1099
|
+
name: "CipherRiskError";
|
|
1100
|
+
variant: "Reqwest";
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
export function isCipherRiskError(error: any): error is CipherRiskError;
|
|
1104
|
+
|
|
1098
1105
|
/**
|
|
1099
|
-
*
|
|
1106
|
+
* Risk evaluation result for a single cipher.
|
|
1100
1107
|
*/
|
|
1101
|
-
export
|
|
1102
|
-
|
|
1103
|
-
export interface EncryptionContext {
|
|
1108
|
+
export interface CipherRiskResult {
|
|
1104
1109
|
/**
|
|
1105
|
-
*
|
|
1106
|
-
* Organization-owned ciphers
|
|
1110
|
+
* Cipher ID matching the input CipherLoginDetails.
|
|
1107
1111
|
*/
|
|
1108
|
-
|
|
1109
|
-
cipher: Cipher;
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
export interface Cipher {
|
|
1113
|
-
id: CipherId | undefined;
|
|
1114
|
-
organizationId: OrganizationId | undefined;
|
|
1115
|
-
folderId: FolderId | undefined;
|
|
1116
|
-
collectionIds: CollectionId[];
|
|
1112
|
+
id: CipherId;
|
|
1117
1113
|
/**
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
1114
|
+
* Password strength score from 0 (weakest) to 4 (strongest).
|
|
1115
|
+
* Calculated using zxcvbn with cipher-specific context.
|
|
1120
1116
|
*/
|
|
1121
|
-
|
|
1122
|
-
name: EncString;
|
|
1123
|
-
notes: EncString | undefined;
|
|
1124
|
-
type: CipherType;
|
|
1125
|
-
login: Login | undefined;
|
|
1126
|
-
identity: Identity | undefined;
|
|
1127
|
-
card: Card | undefined;
|
|
1128
|
-
secureNote: SecureNote | undefined;
|
|
1129
|
-
sshKey: SshKey | undefined;
|
|
1130
|
-
favorite: boolean;
|
|
1131
|
-
reprompt: CipherRepromptType;
|
|
1132
|
-
organizationUseTotp: boolean;
|
|
1133
|
-
edit: boolean;
|
|
1134
|
-
permissions: CipherPermissions | undefined;
|
|
1135
|
-
viewPassword: boolean;
|
|
1136
|
-
localData: LocalData | undefined;
|
|
1137
|
-
attachments: Attachment[] | undefined;
|
|
1138
|
-
fields: Field[] | undefined;
|
|
1139
|
-
passwordHistory: PasswordHistory[] | undefined;
|
|
1140
|
-
creationDate: DateTime<Utc>;
|
|
1141
|
-
deletedDate: DateTime<Utc> | undefined;
|
|
1142
|
-
revisionDate: DateTime<Utc>;
|
|
1143
|
-
archivedDate: DateTime<Utc> | undefined;
|
|
1144
|
-
data: string | undefined;
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
export interface CipherView {
|
|
1148
|
-
id: CipherId | undefined;
|
|
1149
|
-
organizationId: OrganizationId | undefined;
|
|
1150
|
-
folderId: FolderId | undefined;
|
|
1151
|
-
collectionIds: CollectionId[];
|
|
1117
|
+
password_strength: number;
|
|
1152
1118
|
/**
|
|
1153
|
-
*
|
|
1119
|
+
* Result of checking password exposure via HIBP API.
|
|
1120
|
+
* - `NotChecked`: check_exposed was false, or password was empty
|
|
1121
|
+
* - `Found(n)`: Successfully checked, found in n breaches
|
|
1122
|
+
* - `Error(msg)`: HIBP API request failed for this cipher with the given error message
|
|
1154
1123
|
*/
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
card: CardView | undefined;
|
|
1162
|
-
secureNote: SecureNoteView | undefined;
|
|
1163
|
-
sshKey: SshKeyView | undefined;
|
|
1164
|
-
favorite: boolean;
|
|
1165
|
-
reprompt: CipherRepromptType;
|
|
1166
|
-
organizationUseTotp: boolean;
|
|
1167
|
-
edit: boolean;
|
|
1168
|
-
permissions: CipherPermissions | undefined;
|
|
1169
|
-
viewPassword: boolean;
|
|
1170
|
-
localData: LocalDataView | undefined;
|
|
1171
|
-
attachments: AttachmentView[] | undefined;
|
|
1172
|
-
fields: FieldView[] | undefined;
|
|
1173
|
-
passwordHistory: PasswordHistoryView[] | undefined;
|
|
1174
|
-
creationDate: DateTime<Utc>;
|
|
1175
|
-
deletedDate: DateTime<Utc> | undefined;
|
|
1176
|
-
revisionDate: DateTime<Utc>;
|
|
1177
|
-
archivedDate: DateTime<Utc> | undefined;
|
|
1124
|
+
exposed_result: ExposedPasswordResult;
|
|
1125
|
+
/**
|
|
1126
|
+
* Number of times this password appears in the provided password_map.
|
|
1127
|
+
* None if not found or if no password_map was provided.
|
|
1128
|
+
*/
|
|
1129
|
+
reuse_count: number | undefined;
|
|
1178
1130
|
}
|
|
1179
1131
|
|
|
1180
|
-
export type CipherListViewType =
|
|
1181
|
-
| { login: LoginListView }
|
|
1182
|
-
| "secureNote"
|
|
1183
|
-
| { card: CardListView }
|
|
1184
|
-
| "identity"
|
|
1185
|
-
| "sshKey";
|
|
1186
|
-
|
|
1187
1132
|
/**
|
|
1188
|
-
*
|
|
1133
|
+
* Options for configuring risk computation.
|
|
1189
1134
|
*/
|
|
1190
|
-
export
|
|
1191
|
-
| "LoginUsername"
|
|
1192
|
-
| "LoginPassword"
|
|
1193
|
-
| "LoginTotp"
|
|
1194
|
-
| "CardNumber"
|
|
1195
|
-
| "CardSecurityCode"
|
|
1196
|
-
| "IdentityUsername"
|
|
1197
|
-
| "IdentityEmail"
|
|
1198
|
-
| "IdentityPhone"
|
|
1199
|
-
| "IdentityAddress"
|
|
1200
|
-
| "SshKey"
|
|
1201
|
-
| "SecureNotes";
|
|
1202
|
-
|
|
1203
|
-
export interface CipherListView {
|
|
1204
|
-
id: CipherId | undefined;
|
|
1205
|
-
organizationId: OrganizationId | undefined;
|
|
1206
|
-
folderId: FolderId | undefined;
|
|
1207
|
-
collectionIds: CollectionId[];
|
|
1208
|
-
/**
|
|
1209
|
-
* Temporary, required to support calculating TOTP from CipherListView.
|
|
1210
|
-
*/
|
|
1211
|
-
key: EncString | undefined;
|
|
1212
|
-
name: string;
|
|
1213
|
-
subtitle: string;
|
|
1214
|
-
type: CipherListViewType;
|
|
1215
|
-
favorite: boolean;
|
|
1216
|
-
reprompt: CipherRepromptType;
|
|
1217
|
-
organizationUseTotp: boolean;
|
|
1218
|
-
edit: boolean;
|
|
1219
|
-
permissions: CipherPermissions | undefined;
|
|
1220
|
-
viewPassword: boolean;
|
|
1135
|
+
export interface CipherRiskOptions {
|
|
1221
1136
|
/**
|
|
1222
|
-
*
|
|
1137
|
+
* Pre-computed password reuse map (password → count).
|
|
1138
|
+
* If provided, enables reuse detection across ciphers.
|
|
1223
1139
|
*/
|
|
1224
|
-
|
|
1140
|
+
passwordMap?: PasswordReuseMap | undefined;
|
|
1225
1141
|
/**
|
|
1226
|
-
*
|
|
1142
|
+
* Whether to check passwords against Have I Been Pwned API.
|
|
1143
|
+
* When true, makes network requests to check for exposed passwords.
|
|
1227
1144
|
*/
|
|
1228
|
-
|
|
1229
|
-
creationDate: DateTime<Utc>;
|
|
1230
|
-
deletedDate: DateTime<Utc> | undefined;
|
|
1231
|
-
revisionDate: DateTime<Utc>;
|
|
1232
|
-
archivedDate: DateTime<Utc> | undefined;
|
|
1145
|
+
checkExposed?: boolean;
|
|
1233
1146
|
/**
|
|
1234
|
-
*
|
|
1147
|
+
* Optional HIBP API base URL override. When None, uses the production HIBP URL.
|
|
1148
|
+
* Can be used for testing or alternative password breach checking services.
|
|
1235
1149
|
*/
|
|
1236
|
-
|
|
1237
|
-
localData: LocalDataView | undefined;
|
|
1150
|
+
hibpBaseUrl?: string | undefined;
|
|
1238
1151
|
}
|
|
1239
1152
|
|
|
1240
1153
|
/**
|
|
1241
|
-
*
|
|
1242
|
-
*
|
|
1243
|
-
* This struct contains two vectors: `successes` and `failures`.
|
|
1244
|
-
* `successes` contains the decrypted `CipherListView` objects,
|
|
1245
|
-
* while `failures` contains the original `Cipher` objects that failed to decrypt.
|
|
1154
|
+
* Login cipher data needed for risk evaluation.
|
|
1246
1155
|
*/
|
|
1247
|
-
export interface
|
|
1156
|
+
export interface CipherLoginDetails {
|
|
1248
1157
|
/**
|
|
1249
|
-
*
|
|
1158
|
+
* Cipher ID to identify which cipher in results.
|
|
1250
1159
|
*/
|
|
1251
|
-
|
|
1160
|
+
id: CipherId;
|
|
1252
1161
|
/**
|
|
1253
|
-
* The
|
|
1162
|
+
* The decrypted password to evaluate.
|
|
1254
1163
|
*/
|
|
1255
|
-
|
|
1164
|
+
password: string;
|
|
1165
|
+
/**
|
|
1166
|
+
* Username or email (login ciphers only have one field).
|
|
1167
|
+
*/
|
|
1168
|
+
username: string | undefined;
|
|
1256
1169
|
}
|
|
1257
1170
|
|
|
1258
1171
|
/**
|
|
1259
|
-
*
|
|
1172
|
+
* Password reuse map wrapper for WASM compatibility.
|
|
1260
1173
|
*/
|
|
1261
|
-
export
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
type:
|
|
1269
|
-
|
|
1174
|
+
export type PasswordReuseMap = Record<string, number>;
|
|
1175
|
+
|
|
1176
|
+
/**
|
|
1177
|
+
* Result of checking password exposure via HIBP API.
|
|
1178
|
+
*/
|
|
1179
|
+
export type ExposedPasswordResult =
|
|
1180
|
+
| { type: "NotChecked" }
|
|
1181
|
+
| { type: "Found"; value: number }
|
|
1182
|
+
| { type: "Error"; value: string };
|
|
1183
|
+
|
|
1184
|
+
export interface PasswordHistory {
|
|
1185
|
+
password: EncString;
|
|
1186
|
+
lastUsedDate: DateTime<Utc>;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
export interface PasswordHistoryView {
|
|
1190
|
+
password: string;
|
|
1191
|
+
lastUsedDate: DateTime<Utc>;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
export interface AncestorMap {
|
|
1195
|
+
ancestors: Map<CollectionId, string>;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
export interface TotpError extends Error {
|
|
1199
|
+
name: "TotpError";
|
|
1200
|
+
variant: "InvalidOtpauth" | "MissingSecret" | "Crypto";
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
export function isTotpError(error: any): error is TotpError;
|
|
1204
|
+
|
|
1205
|
+
export interface TotpResponse {
|
|
1206
|
+
/**
|
|
1207
|
+
* Generated TOTP code
|
|
1208
|
+
*/
|
|
1209
|
+
code: string;
|
|
1210
|
+
/**
|
|
1211
|
+
* Time period
|
|
1212
|
+
*/
|
|
1213
|
+
period: number;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
export interface DecryptError extends Error {
|
|
1217
|
+
name: "DecryptError";
|
|
1218
|
+
variant: "Crypto";
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
export function isDecryptError(error: any): error is DecryptError;
|
|
1222
|
+
|
|
1223
|
+
export interface EncryptError extends Error {
|
|
1224
|
+
name: "EncryptError";
|
|
1225
|
+
variant: "Crypto" | "MissingUserId";
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
export function isEncryptError(error: any): error is EncryptError;
|
|
1229
|
+
|
|
1230
|
+
export interface Attachment {
|
|
1231
|
+
id: string | undefined;
|
|
1232
|
+
url: string | undefined;
|
|
1233
|
+
size: string | undefined;
|
|
1234
|
+
/**
|
|
1235
|
+
* Readable size, ex: \"4.2 KB\" or \"1.43 GB\
|
|
1236
|
+
*/
|
|
1237
|
+
sizeName: string | undefined;
|
|
1238
|
+
fileName: EncString | undefined;
|
|
1239
|
+
key: EncString | undefined;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
export interface AttachmentView {
|
|
1243
|
+
id: string | undefined;
|
|
1244
|
+
url: string | undefined;
|
|
1245
|
+
size: string | undefined;
|
|
1246
|
+
sizeName: string | undefined;
|
|
1247
|
+
fileName: string | undefined;
|
|
1248
|
+
key: EncString | undefined;
|
|
1249
|
+
/**
|
|
1250
|
+
* The decrypted attachmentkey in base64 format.
|
|
1251
|
+
*
|
|
1252
|
+
* **TEMPORARY FIELD**: This field is a temporary workaround to provide
|
|
1253
|
+
* decrypted attachment keys to the TypeScript client during the migration
|
|
1254
|
+
* process. It will be removed once the encryption/decryption logic is
|
|
1255
|
+
* fully migrated to the SDK.
|
|
1256
|
+
*
|
|
1257
|
+
* **Ticket**: <https://bitwarden.atlassian.net/browse/PM-23005>
|
|
1258
|
+
*
|
|
1259
|
+
* Do not rely on this field for long-term use.
|
|
1260
|
+
*/
|
|
1261
|
+
decryptedKey: string | undefined;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
export interface LocalData {
|
|
1265
|
+
lastUsedDate: DateTime<Utc> | undefined;
|
|
1266
|
+
lastLaunched: DateTime<Utc> | undefined;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
export interface LocalDataView {
|
|
1270
|
+
lastUsedDate: DateTime<Utc> | undefined;
|
|
1271
|
+
lastLaunched: DateTime<Utc> | undefined;
|
|
1270
1272
|
}
|
|
1271
1273
|
|
|
1274
|
+
export interface SecureNoteView {
|
|
1275
|
+
type: SecureNoteType;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
export interface SecureNote {
|
|
1279
|
+
type: SecureNoteType;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
export interface GetCipherError extends Error {
|
|
1283
|
+
name: "GetCipherError";
|
|
1284
|
+
variant: "ItemNotFound" | "Crypto" | "RepositoryError";
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
export function isGetCipherError(error: any): error is GetCipherError;
|
|
1288
|
+
|
|
1289
|
+
export interface EditCipherError extends Error {
|
|
1290
|
+
name: "EditCipherError";
|
|
1291
|
+
variant:
|
|
1292
|
+
| "ItemNotFound"
|
|
1293
|
+
| "Crypto"
|
|
1294
|
+
| "Api"
|
|
1295
|
+
| "VaultParse"
|
|
1296
|
+
| "MissingField"
|
|
1297
|
+
| "NotAuthenticated"
|
|
1298
|
+
| "Repository"
|
|
1299
|
+
| "Uuid";
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
export function isEditCipherError(error: any): error is EditCipherError;
|
|
1303
|
+
|
|
1272
1304
|
/**
|
|
1273
1305
|
* Request to edit a cipher.
|
|
1274
1306
|
*/
|
|
@@ -1288,11 +1320,82 @@ export interface CipherEditRequest {
|
|
|
1288
1320
|
key: EncString | undefined;
|
|
1289
1321
|
}
|
|
1290
1322
|
|
|
1291
|
-
export interface
|
|
1292
|
-
name:
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1323
|
+
export interface CreateCipherError extends Error {
|
|
1324
|
+
name: "CreateCipherError";
|
|
1325
|
+
variant: "Crypto" | "Api" | "VaultParse" | "MissingField" | "NotAuthenticated" | "Repository";
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
export function isCreateCipherError(error: any): error is CreateCipherError;
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* Request to add a cipher.
|
|
1332
|
+
*/
|
|
1333
|
+
export interface CipherCreateRequest {
|
|
1334
|
+
organizationId: OrganizationId | undefined;
|
|
1335
|
+
folderId: FolderId | undefined;
|
|
1336
|
+
name: string;
|
|
1337
|
+
notes: string | undefined;
|
|
1338
|
+
favorite: boolean;
|
|
1339
|
+
reprompt: CipherRepromptType;
|
|
1340
|
+
type: CipherViewType;
|
|
1341
|
+
fields: FieldView[];
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* Represents the inner data of a cipher view.
|
|
1346
|
+
*/
|
|
1347
|
+
export type CipherViewType =
|
|
1348
|
+
| { login: LoginView }
|
|
1349
|
+
| { card: CardView }
|
|
1350
|
+
| { identity: IdentityView }
|
|
1351
|
+
| { secureNote: SecureNoteView }
|
|
1352
|
+
| { sshKey: SshKeyView };
|
|
1353
|
+
|
|
1354
|
+
export interface DecryptFileError extends Error {
|
|
1355
|
+
name: "DecryptFileError";
|
|
1356
|
+
variant: "Decrypt" | "Io";
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
export function isDecryptFileError(error: any): error is DecryptFileError;
|
|
1360
|
+
|
|
1361
|
+
export interface EncryptFileError extends Error {
|
|
1362
|
+
name: "EncryptFileError";
|
|
1363
|
+
variant: "Encrypt" | "Io";
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
export function isEncryptFileError(error: any): error is EncryptFileError;
|
|
1367
|
+
|
|
1368
|
+
export interface CipherPermissions {
|
|
1369
|
+
delete: boolean;
|
|
1370
|
+
restore: boolean;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
export interface CardView {
|
|
1374
|
+
cardholderName: string | undefined;
|
|
1375
|
+
expMonth: string | undefined;
|
|
1376
|
+
expYear: string | undefined;
|
|
1377
|
+
code: string | undefined;
|
|
1378
|
+
brand: string | undefined;
|
|
1379
|
+
number: string | undefined;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
export interface Card {
|
|
1383
|
+
cardholderName: EncString | undefined;
|
|
1384
|
+
expMonth: EncString | undefined;
|
|
1385
|
+
expYear: EncString | undefined;
|
|
1386
|
+
code: EncString | undefined;
|
|
1387
|
+
brand: EncString | undefined;
|
|
1388
|
+
number: EncString | undefined;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* Minimal CardView only including the needed details for list views
|
|
1393
|
+
*/
|
|
1394
|
+
export interface CardListView {
|
|
1395
|
+
/**
|
|
1396
|
+
* The brand of the card, e.g. Visa, Mastercard, etc.
|
|
1397
|
+
*/
|
|
1398
|
+
brand: string | undefined;
|
|
1296
1399
|
}
|
|
1297
1400
|
|
|
1298
1401
|
export interface FieldView {
|
|
@@ -1302,12 +1405,11 @@ export interface FieldView {
|
|
|
1302
1405
|
linkedId: LinkedIdType | undefined;
|
|
1303
1406
|
}
|
|
1304
1407
|
|
|
1305
|
-
export
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
uriChecksum: EncString | undefined;
|
|
1408
|
+
export interface Field {
|
|
1409
|
+
name: EncString | undefined;
|
|
1410
|
+
value: EncString | undefined;
|
|
1411
|
+
type: FieldType;
|
|
1412
|
+
linkedId: LinkedIdType | undefined;
|
|
1311
1413
|
}
|
|
1312
1414
|
|
|
1313
1415
|
export interface LoginUriView {
|
|
@@ -1316,47 +1418,30 @@ export interface LoginUriView {
|
|
|
1316
1418
|
uriChecksum: string | undefined;
|
|
1317
1419
|
}
|
|
1318
1420
|
|
|
1319
|
-
export interface
|
|
1320
|
-
credentialId: EncString;
|
|
1321
|
-
keyType: EncString;
|
|
1322
|
-
keyAlgorithm: EncString;
|
|
1323
|
-
keyCurve: EncString;
|
|
1324
|
-
keyValue: EncString;
|
|
1325
|
-
rpId: EncString;
|
|
1326
|
-
userHandle: EncString | undefined;
|
|
1327
|
-
userName: EncString | undefined;
|
|
1328
|
-
counter: EncString;
|
|
1329
|
-
rpName: EncString | undefined;
|
|
1330
|
-
userDisplayName: EncString | undefined;
|
|
1331
|
-
discoverable: EncString;
|
|
1332
|
-
creationDate: DateTime<Utc>;
|
|
1333
|
-
}
|
|
1334
|
-
|
|
1335
|
-
export interface Fido2CredentialListView {
|
|
1336
|
-
credentialId: string;
|
|
1337
|
-
rpId: string;
|
|
1338
|
-
userHandle: string | undefined;
|
|
1339
|
-
userName: string | undefined;
|
|
1340
|
-
userDisplayName: string | undefined;
|
|
1341
|
-
counter: string;
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
export interface Fido2CredentialView {
|
|
1421
|
+
export interface Fido2CredentialNewView {
|
|
1345
1422
|
credentialId: string;
|
|
1346
1423
|
keyType: string;
|
|
1347
1424
|
keyAlgorithm: string;
|
|
1348
1425
|
keyCurve: string;
|
|
1349
|
-
keyValue: EncString;
|
|
1350
1426
|
rpId: string;
|
|
1351
1427
|
userHandle: string | undefined;
|
|
1352
1428
|
userName: string | undefined;
|
|
1353
1429
|
counter: string;
|
|
1354
1430
|
rpName: string | undefined;
|
|
1355
1431
|
userDisplayName: string | undefined;
|
|
1356
|
-
discoverable: string;
|
|
1357
1432
|
creationDate: DateTime<Utc>;
|
|
1358
1433
|
}
|
|
1359
1434
|
|
|
1435
|
+
export interface Login {
|
|
1436
|
+
username: EncString | undefined;
|
|
1437
|
+
password: EncString | undefined;
|
|
1438
|
+
passwordRevisionDate: DateTime<Utc> | undefined;
|
|
1439
|
+
uris: LoginUri[] | undefined;
|
|
1440
|
+
totp: EncString | undefined;
|
|
1441
|
+
autofillOnPageLoad: boolean | undefined;
|
|
1442
|
+
fido2Credentials: Fido2Credential[] | undefined;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1360
1445
|
export interface Fido2CredentialFullView {
|
|
1361
1446
|
credentialId: string;
|
|
1362
1447
|
keyType: string;
|
|
@@ -1373,30 +1458,6 @@ export interface Fido2CredentialFullView {
|
|
|
1373
1458
|
creationDate: DateTime<Utc>;
|
|
1374
1459
|
}
|
|
1375
1460
|
|
|
1376
|
-
export interface Fido2CredentialNewView {
|
|
1377
|
-
credentialId: string;
|
|
1378
|
-
keyType: string;
|
|
1379
|
-
keyAlgorithm: string;
|
|
1380
|
-
keyCurve: string;
|
|
1381
|
-
rpId: string;
|
|
1382
|
-
userHandle: string | undefined;
|
|
1383
|
-
userName: string | undefined;
|
|
1384
|
-
counter: string;
|
|
1385
|
-
rpName: string | undefined;
|
|
1386
|
-
userDisplayName: string | undefined;
|
|
1387
|
-
creationDate: DateTime<Utc>;
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
export interface Login {
|
|
1391
|
-
username: EncString | undefined;
|
|
1392
|
-
password: EncString | undefined;
|
|
1393
|
-
passwordRevisionDate: DateTime<Utc> | undefined;
|
|
1394
|
-
uris: LoginUri[] | undefined;
|
|
1395
|
-
totp: EncString | undefined;
|
|
1396
|
-
autofillOnPageLoad: boolean | undefined;
|
|
1397
|
-
fido2Credentials: Fido2Credential[] | undefined;
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
1461
|
export interface LoginView {
|
|
1401
1462
|
username: string | undefined;
|
|
1402
1463
|
password: string | undefined;
|
|
@@ -1407,6 +1468,28 @@ export interface LoginView {
|
|
|
1407
1468
|
fido2Credentials: Fido2Credential[] | undefined;
|
|
1408
1469
|
}
|
|
1409
1470
|
|
|
1471
|
+
export interface LoginUri {
|
|
1472
|
+
uri: EncString | undefined;
|
|
1473
|
+
match: UriMatchType | undefined;
|
|
1474
|
+
uriChecksum: EncString | undefined;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
export interface Fido2Credential {
|
|
1478
|
+
credentialId: EncString;
|
|
1479
|
+
keyType: EncString;
|
|
1480
|
+
keyAlgorithm: EncString;
|
|
1481
|
+
keyCurve: EncString;
|
|
1482
|
+
keyValue: EncString;
|
|
1483
|
+
rpId: EncString;
|
|
1484
|
+
userHandle: EncString | undefined;
|
|
1485
|
+
userName: EncString | undefined;
|
|
1486
|
+
counter: EncString;
|
|
1487
|
+
rpName: EncString | undefined;
|
|
1488
|
+
userDisplayName: EncString | undefined;
|
|
1489
|
+
discoverable: EncString;
|
|
1490
|
+
creationDate: DateTime<Utc>;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1410
1493
|
export interface LoginListView {
|
|
1411
1494
|
fido2Credentials: Fido2CredentialListView[] | undefined;
|
|
1412
1495
|
hasFido2: boolean;
|
|
@@ -1418,200 +1501,208 @@ export interface LoginListView {
|
|
|
1418
1501
|
uris: LoginUriView[] | undefined;
|
|
1419
1502
|
}
|
|
1420
1503
|
|
|
1421
|
-
export interface
|
|
1422
|
-
|
|
1504
|
+
export interface Fido2CredentialView {
|
|
1505
|
+
credentialId: string;
|
|
1506
|
+
keyType: string;
|
|
1507
|
+
keyAlgorithm: string;
|
|
1508
|
+
keyCurve: string;
|
|
1509
|
+
keyValue: EncString;
|
|
1510
|
+
rpId: string;
|
|
1511
|
+
userHandle: string | undefined;
|
|
1512
|
+
userName: string | undefined;
|
|
1513
|
+
counter: string;
|
|
1514
|
+
rpName: string | undefined;
|
|
1515
|
+
userDisplayName: string | undefined;
|
|
1516
|
+
discoverable: string;
|
|
1517
|
+
creationDate: DateTime<Utc>;
|
|
1423
1518
|
}
|
|
1424
1519
|
|
|
1425
|
-
export interface
|
|
1426
|
-
|
|
1520
|
+
export interface Fido2CredentialListView {
|
|
1521
|
+
credentialId: string;
|
|
1522
|
+
rpId: string;
|
|
1523
|
+
userHandle: string | undefined;
|
|
1524
|
+
userName: string | undefined;
|
|
1525
|
+
userDisplayName: string | undefined;
|
|
1526
|
+
counter: string;
|
|
1427
1527
|
}
|
|
1428
1528
|
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
| { type: "Found"; value: number }
|
|
1435
|
-
| { type: "Error"; value: string };
|
|
1436
|
-
|
|
1437
|
-
/**
|
|
1438
|
-
* Login cipher data needed for risk evaluation.
|
|
1439
|
-
*/
|
|
1440
|
-
export interface CipherLoginDetails {
|
|
1441
|
-
/**
|
|
1442
|
-
* Cipher ID to identify which cipher in results.
|
|
1443
|
-
*/
|
|
1444
|
-
id: CipherId;
|
|
1445
|
-
/**
|
|
1446
|
-
* The decrypted password to evaluate.
|
|
1447
|
-
*/
|
|
1448
|
-
password: string;
|
|
1529
|
+
export interface CipherListView {
|
|
1530
|
+
id: CipherId | undefined;
|
|
1531
|
+
organizationId: OrganizationId | undefined;
|
|
1532
|
+
folderId: FolderId | undefined;
|
|
1533
|
+
collectionIds: CollectionId[];
|
|
1449
1534
|
/**
|
|
1450
|
-
*
|
|
1535
|
+
* Temporary, required to support calculating TOTP from CipherListView.
|
|
1451
1536
|
*/
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
*/
|
|
1463
|
-
export interface CipherRiskOptions {
|
|
1537
|
+
key: EncString | undefined;
|
|
1538
|
+
name: string;
|
|
1539
|
+
subtitle: string;
|
|
1540
|
+
type: CipherListViewType;
|
|
1541
|
+
favorite: boolean;
|
|
1542
|
+
reprompt: CipherRepromptType;
|
|
1543
|
+
organizationUseTotp: boolean;
|
|
1544
|
+
edit: boolean;
|
|
1545
|
+
permissions: CipherPermissions | undefined;
|
|
1546
|
+
viewPassword: boolean;
|
|
1464
1547
|
/**
|
|
1465
|
-
*
|
|
1466
|
-
* If provided, enables reuse detection across ciphers.
|
|
1548
|
+
* The number of attachments
|
|
1467
1549
|
*/
|
|
1468
|
-
|
|
1550
|
+
attachments: number;
|
|
1469
1551
|
/**
|
|
1470
|
-
*
|
|
1471
|
-
* When true, makes network requests to check for exposed passwords.
|
|
1552
|
+
* Indicates if the cipher has old attachments that need to be re-uploaded
|
|
1472
1553
|
*/
|
|
1473
|
-
|
|
1554
|
+
hasOldAttachments: boolean;
|
|
1555
|
+
creationDate: DateTime<Utc>;
|
|
1556
|
+
deletedDate: DateTime<Utc> | undefined;
|
|
1557
|
+
revisionDate: DateTime<Utc>;
|
|
1558
|
+
archivedDate: DateTime<Utc> | undefined;
|
|
1474
1559
|
/**
|
|
1475
|
-
*
|
|
1476
|
-
* Can be used for testing or alternative password breach checking services.
|
|
1560
|
+
* Hints for the presentation layer for which fields can be copied.
|
|
1477
1561
|
*/
|
|
1478
|
-
|
|
1562
|
+
copyableFields: CopyableCipherFields[];
|
|
1563
|
+
localData: LocalDataView | undefined;
|
|
1479
1564
|
}
|
|
1480
1565
|
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
* Cipher ID matching the input CipherLoginDetails.
|
|
1487
|
-
*/
|
|
1488
|
-
id: CipherId;
|
|
1489
|
-
/**
|
|
1490
|
-
* Password strength score from 0 (weakest) to 4 (strongest).
|
|
1491
|
-
* Calculated using zxcvbn with cipher-specific context.
|
|
1492
|
-
*/
|
|
1493
|
-
password_strength: number;
|
|
1494
|
-
/**
|
|
1495
|
-
* Result of checking password exposure via HIBP API.
|
|
1496
|
-
* - `NotChecked`: check_exposed was false, or password was empty
|
|
1497
|
-
* - `Found(n)`: Successfully checked, found in n breaches
|
|
1498
|
-
* - `Error(msg)`: HIBP API request failed for this cipher with the given error message
|
|
1499
|
-
*/
|
|
1500
|
-
exposed_result: ExposedPasswordResult;
|
|
1566
|
+
export interface CipherView {
|
|
1567
|
+
id: CipherId | undefined;
|
|
1568
|
+
organizationId: OrganizationId | undefined;
|
|
1569
|
+
folderId: FolderId | undefined;
|
|
1570
|
+
collectionIds: CollectionId[];
|
|
1501
1571
|
/**
|
|
1502
|
-
*
|
|
1503
|
-
* None if not found or if no password_map was provided.
|
|
1572
|
+
* Temporary, required to support re-encrypting existing items.
|
|
1504
1573
|
*/
|
|
1505
|
-
|
|
1574
|
+
key: EncString | undefined;
|
|
1575
|
+
name: string;
|
|
1576
|
+
notes: string | undefined;
|
|
1577
|
+
type: CipherType;
|
|
1578
|
+
login: LoginView | undefined;
|
|
1579
|
+
identity: IdentityView | undefined;
|
|
1580
|
+
card: CardView | undefined;
|
|
1581
|
+
secureNote: SecureNoteView | undefined;
|
|
1582
|
+
sshKey: SshKeyView | undefined;
|
|
1583
|
+
favorite: boolean;
|
|
1584
|
+
reprompt: CipherRepromptType;
|
|
1585
|
+
organizationUseTotp: boolean;
|
|
1586
|
+
edit: boolean;
|
|
1587
|
+
permissions: CipherPermissions | undefined;
|
|
1588
|
+
viewPassword: boolean;
|
|
1589
|
+
localData: LocalDataView | undefined;
|
|
1590
|
+
attachments: AttachmentView[] | undefined;
|
|
1591
|
+
fields: FieldView[] | undefined;
|
|
1592
|
+
passwordHistory: PasswordHistoryView[] | undefined;
|
|
1593
|
+
creationDate: DateTime<Utc>;
|
|
1594
|
+
deletedDate: DateTime<Utc> | undefined;
|
|
1595
|
+
revisionDate: DateTime<Utc>;
|
|
1596
|
+
archivedDate: DateTime<Utc> | undefined;
|
|
1506
1597
|
}
|
|
1507
1598
|
|
|
1508
1599
|
/**
|
|
1509
|
-
*
|
|
1600
|
+
* NewType wrapper for `CipherId`
|
|
1510
1601
|
*/
|
|
1511
|
-
export
|
|
1512
|
-
/**
|
|
1513
|
-
* The new name of the folder.
|
|
1514
|
-
*/
|
|
1515
|
-
name: string;
|
|
1516
|
-
}
|
|
1602
|
+
export type CipherId = Tagged<Uuid, "CipherId">;
|
|
1517
1603
|
|
|
1518
1604
|
/**
|
|
1519
|
-
*
|
|
1605
|
+
* Represents the result of decrypting a list of ciphers.
|
|
1606
|
+
*
|
|
1607
|
+
* This struct contains two vectors: `successes` and `failures`.
|
|
1608
|
+
* `successes` contains the decrypted `CipherListView` objects,
|
|
1609
|
+
* while `failures` contains the original `Cipher` objects that failed to decrypt.
|
|
1520
1610
|
*/
|
|
1521
|
-
export
|
|
1522
|
-
|
|
1523
|
-
export interface Folder {
|
|
1524
|
-
id: FolderId | undefined;
|
|
1525
|
-
name: EncString;
|
|
1526
|
-
revisionDate: DateTime<Utc>;
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
|
-
export interface FolderView {
|
|
1530
|
-
id: FolderId | undefined;
|
|
1531
|
-
name: string;
|
|
1532
|
-
revisionDate: DateTime<Utc>;
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
export interface AncestorMap {
|
|
1536
|
-
ancestors: Map<CollectionId, string>;
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
export interface DecryptError extends Error {
|
|
1540
|
-
name: "DecryptError";
|
|
1541
|
-
variant: "Crypto";
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1544
|
-
export function isDecryptError(error: any): error is DecryptError;
|
|
1545
|
-
|
|
1546
|
-
export interface EncryptError extends Error {
|
|
1547
|
-
name: "EncryptError";
|
|
1548
|
-
variant: "Crypto" | "MissingUserId";
|
|
1549
|
-
}
|
|
1550
|
-
|
|
1551
|
-
export function isEncryptError(error: any): error is EncryptError;
|
|
1552
|
-
|
|
1553
|
-
export interface TotpResponse {
|
|
1611
|
+
export interface DecryptCipherListResult {
|
|
1554
1612
|
/**
|
|
1555
|
-
*
|
|
1613
|
+
* The decrypted `CipherListView` objects.
|
|
1556
1614
|
*/
|
|
1557
|
-
|
|
1615
|
+
successes: CipherListView[];
|
|
1558
1616
|
/**
|
|
1559
|
-
*
|
|
1617
|
+
* The original `Cipher` objects that failed to decrypt.
|
|
1560
1618
|
*/
|
|
1561
|
-
|
|
1562
|
-
}
|
|
1563
|
-
|
|
1564
|
-
export interface TotpError extends Error {
|
|
1565
|
-
name: "TotpError";
|
|
1566
|
-
variant: "InvalidOtpauth" | "MissingSecret" | "Crypto";
|
|
1619
|
+
failures: Cipher[];
|
|
1567
1620
|
}
|
|
1568
1621
|
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1622
|
+
/**
|
|
1623
|
+
* Available fields on a cipher and can be copied from a the list view in the UI.
|
|
1624
|
+
*/
|
|
1625
|
+
export type CopyableCipherFields =
|
|
1626
|
+
| "LoginUsername"
|
|
1627
|
+
| "LoginPassword"
|
|
1628
|
+
| "LoginTotp"
|
|
1629
|
+
| "CardNumber"
|
|
1630
|
+
| "CardSecurityCode"
|
|
1631
|
+
| "IdentityUsername"
|
|
1632
|
+
| "IdentityEmail"
|
|
1633
|
+
| "IdentityPhone"
|
|
1634
|
+
| "IdentityAddress"
|
|
1635
|
+
| "SshKey"
|
|
1636
|
+
| "SecureNotes";
|
|
1575
1637
|
|
|
1576
|
-
export interface
|
|
1577
|
-
|
|
1578
|
-
|
|
1638
|
+
export interface EncryptionContext {
|
|
1639
|
+
/**
|
|
1640
|
+
* The Id of the user that encrypted the cipher. It should always represent a UserId, even for
|
|
1641
|
+
* Organization-owned ciphers
|
|
1642
|
+
*/
|
|
1643
|
+
encryptedFor: UserId;
|
|
1644
|
+
cipher: Cipher;
|
|
1579
1645
|
}
|
|
1580
1646
|
|
|
1581
|
-
export interface
|
|
1582
|
-
|
|
1583
|
-
|
|
1647
|
+
export interface Cipher {
|
|
1648
|
+
id: CipherId | undefined;
|
|
1649
|
+
organizationId: OrganizationId | undefined;
|
|
1650
|
+
folderId: FolderId | undefined;
|
|
1651
|
+
collectionIds: CollectionId[];
|
|
1652
|
+
/**
|
|
1653
|
+
* More recent ciphers uses individual encryption keys to encrypt the other fields of the
|
|
1654
|
+
* Cipher.
|
|
1655
|
+
*/
|
|
1656
|
+
key: EncString | undefined;
|
|
1657
|
+
name: EncString;
|
|
1658
|
+
notes: EncString | undefined;
|
|
1659
|
+
type: CipherType;
|
|
1660
|
+
login: Login | undefined;
|
|
1661
|
+
identity: Identity | undefined;
|
|
1662
|
+
card: Card | undefined;
|
|
1663
|
+
secureNote: SecureNote | undefined;
|
|
1664
|
+
sshKey: SshKey | undefined;
|
|
1665
|
+
favorite: boolean;
|
|
1666
|
+
reprompt: CipherRepromptType;
|
|
1667
|
+
organizationUseTotp: boolean;
|
|
1668
|
+
edit: boolean;
|
|
1669
|
+
permissions: CipherPermissions | undefined;
|
|
1670
|
+
viewPassword: boolean;
|
|
1671
|
+
localData: LocalData | undefined;
|
|
1672
|
+
attachments: Attachment[] | undefined;
|
|
1673
|
+
fields: Field[] | undefined;
|
|
1674
|
+
passwordHistory: PasswordHistory[] | undefined;
|
|
1675
|
+
creationDate: DateTime<Utc>;
|
|
1676
|
+
deletedDate: DateTime<Utc> | undefined;
|
|
1677
|
+
revisionDate: DateTime<Utc>;
|
|
1678
|
+
archivedDate: DateTime<Utc> | undefined;
|
|
1679
|
+
data: string | undefined;
|
|
1584
1680
|
}
|
|
1585
1681
|
|
|
1586
|
-
export
|
|
1682
|
+
export type CipherListViewType =
|
|
1683
|
+
| { login: LoginListView }
|
|
1684
|
+
| "secureNote"
|
|
1685
|
+
| { card: CardListView }
|
|
1686
|
+
| "identity"
|
|
1687
|
+
| "sshKey";
|
|
1587
1688
|
|
|
1588
|
-
export interface
|
|
1589
|
-
name: "
|
|
1689
|
+
export interface CipherError extends Error {
|
|
1690
|
+
name: "CipherError";
|
|
1590
1691
|
variant:
|
|
1591
|
-
| "ItemNotFound"
|
|
1592
|
-
| "Crypto"
|
|
1593
|
-
| "Api"
|
|
1594
|
-
| "VaultParse"
|
|
1595
1692
|
| "MissingField"
|
|
1693
|
+
| "Crypto"
|
|
1694
|
+
| "Decrypt"
|
|
1695
|
+
| "Encrypt"
|
|
1696
|
+
| "AttachmentsWithoutKeys"
|
|
1697
|
+
| "OrganizationAlreadySet"
|
|
1698
|
+
| "PutShare"
|
|
1699
|
+
| "PutShareMany"
|
|
1596
1700
|
| "Repository"
|
|
1597
|
-
| "
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
export function isEditFolderError(error: any): error is EditFolderError;
|
|
1601
|
-
|
|
1602
|
-
export interface CreateFolderError extends Error {
|
|
1603
|
-
name: "CreateFolderError";
|
|
1604
|
-
variant: "Crypto" | "Api" | "VaultParse" | "MissingField" | "Repository";
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
export function isCreateFolderError(error: any): error is CreateFolderError;
|
|
1608
|
-
|
|
1609
|
-
export interface CipherRiskError extends Error {
|
|
1610
|
-
name: "CipherRiskError";
|
|
1611
|
-
variant: "Reqwest";
|
|
1701
|
+
| "Chrono"
|
|
1702
|
+
| "SerdeJson";
|
|
1612
1703
|
}
|
|
1613
1704
|
|
|
1614
|
-
export function
|
|
1705
|
+
export function isCipherError(error: any): error is CipherError;
|
|
1615
1706
|
|
|
1616
1707
|
export interface SshKeyView {
|
|
1617
1708
|
/**
|
|
@@ -1643,16 +1734,6 @@ export interface SshKey {
|
|
|
1643
1734
|
fingerprint: EncString;
|
|
1644
1735
|
}
|
|
1645
1736
|
|
|
1646
|
-
export interface LocalDataView {
|
|
1647
|
-
lastUsedDate: DateTime<Utc> | undefined;
|
|
1648
|
-
lastLaunched: DateTime<Utc> | undefined;
|
|
1649
|
-
}
|
|
1650
|
-
|
|
1651
|
-
export interface LocalData {
|
|
1652
|
-
lastUsedDate: DateTime<Utc> | undefined;
|
|
1653
|
-
lastLaunched: DateTime<Utc> | undefined;
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
1737
|
export interface IdentityView {
|
|
1657
1738
|
title: string | undefined;
|
|
1658
1739
|
firstName: string | undefined;
|
|
@@ -1686,153 +1767,72 @@ export interface Identity {
|
|
|
1686
1767
|
state: EncString | undefined;
|
|
1687
1768
|
postalCode: EncString | undefined;
|
|
1688
1769
|
country: EncString | undefined;
|
|
1689
|
-
company: EncString | undefined;
|
|
1690
|
-
email: EncString | undefined;
|
|
1691
|
-
phone: EncString | undefined;
|
|
1692
|
-
ssn: EncString | undefined;
|
|
1693
|
-
username: EncString | undefined;
|
|
1694
|
-
passportNumber: EncString | undefined;
|
|
1695
|
-
licenseNumber: EncString | undefined;
|
|
1696
|
-
}
|
|
1697
|
-
|
|
1698
|
-
/**
|
|
1699
|
-
* Represents the inner data of a cipher view.
|
|
1700
|
-
*/
|
|
1701
|
-
export type CipherViewType =
|
|
1702
|
-
| { login: LoginView }
|
|
1703
|
-
| { card: CardView }
|
|
1704
|
-
| { identity: IdentityView }
|
|
1705
|
-
| { secureNote: SecureNoteView }
|
|
1706
|
-
| { sshKey: SshKeyView };
|
|
1707
|
-
|
|
1708
|
-
export interface CipherPermissions {
|
|
1709
|
-
delete: boolean;
|
|
1710
|
-
restore: boolean;
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
export interface GetCipherError extends Error {
|
|
1714
|
-
name: "GetCipherError";
|
|
1715
|
-
variant: "ItemNotFound" | "Crypto" | "RepositoryError";
|
|
1716
|
-
}
|
|
1717
|
-
|
|
1718
|
-
export function isGetCipherError(error: any): error is GetCipherError;
|
|
1719
|
-
|
|
1720
|
-
export interface EditCipherError extends Error {
|
|
1721
|
-
name: "EditCipherError";
|
|
1722
|
-
variant:
|
|
1723
|
-
| "ItemNotFound"
|
|
1724
|
-
| "Crypto"
|
|
1725
|
-
| "Api"
|
|
1726
|
-
| "VaultParse"
|
|
1727
|
-
| "MissingField"
|
|
1728
|
-
| "NotAuthenticated"
|
|
1729
|
-
| "Repository"
|
|
1730
|
-
| "Uuid";
|
|
1731
|
-
}
|
|
1732
|
-
|
|
1733
|
-
export function isEditCipherError(error: any): error is EditCipherError;
|
|
1734
|
-
|
|
1735
|
-
export interface CreateCipherError extends Error {
|
|
1736
|
-
name: "CreateCipherError";
|
|
1737
|
-
variant: "Crypto" | "Api" | "VaultParse" | "MissingField" | "NotAuthenticated" | "Repository";
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
export function isCreateCipherError(error: any): error is CreateCipherError;
|
|
1741
|
-
|
|
1742
|
-
export interface CipherError extends Error {
|
|
1743
|
-
name: "CipherError";
|
|
1744
|
-
variant:
|
|
1745
|
-
| "MissingField"
|
|
1746
|
-
| "Crypto"
|
|
1747
|
-
| "Decrypt"
|
|
1748
|
-
| "Encrypt"
|
|
1749
|
-
| "AttachmentsWithoutKeys"
|
|
1750
|
-
| "OrganizationAlreadySet"
|
|
1751
|
-
| "PutShare"
|
|
1752
|
-
| "PutShareMany"
|
|
1753
|
-
| "Repository"
|
|
1754
|
-
| "Chrono"
|
|
1755
|
-
| "SerdeJson";
|
|
1770
|
+
company: EncString | undefined;
|
|
1771
|
+
email: EncString | undefined;
|
|
1772
|
+
phone: EncString | undefined;
|
|
1773
|
+
ssn: EncString | undefined;
|
|
1774
|
+
username: EncString | undefined;
|
|
1775
|
+
passportNumber: EncString | undefined;
|
|
1776
|
+
licenseNumber: EncString | undefined;
|
|
1756
1777
|
}
|
|
1757
1778
|
|
|
1758
|
-
export
|
|
1779
|
+
export type LinkedIdType = LoginLinkedIdType | CardLinkedIdType | IdentityLinkedIdType;
|
|
1759
1780
|
|
|
1760
1781
|
/**
|
|
1761
|
-
*
|
|
1782
|
+
* NewType wrapper for `FolderId`
|
|
1762
1783
|
*/
|
|
1763
|
-
export
|
|
1764
|
-
/**
|
|
1765
|
-
* The brand of the card, e.g. Visa, Mastercard, etc.
|
|
1766
|
-
*/
|
|
1767
|
-
brand: string | undefined;
|
|
1768
|
-
}
|
|
1784
|
+
export type FolderId = Tagged<Uuid, "FolderId">;
|
|
1769
1785
|
|
|
1770
|
-
export interface
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
code: string | undefined;
|
|
1775
|
-
brand: string | undefined;
|
|
1776
|
-
number: string | undefined;
|
|
1786
|
+
export interface Folder {
|
|
1787
|
+
id: FolderId | undefined;
|
|
1788
|
+
name: EncString;
|
|
1789
|
+
revisionDate: DateTime<Utc>;
|
|
1777
1790
|
}
|
|
1778
1791
|
|
|
1779
|
-
export interface
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
code: EncString | undefined;
|
|
1784
|
-
brand: EncString | undefined;
|
|
1785
|
-
number: EncString | undefined;
|
|
1792
|
+
export interface FolderView {
|
|
1793
|
+
id: FolderId | undefined;
|
|
1794
|
+
name: string;
|
|
1795
|
+
revisionDate: DateTime<Utc>;
|
|
1786
1796
|
}
|
|
1787
1797
|
|
|
1788
|
-
export interface
|
|
1789
|
-
name: "
|
|
1790
|
-
variant:
|
|
1798
|
+
export interface EditFolderError extends Error {
|
|
1799
|
+
name: "EditFolderError";
|
|
1800
|
+
variant:
|
|
1801
|
+
| "ItemNotFound"
|
|
1802
|
+
| "Crypto"
|
|
1803
|
+
| "Api"
|
|
1804
|
+
| "VaultParse"
|
|
1805
|
+
| "MissingField"
|
|
1806
|
+
| "Repository"
|
|
1807
|
+
| "Uuid";
|
|
1791
1808
|
}
|
|
1792
1809
|
|
|
1793
|
-
export function
|
|
1810
|
+
export function isEditFolderError(error: any): error is EditFolderError;
|
|
1794
1811
|
|
|
1795
|
-
export interface
|
|
1796
|
-
name: "
|
|
1797
|
-
variant: "
|
|
1812
|
+
export interface CreateFolderError extends Error {
|
|
1813
|
+
name: "CreateFolderError";
|
|
1814
|
+
variant: "Crypto" | "Api" | "VaultParse" | "MissingField" | "Repository";
|
|
1798
1815
|
}
|
|
1799
1816
|
|
|
1800
|
-
export function
|
|
1817
|
+
export function isCreateFolderError(error: any): error is CreateFolderError;
|
|
1801
1818
|
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
sizeName: string | undefined;
|
|
1807
|
-
fileName: string | undefined;
|
|
1808
|
-
key: EncString | undefined;
|
|
1819
|
+
/**
|
|
1820
|
+
* Request to add or edit a folder.
|
|
1821
|
+
*/
|
|
1822
|
+
export interface FolderAddEditRequest {
|
|
1809
1823
|
/**
|
|
1810
|
-
* The
|
|
1811
|
-
*
|
|
1812
|
-
* **TEMPORARY FIELD**: This field is a temporary workaround to provide
|
|
1813
|
-
* decrypted attachment keys to the TypeScript client during the migration
|
|
1814
|
-
* process. It will be removed once the encryption/decryption logic is
|
|
1815
|
-
* fully migrated to the SDK.
|
|
1816
|
-
*
|
|
1817
|
-
* **Ticket**: <https://bitwarden.atlassian.net/browse/PM-23005>
|
|
1818
|
-
*
|
|
1819
|
-
* Do not rely on this field for long-term use.
|
|
1824
|
+
* The new name of the folder.
|
|
1820
1825
|
*/
|
|
1821
|
-
|
|
1826
|
+
name: string;
|
|
1822
1827
|
}
|
|
1823
1828
|
|
|
1824
|
-
export interface
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
size: string | undefined;
|
|
1828
|
-
/**
|
|
1829
|
-
* Readable size, ex: \"4.2 KB\" or \"1.43 GB\
|
|
1830
|
-
*/
|
|
1831
|
-
sizeName: string | undefined;
|
|
1832
|
-
fileName: EncString | undefined;
|
|
1833
|
-
key: EncString | undefined;
|
|
1829
|
+
export interface GetFolderError extends Error {
|
|
1830
|
+
name: "GetFolderError";
|
|
1831
|
+
variant: "ItemNotFound" | "Crypto" | "Repository";
|
|
1834
1832
|
}
|
|
1835
1833
|
|
|
1834
|
+
export function isGetFolderError(error: any): error is GetFolderError;
|
|
1835
|
+
|
|
1836
1836
|
export class AttachmentsClient {
|
|
1837
1837
|
private constructor();
|
|
1838
1838
|
free(): void;
|
|
@@ -1850,10 +1850,6 @@ export class AuthClient {
|
|
|
1850
1850
|
private constructor();
|
|
1851
1851
|
free(): void;
|
|
1852
1852
|
[Symbol.dispose](): void;
|
|
1853
|
-
/**
|
|
1854
|
-
* Client for identity functionality
|
|
1855
|
-
*/
|
|
1856
|
-
identity(): IdentityClient;
|
|
1857
1853
|
/**
|
|
1858
1854
|
* Client for send access functionality
|
|
1859
1855
|
*/
|
|
@@ -1862,6 +1858,10 @@ export class AuthClient {
|
|
|
1862
1858
|
* Client for initializing user account cryptography and unlock methods after JIT provisioning
|
|
1863
1859
|
*/
|
|
1864
1860
|
registration(): RegistrationClient;
|
|
1861
|
+
/**
|
|
1862
|
+
* Client for identity functionality
|
|
1863
|
+
*/
|
|
1864
|
+
identity(): IdentityClient;
|
|
1865
1865
|
}
|
|
1866
1866
|
/**
|
|
1867
1867
|
* Client for evaluating credential risk for login ciphers.
|
|
@@ -1870,14 +1870,6 @@ export class CipherRiskClient {
|
|
|
1870
1870
|
private constructor();
|
|
1871
1871
|
free(): void;
|
|
1872
1872
|
[Symbol.dispose](): void;
|
|
1873
|
-
/**
|
|
1874
|
-
* Build password reuse map for a list of login ciphers.
|
|
1875
|
-
*
|
|
1876
|
-
* Returns a map where keys are passwords and values are the number of times
|
|
1877
|
-
* each password appears in the provided list. This map can be passed to `compute_risk()`
|
|
1878
|
-
* to enable password reuse detection.
|
|
1879
|
-
*/
|
|
1880
|
-
password_reuse_map(login_details: CipherLoginDetails[]): PasswordReuseMap;
|
|
1881
1873
|
/**
|
|
1882
1874
|
* Evaluate security risks for multiple login ciphers concurrently.
|
|
1883
1875
|
*
|
|
@@ -1906,19 +1898,19 @@ export class CipherRiskClient {
|
|
|
1906
1898
|
login_details: CipherLoginDetails[],
|
|
1907
1899
|
options: CipherRiskOptions,
|
|
1908
1900
|
): Promise<CipherRiskResult[]>;
|
|
1901
|
+
/**
|
|
1902
|
+
* Build password reuse map for a list of login ciphers.
|
|
1903
|
+
*
|
|
1904
|
+
* Returns a map where keys are passwords and values are the number of times
|
|
1905
|
+
* each password appears in the provided list. This map can be passed to `compute_risk()`
|
|
1906
|
+
* to enable password reuse detection.
|
|
1907
|
+
*/
|
|
1908
|
+
password_reuse_map(login_details: CipherLoginDetails[]): PasswordReuseMap;
|
|
1909
1909
|
}
|
|
1910
1910
|
export class CiphersClient {
|
|
1911
1911
|
private constructor();
|
|
1912
1912
|
free(): void;
|
|
1913
1913
|
[Symbol.dispose](): void;
|
|
1914
|
-
/**
|
|
1915
|
-
* Create a new [Cipher] and save it to the server.
|
|
1916
|
-
*/
|
|
1917
|
-
create(request: CipherCreateRequest): Promise<CipherView>;
|
|
1918
|
-
/**
|
|
1919
|
-
* Edit an existing [Cipher] and save it to the server.
|
|
1920
|
-
*/
|
|
1921
|
-
edit(request: CipherEditRequest): Promise<CipherView>;
|
|
1922
1914
|
/**
|
|
1923
1915
|
* Moves a cipher into an organization, adds it to collections, and calls the share_cipher API.
|
|
1924
1916
|
*/
|
|
@@ -1937,7 +1929,26 @@ export class CiphersClient {
|
|
|
1937
1929
|
organization_id: OrganizationId,
|
|
1938
1930
|
collection_ids: CollectionId[],
|
|
1939
1931
|
): Promise<Cipher[]>;
|
|
1940
|
-
|
|
1932
|
+
decrypt_list(ciphers: Cipher[]): CipherListView[];
|
|
1933
|
+
move_to_organization(cipher_view: CipherView, organization_id: OrganizationId): CipherView;
|
|
1934
|
+
/**
|
|
1935
|
+
* Temporary method used to re-encrypt FIDO2 credentials for a cipher view.
|
|
1936
|
+
* Necessary until the TS clients utilize the SDK entirely for FIDO2 credentials management.
|
|
1937
|
+
* TS clients create decrypted FIDO2 credentials that need to be encrypted manually when
|
|
1938
|
+
* encrypting the rest of the CipherView.
|
|
1939
|
+
* TODO: Remove once TS passkey provider implementation uses SDK - PM-8313
|
|
1940
|
+
*/
|
|
1941
|
+
set_fido2_credentials(
|
|
1942
|
+
cipher_view: CipherView,
|
|
1943
|
+
fido2_credentials: Fido2CredentialFullView[],
|
|
1944
|
+
): CipherView;
|
|
1945
|
+
decrypt_fido2_credentials(cipher_view: CipherView): Fido2CredentialView[];
|
|
1946
|
+
decrypt_fido2_private_key(cipher_view: CipherView): string;
|
|
1947
|
+
/**
|
|
1948
|
+
* Decrypt cipher list with failures
|
|
1949
|
+
* Returns both successfully decrypted ciphers and any that failed to decrypt
|
|
1950
|
+
*/
|
|
1951
|
+
decrypt_list_with_failures(ciphers: Cipher[]): DecryptCipherListResult;
|
|
1941
1952
|
/**
|
|
1942
1953
|
* Encrypt a cipher with the provided key. This should only be used when rotating encryption
|
|
1943
1954
|
* keys in the Web client.
|
|
@@ -1952,49 +1963,37 @@ export class CiphersClient {
|
|
|
1952
1963
|
*/
|
|
1953
1964
|
encrypt_cipher_for_rotation(cipher_view: CipherView, new_key: B64): EncryptionContext;
|
|
1954
1965
|
decrypt(cipher: Cipher): CipherView;
|
|
1955
|
-
|
|
1966
|
+
encrypt(cipher_view: CipherView): EncryptionContext;
|
|
1956
1967
|
/**
|
|
1957
|
-
*
|
|
1958
|
-
* Returns both successfully decrypted ciphers and any that failed to decrypt
|
|
1968
|
+
* Edit an existing [Cipher] and save it to the server.
|
|
1959
1969
|
*/
|
|
1960
|
-
|
|
1961
|
-
decrypt_fido2_credentials(cipher_view: CipherView): Fido2CredentialView[];
|
|
1970
|
+
edit(request: CipherEditRequest): Promise<CipherView>;
|
|
1962
1971
|
/**
|
|
1963
|
-
*
|
|
1964
|
-
* Necessary until the TS clients utilize the SDK entirely for FIDO2 credentials management.
|
|
1965
|
-
* TS clients create decrypted FIDO2 credentials that need to be encrypted manually when
|
|
1966
|
-
* encrypting the rest of the CipherView.
|
|
1967
|
-
* TODO: Remove once TS passkey provider implementation uses SDK - PM-8313
|
|
1972
|
+
* Create a new [Cipher] and save it to the server.
|
|
1968
1973
|
*/
|
|
1969
|
-
|
|
1970
|
-
cipher_view: CipherView,
|
|
1971
|
-
fido2_credentials: Fido2CredentialFullView[],
|
|
1972
|
-
): CipherView;
|
|
1973
|
-
move_to_organization(cipher_view: CipherView, organization_id: OrganizationId): CipherView;
|
|
1974
|
-
decrypt_fido2_private_key(cipher_view: CipherView): string;
|
|
1974
|
+
create(request: CipherCreateRequest): Promise<CipherView>;
|
|
1975
1975
|
}
|
|
1976
1976
|
export class CollectionViewNodeItem {
|
|
1977
1977
|
private constructor();
|
|
1978
1978
|
free(): void;
|
|
1979
1979
|
[Symbol.dispose](): void;
|
|
1980
|
-
get_item(): CollectionView;
|
|
1981
1980
|
get_parent(): CollectionView | undefined;
|
|
1982
1981
|
get_children(): CollectionView[];
|
|
1983
1982
|
get_ancestors(): AncestorMap;
|
|
1983
|
+
get_item(): CollectionView;
|
|
1984
1984
|
}
|
|
1985
1985
|
export class CollectionViewTree {
|
|
1986
1986
|
private constructor();
|
|
1987
1987
|
free(): void;
|
|
1988
1988
|
[Symbol.dispose](): void;
|
|
1989
|
-
get_item_for_view(collection_view: CollectionView): CollectionViewNodeItem | undefined;
|
|
1990
|
-
get_root_items(): CollectionViewNodeItem[];
|
|
1991
1989
|
get_flat_items(): CollectionViewNodeItem[];
|
|
1990
|
+
get_root_items(): CollectionViewNodeItem[];
|
|
1991
|
+
get_item_for_view(collection_view: CollectionView): CollectionViewNodeItem | undefined;
|
|
1992
1992
|
}
|
|
1993
1993
|
export class CollectionsClient {
|
|
1994
1994
|
private constructor();
|
|
1995
1995
|
free(): void;
|
|
1996
1996
|
[Symbol.dispose](): void;
|
|
1997
|
-
decrypt(collection: Collection): CollectionView;
|
|
1998
1997
|
decrypt_list(collections: Collection[]): CollectionView[];
|
|
1999
1998
|
/**
|
|
2000
1999
|
*
|
|
@@ -2002,6 +2001,7 @@ export class CollectionsClient {
|
|
|
2002
2001
|
* path().
|
|
2003
2002
|
*/
|
|
2004
2003
|
get_collection_tree(collections: CollectionView[]): CollectionViewTree;
|
|
2004
|
+
decrypt(collection: Collection): CollectionView;
|
|
2005
2005
|
}
|
|
2006
2006
|
/**
|
|
2007
2007
|
* A client for the crypto operations.
|
|
@@ -2011,46 +2011,46 @@ export class CryptoClient {
|
|
|
2011
2011
|
free(): void;
|
|
2012
2012
|
[Symbol.dispose](): void;
|
|
2013
2013
|
/**
|
|
2014
|
-
*
|
|
2015
|
-
*
|
|
2014
|
+
* Protects the current user key with the provided PIN. The result can be stored and later
|
|
2015
|
+
* used to initialize another client instance by using the PIN and the PIN key with
|
|
2016
|
+
* `initialize_user_crypto`.
|
|
2016
2017
|
*/
|
|
2017
|
-
|
|
2018
|
+
enroll_pin(pin: string): EnrollPinResponse;
|
|
2019
|
+
/**
|
|
2020
|
+
* Generates a new key pair and encrypts the private key with the provided user key.
|
|
2021
|
+
* Crypto initialization not required.
|
|
2022
|
+
*/
|
|
2023
|
+
make_key_pair(user_key: B64): MakeKeyPairResponse;
|
|
2024
|
+
/**
|
|
2025
|
+
* Create the data necessary to update the user's kdf settings. The user's encryption key is
|
|
2026
|
+
* re-encrypted for the password under the new kdf settings. This returns the re-encrypted
|
|
2027
|
+
* user key and the new password hash but does not update sdk state.
|
|
2028
|
+
*/
|
|
2029
|
+
make_update_kdf(password: string, kdf: Kdf): UpdateKdfResponse;
|
|
2018
2030
|
/**
|
|
2019
2031
|
* Initialization method for the organization crypto. Needs to be called after
|
|
2020
2032
|
* `initialize_user_crypto` but before any other crypto operations.
|
|
2021
2033
|
*/
|
|
2022
2034
|
initialize_org_crypto(req: InitOrgCryptoRequest): Promise<void>;
|
|
2023
2035
|
/**
|
|
2024
|
-
*
|
|
2025
|
-
*
|
|
2036
|
+
* Initialization method for the user crypto. Needs to be called before any other crypto
|
|
2037
|
+
* operations.
|
|
2026
2038
|
*/
|
|
2027
|
-
|
|
2039
|
+
initialize_user_crypto(req: InitUserCryptoRequest): Promise<void>;
|
|
2028
2040
|
/**
|
|
2029
2041
|
* Verifies a user's asymmetric keys by decrypting the private key with the provided user
|
|
2030
2042
|
* key. Returns if the private key is decryptable and if it is a valid matching key.
|
|
2031
2043
|
* Crypto initialization not required.
|
|
2032
2044
|
*/
|
|
2033
2045
|
verify_asymmetric_keys(request: VerifyAsymmetricKeysRequest): VerifyAsymmetricKeysResponse;
|
|
2034
|
-
/**
|
|
2035
|
-
* Makes a new signing key pair and signs the public key for the user
|
|
2036
|
-
*/
|
|
2037
|
-
make_keys_for_user_crypto_v2(): UserCryptoV2KeysResponse;
|
|
2038
2046
|
/**
|
|
2039
2047
|
* Creates a rotated set of account keys for the current state
|
|
2040
2048
|
*/
|
|
2041
2049
|
get_v2_rotated_account_keys(): UserCryptoV2KeysResponse;
|
|
2042
2050
|
/**
|
|
2043
|
-
*
|
|
2044
|
-
* re-encrypted for the password under the new kdf settings. This returns the re-encrypted
|
|
2045
|
-
* user key and the new password hash but does not update sdk state.
|
|
2046
|
-
*/
|
|
2047
|
-
make_update_kdf(password: string, kdf: Kdf): UpdateKdfResponse;
|
|
2048
|
-
/**
|
|
2049
|
-
* Protects the current user key with the provided PIN. The result can be stored and later
|
|
2050
|
-
* used to initialize another client instance by using the PIN and the PIN key with
|
|
2051
|
-
* `initialize_user_crypto`.
|
|
2051
|
+
* Makes a new signing key pair and signs the public key for the user
|
|
2052
2052
|
*/
|
|
2053
|
-
|
|
2053
|
+
make_keys_for_user_crypto_v2(): UserCryptoV2KeysResponse;
|
|
2054
2054
|
/**
|
|
2055
2055
|
* Protects the current user key with the provided PIN. The result can be stored and later
|
|
2056
2056
|
* used to initialize another client instance by using the PIN and the PIN key with
|
|
@@ -2067,12 +2067,6 @@ export class ExporterClient {
|
|
|
2067
2067
|
private constructor();
|
|
2068
2068
|
free(): void;
|
|
2069
2069
|
[Symbol.dispose](): void;
|
|
2070
|
-
export_vault(folders: Folder[], ciphers: Cipher[], format: ExportFormat): string;
|
|
2071
|
-
export_organization_vault(
|
|
2072
|
-
collections: Collection[],
|
|
2073
|
-
ciphers: Cipher[],
|
|
2074
|
-
format: ExportFormat,
|
|
2075
|
-
): string;
|
|
2076
2070
|
/**
|
|
2077
2071
|
* Credential Exchange Format (CXF)
|
|
2078
2072
|
*
|
|
@@ -2091,6 +2085,12 @@ export class ExporterClient {
|
|
|
2091
2085
|
* Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
|
|
2092
2086
|
*/
|
|
2093
2087
|
import_cxf(payload: string): Cipher[];
|
|
2088
|
+
export_vault(folders: Folder[], ciphers: Cipher[], format: ExportFormat): string;
|
|
2089
|
+
export_organization_vault(
|
|
2090
|
+
collections: Collection[],
|
|
2091
|
+
ciphers: Cipher[],
|
|
2092
|
+
format: ExportFormat,
|
|
2093
|
+
): string;
|
|
2094
2094
|
}
|
|
2095
2095
|
/**
|
|
2096
2096
|
* Wrapper for folder specific functionality.
|
|
@@ -2100,90 +2100,90 @@ export class FoldersClient {
|
|
|
2100
2100
|
free(): void;
|
|
2101
2101
|
[Symbol.dispose](): void;
|
|
2102
2102
|
/**
|
|
2103
|
-
*
|
|
2103
|
+
* Decrypt a list of [Folder]s to a list of [FolderView]s.
|
|
2104
2104
|
*/
|
|
2105
|
-
|
|
2105
|
+
decrypt_list(folders: Folder[]): FolderView[];
|
|
2106
2106
|
/**
|
|
2107
|
-
*
|
|
2107
|
+
* Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
|
|
2108
2108
|
*/
|
|
2109
|
-
|
|
2109
|
+
get(folder_id: FolderId): Promise<FolderView>;
|
|
2110
2110
|
/**
|
|
2111
|
-
*
|
|
2111
|
+
* Edit the [Folder] and save it to the server.
|
|
2112
2112
|
*/
|
|
2113
|
-
|
|
2113
|
+
edit(folder_id: FolderId, request: FolderAddEditRequest): Promise<FolderView>;
|
|
2114
2114
|
/**
|
|
2115
2115
|
* Get all folders from state and decrypt them to a list of [FolderView].
|
|
2116
2116
|
*/
|
|
2117
2117
|
list(): Promise<FolderView[]>;
|
|
2118
|
-
/**
|
|
2119
|
-
* Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
|
|
2120
|
-
*/
|
|
2121
|
-
get(folder_id: FolderId): Promise<FolderView>;
|
|
2122
2118
|
/**
|
|
2123
2119
|
* Create a new [Folder] and save it to the server.
|
|
2124
2120
|
*/
|
|
2125
2121
|
create(request: FolderAddEditRequest): Promise<FolderView>;
|
|
2126
2122
|
/**
|
|
2127
|
-
*
|
|
2123
|
+
* Encrypt a [Folder] to [FolderView].
|
|
2124
|
+
*/
|
|
2125
|
+
decrypt(folder: Folder): FolderView;
|
|
2126
|
+
/**
|
|
2127
|
+
* Encrypt a [FolderView] to a [Folder].
|
|
2128
2128
|
*/
|
|
2129
|
-
|
|
2129
|
+
encrypt(folder_view: FolderView): Folder;
|
|
2130
2130
|
}
|
|
2131
2131
|
export class GeneratorClient {
|
|
2132
2132
|
private constructor();
|
|
2133
2133
|
free(): void;
|
|
2134
2134
|
[Symbol.dispose](): void;
|
|
2135
2135
|
/**
|
|
2136
|
-
* Generates a random
|
|
2136
|
+
* Generates a random passphrase.
|
|
2137
|
+
* A passphrase is a combination of random words separated by a character.
|
|
2138
|
+
* An example of passphrase is `correct horse battery staple`.
|
|
2137
2139
|
*
|
|
2138
|
-
* The
|
|
2140
|
+
* The number of words and their case, the word separator, and the inclusion of
|
|
2141
|
+
* a number in the passphrase can be customized using the `input` parameter.
|
|
2139
2142
|
*
|
|
2140
2143
|
* # Examples
|
|
2141
2144
|
*
|
|
2142
2145
|
* ```
|
|
2143
2146
|
* use bitwarden_core::Client;
|
|
2144
|
-
* use bitwarden_generators::{GeneratorClientsExt, PassphraseError,
|
|
2147
|
+
* use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
|
|
2145
2148
|
*
|
|
2146
2149
|
* async fn test() -> Result<(), PassphraseError> {
|
|
2147
|
-
* let input =
|
|
2148
|
-
*
|
|
2149
|
-
* uppercase: true,
|
|
2150
|
-
* numbers: true,
|
|
2151
|
-
* length: 20,
|
|
2150
|
+
* let input = PassphraseGeneratorRequest {
|
|
2151
|
+
* num_words: 4,
|
|
2152
2152
|
* ..Default::default()
|
|
2153
2153
|
* };
|
|
2154
|
-
* let
|
|
2155
|
-
* println!("{}",
|
|
2154
|
+
* let passphrase = Client::new(None).generator().passphrase(input).unwrap();
|
|
2155
|
+
* println!("{}", passphrase);
|
|
2156
2156
|
* Ok(())
|
|
2157
2157
|
* }
|
|
2158
2158
|
* ```
|
|
2159
2159
|
*/
|
|
2160
|
-
|
|
2160
|
+
passphrase(input: PassphraseGeneratorRequest): string;
|
|
2161
2161
|
/**
|
|
2162
|
-
* Generates a random
|
|
2163
|
-
* A passphrase is a combination of random words separated by a character.
|
|
2164
|
-
* An example of passphrase is `correct horse battery staple`.
|
|
2162
|
+
* Generates a random password.
|
|
2165
2163
|
*
|
|
2166
|
-
* The
|
|
2167
|
-
* a number in the passphrase can be customized using the `input` parameter.
|
|
2164
|
+
* The character sets and password length can be customized using the `input` parameter.
|
|
2168
2165
|
*
|
|
2169
2166
|
* # Examples
|
|
2170
2167
|
*
|
|
2171
2168
|
* ```
|
|
2172
2169
|
* use bitwarden_core::Client;
|
|
2173
|
-
* use bitwarden_generators::{GeneratorClientsExt, PassphraseError,
|
|
2170
|
+
* use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
|
|
2174
2171
|
*
|
|
2175
2172
|
* async fn test() -> Result<(), PassphraseError> {
|
|
2176
|
-
* let input =
|
|
2177
|
-
*
|
|
2173
|
+
* let input = PasswordGeneratorRequest {
|
|
2174
|
+
* lowercase: true,
|
|
2175
|
+
* uppercase: true,
|
|
2176
|
+
* numbers: true,
|
|
2177
|
+
* length: 20,
|
|
2178
2178
|
* ..Default::default()
|
|
2179
2179
|
* };
|
|
2180
|
-
* let
|
|
2181
|
-
* println!("{}",
|
|
2180
|
+
* let password = Client::new(None).generator().password(input).unwrap();
|
|
2181
|
+
* println!("{}", password);
|
|
2182
2182
|
* Ok(())
|
|
2183
2183
|
* }
|
|
2184
2184
|
* ```
|
|
2185
2185
|
*/
|
|
2186
|
-
|
|
2186
|
+
password(input: PasswordGeneratorRequest): string;
|
|
2187
2187
|
}
|
|
2188
2188
|
/**
|
|
2189
2189
|
* The IdentityClient is used to obtain identity / access tokens from the Bitwarden Identity API.
|
|
@@ -2196,12 +2196,12 @@ export class IdentityClient {
|
|
|
2196
2196
|
export class IncomingMessage {
|
|
2197
2197
|
free(): void;
|
|
2198
2198
|
[Symbol.dispose](): void;
|
|
2199
|
-
constructor(payload: Uint8Array, destination: Endpoint, source: Endpoint, topic?: string | null);
|
|
2200
2199
|
/**
|
|
2201
2200
|
* Try to parse the payload as JSON.
|
|
2202
2201
|
* @returns The parsed JSON value, or undefined if the payload is not valid JSON.
|
|
2203
2202
|
*/
|
|
2204
2203
|
parse_payload_as_json(): any;
|
|
2204
|
+
constructor(payload: Uint8Array, destination: Endpoint, source: Endpoint, topic?: string | null);
|
|
2205
2205
|
payload: Uint8Array;
|
|
2206
2206
|
destination: Endpoint;
|
|
2207
2207
|
source: Endpoint;
|
|
@@ -2216,6 +2216,7 @@ export class IpcClient {
|
|
|
2216
2216
|
private constructor();
|
|
2217
2217
|
free(): void;
|
|
2218
2218
|
[Symbol.dispose](): void;
|
|
2219
|
+
isRunning(): Promise<boolean>;
|
|
2219
2220
|
/**
|
|
2220
2221
|
* Create a new `IpcClient` instance with an in-memory session repository for saving
|
|
2221
2222
|
* sessions within the SDK.
|
|
@@ -2229,9 +2230,8 @@ export class IpcClient {
|
|
|
2229
2230
|
communication_provider: IpcCommunicationBackend,
|
|
2230
2231
|
session_repository: IpcSessionRepository,
|
|
2231
2232
|
): IpcClient;
|
|
2232
|
-
start(): Promise<void>;
|
|
2233
|
-
isRunning(): Promise<boolean>;
|
|
2234
2233
|
send(message: OutgoingMessage): Promise<void>;
|
|
2234
|
+
start(): Promise<void>;
|
|
2235
2235
|
subscribe(): Promise<IpcClientSubscription>;
|
|
2236
2236
|
}
|
|
2237
2237
|
/**
|
|
@@ -2262,7 +2262,6 @@ export class IpcCommunicationBackend {
|
|
|
2262
2262
|
export class OutgoingMessage {
|
|
2263
2263
|
free(): void;
|
|
2264
2264
|
[Symbol.dispose](): void;
|
|
2265
|
-
constructor(payload: Uint8Array, destination: Endpoint, topic?: string | null);
|
|
2266
2265
|
/**
|
|
2267
2266
|
* Create a new message and encode the payload as JSON.
|
|
2268
2267
|
*/
|
|
@@ -2271,6 +2270,7 @@ export class OutgoingMessage {
|
|
|
2271
2270
|
destination: Endpoint,
|
|
2272
2271
|
topic?: string | null,
|
|
2273
2272
|
): OutgoingMessage;
|
|
2273
|
+
constructor(payload: Uint8Array, destination: Endpoint, topic?: string | null);
|
|
2274
2274
|
payload: Uint8Array;
|
|
2275
2275
|
destination: Endpoint;
|
|
2276
2276
|
get topic(): string | undefined;
|
|
@@ -2287,55 +2287,55 @@ export class PasswordManagerClient {
|
|
|
2287
2287
|
*/
|
|
2288
2288
|
constructor(token_provider: any, settings?: ClientSettings | null);
|
|
2289
2289
|
/**
|
|
2290
|
-
*
|
|
2290
|
+
* Auth related operations.
|
|
2291
2291
|
*/
|
|
2292
|
-
|
|
2292
|
+
auth(): AuthClient;
|
|
2293
2293
|
/**
|
|
2294
|
-
*
|
|
2294
|
+
* Test method, echoes back the input
|
|
2295
2295
|
*/
|
|
2296
|
-
|
|
2296
|
+
echo(msg: string): string;
|
|
2297
2297
|
/**
|
|
2298
2298
|
* Test method, always throws an error
|
|
2299
2299
|
*/
|
|
2300
2300
|
throw(msg: string): void;
|
|
2301
2301
|
/**
|
|
2302
|
-
*
|
|
2303
|
-
*/
|
|
2304
|
-
http_get(url: string): Promise<string>;
|
|
2305
|
-
/**
|
|
2306
|
-
* Auth related operations.
|
|
2302
|
+
* Vault item related operations.
|
|
2307
2303
|
*/
|
|
2308
|
-
|
|
2304
|
+
vault(): VaultClient;
|
|
2309
2305
|
/**
|
|
2310
2306
|
* Crypto related operations.
|
|
2311
2307
|
*/
|
|
2312
2308
|
crypto(): CryptoClient;
|
|
2313
2309
|
/**
|
|
2314
|
-
*
|
|
2310
|
+
* Returns the current SDK version
|
|
2315
2311
|
*/
|
|
2316
|
-
|
|
2312
|
+
version(): string;
|
|
2317
2313
|
/**
|
|
2318
|
-
*
|
|
2314
|
+
* Test method, calls http endpoint
|
|
2319
2315
|
*/
|
|
2320
|
-
|
|
2316
|
+
http_get(url: string): Promise<string>;
|
|
2321
2317
|
/**
|
|
2322
|
-
* Constructs a specific client for
|
|
2318
|
+
* Constructs a specific client for platform-specific functionality
|
|
2323
2319
|
*/
|
|
2324
|
-
|
|
2320
|
+
platform(): PlatformClient;
|
|
2325
2321
|
/**
|
|
2326
2322
|
* Exporter related operations.
|
|
2327
2323
|
*/
|
|
2328
2324
|
exporters(): ExporterClient;
|
|
2325
|
+
/**
|
|
2326
|
+
* Constructs a specific client for generating passwords and passphrases
|
|
2327
|
+
*/
|
|
2328
|
+
generator(): GeneratorClient;
|
|
2329
2329
|
}
|
|
2330
2330
|
export class PlatformClient {
|
|
2331
2331
|
private constructor();
|
|
2332
2332
|
free(): void;
|
|
2333
2333
|
[Symbol.dispose](): void;
|
|
2334
|
-
state(): StateClient;
|
|
2335
2334
|
/**
|
|
2336
2335
|
* Load feature flags into the client
|
|
2337
2336
|
*/
|
|
2338
2337
|
load_flags(flags: FeatureFlags): void;
|
|
2338
|
+
state(): StateClient;
|
|
2339
2339
|
}
|
|
2340
2340
|
/**
|
|
2341
2341
|
* This module represents a stopgap solution to provide access to primitive crypto functions for JS
|
|
@@ -2348,77 +2348,63 @@ export class PureCrypto {
|
|
|
2348
2348
|
free(): void;
|
|
2349
2349
|
[Symbol.dispose](): void;
|
|
2350
2350
|
/**
|
|
2351
|
-
*
|
|
2352
|
-
*
|
|
2351
|
+
* Decrypts data using RSAES-OAEP with SHA-1
|
|
2352
|
+
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
2353
2353
|
*/
|
|
2354
|
-
static
|
|
2355
|
-
static symmetric_decrypt_string(enc_string: string, key: Uint8Array): string;
|
|
2356
|
-
static symmetric_decrypt_bytes(enc_string: string, key: Uint8Array): Uint8Array;
|
|
2354
|
+
static rsa_decrypt_data(encrypted_data: Uint8Array, private_key: Uint8Array): Uint8Array;
|
|
2357
2355
|
/**
|
|
2358
|
-
*
|
|
2359
|
-
*
|
|
2356
|
+
* Encrypts data using RSAES-OAEP with SHA-1
|
|
2357
|
+
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
2360
2358
|
*/
|
|
2361
|
-
static
|
|
2362
|
-
static symmetric_decrypt_filedata(enc_bytes: Uint8Array, key: Uint8Array): Uint8Array;
|
|
2363
|
-
static symmetric_encrypt_string(plain: string, key: Uint8Array): string;
|
|
2359
|
+
static rsa_encrypt_data(plain_data: Uint8Array, public_key: Uint8Array): Uint8Array;
|
|
2364
2360
|
/**
|
|
2365
|
-
* DEPRECATED:
|
|
2361
|
+
* DEPRECATED: Use `symmetric_decrypt_string` instead.
|
|
2362
|
+
* Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
|
|
2366
2363
|
*/
|
|
2367
|
-
static
|
|
2368
|
-
static symmetric_encrypt_filedata(plain: Uint8Array, key: Uint8Array): Uint8Array;
|
|
2369
|
-
static decrypt_user_key_with_master_password(
|
|
2370
|
-
encrypted_user_key: string,
|
|
2371
|
-
master_password: string,
|
|
2372
|
-
email: string,
|
|
2373
|
-
kdf: Kdf,
|
|
2374
|
-
): Uint8Array;
|
|
2375
|
-
static encrypt_user_key_with_master_password(
|
|
2376
|
-
user_key: Uint8Array,
|
|
2377
|
-
master_password: string,
|
|
2378
|
-
email: string,
|
|
2379
|
-
kdf: Kdf,
|
|
2380
|
-
): string;
|
|
2381
|
-
static make_user_key_aes256_cbc_hmac(): Uint8Array;
|
|
2382
|
-
static make_user_key_xchacha20_poly1305(): Uint8Array;
|
|
2364
|
+
static symmetric_decrypt(enc_string: string, key: Uint8Array): string;
|
|
2383
2365
|
/**
|
|
2384
2366
|
* Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
|
|
2385
2367
|
* as an EncString.
|
|
2386
2368
|
*/
|
|
2387
2369
|
static wrap_symmetric_key(key_to_be_wrapped: Uint8Array, wrapping_key: Uint8Array): string;
|
|
2370
|
+
/**
|
|
2371
|
+
* Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
|
|
2372
|
+
*/
|
|
2373
|
+
static derive_kdf_material(password: Uint8Array, salt: Uint8Array, kdf: Kdf): Uint8Array;
|
|
2374
|
+
/**
|
|
2375
|
+
* Generates a new RSA key pair and returns the private key
|
|
2376
|
+
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
2377
|
+
*/
|
|
2378
|
+
static rsa_generate_keypair(): Uint8Array;
|
|
2388
2379
|
/**
|
|
2389
2380
|
* Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
|
|
2390
2381
|
* unwrapped key as a serialized byte array.
|
|
2391
2382
|
*/
|
|
2392
2383
|
static unwrap_symmetric_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
|
|
2393
2384
|
/**
|
|
2394
|
-
*
|
|
2395
|
-
*
|
|
2396
|
-
*
|
|
2397
|
-
* the "public key" is not public, with the intent of preventing the server from being able
|
|
2398
|
-
* to overwrite the user key unlocked by the rotateable keyset.
|
|
2399
|
-
*/
|
|
2400
|
-
static wrap_encapsulation_key(encapsulation_key: Uint8Array, wrapping_key: Uint8Array): string;
|
|
2401
|
-
/**
|
|
2402
|
-
* Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
|
|
2403
|
-
* wrapping key.
|
|
2385
|
+
* Given a decrypted private RSA key PKCS8 DER this
|
|
2386
|
+
* returns the corresponding public RSA key in DER format.
|
|
2387
|
+
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
2404
2388
|
*/
|
|
2405
|
-
static
|
|
2389
|
+
static rsa_extract_public_key(private_key: Uint8Array): Uint8Array;
|
|
2406
2390
|
/**
|
|
2407
2391
|
* Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
|
|
2408
2392
|
* key,
|
|
2409
2393
|
*/
|
|
2410
2394
|
static wrap_decapsulation_key(decapsulation_key: Uint8Array, wrapping_key: Uint8Array): string;
|
|
2411
2395
|
/**
|
|
2412
|
-
*
|
|
2413
|
-
*
|
|
2396
|
+
* Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
|
|
2397
|
+
* key. Note: Usually, a public key is - by definition - public, so this should not be
|
|
2398
|
+
* used. The specific use-case for this function is to enable rotateable key sets, where
|
|
2399
|
+
* the "public key" is not public, with the intent of preventing the server from being able
|
|
2400
|
+
* to overwrite the user key unlocked by the rotateable keyset.
|
|
2414
2401
|
*/
|
|
2415
|
-
static
|
|
2402
|
+
static wrap_encapsulation_key(encapsulation_key: Uint8Array, wrapping_key: Uint8Array): string;
|
|
2403
|
+
static symmetric_decrypt_bytes(enc_string: string, key: Uint8Array): Uint8Array;
|
|
2416
2404
|
/**
|
|
2417
|
-
*
|
|
2418
|
-
* in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
|
|
2419
|
-
* the sender's authenticity cannot be verified by the recipient.
|
|
2405
|
+
* DEPRECATED: Only used by send keys
|
|
2420
2406
|
*/
|
|
2421
|
-
static
|
|
2407
|
+
static symmetric_encrypt_bytes(plain: Uint8Array, key: Uint8Array): string;
|
|
2422
2408
|
/**
|
|
2423
2409
|
* Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
|
|
2424
2410
|
* DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
|
|
@@ -2428,15 +2414,46 @@ export class PureCrypto {
|
|
|
2428
2414
|
encapsulated_key: string,
|
|
2429
2415
|
decapsulation_key: Uint8Array,
|
|
2430
2416
|
): Uint8Array;
|
|
2417
|
+
/**
|
|
2418
|
+
* Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
|
|
2419
|
+
* in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
|
|
2420
|
+
* the sender's authenticity cannot be verified by the recipient.
|
|
2421
|
+
*/
|
|
2422
|
+
static encapsulate_key_unsigned(shared_key: Uint8Array, encapsulation_key: Uint8Array): string;
|
|
2423
|
+
static symmetric_decrypt_string(enc_string: string, key: Uint8Array): string;
|
|
2424
|
+
static symmetric_encrypt_string(plain: string, key: Uint8Array): string;
|
|
2425
|
+
/**
|
|
2426
|
+
* Unwraps (decrypts) a wrapped PKCS8 DER encoded decapsulation (private) key using a symmetric
|
|
2427
|
+
* wrapping key.
|
|
2428
|
+
*/
|
|
2429
|
+
static unwrap_decapsulation_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
|
|
2430
|
+
/**
|
|
2431
|
+
* Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
|
|
2432
|
+
* wrapping key.
|
|
2433
|
+
*/
|
|
2434
|
+
static unwrap_encapsulation_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
|
|
2435
|
+
static symmetric_decrypt_filedata(enc_bytes: Uint8Array, key: Uint8Array): Uint8Array;
|
|
2436
|
+
static symmetric_encrypt_filedata(plain: Uint8Array, key: Uint8Array): Uint8Array;
|
|
2437
|
+
static make_user_key_aes256_cbc_hmac(): Uint8Array;
|
|
2431
2438
|
/**
|
|
2432
2439
|
* Given a wrapped signing key and the symmetric key it is wrapped with, this returns
|
|
2433
2440
|
* the corresponding verifying key.
|
|
2434
2441
|
*/
|
|
2435
2442
|
static verifying_key_for_signing_key(signing_key: string, wrapping_key: Uint8Array): Uint8Array;
|
|
2443
|
+
/**
|
|
2444
|
+
* DEPRECATED: Use `symmetric_decrypt_filedata` instead.
|
|
2445
|
+
* Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
|
|
2446
|
+
*/
|
|
2447
|
+
static symmetric_decrypt_array_buffer(enc_bytes: Uint8Array, key: Uint8Array): Uint8Array;
|
|
2436
2448
|
/**
|
|
2437
2449
|
* Returns the algorithm used for the given verifying key.
|
|
2438
2450
|
*/
|
|
2439
2451
|
static key_algorithm_for_verifying_key(verifying_key: Uint8Array): SignatureAlgorithm;
|
|
2452
|
+
static decrypt_user_key_with_master_key(
|
|
2453
|
+
encrypted_user_key: string,
|
|
2454
|
+
master_key: Uint8Array,
|
|
2455
|
+
): Uint8Array;
|
|
2456
|
+
static make_user_key_xchacha20_poly1305(): Uint8Array;
|
|
2440
2457
|
/**
|
|
2441
2458
|
* For a given signing identity (verifying key), this function verifies that the signing
|
|
2442
2459
|
* identity claimed ownership of the public key. This is a one-sided claim and merely shows
|
|
@@ -2447,35 +2464,18 @@ export class PureCrypto {
|
|
|
2447
2464
|
signed_public_key: Uint8Array,
|
|
2448
2465
|
verifying_key: Uint8Array,
|
|
2449
2466
|
): Uint8Array;
|
|
2450
|
-
|
|
2451
|
-
* Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
|
|
2452
|
-
*/
|
|
2453
|
-
static derive_kdf_material(password: Uint8Array, salt: Uint8Array, kdf: Kdf): Uint8Array;
|
|
2454
|
-
static decrypt_user_key_with_master_key(
|
|
2467
|
+
static decrypt_user_key_with_master_password(
|
|
2455
2468
|
encrypted_user_key: string,
|
|
2456
|
-
|
|
2469
|
+
master_password: string,
|
|
2470
|
+
email: string,
|
|
2471
|
+
kdf: Kdf,
|
|
2457
2472
|
): Uint8Array;
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
/**
|
|
2465
|
-
* Generates a new RSA key pair and returns the private key
|
|
2466
|
-
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
2467
|
-
*/
|
|
2468
|
-
static rsa_generate_keypair(): Uint8Array;
|
|
2469
|
-
/**
|
|
2470
|
-
* Decrypts data using RSAES-OAEP with SHA-1
|
|
2471
|
-
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
2472
|
-
*/
|
|
2473
|
-
static rsa_decrypt_data(encrypted_data: Uint8Array, private_key: Uint8Array): Uint8Array;
|
|
2474
|
-
/**
|
|
2475
|
-
* Encrypts data using RSAES-OAEP with SHA-1
|
|
2476
|
-
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
2477
|
-
*/
|
|
2478
|
-
static rsa_encrypt_data(plain_data: Uint8Array, public_key: Uint8Array): Uint8Array;
|
|
2473
|
+
static encrypt_user_key_with_master_password(
|
|
2474
|
+
user_key: Uint8Array,
|
|
2475
|
+
master_password: string,
|
|
2476
|
+
email: string,
|
|
2477
|
+
kdf: Kdf,
|
|
2478
|
+
): string;
|
|
2479
2479
|
}
|
|
2480
2480
|
/**
|
|
2481
2481
|
* Client for initializing a user account.
|
|
@@ -2501,13 +2501,13 @@ export class StateClient {
|
|
|
2501
2501
|
private constructor();
|
|
2502
2502
|
free(): void;
|
|
2503
2503
|
[Symbol.dispose](): void;
|
|
2504
|
-
register_cipher_repository(cipher_repository: any): void;
|
|
2505
|
-
register_folder_repository(store: any): void;
|
|
2506
|
-
register_client_managed_repositories(repositories: Repositories): void;
|
|
2507
2504
|
/**
|
|
2508
2505
|
* Initialize the database for SDK managed repositories.
|
|
2509
2506
|
*/
|
|
2510
2507
|
initialize_state(configuration: IndexedDbConfiguration): Promise<void>;
|
|
2508
|
+
register_cipher_repository(cipher_repository: any): void;
|
|
2509
|
+
register_folder_repository(store: any): void;
|
|
2510
|
+
register_client_managed_repositories(repositories: Repositories): void;
|
|
2511
2511
|
}
|
|
2512
2512
|
export class TotpClient {
|
|
2513
2513
|
private constructor();
|
|
@@ -2534,23 +2534,23 @@ export class VaultClient {
|
|
|
2534
2534
|
*/
|
|
2535
2535
|
attachments(): AttachmentsClient;
|
|
2536
2536
|
/**
|
|
2537
|
-
* Cipher
|
|
2537
|
+
* Cipher risk evaluation operations.
|
|
2538
2538
|
*/
|
|
2539
|
-
|
|
2539
|
+
cipher_risk(): CipherRiskClient;
|
|
2540
2540
|
/**
|
|
2541
|
-
*
|
|
2541
|
+
* Collection related operations.
|
|
2542
2542
|
*/
|
|
2543
|
-
|
|
2543
|
+
collections(): CollectionsClient;
|
|
2544
2544
|
/**
|
|
2545
2545
|
* TOTP related operations.
|
|
2546
2546
|
*/
|
|
2547
2547
|
totp(): TotpClient;
|
|
2548
2548
|
/**
|
|
2549
|
-
*
|
|
2549
|
+
* Cipher related operations.
|
|
2550
2550
|
*/
|
|
2551
|
-
|
|
2551
|
+
ciphers(): CiphersClient;
|
|
2552
2552
|
/**
|
|
2553
|
-
*
|
|
2553
|
+
* Folder related operations.
|
|
2554
2554
|
*/
|
|
2555
|
-
|
|
2555
|
+
folders(): FoldersClient;
|
|
2556
2556
|
}
|