@bitwarden/sdk-internal 0.2.0-main.133 → 0.2.0-main.135

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.
@@ -29,6 +29,52 @@ export function generate_ssh_key(key_algorithm: KeyAlgorithm): SshKeyView;
29
29
  * - `Err(UnsupportedKeyType)` if the key type is not supported
30
30
  */
31
31
  export function import_ssh_key(imported_key: string, password?: string | null): SshKeyView;
32
+ export enum CardLinkedIdType {
33
+ CardholderName = 300,
34
+ ExpMonth = 301,
35
+ ExpYear = 302,
36
+ Code = 303,
37
+ Brand = 304,
38
+ Number = 305,
39
+ }
40
+ export enum CipherRepromptType {
41
+ None = 0,
42
+ Password = 1,
43
+ }
44
+ export enum CipherType {
45
+ Login = 1,
46
+ SecureNote = 2,
47
+ Card = 3,
48
+ Identity = 4,
49
+ SshKey = 5,
50
+ }
51
+ export enum FieldType {
52
+ Text = 0,
53
+ Hidden = 1,
54
+ Boolean = 2,
55
+ Linked = 3,
56
+ }
57
+ export enum IdentityLinkedIdType {
58
+ Title = 400,
59
+ MiddleName = 401,
60
+ Address1 = 402,
61
+ Address2 = 403,
62
+ Address3 = 404,
63
+ City = 405,
64
+ State = 406,
65
+ PostalCode = 407,
66
+ Country = 408,
67
+ Company = 409,
68
+ Email = 410,
69
+ Phone = 411,
70
+ Ssn = 412,
71
+ Username = 413,
72
+ PassportNumber = 414,
73
+ LicenseNumber = 415,
74
+ FirstName = 416,
75
+ LastName = 417,
76
+ FullName = 418,
77
+ }
32
78
  export enum LogLevel {
33
79
  Trace = 0,
34
80
  Debug = 1,
@@ -36,6 +82,21 @@ export enum LogLevel {
36
82
  Warn = 3,
37
83
  Error = 4,
38
84
  }
85
+ export enum LoginLinkedIdType {
86
+ Username = 100,
87
+ Password = 101,
88
+ }
89
+ export enum SecureNoteType {
90
+ Generic = 0,
91
+ }
92
+ export enum UriMatchType {
93
+ Domain = 0,
94
+ Host = 1,
95
+ StartsWith = 2,
96
+ Exact = 3,
97
+ RegularExpression = 4,
98
+ Never = 5,
99
+ }
39
100
  export interface InitUserCryptoRequest {
40
101
  /**
41
102
  * The user\'s KDF parameters, as received from the prelogin request
@@ -279,6 +340,226 @@ export interface KeyGenerationError extends Error {
279
340
 
280
341
  export function isKeyGenerationError(error: any): error is KeyGenerationError;
281
342
 
343
+ export interface Cipher {
344
+ id: Uuid | undefined;
345
+ organizationId: Uuid | undefined;
346
+ folderId: Uuid | undefined;
347
+ collectionIds: Uuid[];
348
+ /**
349
+ * More recent ciphers uses individual encryption keys to encrypt the other fields of the
350
+ * Cipher.
351
+ */
352
+ key: EncString | undefined;
353
+ name: EncString;
354
+ notes: EncString | undefined;
355
+ type: CipherType;
356
+ login: Login | undefined;
357
+ identity: Identity | undefined;
358
+ card: Card | undefined;
359
+ secureNote: SecureNote | undefined;
360
+ sshKey: SshKey | undefined;
361
+ favorite: boolean;
362
+ reprompt: CipherRepromptType;
363
+ organizationUseTotp: boolean;
364
+ edit: boolean;
365
+ permissions: CipherPermissions | undefined;
366
+ viewPassword: boolean;
367
+ localData: LocalData | undefined;
368
+ attachments: Attachment[] | undefined;
369
+ fields: Field[] | undefined;
370
+ passwordHistory: PasswordHistory[] | undefined;
371
+ creationDate: DateTime<Utc>;
372
+ deletedDate: DateTime<Utc> | undefined;
373
+ revisionDate: DateTime<Utc>;
374
+ }
375
+
376
+ export interface CipherView {
377
+ id: Uuid | undefined;
378
+ organizationId: Uuid | undefined;
379
+ folderId: Uuid | undefined;
380
+ collectionIds: Uuid[];
381
+ /**
382
+ * Temporary, required to support re-encrypting existing items.
383
+ */
384
+ key: EncString | undefined;
385
+ name: string;
386
+ notes: string | undefined;
387
+ type: CipherType;
388
+ login: LoginView | undefined;
389
+ identity: IdentityView | undefined;
390
+ card: CardView | undefined;
391
+ secureNote: SecureNoteView | undefined;
392
+ sshKey: SshKeyView | undefined;
393
+ favorite: boolean;
394
+ reprompt: CipherRepromptType;
395
+ organizationUseTotp: boolean;
396
+ edit: boolean;
397
+ permissions: CipherPermissions | undefined;
398
+ viewPassword: boolean;
399
+ localData: LocalDataView | undefined;
400
+ attachments: AttachmentView[] | undefined;
401
+ fields: FieldView[] | undefined;
402
+ passwordHistory: PasswordHistoryView[] | undefined;
403
+ creationDate: DateTime<Utc>;
404
+ deletedDate: DateTime<Utc> | undefined;
405
+ revisionDate: DateTime<Utc>;
406
+ }
407
+
408
+ export type CipherListViewType =
409
+ | { login: LoginListView }
410
+ | "secureNote"
411
+ | "card"
412
+ | "identity"
413
+ | "sshKey";
414
+
415
+ export interface CipherListView {
416
+ id: Uuid | undefined;
417
+ organizationId: Uuid | undefined;
418
+ folderId: Uuid | undefined;
419
+ collectionIds: Uuid[];
420
+ /**
421
+ * Temporary, required to support calculating TOTP from CipherListView.
422
+ */
423
+ key: EncString | undefined;
424
+ name: string;
425
+ subtitle: string;
426
+ type: CipherListViewType;
427
+ favorite: boolean;
428
+ reprompt: CipherRepromptType;
429
+ organizationUseTotp: boolean;
430
+ edit: boolean;
431
+ permissions: CipherPermissions | undefined;
432
+ viewPassword: boolean;
433
+ /**
434
+ * The number of attachments
435
+ */
436
+ attachments: number;
437
+ creationDate: DateTime<Utc>;
438
+ deletedDate: DateTime<Utc> | undefined;
439
+ revisionDate: DateTime<Utc>;
440
+ }
441
+
442
+ export interface Field {
443
+ name: EncString | undefined;
444
+ value: EncString | undefined;
445
+ type: FieldType;
446
+ linkedId: LinkedIdType | undefined;
447
+ }
448
+
449
+ export interface FieldView {
450
+ name: string | undefined;
451
+ value: string | undefined;
452
+ type: FieldType;
453
+ linkedId: LinkedIdType | undefined;
454
+ }
455
+
456
+ export type LinkedIdType = LoginLinkedIdType | CardLinkedIdType | IdentityLinkedIdType;
457
+
458
+ export interface LoginUri {
459
+ uri: EncString | undefined;
460
+ match: UriMatchType | undefined;
461
+ uriChecksum: EncString | undefined;
462
+ }
463
+
464
+ export interface LoginUriView {
465
+ uri: string | undefined;
466
+ match: UriMatchType | undefined;
467
+ uriChecksum: string | undefined;
468
+ }
469
+
470
+ export interface Fido2Credential {
471
+ credentialId: EncString;
472
+ keyType: EncString;
473
+ keyAlgorithm: EncString;
474
+ keyCurve: EncString;
475
+ keyValue: EncString;
476
+ rpId: EncString;
477
+ userHandle: EncString | undefined;
478
+ userName: EncString | undefined;
479
+ counter: EncString;
480
+ rpName: EncString | undefined;
481
+ userDisplayName: EncString | undefined;
482
+ discoverable: EncString;
483
+ creationDate: DateTime<Utc>;
484
+ }
485
+
486
+ export interface Fido2CredentialListView {
487
+ credentialId: string;
488
+ rpId: string;
489
+ userHandle: string | undefined;
490
+ userName: string | undefined;
491
+ userDisplayName: string | undefined;
492
+ }
493
+
494
+ export interface Fido2CredentialView {
495
+ credentialId: string;
496
+ keyType: string;
497
+ keyAlgorithm: string;
498
+ keyCurve: string;
499
+ keyValue: EncString;
500
+ rpId: string;
501
+ userHandle: string | undefined;
502
+ userName: string | undefined;
503
+ counter: string;
504
+ rpName: string | undefined;
505
+ userDisplayName: string | undefined;
506
+ discoverable: string;
507
+ creationDate: DateTime<Utc>;
508
+ }
509
+
510
+ export interface Fido2CredentialNewView {
511
+ credentialId: string;
512
+ keyType: string;
513
+ keyAlgorithm: string;
514
+ keyCurve: string;
515
+ rpId: string;
516
+ userHandle: string | undefined;
517
+ userName: string | undefined;
518
+ counter: string;
519
+ rpName: string | undefined;
520
+ userDisplayName: string | undefined;
521
+ creationDate: DateTime<Utc>;
522
+ }
523
+
524
+ export interface Login {
525
+ username: EncString | undefined;
526
+ password: EncString | undefined;
527
+ passwordRevisionDate: DateTime<Utc> | undefined;
528
+ uris: LoginUri[] | undefined;
529
+ totp: EncString | undefined;
530
+ autofillOnPageLoad: boolean | undefined;
531
+ fido2Credentials: Fido2Credential[] | undefined;
532
+ }
533
+
534
+ export interface LoginView {
535
+ username: string | undefined;
536
+ password: string | undefined;
537
+ passwordRevisionDate: DateTime<Utc> | undefined;
538
+ uris: LoginUriView[] | undefined;
539
+ totp: string | undefined;
540
+ autofillOnPageLoad: boolean | undefined;
541
+ fido2Credentials: Fido2Credential[] | undefined;
542
+ }
543
+
544
+ export interface LoginListView {
545
+ fido2Credentials: Fido2CredentialListView[] | undefined;
546
+ hasFido2: boolean;
547
+ username: string | undefined;
548
+ /**
549
+ * The TOTP key is not decrypted. Useable as is with [`crate::generate_totp_cipher_view`].
550
+ */
551
+ totp: EncString | undefined;
552
+ uris: LoginUriView[] | undefined;
553
+ }
554
+
555
+ export interface SecureNote {
556
+ type: SecureNoteType;
557
+ }
558
+
559
+ export interface SecureNoteView {
560
+ type: SecureNoteType;
561
+ }
562
+
282
563
  export interface Folder {
283
564
  id: Uuid | undefined;
284
565
  name: EncString;
@@ -337,6 +618,16 @@ export interface TotpError extends Error {
337
618
 
338
619
  export function isTotpError(error: any): error is TotpError;
339
620
 
621
+ export interface PasswordHistoryView {
622
+ password: string;
623
+ lastUsedDate: DateTime<Utc>;
624
+ }
625
+
626
+ export interface PasswordHistory {
627
+ password: EncString;
628
+ lastUsedDate: DateTime<Utc>;
629
+ }
630
+
340
631
  export interface SshKeyView {
341
632
  /**
342
633
  * SSH private key (ed25519/rsa) in unencrypted openssh private key format [OpenSSH private key](https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key)
@@ -352,6 +643,117 @@ export interface SshKeyView {
352
643
  fingerprint: string;
353
644
  }
354
645
 
646
+ export interface SshKey {
647
+ /**
648
+ * SSH private key (ed25519/rsa) in unencrypted openssh private key format [OpenSSH private key](https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key)
649
+ */
650
+ privateKey: EncString;
651
+ /**
652
+ * SSH public key (ed25519/rsa) according to [RFC4253](https://datatracker.ietf.org/doc/html/rfc4253#section-6.6)
653
+ */
654
+ publicKey: EncString;
655
+ /**
656
+ * SSH fingerprint using SHA256 in the format: `SHA256:BASE64_ENCODED_FINGERPRINT`
657
+ */
658
+ fingerprint: EncString;
659
+ }
660
+
661
+ export interface LocalDataView {
662
+ lastUsedDate: number | undefined;
663
+ lastLaunched: number | undefined;
664
+ }
665
+
666
+ export interface LocalData {
667
+ lastUsedDate: number | undefined;
668
+ lastLaunched: number | undefined;
669
+ }
670
+
671
+ export interface IdentityView {
672
+ title: string | undefined;
673
+ firstName: string | undefined;
674
+ middleName: string | undefined;
675
+ lastName: string | undefined;
676
+ address1: string | undefined;
677
+ address2: string | undefined;
678
+ address3: string | undefined;
679
+ city: string | undefined;
680
+ state: string | undefined;
681
+ postalCode: string | undefined;
682
+ country: string | undefined;
683
+ company: string | undefined;
684
+ email: string | undefined;
685
+ phone: string | undefined;
686
+ ssn: string | undefined;
687
+ username: string | undefined;
688
+ passportNumber: string | undefined;
689
+ licenseNumber: string | undefined;
690
+ }
691
+
692
+ export interface Identity {
693
+ title: EncString | undefined;
694
+ firstName: EncString | undefined;
695
+ middleName: EncString | undefined;
696
+ lastName: EncString | undefined;
697
+ address1: EncString | undefined;
698
+ address2: EncString | undefined;
699
+ address3: EncString | undefined;
700
+ city: EncString | undefined;
701
+ state: EncString | undefined;
702
+ postalCode: EncString | undefined;
703
+ country: EncString | undefined;
704
+ company: EncString | undefined;
705
+ email: EncString | undefined;
706
+ phone: EncString | undefined;
707
+ ssn: EncString | undefined;
708
+ username: EncString | undefined;
709
+ passportNumber: EncString | undefined;
710
+ licenseNumber: EncString | undefined;
711
+ }
712
+
713
+ export interface CipherPermissions {
714
+ delete: boolean;
715
+ restore: boolean;
716
+ }
717
+
718
+ export interface CardView {
719
+ cardholderName: string | undefined;
720
+ expMonth: string | undefined;
721
+ expYear: string | undefined;
722
+ code: string | undefined;
723
+ brand: string | undefined;
724
+ number: string | undefined;
725
+ }
726
+
727
+ export interface Card {
728
+ cardholderName: EncString | undefined;
729
+ expMonth: EncString | undefined;
730
+ expYear: EncString | undefined;
731
+ code: EncString | undefined;
732
+ brand: EncString | undefined;
733
+ number: EncString | undefined;
734
+ }
735
+
736
+ export interface AttachmentView {
737
+ id: string | undefined;
738
+ url: string | undefined;
739
+ size: string | undefined;
740
+ sizeName: string | undefined;
741
+ fileName: string | undefined;
742
+ key: EncString | undefined;
743
+ }
744
+
745
+ export interface Attachment {
746
+ id: string | undefined;
747
+ url: string | undefined;
748
+ size: string | undefined;
749
+ /**
750
+ * Readable size, ex: \"4.2 KB\" or \"1.43 GB\
751
+ */
752
+ sizeName: string | undefined;
753
+ fileName: EncString | undefined;
754
+ key: EncString | undefined;
755
+ }
756
+
355
757
  export type Uuid = string;
356
758
 
357
759
  /**
@@ -392,6 +794,54 @@ export class BitwardenClient {
392
794
  crypto(): CryptoClient;
393
795
  vault(): VaultClient;
394
796
  }
797
+ export class ClientCiphers {
798
+ private constructor();
799
+ free(): void;
800
+ /**
801
+ * Encrypt cipher
802
+ *
803
+ * # Arguments
804
+ * - `cipher_view` - The decrypted cipher to encrypt
805
+ *
806
+ * # Returns
807
+ * - `Ok(Cipher)` containing the encrypted cipher
808
+ * - `Err(EncryptError)` if encryption fails
809
+ */
810
+ encrypt(cipher_view: CipherView): Cipher;
811
+ /**
812
+ * Decrypt cipher
813
+ *
814
+ * # Arguments
815
+ * - `cipher` - The encrypted cipher to decrypt
816
+ *
817
+ * # Returns
818
+ * - `Ok(CipherView)` containing the decrypted cipher
819
+ * - `Err(DecryptError)` if decryption fails
820
+ */
821
+ decrypt(cipher: Cipher): CipherView;
822
+ /**
823
+ * Decrypt list of ciphers
824
+ *
825
+ * # Arguments
826
+ * - `ciphers` - The list of encrypted ciphers to decrypt
827
+ *
828
+ * # Returns
829
+ * - `Ok(Vec<CipherListView>)` containing the decrypted ciphers
830
+ * - `Err(DecryptError)` if decryption fails
831
+ */
832
+ decrypt_list(ciphers: Cipher[]): CipherListView[];
833
+ /**
834
+ * Decrypt FIDO2 credentials
835
+ *
836
+ * # Arguments
837
+ * - `cipher_view` - Cipher to encrypt containing the FIDO2 credential
838
+ *
839
+ * # Returns
840
+ * - `Ok(Vec<Fido2CredentialView>)` containing the decrypted FIDO2 credentials
841
+ * - `Err(DecryptError)` if decryption fails
842
+ */
843
+ decrypt_fido2_credentials(cipher_view: CipherView): Fido2CredentialView[];
844
+ }
395
845
  export class ClientFolders {
396
846
  private constructor();
397
847
  free(): void;
@@ -480,6 +930,7 @@ export class SendError {
480
930
  export class VaultClient {
481
931
  private constructor();
482
932
  free(): void;
933
+ ciphers(): ClientCiphers;
483
934
  folders(): ClientFolders;
484
935
  totp(): ClientTotp;
485
936
  }