@bitwarden/commercial-sdk-internal 0.2.0-main.410 → 0.2.0-main.412
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/bitwarden_wasm_internal.d.ts +1142 -1142
- package/bitwarden_wasm_internal_bg.js +1206 -1205
- package/bitwarden_wasm_internal_bg.wasm +0 -0
- package/bitwarden_wasm_internal_bg.wasm.d.ts +166 -166
- package/bitwarden_wasm_internal_bg.wasm.js +1 -1
- package/node/bitwarden_wasm_internal.d.ts +1142 -1142
- package/node/bitwarden_wasm_internal.js +1212 -1211
- 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,17 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
export function init_sdk(log_level?: LogLevel | null): void;
|
|
4
|
-
/**
|
|
5
|
-
* Generate a new SSH key pair
|
|
6
|
-
*
|
|
7
|
-
* # Arguments
|
|
8
|
-
* - `key_algorithm` - The algorithm to use for the key pair
|
|
9
|
-
*
|
|
10
|
-
* # Returns
|
|
11
|
-
* - `Ok(SshKey)` if the key was successfully generated
|
|
12
|
-
* - `Err(KeyGenerationError)` if the key could not be generated
|
|
13
|
-
*/
|
|
14
|
-
export function generate_ssh_key(key_algorithm: KeyAlgorithm): SshKeyView;
|
|
15
3
|
/**
|
|
16
4
|
* Convert a PCKS8 or OpenSSH encrypted or unencrypted private key
|
|
17
5
|
* to an OpenSSH private key with public key and fingerprint
|
|
@@ -29,12 +17,17 @@ export function generate_ssh_key(key_algorithm: KeyAlgorithm): SshKeyView;
|
|
|
29
17
|
*/
|
|
30
18
|
export function import_ssh_key(imported_key: string, password?: string | null): SshKeyView;
|
|
31
19
|
/**
|
|
32
|
-
*
|
|
20
|
+
* Generate a new SSH key pair
|
|
21
|
+
*
|
|
22
|
+
* # Arguments
|
|
23
|
+
* - `key_algorithm` - The algorithm to use for the key pair
|
|
24
|
+
*
|
|
25
|
+
* # Returns
|
|
26
|
+
* - `Ok(SshKey)` if the key was successfully generated
|
|
27
|
+
* - `Err(KeyGenerationError)` if the key could not be generated
|
|
33
28
|
*/
|
|
34
|
-
export function
|
|
35
|
-
|
|
36
|
-
response: DiscoverResponse,
|
|
37
|
-
): Promise<void>;
|
|
29
|
+
export function generate_ssh_key(key_algorithm: KeyAlgorithm): SshKeyView;
|
|
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[]>;
|
|
@@ -174,11 +180,6 @@ export interface TokenProvider {
|
|
|
174
180
|
get_access_token(): Promise<string | undefined>;
|
|
175
181
|
}
|
|
176
182
|
|
|
177
|
-
/**
|
|
178
|
-
* Active feature flags for the SDK.
|
|
179
|
-
*/
|
|
180
|
-
export interface FeatureFlags extends Map<string, boolean> {}
|
|
181
|
-
|
|
182
183
|
export interface Repositories {
|
|
183
184
|
cipher: Repository<Cipher> | null;
|
|
184
185
|
folder: Repository<Folder> | null;
|
|
@@ -188,62 +189,69 @@ export interface IndexedDbConfiguration {
|
|
|
188
189
|
db_name: string;
|
|
189
190
|
}
|
|
190
191
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
/**
|
|
193
|
+
* Active feature flags for the SDK.
|
|
194
|
+
*/
|
|
195
|
+
export interface FeatureFlags extends Map<string, boolean> {}
|
|
194
196
|
|
|
195
|
-
|
|
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;
|
|
209
|
+
}
|
|
196
210
|
|
|
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,128 +366,76 @@ 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
|
-
| { pinEnvelope: { pin: string; pin_protected_user_key_envelope: PasswordProtectedKeyEnvelope } }
|
|
405
|
-
| { authRequest: { request_private_key: B64; method: AuthRequestMethod } }
|
|
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 } };
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Auth requests supports multiple initialization methods.
|
|
417
|
-
*/
|
|
418
|
-
export type AuthRequestMethod =
|
|
419
|
-
| { userKey: { protected_user_key: UnsignedSharedKey } }
|
|
420
|
-
| { masterKey: { protected_master_key: UnsignedSharedKey; auth_request_key: EncString } };
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
* Represents the request to initialize the user\'s organizational cryptographic state.
|
|
424
|
-
*/
|
|
425
|
-
export interface InitOrgCryptoRequest {
|
|
426
|
-
/**
|
|
427
|
-
* The encryption keys for all the organizations the user is a part of
|
|
428
|
-
*/
|
|
429
|
-
organizationKeys: Map<OrganizationId, UnsignedSharedKey>;
|
|
389
|
+
export interface MasterPasswordError extends Error {
|
|
390
|
+
name: "MasterPasswordError";
|
|
391
|
+
variant:
|
|
392
|
+
| "EncryptionKeyMalformed"
|
|
393
|
+
| "KdfMalformed"
|
|
394
|
+
| "InvalidKdfConfiguration"
|
|
395
|
+
| "MissingField"
|
|
396
|
+
| "Crypto";
|
|
430
397
|
}
|
|
431
398
|
|
|
432
|
-
|
|
433
|
-
* Response from the `update_kdf` function
|
|
434
|
-
*/
|
|
435
|
-
export interface UpdateKdfResponse {
|
|
436
|
-
/**
|
|
437
|
-
* The authentication data for the new KDF setting
|
|
438
|
-
*/
|
|
439
|
-
masterPasswordAuthenticationData: MasterPasswordAuthenticationData;
|
|
440
|
-
/**
|
|
441
|
-
* The unlock data for the new KDF setting
|
|
442
|
-
*/
|
|
443
|
-
masterPasswordUnlockData: MasterPasswordUnlockData;
|
|
444
|
-
/**
|
|
445
|
-
* The authentication data for the KDF setting prior to the change
|
|
446
|
-
*/
|
|
447
|
-
oldMasterPasswordAuthenticationData: MasterPasswordAuthenticationData;
|
|
448
|
-
}
|
|
399
|
+
export function isMasterPasswordError(error: any): error is MasterPasswordError;
|
|
449
400
|
|
|
450
401
|
/**
|
|
451
|
-
*
|
|
402
|
+
* Represents the data required to authenticate with the master password.
|
|
452
403
|
*/
|
|
453
|
-
export interface
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
passwordHash: B64;
|
|
458
|
-
/**
|
|
459
|
-
* User key, encrypted with the new password
|
|
460
|
-
*/
|
|
461
|
-
newKey: EncString;
|
|
404
|
+
export interface MasterPasswordAuthenticationData {
|
|
405
|
+
kdf: Kdf;
|
|
406
|
+
salt: string;
|
|
407
|
+
masterPasswordAuthenticationHash: B64;
|
|
462
408
|
}
|
|
463
409
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
* PIN protected by [UserKey]
|
|
474
|
-
*/
|
|
475
|
-
userKeyEncryptedPin: EncString;
|
|
410
|
+
export interface AccountCryptographyInitializationError extends Error {
|
|
411
|
+
name: "AccountCryptographyInitializationError";
|
|
412
|
+
variant:
|
|
413
|
+
| "WrongUserKeyType"
|
|
414
|
+
| "WrongUserKey"
|
|
415
|
+
| "CorruptData"
|
|
416
|
+
| "TamperedData"
|
|
417
|
+
| "KeyStoreAlreadyInitialized"
|
|
418
|
+
| "GenericCrypto";
|
|
476
419
|
}
|
|
477
420
|
|
|
421
|
+
export function isAccountCryptographyInitializationError(
|
|
422
|
+
error: any,
|
|
423
|
+
): error is AccountCryptographyInitializationError;
|
|
424
|
+
|
|
478
425
|
/**
|
|
479
|
-
*
|
|
426
|
+
* Any keys / cryptographic protection \"downstream\" from the account symmetric key (user key).
|
|
427
|
+
* Private keys are protected by the user key.
|
|
480
428
|
*/
|
|
481
|
-
export
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
}
|
|
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
|
+
};
|
|
491
439
|
|
|
492
440
|
/**
|
|
493
441
|
* Request for migrating an account from password to key connector.
|
|
@@ -512,27 +460,23 @@ export interface DeriveKeyConnectorRequest {
|
|
|
512
460
|
}
|
|
513
461
|
|
|
514
462
|
/**
|
|
515
|
-
*
|
|
463
|
+
* Request for deriving a pin protected user key
|
|
516
464
|
*/
|
|
517
|
-
export interface
|
|
465
|
+
export interface DerivePinKeyResponse {
|
|
518
466
|
/**
|
|
519
|
-
*
|
|
467
|
+
* [UserKey] protected by PIN
|
|
520
468
|
*/
|
|
521
|
-
|
|
469
|
+
pinProtectedUserKey: EncString;
|
|
522
470
|
/**
|
|
523
|
-
*
|
|
471
|
+
* PIN protected by [UserKey]
|
|
524
472
|
*/
|
|
525
|
-
|
|
473
|
+
encryptedPin: EncString;
|
|
526
474
|
}
|
|
527
475
|
|
|
528
476
|
/**
|
|
529
|
-
*
|
|
477
|
+
* Response from the `make_key_pair` function
|
|
530
478
|
*/
|
|
531
|
-
export interface
|
|
532
|
-
/**
|
|
533
|
-
* The user\'s user key
|
|
534
|
-
*/
|
|
535
|
-
userKey: B64;
|
|
479
|
+
export interface MakeKeyPairResponse {
|
|
536
480
|
/**
|
|
537
481
|
* The user\'s public key
|
|
538
482
|
*/
|
|
@@ -557,95 +501,128 @@ export interface VerifyAsymmetricKeysResponse {
|
|
|
557
501
|
validPrivateKey: boolean;
|
|
558
502
|
}
|
|
559
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";
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
export function isCryptoClientError(error: any): error is CryptoClientError;
|
|
517
|
+
|
|
560
518
|
/**
|
|
561
|
-
*
|
|
519
|
+
* Request for deriving a pin protected user key
|
|
562
520
|
*/
|
|
563
|
-
export interface
|
|
564
|
-
/**
|
|
565
|
-
* User key
|
|
566
|
-
*/
|
|
567
|
-
userKey: B64;
|
|
521
|
+
export interface EnrollPinResponse {
|
|
568
522
|
/**
|
|
569
|
-
*
|
|
523
|
+
* [UserKey] protected by PIN
|
|
570
524
|
*/
|
|
571
|
-
|
|
525
|
+
pinProtectedUserKeyEnvelope: PasswordProtectedKeyEnvelope;
|
|
572
526
|
/**
|
|
573
|
-
*
|
|
527
|
+
* PIN protected by [UserKey]
|
|
574
528
|
*/
|
|
575
|
-
|
|
529
|
+
userKeyEncryptedPin: EncString;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* State used for initializing the user cryptographic state.
|
|
534
|
+
*/
|
|
535
|
+
export interface InitUserCryptoRequest {
|
|
576
536
|
/**
|
|
577
|
-
* The user\'s
|
|
537
|
+
* The user\'s ID.
|
|
578
538
|
*/
|
|
579
|
-
|
|
539
|
+
userId: UserId | undefined;
|
|
580
540
|
/**
|
|
581
|
-
*
|
|
541
|
+
* The user\'s KDF parameters, as received from the prelogin request
|
|
582
542
|
*/
|
|
583
|
-
|
|
543
|
+
kdfParams: Kdf;
|
|
584
544
|
/**
|
|
585
|
-
*
|
|
545
|
+
* The user\'s email address
|
|
586
546
|
*/
|
|
587
|
-
|
|
547
|
+
email: string;
|
|
588
548
|
/**
|
|
589
|
-
* 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
|
|
590
551
|
*/
|
|
591
|
-
|
|
552
|
+
accountCryptographicState: WrappedAccountCryptographicState;
|
|
592
553
|
/**
|
|
593
|
-
* The
|
|
554
|
+
* The method to decrypt the user\'s account symmetric key (user key)
|
|
594
555
|
*/
|
|
595
|
-
|
|
556
|
+
method: InitUserCryptoMethod;
|
|
596
557
|
}
|
|
597
558
|
|
|
598
559
|
/**
|
|
599
|
-
*
|
|
560
|
+
* Request for `verify_asymmetric_keys`.
|
|
600
561
|
*/
|
|
601
|
-
export interface
|
|
562
|
+
export interface VerifyAsymmetricKeysRequest {
|
|
602
563
|
/**
|
|
603
|
-
* The
|
|
564
|
+
* The user\'s user key
|
|
604
565
|
*/
|
|
605
|
-
|
|
566
|
+
userKey: B64;
|
|
606
567
|
/**
|
|
607
|
-
* The
|
|
568
|
+
* The user\'s public key
|
|
608
569
|
*/
|
|
609
|
-
|
|
570
|
+
userPublicKey: B64;
|
|
610
571
|
/**
|
|
611
|
-
*
|
|
572
|
+
* User\'s private key, encrypted with the user key
|
|
612
573
|
*/
|
|
613
|
-
|
|
574
|
+
userKeyEncryptedPrivateKey: EncString;
|
|
614
575
|
}
|
|
615
576
|
|
|
616
577
|
/**
|
|
617
|
-
*
|
|
578
|
+
* Response from the `make_update_password` function
|
|
618
579
|
*/
|
|
619
|
-
export interface
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
580
|
+
export interface UpdatePasswordResponse {
|
|
581
|
+
/**
|
|
582
|
+
* Hash of the new password
|
|
583
|
+
*/
|
|
584
|
+
passwordHash: B64;
|
|
585
|
+
/**
|
|
586
|
+
* User key, encrypted with the new password
|
|
587
|
+
*/
|
|
588
|
+
newKey: EncString;
|
|
623
589
|
}
|
|
624
590
|
|
|
625
|
-
export type SignedSecurityState = string;
|
|
626
|
-
|
|
627
591
|
/**
|
|
628
|
-
*
|
|
592
|
+
* Represents the request to initialize the user\'s organizational cryptographic state.
|
|
629
593
|
*/
|
|
630
|
-
export
|
|
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
|
+
}
|
|
631
600
|
|
|
632
601
|
/**
|
|
633
|
-
*
|
|
602
|
+
* Auth requests supports multiple initialization methods.
|
|
634
603
|
*/
|
|
635
|
-
export type
|
|
604
|
+
export type AuthRequestMethod =
|
|
605
|
+
| { userKey: { protected_user_key: UnsignedSharedKey } }
|
|
606
|
+
| { masterKey: { protected_master_key: UnsignedSharedKey; auth_request_key: EncString } };
|
|
636
607
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
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;
|
|
645
624
|
}
|
|
646
625
|
|
|
647
|
-
export function isMasterPasswordError(error: any): error is MasterPasswordError;
|
|
648
|
-
|
|
649
626
|
export interface DeriveKeyConnectorError extends Error {
|
|
650
627
|
name: "DeriveKeyConnectorError";
|
|
651
628
|
variant: "WrongPassword" | "Crypto";
|
|
@@ -653,49 +630,72 @@ export interface DeriveKeyConnectorError extends Error {
|
|
|
653
630
|
|
|
654
631
|
export function isDeriveKeyConnectorError(error: any): error is DeriveKeyConnectorError;
|
|
655
632
|
|
|
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
633
|
/**
|
|
671
|
-
*
|
|
672
|
-
* Private keys are protected by the user key.
|
|
634
|
+
* The crypto method used to initialize the user cryptographic state.
|
|
673
635
|
*/
|
|
674
|
-
export type
|
|
675
|
-
| {
|
|
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 } }
|
|
676
643
|
| {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
security_state: SignedSecurityState;
|
|
644
|
+
deviceKey: {
|
|
645
|
+
device_key: string;
|
|
646
|
+
protected_device_private_key: EncString;
|
|
647
|
+
device_protected_user_key: UnsignedSharedKey;
|
|
682
648
|
};
|
|
683
|
-
}
|
|
649
|
+
}
|
|
650
|
+
| { keyConnector: { master_key: B64; user_key: EncString } };
|
|
684
651
|
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
652
|
+
/**
|
|
653
|
+
* Response for the `make_keys_for_user_crypto_v2`, containing a set of keys for a user
|
|
654
|
+
*/
|
|
655
|
+
export interface UserCryptoV2KeysResponse {
|
|
656
|
+
/**
|
|
657
|
+
* User key
|
|
658
|
+
*/
|
|
659
|
+
userKey: B64;
|
|
660
|
+
/**
|
|
661
|
+
* Wrapped private key
|
|
662
|
+
*/
|
|
663
|
+
privateKey: EncString;
|
|
664
|
+
/**
|
|
665
|
+
* Public key
|
|
666
|
+
*/
|
|
667
|
+
publicKey: B64;
|
|
668
|
+
/**
|
|
669
|
+
* The user\'s public key, signed by the signing key
|
|
670
|
+
*/
|
|
671
|
+
signedPublicKey: SignedPublicKey;
|
|
672
|
+
/**
|
|
673
|
+
* Signing key, encrypted with the user\'s symmetric key
|
|
674
|
+
*/
|
|
675
|
+
signingKey: EncString;
|
|
676
|
+
/**
|
|
677
|
+
* Base64 encoded verifying key
|
|
678
|
+
*/
|
|
679
|
+
verifyingKey: B64;
|
|
680
|
+
/**
|
|
681
|
+
* The user\'s signed security state
|
|
682
|
+
*/
|
|
683
|
+
securityState: SignedSecurityState;
|
|
684
|
+
/**
|
|
685
|
+
* The security state\'s version
|
|
686
|
+
*/
|
|
687
|
+
securityVersion: number;
|
|
694
688
|
}
|
|
695
689
|
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
690
|
+
/**
|
|
691
|
+
* NewType wrapper for `OrganizationId`
|
|
692
|
+
*/
|
|
693
|
+
export type OrganizationId = Tagged<Uuid, "OrganizationId">;
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* NewType wrapper for `UserId`
|
|
697
|
+
*/
|
|
698
|
+
export type UserId = Tagged<Uuid, "UserId">;
|
|
699
699
|
|
|
700
700
|
export interface StatefulCryptoError extends Error {
|
|
701
701
|
name: "StatefulCryptoError";
|
|
@@ -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
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
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;
|
|
1449
|
-
/**
|
|
1450
|
-
* Username or email (login ciphers only have one field).
|
|
1451
|
-
*/
|
|
1452
|
-
username: string | undefined;
|
|
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>;
|
|
1453
1518
|
}
|
|
1454
1519
|
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
*/
|
|
1463
|
-
export interface CipherRiskOptions {
|
|
1464
|
-
/**
|
|
1465
|
-
* Pre-computed password reuse map (password → count).
|
|
1466
|
-
* If provided, enables reuse detection across ciphers.
|
|
1467
|
-
*/
|
|
1468
|
-
passwordMap?: PasswordReuseMap | undefined;
|
|
1469
|
-
/**
|
|
1470
|
-
* Whether to check passwords against Have I Been Pwned API.
|
|
1471
|
-
* When true, makes network requests to check for exposed passwords.
|
|
1472
|
-
*/
|
|
1473
|
-
checkExposed?: boolean;
|
|
1474
|
-
/**
|
|
1475
|
-
* Optional HIBP API base URL override. When None, uses the production HIBP URL.
|
|
1476
|
-
* Can be used for testing or alternative password breach checking services.
|
|
1477
|
-
*/
|
|
1478
|
-
hibpBaseUrl?: string | undefined;
|
|
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;
|
|
1479
1527
|
}
|
|
1480
1528
|
|
|
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;
|
|
1529
|
+
export interface CipherListView {
|
|
1530
|
+
id: CipherId | undefined;
|
|
1531
|
+
organizationId: OrganizationId | undefined;
|
|
1532
|
+
folderId: FolderId | undefined;
|
|
1533
|
+
collectionIds: CollectionId[];
|
|
1494
1534
|
/**
|
|
1495
|
-
*
|
|
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
|
|
1535
|
+
* Temporary, required to support calculating TOTP from CipherListView.
|
|
1499
1536
|
*/
|
|
1500
|
-
|
|
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;
|
|
1501
1547
|
/**
|
|
1502
|
-
*
|
|
1503
|
-
* None if not found or if no password_map was provided.
|
|
1548
|
+
* The number of attachments
|
|
1504
1549
|
*/
|
|
1505
|
-
|
|
1506
|
-
}
|
|
1507
|
-
|
|
1508
|
-
/**
|
|
1509
|
-
* Request to add or edit a folder.
|
|
1510
|
-
*/
|
|
1511
|
-
export interface FolderAddEditRequest {
|
|
1550
|
+
attachments: number;
|
|
1512
1551
|
/**
|
|
1513
|
-
*
|
|
1552
|
+
* Indicates if the cipher has old attachments that need to be re-uploaded
|
|
1514
1553
|
*/
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
/**
|
|
1519
|
-
* NewType wrapper for `FolderId`
|
|
1520
|
-
*/
|
|
1521
|
-
export type FolderId = Tagged<Uuid, "FolderId">;
|
|
1522
|
-
|
|
1523
|
-
export interface Folder {
|
|
1524
|
-
id: FolderId | undefined;
|
|
1525
|
-
name: EncString;
|
|
1554
|
+
hasOldAttachments: boolean;
|
|
1555
|
+
creationDate: DateTime<Utc>;
|
|
1556
|
+
deletedDate: DateTime<Utc> | undefined;
|
|
1526
1557
|
revisionDate: DateTime<Utc>;
|
|
1558
|
+
archivedDate: DateTime<Utc> | undefined;
|
|
1559
|
+
/**
|
|
1560
|
+
* Hints for the presentation layer for which fields can be copied.
|
|
1561
|
+
*/
|
|
1562
|
+
copyableFields: CopyableCipherFields[];
|
|
1563
|
+
localData: LocalDataView | undefined;
|
|
1527
1564
|
}
|
|
1528
1565
|
|
|
1529
|
-
export interface
|
|
1530
|
-
id:
|
|
1566
|
+
export interface CipherView {
|
|
1567
|
+
id: CipherId | undefined;
|
|
1568
|
+
organizationId: OrganizationId | undefined;
|
|
1569
|
+
folderId: FolderId | undefined;
|
|
1570
|
+
collectionIds: CollectionId[];
|
|
1571
|
+
/**
|
|
1572
|
+
* Temporary, required to support re-encrypting existing items.
|
|
1573
|
+
*/
|
|
1574
|
+
key: EncString | undefined;
|
|
1531
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;
|
|
1532
1595
|
revisionDate: DateTime<Utc>;
|
|
1596
|
+
archivedDate: DateTime<Utc> | undefined;
|
|
1533
1597
|
}
|
|
1534
1598
|
|
|
1535
|
-
|
|
1536
|
-
|
|
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;
|
|
1599
|
+
/**
|
|
1600
|
+
* NewType wrapper for `CipherId`
|
|
1601
|
+
*/
|
|
1602
|
+
export type CipherId = Tagged<Uuid, "CipherId">;
|
|
1552
1603
|
|
|
1553
|
-
|
|
1604
|
+
/**
|
|
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.
|
|
1610
|
+
*/
|
|
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;
|
|
@@ -1695,144 +1776,63 @@ export interface Identity {
|
|
|
1695
1776
|
licenseNumber: EncString | undefined;
|
|
1696
1777
|
}
|
|
1697
1778
|
|
|
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";
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
export function isCipherError(error: any): error is CipherError;
|
|
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
|
* Client for bitwarden licensed operations
|
|
@@ -2028,46 +2028,46 @@ export class CryptoClient {
|
|
|
2028
2028
|
free(): void;
|
|
2029
2029
|
[Symbol.dispose](): void;
|
|
2030
2030
|
/**
|
|
2031
|
-
*
|
|
2032
|
-
*
|
|
2031
|
+
* Protects the current user key with the provided PIN. The result can be stored and later
|
|
2032
|
+
* used to initialize another client instance by using the PIN and the PIN key with
|
|
2033
|
+
* `initialize_user_crypto`.
|
|
2033
2034
|
*/
|
|
2034
|
-
|
|
2035
|
+
enroll_pin(pin: string): EnrollPinResponse;
|
|
2036
|
+
/**
|
|
2037
|
+
* Generates a new key pair and encrypts the private key with the provided user key.
|
|
2038
|
+
* Crypto initialization not required.
|
|
2039
|
+
*/
|
|
2040
|
+
make_key_pair(user_key: B64): MakeKeyPairResponse;
|
|
2041
|
+
/**
|
|
2042
|
+
* Create the data necessary to update the user's kdf settings. The user's encryption key is
|
|
2043
|
+
* re-encrypted for the password under the new kdf settings. This returns the re-encrypted
|
|
2044
|
+
* user key and the new password hash but does not update sdk state.
|
|
2045
|
+
*/
|
|
2046
|
+
make_update_kdf(password: string, kdf: Kdf): UpdateKdfResponse;
|
|
2035
2047
|
/**
|
|
2036
2048
|
* Initialization method for the organization crypto. Needs to be called after
|
|
2037
2049
|
* `initialize_user_crypto` but before any other crypto operations.
|
|
2038
2050
|
*/
|
|
2039
2051
|
initialize_org_crypto(req: InitOrgCryptoRequest): Promise<void>;
|
|
2040
2052
|
/**
|
|
2041
|
-
*
|
|
2042
|
-
*
|
|
2053
|
+
* Initialization method for the user crypto. Needs to be called before any other crypto
|
|
2054
|
+
* operations.
|
|
2043
2055
|
*/
|
|
2044
|
-
|
|
2056
|
+
initialize_user_crypto(req: InitUserCryptoRequest): Promise<void>;
|
|
2045
2057
|
/**
|
|
2046
2058
|
* Verifies a user's asymmetric keys by decrypting the private key with the provided user
|
|
2047
2059
|
* key. Returns if the private key is decryptable and if it is a valid matching key.
|
|
2048
2060
|
* Crypto initialization not required.
|
|
2049
2061
|
*/
|
|
2050
2062
|
verify_asymmetric_keys(request: VerifyAsymmetricKeysRequest): VerifyAsymmetricKeysResponse;
|
|
2051
|
-
/**
|
|
2052
|
-
* Makes a new signing key pair and signs the public key for the user
|
|
2053
|
-
*/
|
|
2054
|
-
make_keys_for_user_crypto_v2(): UserCryptoV2KeysResponse;
|
|
2055
2063
|
/**
|
|
2056
2064
|
* Creates a rotated set of account keys for the current state
|
|
2057
2065
|
*/
|
|
2058
2066
|
get_v2_rotated_account_keys(): UserCryptoV2KeysResponse;
|
|
2059
2067
|
/**
|
|
2060
|
-
*
|
|
2061
|
-
* re-encrypted for the password under the new kdf settings. This returns the re-encrypted
|
|
2062
|
-
* user key and the new password hash but does not update sdk state.
|
|
2063
|
-
*/
|
|
2064
|
-
make_update_kdf(password: string, kdf: Kdf): UpdateKdfResponse;
|
|
2065
|
-
/**
|
|
2066
|
-
* Protects the current user key with the provided PIN. The result can be stored and later
|
|
2067
|
-
* used to initialize another client instance by using the PIN and the PIN key with
|
|
2068
|
-
* `initialize_user_crypto`.
|
|
2068
|
+
* Makes a new signing key pair and signs the public key for the user
|
|
2069
2069
|
*/
|
|
2070
|
-
|
|
2070
|
+
make_keys_for_user_crypto_v2(): UserCryptoV2KeysResponse;
|
|
2071
2071
|
/**
|
|
2072
2072
|
* Protects the current user key with the provided PIN. The result can be stored and later
|
|
2073
2073
|
* used to initialize another client instance by using the PIN and the PIN key with
|
|
@@ -2084,12 +2084,6 @@ export class ExporterClient {
|
|
|
2084
2084
|
private constructor();
|
|
2085
2085
|
free(): void;
|
|
2086
2086
|
[Symbol.dispose](): void;
|
|
2087
|
-
export_vault(folders: Folder[], ciphers: Cipher[], format: ExportFormat): string;
|
|
2088
|
-
export_organization_vault(
|
|
2089
|
-
collections: Collection[],
|
|
2090
|
-
ciphers: Cipher[],
|
|
2091
|
-
format: ExportFormat,
|
|
2092
|
-
): string;
|
|
2093
2087
|
/**
|
|
2094
2088
|
* Credential Exchange Format (CXF)
|
|
2095
2089
|
*
|
|
@@ -2108,6 +2102,12 @@ export class ExporterClient {
|
|
|
2108
2102
|
* Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
|
|
2109
2103
|
*/
|
|
2110
2104
|
import_cxf(payload: string): Cipher[];
|
|
2105
|
+
export_vault(folders: Folder[], ciphers: Cipher[], format: ExportFormat): string;
|
|
2106
|
+
export_organization_vault(
|
|
2107
|
+
collections: Collection[],
|
|
2108
|
+
ciphers: Cipher[],
|
|
2109
|
+
format: ExportFormat,
|
|
2110
|
+
): string;
|
|
2111
2111
|
}
|
|
2112
2112
|
/**
|
|
2113
2113
|
* Wrapper for folder specific functionality.
|
|
@@ -2117,90 +2117,90 @@ export class FoldersClient {
|
|
|
2117
2117
|
free(): void;
|
|
2118
2118
|
[Symbol.dispose](): void;
|
|
2119
2119
|
/**
|
|
2120
|
-
*
|
|
2120
|
+
* Decrypt a list of [Folder]s to a list of [FolderView]s.
|
|
2121
2121
|
*/
|
|
2122
|
-
|
|
2122
|
+
decrypt_list(folders: Folder[]): FolderView[];
|
|
2123
2123
|
/**
|
|
2124
|
-
*
|
|
2124
|
+
* Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
|
|
2125
2125
|
*/
|
|
2126
|
-
|
|
2126
|
+
get(folder_id: FolderId): Promise<FolderView>;
|
|
2127
2127
|
/**
|
|
2128
|
-
*
|
|
2128
|
+
* Edit the [Folder] and save it to the server.
|
|
2129
2129
|
*/
|
|
2130
|
-
|
|
2130
|
+
edit(folder_id: FolderId, request: FolderAddEditRequest): Promise<FolderView>;
|
|
2131
2131
|
/**
|
|
2132
2132
|
* Get all folders from state and decrypt them to a list of [FolderView].
|
|
2133
2133
|
*/
|
|
2134
2134
|
list(): Promise<FolderView[]>;
|
|
2135
|
-
/**
|
|
2136
|
-
* Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
|
|
2137
|
-
*/
|
|
2138
|
-
get(folder_id: FolderId): Promise<FolderView>;
|
|
2139
2135
|
/**
|
|
2140
2136
|
* Create a new [Folder] and save it to the server.
|
|
2141
2137
|
*/
|
|
2142
2138
|
create(request: FolderAddEditRequest): Promise<FolderView>;
|
|
2143
2139
|
/**
|
|
2144
|
-
*
|
|
2140
|
+
* Encrypt a [Folder] to [FolderView].
|
|
2145
2141
|
*/
|
|
2146
|
-
|
|
2142
|
+
decrypt(folder: Folder): FolderView;
|
|
2143
|
+
/**
|
|
2144
|
+
* Encrypt a [FolderView] to a [Folder].
|
|
2145
|
+
*/
|
|
2146
|
+
encrypt(folder_view: FolderView): Folder;
|
|
2147
2147
|
}
|
|
2148
2148
|
export class GeneratorClient {
|
|
2149
2149
|
private constructor();
|
|
2150
2150
|
free(): void;
|
|
2151
2151
|
[Symbol.dispose](): void;
|
|
2152
2152
|
/**
|
|
2153
|
-
* Generates a random
|
|
2153
|
+
* Generates a random passphrase.
|
|
2154
|
+
* A passphrase is a combination of random words separated by a character.
|
|
2155
|
+
* An example of passphrase is `correct horse battery staple`.
|
|
2154
2156
|
*
|
|
2155
|
-
* The
|
|
2157
|
+
* The number of words and their case, the word separator, and the inclusion of
|
|
2158
|
+
* a number in the passphrase can be customized using the `input` parameter.
|
|
2156
2159
|
*
|
|
2157
2160
|
* # Examples
|
|
2158
2161
|
*
|
|
2159
2162
|
* ```
|
|
2160
2163
|
* use bitwarden_core::Client;
|
|
2161
|
-
* use bitwarden_generators::{GeneratorClientsExt, PassphraseError,
|
|
2164
|
+
* use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
|
|
2162
2165
|
*
|
|
2163
2166
|
* async fn test() -> Result<(), PassphraseError> {
|
|
2164
|
-
* let input =
|
|
2165
|
-
*
|
|
2166
|
-
* uppercase: true,
|
|
2167
|
-
* numbers: true,
|
|
2168
|
-
* length: 20,
|
|
2167
|
+
* let input = PassphraseGeneratorRequest {
|
|
2168
|
+
* num_words: 4,
|
|
2169
2169
|
* ..Default::default()
|
|
2170
2170
|
* };
|
|
2171
|
-
* let
|
|
2172
|
-
* println!("{}",
|
|
2171
|
+
* let passphrase = Client::new(None).generator().passphrase(input).unwrap();
|
|
2172
|
+
* println!("{}", passphrase);
|
|
2173
2173
|
* Ok(())
|
|
2174
2174
|
* }
|
|
2175
2175
|
* ```
|
|
2176
2176
|
*/
|
|
2177
|
-
|
|
2177
|
+
passphrase(input: PassphraseGeneratorRequest): string;
|
|
2178
2178
|
/**
|
|
2179
|
-
* Generates a random
|
|
2180
|
-
* A passphrase is a combination of random words separated by a character.
|
|
2181
|
-
* An example of passphrase is `correct horse battery staple`.
|
|
2179
|
+
* Generates a random password.
|
|
2182
2180
|
*
|
|
2183
|
-
* The
|
|
2184
|
-
* a number in the passphrase can be customized using the `input` parameter.
|
|
2181
|
+
* The character sets and password length can be customized using the `input` parameter.
|
|
2185
2182
|
*
|
|
2186
2183
|
* # Examples
|
|
2187
2184
|
*
|
|
2188
2185
|
* ```
|
|
2189
2186
|
* use bitwarden_core::Client;
|
|
2190
|
-
* use bitwarden_generators::{GeneratorClientsExt, PassphraseError,
|
|
2187
|
+
* use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
|
|
2191
2188
|
*
|
|
2192
2189
|
* async fn test() -> Result<(), PassphraseError> {
|
|
2193
|
-
* let input =
|
|
2194
|
-
*
|
|
2190
|
+
* let input = PasswordGeneratorRequest {
|
|
2191
|
+
* lowercase: true,
|
|
2192
|
+
* uppercase: true,
|
|
2193
|
+
* numbers: true,
|
|
2194
|
+
* length: 20,
|
|
2195
2195
|
* ..Default::default()
|
|
2196
2196
|
* };
|
|
2197
|
-
* let
|
|
2198
|
-
* println!("{}",
|
|
2197
|
+
* let password = Client::new(None).generator().password(input).unwrap();
|
|
2198
|
+
* println!("{}", password);
|
|
2199
2199
|
* Ok(())
|
|
2200
2200
|
* }
|
|
2201
2201
|
* ```
|
|
2202
2202
|
*/
|
|
2203
|
-
|
|
2203
|
+
password(input: PasswordGeneratorRequest): string;
|
|
2204
2204
|
}
|
|
2205
2205
|
/**
|
|
2206
2206
|
* The IdentityClient is used to obtain identity / access tokens from the Bitwarden Identity API.
|
|
@@ -2213,12 +2213,12 @@ export class IdentityClient {
|
|
|
2213
2213
|
export class IncomingMessage {
|
|
2214
2214
|
free(): void;
|
|
2215
2215
|
[Symbol.dispose](): void;
|
|
2216
|
-
constructor(payload: Uint8Array, destination: Endpoint, source: Endpoint, topic?: string | null);
|
|
2217
2216
|
/**
|
|
2218
2217
|
* Try to parse the payload as JSON.
|
|
2219
2218
|
* @returns The parsed JSON value, or undefined if the payload is not valid JSON.
|
|
2220
2219
|
*/
|
|
2221
2220
|
parse_payload_as_json(): any;
|
|
2221
|
+
constructor(payload: Uint8Array, destination: Endpoint, source: Endpoint, topic?: string | null);
|
|
2222
2222
|
payload: Uint8Array;
|
|
2223
2223
|
destination: Endpoint;
|
|
2224
2224
|
source: Endpoint;
|
|
@@ -2233,6 +2233,7 @@ export class IpcClient {
|
|
|
2233
2233
|
private constructor();
|
|
2234
2234
|
free(): void;
|
|
2235
2235
|
[Symbol.dispose](): void;
|
|
2236
|
+
isRunning(): Promise<boolean>;
|
|
2236
2237
|
/**
|
|
2237
2238
|
* Create a new `IpcClient` instance with an in-memory session repository for saving
|
|
2238
2239
|
* sessions within the SDK.
|
|
@@ -2246,9 +2247,8 @@ export class IpcClient {
|
|
|
2246
2247
|
communication_provider: IpcCommunicationBackend,
|
|
2247
2248
|
session_repository: IpcSessionRepository,
|
|
2248
2249
|
): IpcClient;
|
|
2249
|
-
start(): Promise<void>;
|
|
2250
|
-
isRunning(): Promise<boolean>;
|
|
2251
2250
|
send(message: OutgoingMessage): Promise<void>;
|
|
2251
|
+
start(): Promise<void>;
|
|
2252
2252
|
subscribe(): Promise<IpcClientSubscription>;
|
|
2253
2253
|
}
|
|
2254
2254
|
/**
|
|
@@ -2279,7 +2279,6 @@ export class IpcCommunicationBackend {
|
|
|
2279
2279
|
export class OutgoingMessage {
|
|
2280
2280
|
free(): void;
|
|
2281
2281
|
[Symbol.dispose](): void;
|
|
2282
|
-
constructor(payload: Uint8Array, destination: Endpoint, topic?: string | null);
|
|
2283
2282
|
/**
|
|
2284
2283
|
* Create a new message and encode the payload as JSON.
|
|
2285
2284
|
*/
|
|
@@ -2288,6 +2287,7 @@ export class OutgoingMessage {
|
|
|
2288
2287
|
destination: Endpoint,
|
|
2289
2288
|
topic?: string | null,
|
|
2290
2289
|
): OutgoingMessage;
|
|
2290
|
+
constructor(payload: Uint8Array, destination: Endpoint, topic?: string | null);
|
|
2291
2291
|
payload: Uint8Array;
|
|
2292
2292
|
destination: Endpoint;
|
|
2293
2293
|
get topic(): string | undefined;
|
|
@@ -2299,64 +2299,64 @@ export class OutgoingMessage {
|
|
|
2299
2299
|
export class PasswordManagerClient {
|
|
2300
2300
|
free(): void;
|
|
2301
2301
|
[Symbol.dispose](): void;
|
|
2302
|
+
/**
|
|
2303
|
+
* Bitwarden licensed operations.
|
|
2304
|
+
*/
|
|
2305
|
+
commercial(): CommercialPasswordManagerClient;
|
|
2302
2306
|
/**
|
|
2303
2307
|
* Initialize a new instance of the SDK client
|
|
2304
2308
|
*/
|
|
2305
2309
|
constructor(token_provider: any, settings?: ClientSettings | null);
|
|
2306
2310
|
/**
|
|
2307
|
-
*
|
|
2311
|
+
* Auth related operations.
|
|
2308
2312
|
*/
|
|
2309
|
-
|
|
2313
|
+
auth(): AuthClient;
|
|
2310
2314
|
/**
|
|
2311
|
-
*
|
|
2315
|
+
* Test method, echoes back the input
|
|
2312
2316
|
*/
|
|
2313
|
-
|
|
2317
|
+
echo(msg: string): string;
|
|
2314
2318
|
/**
|
|
2315
2319
|
* Test method, always throws an error
|
|
2316
2320
|
*/
|
|
2317
2321
|
throw(msg: string): void;
|
|
2318
2322
|
/**
|
|
2319
|
-
*
|
|
2320
|
-
*/
|
|
2321
|
-
http_get(url: string): Promise<string>;
|
|
2322
|
-
/**
|
|
2323
|
-
* Auth related operations.
|
|
2324
|
-
*/
|
|
2325
|
-
auth(): AuthClient;
|
|
2326
|
-
/**
|
|
2327
|
-
* Bitwarden licensed operations.
|
|
2323
|
+
* Vault item related operations.
|
|
2328
2324
|
*/
|
|
2329
|
-
|
|
2325
|
+
vault(): VaultClient;
|
|
2330
2326
|
/**
|
|
2331
2327
|
* Crypto related operations.
|
|
2332
2328
|
*/
|
|
2333
2329
|
crypto(): CryptoClient;
|
|
2334
2330
|
/**
|
|
2335
|
-
*
|
|
2331
|
+
* Returns the current SDK version
|
|
2336
2332
|
*/
|
|
2337
|
-
|
|
2333
|
+
version(): string;
|
|
2338
2334
|
/**
|
|
2339
|
-
*
|
|
2335
|
+
* Test method, calls http endpoint
|
|
2340
2336
|
*/
|
|
2341
|
-
|
|
2337
|
+
http_get(url: string): Promise<string>;
|
|
2342
2338
|
/**
|
|
2343
|
-
* Constructs a specific client for
|
|
2339
|
+
* Constructs a specific client for platform-specific functionality
|
|
2344
2340
|
*/
|
|
2345
|
-
|
|
2341
|
+
platform(): PlatformClient;
|
|
2346
2342
|
/**
|
|
2347
2343
|
* Exporter related operations.
|
|
2348
2344
|
*/
|
|
2349
2345
|
exporters(): ExporterClient;
|
|
2346
|
+
/**
|
|
2347
|
+
* Constructs a specific client for generating passwords and passphrases
|
|
2348
|
+
*/
|
|
2349
|
+
generator(): GeneratorClient;
|
|
2350
2350
|
}
|
|
2351
2351
|
export class PlatformClient {
|
|
2352
2352
|
private constructor();
|
|
2353
2353
|
free(): void;
|
|
2354
2354
|
[Symbol.dispose](): void;
|
|
2355
|
-
state(): StateClient;
|
|
2356
2355
|
/**
|
|
2357
2356
|
* Load feature flags into the client
|
|
2358
2357
|
*/
|
|
2359
2358
|
load_flags(flags: FeatureFlags): void;
|
|
2359
|
+
state(): StateClient;
|
|
2360
2360
|
}
|
|
2361
2361
|
/**
|
|
2362
2362
|
* This module represents a stopgap solution to provide access to primitive crypto functions for JS
|
|
@@ -2369,77 +2369,63 @@ export class PureCrypto {
|
|
|
2369
2369
|
free(): void;
|
|
2370
2370
|
[Symbol.dispose](): void;
|
|
2371
2371
|
/**
|
|
2372
|
-
*
|
|
2373
|
-
*
|
|
2372
|
+
* Decrypts data using RSAES-OAEP with SHA-1
|
|
2373
|
+
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
2374
2374
|
*/
|
|
2375
|
-
static
|
|
2376
|
-
static symmetric_decrypt_string(enc_string: string, key: Uint8Array): string;
|
|
2377
|
-
static symmetric_decrypt_bytes(enc_string: string, key: Uint8Array): Uint8Array;
|
|
2375
|
+
static rsa_decrypt_data(encrypted_data: Uint8Array, private_key: Uint8Array): Uint8Array;
|
|
2378
2376
|
/**
|
|
2379
|
-
*
|
|
2380
|
-
*
|
|
2377
|
+
* Encrypts data using RSAES-OAEP with SHA-1
|
|
2378
|
+
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
2381
2379
|
*/
|
|
2382
|
-
static
|
|
2383
|
-
static symmetric_decrypt_filedata(enc_bytes: Uint8Array, key: Uint8Array): Uint8Array;
|
|
2384
|
-
static symmetric_encrypt_string(plain: string, key: Uint8Array): string;
|
|
2380
|
+
static rsa_encrypt_data(plain_data: Uint8Array, public_key: Uint8Array): Uint8Array;
|
|
2385
2381
|
/**
|
|
2386
|
-
* DEPRECATED:
|
|
2382
|
+
* DEPRECATED: Use `symmetric_decrypt_string` instead.
|
|
2383
|
+
* Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
|
|
2387
2384
|
*/
|
|
2388
|
-
static
|
|
2389
|
-
static symmetric_encrypt_filedata(plain: Uint8Array, key: Uint8Array): Uint8Array;
|
|
2390
|
-
static decrypt_user_key_with_master_password(
|
|
2391
|
-
encrypted_user_key: string,
|
|
2392
|
-
master_password: string,
|
|
2393
|
-
email: string,
|
|
2394
|
-
kdf: Kdf,
|
|
2395
|
-
): Uint8Array;
|
|
2396
|
-
static encrypt_user_key_with_master_password(
|
|
2397
|
-
user_key: Uint8Array,
|
|
2398
|
-
master_password: string,
|
|
2399
|
-
email: string,
|
|
2400
|
-
kdf: Kdf,
|
|
2401
|
-
): string;
|
|
2402
|
-
static make_user_key_aes256_cbc_hmac(): Uint8Array;
|
|
2403
|
-
static make_user_key_xchacha20_poly1305(): Uint8Array;
|
|
2385
|
+
static symmetric_decrypt(enc_string: string, key: Uint8Array): string;
|
|
2404
2386
|
/**
|
|
2405
2387
|
* Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
|
|
2406
2388
|
* as an EncString.
|
|
2407
2389
|
*/
|
|
2408
2390
|
static wrap_symmetric_key(key_to_be_wrapped: Uint8Array, wrapping_key: Uint8Array): string;
|
|
2391
|
+
/**
|
|
2392
|
+
* Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
|
|
2393
|
+
*/
|
|
2394
|
+
static derive_kdf_material(password: Uint8Array, salt: Uint8Array, kdf: Kdf): Uint8Array;
|
|
2395
|
+
/**
|
|
2396
|
+
* Generates a new RSA key pair and returns the private key
|
|
2397
|
+
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
2398
|
+
*/
|
|
2399
|
+
static rsa_generate_keypair(): Uint8Array;
|
|
2409
2400
|
/**
|
|
2410
2401
|
* Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
|
|
2411
2402
|
* unwrapped key as a serialized byte array.
|
|
2412
2403
|
*/
|
|
2413
2404
|
static unwrap_symmetric_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
|
|
2414
2405
|
/**
|
|
2415
|
-
*
|
|
2416
|
-
*
|
|
2417
|
-
*
|
|
2418
|
-
* the "public key" is not public, with the intent of preventing the server from being able
|
|
2419
|
-
* to overwrite the user key unlocked by the rotateable keyset.
|
|
2420
|
-
*/
|
|
2421
|
-
static wrap_encapsulation_key(encapsulation_key: Uint8Array, wrapping_key: Uint8Array): string;
|
|
2422
|
-
/**
|
|
2423
|
-
* Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
|
|
2424
|
-
* wrapping key.
|
|
2406
|
+
* Given a decrypted private RSA key PKCS8 DER this
|
|
2407
|
+
* returns the corresponding public RSA key in DER format.
|
|
2408
|
+
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
2425
2409
|
*/
|
|
2426
|
-
static
|
|
2410
|
+
static rsa_extract_public_key(private_key: Uint8Array): Uint8Array;
|
|
2427
2411
|
/**
|
|
2428
2412
|
* Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
|
|
2429
2413
|
* key,
|
|
2430
2414
|
*/
|
|
2431
2415
|
static wrap_decapsulation_key(decapsulation_key: Uint8Array, wrapping_key: Uint8Array): string;
|
|
2432
2416
|
/**
|
|
2433
|
-
*
|
|
2434
|
-
*
|
|
2417
|
+
* Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
|
|
2418
|
+
* key. Note: Usually, a public key is - by definition - public, so this should not be
|
|
2419
|
+
* used. The specific use-case for this function is to enable rotateable key sets, where
|
|
2420
|
+
* the "public key" is not public, with the intent of preventing the server from being able
|
|
2421
|
+
* to overwrite the user key unlocked by the rotateable keyset.
|
|
2435
2422
|
*/
|
|
2436
|
-
static
|
|
2423
|
+
static wrap_encapsulation_key(encapsulation_key: Uint8Array, wrapping_key: Uint8Array): string;
|
|
2424
|
+
static symmetric_decrypt_bytes(enc_string: string, key: Uint8Array): Uint8Array;
|
|
2437
2425
|
/**
|
|
2438
|
-
*
|
|
2439
|
-
* in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
|
|
2440
|
-
* the sender's authenticity cannot be verified by the recipient.
|
|
2426
|
+
* DEPRECATED: Only used by send keys
|
|
2441
2427
|
*/
|
|
2442
|
-
static
|
|
2428
|
+
static symmetric_encrypt_bytes(plain: Uint8Array, key: Uint8Array): string;
|
|
2443
2429
|
/**
|
|
2444
2430
|
* Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
|
|
2445
2431
|
* DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
|
|
@@ -2449,15 +2435,46 @@ export class PureCrypto {
|
|
|
2449
2435
|
encapsulated_key: string,
|
|
2450
2436
|
decapsulation_key: Uint8Array,
|
|
2451
2437
|
): Uint8Array;
|
|
2438
|
+
/**
|
|
2439
|
+
* Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
|
|
2440
|
+
* in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
|
|
2441
|
+
* the sender's authenticity cannot be verified by the recipient.
|
|
2442
|
+
*/
|
|
2443
|
+
static encapsulate_key_unsigned(shared_key: Uint8Array, encapsulation_key: Uint8Array): string;
|
|
2444
|
+
static symmetric_decrypt_string(enc_string: string, key: Uint8Array): string;
|
|
2445
|
+
static symmetric_encrypt_string(plain: string, key: Uint8Array): string;
|
|
2446
|
+
/**
|
|
2447
|
+
* Unwraps (decrypts) a wrapped PKCS8 DER encoded decapsulation (private) key using a symmetric
|
|
2448
|
+
* wrapping key.
|
|
2449
|
+
*/
|
|
2450
|
+
static unwrap_decapsulation_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
|
|
2451
|
+
/**
|
|
2452
|
+
* Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
|
|
2453
|
+
* wrapping key.
|
|
2454
|
+
*/
|
|
2455
|
+
static unwrap_encapsulation_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
|
|
2456
|
+
static symmetric_decrypt_filedata(enc_bytes: Uint8Array, key: Uint8Array): Uint8Array;
|
|
2457
|
+
static symmetric_encrypt_filedata(plain: Uint8Array, key: Uint8Array): Uint8Array;
|
|
2458
|
+
static make_user_key_aes256_cbc_hmac(): Uint8Array;
|
|
2452
2459
|
/**
|
|
2453
2460
|
* Given a wrapped signing key and the symmetric key it is wrapped with, this returns
|
|
2454
2461
|
* the corresponding verifying key.
|
|
2455
2462
|
*/
|
|
2456
2463
|
static verifying_key_for_signing_key(signing_key: string, wrapping_key: Uint8Array): Uint8Array;
|
|
2464
|
+
/**
|
|
2465
|
+
* DEPRECATED: Use `symmetric_decrypt_filedata` instead.
|
|
2466
|
+
* Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
|
|
2467
|
+
*/
|
|
2468
|
+
static symmetric_decrypt_array_buffer(enc_bytes: Uint8Array, key: Uint8Array): Uint8Array;
|
|
2457
2469
|
/**
|
|
2458
2470
|
* Returns the algorithm used for the given verifying key.
|
|
2459
2471
|
*/
|
|
2460
2472
|
static key_algorithm_for_verifying_key(verifying_key: Uint8Array): SignatureAlgorithm;
|
|
2473
|
+
static decrypt_user_key_with_master_key(
|
|
2474
|
+
encrypted_user_key: string,
|
|
2475
|
+
master_key: Uint8Array,
|
|
2476
|
+
): Uint8Array;
|
|
2477
|
+
static make_user_key_xchacha20_poly1305(): Uint8Array;
|
|
2461
2478
|
/**
|
|
2462
2479
|
* For a given signing identity (verifying key), this function verifies that the signing
|
|
2463
2480
|
* identity claimed ownership of the public key. This is a one-sided claim and merely shows
|
|
@@ -2468,35 +2485,18 @@ export class PureCrypto {
|
|
|
2468
2485
|
signed_public_key: Uint8Array,
|
|
2469
2486
|
verifying_key: Uint8Array,
|
|
2470
2487
|
): Uint8Array;
|
|
2471
|
-
|
|
2472
|
-
* Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
|
|
2473
|
-
*/
|
|
2474
|
-
static derive_kdf_material(password: Uint8Array, salt: Uint8Array, kdf: Kdf): Uint8Array;
|
|
2475
|
-
static decrypt_user_key_with_master_key(
|
|
2488
|
+
static decrypt_user_key_with_master_password(
|
|
2476
2489
|
encrypted_user_key: string,
|
|
2477
|
-
|
|
2490
|
+
master_password: string,
|
|
2491
|
+
email: string,
|
|
2492
|
+
kdf: Kdf,
|
|
2478
2493
|
): Uint8Array;
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
/**
|
|
2486
|
-
* Generates a new RSA key pair and returns the private key
|
|
2487
|
-
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
2488
|
-
*/
|
|
2489
|
-
static rsa_generate_keypair(): Uint8Array;
|
|
2490
|
-
/**
|
|
2491
|
-
* Decrypts data using RSAES-OAEP with SHA-1
|
|
2492
|
-
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
2493
|
-
*/
|
|
2494
|
-
static rsa_decrypt_data(encrypted_data: Uint8Array, private_key: Uint8Array): Uint8Array;
|
|
2495
|
-
/**
|
|
2496
|
-
* Encrypts data using RSAES-OAEP with SHA-1
|
|
2497
|
-
* HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
|
|
2498
|
-
*/
|
|
2499
|
-
static rsa_encrypt_data(plain_data: Uint8Array, public_key: Uint8Array): Uint8Array;
|
|
2494
|
+
static encrypt_user_key_with_master_password(
|
|
2495
|
+
user_key: Uint8Array,
|
|
2496
|
+
master_password: string,
|
|
2497
|
+
email: string,
|
|
2498
|
+
kdf: Kdf,
|
|
2499
|
+
): string;
|
|
2500
2500
|
}
|
|
2501
2501
|
/**
|
|
2502
2502
|
* Client for initializing a user account.
|
|
@@ -2522,13 +2522,13 @@ export class StateClient {
|
|
|
2522
2522
|
private constructor();
|
|
2523
2523
|
free(): void;
|
|
2524
2524
|
[Symbol.dispose](): void;
|
|
2525
|
-
register_cipher_repository(cipher_repository: any): void;
|
|
2526
|
-
register_folder_repository(store: any): void;
|
|
2527
|
-
register_client_managed_repositories(repositories: Repositories): void;
|
|
2528
2525
|
/**
|
|
2529
2526
|
* Initialize the database for SDK managed repositories.
|
|
2530
2527
|
*/
|
|
2531
2528
|
initialize_state(configuration: IndexedDbConfiguration): Promise<void>;
|
|
2529
|
+
register_cipher_repository(cipher_repository: any): void;
|
|
2530
|
+
register_folder_repository(store: any): void;
|
|
2531
|
+
register_client_managed_repositories(repositories: Repositories): void;
|
|
2532
2532
|
}
|
|
2533
2533
|
export class TotpClient {
|
|
2534
2534
|
private constructor();
|
|
@@ -2555,23 +2555,23 @@ export class VaultClient {
|
|
|
2555
2555
|
*/
|
|
2556
2556
|
attachments(): AttachmentsClient;
|
|
2557
2557
|
/**
|
|
2558
|
-
* Cipher
|
|
2558
|
+
* Cipher risk evaluation operations.
|
|
2559
2559
|
*/
|
|
2560
|
-
|
|
2560
|
+
cipher_risk(): CipherRiskClient;
|
|
2561
2561
|
/**
|
|
2562
|
-
*
|
|
2562
|
+
* Collection related operations.
|
|
2563
2563
|
*/
|
|
2564
|
-
|
|
2564
|
+
collections(): CollectionsClient;
|
|
2565
2565
|
/**
|
|
2566
2566
|
* TOTP related operations.
|
|
2567
2567
|
*/
|
|
2568
2568
|
totp(): TotpClient;
|
|
2569
2569
|
/**
|
|
2570
|
-
*
|
|
2570
|
+
* Cipher related operations.
|
|
2571
2571
|
*/
|
|
2572
|
-
|
|
2572
|
+
ciphers(): CiphersClient;
|
|
2573
2573
|
/**
|
|
2574
|
-
*
|
|
2574
|
+
* Folder related operations.
|
|
2575
2575
|
*/
|
|
2576
|
-
|
|
2576
|
+
folders(): FoldersClient;
|
|
2577
2577
|
}
|