@bitwarden/sdk-internal 0.2.0-main.500 → 0.2.0-main.502

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.
@@ -180,32 +180,44 @@ export interface TokenProvider {
180
180
  get_access_token(): Promise<string | undefined>;
181
181
  }
182
182
 
183
- /**
184
- * Active feature flags for the SDK.
185
- */
186
- export interface FeatureFlags extends Map<string, boolean> {}
183
+ export interface IndexedDbConfiguration {
184
+ db_name: string;
185
+ }
187
186
 
188
187
  export interface Repositories {
189
188
  cipher: Repository<Cipher> | null;
190
189
  folder: Repository<Folder> | null;
191
190
  }
192
191
 
193
- export interface IndexedDbConfiguration {
194
- db_name: string;
192
+ /**
193
+ * Active feature flags for the SDK.
194
+ */
195
+ export interface FeatureFlags extends Map<string, boolean> {}
196
+
197
+ /**
198
+ * Credentials for sending password secured access requests.
199
+ * Clone auto implements the standard lib\'s Clone trait, allowing us to create copies of this
200
+ * struct.
201
+ */
202
+ export interface SendPasswordCredentials {
203
+ /**
204
+ * A Base64-encoded hash of the password protecting the send.
205
+ */
206
+ passwordHashB64: string;
195
207
  }
196
208
 
197
209
  /**
198
- * Credentials for getting a send access token using an email and OTP.
210
+ * A request structure for requesting a send access token from the API.
199
211
  */
200
- export interface SendEmailOtpCredentials {
212
+ export interface SendAccessTokenRequest {
201
213
  /**
202
- * The email address to which the OTP will be sent.
214
+ * The id of the send for which the access token is requested.
203
215
  */
204
- email: string;
216
+ sendId: string;
205
217
  /**
206
- * The one-time password (OTP) that the user has received via email.
218
+ * The optional send access credentials.
207
219
  */
208
- otp: string;
220
+ sendAccessCredentials?: SendAccessCredentials;
209
221
  }
210
222
 
211
223
  /**
@@ -228,29 +240,17 @@ export interface SendEmailCredentials {
228
240
  }
229
241
 
230
242
  /**
231
- * Credentials for sending password secured access requests.
232
- * Clone auto implements the standard lib\'s Clone trait, allowing us to create copies of this
233
- * struct.
234
- */
235
- export interface SendPasswordCredentials {
236
- /**
237
- * A Base64-encoded hash of the password protecting the send.
238
- */
239
- passwordHashB64: string;
240
- }
241
-
242
- /**
243
- * A request structure for requesting a send access token from the API.
243
+ * Credentials for getting a send access token using an email and OTP.
244
244
  */
245
- export interface SendAccessTokenRequest {
245
+ export interface SendEmailOtpCredentials {
246
246
  /**
247
- * The id of the send for which the access token is requested.
247
+ * The email address to which the OTP will be sent.
248
248
  */
249
- sendId: string;
249
+ email: string;
250
250
  /**
251
- * The optional send access credentials.
251
+ * The one-time password (OTP) that the user has received via email.
252
252
  */
253
- sendAccessCredentials?: SendAccessCredentials;
253
+ otp: string;
254
254
  }
255
255
 
256
256
  /**
@@ -285,27 +285,6 @@ export type SendAccessTokenError =
285
285
  | { kind: "unexpected"; data: UnexpectedIdentityError }
286
286
  | { kind: "expected"; data: SendAccessTokenApiErrorResponse };
287
287
 
288
- /**
289
- * Invalid request errors - typically due to missing parameters.
290
- */
291
- export type SendAccessTokenInvalidRequestError =
292
- | "send_id_required"
293
- | "password_hash_b64_required"
294
- | "email_required"
295
- | "email_and_otp_required_otp_sent"
296
- | "unknown";
297
-
298
- /**
299
- * Invalid grant errors - typically due to invalid credentials.
300
- */
301
- export type SendAccessTokenInvalidGrantError =
302
- | "send_id_invalid"
303
- | "password_hash_b64_invalid"
304
- | "email_invalid"
305
- | "otp_invalid"
306
- | "otp_generation_failed"
307
- | "unknown";
308
-
309
288
  /**
310
289
  * Represents the possible, expected errors that can occur when requesting a send access token.
311
290
  */
@@ -327,45 +306,32 @@ export type SendAccessTokenApiErrorResponse =
327
306
  | { error: "invalid_target"; error_description?: string };
328
307
 
329
308
  /**
330
- * Result of JIT master password registration process.
309
+ * Invalid grant errors - typically due to invalid credentials.
331
310
  */
332
- export interface JitMasterPasswordRegistrationResponse {
333
- /**
334
- * The account cryptographic state of the user
335
- */
336
- account_cryptographic_state: WrappedAccountCryptographicState;
337
- /**
338
- * The master password unlock data
339
- */
340
- master_password_unlock: MasterPasswordUnlockData;
341
- /**
342
- * The decrypted user key.
343
- */
344
- user_key: B64;
345
- }
311
+ export type SendAccessTokenInvalidGrantError =
312
+ | "send_id_invalid"
313
+ | "password_hash_b64_invalid"
314
+ | "otp_invalid"
315
+ | "otp_generation_failed"
316
+ | "unknown";
346
317
 
347
318
  /**
348
- * Result of Key Connector registration process.
319
+ * Invalid request errors - typically due to missing parameters.
349
320
  */
350
- export interface KeyConnectorRegistrationResult {
351
- /**
352
- * The account cryptographic state of the user.
353
- */
354
- account_cryptographic_state: WrappedAccountCryptographicState;
355
- /**
356
- * The key connector key used for unlocking.
357
- */
358
- key_connector_key: B64;
359
- /**
360
- * The encrypted user key, wrapped with the key connector key.
361
- */
362
- key_connector_key_wrapped_user_key: EncString;
363
- /**
364
- * The decrypted user key. This can be used to get the consuming client to an unlocked state.
365
- */
366
- user_key: B64;
321
+ export type SendAccessTokenInvalidRequestError =
322
+ | "send_id_required"
323
+ | "password_hash_b64_required"
324
+ | "email_required"
325
+ | "email_and_otp_required"
326
+ | "unknown";
327
+
328
+ export interface RegistrationError extends Error {
329
+ name: "RegistrationError";
330
+ variant: "KeyConnectorApi" | "Api" | "Crypto";
367
331
  }
368
332
 
333
+ export function isRegistrationError(error: any): error is RegistrationError;
334
+
369
335
  /**
370
336
  * Request parameters for SSO JIT master password registration.
371
337
  */
@@ -405,13 +371,6 @@ export interface JitMasterPasswordRegistrationRequest {
405
371
  reset_password_enroll: boolean;
406
372
  }
407
373
 
408
- export interface RegistrationError extends Error {
409
- name: "RegistrationError";
410
- variant: "KeyConnectorApi" | "Api" | "Crypto";
411
- }
412
-
413
- export function isRegistrationError(error: any): error is RegistrationError;
414
-
415
374
  /**
416
375
  * Request parameters for TDE (Trusted Device Encryption) registration.
417
376
  */
@@ -457,6 +416,46 @@ export interface TdeRegistrationResponse {
457
416
  user_key: B64;
458
417
  }
459
418
 
419
+ /**
420
+ * Result of Key Connector registration process.
421
+ */
422
+ export interface KeyConnectorRegistrationResult {
423
+ /**
424
+ * The account cryptographic state of the user.
425
+ */
426
+ account_cryptographic_state: WrappedAccountCryptographicState;
427
+ /**
428
+ * The key connector key used for unlocking.
429
+ */
430
+ key_connector_key: B64;
431
+ /**
432
+ * The encrypted user key, wrapped with the key connector key.
433
+ */
434
+ key_connector_key_wrapped_user_key: EncString;
435
+ /**
436
+ * The decrypted user key. This can be used to get the consuming client to an unlocked state.
437
+ */
438
+ user_key: B64;
439
+ }
440
+
441
+ /**
442
+ * Result of JIT master password registration process.
443
+ */
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
+ }
458
+
460
459
  export interface CollectionView {
461
460
  id: CollectionId | undefined;
462
461
  organizationId: OrganizationId;
@@ -468,6 +467,11 @@ export interface CollectionView {
468
467
  type: CollectionType;
469
468
  }
470
469
 
470
+ /**
471
+ * Type of collection
472
+ */
473
+ export type CollectionType = "SharedCollection" | "DefaultUserCollection";
474
+
471
475
  export interface Collection {
472
476
  id: CollectionId | undefined;
473
477
  organizationId: OrganizationId;
@@ -485,11 +489,6 @@ export interface Collection {
485
489
  */
486
490
  export type CollectionId = Tagged<Uuid, "CollectionId">;
487
491
 
488
- /**
489
- * Type of collection
490
- */
491
- export type CollectionType = "SharedCollection" | "DefaultUserCollection";
492
-
493
492
  export interface CollectionDecryptError extends Error {
494
493
  name: "CollectionDecryptError";
495
494
  variant: "Crypto";
@@ -499,15 +498,19 @@ export function isCollectionDecryptError(error: any): error is CollectionDecrypt
499
498
 
500
499
  export type SignedSecurityState = string;
501
500
 
502
- /**
503
- * Represents the data required to authenticate with the master password.
504
- */
505
- export interface MasterPasswordAuthenticationData {
506
- kdf: Kdf;
507
- salt: string;
508
- masterPasswordAuthenticationHash: B64;
501
+ export interface MasterPasswordError extends Error {
502
+ name: "MasterPasswordError";
503
+ variant:
504
+ | "EncryptionKeyMalformed"
505
+ | "KdfMalformed"
506
+ | "InvalidKdfConfiguration"
507
+ | "MissingField"
508
+ | "Crypto"
509
+ | "WrongPassword";
509
510
  }
510
511
 
512
+ export function isMasterPasswordError(error: any): error is MasterPasswordError;
513
+
511
514
  /**
512
515
  * Represents the data required to unlock with the master password.
513
516
  */
@@ -526,19 +529,15 @@ export interface MasterPasswordUnlockData {
526
529
  salt: string;
527
530
  }
528
531
 
529
- export interface MasterPasswordError extends Error {
530
- name: "MasterPasswordError";
531
- variant:
532
- | "EncryptionKeyMalformed"
533
- | "KdfMalformed"
534
- | "InvalidKdfConfiguration"
535
- | "MissingField"
536
- | "Crypto"
537
- | "WrongPassword";
532
+ /**
533
+ * Represents the data required to authenticate with the master password.
534
+ */
535
+ export interface MasterPasswordAuthenticationData {
536
+ kdf: Kdf;
537
+ salt: string;
538
+ masterPasswordAuthenticationHash: B64;
538
539
  }
539
540
 
540
- export function isMasterPasswordError(error: any): error is MasterPasswordError;
541
-
542
541
  export interface AccountCryptographyInitializationError extends Error {
543
542
  name: "AccountCryptographyInitializationError";
544
543
  variant:
@@ -554,13 +553,6 @@ export function isAccountCryptographyInitializationError(
554
553
  error: any,
555
554
  ): error is AccountCryptographyInitializationError;
556
555
 
557
- export interface RotateCryptographyStateError extends Error {
558
- name: "RotateCryptographyStateError";
559
- variant: "KeyMissing" | "InvalidData";
560
- }
561
-
562
- export function isRotateCryptographyStateError(error: any): error is RotateCryptographyStateError;
563
-
564
556
  /**
565
557
  * Any keys / cryptographic protection \"downstream\" from the account symmetric key (user key).
566
558
  * Private keys are protected by the user key.
@@ -571,69 +563,26 @@ export type WrappedAccountCryptographicState =
571
563
  V2: {
572
564
  private_key: EncString;
573
565
  signed_public_key: SignedPublicKey | undefined;
574
- signing_key: EncString;
575
- security_state: SignedSecurityState;
576
- };
577
- };
578
-
579
- /**
580
- * Auth requests supports multiple initialization methods.
581
- */
582
- export type AuthRequestMethod =
583
- | { userKey: { protected_user_key: UnsignedSharedKey } }
584
- | { masterKey: { protected_master_key: UnsignedSharedKey; auth_request_key: EncString } };
585
-
586
- /**
587
- * Request for `verify_asymmetric_keys`.
588
- */
589
- export interface VerifyAsymmetricKeysRequest {
590
- /**
591
- * The user\'s user key
592
- */
593
- userKey: B64;
594
- /**
595
- * The user\'s public key
596
- */
597
- userPublicKey: B64;
598
- /**
599
- * User\'s private key, encrypted with the user key
600
- */
601
- userKeyEncryptedPrivateKey: EncString;
602
- }
603
-
604
- /**
605
- * Response for `verify_asymmetric_keys`.
606
- */
607
- export interface VerifyAsymmetricKeysResponse {
608
- /**
609
- * Whether the user\'s private key was decryptable by the user key.
610
- */
611
- privateKeyDecryptable: boolean;
612
- /**
613
- * Whether the user\'s private key was a valid RSA key and matched the public key provided.
614
- */
615
- validPrivateKey: boolean;
616
- }
566
+ signing_key: EncString;
567
+ security_state: SignedSecurityState;
568
+ };
569
+ };
617
570
 
618
- export interface DeriveKeyConnectorError extends Error {
619
- name: "DeriveKeyConnectorError";
620
- variant: "WrongPassword" | "Crypto";
571
+ export interface RotateCryptographyStateError extends Error {
572
+ name: "RotateCryptographyStateError";
573
+ variant: "KeyMissing" | "InvalidData";
621
574
  }
622
575
 
623
- export function isDeriveKeyConnectorError(error: any): error is DeriveKeyConnectorError;
576
+ export function isRotateCryptographyStateError(error: any): error is RotateCryptographyStateError;
624
577
 
625
578
  /**
626
- * Response from the `make_update_password` function
579
+ * Represents the request to initialize the user\'s organizational cryptographic state.
627
580
  */
628
- export interface UpdatePasswordResponse {
629
- /**
630
- * Hash of the new password
631
- */
632
- passwordHash: B64;
581
+ export interface InitOrgCryptoRequest {
633
582
  /**
634
- * User key, encrypted with the new password
583
+ * The encryption keys for all the organizations the user is a part of
635
584
  */
636
- newKey: EncString;
585
+ organizationKeys: Map<OrganizationId, UnsignedSharedKey>;
637
586
  }
638
587
 
639
588
  export interface MakeKeysError extends Error {
@@ -647,13 +596,6 @@ export interface MakeKeysError extends Error {
647
596
 
648
597
  export function isMakeKeysError(error: any): error is MakeKeysError;
649
598
 
650
- export interface EnrollAdminPasswordResetError extends Error {
651
- name: "EnrollAdminPasswordResetError";
652
- variant: "Crypto";
653
- }
654
-
655
- export function isEnrollAdminPasswordResetError(error: any): error is EnrollAdminPasswordResetError;
656
-
657
599
  /**
658
600
  * The crypto method used to initialize the user cryptographic state.
659
601
  */
@@ -672,18 +614,20 @@ export type InitUserCryptoMethod =
672
614
  }
673
615
  | { keyConnector: { master_key: B64; user_key: EncString } };
674
616
 
675
- export interface CryptoClientError extends Error {
676
- name: "CryptoClientError";
677
- variant:
678
- | "NotAuthenticated"
679
- | "Crypto"
680
- | "InvalidKdfSettings"
681
- | "PasswordProtectedKeyEnvelope"
682
- | "InvalidPrfInput";
617
+ /**
618
+ * Request for deriving a pin protected user key
619
+ */
620
+ export interface EnrollPinResponse {
621
+ /**
622
+ * [UserKey] protected by PIN
623
+ */
624
+ pinProtectedUserKeyEnvelope: PasswordProtectedKeyEnvelope;
625
+ /**
626
+ * PIN protected by [UserKey]
627
+ */
628
+ userKeyEncryptedPin: EncString;
683
629
  }
684
630
 
685
- export function isCryptoClientError(error: any): error is CryptoClientError;
686
-
687
631
  /**
688
632
  * Request for deriving a pin protected user key
689
633
  */
@@ -699,17 +643,35 @@ export interface DerivePinKeyResponse {
699
643
  }
700
644
 
701
645
  /**
702
- * Request for deriving a pin protected user key
646
+ * Request for `verify_asymmetric_keys`.
703
647
  */
704
- export interface EnrollPinResponse {
648
+ export interface VerifyAsymmetricKeysRequest {
705
649
  /**
706
- * [UserKey] protected by PIN
650
+ * The user\'s user key
707
651
  */
708
- pinProtectedUserKeyEnvelope: PasswordProtectedKeyEnvelope;
652
+ userKey: B64;
709
653
  /**
710
- * PIN protected by [UserKey]
654
+ * The user\'s public key
711
655
  */
712
- userKeyEncryptedPin: EncString;
656
+ userPublicKey: B64;
657
+ /**
658
+ * User\'s private key, encrypted with the user key
659
+ */
660
+ userKeyEncryptedPrivateKey: EncString;
661
+ }
662
+
663
+ /**
664
+ * Response for `verify_asymmetric_keys`.
665
+ */
666
+ export interface VerifyAsymmetricKeysResponse {
667
+ /**
668
+ * Whether the user\'s private key was decryptable by the user key.
669
+ */
670
+ privateKeyDecryptable: boolean;
671
+ /**
672
+ * Whether the user\'s private key was a valid RSA key and matched the public key provided.
673
+ */
674
+ validPrivateKey: boolean;
713
675
  }
714
676
 
715
677
  /**
@@ -750,24 +712,25 @@ export interface UserCryptoV2KeysResponse {
750
712
  securityVersion: number;
751
713
  }
752
714
 
753
- /**
754
- * Response from the `update_kdf` function
755
- */
756
- export interface UpdateKdfResponse {
757
- /**
758
- * The authentication data for the new KDF setting
759
- */
760
- masterPasswordAuthenticationData: MasterPasswordAuthenticationData;
761
- /**
762
- * The unlock data for the new KDF setting
763
- */
764
- masterPasswordUnlockData: MasterPasswordUnlockData;
765
- /**
766
- * The authentication data for the KDF setting prior to the change
767
- */
768
- oldMasterPasswordAuthenticationData: MasterPasswordAuthenticationData;
715
+ export interface EnrollAdminPasswordResetError extends Error {
716
+ name: "EnrollAdminPasswordResetError";
717
+ variant: "Crypto";
718
+ }
719
+
720
+ export function isEnrollAdminPasswordResetError(error: any): error is EnrollAdminPasswordResetError;
721
+
722
+ export interface CryptoClientError extends Error {
723
+ name: "CryptoClientError";
724
+ variant:
725
+ | "NotAuthenticated"
726
+ | "Crypto"
727
+ | "InvalidKdfSettings"
728
+ | "PasswordProtectedKeyEnvelope"
729
+ | "InvalidPrfInput";
769
730
  }
770
731
 
732
+ export function isCryptoClientError(error: any): error is CryptoClientError;
733
+
771
734
  /**
772
735
  * Request for migrating an account from password to key connector.
773
736
  */
@@ -790,28 +753,39 @@ export interface DeriveKeyConnectorRequest {
790
753
  email: string;
791
754
  }
792
755
 
756
+ export interface DeriveKeyConnectorError extends Error {
757
+ name: "DeriveKeyConnectorError";
758
+ variant: "WrongPassword" | "Crypto";
759
+ }
760
+
761
+ export function isDeriveKeyConnectorError(error: any): error is DeriveKeyConnectorError;
762
+
793
763
  /**
794
- * Response from the `make_key_pair` function
764
+ * Response from the `make_update_password` function
795
765
  */
796
- export interface MakeKeyPairResponse {
766
+ export interface UpdatePasswordResponse {
797
767
  /**
798
- * The user\'s public key
768
+ * Hash of the new password
799
769
  */
800
- userPublicKey: B64;
770
+ passwordHash: B64;
801
771
  /**
802
- * User\'s private key, encrypted with the user key
772
+ * User key, encrypted with the new password
803
773
  */
804
- userKeyEncryptedPrivateKey: EncString;
774
+ newKey: EncString;
805
775
  }
806
776
 
807
777
  /**
808
- * Represents the request to initialize the user\'s organizational cryptographic state.
778
+ * Response from the `make_key_pair` function
809
779
  */
810
- export interface InitOrgCryptoRequest {
780
+ export interface MakeKeyPairResponse {
811
781
  /**
812
- * The encryption keys for all the organizations the user is a part of
782
+ * The user\'s public key
813
783
  */
814
- organizationKeys: Map<OrganizationId, UnsignedSharedKey>;
784
+ userPublicKey: B64;
785
+ /**
786
+ * User\'s private key, encrypted with the user key
787
+ */
788
+ userKeyEncryptedPrivateKey: EncString;
815
789
  }
816
790
 
817
791
  /**
@@ -841,6 +815,31 @@ export interface InitUserCryptoRequest {
841
815
  method: InitUserCryptoMethod;
842
816
  }
843
817
 
818
+ /**
819
+ * Response from the `update_kdf` function
820
+ */
821
+ export interface UpdateKdfResponse {
822
+ /**
823
+ * The authentication data for the new KDF setting
824
+ */
825
+ masterPasswordAuthenticationData: MasterPasswordAuthenticationData;
826
+ /**
827
+ * The unlock data for the new KDF setting
828
+ */
829
+ masterPasswordUnlockData: MasterPasswordUnlockData;
830
+ /**
831
+ * The authentication data for the KDF setting prior to the change
832
+ */
833
+ oldMasterPasswordAuthenticationData: MasterPasswordAuthenticationData;
834
+ }
835
+
836
+ /**
837
+ * Auth requests supports multiple initialization methods.
838
+ */
839
+ export type AuthRequestMethod =
840
+ | { userKey: { protected_user_key: UnsignedSharedKey } }
841
+ | { masterKey: { protected_master_key: UnsignedSharedKey; auth_request_key: EncString } };
842
+
844
843
  /**
845
844
  * NewType wrapper for `OrganizationId`
846
845
  */
@@ -1116,13 +1115,6 @@ export interface PassphraseGeneratorRequest {
1116
1115
  includeNumber: boolean;
1117
1116
  }
1118
1117
 
1119
- export interface PasswordError extends Error {
1120
- name: "PasswordError";
1121
- variant: "NoCharacterSetEnabled" | "InvalidLength";
1122
- }
1123
-
1124
- export function isPasswordError(error: any): error is PasswordError;
1125
-
1126
1118
  /**
1127
1119
  * Password generator request options.
1128
1120
  */
@@ -1175,12 +1167,12 @@ export interface PasswordGeneratorRequest {
1175
1167
  minSpecial: number | undefined;
1176
1168
  }
1177
1169
 
1178
- export interface UsernameError extends Error {
1179
- name: "UsernameError";
1180
- variant: "InvalidApiKey" | "Unknown" | "ResponseContent" | "Reqwest";
1170
+ export interface PasswordError extends Error {
1171
+ name: "PasswordError";
1172
+ variant: "NoCharacterSetEnabled" | "InvalidLength";
1181
1173
  }
1182
1174
 
1183
- export function isUsernameError(error: any): error is UsernameError;
1175
+ export function isPasswordError(error: any): error is PasswordError;
1184
1176
 
1185
1177
  export type UsernameGeneratorRequest =
1186
1178
  | { word: { capitalize: boolean; include_number: boolean } }
@@ -1188,6 +1180,15 @@ export type UsernameGeneratorRequest =
1188
1180
  | { catchall: { type: AppendType; domain: string } }
1189
1181
  | { forwarded: { service: ForwarderServiceType; website: string | undefined } };
1190
1182
 
1183
+ export type AppendType = "random" | { websiteName: { website: string } };
1184
+
1185
+ export interface UsernameError extends Error {
1186
+ name: "UsernameError";
1187
+ variant: "InvalidApiKey" | "Unknown" | "ResponseContent" | "Reqwest";
1188
+ }
1189
+
1190
+ export function isUsernameError(error: any): error is UsernameError;
1191
+
1191
1192
  /**
1192
1193
  * Configures the email forwarding service to use.
1193
1194
  * For instructions on how to configure each service, see the documentation:
@@ -1201,8 +1202,6 @@ export type ForwarderServiceType =
1201
1202
  | { forwardEmail: { api_token: string; domain: string } }
1202
1203
  | { simpleLogin: { api_key: string; base_url: string } };
1203
1204
 
1204
- export type AppendType = "random" | { websiteName: { website: string } };
1205
-
1206
1205
  export interface ReceiveError extends Error {
1207
1206
  name: "ReceiveError";
1208
1207
  variant: "Channel" | "Timeout" | "Cancelled";
@@ -1264,13 +1263,6 @@ export type Endpoint =
1264
1263
  | "DesktopRenderer"
1265
1264
  | "DesktopMain";
1266
1265
 
1267
- export interface SshKeyExportError extends Error {
1268
- name: "SshKeyExportError";
1269
- variant: "KeyConversion";
1270
- }
1271
-
1272
- export function isSshKeyExportError(error: any): error is SshKeyExportError;
1273
-
1274
1266
  export interface SshKeyImportError extends Error {
1275
1267
  name: "SshKeyImportError";
1276
1268
  variant: "Parsing" | "PasswordRequired" | "WrongPassword" | "UnsupportedKeyType";
@@ -1278,6 +1270,13 @@ export interface SshKeyImportError extends Error {
1278
1270
 
1279
1271
  export function isSshKeyImportError(error: any): error is SshKeyImportError;
1280
1272
 
1273
+ export interface SshKeyExportError extends Error {
1274
+ name: "SshKeyExportError";
1275
+ variant: "KeyConversion";
1276
+ }
1277
+
1278
+ export function isSshKeyExportError(error: any): error is SshKeyExportError;
1279
+
1281
1280
  export interface KeyGenerationError extends Error {
1282
1281
  name: "KeyGenerationError";
1283
1282
  variant: "KeyGeneration" | "KeyConversion";
@@ -1314,6 +1313,14 @@ export interface CipherRiskError extends Error {
1314
1313
 
1315
1314
  export function isCipherRiskError(error: any): error is CipherRiskError;
1316
1315
 
1316
+ /**
1317
+ * Result of checking password exposure via HIBP API.
1318
+ */
1319
+ export type ExposedPasswordResult =
1320
+ | { type: "NotChecked" }
1321
+ | { type: "Found"; value: number }
1322
+ | { type: "Error"; value: string };
1323
+
1317
1324
  /**
1318
1325
  * Password reuse map wrapper for WASM compatibility.
1319
1326
  */
@@ -1385,21 +1392,13 @@ export interface CipherRiskOptions {
1385
1392
  hibpBaseUrl?: string | undefined;
1386
1393
  }
1387
1394
 
1388
- /**
1389
- * Result of checking password exposure via HIBP API.
1390
- */
1391
- export type ExposedPasswordResult =
1392
- | { type: "NotChecked" }
1393
- | { type: "Found"; value: number }
1394
- | { type: "Error"; value: string };
1395
-
1396
- export interface PasswordHistoryView {
1397
- password: string;
1395
+ export interface PasswordHistory {
1396
+ password: EncString;
1398
1397
  lastUsedDate: DateTime<Utc>;
1399
1398
  }
1400
1399
 
1401
- export interface PasswordHistory {
1402
- password: EncString;
1400
+ export interface PasswordHistoryView {
1401
+ password: string;
1403
1402
  lastUsedDate: DateTime<Utc>;
1404
1403
  }
1405
1404
 
@@ -1425,6 +1424,13 @@ export interface TotpResponse {
1425
1424
  period: number;
1426
1425
  }
1427
1426
 
1427
+ export interface DecryptError extends Error {
1428
+ name: "DecryptError";
1429
+ variant: "Crypto";
1430
+ }
1431
+
1432
+ export function isDecryptError(error: any): error is DecryptError;
1433
+
1428
1434
  export interface EncryptError extends Error {
1429
1435
  name: "EncryptError";
1430
1436
  variant: "Crypto" | "MissingUserId";
@@ -1432,13 +1438,18 @@ export interface EncryptError extends Error {
1432
1438
 
1433
1439
  export function isEncryptError(error: any): error is EncryptError;
1434
1440
 
1435
- export interface DecryptError extends Error {
1436
- name: "DecryptError";
1437
- variant: "Crypto";
1441
+ export interface Attachment {
1442
+ id: string | undefined;
1443
+ url: string | undefined;
1444
+ size: string | undefined;
1445
+ /**
1446
+ * Readable size, ex: \"4.2 KB\" or \"1.43 GB\
1447
+ */
1448
+ sizeName: string | undefined;
1449
+ fileName: EncString | undefined;
1450
+ key: EncString | undefined;
1438
1451
  }
1439
1452
 
1440
- export function isDecryptError(error: any): error is DecryptError;
1441
-
1442
1453
  export interface AttachmentView {
1443
1454
  id: string | undefined;
1444
1455
  url: string | undefined;
@@ -1461,33 +1472,21 @@ export interface AttachmentView {
1461
1472
  decryptedKey: string | undefined;
1462
1473
  }
1463
1474
 
1464
- export interface Attachment {
1465
- id: string | undefined;
1466
- url: string | undefined;
1467
- size: string | undefined;
1468
- /**
1469
- * Readable size, ex: \"4.2 KB\" or \"1.43 GB\
1470
- */
1471
- sizeName: string | undefined;
1472
- fileName: EncString | undefined;
1473
- key: EncString | undefined;
1474
- }
1475
-
1476
- export interface LocalDataView {
1475
+ export interface LocalData {
1477
1476
  lastUsedDate: DateTime<Utc> | undefined;
1478
1477
  lastLaunched: DateTime<Utc> | undefined;
1479
1478
  }
1480
1479
 
1481
- export interface LocalData {
1480
+ export interface LocalDataView {
1482
1481
  lastUsedDate: DateTime<Utc> | undefined;
1483
1482
  lastLaunched: DateTime<Utc> | undefined;
1484
1483
  }
1485
1484
 
1486
- export interface SecureNote {
1485
+ export interface SecureNoteView {
1487
1486
  type: SecureNoteType;
1488
1487
  }
1489
1488
 
1490
- export interface SecureNoteView {
1489
+ export interface SecureNote {
1491
1490
  type: SecureNoteType;
1492
1491
  }
1493
1492
 
@@ -1643,6 +1642,15 @@ export interface CipherPermissions {
1643
1642
  restore: boolean;
1644
1643
  }
1645
1644
 
1645
+ export interface CardView {
1646
+ cardholderName: string | undefined;
1647
+ expMonth: string | undefined;
1648
+ expYear: string | undefined;
1649
+ code: string | undefined;
1650
+ brand: string | undefined;
1651
+ number: string | undefined;
1652
+ }
1653
+
1646
1654
  export interface Card {
1647
1655
  cardholderName: EncString | undefined;
1648
1656
  expMonth: EncString | undefined;
@@ -1662,15 +1670,6 @@ export interface CardListView {
1662
1670
  brand: string | undefined;
1663
1671
  }
1664
1672
 
1665
- export interface CardView {
1666
- cardholderName: string | undefined;
1667
- expMonth: string | undefined;
1668
- expYear: string | undefined;
1669
- code: string | undefined;
1670
- brand: string | undefined;
1671
- number: string | undefined;
1672
- }
1673
-
1674
1673
  export interface FieldView {
1675
1674
  name: string | undefined;
1676
1675
  value: string | undefined;
@@ -1685,23 +1684,10 @@ export interface Field {
1685
1684
  linkedId: LinkedIdType | undefined;
1686
1685
  }
1687
1686
 
1688
- export interface Login {
1689
- username: EncString | undefined;
1690
- password: EncString | undefined;
1691
- passwordRevisionDate: DateTime<Utc> | undefined;
1692
- uris: LoginUri[] | undefined;
1693
- totp: EncString | undefined;
1694
- autofillOnPageLoad: boolean | undefined;
1695
- fido2Credentials: Fido2Credential[] | undefined;
1696
- }
1697
-
1698
- export interface Fido2CredentialListView {
1699
- credentialId: string;
1700
- rpId: string;
1701
- userHandle: string | undefined;
1702
- userName: string | undefined;
1703
- userDisplayName: string | undefined;
1704
- counter: string;
1687
+ export interface LoginUriView {
1688
+ uri: string | undefined;
1689
+ match: UriMatchType | undefined;
1690
+ uriChecksum: string | undefined;
1705
1691
  }
1706
1692
 
1707
1693
  export interface LoginUri {
@@ -1726,16 +1712,6 @@ export interface Fido2CredentialView {
1726
1712
  creationDate: DateTime<Utc>;
1727
1713
  }
1728
1714
 
1729
- export interface LoginView {
1730
- username: string | undefined;
1731
- password: string | undefined;
1732
- passwordRevisionDate: DateTime<Utc> | undefined;
1733
- uris: LoginUriView[] | undefined;
1734
- totp: string | undefined;
1735
- autofillOnPageLoad: boolean | undefined;
1736
- fido2Credentials: Fido2Credential[] | undefined;
1737
- }
1738
-
1739
1715
  export interface Fido2CredentialNewView {
1740
1716
  credentialId: string;
1741
1717
  keyType: string;
@@ -1750,12 +1726,6 @@ export interface Fido2CredentialNewView {
1750
1726
  creationDate: DateTime<Utc>;
1751
1727
  }
1752
1728
 
1753
- export interface LoginUriView {
1754
- uri: string | undefined;
1755
- match: UriMatchType | undefined;
1756
- uriChecksum: string | undefined;
1757
- }
1758
-
1759
1729
  export interface Fido2CredentialFullView {
1760
1730
  credentialId: string;
1761
1731
  keyType: string;
@@ -1772,6 +1742,16 @@ export interface Fido2CredentialFullView {
1772
1742
  creationDate: DateTime<Utc>;
1773
1743
  }
1774
1744
 
1745
+ export interface LoginView {
1746
+ username: string | undefined;
1747
+ password: string | undefined;
1748
+ passwordRevisionDate: DateTime<Utc> | undefined;
1749
+ uris: LoginUriView[] | undefined;
1750
+ totp: string | undefined;
1751
+ autofillOnPageLoad: boolean | undefined;
1752
+ fido2Credentials: Fido2Credential[] | undefined;
1753
+ }
1754
+
1775
1755
  export interface Fido2Credential {
1776
1756
  credentialId: EncString;
1777
1757
  keyType: EncString;
@@ -1799,27 +1779,24 @@ export interface LoginListView {
1799
1779
  uris: LoginUriView[] | undefined;
1800
1780
  }
1801
1781
 
1802
- export interface CipherError extends Error {
1803
- name: "CipherError";
1804
- variant:
1805
- | "MissingField"
1806
- | "Crypto"
1807
- | "Decrypt"
1808
- | "Encrypt"
1809
- | "AttachmentsWithoutKeys"
1810
- | "OrganizationAlreadySet"
1811
- | "Repository"
1812
- | "Chrono"
1813
- | "SerdeJson"
1814
- | "Api";
1782
+ export interface Fido2CredentialListView {
1783
+ credentialId: string;
1784
+ rpId: string;
1785
+ userHandle: string | undefined;
1786
+ userName: string | undefined;
1787
+ userDisplayName: string | undefined;
1788
+ counter: string;
1815
1789
  }
1816
1790
 
1817
- export function isCipherError(error: any): error is CipherError;
1818
-
1819
- /**
1820
- * NewType wrapper for `CipherId`
1821
- */
1822
- export type CipherId = Tagged<Uuid, "CipherId">;
1791
+ export interface Login {
1792
+ username: EncString | undefined;
1793
+ password: EncString | undefined;
1794
+ passwordRevisionDate: DateTime<Utc> | undefined;
1795
+ uris: LoginUri[] | undefined;
1796
+ totp: EncString | undefined;
1797
+ autofillOnPageLoad: boolean | undefined;
1798
+ fido2Credentials: Fido2Credential[] | undefined;
1799
+ }
1823
1800
 
1824
1801
  export interface Cipher {
1825
1802
  id: CipherId | undefined;
@@ -1856,43 +1833,68 @@ export interface Cipher {
1856
1833
  data: string | undefined;
1857
1834
  }
1858
1835
 
1859
- export interface CipherView {
1836
+ export interface CipherListView {
1860
1837
  id: CipherId | undefined;
1861
1838
  organizationId: OrganizationId | undefined;
1862
1839
  folderId: FolderId | undefined;
1863
1840
  collectionIds: CollectionId[];
1864
1841
  /**
1865
- * Temporary, required to support re-encrypting existing items.
1842
+ * Temporary, required to support calculating TOTP from CipherListView.
1866
1843
  */
1867
1844
  key: EncString | undefined;
1868
1845
  name: string;
1869
- notes: string | undefined;
1870
- type: CipherType;
1871
- login: LoginView | undefined;
1872
- identity: IdentityView | undefined;
1873
- card: CardView | undefined;
1874
- secureNote: SecureNoteView | undefined;
1875
- sshKey: SshKeyView | undefined;
1846
+ subtitle: string;
1847
+ type: CipherListViewType;
1876
1848
  favorite: boolean;
1877
1849
  reprompt: CipherRepromptType;
1878
1850
  organizationUseTotp: boolean;
1879
1851
  edit: boolean;
1880
1852
  permissions: CipherPermissions | undefined;
1881
1853
  viewPassword: boolean;
1882
- localData: LocalDataView | undefined;
1883
- attachments: AttachmentView[] | undefined;
1884
1854
  /**
1885
- * Attachments that failed to decrypt. Only present when there are decryption failures.
1855
+ * The number of attachments
1886
1856
  */
1887
- attachmentDecryptionFailures?: AttachmentView[];
1888
- fields: FieldView[] | undefined;
1889
- passwordHistory: PasswordHistoryView[] | undefined;
1857
+ attachments: number;
1858
+ /**
1859
+ * Indicates if the cipher has old attachments that need to be re-uploaded
1860
+ */
1861
+ hasOldAttachments: boolean;
1890
1862
  creationDate: DateTime<Utc>;
1891
1863
  deletedDate: DateTime<Utc> | undefined;
1892
1864
  revisionDate: DateTime<Utc>;
1893
1865
  archivedDate: DateTime<Utc> | undefined;
1866
+ /**
1867
+ * Hints for the presentation layer for which fields can be copied.
1868
+ */
1869
+ copyableFields: CopyableCipherFields[];
1870
+ localData: LocalDataView | undefined;
1871
+ }
1872
+
1873
+ /**
1874
+ * Represents the result of decrypting a list of ciphers.
1875
+ *
1876
+ * This struct contains two vectors: `successes` and `failures`.
1877
+ * `successes` contains the decrypted `CipherListView` objects,
1878
+ * while `failures` contains the original `Cipher` objects that failed to decrypt.
1879
+ */
1880
+ export interface DecryptCipherListResult {
1881
+ /**
1882
+ * The decrypted `CipherListView` objects.
1883
+ */
1884
+ successes: CipherListView[];
1885
+ /**
1886
+ * The original `Cipher` objects that failed to decrypt.
1887
+ */
1888
+ failures: Cipher[];
1894
1889
  }
1895
1890
 
1891
+ export type CipherListViewType =
1892
+ | { login: LoginListView }
1893
+ | "secureNote"
1894
+ | { card: CardListView }
1895
+ | "identity"
1896
+ | "sshKey";
1897
+
1896
1898
  /**
1897
1899
  * Available fields on a cipher and can be copied from a the list view in the UI.
1898
1900
  */
@@ -1909,6 +1911,23 @@ export type CopyableCipherFields =
1909
1911
  | "SshKey"
1910
1912
  | "SecureNotes";
1911
1913
 
1914
+ export interface CipherError extends Error {
1915
+ name: "CipherError";
1916
+ variant:
1917
+ | "MissingField"
1918
+ | "Crypto"
1919
+ | "Decrypt"
1920
+ | "Encrypt"
1921
+ | "AttachmentsWithoutKeys"
1922
+ | "OrganizationAlreadySet"
1923
+ | "Repository"
1924
+ | "Chrono"
1925
+ | "SerdeJson"
1926
+ | "Api";
1927
+ }
1928
+
1929
+ export function isCipherError(error: any): error is CipherError;
1930
+
1912
1931
  export interface EncryptionContext {
1913
1932
  /**
1914
1933
  * The Id of the user that encrypted the cipher. It should always represent a UserId, even for
@@ -1918,67 +1937,47 @@ export interface EncryptionContext {
1918
1937
  cipher: Cipher;
1919
1938
  }
1920
1939
 
1921
- export interface CipherListView {
1940
+ export interface CipherView {
1922
1941
  id: CipherId | undefined;
1923
1942
  organizationId: OrganizationId | undefined;
1924
1943
  folderId: FolderId | undefined;
1925
1944
  collectionIds: CollectionId[];
1926
1945
  /**
1927
- * Temporary, required to support calculating TOTP from CipherListView.
1946
+ * Temporary, required to support re-encrypting existing items.
1928
1947
  */
1929
1948
  key: EncString | undefined;
1930
1949
  name: string;
1931
- subtitle: string;
1932
- type: CipherListViewType;
1950
+ notes: string | undefined;
1951
+ type: CipherType;
1952
+ login: LoginView | undefined;
1953
+ identity: IdentityView | undefined;
1954
+ card: CardView | undefined;
1955
+ secureNote: SecureNoteView | undefined;
1956
+ sshKey: SshKeyView | undefined;
1933
1957
  favorite: boolean;
1934
1958
  reprompt: CipherRepromptType;
1935
1959
  organizationUseTotp: boolean;
1936
1960
  edit: boolean;
1937
1961
  permissions: CipherPermissions | undefined;
1938
1962
  viewPassword: boolean;
1963
+ localData: LocalDataView | undefined;
1964
+ attachments: AttachmentView[] | undefined;
1939
1965
  /**
1940
- * The number of attachments
1941
- */
1942
- attachments: number;
1943
- /**
1944
- * Indicates if the cipher has old attachments that need to be re-uploaded
1966
+ * Attachments that failed to decrypt. Only present when there are decryption failures.
1945
1967
  */
1946
- hasOldAttachments: boolean;
1968
+ attachmentDecryptionFailures?: AttachmentView[];
1969
+ fields: FieldView[] | undefined;
1970
+ passwordHistory: PasswordHistoryView[] | undefined;
1947
1971
  creationDate: DateTime<Utc>;
1948
1972
  deletedDate: DateTime<Utc> | undefined;
1949
1973
  revisionDate: DateTime<Utc>;
1950
1974
  archivedDate: DateTime<Utc> | undefined;
1951
- /**
1952
- * Hints for the presentation layer for which fields can be copied.
1953
- */
1954
- copyableFields: CopyableCipherFields[];
1955
- localData: LocalDataView | undefined;
1956
1975
  }
1957
1976
 
1958
1977
  /**
1959
- * Represents the result of decrypting a list of ciphers.
1960
- *
1961
- * This struct contains two vectors: `successes` and `failures`.
1962
- * `successes` contains the decrypted `CipherListView` objects,
1963
- * while `failures` contains the original `Cipher` objects that failed to decrypt.
1978
+ * NewType wrapper for `CipherId`
1964
1979
  */
1965
- export interface DecryptCipherListResult {
1966
- /**
1967
- * The decrypted `CipherListView` objects.
1968
- */
1969
- successes: CipherListView[];
1970
- /**
1971
- * The original `Cipher` objects that failed to decrypt.
1972
- */
1973
- failures: Cipher[];
1974
- }
1975
-
1976
- export type CipherListViewType =
1977
- | { login: LoginListView }
1978
- | "secureNote"
1979
- | { card: CardListView }
1980
- | "identity"
1981
- | "sshKey";
1980
+ export type CipherId = Tagged<Uuid, "CipherId">;
1982
1981
 
1983
1982
  export interface SshKey {
1984
1983
  /**
@@ -2054,15 +2053,15 @@ export interface IdentityView {
2054
2053
 
2055
2054
  export type LinkedIdType = LoginLinkedIdType | CardLinkedIdType | IdentityLinkedIdType;
2056
2055
 
2057
- export interface Folder {
2056
+ export interface FolderView {
2058
2057
  id: FolderId | undefined;
2059
- name: EncString;
2058
+ name: string;
2060
2059
  revisionDate: DateTime<Utc>;
2061
2060
  }
2062
2061
 
2063
- export interface FolderView {
2062
+ export interface Folder {
2064
2063
  id: FolderId | undefined;
2065
- name: string;
2064
+ name: EncString;
2066
2065
  revisionDate: DateTime<Utc>;
2067
2066
  }
2068
2067