@bitwarden/sdk-internal 0.2.0-main.27 → 0.2.0-main.271

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,110 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export function set_log_level(level: LogLevel): void;
4
+ export function init_sdk(log_level?: LogLevel | null): void;
3
5
  /**
4
- * @param {KeyAlgorithm} key_algorithm
5
- * @returns {GenerateSshKeyResult}
6
+ * Generate a new SSH key pair
7
+ *
8
+ * # Arguments
9
+ * - `key_algorithm` - The algorithm to use for the key pair
10
+ *
11
+ * # Returns
12
+ * - `Ok(SshKey)` if the key was successfully generated
13
+ * - `Err(KeyGenerationError)` if the key could not be generated
14
+ */
15
+ export function generate_ssh_key(key_algorithm: KeyAlgorithm): SshKeyView;
16
+ /**
17
+ * Convert a PCKS8 or OpenSSH encrypted or unencrypted private key
18
+ * to an OpenSSH private key with public key and fingerprint
19
+ *
20
+ * # Arguments
21
+ * - `imported_key` - The private key to convert
22
+ * - `password` - The password to use for decrypting the key
23
+ *
24
+ * # Returns
25
+ * - `Ok(SshKey)` if the key was successfully coneverted
26
+ * - `Err(PasswordRequired)` if the key is encrypted and no password was provided
27
+ * - `Err(WrongPassword)` if the password provided is incorrect
28
+ * - `Err(ParsingError)` if the key could not be parsed
29
+ * - `Err(UnsupportedKeyType)` if the key type is not supported
30
+ */
31
+ export function import_ssh_key(imported_key: string, password?: string | null): SshKeyView;
32
+ /**
33
+ * Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
6
34
  */
7
- export function generate_ssh_key(key_algorithm: KeyAlgorithm): GenerateSshKeyResult;
35
+ export function ipcRegisterDiscoverHandler(
36
+ ipc_client: IpcClient,
37
+ response: DiscoverResponse,
38
+ ): Promise<void>;
39
+ /**
40
+ * Sends a DiscoverRequest to the specified destination and returns the response.
41
+ */
42
+ export function ipcRequestDiscover(
43
+ ipc_client: IpcClient,
44
+ destination: Endpoint,
45
+ abort_signal?: AbortSignal | null,
46
+ ): Promise<DiscoverResponse>;
47
+ export enum CardLinkedIdType {
48
+ CardholderName = 300,
49
+ ExpMonth = 301,
50
+ ExpYear = 302,
51
+ Code = 303,
52
+ Brand = 304,
53
+ Number = 305,
54
+ }
55
+ export enum CipherRepromptType {
56
+ None = 0,
57
+ Password = 1,
58
+ }
59
+ export enum CipherType {
60
+ Login = 1,
61
+ SecureNote = 2,
62
+ Card = 3,
63
+ Identity = 4,
64
+ SshKey = 5,
65
+ }
66
+ /**
67
+ * Represents the type of a [FieldView].
68
+ */
69
+ export enum FieldType {
70
+ /**
71
+ * Text field
72
+ */
73
+ Text = 0,
74
+ /**
75
+ * Hidden text field
76
+ */
77
+ Hidden = 1,
78
+ /**
79
+ * Boolean field
80
+ */
81
+ Boolean = 2,
82
+ /**
83
+ * Linked field
84
+ */
85
+ Linked = 3,
86
+ }
87
+ export enum IdentityLinkedIdType {
88
+ Title = 400,
89
+ MiddleName = 401,
90
+ Address1 = 402,
91
+ Address2 = 403,
92
+ Address3 = 404,
93
+ City = 405,
94
+ State = 406,
95
+ PostalCode = 407,
96
+ Country = 408,
97
+ Company = 409,
98
+ Email = 410,
99
+ Phone = 411,
100
+ Ssn = 412,
101
+ Username = 413,
102
+ PassportNumber = 414,
103
+ LicenseNumber = 415,
104
+ FirstName = 416,
105
+ LastName = 417,
106
+ FullName = 418,
107
+ }
8
108
  export enum LogLevel {
9
109
  Trace = 0,
10
110
  Debug = 1,
@@ -12,7 +112,117 @@ export enum LogLevel {
12
112
  Warn = 3,
13
113
  Error = 4,
14
114
  }
115
+ export enum LoginLinkedIdType {
116
+ Username = 100,
117
+ Password = 101,
118
+ }
119
+ export enum SecureNoteType {
120
+ Generic = 0,
121
+ }
122
+ export enum UriMatchType {
123
+ Domain = 0,
124
+ Host = 1,
125
+ StartsWith = 2,
126
+ Exact = 3,
127
+ RegularExpression = 4,
128
+ Never = 5,
129
+ }
130
+
131
+ import { Tagged } from "type-fest";
132
+
133
+ /**
134
+ * A string that **MUST** be a valid UUID.
135
+ *
136
+ * Never create or cast to this type directly, use the `uuid<T>()` function instead.
137
+ */
138
+ export type Uuid = unknown;
139
+
140
+ /**
141
+ * RFC3339 compliant date-time string.
142
+ * @typeParam T - Not used in JavaScript.
143
+ */
144
+ export type DateTime<T = unknown> = string;
145
+
146
+ /**
147
+ * UTC date-time string. Not used in JavaScript.
148
+ */
149
+ export type Utc = unknown;
150
+
151
+ /**
152
+ * An integer that is known not to equal zero.
153
+ */
154
+ export type NonZeroU32 = number;
155
+
156
+ export interface Repository<T> {
157
+ get(id: string): Promise<T | null>;
158
+ list(): Promise<T[]>;
159
+ set(id: string, value: T): Promise<void>;
160
+ remove(id: string): Promise<void>;
161
+ }
162
+
163
+ export interface TokenProvider {
164
+ get_access_token(): Promise<string | undefined>;
165
+ }
166
+
167
+ /**
168
+ * Active feature flags for the SDK.
169
+ */
170
+ export interface FeatureFlags extends Map<string, boolean> {}
171
+
172
+ export interface TestError extends Error {
173
+ name: "TestError";
174
+ }
175
+
176
+ export function isTestError(error: any): error is TestError;
177
+
178
+ /**
179
+ * NewType wrapper for `CollectionId`
180
+ */
181
+ export type CollectionId = Tagged<Uuid, "CollectionId">;
182
+
183
+ export interface Collection {
184
+ id: CollectionId | undefined;
185
+ organizationId: OrganizationId;
186
+ name: EncString;
187
+ externalId: string | undefined;
188
+ hidePasswords: boolean;
189
+ readOnly: boolean;
190
+ manage: boolean;
191
+ defaultUserCollectionEmail: string | undefined;
192
+ type: CollectionType;
193
+ }
194
+
195
+ export interface CollectionView {
196
+ id: CollectionId | undefined;
197
+ organizationId: OrganizationId;
198
+ name: string;
199
+ externalId: string | undefined;
200
+ hidePasswords: boolean;
201
+ readOnly: boolean;
202
+ manage: boolean;
203
+ type: CollectionType;
204
+ }
205
+
206
+ /**
207
+ * Type of collection
208
+ */
209
+ export type CollectionType = "SharedCollection" | "DefaultUserCollection";
210
+
211
+ export interface CollectionDecryptError extends Error {
212
+ name: "CollectionDecryptError";
213
+ variant: "Crypto";
214
+ }
215
+
216
+ export function isCollectionDecryptError(error: any): error is CollectionDecryptError;
217
+
218
+ /**
219
+ * State used for initializing the user cryptographic state.
220
+ */
15
221
  export interface InitUserCryptoRequest {
222
+ /**
223
+ * The user\'s ID.
224
+ */
225
+ userId: UserId | undefined;
16
226
  /**
17
227
  * The user\'s KDF parameters, as received from the prelogin request
18
228
  */
@@ -24,66 +234,260 @@ export interface InitUserCryptoRequest {
24
234
  /**
25
235
  * The user\'s encrypted private key
26
236
  */
27
- privateKey: string;
237
+ privateKey: EncString;
238
+ /**
239
+ * The user\'s signing key
240
+ */
241
+ signingKey: EncString | undefined;
242
+ /**
243
+ * The user\'s security state
244
+ */
245
+ securityState: SignedSecurityState | undefined;
28
246
  /**
29
247
  * The initialization method to use
30
248
  */
31
249
  method: InitUserCryptoMethod;
32
250
  }
33
251
 
252
+ /**
253
+ * The crypto method used to initialize the user cryptographic state.
254
+ */
34
255
  export type InitUserCryptoMethod =
35
- | { password: { password: string; user_key: string } }
256
+ | { password: { password: string; user_key: EncString } }
36
257
  | { decryptedKey: { decrypted_user_key: string } }
37
258
  | { pin: { pin: string; pin_protected_user_key: EncString } }
38
- | { authRequest: { request_private_key: string; method: AuthRequestMethod } }
259
+ | { pinEnvelope: { pin: string; pin_protected_user_key_envelope: PasswordProtectedKeyEnvelope } }
260
+ | { authRequest: { request_private_key: B64; method: AuthRequestMethod } }
39
261
  | {
40
262
  deviceKey: {
41
263
  device_key: string;
42
264
  protected_device_private_key: EncString;
43
- device_protected_user_key: AsymmetricEncString;
265
+ device_protected_user_key: UnsignedSharedKey;
44
266
  };
45
267
  }
46
- | { keyConnector: { master_key: string; user_key: string } };
268
+ | { keyConnector: { master_key: B64; user_key: EncString } };
47
269
 
270
+ /**
271
+ * Auth requests supports multiple initialization methods.
272
+ */
48
273
  export type AuthRequestMethod =
49
- | { userKey: { protected_user_key: AsymmetricEncString } }
50
- | { masterKey: { protected_master_key: AsymmetricEncString; auth_request_key: EncString } };
274
+ | { userKey: { protected_user_key: UnsignedSharedKey } }
275
+ | { masterKey: { protected_master_key: UnsignedSharedKey; auth_request_key: EncString } };
51
276
 
277
+ /**
278
+ * Represents the request to initialize the user\'s organizational cryptographic state.
279
+ */
52
280
  export interface InitOrgCryptoRequest {
53
281
  /**
54
282
  * The encryption keys for all the organizations the user is a part of
55
283
  */
56
- organizationKeys: Map<Uuid, AsymmetricEncString>;
284
+ organizationKeys: Map<OrganizationId, UnsignedSharedKey>;
57
285
  }
58
286
 
59
- export interface CoreError extends Error {
60
- name: "CoreError";
61
- variant:
62
- | "MissingFieldError"
63
- | "VaultLocked"
64
- | "NotAuthenticated"
65
- | "AccessTokenInvalid"
66
- | "InvalidResponse"
67
- | "Crypto"
68
- | "IdentityFail"
69
- | "Reqwest"
70
- | "Serde"
71
- | "Io"
72
- | "InvalidBase64"
73
- | "Chrono"
74
- | "ResponseContent"
75
- | "ValidationError"
76
- | "InvalidStateFileVersion"
77
- | "InvalidStateFile"
78
- | "Internal"
79
- | "EncryptionSettings";
80
- }
81
-
82
- export function isCoreError(error: any): error is CoreError;
287
+ /**
288
+ * Response from the `update_password` function
289
+ */
290
+ export interface UpdatePasswordResponse {
291
+ /**
292
+ * Hash of the new password
293
+ */
294
+ passwordHash: B64;
295
+ /**
296
+ * User key, encrypted with the new password
297
+ */
298
+ newKey: EncString;
299
+ }
300
+
301
+ /**
302
+ * Request for deriving a pin protected user key
303
+ */
304
+ export interface EnrollPinResponse {
305
+ /**
306
+ * [UserKey] protected by PIN
307
+ */
308
+ pinProtectedUserKeyEnvelope: PasswordProtectedKeyEnvelope;
309
+ /**
310
+ * PIN protected by [UserKey]
311
+ */
312
+ userKeyEncryptedPin: EncString;
313
+ }
314
+
315
+ /**
316
+ * Request for deriving a pin protected user key
317
+ */
318
+ export interface DerivePinKeyResponse {
319
+ /**
320
+ * [UserKey] protected by PIN
321
+ */
322
+ pinProtectedUserKey: EncString;
323
+ /**
324
+ * PIN protected by [UserKey]
325
+ */
326
+ encryptedPin: EncString;
327
+ }
328
+
329
+ /**
330
+ * Request for migrating an account from password to key connector.
331
+ */
332
+ export interface DeriveKeyConnectorRequest {
333
+ /**
334
+ * Encrypted user key, used to validate the master key
335
+ */
336
+ userKeyEncrypted: EncString;
337
+ /**
338
+ * The user\'s master password
339
+ */
340
+ password: string;
341
+ /**
342
+ * The KDF parameters used to derive the master key
343
+ */
344
+ kdf: Kdf;
345
+ /**
346
+ * The user\'s email address
347
+ */
348
+ email: string;
349
+ }
350
+
351
+ /**
352
+ * Response from the `make_key_pair` function
353
+ */
354
+ export interface MakeKeyPairResponse {
355
+ /**
356
+ * The user\'s public key
357
+ */
358
+ userPublicKey: B64;
359
+ /**
360
+ * User\'s private key, encrypted with the user key
361
+ */
362
+ userKeyEncryptedPrivateKey: EncString;
363
+ }
364
+
365
+ /**
366
+ * Request for `verify_asymmetric_keys`.
367
+ */
368
+ export interface VerifyAsymmetricKeysRequest {
369
+ /**
370
+ * The user\'s user key
371
+ */
372
+ userKey: B64;
373
+ /**
374
+ * The user\'s public key
375
+ */
376
+ userPublicKey: B64;
377
+ /**
378
+ * User\'s private key, encrypted with the user key
379
+ */
380
+ userKeyEncryptedPrivateKey: EncString;
381
+ }
382
+
383
+ /**
384
+ * Response for `verify_asymmetric_keys`.
385
+ */
386
+ export interface VerifyAsymmetricKeysResponse {
387
+ /**
388
+ * Whether the user\'s private key was decryptable by the user key.
389
+ */
390
+ privateKeyDecryptable: boolean;
391
+ /**
392
+ * Whether the user\'s private key was a valid RSA key and matched the public key provided.
393
+ */
394
+ validPrivateKey: boolean;
395
+ }
396
+
397
+ /**
398
+ * Response for the `make_keys_for_user_crypto_v2`, containing a set of keys for a user
399
+ */
400
+ export interface UserCryptoV2KeysResponse {
401
+ /**
402
+ * User key
403
+ */
404
+ userKey: B64;
405
+ /**
406
+ * Wrapped private key
407
+ */
408
+ privateKey: EncString;
409
+ /**
410
+ * Public key
411
+ */
412
+ publicKey: B64;
413
+ /**
414
+ * The user\'s public key, signed by the signing key
415
+ */
416
+ signedPublicKey: SignedPublicKey;
417
+ /**
418
+ * Signing key, encrypted with the user\'s symmetric key
419
+ */
420
+ signingKey: EncString;
421
+ /**
422
+ * Base64 encoded verifying key
423
+ */
424
+ verifyingKey: B64;
425
+ /**
426
+ * The user\'s signed security state
427
+ */
428
+ securityState: SignedSecurityState;
429
+ /**
430
+ * The security state\'s version
431
+ */
432
+ securityVersion: number;
433
+ }
434
+
435
+ export type SignedSecurityState = string;
436
+
437
+ /**
438
+ * NewType wrapper for `UserId`
439
+ */
440
+ export type UserId = Tagged<Uuid, "UserId">;
441
+
442
+ /**
443
+ * NewType wrapper for `OrganizationId`
444
+ */
445
+ export type OrganizationId = Tagged<Uuid, "OrganizationId">;
446
+
447
+ /**
448
+ * A non-generic wrapper around `bitwarden-crypto`\'s `PasswordProtectedKeyEnvelope`.
449
+ */
450
+ export type PasswordProtectedKeyEnvelope = Tagged<string, "PasswordProtectedKeyEnvelope">;
451
+
452
+ export interface DeriveKeyConnectorError extends Error {
453
+ name: "DeriveKeyConnectorError";
454
+ variant: "WrongPassword" | "Crypto";
455
+ }
456
+
457
+ export function isDeriveKeyConnectorError(error: any): error is DeriveKeyConnectorError;
458
+
459
+ export interface EnrollAdminPasswordResetError extends Error {
460
+ name: "EnrollAdminPasswordResetError";
461
+ variant: "VaultLocked" | "Crypto";
462
+ }
463
+
464
+ export function isEnrollAdminPasswordResetError(error: any): error is EnrollAdminPasswordResetError;
465
+
466
+ export interface CryptoClientError extends Error {
467
+ name: "CryptoClientError";
468
+ variant: "NotAuthenticated" | "VaultLocked" | "Crypto" | "PasswordProtectedKeyEnvelope";
469
+ }
470
+
471
+ export function isCryptoClientError(error: any): error is CryptoClientError;
472
+
473
+ export interface StatefulCryptoError extends Error {
474
+ name: "StatefulCryptoError";
475
+ variant: "MissingSecurityState" | "WrongAccountCryptoVersion" | "CryptoError";
476
+ }
477
+
478
+ export function isStatefulCryptoError(error: any): error is StatefulCryptoError;
83
479
 
84
480
  export interface EncryptionSettingsError extends Error {
85
481
  name: "EncryptionSettingsError";
86
- variant: "Crypto" | "InvalidBase64" | "VaultLocked" | "InvalidPrivateKey" | "MissingPrivateKey";
482
+ variant:
483
+ | "Crypto"
484
+ | "VaultLocked"
485
+ | "InvalidPrivateKey"
486
+ | "InvalidSigningKey"
487
+ | "InvalidSecurityState"
488
+ | "MissingPrivateKey"
489
+ | "UserIdAlreadySetError"
490
+ | "WrongPin";
87
491
  }
88
492
 
89
493
  export function isEncryptionSettingsError(error: any): error is EncryptionSettingsError;
@@ -152,9 +556,16 @@ export interface ClientSettings {
152
556
  deviceType?: DeviceType;
153
557
  }
154
558
 
155
- export type AsymmetricEncString = string;
559
+ export type UnsignedSharedKey = Tagged<string, "UnsignedSharedKey">;
560
+
561
+ export type EncString = Tagged<string, "EncString">;
562
+
563
+ export type SignedPublicKey = Tagged<string, "SignedPublicKey">;
156
564
 
157
- export type EncString = string;
565
+ /**
566
+ * The type of key / signature scheme used for signing and verifying.
567
+ */
568
+ export type SignatureAlgorithm = "ed25519";
158
569
 
159
570
  /**
160
571
  * Key Derivation Function for Bitwarden Account
@@ -166,124 +577,1367 @@ export type Kdf =
166
577
  | { pBKDF2: { iterations: NonZeroU32 } }
167
578
  | { argon2id: { iterations: NonZeroU32; memory: NonZeroU32; parallelism: NonZeroU32 } };
168
579
 
169
- export interface GenerateSshKeyResult {
170
- private_key: string;
171
- public_key: string;
172
- key_fingerprint: string;
580
+ export interface CryptoError extends Error {
581
+ name: "CryptoError";
582
+ variant:
583
+ | "InvalidKey"
584
+ | "InvalidMac"
585
+ | "MacNotProvided"
586
+ | "KeyDecrypt"
587
+ | "InvalidKeyLen"
588
+ | "InvalidUtf8String"
589
+ | "MissingKey"
590
+ | "MissingField"
591
+ | "MissingKeyId"
592
+ | "ReadOnlyKeyStore"
593
+ | "InsufficientKdfParameters"
594
+ | "EncString"
595
+ | "RsaError"
596
+ | "FingerprintError"
597
+ | "ArgonError"
598
+ | "ZeroNumber"
599
+ | "OperationNotSupported"
600
+ | "WrongKeyType"
601
+ | "WrongCoseKeyId"
602
+ | "InvalidNonceLength"
603
+ | "InvalidPadding"
604
+ | "SignatureError"
605
+ | "EncodingError";
173
606
  }
174
607
 
175
- export type KeyAlgorithm = "Ed25519" | "Rsa3072" | "Rsa4096";
176
-
177
- export interface KeyGenerationError extends Error {
178
- name: "KeyGenerationError";
179
- variant: "KeyGenerationError" | "KeyConversionError";
180
- }
608
+ export function isCryptoError(error: any): error is CryptoError;
181
609
 
182
- export function isKeyGenerationError(error: any): error is KeyGenerationError;
610
+ /**
611
+ * Base64 encoded data
612
+ *
613
+ * Is indifferent about padding when decoding, but always produces padding when encoding.
614
+ */
615
+ export type B64 = String;
183
616
 
184
- export interface Folder {
185
- id: Uuid | undefined;
186
- name: EncString;
187
- revisionDate: DateTime<Utc>;
617
+ /**
618
+ * Temporary struct to hold metadata related to current account
619
+ *
620
+ * Eventually the SDK itself should have this state and we get rid of this struct.
621
+ */
622
+ export interface Account {
623
+ id: Uuid;
624
+ email: string;
625
+ name: string | undefined;
188
626
  }
189
627
 
190
- export interface FolderView {
191
- id: Uuid | undefined;
192
- name: string;
193
- revisionDate: DateTime<Utc>;
194
- }
628
+ export type ExportFormat = "Csv" | "Json" | { EncryptedJson: { password: string } };
195
629
 
196
- export interface TestError extends Error {
197
- name: "TestError";
630
+ export interface ExportError extends Error {
631
+ name: "ExportError";
632
+ variant:
633
+ | "MissingField"
634
+ | "NotAuthenticated"
635
+ | "VaultLocked"
636
+ | "Csv"
637
+ | "CxfError"
638
+ | "Json"
639
+ | "EncryptedJsonError"
640
+ | "BitwardenCryptoError"
641
+ | "CipherError";
198
642
  }
199
643
 
200
- export function isTestError(error: any): error is TestError;
644
+ export function isExportError(error: any): error is ExportError;
201
645
 
202
- export type Uuid = string;
646
+ export type UsernameGeneratorRequest =
647
+ | { word: { capitalize: boolean; include_number: boolean } }
648
+ | { subaddress: { type: AppendType; email: string } }
649
+ | { catchall: { type: AppendType; domain: string } }
650
+ | { forwarded: { service: ForwarderServiceType; website: string | undefined } };
203
651
 
204
652
  /**
205
- * RFC3339 compliant date-time string.
206
- * @typeParam T - Not used in JavaScript.
653
+ * Configures the email forwarding service to use.
654
+ * For instructions on how to configure each service, see the documentation:
655
+ * <https://bitwarden.com/help/generator/#username-types>
207
656
  */
208
- export type DateTime<T = unknown> = string;
657
+ export type ForwarderServiceType =
658
+ | { addyIo: { api_token: string; domain: string; base_url: string } }
659
+ | { duckDuckGo: { token: string } }
660
+ | { firefox: { api_token: string } }
661
+ | { fastmail: { api_token: string } }
662
+ | { forwardEmail: { api_token: string; domain: string } }
663
+ | { simpleLogin: { api_key: string; base_url: string } };
209
664
 
210
- /**
211
- * UTC date-time string. Not used in JavaScript.
212
- */
213
- export type Utc = unknown;
665
+ export type AppendType = "random" | { websiteName: { website: string } };
666
+
667
+ export interface UsernameError extends Error {
668
+ name: "UsernameError";
669
+ variant: "InvalidApiKey" | "Unknown" | "ResponseContent" | "Reqwest";
670
+ }
671
+
672
+ export function isUsernameError(error: any): error is UsernameError;
214
673
 
215
674
  /**
216
- * An integer that is known not to equal zero.
675
+ * Password generator request options.
217
676
  */
218
- export type NonZeroU32 = number;
219
-
220
- export class BitwardenClient {
221
- free(): void;
677
+ export interface PasswordGeneratorRequest {
222
678
  /**
223
- * @param {ClientSettings | undefined} [settings]
224
- * @param {LogLevel | undefined} [log_level]
679
+ * Include lowercase characters (a-z).
225
680
  */
226
- constructor(settings?: ClientSettings, log_level?: LogLevel);
681
+ lowercase: boolean;
227
682
  /**
228
- * Test method, echoes back the input
229
- * @param {string} msg
230
- * @returns {string}
683
+ * Include uppercase characters (A-Z).
231
684
  */
232
- echo(msg: string): string;
685
+ uppercase: boolean;
233
686
  /**
234
- * @returns {string}
687
+ * Include numbers (0-9).
235
688
  */
236
- version(): string;
689
+ numbers: boolean;
237
690
  /**
238
- * @param {string} msg
239
- * @returns {Promise<void>}
691
+ * Include special characters: ! @ # $ % ^ & *
240
692
  */
241
- throw(msg: string): Promise<void>;
693
+ special: boolean;
694
+ /**
695
+ * The length of the generated password.
696
+ * Note that the password length must be greater than the sum of all the minimums.
697
+ */
698
+ length: number;
699
+ /**
700
+ * When set to true, the generated password will not contain ambiguous characters.
701
+ * The ambiguous characters are: I, O, l, 0, 1
702
+ */
703
+ avoidAmbiguous: boolean;
704
+ /**
705
+ * The minimum number of lowercase characters in the generated password.
706
+ * When set, the value must be between 1 and 9. This value is ignored if lowercase is false.
707
+ */
708
+ minLowercase: number | undefined;
709
+ /**
710
+ * The minimum number of uppercase characters in the generated password.
711
+ * When set, the value must be between 1 and 9. This value is ignored if uppercase is false.
712
+ */
713
+ minUppercase: number | undefined;
714
+ /**
715
+ * The minimum number of numbers in the generated password.
716
+ * When set, the value must be between 1 and 9. This value is ignored if numbers is false.
717
+ */
718
+ minNumber: number | undefined;
719
+ /**
720
+ * The minimum number of special characters in the generated password.
721
+ * When set, the value must be between 1 and 9. This value is ignored if special is false.
722
+ */
723
+ minSpecial: number | undefined;
724
+ }
725
+
726
+ export interface PasswordError extends Error {
727
+ name: "PasswordError";
728
+ variant: "NoCharacterSetEnabled" | "InvalidLength";
729
+ }
730
+
731
+ export function isPasswordError(error: any): error is PasswordError;
732
+
733
+ /**
734
+ * Passphrase generator request options.
735
+ */
736
+ export interface PassphraseGeneratorRequest {
737
+ /**
738
+ * Number of words in the generated passphrase.
739
+ * This value must be between 3 and 20.
740
+ */
741
+ numWords: number;
742
+ /**
743
+ * Character separator between words in the generated passphrase. The value cannot be empty.
744
+ */
745
+ wordSeparator: string;
746
+ /**
747
+ * When set to true, capitalize the first letter of each word in the generated passphrase.
748
+ */
749
+ capitalize: boolean;
750
+ /**
751
+ * When set to true, include a number at the end of one of the words in the generated
752
+ * passphrase.
753
+ */
754
+ includeNumber: boolean;
755
+ }
756
+
757
+ export interface PassphraseError extends Error {
758
+ name: "PassphraseError";
759
+ variant: "InvalidNumWords";
760
+ }
761
+
762
+ export function isPassphraseError(error: any): error is PassphraseError;
763
+
764
+ export interface DiscoverResponse {
765
+ version: string;
766
+ }
767
+
768
+ export type Endpoint =
769
+ | { Web: { id: number } }
770
+ | "BrowserForeground"
771
+ | "BrowserBackground"
772
+ | "DesktopRenderer"
773
+ | "DesktopMain";
774
+
775
+ export interface IpcCommunicationBackendSender {
776
+ send(message: OutgoingMessage): Promise<void>;
777
+ }
778
+
779
+ export interface ChannelError extends Error {
780
+ name: "ChannelError";
781
+ }
782
+
783
+ export function isChannelError(error: any): error is ChannelError;
784
+
785
+ export interface DeserializeError extends Error {
786
+ name: "DeserializeError";
787
+ }
788
+
789
+ export function isDeserializeError(error: any): error is DeserializeError;
790
+
791
+ export interface RequestError extends Error {
792
+ name: "RequestError";
793
+ variant: "Subscribe" | "Receive" | "Timeout" | "Send" | "RpcError";
794
+ }
795
+
796
+ export function isRequestError(error: any): error is RequestError;
797
+
798
+ export interface TypedReceiveError extends Error {
799
+ name: "TypedReceiveError";
800
+ variant: "Channel" | "Timeout" | "Cancelled" | "Typing";
801
+ }
802
+
803
+ export function isTypedReceiveError(error: any): error is TypedReceiveError;
804
+
805
+ export interface ReceiveError extends Error {
806
+ name: "ReceiveError";
807
+ variant: "Channel" | "Timeout" | "Cancelled";
808
+ }
809
+
810
+ export function isReceiveError(error: any): error is ReceiveError;
811
+
812
+ export interface SubscribeError extends Error {
813
+ name: "SubscribeError";
814
+ variant: "NotStarted";
815
+ }
816
+
817
+ export function isSubscribeError(error: any): error is SubscribeError;
818
+
819
+ export type KeyAlgorithm = "Ed25519" | "Rsa3072" | "Rsa4096";
820
+
821
+ export interface SshKeyExportError extends Error {
822
+ name: "SshKeyExportError";
823
+ variant: "KeyConversionError";
824
+ }
825
+
826
+ export function isSshKeyExportError(error: any): error is SshKeyExportError;
827
+
828
+ export interface SshKeyImportError extends Error {
829
+ name: "SshKeyImportError";
830
+ variant: "ParsingError" | "PasswordRequired" | "WrongPassword" | "UnsupportedKeyType";
831
+ }
832
+
833
+ export function isSshKeyImportError(error: any): error is SshKeyImportError;
834
+
835
+ export interface KeyGenerationError extends Error {
836
+ name: "KeyGenerationError";
837
+ variant: "KeyGenerationError" | "KeyConversionError";
838
+ }
839
+
840
+ export function isKeyGenerationError(error: any): error is KeyGenerationError;
841
+
842
+ export interface CallError extends Error {
843
+ name: "CallError";
844
+ }
845
+
846
+ export function isCallError(error: any): error is CallError;
847
+
848
+ /**
849
+ * NewType wrapper for `CipherId`
850
+ */
851
+ export type CipherId = Tagged<Uuid, "CipherId">;
852
+
853
+ export interface EncryptionContext {
854
+ /**
855
+ * The Id of the user that encrypted the cipher. It should always represent a UserId, even for
856
+ * Organization-owned ciphers
857
+ */
858
+ encryptedFor: UserId;
859
+ cipher: Cipher;
860
+ }
861
+
862
+ export interface Cipher {
863
+ id: CipherId | undefined;
864
+ organizationId: OrganizationId | undefined;
865
+ folderId: FolderId | undefined;
866
+ collectionIds: CollectionId[];
867
+ /**
868
+ * More recent ciphers uses individual encryption keys to encrypt the other fields of the
869
+ * Cipher.
870
+ */
871
+ key: EncString | undefined;
872
+ name: EncString;
873
+ notes: EncString | undefined;
874
+ type: CipherType;
875
+ login: Login | undefined;
876
+ identity: Identity | undefined;
877
+ card: Card | undefined;
878
+ secureNote: SecureNote | undefined;
879
+ sshKey: SshKey | undefined;
880
+ favorite: boolean;
881
+ reprompt: CipherRepromptType;
882
+ organizationUseTotp: boolean;
883
+ edit: boolean;
884
+ permissions: CipherPermissions | undefined;
885
+ viewPassword: boolean;
886
+ localData: LocalData | undefined;
887
+ attachments: Attachment[] | undefined;
888
+ fields: Field[] | undefined;
889
+ passwordHistory: PasswordHistory[] | undefined;
890
+ creationDate: DateTime<Utc>;
891
+ deletedDate: DateTime<Utc> | undefined;
892
+ revisionDate: DateTime<Utc>;
893
+ }
894
+
895
+ export interface CipherView {
896
+ id: CipherId | undefined;
897
+ organizationId: OrganizationId | undefined;
898
+ folderId: FolderId | undefined;
899
+ collectionIds: CollectionId[];
900
+ /**
901
+ * Temporary, required to support re-encrypting existing items.
902
+ */
903
+ key: EncString | undefined;
904
+ name: string;
905
+ notes: string | undefined;
906
+ type: CipherType;
907
+ login: LoginView | undefined;
908
+ identity: IdentityView | undefined;
909
+ card: CardView | undefined;
910
+ secureNote: SecureNoteView | undefined;
911
+ sshKey: SshKeyView | undefined;
912
+ favorite: boolean;
913
+ reprompt: CipherRepromptType;
914
+ organizationUseTotp: boolean;
915
+ edit: boolean;
916
+ permissions: CipherPermissions | undefined;
917
+ viewPassword: boolean;
918
+ localData: LocalDataView | undefined;
919
+ attachments: AttachmentView[] | undefined;
920
+ fields: FieldView[] | undefined;
921
+ passwordHistory: PasswordHistoryView[] | undefined;
922
+ creationDate: DateTime<Utc>;
923
+ deletedDate: DateTime<Utc> | undefined;
924
+ revisionDate: DateTime<Utc>;
925
+ }
926
+
927
+ export type CipherListViewType =
928
+ | { login: LoginListView }
929
+ | "secureNote"
930
+ | { card: CardListView }
931
+ | "identity"
932
+ | "sshKey";
933
+
934
+ /**
935
+ * Available fields on a cipher and can be copied from a the list view in the UI.
936
+ */
937
+ export type CopyableCipherFields =
938
+ | "LoginUsername"
939
+ | "LoginPassword"
940
+ | "LoginTotp"
941
+ | "CardNumber"
942
+ | "CardSecurityCode"
943
+ | "IdentityUsername"
944
+ | "IdentityEmail"
945
+ | "IdentityPhone"
946
+ | "IdentityAddress"
947
+ | "SshKey"
948
+ | "SecureNotes";
949
+
950
+ export interface CipherListView {
951
+ id: CipherId | undefined;
952
+ organizationId: OrganizationId | undefined;
953
+ folderId: FolderId | undefined;
954
+ collectionIds: CollectionId[];
955
+ /**
956
+ * Temporary, required to support calculating TOTP from CipherListView.
957
+ */
958
+ key: EncString | undefined;
959
+ name: string;
960
+ subtitle: string;
961
+ type: CipherListViewType;
962
+ favorite: boolean;
963
+ reprompt: CipherRepromptType;
964
+ organizationUseTotp: boolean;
965
+ edit: boolean;
966
+ permissions: CipherPermissions | undefined;
967
+ viewPassword: boolean;
968
+ /**
969
+ * The number of attachments
970
+ */
971
+ attachments: number;
972
+ /**
973
+ * Indicates if the cipher has old attachments that need to be re-uploaded
974
+ */
975
+ hasOldAttachments: boolean;
976
+ creationDate: DateTime<Utc>;
977
+ deletedDate: DateTime<Utc> | undefined;
978
+ revisionDate: DateTime<Utc>;
979
+ /**
980
+ * Hints for the presentation layer for which fields can be copied.
981
+ */
982
+ copyableFields: CopyableCipherFields[];
983
+ localData: LocalDataView | undefined;
984
+ }
985
+
986
+ /**
987
+ * Represents the result of decrypting a list of ciphers.
988
+ *
989
+ * This struct contains two vectors: `successes` and `failures`.
990
+ * `successes` contains the decrypted `CipherListView` objects,
991
+ * while `failures` contains the original `Cipher` objects that failed to decrypt.
992
+ */
993
+ export interface DecryptCipherListResult {
994
+ /**
995
+ * The decrypted `CipherListView` objects.
996
+ */
997
+ successes: CipherListView[];
998
+ /**
999
+ * The original `Cipher` objects that failed to decrypt.
1000
+ */
1001
+ failures: Cipher[];
1002
+ }
1003
+
1004
+ export interface Field {
1005
+ name: EncString | undefined;
1006
+ value: EncString | undefined;
1007
+ type: FieldType;
1008
+ linkedId: LinkedIdType | undefined;
1009
+ }
1010
+
1011
+ export interface FieldView {
1012
+ name: string | undefined;
1013
+ value: string | undefined;
1014
+ type: FieldType;
1015
+ linkedId: LinkedIdType | undefined;
1016
+ }
1017
+
1018
+ export type LinkedIdType = LoginLinkedIdType | CardLinkedIdType | IdentityLinkedIdType;
1019
+
1020
+ export interface LoginUri {
1021
+ uri: EncString | undefined;
1022
+ match: UriMatchType | undefined;
1023
+ uriChecksum: EncString | undefined;
1024
+ }
1025
+
1026
+ export interface LoginUriView {
1027
+ uri: string | undefined;
1028
+ match: UriMatchType | undefined;
1029
+ uriChecksum: string | undefined;
1030
+ }
1031
+
1032
+ export interface Fido2Credential {
1033
+ credentialId: EncString;
1034
+ keyType: EncString;
1035
+ keyAlgorithm: EncString;
1036
+ keyCurve: EncString;
1037
+ keyValue: EncString;
1038
+ rpId: EncString;
1039
+ userHandle: EncString | undefined;
1040
+ userName: EncString | undefined;
1041
+ counter: EncString;
1042
+ rpName: EncString | undefined;
1043
+ userDisplayName: EncString | undefined;
1044
+ discoverable: EncString;
1045
+ creationDate: DateTime<Utc>;
1046
+ }
1047
+
1048
+ export interface Fido2CredentialListView {
1049
+ credentialId: string;
1050
+ rpId: string;
1051
+ userHandle: string | undefined;
1052
+ userName: string | undefined;
1053
+ userDisplayName: string | undefined;
1054
+ }
1055
+
1056
+ export interface Fido2CredentialView {
1057
+ credentialId: string;
1058
+ keyType: string;
1059
+ keyAlgorithm: string;
1060
+ keyCurve: string;
1061
+ keyValue: EncString;
1062
+ rpId: string;
1063
+ userHandle: string | undefined;
1064
+ userName: string | undefined;
1065
+ counter: string;
1066
+ rpName: string | undefined;
1067
+ userDisplayName: string | undefined;
1068
+ discoverable: string;
1069
+ creationDate: DateTime<Utc>;
1070
+ }
1071
+
1072
+ export interface Fido2CredentialFullView {
1073
+ credentialId: string;
1074
+ keyType: string;
1075
+ keyAlgorithm: string;
1076
+ keyCurve: string;
1077
+ keyValue: string;
1078
+ rpId: string;
1079
+ userHandle: string | undefined;
1080
+ userName: string | undefined;
1081
+ counter: string;
1082
+ rpName: string | undefined;
1083
+ userDisplayName: string | undefined;
1084
+ discoverable: string;
1085
+ creationDate: DateTime<Utc>;
1086
+ }
1087
+
1088
+ export interface Fido2CredentialNewView {
1089
+ credentialId: string;
1090
+ keyType: string;
1091
+ keyAlgorithm: string;
1092
+ keyCurve: string;
1093
+ rpId: string;
1094
+ userHandle: string | undefined;
1095
+ userName: string | undefined;
1096
+ counter: string;
1097
+ rpName: string | undefined;
1098
+ userDisplayName: string | undefined;
1099
+ creationDate: DateTime<Utc>;
1100
+ }
1101
+
1102
+ export interface Login {
1103
+ username: EncString | undefined;
1104
+ password: EncString | undefined;
1105
+ passwordRevisionDate: DateTime<Utc> | undefined;
1106
+ uris: LoginUri[] | undefined;
1107
+ totp: EncString | undefined;
1108
+ autofillOnPageLoad: boolean | undefined;
1109
+ fido2Credentials: Fido2Credential[] | undefined;
1110
+ }
1111
+
1112
+ export interface LoginView {
1113
+ username: string | undefined;
1114
+ password: string | undefined;
1115
+ passwordRevisionDate: DateTime<Utc> | undefined;
1116
+ uris: LoginUriView[] | undefined;
1117
+ totp: string | undefined;
1118
+ autofillOnPageLoad: boolean | undefined;
1119
+ fido2Credentials: Fido2Credential[] | undefined;
1120
+ }
1121
+
1122
+ export interface LoginListView {
1123
+ fido2Credentials: Fido2CredentialListView[] | undefined;
1124
+ hasFido2: boolean;
1125
+ username: string | undefined;
1126
+ /**
1127
+ * The TOTP key is not decrypted. Useable as is with [`crate::generate_totp_cipher_view`].
1128
+ */
1129
+ totp: EncString | undefined;
1130
+ uris: LoginUriView[] | undefined;
1131
+ }
1132
+
1133
+ export interface SecureNote {
1134
+ type: SecureNoteType;
1135
+ }
1136
+
1137
+ export interface SecureNoteView {
1138
+ type: SecureNoteType;
1139
+ }
1140
+
1141
+ /**
1142
+ * Request to add or edit a folder.
1143
+ */
1144
+ export interface FolderAddEditRequest {
1145
+ /**
1146
+ * The new name of the folder.
1147
+ */
1148
+ name: string;
1149
+ }
1150
+
1151
+ /**
1152
+ * NewType wrapper for `FolderId`
1153
+ */
1154
+ export type FolderId = Tagged<Uuid, "FolderId">;
1155
+
1156
+ export interface Folder {
1157
+ id: FolderId | undefined;
1158
+ name: EncString;
1159
+ revisionDate: DateTime<Utc>;
1160
+ }
1161
+
1162
+ export interface FolderView {
1163
+ id: FolderId | undefined;
1164
+ name: string;
1165
+ revisionDate: DateTime<Utc>;
1166
+ }
1167
+
1168
+ export interface DecryptError extends Error {
1169
+ name: "DecryptError";
1170
+ variant: "Crypto" | "VaultLocked";
1171
+ }
1172
+
1173
+ export function isDecryptError(error: any): error is DecryptError;
1174
+
1175
+ export interface EncryptError extends Error {
1176
+ name: "EncryptError";
1177
+ variant: "Crypto" | "VaultLocked" | "MissingUserId";
1178
+ }
1179
+
1180
+ export function isEncryptError(error: any): error is EncryptError;
1181
+
1182
+ export interface TotpResponse {
1183
+ /**
1184
+ * Generated TOTP code
1185
+ */
1186
+ code: string;
1187
+ /**
1188
+ * Time period
1189
+ */
1190
+ period: number;
1191
+ }
1192
+
1193
+ export interface TotpError extends Error {
1194
+ name: "TotpError";
1195
+ variant: "InvalidOtpauth" | "MissingSecret" | "CryptoError" | "VaultLocked";
1196
+ }
1197
+
1198
+ export function isTotpError(error: any): error is TotpError;
1199
+
1200
+ export interface PasswordHistoryView {
1201
+ password: string;
1202
+ lastUsedDate: DateTime<Utc>;
1203
+ }
1204
+
1205
+ export interface PasswordHistory {
1206
+ password: EncString;
1207
+ lastUsedDate: DateTime<Utc>;
1208
+ }
1209
+
1210
+ export interface GetFolderError extends Error {
1211
+ name: "GetFolderError";
1212
+ variant: "ItemNotFound" | "Crypto" | "RepositoryError";
1213
+ }
1214
+
1215
+ export function isGetFolderError(error: any): error is GetFolderError;
1216
+
1217
+ export interface EditFolderError extends Error {
1218
+ name: "EditFolderError";
1219
+ variant:
1220
+ | "ItemNotFound"
1221
+ | "Crypto"
1222
+ | "Api"
1223
+ | "VaultParse"
1224
+ | "MissingField"
1225
+ | "RepositoryError"
1226
+ | "Uuid";
1227
+ }
1228
+
1229
+ export function isEditFolderError(error: any): error is EditFolderError;
1230
+
1231
+ export interface CreateFolderError extends Error {
1232
+ name: "CreateFolderError";
1233
+ variant: "Crypto" | "Api" | "VaultParse" | "MissingField" | "RepositoryError";
1234
+ }
1235
+
1236
+ export function isCreateFolderError(error: any): error is CreateFolderError;
1237
+
1238
+ export interface SshKeyView {
1239
+ /**
1240
+ * SSH private key (ed25519/rsa) in unencrypted openssh private key format [OpenSSH private key](https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key)
1241
+ */
1242
+ privateKey: string;
1243
+ /**
1244
+ * SSH public key (ed25519/rsa) according to [RFC4253](https://datatracker.ietf.org/doc/html/rfc4253#section-6.6)
1245
+ */
1246
+ publicKey: string;
1247
+ /**
1248
+ * SSH fingerprint using SHA256 in the format: `SHA256:BASE64_ENCODED_FINGERPRINT`
1249
+ */
1250
+ fingerprint: string;
1251
+ }
1252
+
1253
+ export interface SshKey {
1254
+ /**
1255
+ * SSH private key (ed25519/rsa) in unencrypted openssh private key format [OpenSSH private key](https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key)
1256
+ */
1257
+ privateKey: EncString;
1258
+ /**
1259
+ * SSH public key (ed25519/rsa) according to [RFC4253](https://datatracker.ietf.org/doc/html/rfc4253#section-6.6)
1260
+ */
1261
+ publicKey: EncString;
1262
+ /**
1263
+ * SSH fingerprint using SHA256 in the format: `SHA256:BASE64_ENCODED_FINGERPRINT`
1264
+ */
1265
+ fingerprint: EncString;
1266
+ }
1267
+
1268
+ export interface LocalDataView {
1269
+ lastUsedDate: DateTime<Utc> | undefined;
1270
+ lastLaunched: DateTime<Utc> | undefined;
1271
+ }
1272
+
1273
+ export interface LocalData {
1274
+ lastUsedDate: DateTime<Utc> | undefined;
1275
+ lastLaunched: DateTime<Utc> | undefined;
1276
+ }
1277
+
1278
+ export interface IdentityView {
1279
+ title: string | undefined;
1280
+ firstName: string | undefined;
1281
+ middleName: string | undefined;
1282
+ lastName: string | undefined;
1283
+ address1: string | undefined;
1284
+ address2: string | undefined;
1285
+ address3: string | undefined;
1286
+ city: string | undefined;
1287
+ state: string | undefined;
1288
+ postalCode: string | undefined;
1289
+ country: string | undefined;
1290
+ company: string | undefined;
1291
+ email: string | undefined;
1292
+ phone: string | undefined;
1293
+ ssn: string | undefined;
1294
+ username: string | undefined;
1295
+ passportNumber: string | undefined;
1296
+ licenseNumber: string | undefined;
1297
+ }
1298
+
1299
+ export interface Identity {
1300
+ title: EncString | undefined;
1301
+ firstName: EncString | undefined;
1302
+ middleName: EncString | undefined;
1303
+ lastName: EncString | undefined;
1304
+ address1: EncString | undefined;
1305
+ address2: EncString | undefined;
1306
+ address3: EncString | undefined;
1307
+ city: EncString | undefined;
1308
+ state: EncString | undefined;
1309
+ postalCode: EncString | undefined;
1310
+ country: EncString | undefined;
1311
+ company: EncString | undefined;
1312
+ email: EncString | undefined;
1313
+ phone: EncString | undefined;
1314
+ ssn: EncString | undefined;
1315
+ username: EncString | undefined;
1316
+ passportNumber: EncString | undefined;
1317
+ licenseNumber: EncString | undefined;
1318
+ }
1319
+
1320
+ export interface CipherPermissions {
1321
+ delete: boolean;
1322
+ restore: boolean;
1323
+ }
1324
+
1325
+ export interface CipherError extends Error {
1326
+ name: "CipherError";
1327
+ variant:
1328
+ | "MissingFieldError"
1329
+ | "VaultLocked"
1330
+ | "CryptoError"
1331
+ | "EncryptError"
1332
+ | "AttachmentsWithoutKeys";
1333
+ }
1334
+
1335
+ export function isCipherError(error: any): error is CipherError;
1336
+
1337
+ /**
1338
+ * Minimal CardView only including the needed details for list views
1339
+ */
1340
+ export interface CardListView {
1341
+ /**
1342
+ * The brand of the card, e.g. Visa, Mastercard, etc.
1343
+ */
1344
+ brand: string | undefined;
1345
+ }
1346
+
1347
+ export interface CardView {
1348
+ cardholderName: string | undefined;
1349
+ expMonth: string | undefined;
1350
+ expYear: string | undefined;
1351
+ code: string | undefined;
1352
+ brand: string | undefined;
1353
+ number: string | undefined;
1354
+ }
1355
+
1356
+ export interface Card {
1357
+ cardholderName: EncString | undefined;
1358
+ expMonth: EncString | undefined;
1359
+ expYear: EncString | undefined;
1360
+ code: EncString | undefined;
1361
+ brand: EncString | undefined;
1362
+ number: EncString | undefined;
1363
+ }
1364
+
1365
+ export interface DecryptFileError extends Error {
1366
+ name: "DecryptFileError";
1367
+ variant: "Decrypt" | "Io";
1368
+ }
1369
+
1370
+ export function isDecryptFileError(error: any): error is DecryptFileError;
1371
+
1372
+ export interface EncryptFileError extends Error {
1373
+ name: "EncryptFileError";
1374
+ variant: "Encrypt" | "Io";
1375
+ }
1376
+
1377
+ export function isEncryptFileError(error: any): error is EncryptFileError;
1378
+
1379
+ export interface AttachmentView {
1380
+ id: string | undefined;
1381
+ url: string | undefined;
1382
+ size: string | undefined;
1383
+ sizeName: string | undefined;
1384
+ fileName: string | undefined;
1385
+ key: EncString | undefined;
1386
+ /**
1387
+ * The decrypted attachmentkey in base64 format.
1388
+ *
1389
+ * **TEMPORARY FIELD**: This field is a temporary workaround to provide
1390
+ * decrypted attachment keys to the TypeScript client during the migration
1391
+ * process. It will be removed once the encryption/decryption logic is
1392
+ * fully migrated to the SDK.
1393
+ *
1394
+ * **Ticket**: <https://bitwarden.atlassian.net/browse/PM-23005>
1395
+ *
1396
+ * Do not rely on this field for long-term use.
1397
+ */
1398
+ decryptedKey: string | undefined;
1399
+ }
1400
+
1401
+ export interface Attachment {
1402
+ id: string | undefined;
1403
+ url: string | undefined;
1404
+ size: string | undefined;
1405
+ /**
1406
+ * Readable size, ex: \"4.2 KB\" or \"1.43 GB\
1407
+ */
1408
+ sizeName: string | undefined;
1409
+ fileName: EncString | undefined;
1410
+ key: EncString | undefined;
1411
+ }
1412
+
1413
+ export class AttachmentsClient {
1414
+ private constructor();
1415
+ free(): void;
1416
+ decrypt_buffer(
1417
+ cipher: Cipher,
1418
+ attachment: AttachmentView,
1419
+ encrypted_buffer: Uint8Array,
1420
+ ): Uint8Array;
1421
+ }
1422
+ /**
1423
+ * Subclient containing auth functionality.
1424
+ */
1425
+ export class AuthClient {
1426
+ private constructor();
1427
+ free(): void;
1428
+ /**
1429
+ * Client for send access functionality
1430
+ */
1431
+ send_access(): SendAccessClient;
1432
+ }
1433
+ export class BitwardenClient {
1434
+ free(): void;
1435
+ constructor(token_provider: any, settings?: ClientSettings | null);
1436
+ /**
1437
+ * Test method, echoes back the input
1438
+ */
1439
+ echo(msg: string): string;
1440
+ version(): string;
1441
+ throw(msg: string): void;
242
1442
  /**
243
1443
  * Test method, calls http endpoint
244
- * @param {string} url
245
- * @returns {Promise<string>}
246
1444
  */
247
1445
  http_get(url: string): Promise<string>;
248
1446
  /**
249
- * @returns {ClientCrypto}
1447
+ * Auth related operations.
250
1448
  */
251
- crypto(): ClientCrypto;
1449
+ auth(): AuthClient;
1450
+ crypto(): CryptoClient;
1451
+ vault(): VaultClient;
252
1452
  /**
253
- * @returns {ClientVault}
1453
+ * Constructs a specific client for platform-specific functionality
254
1454
  */
255
- vault(): ClientVault;
1455
+ platform(): PlatformClient;
1456
+ /**
1457
+ * Constructs a specific client for generating passwords and passphrases
1458
+ */
1459
+ generator(): GeneratorClient;
1460
+ exporters(): ExporterClient;
256
1461
  }
257
- export class ClientCrypto {
1462
+ export class CiphersClient {
1463
+ private constructor();
1464
+ free(): void;
1465
+ encrypt(cipher_view: CipherView): EncryptionContext;
1466
+ /**
1467
+ * Encrypt a cipher with the provided key. This should only be used when rotating encryption
1468
+ * keys in the Web client.
1469
+ *
1470
+ * Until key rotation is fully implemented in the SDK, this method must be provided the new
1471
+ * symmetric key in base64 format. See PM-23084
1472
+ *
1473
+ * If the cipher has a CipherKey, it will be re-encrypted with the new key.
1474
+ * If the cipher does not have a CipherKey and CipherKeyEncryption is enabled, one will be
1475
+ * generated using the new key. Otherwise, the cipher's data will be encrypted with the new
1476
+ * key directly.
1477
+ */
1478
+ encrypt_cipher_for_rotation(cipher_view: CipherView, new_key: B64): EncryptionContext;
1479
+ decrypt(cipher: Cipher): CipherView;
1480
+ decrypt_list(ciphers: Cipher[]): CipherListView[];
1481
+ /**
1482
+ * Decrypt cipher list with failures
1483
+ * Returns both successfully decrypted ciphers and any that failed to decrypt
1484
+ */
1485
+ decrypt_list_with_failures(ciphers: Cipher[]): DecryptCipherListResult;
1486
+ decrypt_fido2_credentials(cipher_view: CipherView): Fido2CredentialView[];
1487
+ /**
1488
+ * Temporary method used to re-encrypt FIDO2 credentials for a cipher view.
1489
+ * Necessary until the TS clients utilize the SDK entirely for FIDO2 credentials management.
1490
+ * TS clients create decrypted FIDO2 credentials that need to be encrypted manually when
1491
+ * encrypting the rest of the CipherView.
1492
+ * TODO: Remove once TS passkey provider implementation uses SDK - PM-8313
1493
+ */
1494
+ set_fido2_credentials(
1495
+ cipher_view: CipherView,
1496
+ fido2_credentials: Fido2CredentialFullView[],
1497
+ ): CipherView;
1498
+ move_to_organization(cipher_view: CipherView, organization_id: OrganizationId): CipherView;
1499
+ decrypt_fido2_private_key(cipher_view: CipherView): string;
1500
+ }
1501
+ export class CollectionViewNodeItem {
1502
+ private constructor();
1503
+ free(): void;
1504
+ get_item(): CollectionView;
1505
+ get_parent(): CollectionView | undefined;
1506
+ get_children(): CollectionView[];
1507
+ get_ancestors(): Map<any, any>;
1508
+ }
1509
+ export class CollectionViewTree {
1510
+ private constructor();
1511
+ free(): void;
1512
+ get_item_by_id(collection_view: CollectionView): CollectionViewNodeItem | undefined;
1513
+ get_root_items(): CollectionViewNodeItem[];
1514
+ get_flat_items(): CollectionViewNodeItem[];
1515
+ }
1516
+ export class CollectionsClient {
1517
+ private constructor();
1518
+ free(): void;
1519
+ decrypt(collection: Collection): CollectionView;
1520
+ decrypt_list(collections: Collection[]): CollectionView[];
1521
+ /**
1522
+ *
1523
+ * Returns the vector of CollectionView objects in a tree structure based on its implemented
1524
+ * path().
1525
+ */
1526
+ get_collection_tree(collections: CollectionView[]): CollectionViewTree;
1527
+ }
1528
+ /**
1529
+ * A client for the crypto operations.
1530
+ */
1531
+ export class CryptoClient {
1532
+ private constructor();
258
1533
  free(): void;
259
1534
  /**
260
1535
  * Initialization method for the user crypto. Needs to be called before any other crypto
261
1536
  * operations.
262
- * @param {InitUserCryptoRequest} req
263
- * @returns {Promise<void>}
264
1537
  */
265
1538
  initialize_user_crypto(req: InitUserCryptoRequest): Promise<void>;
266
1539
  /**
267
1540
  * Initialization method for the organization crypto. Needs to be called after
268
1541
  * `initialize_user_crypto` but before any other crypto operations.
269
- * @param {InitOrgCryptoRequest} req
270
- * @returns {Promise<void>}
271
1542
  */
272
1543
  initialize_org_crypto(req: InitOrgCryptoRequest): Promise<void>;
1544
+ /**
1545
+ * Generates a new key pair and encrypts the private key with the provided user key.
1546
+ * Crypto initialization not required.
1547
+ */
1548
+ make_key_pair(user_key: B64): MakeKeyPairResponse;
1549
+ /**
1550
+ * Verifies a user's asymmetric keys by decrypting the private key with the provided user
1551
+ * key. Returns if the private key is decryptable and if it is a valid matching key.
1552
+ * Crypto initialization not required.
1553
+ */
1554
+ verify_asymmetric_keys(request: VerifyAsymmetricKeysRequest): VerifyAsymmetricKeysResponse;
1555
+ /**
1556
+ * Makes a new signing key pair and signs the public key for the user
1557
+ */
1558
+ make_keys_for_user_crypto_v2(): UserCryptoV2KeysResponse;
1559
+ /**
1560
+ * Creates a rotated set of account keys for the current state
1561
+ */
1562
+ get_v2_rotated_account_keys(): UserCryptoV2KeysResponse;
1563
+ /**
1564
+ * Protects the current user key with the provided PIN. The result can be stored and later
1565
+ * used to initialize another client instance by using the PIN and the PIN key with
1566
+ * `initialize_user_crypto`.
1567
+ */
1568
+ enroll_pin(pin: string): EnrollPinResponse;
1569
+ /**
1570
+ * Protects the current user key with the provided PIN. The result can be stored and later
1571
+ * used to initialize another client instance by using the PIN and the PIN key with
1572
+ * `initialize_user_crypto`. The provided pin is encrypted with the user key.
1573
+ */
1574
+ enroll_pin_with_encrypted_pin(encrypted_pin: string): EnrollPinResponse;
1575
+ /**
1576
+ * Decrypts a `PasswordProtectedKeyEnvelope`, returning the user key, if successful.
1577
+ * This is a stop-gap solution, until initialization of the SDK is used.
1578
+ */
1579
+ unseal_password_protected_key_envelope(
1580
+ pin: string,
1581
+ envelope: PasswordProtectedKeyEnvelope,
1582
+ ): Uint8Array;
273
1583
  }
274
- export class ClientFolders {
1584
+ export class ExporterClient {
1585
+ private constructor();
275
1586
  free(): void;
1587
+ export_vault(folders: Folder[], ciphers: Cipher[], format: ExportFormat): string;
1588
+ export_organization_vault(
1589
+ collections: Collection[],
1590
+ ciphers: Cipher[],
1591
+ format: ExportFormat,
1592
+ ): string;
1593
+ /**
1594
+ * Credential Exchange Format (CXF)
1595
+ *
1596
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
1597
+ *
1598
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
1599
+ * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
1600
+ */
1601
+ export_cxf(account: Account, ciphers: Cipher[]): string;
276
1602
  /**
277
- * Decrypt folder
278
- * @param {Folder} folder
279
- * @returns {FolderView}
1603
+ * Credential Exchange Format (CXF)
1604
+ *
1605
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
1606
+ *
1607
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
1608
+ * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
1609
+ */
1610
+ import_cxf(payload: string): Cipher[];
1611
+ }
1612
+ /**
1613
+ * Wrapper for folder specific functionality.
1614
+ */
1615
+ export class FoldersClient {
1616
+ private constructor();
1617
+ free(): void;
1618
+ /**
1619
+ * Encrypt a [FolderView] to a [Folder].
1620
+ */
1621
+ encrypt(folder_view: FolderView): Folder;
1622
+ /**
1623
+ * Encrypt a [Folder] to [FolderView].
280
1624
  */
281
1625
  decrypt(folder: Folder): FolderView;
1626
+ /**
1627
+ * Decrypt a list of [Folder]s to a list of [FolderView]s.
1628
+ */
1629
+ decrypt_list(folders: Folder[]): FolderView[];
1630
+ /**
1631
+ * Get all folders from state and decrypt them to a list of [FolderView].
1632
+ */
1633
+ list(): Promise<FolderView[]>;
1634
+ /**
1635
+ * Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
1636
+ */
1637
+ get(folder_id: string): Promise<FolderView>;
1638
+ /**
1639
+ * Create a new [Folder] and save it to the server.
1640
+ */
1641
+ create(request: FolderAddEditRequest): Promise<FolderView>;
1642
+ /**
1643
+ * Edit the [Folder] and save it to the server.
1644
+ */
1645
+ edit(folder_id: string, request: FolderAddEditRequest): Promise<FolderView>;
1646
+ }
1647
+ export class GeneratorClient {
1648
+ private constructor();
1649
+ free(): void;
1650
+ /**
1651
+ * Generates a random password.
1652
+ *
1653
+ * The character sets and password length can be customized using the `input` parameter.
1654
+ *
1655
+ * # Examples
1656
+ *
1657
+ * ```
1658
+ * use bitwarden_core::Client;
1659
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
1660
+ *
1661
+ * async fn test() -> Result<(), PassphraseError> {
1662
+ * let input = PasswordGeneratorRequest {
1663
+ * lowercase: true,
1664
+ * uppercase: true,
1665
+ * numbers: true,
1666
+ * length: 20,
1667
+ * ..Default::default()
1668
+ * };
1669
+ * let password = Client::new(None).generator().password(input).unwrap();
1670
+ * println!("{}", password);
1671
+ * Ok(())
1672
+ * }
1673
+ * ```
1674
+ */
1675
+ password(input: PasswordGeneratorRequest): string;
1676
+ /**
1677
+ * Generates a random passphrase.
1678
+ * A passphrase is a combination of random words separated by a character.
1679
+ * An example of passphrase is `correct horse battery staple`.
1680
+ *
1681
+ * The number of words and their case, the word separator, and the inclusion of
1682
+ * a number in the passphrase can be customized using the `input` parameter.
1683
+ *
1684
+ * # Examples
1685
+ *
1686
+ * ```
1687
+ * use bitwarden_core::Client;
1688
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
1689
+ *
1690
+ * async fn test() -> Result<(), PassphraseError> {
1691
+ * let input = PassphraseGeneratorRequest {
1692
+ * num_words: 4,
1693
+ * ..Default::default()
1694
+ * };
1695
+ * let passphrase = Client::new(None).generator().passphrase(input).unwrap();
1696
+ * println!("{}", passphrase);
1697
+ * Ok(())
1698
+ * }
1699
+ * ```
1700
+ */
1701
+ passphrase(input: PassphraseGeneratorRequest): string;
1702
+ }
1703
+ export class IncomingMessage {
1704
+ free(): void;
1705
+ constructor(payload: Uint8Array, destination: Endpoint, source: Endpoint, topic?: string | null);
1706
+ /**
1707
+ * Try to parse the payload as JSON.
1708
+ * @returns The parsed JSON value, or undefined if the payload is not valid JSON.
1709
+ */
1710
+ parse_payload_as_json(): any;
1711
+ payload: Uint8Array;
1712
+ destination: Endpoint;
1713
+ source: Endpoint;
1714
+ get topic(): string | undefined;
1715
+ set topic(value: string | null | undefined);
1716
+ }
1717
+ /**
1718
+ * JavaScript wrapper around the IPC client. For more information, see the
1719
+ * [IpcClient] documentation.
1720
+ */
1721
+ export class IpcClient {
1722
+ free(): void;
1723
+ constructor(communication_provider: IpcCommunicationBackend);
1724
+ start(): Promise<void>;
1725
+ isRunning(): Promise<boolean>;
1726
+ send(message: OutgoingMessage): Promise<void>;
1727
+ subscribe(): Promise<IpcClientSubscription>;
1728
+ }
1729
+ /**
1730
+ * JavaScript wrapper around the IPC client subscription. For more information, see the
1731
+ * [IpcClientSubscription](crate::IpcClientSubscription) documentation.
1732
+ */
1733
+ export class IpcClientSubscription {
1734
+ private constructor();
1735
+ free(): void;
1736
+ receive(abort_signal?: AbortSignal | null): Promise<IncomingMessage>;
1737
+ }
1738
+ /**
1739
+ * JavaScript implementation of the `CommunicationBackend` trait for IPC communication.
1740
+ */
1741
+ export class IpcCommunicationBackend {
1742
+ free(): void;
1743
+ /**
1744
+ * Creates a new instance of the JavaScript communication backend.
1745
+ */
1746
+ constructor(sender: IpcCommunicationBackendSender);
1747
+ /**
1748
+ * Used by JavaScript to provide an incoming message to the IPC framework.
1749
+ */
1750
+ receive(message: IncomingMessage): void;
1751
+ }
1752
+ export class OutgoingMessage {
1753
+ free(): void;
1754
+ constructor(payload: Uint8Array, destination: Endpoint, topic?: string | null);
1755
+ /**
1756
+ * Create a new message and encode the payload as JSON.
1757
+ */
1758
+ static new_json_payload(
1759
+ payload: any,
1760
+ destination: Endpoint,
1761
+ topic?: string | null,
1762
+ ): OutgoingMessage;
1763
+ payload: Uint8Array;
1764
+ destination: Endpoint;
1765
+ get topic(): string | undefined;
1766
+ set topic(value: string | null | undefined);
1767
+ }
1768
+ export class PlatformClient {
1769
+ private constructor();
1770
+ free(): void;
1771
+ state(): StateClient;
1772
+ /**
1773
+ * Load feature flags into the client
1774
+ */
1775
+ load_flags(flags: FeatureFlags): void;
1776
+ }
1777
+ /**
1778
+ * This module represents a stopgap solution to provide access to primitive crypto functions for JS
1779
+ * clients. It is not intended to be used outside of the JS clients and this pattern should not be
1780
+ * proliferated. It is necessary because we want to use SDK crypto prior to the SDK being fully
1781
+ * responsible for state and keys.
1782
+ */
1783
+ export class PureCrypto {
1784
+ private constructor();
1785
+ free(): void;
1786
+ /**
1787
+ * DEPRECATED: Use `symmetric_decrypt_string` instead.
1788
+ * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
1789
+ */
1790
+ static symmetric_decrypt(enc_string: string, key: Uint8Array): string;
1791
+ static symmetric_decrypt_string(enc_string: string, key: Uint8Array): string;
1792
+ static symmetric_decrypt_bytes(enc_string: string, key: Uint8Array): Uint8Array;
1793
+ /**
1794
+ * DEPRECATED: Use `symmetric_decrypt_filedata` instead.
1795
+ * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
1796
+ */
1797
+ static symmetric_decrypt_array_buffer(enc_bytes: Uint8Array, key: Uint8Array): Uint8Array;
1798
+ static symmetric_decrypt_filedata(enc_bytes: Uint8Array, key: Uint8Array): Uint8Array;
1799
+ static symmetric_encrypt_string(plain: string, key: Uint8Array): string;
1800
+ /**
1801
+ * DEPRECATED: Only used by send keys
1802
+ */
1803
+ static symmetric_encrypt_bytes(plain: Uint8Array, key: Uint8Array): string;
1804
+ static symmetric_encrypt_filedata(plain: Uint8Array, key: Uint8Array): Uint8Array;
1805
+ static decrypt_user_key_with_master_password(
1806
+ encrypted_user_key: string,
1807
+ master_password: string,
1808
+ email: string,
1809
+ kdf: Kdf,
1810
+ ): Uint8Array;
1811
+ static encrypt_user_key_with_master_password(
1812
+ user_key: Uint8Array,
1813
+ master_password: string,
1814
+ email: string,
1815
+ kdf: Kdf,
1816
+ ): string;
1817
+ static make_user_key_aes256_cbc_hmac(): Uint8Array;
1818
+ static make_user_key_xchacha20_poly1305(): Uint8Array;
1819
+ /**
1820
+ * Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
1821
+ * as an EncString.
1822
+ */
1823
+ static wrap_symmetric_key(key_to_be_wrapped: Uint8Array, wrapping_key: Uint8Array): string;
1824
+ /**
1825
+ * Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
1826
+ * unwrapped key as a serialized byte array.
1827
+ */
1828
+ static unwrap_symmetric_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
1829
+ /**
1830
+ * Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
1831
+ * key. Note: Usually, a public key is - by definition - public, so this should not be
1832
+ * used. The specific use-case for this function is to enable rotateable key sets, where
1833
+ * the "public key" is not public, with the intent of preventing the server from being able
1834
+ * to overwrite the user key unlocked by the rotateable keyset.
1835
+ */
1836
+ static wrap_encapsulation_key(encapsulation_key: Uint8Array, wrapping_key: Uint8Array): string;
1837
+ /**
1838
+ * Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
1839
+ * wrapping key.
1840
+ */
1841
+ static unwrap_encapsulation_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
1842
+ /**
1843
+ * Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
1844
+ * key,
1845
+ */
1846
+ static wrap_decapsulation_key(decapsulation_key: Uint8Array, wrapping_key: Uint8Array): string;
1847
+ /**
1848
+ * Unwraps (decrypts) a wrapped PKCS8 DER encoded decapsulation (private) key using a symmetric
1849
+ * wrapping key.
1850
+ */
1851
+ static unwrap_decapsulation_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
1852
+ /**
1853
+ * Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
1854
+ * in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
1855
+ * the sender's authenticity cannot be verified by the recipient.
1856
+ */
1857
+ static encapsulate_key_unsigned(shared_key: Uint8Array, encapsulation_key: Uint8Array): string;
1858
+ /**
1859
+ * Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
1860
+ * DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
1861
+ * recipient.
1862
+ */
1863
+ static decapsulate_key_unsigned(
1864
+ encapsulated_key: string,
1865
+ decapsulation_key: Uint8Array,
1866
+ ): Uint8Array;
1867
+ /**
1868
+ * Given a wrapped signing key and the symmetric key it is wrapped with, this returns
1869
+ * the corresponding verifying key.
1870
+ */
1871
+ static verifying_key_for_signing_key(signing_key: string, wrapping_key: Uint8Array): Uint8Array;
1872
+ /**
1873
+ * Returns the algorithm used for the given verifying key.
1874
+ */
1875
+ static key_algorithm_for_verifying_key(verifying_key: Uint8Array): SignatureAlgorithm;
1876
+ /**
1877
+ * For a given signing identity (verifying key), this function verifies that the signing
1878
+ * identity claimed ownership of the public key. This is a one-sided claim and merely shows
1879
+ * that the signing identity has the intent to receive messages encrypted to the public
1880
+ * key.
1881
+ */
1882
+ static verify_and_unwrap_signed_public_key(
1883
+ signed_public_key: Uint8Array,
1884
+ verifying_key: Uint8Array,
1885
+ ): Uint8Array;
1886
+ /**
1887
+ * Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
1888
+ */
1889
+ static derive_kdf_material(password: Uint8Array, salt: Uint8Array, kdf: Kdf): Uint8Array;
1890
+ }
1891
+ export class SendAccessClient {
1892
+ private constructor();
1893
+ free(): void;
1894
+ /**
1895
+ * Request an access token for the provided send
1896
+ */
1897
+ request_send_access_token(request: string): Promise<string>;
1898
+ }
1899
+ export class StateClient {
1900
+ private constructor();
1901
+ free(): void;
1902
+ register_cipher_repository(store: Repository<Cipher>): void;
1903
+ register_folder_repository(store: Repository<Folder>): void;
282
1904
  }
283
- export class ClientVault {
1905
+ export class TotpClient {
1906
+ private constructor();
284
1907
  free(): void;
285
1908
  /**
286
- * @returns {ClientFolders}
1909
+ * Generates a TOTP code from a provided key
1910
+ *
1911
+ * # Arguments
1912
+ * - `key` - Can be:
1913
+ * - A base32 encoded string
1914
+ * - OTP Auth URI
1915
+ * - Steam URI
1916
+ * - `time_ms` - Optional timestamp in milliseconds
1917
+ */
1918
+ generate_totp(key: string, time_ms?: number | null): TotpResponse;
1919
+ }
1920
+ export class VaultClient {
1921
+ private constructor();
1922
+ free(): void;
1923
+ /**
1924
+ * Attachment related operations.
1925
+ */
1926
+ attachments(): AttachmentsClient;
1927
+ /**
1928
+ * Cipher related operations.
1929
+ */
1930
+ ciphers(): CiphersClient;
1931
+ /**
1932
+ * Folder related operations.
1933
+ */
1934
+ folders(): FoldersClient;
1935
+ /**
1936
+ * TOTP related operations.
1937
+ */
1938
+ totp(): TotpClient;
1939
+ /**
1940
+ * Collection related operations.
287
1941
  */
288
- folders(): ClientFolders;
1942
+ collections(): CollectionsClient;
289
1943
  }