@bitwarden/sdk-internal 0.2.0-main.19 → 0.2.0-main.191

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,80 @@
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
6
30
  */
7
- export function generate_ssh_key(key_algorithm: KeyAlgorithm): GenerateSshKeyResult;
31
+ export function import_ssh_key(imported_key: string, password?: string | null): SshKeyView;
32
+ export enum CardLinkedIdType {
33
+ CardholderName = 300,
34
+ ExpMonth = 301,
35
+ ExpYear = 302,
36
+ Code = 303,
37
+ Brand = 304,
38
+ Number = 305,
39
+ }
40
+ export enum CipherRepromptType {
41
+ None = 0,
42
+ Password = 1,
43
+ }
44
+ export enum CipherType {
45
+ Login = 1,
46
+ SecureNote = 2,
47
+ Card = 3,
48
+ Identity = 4,
49
+ SshKey = 5,
50
+ }
51
+ export enum FieldType {
52
+ Text = 0,
53
+ Hidden = 1,
54
+ Boolean = 2,
55
+ Linked = 3,
56
+ }
57
+ export enum IdentityLinkedIdType {
58
+ Title = 400,
59
+ MiddleName = 401,
60
+ Address1 = 402,
61
+ Address2 = 403,
62
+ Address3 = 404,
63
+ City = 405,
64
+ State = 406,
65
+ PostalCode = 407,
66
+ Country = 408,
67
+ Company = 409,
68
+ Email = 410,
69
+ Phone = 411,
70
+ Ssn = 412,
71
+ Username = 413,
72
+ PassportNumber = 414,
73
+ LicenseNumber = 415,
74
+ FirstName = 416,
75
+ LastName = 417,
76
+ FullName = 418,
77
+ }
8
78
  export enum LogLevel {
9
79
  Trace = 0,
10
80
  Debug = 1,
@@ -12,7 +82,29 @@ export enum LogLevel {
12
82
  Warn = 3,
13
83
  Error = 4,
14
84
  }
85
+ export enum LoginLinkedIdType {
86
+ Username = 100,
87
+ Password = 101,
88
+ }
89
+ export enum SecureNoteType {
90
+ Generic = 0,
91
+ }
92
+ export enum UriMatchType {
93
+ Domain = 0,
94
+ Host = 1,
95
+ StartsWith = 2,
96
+ Exact = 3,
97
+ RegularExpression = 4,
98
+ Never = 5,
99
+ }
100
+ /**
101
+ * State used for initializing the user cryptographic state.
102
+ */
15
103
  export interface InitUserCryptoRequest {
104
+ /**
105
+ * The user\'s ID.
106
+ */
107
+ userId: Uuid | undefined;
16
108
  /**
17
109
  * The user\'s KDF parameters, as received from the prelogin request
18
110
  */
@@ -24,15 +116,18 @@ export interface InitUserCryptoRequest {
24
116
  /**
25
117
  * The user\'s encrypted private key
26
118
  */
27
- privateKey: string;
119
+ privateKey: EncString;
28
120
  /**
29
121
  * The initialization method to use
30
122
  */
31
123
  method: InitUserCryptoMethod;
32
124
  }
33
125
 
126
+ /**
127
+ * The crypto method used to initialize the user cryptographic state.
128
+ */
34
129
  export type InitUserCryptoMethod =
35
- | { password: { password: string; user_key: string } }
130
+ | { password: { password: string; user_key: EncString } }
36
131
  | { decryptedKey: { decrypted_user_key: string } }
37
132
  | { pin: { pin: string; pin_protected_user_key: EncString } }
38
133
  | { authRequest: { request_private_key: string; method: AuthRequestMethod } }
@@ -40,50 +135,88 @@ export type InitUserCryptoMethod =
40
135
  deviceKey: {
41
136
  device_key: string;
42
137
  protected_device_private_key: EncString;
43
- device_protected_user_key: AsymmetricEncString;
138
+ device_protected_user_key: UnsignedSharedKey;
44
139
  };
45
140
  }
46
- | { keyConnector: { master_key: string; user_key: string } };
141
+ | { keyConnector: { master_key: string; user_key: EncString } };
47
142
 
143
+ /**
144
+ * Auth requests supports multiple initialization methods.
145
+ */
48
146
  export type AuthRequestMethod =
49
- | { userKey: { protected_user_key: AsymmetricEncString } }
50
- | { masterKey: { protected_master_key: AsymmetricEncString; auth_request_key: EncString } };
147
+ | { userKey: { protected_user_key: UnsignedSharedKey } }
148
+ | { masterKey: { protected_master_key: UnsignedSharedKey; auth_request_key: EncString } };
51
149
 
150
+ /**
151
+ * Represents the request to initialize the user\'s organizational cryptographic state.
152
+ */
52
153
  export interface InitOrgCryptoRequest {
53
154
  /**
54
155
  * The encryption keys for all the organizations the user is a part of
55
156
  */
56
- organizationKeys: Map<Uuid, AsymmetricEncString>;
157
+ organizationKeys: Map<Uuid, UnsignedSharedKey>;
57
158
  }
58
159
 
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";
160
+ /**
161
+ * Response from the `make_key_pair` function
162
+ */
163
+ export interface MakeKeyPairResponse {
164
+ /**
165
+ * The user\'s public key
166
+ */
167
+ userPublicKey: string;
168
+ /**
169
+ * User\'s private key, encrypted with the user key
170
+ */
171
+ userKeyEncryptedPrivateKey: EncString;
80
172
  }
81
173
 
82
- export function isCoreError(error: any): error is CoreError;
174
+ /**
175
+ * Request for `verify_asymmetric_keys`.
176
+ */
177
+ export interface VerifyAsymmetricKeysRequest {
178
+ /**
179
+ * The user\'s user key
180
+ */
181
+ userKey: string;
182
+ /**
183
+ * The user\'s public key
184
+ */
185
+ userPublicKey: string;
186
+ /**
187
+ * User\'s private key, encrypted with the user key
188
+ */
189
+ userKeyEncryptedPrivateKey: EncString;
190
+ }
191
+
192
+ /**
193
+ * Response for `verify_asymmetric_keys`.
194
+ */
195
+ export interface VerifyAsymmetricKeysResponse {
196
+ /**
197
+ * Whether the user\'s private key was decryptable by the user key.
198
+ */
199
+ privateKeyDecryptable: boolean;
200
+ /**
201
+ * Whether the user\'s private key was a valid RSA key and matched the public key provided.
202
+ */
203
+ validPrivateKey: boolean;
204
+ }
205
+
206
+ /**
207
+ * NewType wrapper for `OrganizationId`
208
+ */
209
+ export type OrganizationId = Tagged<Uuid, "OrganizationId">;
83
210
 
84
211
  export interface EncryptionSettingsError extends Error {
85
212
  name: "EncryptionSettingsError";
86
- variant: "Crypto" | "InvalidBase64" | "VaultLocked" | "InvalidPrivateKey" | "MissingPrivateKey";
213
+ variant:
214
+ | "Crypto"
215
+ | "InvalidBase64"
216
+ | "VaultLocked"
217
+ | "InvalidPrivateKey"
218
+ | "MissingPrivateKey"
219
+ | "UserIdAlreadySetError";
87
220
  }
88
221
 
89
222
  export function isEncryptionSettingsError(error: any): error is EncryptionSettingsError;
@@ -152,7 +285,7 @@ export interface ClientSettings {
152
285
  deviceType?: DeviceType;
153
286
  }
154
287
 
155
- export type AsymmetricEncString = string;
288
+ export type UnsignedSharedKey = string;
156
289
 
157
290
  export type EncString = string;
158
291
 
@@ -166,14 +299,218 @@ export type Kdf =
166
299
  | { pBKDF2: { iterations: NonZeroU32 } }
167
300
  | { argon2id: { iterations: NonZeroU32; memory: NonZeroU32; parallelism: NonZeroU32 } };
168
301
 
169
- export interface GenerateSshKeyResult {
170
- private_key: string;
171
- public_key: string;
172
- key_fingerprint: string;
302
+ export interface CryptoError extends Error {
303
+ name: "CryptoError";
304
+ variant:
305
+ | "InvalidKey"
306
+ | "InvalidMac"
307
+ | "MacNotProvided"
308
+ | "KeyDecrypt"
309
+ | "InvalidKeyLen"
310
+ | "InvalidUtf8String"
311
+ | "MissingKey"
312
+ | "MissingField"
313
+ | "MissingKeyId"
314
+ | "ReadOnlyKeyStore"
315
+ | "InsufficientKdfParameters"
316
+ | "EncString"
317
+ | "RsaError"
318
+ | "FingerprintError"
319
+ | "ArgonError"
320
+ | "ZeroNumber"
321
+ | "OperationNotSupported"
322
+ | "WrongKeyType"
323
+ | "InvalidNonceLength";
324
+ }
325
+
326
+ export function isCryptoError(error: any): error is CryptoError;
327
+
328
+ /**
329
+ * Temporary struct to hold metadata related to current account
330
+ *
331
+ * Eventually the SDK itself should have this state and we get rid of this struct.
332
+ */
333
+ export interface Account {
334
+ id: Uuid;
335
+ email: string;
336
+ name: string | undefined;
337
+ }
338
+
339
+ export type ExportFormat = "Csv" | "Json" | { EncryptedJson: { password: string } };
340
+
341
+ export interface ExportError extends Error {
342
+ name: "ExportError";
343
+ variant:
344
+ | "MissingField"
345
+ | "NotAuthenticated"
346
+ | "VaultLocked"
347
+ | "Csv"
348
+ | "CxfError"
349
+ | "Json"
350
+ | "EncryptedJsonError"
351
+ | "BitwardenCryptoError"
352
+ | "CipherError";
353
+ }
354
+
355
+ export function isExportError(error: any): error is ExportError;
356
+
357
+ export type UsernameGeneratorRequest =
358
+ | { word: { capitalize: boolean; include_number: boolean } }
359
+ | { subaddress: { type: AppendType; email: string } }
360
+ | { catchall: { type: AppendType; domain: string } }
361
+ | { forwarded: { service: ForwarderServiceType; website: string | undefined } };
362
+
363
+ /**
364
+ * Configures the email forwarding service to use.
365
+ * For instructions on how to configure each service, see the documentation:
366
+ * <https://bitwarden.com/help/generator/#username-types>
367
+ */
368
+ export type ForwarderServiceType =
369
+ | { addyIo: { api_token: string; domain: string; base_url: string } }
370
+ | { duckDuckGo: { token: string } }
371
+ | { firefox: { api_token: string } }
372
+ | { fastmail: { api_token: string } }
373
+ | { forwardEmail: { api_token: string; domain: string } }
374
+ | { simpleLogin: { api_key: string; base_url: string } };
375
+
376
+ export type AppendType = "random" | { websiteName: { website: string } };
377
+
378
+ export interface UsernameError extends Error {
379
+ name: "UsernameError";
380
+ variant: "InvalidApiKey" | "Unknown" | "ResponseContent" | "Reqwest";
381
+ }
382
+
383
+ export function isUsernameError(error: any): error is UsernameError;
384
+
385
+ /**
386
+ * Password generator request options.
387
+ */
388
+ export interface PasswordGeneratorRequest {
389
+ /**
390
+ * Include lowercase characters (a-z).
391
+ */
392
+ lowercase: boolean;
393
+ /**
394
+ * Include uppercase characters (A-Z).
395
+ */
396
+ uppercase: boolean;
397
+ /**
398
+ * Include numbers (0-9).
399
+ */
400
+ numbers: boolean;
401
+ /**
402
+ * Include special characters: ! @ # $ % ^ & *
403
+ */
404
+ special: boolean;
405
+ /**
406
+ * The length of the generated password.
407
+ * Note that the password length must be greater than the sum of all the minimums.
408
+ */
409
+ length: number;
410
+ /**
411
+ * When set to true, the generated password will not contain ambiguous characters.
412
+ * The ambiguous characters are: I, O, l, 0, 1
413
+ */
414
+ avoidAmbiguous: boolean;
415
+ /**
416
+ * The minimum number of lowercase characters in the generated password.
417
+ * When set, the value must be between 1 and 9. This value is ignored if lowercase is false.
418
+ */
419
+ minLowercase: number | undefined;
420
+ /**
421
+ * The minimum number of uppercase characters in the generated password.
422
+ * When set, the value must be between 1 and 9. This value is ignored if uppercase is false.
423
+ */
424
+ minUppercase: number | undefined;
425
+ /**
426
+ * The minimum number of numbers in the generated password.
427
+ * When set, the value must be between 1 and 9. This value is ignored if numbers is false.
428
+ */
429
+ minNumber: number | undefined;
430
+ /**
431
+ * The minimum number of special characters in the generated password.
432
+ * When set, the value must be between 1 and 9. This value is ignored if special is false.
433
+ */
434
+ minSpecial: number | undefined;
435
+ }
436
+
437
+ export interface PasswordError extends Error {
438
+ name: "PasswordError";
439
+ variant: "NoCharacterSetEnabled" | "InvalidLength";
173
440
  }
174
441
 
442
+ export function isPasswordError(error: any): error is PasswordError;
443
+
444
+ /**
445
+ * Passphrase generator request options.
446
+ */
447
+ export interface PassphraseGeneratorRequest {
448
+ /**
449
+ * Number of words in the generated passphrase.
450
+ * This value must be between 3 and 20.
451
+ */
452
+ numWords: number;
453
+ /**
454
+ * Character separator between words in the generated passphrase. The value cannot be empty.
455
+ */
456
+ wordSeparator: string;
457
+ /**
458
+ * When set to true, capitalize the first letter of each word in the generated passphrase.
459
+ */
460
+ capitalize: boolean;
461
+ /**
462
+ * When set to true, include a number at the end of one of the words in the generated
463
+ * passphrase.
464
+ */
465
+ includeNumber: boolean;
466
+ }
467
+
468
+ export interface PassphraseError extends Error {
469
+ name: "PassphraseError";
470
+ variant: "InvalidNumWords";
471
+ }
472
+
473
+ export function isPassphraseError(error: any): error is PassphraseError;
474
+
475
+ export type Endpoint =
476
+ | { Web: { id: number } }
477
+ | "BrowserForeground"
478
+ | "BrowserBackground"
479
+ | "DesktopRenderer"
480
+ | "DesktopMain";
481
+
482
+ export interface IpcCommunicationBackendSender {
483
+ send(message: OutgoingMessage): Promise<void>;
484
+ }
485
+
486
+ export interface ChannelError extends Error {
487
+ name: "ChannelError";
488
+ }
489
+
490
+ export function isChannelError(error: any): error is ChannelError;
491
+
492
+ export interface DeserializeError extends Error {
493
+ name: "DeserializeError";
494
+ }
495
+
496
+ export function isDeserializeError(error: any): error is DeserializeError;
497
+
175
498
  export type KeyAlgorithm = "Ed25519" | "Rsa3072" | "Rsa4096";
176
499
 
500
+ export interface SshKeyExportError extends Error {
501
+ name: "SshKeyExportError";
502
+ variant: "KeyConversionError";
503
+ }
504
+
505
+ export function isSshKeyExportError(error: any): error is SshKeyExportError;
506
+
507
+ export interface SshKeyImportError extends Error {
508
+ name: "SshKeyImportError";
509
+ variant: "ParsingError" | "PasswordRequired" | "WrongPassword" | "UnsupportedKeyType";
510
+ }
511
+
512
+ export function isSshKeyImportError(error: any): error is SshKeyImportError;
513
+
177
514
  export interface KeyGenerationError extends Error {
178
515
  name: "KeyGenerationError";
179
516
  variant: "KeyGenerationError" | "KeyConversionError";
@@ -181,6 +518,235 @@ export interface KeyGenerationError extends Error {
181
518
 
182
519
  export function isKeyGenerationError(error: any): error is KeyGenerationError;
183
520
 
521
+ export interface EncryptionContext {
522
+ /**
523
+ * The Id of the user that encrypted the cipher. It should always represent a UserId, even for
524
+ * Organization-owned ciphers
525
+ */
526
+ encryptedFor: Uuid;
527
+ cipher: Cipher;
528
+ }
529
+
530
+ export interface Cipher {
531
+ id: Uuid | undefined;
532
+ organizationId: Uuid | undefined;
533
+ folderId: Uuid | undefined;
534
+ collectionIds: Uuid[];
535
+ /**
536
+ * More recent ciphers uses individual encryption keys to encrypt the other fields of the
537
+ * Cipher.
538
+ */
539
+ key: EncString | undefined;
540
+ name: EncString;
541
+ notes: EncString | undefined;
542
+ type: CipherType;
543
+ login: Login | undefined;
544
+ identity: Identity | undefined;
545
+ card: Card | undefined;
546
+ secureNote: SecureNote | undefined;
547
+ sshKey: SshKey | undefined;
548
+ favorite: boolean;
549
+ reprompt: CipherRepromptType;
550
+ organizationUseTotp: boolean;
551
+ edit: boolean;
552
+ permissions: CipherPermissions | undefined;
553
+ viewPassword: boolean;
554
+ localData: LocalData | undefined;
555
+ attachments: Attachment[] | undefined;
556
+ fields: Field[] | undefined;
557
+ passwordHistory: PasswordHistory[] | undefined;
558
+ creationDate: DateTime<Utc>;
559
+ deletedDate: DateTime<Utc> | undefined;
560
+ revisionDate: DateTime<Utc>;
561
+ }
562
+
563
+ export interface CipherView {
564
+ id: Uuid | undefined;
565
+ organizationId: Uuid | undefined;
566
+ folderId: Uuid | undefined;
567
+ collectionIds: Uuid[];
568
+ /**
569
+ * Temporary, required to support re-encrypting existing items.
570
+ */
571
+ key: EncString | undefined;
572
+ name: string;
573
+ notes: string | undefined;
574
+ type: CipherType;
575
+ login: LoginView | undefined;
576
+ identity: IdentityView | undefined;
577
+ card: CardView | undefined;
578
+ secureNote: SecureNoteView | undefined;
579
+ sshKey: SshKeyView | undefined;
580
+ favorite: boolean;
581
+ reprompt: CipherRepromptType;
582
+ organizationUseTotp: boolean;
583
+ edit: boolean;
584
+ permissions: CipherPermissions | undefined;
585
+ viewPassword: boolean;
586
+ localData: LocalDataView | undefined;
587
+ attachments: AttachmentView[] | undefined;
588
+ fields: FieldView[] | undefined;
589
+ passwordHistory: PasswordHistoryView[] | undefined;
590
+ creationDate: DateTime<Utc>;
591
+ deletedDate: DateTime<Utc> | undefined;
592
+ revisionDate: DateTime<Utc>;
593
+ }
594
+
595
+ export type CipherListViewType =
596
+ | { login: LoginListView }
597
+ | "secureNote"
598
+ | "card"
599
+ | "identity"
600
+ | "sshKey";
601
+
602
+ export interface CipherListView {
603
+ id: Uuid | undefined;
604
+ organizationId: Uuid | undefined;
605
+ folderId: Uuid | undefined;
606
+ collectionIds: Uuid[];
607
+ /**
608
+ * Temporary, required to support calculating TOTP from CipherListView.
609
+ */
610
+ key: EncString | undefined;
611
+ name: string;
612
+ subtitle: string;
613
+ type: CipherListViewType;
614
+ favorite: boolean;
615
+ reprompt: CipherRepromptType;
616
+ organizationUseTotp: boolean;
617
+ edit: boolean;
618
+ permissions: CipherPermissions | undefined;
619
+ viewPassword: boolean;
620
+ /**
621
+ * The number of attachments
622
+ */
623
+ attachments: number;
624
+ creationDate: DateTime<Utc>;
625
+ deletedDate: DateTime<Utc> | undefined;
626
+ revisionDate: DateTime<Utc>;
627
+ }
628
+
629
+ export interface Field {
630
+ name: EncString | undefined;
631
+ value: EncString | undefined;
632
+ type: FieldType;
633
+ linkedId: LinkedIdType | undefined;
634
+ }
635
+
636
+ export interface FieldView {
637
+ name: string | undefined;
638
+ value: string | undefined;
639
+ type: FieldType;
640
+ linkedId: LinkedIdType | undefined;
641
+ }
642
+
643
+ export type LinkedIdType = LoginLinkedIdType | CardLinkedIdType | IdentityLinkedIdType;
644
+
645
+ export interface LoginUri {
646
+ uri: EncString | undefined;
647
+ match: UriMatchType | undefined;
648
+ uriChecksum: EncString | undefined;
649
+ }
650
+
651
+ export interface LoginUriView {
652
+ uri: string | undefined;
653
+ match: UriMatchType | undefined;
654
+ uriChecksum: string | undefined;
655
+ }
656
+
657
+ export interface Fido2Credential {
658
+ credentialId: EncString;
659
+ keyType: EncString;
660
+ keyAlgorithm: EncString;
661
+ keyCurve: EncString;
662
+ keyValue: EncString;
663
+ rpId: EncString;
664
+ userHandle: EncString | undefined;
665
+ userName: EncString | undefined;
666
+ counter: EncString;
667
+ rpName: EncString | undefined;
668
+ userDisplayName: EncString | undefined;
669
+ discoverable: EncString;
670
+ creationDate: DateTime<Utc>;
671
+ }
672
+
673
+ export interface Fido2CredentialListView {
674
+ credentialId: string;
675
+ rpId: string;
676
+ userHandle: string | undefined;
677
+ userName: string | undefined;
678
+ userDisplayName: string | undefined;
679
+ }
680
+
681
+ export interface Fido2CredentialView {
682
+ credentialId: string;
683
+ keyType: string;
684
+ keyAlgorithm: string;
685
+ keyCurve: string;
686
+ keyValue: EncString;
687
+ rpId: string;
688
+ userHandle: string | undefined;
689
+ userName: string | undefined;
690
+ counter: string;
691
+ rpName: string | undefined;
692
+ userDisplayName: string | undefined;
693
+ discoverable: string;
694
+ creationDate: DateTime<Utc>;
695
+ }
696
+
697
+ export interface Fido2CredentialNewView {
698
+ credentialId: string;
699
+ keyType: string;
700
+ keyAlgorithm: string;
701
+ keyCurve: string;
702
+ rpId: string;
703
+ userHandle: string | undefined;
704
+ userName: string | undefined;
705
+ counter: string;
706
+ rpName: string | undefined;
707
+ userDisplayName: string | undefined;
708
+ creationDate: DateTime<Utc>;
709
+ }
710
+
711
+ export interface Login {
712
+ username: EncString | undefined;
713
+ password: EncString | undefined;
714
+ passwordRevisionDate: DateTime<Utc> | undefined;
715
+ uris: LoginUri[] | undefined;
716
+ totp: EncString | undefined;
717
+ autofillOnPageLoad: boolean | undefined;
718
+ fido2Credentials: Fido2Credential[] | undefined;
719
+ }
720
+
721
+ export interface LoginView {
722
+ username: string | undefined;
723
+ password: string | undefined;
724
+ passwordRevisionDate: DateTime<Utc> | undefined;
725
+ uris: LoginUriView[] | undefined;
726
+ totp: string | undefined;
727
+ autofillOnPageLoad: boolean | undefined;
728
+ fido2Credentials: Fido2Credential[] | undefined;
729
+ }
730
+
731
+ export interface LoginListView {
732
+ fido2Credentials: Fido2CredentialListView[] | undefined;
733
+ hasFido2: boolean;
734
+ username: string | undefined;
735
+ /**
736
+ * The TOTP key is not decrypted. Useable as is with [`crate::generate_totp_cipher_view`].
737
+ */
738
+ totp: EncString | undefined;
739
+ uris: LoginUriView[] | undefined;
740
+ }
741
+
742
+ export interface SecureNote {
743
+ type: SecureNoteType;
744
+ }
745
+
746
+ export interface SecureNoteView {
747
+ type: SecureNoteType;
748
+ }
749
+
184
750
  export interface Folder {
185
751
  id: Uuid | undefined;
186
752
  name: EncString;
@@ -193,13 +759,213 @@ export interface FolderView {
193
759
  revisionDate: DateTime<Utc>;
194
760
  }
195
761
 
196
- export interface TestError extends Error {
197
- name: "TestError";
762
+ export interface DecryptError extends Error {
763
+ name: "DecryptError";
764
+ variant: "Crypto" | "VaultLocked";
198
765
  }
199
766
 
200
- export function isTestError(error: any): error is TestError;
767
+ export function isDecryptError(error: any): error is DecryptError;
768
+
769
+ export interface EncryptError extends Error {
770
+ name: "EncryptError";
771
+ variant: "Crypto" | "VaultLocked" | "MissingUserId";
772
+ }
773
+
774
+ export function isEncryptError(error: any): error is EncryptError;
775
+
776
+ export interface TotpResponse {
777
+ /**
778
+ * Generated TOTP code
779
+ */
780
+ code: string;
781
+ /**
782
+ * Time period
783
+ */
784
+ period: number;
785
+ }
786
+
787
+ export interface TotpError extends Error {
788
+ name: "TotpError";
789
+ variant: "InvalidOtpauth" | "MissingSecret" | "CryptoError" | "VaultLocked";
790
+ }
791
+
792
+ export function isTotpError(error: any): error is TotpError;
793
+
794
+ export interface PasswordHistoryView {
795
+ password: string;
796
+ lastUsedDate: DateTime<Utc>;
797
+ }
798
+
799
+ export interface PasswordHistory {
800
+ password: EncString;
801
+ lastUsedDate: DateTime<Utc>;
802
+ }
803
+
804
+ export interface Collection {
805
+ id: Uuid | undefined;
806
+ organizationId: Uuid;
807
+ name: EncString;
808
+ externalId: string | undefined;
809
+ hidePasswords: boolean;
810
+ readOnly: boolean;
811
+ manage: boolean;
812
+ }
813
+
814
+ export interface SshKeyView {
815
+ /**
816
+ * SSH private key (ed25519/rsa) in unencrypted openssh private key format [OpenSSH private key](https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key)
817
+ */
818
+ privateKey: string;
819
+ /**
820
+ * SSH public key (ed25519/rsa) according to [RFC4253](https://datatracker.ietf.org/doc/html/rfc4253#section-6.6)
821
+ */
822
+ publicKey: string;
823
+ /**
824
+ * SSH fingerprint using SHA256 in the format: `SHA256:BASE64_ENCODED_FINGERPRINT`
825
+ */
826
+ fingerprint: string;
827
+ }
828
+
829
+ export interface SshKey {
830
+ /**
831
+ * SSH private key (ed25519/rsa) in unencrypted openssh private key format [OpenSSH private key](https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key)
832
+ */
833
+ privateKey: EncString;
834
+ /**
835
+ * SSH public key (ed25519/rsa) according to [RFC4253](https://datatracker.ietf.org/doc/html/rfc4253#section-6.6)
836
+ */
837
+ publicKey: EncString;
838
+ /**
839
+ * SSH fingerprint using SHA256 in the format: `SHA256:BASE64_ENCODED_FINGERPRINT`
840
+ */
841
+ fingerprint: EncString;
842
+ }
843
+
844
+ export interface LocalDataView {
845
+ lastUsedDate: DateTime<Utc> | undefined;
846
+ lastLaunched: DateTime<Utc> | undefined;
847
+ }
848
+
849
+ export interface LocalData {
850
+ lastUsedDate: DateTime<Utc> | undefined;
851
+ lastLaunched: DateTime<Utc> | undefined;
852
+ }
853
+
854
+ export interface IdentityView {
855
+ title: string | undefined;
856
+ firstName: string | undefined;
857
+ middleName: string | undefined;
858
+ lastName: string | undefined;
859
+ address1: string | undefined;
860
+ address2: string | undefined;
861
+ address3: string | undefined;
862
+ city: string | undefined;
863
+ state: string | undefined;
864
+ postalCode: string | undefined;
865
+ country: string | undefined;
866
+ company: string | undefined;
867
+ email: string | undefined;
868
+ phone: string | undefined;
869
+ ssn: string | undefined;
870
+ username: string | undefined;
871
+ passportNumber: string | undefined;
872
+ licenseNumber: string | undefined;
873
+ }
874
+
875
+ export interface Identity {
876
+ title: EncString | undefined;
877
+ firstName: EncString | undefined;
878
+ middleName: EncString | undefined;
879
+ lastName: EncString | undefined;
880
+ address1: EncString | undefined;
881
+ address2: EncString | undefined;
882
+ address3: EncString | undefined;
883
+ city: EncString | undefined;
884
+ state: EncString | undefined;
885
+ postalCode: EncString | undefined;
886
+ country: EncString | undefined;
887
+ company: EncString | undefined;
888
+ email: EncString | undefined;
889
+ phone: EncString | undefined;
890
+ ssn: EncString | undefined;
891
+ username: EncString | undefined;
892
+ passportNumber: EncString | undefined;
893
+ licenseNumber: EncString | undefined;
894
+ }
895
+
896
+ export interface CipherPermissions {
897
+ delete: boolean;
898
+ restore: boolean;
899
+ }
900
+
901
+ export interface CipherError extends Error {
902
+ name: "CipherError";
903
+ variant: "MissingFieldError" | "VaultLocked" | "CryptoError" | "AttachmentsWithoutKeys";
904
+ }
905
+
906
+ export function isCipherError(error: any): error is CipherError;
907
+
908
+ export interface CardView {
909
+ cardholderName: string | undefined;
910
+ expMonth: string | undefined;
911
+ expYear: string | undefined;
912
+ code: string | undefined;
913
+ brand: string | undefined;
914
+ number: string | undefined;
915
+ }
916
+
917
+ export interface Card {
918
+ cardholderName: EncString | undefined;
919
+ expMonth: EncString | undefined;
920
+ expYear: EncString | undefined;
921
+ code: EncString | undefined;
922
+ brand: EncString | undefined;
923
+ number: EncString | undefined;
924
+ }
925
+
926
+ export interface DecryptFileError extends Error {
927
+ name: "DecryptFileError";
928
+ variant: "Decrypt" | "Io";
929
+ }
930
+
931
+ export function isDecryptFileError(error: any): error is DecryptFileError;
932
+
933
+ export interface EncryptFileError extends Error {
934
+ name: "EncryptFileError";
935
+ variant: "Encrypt" | "Io";
936
+ }
937
+
938
+ export function isEncryptFileError(error: any): error is EncryptFileError;
939
+
940
+ export interface AttachmentView {
941
+ id: string | undefined;
942
+ url: string | undefined;
943
+ size: string | undefined;
944
+ sizeName: string | undefined;
945
+ fileName: string | undefined;
946
+ key: EncString | undefined;
947
+ }
948
+
949
+ export interface Attachment {
950
+ id: string | undefined;
951
+ url: string | undefined;
952
+ size: string | undefined;
953
+ /**
954
+ * Readable size, ex: \"4.2 KB\" or \"1.43 GB\
955
+ */
956
+ sizeName: string | undefined;
957
+ fileName: EncString | undefined;
958
+ key: EncString | undefined;
959
+ }
960
+
961
+ import { Tagged } from "type-fest";
201
962
 
202
- export type Uuid = string;
963
+ /**
964
+ * A string that **MUST** be a valid UUID.
965
+ *
966
+ * Never create or cast to this type directly, use the `uuid<T>()` function instead.
967
+ */
968
+ export type Uuid = unknown;
203
969
 
204
970
  /**
205
971
  * RFC3339 compliant date-time string.
@@ -217,73 +983,350 @@ export type Utc = unknown;
217
983
  */
218
984
  export type NonZeroU32 = number;
219
985
 
986
+ export interface TestError extends Error {
987
+ name: "TestError";
988
+ }
989
+
990
+ export function isTestError(error: any): error is TestError;
991
+
992
+ export class AttachmentsClient {
993
+ private constructor();
994
+ free(): void;
995
+ decrypt_buffer(
996
+ cipher: Cipher,
997
+ attachment: AttachmentView,
998
+ encrypted_buffer: Uint8Array,
999
+ ): Uint8Array;
1000
+ }
220
1001
  export class BitwardenClient {
221
1002
  free(): void;
222
- /**
223
- * @param {ClientSettings | undefined} [settings]
224
- * @param {LogLevel | undefined} [log_level]
225
- */
226
- constructor(settings?: ClientSettings, log_level?: LogLevel);
1003
+ constructor(settings?: ClientSettings | null);
227
1004
  /**
228
1005
  * Test method, echoes back the input
229
- * @param {string} msg
230
- * @returns {string}
231
1006
  */
232
1007
  echo(msg: string): string;
233
- /**
234
- * @returns {string}
235
- */
236
1008
  version(): string;
237
- /**
238
- * @param {string} msg
239
- * @returns {Promise<void>}
240
- */
241
- throw(msg: string): Promise<void>;
1009
+ throw(msg: string): void;
242
1010
  /**
243
1011
  * Test method, calls http endpoint
244
- * @param {string} url
245
- * @returns {Promise<string>}
246
1012
  */
247
1013
  http_get(url: string): Promise<string>;
1014
+ crypto(): CryptoClient;
1015
+ vault(): VaultClient;
248
1016
  /**
249
- * @returns {ClientCrypto}
1017
+ * Constructs a specific client for generating passwords and passphrases
250
1018
  */
251
- crypto(): ClientCrypto;
252
- /**
253
- * @returns {ClientVault}
254
- */
255
- vault(): ClientVault;
1019
+ generator(): GeneratorClient;
1020
+ exporters(): ExporterClient;
1021
+ }
1022
+ export class CiphersClient {
1023
+ private constructor();
1024
+ free(): void;
1025
+ encrypt(cipher_view: CipherView): EncryptionContext;
1026
+ decrypt(cipher: Cipher): CipherView;
1027
+ decrypt_list(ciphers: Cipher[]): CipherListView[];
1028
+ decrypt_fido2_credentials(cipher_view: CipherView): Fido2CredentialView[];
1029
+ move_to_organization(cipher_view: CipherView, organization_id: OrganizationId): CipherView;
1030
+ decrypt_fido2_private_key(cipher_view: CipherView): string;
256
1031
  }
257
- export class ClientCrypto {
1032
+ export class CryptoClient {
1033
+ private constructor();
258
1034
  free(): void;
259
1035
  /**
260
1036
  * Initialization method for the user crypto. Needs to be called before any other crypto
261
1037
  * operations.
262
- * @param {InitUserCryptoRequest} req
263
- * @returns {Promise<void>}
264
1038
  */
265
1039
  initialize_user_crypto(req: InitUserCryptoRequest): Promise<void>;
266
1040
  /**
267
1041
  * Initialization method for the organization crypto. Needs to be called after
268
1042
  * `initialize_user_crypto` but before any other crypto operations.
269
- * @param {InitOrgCryptoRequest} req
270
- * @returns {Promise<void>}
271
1043
  */
272
1044
  initialize_org_crypto(req: InitOrgCryptoRequest): Promise<void>;
1045
+ /**
1046
+ * Generates a new key pair and encrypts the private key with the provided user key.
1047
+ * Crypto initialization not required.
1048
+ */
1049
+ make_key_pair(user_key: string): MakeKeyPairResponse;
1050
+ /**
1051
+ * Verifies a user's asymmetric keys by decrypting the private key with the provided user
1052
+ * key. Returns if the private key is decryptable and if it is a valid matching key.
1053
+ * Crypto initialization not required.
1054
+ */
1055
+ verify_asymmetric_keys(request: VerifyAsymmetricKeysRequest): VerifyAsymmetricKeysResponse;
273
1056
  }
274
- export class ClientFolders {
1057
+ export class ExporterClient {
1058
+ private constructor();
275
1059
  free(): void;
1060
+ export_vault(folders: Folder[], ciphers: Cipher[], format: ExportFormat): string;
1061
+ export_organization_vault(
1062
+ collections: Collection[],
1063
+ ciphers: Cipher[],
1064
+ format: ExportFormat,
1065
+ ): string;
1066
+ /**
1067
+ * Credential Exchange Format (CXF)
1068
+ *
1069
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
1070
+ *
1071
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
1072
+ * Ideally the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
1073
+ */
1074
+ export_cxf(account: Account, ciphers: Cipher[]): string;
276
1075
  /**
277
- * Decrypt folder
278
- * @param {Folder} folder
279
- * @returns {FolderView}
1076
+ * Credential Exchange Format (CXF)
1077
+ *
1078
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
1079
+ *
1080
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
1081
+ * Ideally the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
280
1082
  */
1083
+ import_cxf(payload: string): Cipher[];
1084
+ }
1085
+ export class FoldersClient {
1086
+ private constructor();
1087
+ free(): void;
1088
+ encrypt(folder_view: FolderView): Folder;
281
1089
  decrypt(folder: Folder): FolderView;
1090
+ decrypt_list(folders: Folder[]): FolderView[];
1091
+ }
1092
+ export class GeneratorClient {
1093
+ private constructor();
1094
+ free(): void;
1095
+ /**
1096
+ * Generates a random password.
1097
+ *
1098
+ * The character sets and password length can be customized using the `input` parameter.
1099
+ *
1100
+ * # Examples
1101
+ *
1102
+ * ```
1103
+ * use bitwarden_core::Client;
1104
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
1105
+ *
1106
+ * async fn test() -> Result<(), PassphraseError> {
1107
+ * let input = PasswordGeneratorRequest {
1108
+ * lowercase: true,
1109
+ * uppercase: true,
1110
+ * numbers: true,
1111
+ * length: 20,
1112
+ * ..Default::default()
1113
+ * };
1114
+ * let password = Client::new(None).generator().password(input).unwrap();
1115
+ * println!("{}", password);
1116
+ * Ok(())
1117
+ * }
1118
+ * ```
1119
+ */
1120
+ password(input: PasswordGeneratorRequest): string;
1121
+ /**
1122
+ * Generates a random passphrase.
1123
+ * A passphrase is a combination of random words separated by a character.
1124
+ * An example of passphrase is `correct horse battery staple`.
1125
+ *
1126
+ * The number of words and their case, the word separator, and the inclusion of
1127
+ * a number in the passphrase can be customized using the `input` parameter.
1128
+ *
1129
+ * # Examples
1130
+ *
1131
+ * ```
1132
+ * use bitwarden_core::Client;
1133
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
1134
+ *
1135
+ * async fn test() -> Result<(), PassphraseError> {
1136
+ * let input = PassphraseGeneratorRequest {
1137
+ * num_words: 4,
1138
+ * ..Default::default()
1139
+ * };
1140
+ * let passphrase = Client::new(None).generator().passphrase(input).unwrap();
1141
+ * println!("{}", passphrase);
1142
+ * Ok(())
1143
+ * }
1144
+ * ```
1145
+ */
1146
+ passphrase(input: PassphraseGeneratorRequest): string;
1147
+ }
1148
+ export class IncomingMessage {
1149
+ free(): void;
1150
+ constructor(payload: Uint8Array, destination: Endpoint, source: Endpoint, topic?: string | null);
1151
+ /**
1152
+ * Try to parse the payload as JSON.
1153
+ * @returns The parsed JSON value, or undefined if the payload is not valid JSON.
1154
+ */
1155
+ parse_payload_as_json(): any;
1156
+ payload: Uint8Array;
1157
+ destination: Endpoint;
1158
+ source: Endpoint;
1159
+ get topic(): string | undefined;
1160
+ set topic(value: string | null | undefined);
282
1161
  }
283
- export class ClientVault {
1162
+ export class IpcClient {
284
1163
  free(): void;
1164
+ constructor(communication_provider: IpcCommunicationBackend);
1165
+ send(message: OutgoingMessage): Promise<void>;
1166
+ subscribe(): Promise<IpcClientSubscription>;
1167
+ }
1168
+ export class IpcClientSubscription {
1169
+ private constructor();
1170
+ free(): void;
1171
+ receive(): Promise<IncomingMessage>;
1172
+ }
1173
+ export class IpcCommunicationBackend {
1174
+ free(): void;
1175
+ constructor(sender: IpcCommunicationBackendSender);
1176
+ /**
1177
+ * JavaScript function to provide a received message to the backend/IPC framework.
1178
+ */
1179
+ deliver_message(message: IncomingMessage): void;
1180
+ }
1181
+ export class OutgoingMessage {
1182
+ free(): void;
1183
+ constructor(payload: Uint8Array, destination: Endpoint, topic?: string | null);
1184
+ /**
1185
+ * Create a new message and encode the payload as JSON.
1186
+ */
1187
+ static new_json_payload(
1188
+ payload: any,
1189
+ destination: Endpoint,
1190
+ topic?: string | null,
1191
+ ): OutgoingMessage;
1192
+ payload: Uint8Array;
1193
+ destination: Endpoint;
1194
+ get topic(): string | undefined;
1195
+ set topic(value: string | null | undefined);
1196
+ }
1197
+ /**
1198
+ * This module represents a stopgap solution to provide access to primitive crypto functions for JS
1199
+ * clients. It is not intended to be used outside of the JS clients and this pattern should not be
1200
+ * proliferated. It is necessary because we want to use SDK crypto prior to the SDK being fully
1201
+ * responsible for state and keys.
1202
+ */
1203
+ export class PureCrypto {
1204
+ private constructor();
1205
+ free(): void;
1206
+ /**
1207
+ * DEPRECATED: Use `symmetric_decrypt_string` instead.
1208
+ * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
1209
+ */
1210
+ static symmetric_decrypt(enc_string: string, key: Uint8Array): string;
1211
+ static symmetric_decrypt_string(enc_string: string, key: Uint8Array): string;
1212
+ static symmetric_decrypt_bytes(enc_string: string, key: Uint8Array): Uint8Array;
1213
+ /**
1214
+ * DEPRECATED: Use `symmetric_decrypt_filedata` instead.
1215
+ * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
1216
+ */
1217
+ static symmetric_decrypt_array_buffer(enc_bytes: Uint8Array, key: Uint8Array): Uint8Array;
1218
+ static symmetric_decrypt_filedata(enc_bytes: Uint8Array, key: Uint8Array): Uint8Array;
1219
+ static symmetric_encrypt_string(plain: string, key: Uint8Array): string;
1220
+ static symmetric_encrypt_bytes(plain: Uint8Array, key: Uint8Array): string;
1221
+ static symmetric_encrypt_filedata(plain: Uint8Array, key: Uint8Array): Uint8Array;
1222
+ static decrypt_user_key_with_master_password(
1223
+ encrypted_user_key: string,
1224
+ master_password: string,
1225
+ email: string,
1226
+ kdf: Kdf,
1227
+ ): Uint8Array;
1228
+ static encrypt_user_key_with_master_password(
1229
+ user_key: Uint8Array,
1230
+ master_password: string,
1231
+ email: string,
1232
+ kdf: Kdf,
1233
+ ): string;
1234
+ static make_user_key_aes256_cbc_hmac(): Uint8Array;
1235
+ static make_user_key_xchacha20_poly1305(): Uint8Array;
1236
+ /**
1237
+ * Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
1238
+ * as an EncString.
1239
+ */
1240
+ static wrap_symmetric_key(key_to_be_wrapped: Uint8Array, wrapping_key: Uint8Array): string;
1241
+ /**
1242
+ * Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
1243
+ * unwrapped key as a serialized byte array.
1244
+ */
1245
+ static unwrap_symmetric_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
1246
+ /**
1247
+ * Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
1248
+ * key. Note: Usually, a public key is - by definition - public, so this should not be
1249
+ * used. The specific use-case for this function is to enable rotateable key sets, where
1250
+ * the "public key" is not public, with the intent of preventing the server from being able
1251
+ * to overwrite the user key unlocked by the rotateable keyset.
1252
+ */
1253
+ static wrap_encapsulation_key(encapsulation_key: Uint8Array, wrapping_key: Uint8Array): string;
1254
+ /**
1255
+ * Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
1256
+ * wrapping key.
1257
+ */
1258
+ static unwrap_encapsulation_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
1259
+ /**
1260
+ * Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
1261
+ * key,
1262
+ */
1263
+ static wrap_decapsulation_key(decapsulation_key: Uint8Array, wrapping_key: Uint8Array): string;
1264
+ /**
1265
+ * Unwraps (decrypts) a wrapped PKCS8 DER encoded decapsulation (private) key using a symmetric
1266
+ * wrapping key.
1267
+ */
1268
+ static unwrap_decapsulation_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
1269
+ /**
1270
+ * Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
1271
+ * in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
1272
+ * the sender's authenticity cannot be verified by the recipient.
1273
+ */
1274
+ static encapsulate_key_unsigned(shared_key: Uint8Array, encapsulation_key: Uint8Array): string;
1275
+ /**
1276
+ * Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
1277
+ * DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
1278
+ * recipient.
1279
+ */
1280
+ static decapsulate_key_unsigned(
1281
+ encapsulated_key: string,
1282
+ decapsulation_key: Uint8Array,
1283
+ ): Uint8Array;
1284
+ }
1285
+ export class ReceiveError {
1286
+ private constructor();
1287
+ free(): void;
1288
+ timeout: boolean;
1289
+ crypto: any;
1290
+ communication: any;
1291
+ }
1292
+ export class SendError {
1293
+ private constructor();
1294
+ free(): void;
1295
+ crypto: any;
1296
+ communication: any;
1297
+ }
1298
+ export class TotpClient {
1299
+ private constructor();
1300
+ free(): void;
1301
+ /**
1302
+ * Generates a TOTP code from a provided key
1303
+ *
1304
+ * # Arguments
1305
+ * - `key` - Can be:
1306
+ * - A base32 encoded string
1307
+ * - OTP Auth URI
1308
+ * - Steam URI
1309
+ * - `time_ms` - Optional timestamp in milliseconds
1310
+ */
1311
+ generate_totp(key: string, time_ms?: number | null): TotpResponse;
1312
+ }
1313
+ export class VaultClient {
1314
+ private constructor();
1315
+ free(): void;
1316
+ /**
1317
+ * Attachment related operations.
1318
+ */
1319
+ attachments(): AttachmentsClient;
1320
+ /**
1321
+ * Cipher related operations.
1322
+ */
1323
+ ciphers(): CiphersClient;
1324
+ /**
1325
+ * Folder related operations.
1326
+ */
1327
+ folders(): FoldersClient;
285
1328
  /**
286
- * @returns {ClientFolders}
1329
+ * TOTP related operations.
287
1330
  */
288
- folders(): ClientFolders;
1331
+ totp(): TotpClient;
289
1332
  }