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

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