@bitwarden/sdk-internal 0.2.0-main.515 → 0.2.0-main.516

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,16 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Generate a new SSH key pair
5
- *
6
- * # Arguments
7
- * - `key_algorithm` - The algorithm to use for the key pair
8
- *
9
- * # Returns
10
- * - `Ok(SshKey)` if the key was successfully generated
11
- * - `Err(KeyGenerationError)` if the key could not be generated
12
- */
13
- export function generate_ssh_key(key_algorithm: KeyAlgorithm): SshKeyView;
14
3
  /**
15
4
  * Convert a PCKS8 or OpenSSH encrypted or unencrypted private key
16
5
  * to an OpenSSH private key with public key and fingerprint
@@ -27,6 +16,17 @@ export function generate_ssh_key(key_algorithm: KeyAlgorithm): SshKeyView;
27
16
  * - `Err(UnsupportedKeyType)` if the key type is not supported
28
17
  */
29
18
  export function import_ssh_key(imported_key: string, password?: string | null): SshKeyView;
19
+ /**
20
+ * Generate a new SSH key pair
21
+ *
22
+ * # Arguments
23
+ * - `key_algorithm` - The algorithm to use for the key pair
24
+ *
25
+ * # Returns
26
+ * - `Ok(SshKey)` if the key was successfully generated
27
+ * - `Err(KeyGenerationError)` if the key could not be generated
28
+ */
29
+ export function generate_ssh_key(key_algorithm: KeyAlgorithm): SshKeyView;
30
30
  export function init_sdk(log_level?: LogLevel | null): void;
31
31
  /**
32
32
  * Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
@@ -180,6 +180,11 @@ export interface TokenProvider {
180
180
  get_access_token(): Promise<string | undefined>;
181
181
  }
182
182
 
183
+ export interface Repositories {
184
+ cipher: Repository<Cipher> | null;
185
+ folder: Repository<Folder> | null;
186
+ }
187
+
183
188
  export interface IndexedDbConfiguration {
184
189
  db_name: string;
185
190
  }
@@ -189,9 +194,18 @@ export interface IndexedDbConfiguration {
189
194
  */
190
195
  export interface FeatureFlags extends Map<string, boolean> {}
191
196
 
192
- export interface Repositories {
193
- cipher: Repository<Cipher> | null;
194
- folder: Repository<Folder> | null;
197
+ /**
198
+ * A request structure for requesting a send access token from the API.
199
+ */
200
+ export interface SendAccessTokenRequest {
201
+ /**
202
+ * The id of the send for which the access token is requested.
203
+ */
204
+ sendId: string;
205
+ /**
206
+ * The optional send access credentials.
207
+ */
208
+ sendAccessCredentials?: SendAccessCredentials;
195
209
  }
196
210
 
197
211
  /**
@@ -209,25 +223,14 @@ export interface SendEmailOtpCredentials {
209
223
  }
210
224
 
211
225
  /**
212
- * The credentials used for send access requests.
213
- */
214
- export type SendAccessCredentials =
215
- | SendPasswordCredentials
216
- | SendEmailOtpCredentials
217
- | SendEmailCredentials;
218
-
219
- /**
220
- * A request structure for requesting a send access token from the API.
226
+ * Credentials for sending an OTP to the user\'s email address.
227
+ * This is used when the send requires email verification with an OTP.
221
228
  */
222
- export interface SendAccessTokenRequest {
223
- /**
224
- * The id of the send for which the access token is requested.
225
- */
226
- sendId: string;
229
+ export interface SendEmailCredentials {
227
230
  /**
228
- * The optional send access credentials.
231
+ * The email address to which the OTP will be sent.
229
232
  */
230
- sendAccessCredentials?: SendAccessCredentials;
233
+ email: string;
231
234
  }
232
235
 
233
236
  /**
@@ -243,15 +246,20 @@ export interface SendPasswordCredentials {
243
246
  }
244
247
 
245
248
  /**
246
- * Credentials for sending an OTP to the user\'s email address.
247
- * This is used when the send requires email verification with an OTP.
249
+ * The credentials used for send access requests.
248
250
  */
249
- export interface SendEmailCredentials {
250
- /**
251
- * The email address to which the OTP will be sent.
252
- */
253
- email: string;
254
- }
251
+ export type SendAccessCredentials =
252
+ | SendPasswordCredentials
253
+ | SendEmailOtpCredentials
254
+ | SendEmailCredentials;
255
+
256
+ /**
257
+ * Represents errors that can occur when requesting a send access token.
258
+ * It includes expected and unexpected API errors.
259
+ */
260
+ export type SendAccessTokenError =
261
+ | { kind: "unexpected"; data: UnexpectedIdentityError }
262
+ | { kind: "expected"; data: SendAccessTokenApiErrorResponse };
255
263
 
256
264
  /**
257
265
  * Any unexpected error that occurs when making requests to identity. This could be
@@ -263,14 +271,6 @@ export interface SendEmailCredentials {
263
271
  */
264
272
  export type UnexpectedIdentityError = string;
265
273
 
266
- /**
267
- * Represents errors that can occur when requesting a send access token.
268
- * It includes expected and unexpected API errors.
269
- */
270
- export type SendAccessTokenError =
271
- | { kind: "unexpected"; data: UnexpectedIdentityError }
272
- | { kind: "expected"; data: SendAccessTokenApiErrorResponse };
273
-
274
274
  /**
275
275
  * A send access token which can be used to access a send.
276
276
  */
@@ -286,13 +286,13 @@ export interface SendAccessTokenResponse {
286
286
  }
287
287
 
288
288
  /**
289
- * Invalid grant errors - typically due to invalid credentials.
289
+ * Invalid request errors - typically due to missing parameters.
290
290
  */
291
- export type SendAccessTokenInvalidGrantError =
292
- | "send_id_invalid"
293
- | "password_hash_b64_invalid"
294
- | "otp_invalid"
295
- | "otp_generation_failed"
291
+ export type SendAccessTokenInvalidRequestError =
292
+ | "send_id_required"
293
+ | "password_hash_b64_required"
294
+ | "email_required"
295
+ | "email_and_otp_required"
296
296
  | "unknown";
297
297
 
298
298
  /**
@@ -316,37 +316,15 @@ export type SendAccessTokenApiErrorResponse =
316
316
  | { error: "invalid_target"; error_description?: string };
317
317
 
318
318
  /**
319
- * Invalid request errors - typically due to missing parameters.
319
+ * Invalid grant errors - typically due to invalid credentials.
320
320
  */
321
- export type SendAccessTokenInvalidRequestError =
322
- | "send_id_required"
323
- | "password_hash_b64_required"
324
- | "email_required"
325
- | "email_and_otp_required"
321
+ export type SendAccessTokenInvalidGrantError =
322
+ | "send_id_invalid"
323
+ | "password_hash_b64_invalid"
324
+ | "otp_invalid"
325
+ | "otp_generation_failed"
326
326
  | "unknown";
327
327
 
328
- /**
329
- * Result of Key Connector registration process.
330
- */
331
- export interface KeyConnectorRegistrationResult {
332
- /**
333
- * The account cryptographic state of the user.
334
- */
335
- account_cryptographic_state: WrappedAccountCryptographicState;
336
- /**
337
- * The key connector key used for unlocking.
338
- */
339
- key_connector_key: B64;
340
- /**
341
- * The encrypted user key, wrapped with the key connector key.
342
- */
343
- key_connector_key_wrapped_user_key: EncString;
344
- /**
345
- * The decrypted user key. This can be used to get the consuming client to an unlocked state.
346
- */
347
- user_key: B64;
348
- }
349
-
350
328
  /**
351
329
  * Request parameters for SSO JIT master password registration.
352
330
  */
@@ -386,6 +364,24 @@ export interface JitMasterPasswordRegistrationRequest {
386
364
  reset_password_enroll: boolean;
387
365
  }
388
366
 
367
+ /**
368
+ * Result of JIT master password registration process.
369
+ */
370
+ export interface JitMasterPasswordRegistrationResponse {
371
+ /**
372
+ * The account cryptographic state of the user
373
+ */
374
+ account_cryptographic_state: WrappedAccountCryptographicState;
375
+ /**
376
+ * The master password unlock data
377
+ */
378
+ master_password_unlock: MasterPasswordUnlockData;
379
+ /**
380
+ * The decrypted user key.
381
+ */
382
+ user_key: B64;
383
+ }
384
+
389
385
  /**
390
386
  * Result of TDE registration process.
391
387
  */
@@ -411,6 +407,28 @@ export interface RegistrationError extends Error {
411
407
 
412
408
  export function isRegistrationError(error: any): error is RegistrationError;
413
409
 
410
+ /**
411
+ * Result of Key Connector registration process.
412
+ */
413
+ export interface KeyConnectorRegistrationResult {
414
+ /**
415
+ * The account cryptographic state of the user.
416
+ */
417
+ account_cryptographic_state: WrappedAccountCryptographicState;
418
+ /**
419
+ * The key connector key used for unlocking.
420
+ */
421
+ key_connector_key: B64;
422
+ /**
423
+ * The encrypted user key, wrapped with the key connector key.
424
+ */
425
+ key_connector_key_wrapped_user_key: EncString;
426
+ /**
427
+ * The decrypted user key. This can be used to get the consuming client to an unlocked state.
428
+ */
429
+ user_key: B64;
430
+ }
431
+
414
432
  /**
415
433
  * Request parameters for TDE (Trusted Device Encryption) registration.
416
434
  */
@@ -439,27 +457,14 @@ export interface TdeRegistrationRequest {
439
457
  }
440
458
 
441
459
  /**
442
- * Result of JIT master password registration process.
460
+ * NewType wrapper for `CollectionId`
443
461
  */
444
- export interface JitMasterPasswordRegistrationResponse {
445
- /**
446
- * The account cryptographic state of the user
447
- */
448
- account_cryptographic_state: WrappedAccountCryptographicState;
449
- /**
450
- * The master password unlock data
451
- */
452
- master_password_unlock: MasterPasswordUnlockData;
453
- /**
454
- * The decrypted user key.
455
- */
456
- user_key: B64;
457
- }
462
+ export type CollectionId = Tagged<Uuid, "CollectionId">;
458
463
 
459
464
  /**
460
- * NewType wrapper for `CollectionId`
465
+ * Type of collection
461
466
  */
462
- export type CollectionId = Tagged<Uuid, "CollectionId">;
467
+ export type CollectionType = "SharedCollection" | "DefaultUserCollection";
463
468
 
464
469
  export interface CollectionView {
465
470
  id: CollectionId | undefined;
@@ -472,11 +477,6 @@ export interface CollectionView {
472
477
  type: CollectionType;
473
478
  }
474
479
 
475
- /**
476
- * Type of collection
477
- */
478
- export type CollectionType = "SharedCollection" | "DefaultUserCollection";
479
-
480
480
  export interface Collection {
481
481
  id: CollectionId | undefined;
482
482
  organizationId: OrganizationId;
@@ -498,19 +498,6 @@ export function isCollectionDecryptError(error: any): error is CollectionDecrypt
498
498
 
499
499
  export type SignedSecurityState = string;
500
500
 
501
- export interface MasterPasswordError extends Error {
502
- name: "MasterPasswordError";
503
- variant:
504
- | "EncryptionKeyMalformed"
505
- | "KdfMalformed"
506
- | "InvalidKdfConfiguration"
507
- | "MissingField"
508
- | "Crypto"
509
- | "WrongPassword";
510
- }
511
-
512
- export function isMasterPasswordError(error: any): error is MasterPasswordError;
513
-
514
501
  /**
515
502
  * Represents the data required to unlock with the master password.
516
503
  */
@@ -529,6 +516,19 @@ export interface MasterPasswordUnlockData {
529
516
  salt: string;
530
517
  }
531
518
 
519
+ export interface MasterPasswordError extends Error {
520
+ name: "MasterPasswordError";
521
+ variant:
522
+ | "EncryptionKeyMalformed"
523
+ | "KdfMalformed"
524
+ | "InvalidKdfConfiguration"
525
+ | "MissingField"
526
+ | "Crypto"
527
+ | "WrongPassword";
528
+ }
529
+
530
+ export function isMasterPasswordError(error: any): error is MasterPasswordError;
531
+
532
532
  /**
533
533
  * Represents the data required to authenticate with the master password.
534
534
  */
@@ -553,13 +553,6 @@ export type WrappedAccountCryptographicState =
553
553
  };
554
554
  };
555
555
 
556
- export interface RotateCryptographyStateError extends Error {
557
- name: "RotateCryptographyStateError";
558
- variant: "KeyMissing" | "InvalidData";
559
- }
560
-
561
- export function isRotateCryptographyStateError(error: any): error is RotateCryptographyStateError;
562
-
563
556
  export interface AccountCryptographyInitializationError extends Error {
564
557
  name: "AccountCryptographyInitializationError";
565
558
  variant:
@@ -575,42 +568,90 @@ export function isAccountCryptographyInitializationError(
575
568
  error: any,
576
569
  ): error is AccountCryptographyInitializationError;
577
570
 
571
+ export interface RotateCryptographyStateError extends Error {
572
+ name: "RotateCryptographyStateError";
573
+ variant: "KeyMissing" | "InvalidData";
574
+ }
575
+
576
+ export function isRotateCryptographyStateError(error: any): error is RotateCryptographyStateError;
577
+
578
578
  /**
579
- * Response for the `make_keys_for_user_crypto_v2`, containing a set of keys for a user
579
+ * Response from the `make_update_password` function
580
580
  */
581
- export interface UserCryptoV2KeysResponse {
581
+ export interface UpdatePasswordResponse {
582
582
  /**
583
- * User key
583
+ * Hash of the new password
584
584
  */
585
- userKey: B64;
585
+ passwordHash: B64;
586
586
  /**
587
- * Wrapped private key
587
+ * User key, encrypted with the new password
588
588
  */
589
- privateKey: EncString;
590
- /**
591
- * Public key
589
+ newKey: EncString;
590
+ }
591
+
592
+ /**
593
+ * Represents the request to initialize the user\'s organizational cryptographic state.
594
+ */
595
+ export interface InitOrgCryptoRequest {
596
+ /**
597
+ * The encryption keys for all the organizations the user is a part of
592
598
  */
593
- publicKey: B64;
599
+ organizationKeys: Map<OrganizationId, UnsignedSharedKey>;
600
+ }
601
+
602
+ export interface CryptoClientError extends Error {
603
+ name: "CryptoClientError";
604
+ variant:
605
+ | "NotAuthenticated"
606
+ | "Crypto"
607
+ | "InvalidKdfSettings"
608
+ | "PasswordProtectedKeyEnvelope"
609
+ | "InvalidPrfInput";
610
+ }
611
+
612
+ export function isCryptoClientError(error: any): error is CryptoClientError;
613
+
614
+ /**
615
+ * Request for deriving a pin protected user key
616
+ */
617
+ export interface EnrollPinResponse {
594
618
  /**
595
- * The user\'s public key, signed by the signing key
619
+ * [UserKey] protected by PIN
596
620
  */
597
- signedPublicKey: SignedPublicKey;
621
+ pinProtectedUserKeyEnvelope: PasswordProtectedKeyEnvelope;
598
622
  /**
599
- * Signing key, encrypted with the user\'s symmetric key
623
+ * PIN protected by [UserKey]
600
624
  */
601
- signingKey: EncString;
625
+ userKeyEncryptedPin: EncString;
626
+ }
627
+
628
+ /**
629
+ * Auth requests supports multiple initialization methods.
630
+ */
631
+ export type AuthRequestMethod =
632
+ | { userKey: { protected_user_key: UnsignedSharedKey } }
633
+ | { masterKey: { protected_master_key: UnsignedSharedKey; auth_request_key: EncString } };
634
+
635
+ /**
636
+ * Request for migrating an account from password to key connector.
637
+ */
638
+ export interface DeriveKeyConnectorRequest {
602
639
  /**
603
- * Base64 encoded verifying key
640
+ * Encrypted user key, used to validate the master key
604
641
  */
605
- verifyingKey: B64;
642
+ userKeyEncrypted: EncString;
606
643
  /**
607
- * The user\'s signed security state
644
+ * The user\'s master password
608
645
  */
609
- securityState: SignedSecurityState;
646
+ password: string;
610
647
  /**
611
- * The security state\'s version
648
+ * The KDF parameters used to derive the master key
612
649
  */
613
- securityVersion: number;
650
+ kdf: Kdf;
651
+ /**
652
+ * The user\'s email address
653
+ */
654
+ email: string;
614
655
  }
615
656
 
616
657
  export interface EnrollAdminPasswordResetError extends Error {
@@ -621,127 +662,57 @@ export interface EnrollAdminPasswordResetError extends Error {
621
662
  export function isEnrollAdminPasswordResetError(error: any): error is EnrollAdminPasswordResetError;
622
663
 
623
664
  /**
624
- * Response from the `update_kdf` function
665
+ * Response for `verify_asymmetric_keys`.
625
666
  */
626
- export interface UpdateKdfResponse {
627
- /**
628
- * The authentication data for the new KDF setting
629
- */
630
- masterPasswordAuthenticationData: MasterPasswordAuthenticationData;
667
+ export interface VerifyAsymmetricKeysResponse {
631
668
  /**
632
- * The unlock data for the new KDF setting
669
+ * Whether the user\'s private key was decryptable by the user key.
633
670
  */
634
- masterPasswordUnlockData: MasterPasswordUnlockData;
671
+ privateKeyDecryptable: boolean;
635
672
  /**
636
- * The authentication data for the KDF setting prior to the change
673
+ * Whether the user\'s private key was a valid RSA key and matched the public key provided.
637
674
  */
638
- oldMasterPasswordAuthenticationData: MasterPasswordAuthenticationData;
675
+ validPrivateKey: boolean;
639
676
  }
640
677
 
641
678
  /**
642
- * Request for deriving a pin protected user key
679
+ * Response for the `make_keys_for_user_crypto_v2`, containing a set of keys for a user
643
680
  */
644
- export interface DerivePinKeyResponse {
681
+ export interface UserCryptoV2KeysResponse {
645
682
  /**
646
- * [UserKey] protected by PIN
683
+ * User key
647
684
  */
648
- pinProtectedUserKey: EncString;
685
+ userKey: B64;
649
686
  /**
650
- * PIN protected by [UserKey]
687
+ * Wrapped private key
651
688
  */
652
- encryptedPin: EncString;
653
- }
654
-
655
- export interface CryptoClientError extends Error {
656
- name: "CryptoClientError";
657
- variant:
658
- | "NotAuthenticated"
659
- | "Crypto"
660
- | "InvalidKdfSettings"
661
- | "PasswordProtectedKeyEnvelope"
662
- | "InvalidPrfInput";
663
- }
664
-
665
- export function isCryptoClientError(error: any): error is CryptoClientError;
666
-
667
- /**
668
- * Request for `verify_asymmetric_keys`.
669
- */
670
- export interface VerifyAsymmetricKeysRequest {
689
+ privateKey: EncString;
671
690
  /**
672
- * The user\'s user key
691
+ * Public key
673
692
  */
674
- userKey: B64;
693
+ publicKey: B64;
675
694
  /**
676
- * The user\'s public key
695
+ * The user\'s public key, signed by the signing key
677
696
  */
678
- userPublicKey: B64;
697
+ signedPublicKey: SignedPublicKey;
679
698
  /**
680
- * User\'s private key, encrypted with the user key
699
+ * Signing key, encrypted with the user\'s symmetric key
681
700
  */
682
- userKeyEncryptedPrivateKey: EncString;
683
- }
684
-
685
- /**
686
- * Response from the `make_key_pair` function
687
- */
688
- export interface MakeKeyPairResponse {
701
+ signingKey: EncString;
689
702
  /**
690
- * The user\'s public key
703
+ * Base64 encoded verifying key
691
704
  */
692
- userPublicKey: B64;
705
+ verifyingKey: B64;
693
706
  /**
694
- * User\'s private key, encrypted with the user key
707
+ * The user\'s signed security state
695
708
  */
696
- userKeyEncryptedPrivateKey: EncString;
697
- }
698
-
699
- /**
700
- * Represents the request to initialize the user\'s organizational cryptographic state.
701
- */
702
- export interface InitOrgCryptoRequest {
709
+ securityState: SignedSecurityState;
703
710
  /**
704
- * The encryption keys for all the organizations the user is a part of
711
+ * The security state\'s version
705
712
  */
706
- organizationKeys: Map<OrganizationId, UnsignedSharedKey>;
707
- }
708
-
709
- /**
710
- * Auth requests supports multiple initialization methods.
711
- */
712
- export type AuthRequestMethod =
713
- | { userKey: { protected_user_key: UnsignedSharedKey } }
714
- | { masterKey: { protected_master_key: UnsignedSharedKey; auth_request_key: EncString } };
715
-
716
- /**
717
- * The crypto method used to initialize the user cryptographic state.
718
- */
719
- export type InitUserCryptoMethod =
720
- | { masterPasswordUnlock: { password: string; master_password_unlock: MasterPasswordUnlockData } }
721
- | { decryptedKey: { decrypted_user_key: string } }
722
- | { pin: { pin: string; pin_protected_user_key: EncString } }
723
- | { pinEnvelope: { pin: string; pin_protected_user_key_envelope: PasswordProtectedKeyEnvelope } }
724
- | { authRequest: { request_private_key: B64; method: AuthRequestMethod } }
725
- | {
726
- deviceKey: {
727
- device_key: string;
728
- protected_device_private_key: EncString;
729
- device_protected_user_key: UnsignedSharedKey;
730
- };
731
- }
732
- | { keyConnector: { master_key: B64; user_key: EncString } };
733
-
734
- export interface MakeKeysError extends Error {
735
- name: "MakeKeysError";
736
- variant:
737
- | "AccountCryptographyInitialization"
738
- | "MasterPasswordDerivation"
739
- | "RequestModelCreation"
740
- | "Crypto";
713
+ securityVersion: number;
741
714
  }
742
715
 
743
- export function isMakeKeysError(error: any): error is MakeKeysError;
744
-
745
716
  /**
746
717
  * State used for initializing the user cryptographic state.
747
718
  */
@@ -770,86 +741,115 @@ export interface InitUserCryptoRequest {
770
741
  }
771
742
 
772
743
  /**
773
- * Request for migrating an account from password to key connector.
744
+ * Response from the `update_kdf` function
774
745
  */
775
- export interface DeriveKeyConnectorRequest {
776
- /**
777
- * Encrypted user key, used to validate the master key
778
- */
779
- userKeyEncrypted: EncString;
746
+ export interface UpdateKdfResponse {
780
747
  /**
781
- * The user\'s master password
748
+ * The authentication data for the new KDF setting
782
749
  */
783
- password: string;
750
+ masterPasswordAuthenticationData: MasterPasswordAuthenticationData;
784
751
  /**
785
- * The KDF parameters used to derive the master key
752
+ * The unlock data for the new KDF setting
786
753
  */
787
- kdf: Kdf;
754
+ masterPasswordUnlockData: MasterPasswordUnlockData;
788
755
  /**
789
- * The user\'s email address
756
+ * The authentication data for the KDF setting prior to the change
790
757
  */
791
- email: string;
758
+ oldMasterPasswordAuthenticationData: MasterPasswordAuthenticationData;
792
759
  }
793
760
 
794
761
  /**
795
- * Request for deriving a pin protected user key
762
+ * Response from the `make_key_pair` function
796
763
  */
797
- export interface EnrollPinResponse {
764
+ export interface MakeKeyPairResponse {
798
765
  /**
799
- * [UserKey] protected by PIN
766
+ * The user\'s public key
800
767
  */
801
- pinProtectedUserKeyEnvelope: PasswordProtectedKeyEnvelope;
768
+ userPublicKey: B64;
802
769
  /**
803
- * PIN protected by [UserKey]
770
+ * User\'s private key, encrypted with the user key
804
771
  */
805
- userKeyEncryptedPin: EncString;
772
+ userKeyEncryptedPrivateKey: EncString;
806
773
  }
807
774
 
808
775
  /**
809
- * Response from the `make_update_password` function
776
+ * Request for deriving a pin protected user key
810
777
  */
811
- export interface UpdatePasswordResponse {
778
+ export interface DerivePinKeyResponse {
812
779
  /**
813
- * Hash of the new password
780
+ * [UserKey] protected by PIN
814
781
  */
815
- passwordHash: B64;
782
+ pinProtectedUserKey: EncString;
816
783
  /**
817
- * User key, encrypted with the new password
784
+ * PIN protected by [UserKey]
818
785
  */
819
- newKey: EncString;
786
+ encryptedPin: EncString;
787
+ }
788
+
789
+ export interface DeriveKeyConnectorError extends Error {
790
+ name: "DeriveKeyConnectorError";
791
+ variant: "WrongPassword" | "Crypto";
792
+ }
793
+
794
+ export function isDeriveKeyConnectorError(error: any): error is DeriveKeyConnectorError;
795
+
796
+ export interface MakeKeysError extends Error {
797
+ name: "MakeKeysError";
798
+ variant:
799
+ | "AccountCryptographyInitialization"
800
+ | "MasterPasswordDerivation"
801
+ | "RequestModelCreation"
802
+ | "Crypto";
820
803
  }
821
804
 
805
+ export function isMakeKeysError(error: any): error is MakeKeysError;
806
+
822
807
  /**
823
- * Response for `verify_asymmetric_keys`.
808
+ * Request for `verify_asymmetric_keys`.
824
809
  */
825
- export interface VerifyAsymmetricKeysResponse {
810
+ export interface VerifyAsymmetricKeysRequest {
826
811
  /**
827
- * Whether the user\'s private key was decryptable by the user key.
812
+ * The user\'s user key
828
813
  */
829
- privateKeyDecryptable: boolean;
814
+ userKey: B64;
830
815
  /**
831
- * Whether the user\'s private key was a valid RSA key and matched the public key provided.
816
+ * The user\'s public key
832
817
  */
833
- validPrivateKey: boolean;
834
- }
835
-
836
- export interface DeriveKeyConnectorError extends Error {
837
- name: "DeriveKeyConnectorError";
838
- variant: "WrongPassword" | "Crypto";
818
+ userPublicKey: B64;
819
+ /**
820
+ * User\'s private key, encrypted with the user key
821
+ */
822
+ userKeyEncryptedPrivateKey: EncString;
839
823
  }
840
824
 
841
- export function isDeriveKeyConnectorError(error: any): error is DeriveKeyConnectorError;
842
-
843
825
  /**
844
- * NewType wrapper for `OrganizationId`
826
+ * The crypto method used to initialize the user cryptographic state.
845
827
  */
846
- export type OrganizationId = Tagged<Uuid, "OrganizationId">;
828
+ export type InitUserCryptoMethod =
829
+ | { masterPasswordUnlock: { password: string; master_password_unlock: MasterPasswordUnlockData } }
830
+ | { decryptedKey: { decrypted_user_key: string } }
831
+ | { pin: { pin: string; pin_protected_user_key: EncString } }
832
+ | { pinEnvelope: { pin: string; pin_protected_user_key_envelope: PasswordProtectedKeyEnvelope } }
833
+ | { authRequest: { request_private_key: B64; method: AuthRequestMethod } }
834
+ | {
835
+ deviceKey: {
836
+ device_key: string;
837
+ protected_device_private_key: EncString;
838
+ device_protected_user_key: UnsignedSharedKey;
839
+ };
840
+ }
841
+ | { keyConnector: { master_key: B64; user_key: EncString } };
847
842
 
848
843
  /**
849
844
  * NewType wrapper for `UserId`
850
845
  */
851
846
  export type UserId = Tagged<Uuid, "UserId">;
852
847
 
848
+ /**
849
+ * NewType wrapper for `OrganizationId`
850
+ */
851
+ export type OrganizationId = Tagged<Uuid, "OrganizationId">;
852
+
853
853
  export interface StatefulCryptoError extends Error {
854
854
  name: "StatefulCryptoError";
855
855
  variant: "MissingSecurityState" | "WrongAccountCryptoVersion" | "Crypto";
@@ -857,6 +857,35 @@ export interface StatefulCryptoError extends Error {
857
857
 
858
858
  export function isStatefulCryptoError(error: any): error is StatefulCryptoError;
859
859
 
860
+ export type DeviceType =
861
+ | "Android"
862
+ | "iOS"
863
+ | "ChromeExtension"
864
+ | "FirefoxExtension"
865
+ | "OperaExtension"
866
+ | "EdgeExtension"
867
+ | "WindowsDesktop"
868
+ | "MacOsDesktop"
869
+ | "LinuxDesktop"
870
+ | "ChromeBrowser"
871
+ | "FirefoxBrowser"
872
+ | "OperaBrowser"
873
+ | "EdgeBrowser"
874
+ | "IEBrowser"
875
+ | "UnknownBrowser"
876
+ | "AndroidAmazon"
877
+ | "UWP"
878
+ | "SafariBrowser"
879
+ | "VivaldiBrowser"
880
+ | "VivaldiExtension"
881
+ | "SafariExtension"
882
+ | "SDK"
883
+ | "Server"
884
+ | "WindowsCLI"
885
+ | "MacOsCLI"
886
+ | "LinuxCLI"
887
+ | "DuckDuckGoBrowser";
888
+
860
889
  /**
861
890
  * Basic client behavior settings. These settings specify the various targets and behavior of the
862
891
  * Bitwarden Client. They are optional and uneditable once the client is initialized.
@@ -909,35 +938,6 @@ export interface ClientSettings {
909
938
  bitwardenPackageType?: string | undefined;
910
939
  }
911
940
 
912
- export type DeviceType =
913
- | "Android"
914
- | "iOS"
915
- | "ChromeExtension"
916
- | "FirefoxExtension"
917
- | "OperaExtension"
918
- | "EdgeExtension"
919
- | "WindowsDesktop"
920
- | "MacOsDesktop"
921
- | "LinuxDesktop"
922
- | "ChromeBrowser"
923
- | "FirefoxBrowser"
924
- | "OperaBrowser"
925
- | "EdgeBrowser"
926
- | "IEBrowser"
927
- | "UnknownBrowser"
928
- | "AndroidAmazon"
929
- | "UWP"
930
- | "SafariBrowser"
931
- | "VivaldiBrowser"
932
- | "VivaldiExtension"
933
- | "SafariExtension"
934
- | "SDK"
935
- | "Server"
936
- | "WindowsCLI"
937
- | "MacOsCLI"
938
- | "LinuxCLI"
939
- | "DuckDuckGoBrowser";
940
-
941
941
  export interface EncryptionSettingsError extends Error {
942
942
  name: "EncryptionSettingsError";
943
943
  variant:
@@ -1089,6 +1089,8 @@ export interface ExportError extends Error {
1089
1089
 
1090
1090
  export function isExportError(error: any): error is ExportError;
1091
1091
 
1092
+ export type PassphraseError = { InvalidNumWords: { minimum: number; maximum: number } };
1093
+
1092
1094
  /**
1093
1095
  * Passphrase generator request options.
1094
1096
  */
@@ -1113,7 +1115,12 @@ export interface PassphraseGeneratorRequest {
1113
1115
  includeNumber: boolean;
1114
1116
  }
1115
1117
 
1116
- export type PassphraseError = { InvalidNumWords: { minimum: number; maximum: number } };
1118
+ export interface PasswordError extends Error {
1119
+ name: "PasswordError";
1120
+ variant: "NoCharacterSetEnabled" | "InvalidLength";
1121
+ }
1122
+
1123
+ export function isPasswordError(error: any): error is PasswordError;
1117
1124
 
1118
1125
  /**
1119
1126
  * Password generator request options.
@@ -1167,19 +1174,6 @@ export interface PasswordGeneratorRequest {
1167
1174
  minSpecial: number | undefined;
1168
1175
  }
1169
1176
 
1170
- export interface PasswordError extends Error {
1171
- name: "PasswordError";
1172
- variant: "NoCharacterSetEnabled" | "InvalidLength";
1173
- }
1174
-
1175
- export function isPasswordError(error: any): error is PasswordError;
1176
-
1177
- export type UsernameGeneratorRequest =
1178
- | { word: { capitalize: boolean; include_number: boolean } }
1179
- | { subaddress: { type: AppendType; email: string } }
1180
- | { catchall: { type: AppendType; domain: string } }
1181
- | { forwarded: { service: ForwarderServiceType; website: string | undefined } };
1182
-
1183
1177
  /**
1184
1178
  * Configures the email forwarding service to use.
1185
1179
  * For instructions on how to configure each service, see the documentation:
@@ -1193,8 +1187,6 @@ export type ForwarderServiceType =
1193
1187
  | { forwardEmail: { api_token: string; domain: string } }
1194
1188
  | { simpleLogin: { api_key: string; base_url: string } };
1195
1189
 
1196
- export type AppendType = "random" | { websiteName: { website: string } };
1197
-
1198
1190
  export interface UsernameError extends Error {
1199
1191
  name: "UsernameError";
1200
1192
  variant: "InvalidApiKey" | "Unknown" | "ResponseContent" | "Reqwest";
@@ -1202,6 +1194,14 @@ export interface UsernameError extends Error {
1202
1194
 
1203
1195
  export function isUsernameError(error: any): error is UsernameError;
1204
1196
 
1197
+ export type UsernameGeneratorRequest =
1198
+ | { word: { capitalize: boolean; include_number: boolean } }
1199
+ | { subaddress: { type: AppendType; email: string } }
1200
+ | { catchall: { type: AppendType; domain: string } }
1201
+ | { forwarded: { service: ForwarderServiceType; website: string | undefined } };
1202
+
1203
+ export type AppendType = "random" | { websiteName: { website: string } };
1204
+
1205
1205
  export interface ReceiveError extends Error {
1206
1206
  name: "ReceiveError";
1207
1207
  variant: "Channel" | "Timeout" | "Cancelled";
@@ -1345,13 +1345,6 @@ export interface SshKeyExportError extends Error {
1345
1345
 
1346
1346
  export function isSshKeyExportError(error: any): error is SshKeyExportError;
1347
1347
 
1348
- export interface SshKeyImportError extends Error {
1349
- name: "SshKeyImportError";
1350
- variant: "Parsing" | "PasswordRequired" | "WrongPassword" | "UnsupportedKeyType";
1351
- }
1352
-
1353
- export function isSshKeyImportError(error: any): error is SshKeyImportError;
1354
-
1355
1348
  export interface KeyGenerationError extends Error {
1356
1349
  name: "KeyGenerationError";
1357
1350
  variant: "KeyGeneration" | "KeyConversion";
@@ -1359,6 +1352,13 @@ export interface KeyGenerationError extends Error {
1359
1352
 
1360
1353
  export function isKeyGenerationError(error: any): error is KeyGenerationError;
1361
1354
 
1355
+ export interface SshKeyImportError extends Error {
1356
+ name: "SshKeyImportError";
1357
+ variant: "Parsing" | "PasswordRequired" | "WrongPassword" | "UnsupportedKeyType";
1358
+ }
1359
+
1360
+ export function isSshKeyImportError(error: any): error is SshKeyImportError;
1361
+
1362
1362
  export type KeyAlgorithm = "Ed25519" | "Rsa3072" | "Rsa4096";
1363
1363
 
1364
1364
  export interface DatabaseError extends Error {
@@ -1389,9 +1389,33 @@ export interface CipherRiskError extends Error {
1389
1389
  export function isCipherRiskError(error: any): error is CipherRiskError;
1390
1390
 
1391
1391
  /**
1392
- * Password reuse map wrapper for WASM compatibility.
1392
+ * Result of checking password exposure via HIBP API.
1393
1393
  */
1394
- export type PasswordReuseMap = Record<string, number>;
1394
+ export type ExposedPasswordResult =
1395
+ | { type: "NotChecked" }
1396
+ | { type: "Found"; value: number }
1397
+ | { type: "Error"; value: string };
1398
+
1399
+ /**
1400
+ * Options for configuring risk computation.
1401
+ */
1402
+ export interface CipherRiskOptions {
1403
+ /**
1404
+ * Pre-computed password reuse map (password → count).
1405
+ * If provided, enables reuse detection across ciphers.
1406
+ */
1407
+ passwordMap?: PasswordReuseMap | undefined;
1408
+ /**
1409
+ * Whether to check passwords against Have I Been Pwned API.
1410
+ * When true, makes network requests to check for exposed passwords.
1411
+ */
1412
+ checkExposed?: boolean;
1413
+ /**
1414
+ * Optional HIBP API base URL override. When None, uses the production HIBP URL.
1415
+ * Can be used for testing or alternative password breach checking services.
1416
+ */
1417
+ hibpBaseUrl?: string | undefined;
1418
+ }
1395
1419
 
1396
1420
  /**
1397
1421
  * Login cipher data needed for risk evaluation.
@@ -1439,32 +1463,13 @@ export interface CipherRiskResult {
1439
1463
  }
1440
1464
 
1441
1465
  /**
1442
- * Result of checking password exposure via HIBP API.
1466
+ * Password reuse map wrapper for WASM compatibility.
1443
1467
  */
1444
- export type ExposedPasswordResult =
1445
- | { type: "NotChecked" }
1446
- | { type: "Found"; value: number }
1447
- | { type: "Error"; value: string };
1468
+ export type PasswordReuseMap = Record<string, number>;
1448
1469
 
1449
- /**
1450
- * Options for configuring risk computation.
1451
- */
1452
- export interface CipherRiskOptions {
1453
- /**
1454
- * Pre-computed password reuse map (password → count).
1455
- * If provided, enables reuse detection across ciphers.
1456
- */
1457
- passwordMap?: PasswordReuseMap | undefined;
1458
- /**
1459
- * Whether to check passwords against Have I Been Pwned API.
1460
- * When true, makes network requests to check for exposed passwords.
1461
- */
1462
- checkExposed?: boolean;
1463
- /**
1464
- * Optional HIBP API base URL override. When None, uses the production HIBP URL.
1465
- * Can be used for testing or alternative password breach checking services.
1466
- */
1467
- hibpBaseUrl?: string | undefined;
1470
+ export interface PasswordHistory {
1471
+ password: EncString;
1472
+ lastUsedDate: DateTime<Utc>;
1468
1473
  }
1469
1474
 
1470
1475
  export interface PasswordHistoryView {
@@ -1472,11 +1477,6 @@ export interface PasswordHistoryView {
1472
1477
  lastUsedDate: DateTime<Utc>;
1473
1478
  }
1474
1479
 
1475
- export interface PasswordHistory {
1476
- password: EncString;
1477
- lastUsedDate: DateTime<Utc>;
1478
- }
1479
-
1480
1480
  export interface AncestorMap {
1481
1481
  ancestors: Map<CollectionId, string>;
1482
1482
  }
@@ -1499,13 +1499,6 @@ export interface TotpError extends Error {
1499
1499
 
1500
1500
  export function isTotpError(error: any): error is TotpError;
1501
1501
 
1502
- export interface DecryptError extends Error {
1503
- name: "DecryptError";
1504
- variant: "Crypto";
1505
- }
1506
-
1507
- export function isDecryptError(error: any): error is DecryptError;
1508
-
1509
1502
  export interface EncryptError extends Error {
1510
1503
  name: "EncryptError";
1511
1504
  variant: "Crypto" | "MissingUserId";
@@ -1513,6 +1506,13 @@ export interface EncryptError extends Error {
1513
1506
 
1514
1507
  export function isEncryptError(error: any): error is EncryptError;
1515
1508
 
1509
+ export interface DecryptError extends Error {
1510
+ name: "DecryptError";
1511
+ variant: "Crypto";
1512
+ }
1513
+
1514
+ export function isDecryptError(error: any): error is DecryptError;
1515
+
1516
1516
  export interface Attachment {
1517
1517
  id: string | undefined;
1518
1518
  url: string | undefined;
@@ -1572,6 +1572,21 @@ export interface GetCipherError extends Error {
1572
1572
 
1573
1573
  export function isGetCipherError(error: any): error is GetCipherError;
1574
1574
 
1575
+ export interface EditCipherError extends Error {
1576
+ name: "EditCipherError";
1577
+ variant:
1578
+ | "ItemNotFound"
1579
+ | "Crypto"
1580
+ | "Api"
1581
+ | "VaultParse"
1582
+ | "MissingField"
1583
+ | "NotAuthenticated"
1584
+ | "Repository"
1585
+ | "Uuid";
1586
+ }
1587
+
1588
+ export function isEditCipherError(error: any): error is EditCipherError;
1589
+
1575
1590
  /**
1576
1591
  * Request to edit a cipher.
1577
1592
  */
@@ -1591,21 +1606,6 @@ export interface CipherEditRequest {
1591
1606
  key: EncString | undefined;
1592
1607
  }
1593
1608
 
1594
- export interface EditCipherError extends Error {
1595
- name: "EditCipherError";
1596
- variant:
1597
- | "ItemNotFound"
1598
- | "Crypto"
1599
- | "Api"
1600
- | "VaultParse"
1601
- | "MissingField"
1602
- | "NotAuthenticated"
1603
- | "Repository"
1604
- | "Uuid";
1605
- }
1606
-
1607
- export function isEditCipherError(error: any): error is EditCipherError;
1608
-
1609
1609
  export interface GetOrganizationCiphersAdminError extends Error {
1610
1610
  name: "GetOrganizationCiphersAdminError";
1611
1611
  variant: "Crypto" | "VaultParse" | "Api";
@@ -1652,13 +1652,6 @@ export interface RestoreCipherAdminError extends Error {
1652
1652
 
1653
1653
  export function isRestoreCipherAdminError(error: any): error is RestoreCipherAdminError;
1654
1654
 
1655
- export interface CreateCipherError extends Error {
1656
- name: "CreateCipherError";
1657
- variant: "Crypto" | "Api" | "VaultParse" | "MissingField" | "NotAuthenticated" | "Repository";
1658
- }
1659
-
1660
- export function isCreateCipherError(error: any): error is CreateCipherError;
1661
-
1662
1655
  /**
1663
1656
  * Request to add a cipher.
1664
1657
  */
@@ -1674,6 +1667,13 @@ export interface CipherCreateRequest {
1674
1667
  fields: FieldView[];
1675
1668
  }
1676
1669
 
1670
+ export interface CreateCipherError extends Error {
1671
+ name: "CreateCipherError";
1672
+ variant: "Crypto" | "Api" | "VaultParse" | "MissingField" | "NotAuthenticated" | "Repository";
1673
+ }
1674
+
1675
+ export function isCreateCipherError(error: any): error is CreateCipherError;
1676
+
1677
1677
  export interface DeleteCipherError extends Error {
1678
1678
  name: "DeleteCipherError";
1679
1679
  variant: "Api" | "Repository";
@@ -1717,6 +1717,15 @@ export interface CipherPermissions {
1717
1717
  restore: boolean;
1718
1718
  }
1719
1719
 
1720
+ export interface Card {
1721
+ cardholderName: EncString | undefined;
1722
+ expMonth: EncString | undefined;
1723
+ expYear: EncString | undefined;
1724
+ code: EncString | undefined;
1725
+ brand: EncString | undefined;
1726
+ number: EncString | undefined;
1727
+ }
1728
+
1720
1729
  /**
1721
1730
  * Minimal CardView only including the needed details for list views
1722
1731
  */
@@ -1727,15 +1736,6 @@ export interface CardListView {
1727
1736
  brand: string | undefined;
1728
1737
  }
1729
1738
 
1730
- export interface Card {
1731
- cardholderName: EncString | undefined;
1732
- expMonth: EncString | undefined;
1733
- expYear: EncString | undefined;
1734
- code: EncString | undefined;
1735
- brand: EncString | undefined;
1736
- number: EncString | undefined;
1737
- }
1738
-
1739
1739
  export interface CardView {
1740
1740
  cardholderName: string | undefined;
1741
1741
  expMonth: string | undefined;
@@ -1759,41 +1759,22 @@ export interface Field {
1759
1759
  linkedId: LinkedIdType | undefined;
1760
1760
  }
1761
1761
 
1762
- export interface Fido2CredentialNewView {
1763
- credentialId: string;
1764
- keyType: string;
1765
- keyAlgorithm: string;
1766
- keyCurve: string;
1767
- rpId: string;
1768
- userHandle: string | undefined;
1769
- userName: string | undefined;
1770
- counter: string;
1771
- rpName: string | undefined;
1772
- userDisplayName: string | undefined;
1762
+ export interface Fido2Credential {
1763
+ credentialId: EncString;
1764
+ keyType: EncString;
1765
+ keyAlgorithm: EncString;
1766
+ keyCurve: EncString;
1767
+ keyValue: EncString;
1768
+ rpId: EncString;
1769
+ userHandle: EncString | undefined;
1770
+ userName: EncString | undefined;
1771
+ counter: EncString;
1772
+ rpName: EncString | undefined;
1773
+ userDisplayName: EncString | undefined;
1774
+ discoverable: EncString;
1773
1775
  creationDate: DateTime<Utc>;
1774
1776
  }
1775
1777
 
1776
- export interface Fido2CredentialListView {
1777
- credentialId: string;
1778
- rpId: string;
1779
- userHandle: string | undefined;
1780
- userName: string | undefined;
1781
- userDisplayName: string | undefined;
1782
- counter: string;
1783
- }
1784
-
1785
- export interface LoginUri {
1786
- uri: EncString | undefined;
1787
- match: UriMatchType | undefined;
1788
- uriChecksum: EncString | undefined;
1789
- }
1790
-
1791
- export interface LoginUriView {
1792
- uri: string | undefined;
1793
- match: UriMatchType | undefined;
1794
- uriChecksum: string | undefined;
1795
- }
1796
-
1797
1778
  export interface Fido2CredentialView {
1798
1779
  credentialId: string;
1799
1780
  keyType: string;
@@ -1820,31 +1801,24 @@ export interface LoginView {
1820
1801
  fido2Credentials: Fido2Credential[] | undefined;
1821
1802
  }
1822
1803
 
1823
- export interface LoginListView {
1824
- fido2Credentials: Fido2CredentialListView[] | undefined;
1825
- hasFido2: boolean;
1826
- username: string | undefined;
1827
- /**
1828
- * The TOTP key is not decrypted. Useable as is with [`crate::generate_totp_cipher_view`].
1829
- */
1830
- totp: EncString | undefined;
1831
- uris: LoginUriView[] | undefined;
1804
+ export interface Fido2CredentialListView {
1805
+ credentialId: string;
1806
+ rpId: string;
1807
+ userHandle: string | undefined;
1808
+ userName: string | undefined;
1809
+ userDisplayName: string | undefined;
1810
+ counter: string;
1832
1811
  }
1833
-
1834
- export interface Fido2Credential {
1835
- credentialId: EncString;
1836
- keyType: EncString;
1837
- keyAlgorithm: EncString;
1838
- keyCurve: EncString;
1839
- keyValue: EncString;
1840
- rpId: EncString;
1841
- userHandle: EncString | undefined;
1842
- userName: EncString | undefined;
1843
- counter: EncString;
1844
- rpName: EncString | undefined;
1845
- userDisplayName: EncString | undefined;
1846
- discoverable: EncString;
1847
- creationDate: DateTime<Utc>;
1812
+
1813
+ export interface LoginListView {
1814
+ fido2Credentials: Fido2CredentialListView[] | undefined;
1815
+ hasFido2: boolean;
1816
+ username: string | undefined;
1817
+ /**
1818
+ * The TOTP key is not decrypted. Useable as is with [`crate::generate_totp_cipher_view`].
1819
+ */
1820
+ totp: EncString | undefined;
1821
+ uris: LoginUriView[] | undefined;
1848
1822
  }
1849
1823
 
1850
1824
  export interface Login {
@@ -1873,10 +1847,48 @@ export interface Fido2CredentialFullView {
1873
1847
  creationDate: DateTime<Utc>;
1874
1848
  }
1875
1849
 
1876
- /**
1877
- * NewType wrapper for `CipherId`
1878
- */
1879
- export type CipherId = Tagged<Uuid, "CipherId">;
1850
+ export interface LoginUri {
1851
+ uri: EncString | undefined;
1852
+ match: UriMatchType | undefined;
1853
+ uriChecksum: EncString | undefined;
1854
+ }
1855
+
1856
+ export interface LoginUriView {
1857
+ uri: string | undefined;
1858
+ match: UriMatchType | undefined;
1859
+ uriChecksum: string | undefined;
1860
+ }
1861
+
1862
+ export interface Fido2CredentialNewView {
1863
+ credentialId: string;
1864
+ keyType: string;
1865
+ keyAlgorithm: string;
1866
+ keyCurve: string;
1867
+ rpId: string;
1868
+ userHandle: string | undefined;
1869
+ userName: string | undefined;
1870
+ counter: string;
1871
+ rpName: string | undefined;
1872
+ userDisplayName: string | undefined;
1873
+ creationDate: DateTime<Utc>;
1874
+ }
1875
+
1876
+ export interface CipherError extends Error {
1877
+ name: "CipherError";
1878
+ variant:
1879
+ | "MissingField"
1880
+ | "Crypto"
1881
+ | "Decrypt"
1882
+ | "Encrypt"
1883
+ | "AttachmentsWithoutKeys"
1884
+ | "OrganizationAlreadySet"
1885
+ | "Repository"
1886
+ | "Chrono"
1887
+ | "SerdeJson"
1888
+ | "Api";
1889
+ }
1890
+
1891
+ export function isCipherError(error: any): error is CipherError;
1880
1892
 
1881
1893
  export interface CipherListView {
1882
1894
  id: CipherId | undefined;
@@ -1916,110 +1928,103 @@ export interface CipherListView {
1916
1928
  }
1917
1929
 
1918
1930
  /**
1919
- * Represents the result of decrypting a list of ciphers.
1920
- *
1921
- * This struct contains two vectors: `successes` and `failures`.
1922
- * `successes` contains the decrypted `CipherListView` objects,
1923
- * while `failures` contains the original `Cipher` objects that failed to decrypt.
1931
+ * NewType wrapper for `CipherId`
1924
1932
  */
1925
- export interface DecryptCipherListResult {
1926
- /**
1927
- * The decrypted `CipherListView` objects.
1928
- */
1929
- successes: CipherListView[];
1930
- /**
1931
- * The original `Cipher` objects that failed to decrypt.
1932
- */
1933
- failures: Cipher[];
1934
- }
1933
+ export type CipherId = Tagged<Uuid, "CipherId">;
1935
1934
 
1936
- export interface CipherError extends Error {
1937
- name: "CipherError";
1938
- variant:
1939
- | "MissingField"
1940
- | "Crypto"
1941
- | "Decrypt"
1942
- | "Encrypt"
1943
- | "AttachmentsWithoutKeys"
1944
- | "OrganizationAlreadySet"
1945
- | "Repository"
1946
- | "Chrono"
1947
- | "SerdeJson"
1948
- | "Api";
1949
- }
1935
+ export type CipherListViewType =
1936
+ | { login: LoginListView }
1937
+ | "secureNote"
1938
+ | { card: CardListView }
1939
+ | "identity"
1940
+ | "sshKey";
1950
1941
 
1951
- export function isCipherError(error: any): error is CipherError;
1942
+ /**
1943
+ * Available fields on a cipher and can be copied from a the list view in the UI.
1944
+ */
1945
+ export type CopyableCipherFields =
1946
+ | "LoginUsername"
1947
+ | "LoginPassword"
1948
+ | "LoginTotp"
1949
+ | "CardNumber"
1950
+ | "CardSecurityCode"
1951
+ | "IdentityUsername"
1952
+ | "IdentityEmail"
1953
+ | "IdentityPhone"
1954
+ | "IdentityAddress"
1955
+ | "SshKey"
1956
+ | "SecureNotes";
1952
1957
 
1953
- export interface CipherView {
1958
+ export interface Cipher {
1954
1959
  id: CipherId | undefined;
1955
1960
  organizationId: OrganizationId | undefined;
1956
1961
  folderId: FolderId | undefined;
1957
1962
  collectionIds: CollectionId[];
1958
1963
  /**
1959
- * Temporary, required to support re-encrypting existing items.
1964
+ * More recent ciphers uses individual encryption keys to encrypt the other fields of the
1965
+ * Cipher.
1960
1966
  */
1961
1967
  key: EncString | undefined;
1962
- name: string;
1963
- notes: string | undefined;
1968
+ name: EncString;
1969
+ notes: EncString | undefined;
1964
1970
  type: CipherType;
1965
- login: LoginView | undefined;
1966
- identity: IdentityView | undefined;
1967
- card: CardView | undefined;
1968
- secureNote: SecureNoteView | undefined;
1969
- sshKey: SshKeyView | undefined;
1971
+ login: Login | undefined;
1972
+ identity: Identity | undefined;
1973
+ card: Card | undefined;
1974
+ secureNote: SecureNote | undefined;
1975
+ sshKey: SshKey | undefined;
1970
1976
  favorite: boolean;
1971
1977
  reprompt: CipherRepromptType;
1972
1978
  organizationUseTotp: boolean;
1973
1979
  edit: boolean;
1974
1980
  permissions: CipherPermissions | undefined;
1975
1981
  viewPassword: boolean;
1976
- localData: LocalDataView | undefined;
1977
- attachments: AttachmentView[] | undefined;
1978
- /**
1979
- * Attachments that failed to decrypt. Only present when there are decryption failures.
1980
- */
1981
- attachmentDecryptionFailures?: AttachmentView[];
1982
- fields: FieldView[] | undefined;
1983
- passwordHistory: PasswordHistoryView[] | undefined;
1982
+ localData: LocalData | undefined;
1983
+ attachments: Attachment[] | undefined;
1984
+ fields: Field[] | undefined;
1985
+ passwordHistory: PasswordHistory[] | undefined;
1984
1986
  creationDate: DateTime<Utc>;
1985
1987
  deletedDate: DateTime<Utc> | undefined;
1986
1988
  revisionDate: DateTime<Utc>;
1987
1989
  archivedDate: DateTime<Utc> | undefined;
1990
+ data: string | undefined;
1988
1991
  }
1989
1992
 
1990
- export interface Cipher {
1993
+ export interface CipherView {
1991
1994
  id: CipherId | undefined;
1992
1995
  organizationId: OrganizationId | undefined;
1993
1996
  folderId: FolderId | undefined;
1994
1997
  collectionIds: CollectionId[];
1995
1998
  /**
1996
- * More recent ciphers uses individual encryption keys to encrypt the other fields of the
1997
- * Cipher.
1999
+ * Temporary, required to support re-encrypting existing items.
1998
2000
  */
1999
2001
  key: EncString | undefined;
2000
- name: EncString;
2001
- notes: EncString | undefined;
2002
+ name: string;
2003
+ notes: string | undefined;
2002
2004
  type: CipherType;
2003
- login: Login | undefined;
2004
- identity: Identity | undefined;
2005
- card: Card | undefined;
2006
- secureNote: SecureNote | undefined;
2007
- sshKey: SshKey | undefined;
2005
+ login: LoginView | undefined;
2006
+ identity: IdentityView | undefined;
2007
+ card: CardView | undefined;
2008
+ secureNote: SecureNoteView | undefined;
2009
+ sshKey: SshKeyView | undefined;
2008
2010
  favorite: boolean;
2009
2011
  reprompt: CipherRepromptType;
2010
2012
  organizationUseTotp: boolean;
2011
2013
  edit: boolean;
2012
2014
  permissions: CipherPermissions | undefined;
2013
2015
  viewPassword: boolean;
2014
- localData: LocalData | undefined;
2015
- attachments: Attachment[] | undefined;
2016
- fields: Field[] | undefined;
2017
- passwordHistory: PasswordHistory[] | undefined;
2016
+ localData: LocalDataView | undefined;
2017
+ attachments: AttachmentView[] | undefined;
2018
+ /**
2019
+ * Attachments that failed to decrypt. Only present when there are decryption failures.
2020
+ */
2021
+ attachmentDecryptionFailures?: AttachmentView[];
2022
+ fields: FieldView[] | undefined;
2023
+ passwordHistory: PasswordHistoryView[] | undefined;
2018
2024
  creationDate: DateTime<Utc>;
2019
2025
  deletedDate: DateTime<Utc> | undefined;
2020
2026
  revisionDate: DateTime<Utc>;
2021
2027
  archivedDate: DateTime<Utc> | undefined;
2022
- data: string | undefined;
2023
2028
  }
2024
2029
 
2025
2030
  export interface EncryptionContext {
@@ -2031,57 +2036,52 @@ export interface EncryptionContext {
2031
2036
  cipher: Cipher;
2032
2037
  }
2033
2038
 
2034
- export type CipherListViewType =
2035
- | { login: LoginListView }
2036
- | "secureNote"
2037
- | { card: CardListView }
2038
- | "identity"
2039
- | "sshKey";
2040
-
2041
2039
  /**
2042
- * Available fields on a cipher and can be copied from a the list view in the UI.
2040
+ * Represents the result of decrypting a list of ciphers.
2041
+ *
2042
+ * This struct contains two vectors: `successes` and `failures`.
2043
+ * `successes` contains the decrypted `CipherListView` objects,
2044
+ * while `failures` contains the original `Cipher` objects that failed to decrypt.
2043
2045
  */
2044
- export type CopyableCipherFields =
2045
- | "LoginUsername"
2046
- | "LoginPassword"
2047
- | "LoginTotp"
2048
- | "CardNumber"
2049
- | "CardSecurityCode"
2050
- | "IdentityUsername"
2051
- | "IdentityEmail"
2052
- | "IdentityPhone"
2053
- | "IdentityAddress"
2054
- | "SshKey"
2055
- | "SecureNotes";
2046
+ export interface DecryptCipherListResult {
2047
+ /**
2048
+ * The decrypted `CipherListView` objects.
2049
+ */
2050
+ successes: CipherListView[];
2051
+ /**
2052
+ * The original `Cipher` objects that failed to decrypt.
2053
+ */
2054
+ failures: Cipher[];
2055
+ }
2056
2056
 
2057
- export interface SshKey {
2057
+ export interface SshKeyView {
2058
2058
  /**
2059
2059
  * SSH private key (ed25519/rsa) in unencrypted openssh private key format [OpenSSH private key](https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key)
2060
2060
  */
2061
- privateKey: EncString;
2061
+ privateKey: string;
2062
2062
  /**
2063
2063
  * SSH public key (ed25519/rsa) according to [RFC4253](https://datatracker.ietf.org/doc/html/rfc4253#section-6.6)
2064
2064
  */
2065
- publicKey: EncString;
2065
+ publicKey: string;
2066
2066
  /**
2067
2067
  * SSH fingerprint using SHA256 in the format: `SHA256:BASE64_ENCODED_FINGERPRINT`
2068
2068
  */
2069
- fingerprint: EncString;
2069
+ fingerprint: string;
2070
2070
  }
2071
2071
 
2072
- export interface SshKeyView {
2072
+ export interface SshKey {
2073
2073
  /**
2074
2074
  * SSH private key (ed25519/rsa) in unencrypted openssh private key format [OpenSSH private key](https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key)
2075
2075
  */
2076
- privateKey: string;
2076
+ privateKey: EncString;
2077
2077
  /**
2078
2078
  * SSH public key (ed25519/rsa) according to [RFC4253](https://datatracker.ietf.org/doc/html/rfc4253#section-6.6)
2079
2079
  */
2080
- publicKey: string;
2080
+ publicKey: EncString;
2081
2081
  /**
2082
2082
  * SSH fingerprint using SHA256 in the format: `SHA256:BASE64_ENCODED_FINGERPRINT`
2083
2083
  */
2084
- fingerprint: string;
2084
+ fingerprint: EncString;
2085
2085
  }
2086
2086
 
2087
2087
  export interface Identity {
@@ -2128,23 +2128,23 @@ export interface IdentityView {
2128
2128
 
2129
2129
  export type LinkedIdType = LoginLinkedIdType | CardLinkedIdType | IdentityLinkedIdType;
2130
2130
 
2131
- /**
2132
- * NewType wrapper for `FolderId`
2133
- */
2134
- export type FolderId = Tagged<Uuid, "FolderId">;
2135
-
2136
- export interface Folder {
2131
+ export interface FolderView {
2137
2132
  id: FolderId | undefined;
2138
- name: EncString;
2133
+ name: string;
2139
2134
  revisionDate: DateTime<Utc>;
2140
2135
  }
2141
2136
 
2142
- export interface FolderView {
2137
+ export interface Folder {
2143
2138
  id: FolderId | undefined;
2144
- name: string;
2139
+ name: EncString;
2145
2140
  revisionDate: DateTime<Utc>;
2146
2141
  }
2147
2142
 
2143
+ /**
2144
+ * NewType wrapper for `FolderId`
2145
+ */
2146
+ export type FolderId = Tagged<Uuid, "FolderId">;
2147
+
2148
2148
  export interface EditFolderError extends Error {
2149
2149
  name: "EditFolderError";
2150
2150
  variant:
@@ -2159,6 +2159,13 @@ export interface EditFolderError extends Error {
2159
2159
 
2160
2160
  export function isEditFolderError(error: any): error is EditFolderError;
2161
2161
 
2162
+ export interface CreateFolderError extends Error {
2163
+ name: "CreateFolderError";
2164
+ variant: "Crypto" | "Api" | "VaultParse" | "MissingField" | "Repository";
2165
+ }
2166
+
2167
+ export function isCreateFolderError(error: any): error is CreateFolderError;
2168
+
2162
2169
  /**
2163
2170
  * Request to add or edit a folder.
2164
2171
  */
@@ -2169,13 +2176,6 @@ export interface FolderAddEditRequest {
2169
2176
  name: string;
2170
2177
  }
2171
2178
 
2172
- export interface CreateFolderError extends Error {
2173
- name: "CreateFolderError";
2174
- variant: "Crypto" | "Api" | "VaultParse" | "MissingField" | "Repository";
2175
- }
2176
-
2177
- export function isCreateFolderError(error: any): error is CreateFolderError;
2178
-
2179
2179
  export interface GetFolderError extends Error {
2180
2180
  name: "GetFolderError";
2181
2181
  variant: "ItemNotFound" | "Crypto" | "Repository";