@bitwarden/sdk-internal 0.2.0-main.134 → 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.
@@ -482,6 +482,25 @@ export function import_ssh_key(imported_key, password) {
482
482
  }
483
483
  }
484
484
 
485
+ function passArrayJsValueToWasm0(array, malloc) {
486
+ const ptr = malloc(array.length * 4, 4) >>> 0;
487
+ const mem = getDataViewMemory0();
488
+ for (let i = 0; i < array.length; i++) {
489
+ mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
490
+ }
491
+ WASM_VECTOR_LEN = array.length;
492
+ return ptr;
493
+ }
494
+
495
+ function getArrayJsValueFromWasm0(ptr, len) {
496
+ ptr = ptr >>> 0;
497
+ const mem = getDataViewMemory0();
498
+ const result = [];
499
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
500
+ result.push(takeObject(mem.getUint32(i, true)));
501
+ }
502
+ return result;
503
+ }
485
504
  /**
486
505
  * @param {any} error
487
506
  * @returns {boolean}
@@ -495,7 +514,7 @@ export function isTestError(error) {
495
514
  }
496
515
  }
497
516
 
498
- function __wbg_adapter_40(arg0, arg1, arg2) {
517
+ function __wbg_adapter_50(arg0, arg1, arg2) {
499
518
  wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8ef26cc0e999965d(
500
519
  arg0,
501
520
  arg1,
@@ -503,7 +522,7 @@ function __wbg_adapter_40(arg0, arg1, arg2) {
503
522
  );
504
523
  }
505
524
 
506
- function __wbg_adapter_174(arg0, arg1, arg2, arg3) {
525
+ function __wbg_adapter_191(arg0, arg1, arg2, arg3) {
507
526
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h33defb2ea0fdb769(
508
527
  arg0,
509
528
  arg1,
@@ -512,6 +531,103 @@ function __wbg_adapter_174(arg0, arg1, arg2, arg3) {
512
531
  );
513
532
  }
514
533
 
534
+ /**
535
+ * @enum {300 | 301 | 302 | 303 | 304 | 305}
536
+ */
537
+ export const CardLinkedIdType = Object.freeze({
538
+ CardholderName: 300,
539
+ 300: "CardholderName",
540
+ ExpMonth: 301,
541
+ 301: "ExpMonth",
542
+ ExpYear: 302,
543
+ 302: "ExpYear",
544
+ Code: 303,
545
+ 303: "Code",
546
+ Brand: 304,
547
+ 304: "Brand",
548
+ Number: 305,
549
+ 305: "Number",
550
+ });
551
+ /**
552
+ * @enum {0 | 1}
553
+ */
554
+ export const CipherRepromptType = Object.freeze({
555
+ None: 0,
556
+ 0: "None",
557
+ Password: 1,
558
+ 1: "Password",
559
+ });
560
+ /**
561
+ * @enum {1 | 2 | 3 | 4 | 5}
562
+ */
563
+ export const CipherType = Object.freeze({
564
+ Login: 1,
565
+ 1: "Login",
566
+ SecureNote: 2,
567
+ 2: "SecureNote",
568
+ Card: 3,
569
+ 3: "Card",
570
+ Identity: 4,
571
+ 4: "Identity",
572
+ SshKey: 5,
573
+ 5: "SshKey",
574
+ });
575
+ /**
576
+ * @enum {0 | 1 | 2 | 3}
577
+ */
578
+ export const FieldType = Object.freeze({
579
+ Text: 0,
580
+ 0: "Text",
581
+ Hidden: 1,
582
+ 1: "Hidden",
583
+ Boolean: 2,
584
+ 2: "Boolean",
585
+ Linked: 3,
586
+ 3: "Linked",
587
+ });
588
+ /**
589
+ * @enum {400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418}
590
+ */
591
+ export const IdentityLinkedIdType = Object.freeze({
592
+ Title: 400,
593
+ 400: "Title",
594
+ MiddleName: 401,
595
+ 401: "MiddleName",
596
+ Address1: 402,
597
+ 402: "Address1",
598
+ Address2: 403,
599
+ 403: "Address2",
600
+ Address3: 404,
601
+ 404: "Address3",
602
+ City: 405,
603
+ 405: "City",
604
+ State: 406,
605
+ 406: "State",
606
+ PostalCode: 407,
607
+ 407: "PostalCode",
608
+ Country: 408,
609
+ 408: "Country",
610
+ Company: 409,
611
+ 409: "Company",
612
+ Email: 410,
613
+ 410: "Email",
614
+ Phone: 411,
615
+ 411: "Phone",
616
+ Ssn: 412,
617
+ 412: "Ssn",
618
+ Username: 413,
619
+ 413: "Username",
620
+ PassportNumber: 414,
621
+ 414: "PassportNumber",
622
+ LicenseNumber: 415,
623
+ 415: "LicenseNumber",
624
+ FirstName: 416,
625
+ 416: "FirstName",
626
+ LastName: 417,
627
+ 417: "LastName",
628
+ FullName: 418,
629
+ 418: "FullName",
630
+ });
515
631
  /**
516
632
  * @enum {0 | 1 | 2 | 3 | 4}
517
633
  */
@@ -527,6 +643,39 @@ export const LogLevel = Object.freeze({
527
643
  Error: 4,
528
644
  4: "Error",
529
645
  });
646
+ /**
647
+ * @enum {100 | 101}
648
+ */
649
+ export const LoginLinkedIdType = Object.freeze({
650
+ Username: 100,
651
+ 100: "Username",
652
+ Password: 101,
653
+ 101: "Password",
654
+ });
655
+ /**
656
+ * @enum {0}
657
+ */
658
+ export const SecureNoteType = Object.freeze({
659
+ Generic: 0,
660
+ 0: "Generic",
661
+ });
662
+ /**
663
+ * @enum {0 | 1 | 2 | 3 | 4 | 5}
664
+ */
665
+ export const UriMatchType = Object.freeze({
666
+ Domain: 0,
667
+ 0: "Domain",
668
+ Host: 1,
669
+ 1: "Host",
670
+ StartsWith: 2,
671
+ 2: "StartsWith",
672
+ Exact: 3,
673
+ 3: "Exact",
674
+ RegularExpression: 4,
675
+ 4: "RegularExpression",
676
+ Never: 5,
677
+ 5: "Never",
678
+ });
530
679
 
531
680
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
532
681
 
@@ -645,6 +794,153 @@ export class BitwardenClient {
645
794
  }
646
795
  }
647
796
 
797
+ const ClientCiphersFinalization =
798
+ typeof FinalizationRegistry === "undefined"
799
+ ? { register: () => {}, unregister: () => {} }
800
+ : new FinalizationRegistry((ptr) => wasm.__wbg_clientciphers_free(ptr >>> 0, 1));
801
+
802
+ export class ClientCiphers {
803
+ static __wrap(ptr) {
804
+ ptr = ptr >>> 0;
805
+ const obj = Object.create(ClientCiphers.prototype);
806
+ obj.__wbg_ptr = ptr;
807
+ ClientCiphersFinalization.register(obj, obj.__wbg_ptr, obj);
808
+ return obj;
809
+ }
810
+
811
+ __destroy_into_raw() {
812
+ const ptr = this.__wbg_ptr;
813
+ this.__wbg_ptr = 0;
814
+ ClientCiphersFinalization.unregister(this);
815
+ return ptr;
816
+ }
817
+
818
+ free() {
819
+ const ptr = this.__destroy_into_raw();
820
+ wasm.__wbg_clientciphers_free(ptr, 0);
821
+ }
822
+ /**
823
+ * Encrypt cipher
824
+ *
825
+ * # Arguments
826
+ * - `cipher_view` - The decrypted cipher to encrypt
827
+ *
828
+ * # Returns
829
+ * - `Ok(Cipher)` containing the encrypted cipher
830
+ * - `Err(EncryptError)` if encryption fails
831
+ * @param {CipherView} cipher_view
832
+ * @returns {Cipher}
833
+ */
834
+ encrypt(cipher_view) {
835
+ try {
836
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
837
+ wasm.clientciphers_encrypt(retptr, this.__wbg_ptr, addHeapObject(cipher_view));
838
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
839
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
840
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
841
+ if (r2) {
842
+ throw takeObject(r1);
843
+ }
844
+ return takeObject(r0);
845
+ } finally {
846
+ wasm.__wbindgen_add_to_stack_pointer(16);
847
+ }
848
+ }
849
+ /**
850
+ * Decrypt cipher
851
+ *
852
+ * # Arguments
853
+ * - `cipher` - The encrypted cipher to decrypt
854
+ *
855
+ * # Returns
856
+ * - `Ok(CipherView)` containing the decrypted cipher
857
+ * - `Err(DecryptError)` if decryption fails
858
+ * @param {Cipher} cipher
859
+ * @returns {CipherView}
860
+ */
861
+ decrypt(cipher) {
862
+ try {
863
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
864
+ wasm.clientciphers_decrypt(retptr, this.__wbg_ptr, addHeapObject(cipher));
865
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
866
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
867
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
868
+ if (r2) {
869
+ throw takeObject(r1);
870
+ }
871
+ return takeObject(r0);
872
+ } finally {
873
+ wasm.__wbindgen_add_to_stack_pointer(16);
874
+ }
875
+ }
876
+ /**
877
+ * Decrypt list of ciphers
878
+ *
879
+ * # Arguments
880
+ * - `ciphers` - The list of encrypted ciphers to decrypt
881
+ *
882
+ * # Returns
883
+ * - `Ok(Vec<CipherListView>)` containing the decrypted ciphers
884
+ * - `Err(DecryptError)` if decryption fails
885
+ * @param {Cipher[]} ciphers
886
+ * @returns {CipherListView[]}
887
+ */
888
+ decrypt_list(ciphers) {
889
+ try {
890
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
891
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
892
+ const len0 = WASM_VECTOR_LEN;
893
+ wasm.clientciphers_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
894
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
895
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
896
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
897
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
898
+ if (r3) {
899
+ throw takeObject(r2);
900
+ }
901
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
902
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
903
+ return v2;
904
+ } finally {
905
+ wasm.__wbindgen_add_to_stack_pointer(16);
906
+ }
907
+ }
908
+ /**
909
+ * Decrypt FIDO2 credentials
910
+ *
911
+ * # Arguments
912
+ * - `cipher_view` - Cipher to encrypt containing the FIDO2 credential
913
+ *
914
+ * # Returns
915
+ * - `Ok(Vec<Fido2CredentialView>)` containing the decrypted FIDO2 credentials
916
+ * - `Err(DecryptError)` if decryption fails
917
+ * @param {CipherView} cipher_view
918
+ * @returns {Fido2CredentialView[]}
919
+ */
920
+ decrypt_fido2_credentials(cipher_view) {
921
+ try {
922
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
923
+ wasm.clientciphers_decrypt_fido2_credentials(
924
+ retptr,
925
+ this.__wbg_ptr,
926
+ addHeapObject(cipher_view),
927
+ );
928
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
929
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
930
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
931
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
932
+ if (r3) {
933
+ throw takeObject(r2);
934
+ }
935
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
936
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
937
+ return v1;
938
+ } finally {
939
+ wasm.__wbindgen_add_to_stack_pointer(16);
940
+ }
941
+ }
942
+ }
943
+
648
944
  const ClientFoldersFinalization =
649
945
  typeof FinalizationRegistry === "undefined"
650
946
  ? { register: () => {}, unregister: () => {} }
@@ -1199,6 +1495,13 @@ export class VaultClient {
1199
1495
  const ptr = this.__destroy_into_raw();
1200
1496
  wasm.__wbg_vaultclient_free(ptr, 0);
1201
1497
  }
1498
+ /**
1499
+ * @returns {ClientCiphers}
1500
+ */
1501
+ ciphers() {
1502
+ const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
1503
+ return ClientCiphers.__wrap(ret);
1504
+ }
1202
1505
  /**
1203
1506
  * @returns {ClientFolders}
1204
1507
  */
@@ -1374,6 +1677,17 @@ export function __wbg_instanceof_ArrayBuffer_e14585432e3737fc(arg0) {
1374
1677
  return ret;
1375
1678
  }
1376
1679
 
1680
+ export function __wbg_instanceof_Map_f3469ce2244d2430(arg0) {
1681
+ let result;
1682
+ try {
1683
+ result = getObject(arg0) instanceof Map;
1684
+ } catch (_) {
1685
+ result = false;
1686
+ }
1687
+ const ret = result;
1688
+ return ret;
1689
+ }
1690
+
1377
1691
  export function __wbg_instanceof_Response_f2cc20d9f7dfd644(arg0) {
1378
1692
  let result;
1379
1693
  try {
@@ -1449,7 +1763,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
1449
1763
  const a = state0.a;
1450
1764
  state0.a = 0;
1451
1765
  try {
1452
- return __wbg_adapter_174(a, state0.b, arg0, arg1);
1766
+ return __wbg_adapter_191(a, state0.b, arg0, arg1);
1453
1767
  } finally {
1454
1768
  state0.a = a;
1455
1769
  }
@@ -1778,6 +2092,23 @@ export function __wbindgen_as_number(arg0) {
1778
2092
  return ret;
1779
2093
  }
1780
2094
 
2095
+ export function __wbindgen_bigint_from_i64(arg0) {
2096
+ const ret = arg0;
2097
+ return addHeapObject(ret);
2098
+ }
2099
+
2100
+ export function __wbindgen_bigint_from_u64(arg0) {
2101
+ const ret = BigInt.asUintN(64, arg0);
2102
+ return addHeapObject(ret);
2103
+ }
2104
+
2105
+ export function __wbindgen_bigint_get_as_i64(arg0, arg1) {
2106
+ const v = getObject(arg1);
2107
+ const ret = typeof v === "bigint" ? v : undefined;
2108
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
2109
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2110
+ }
2111
+
1781
2112
  export function __wbindgen_boolean_get(arg0) {
1782
2113
  const v = getObject(arg0);
1783
2114
  const ret = typeof v === "boolean" ? (v ? 1 : 0) : 2;
@@ -1794,8 +2125,8 @@ export function __wbindgen_cb_drop(arg0) {
1794
2125
  return ret;
1795
2126
  }
1796
2127
 
1797
- export function __wbindgen_closure_wrapper2219(arg0, arg1, arg2) {
1798
- const ret = makeMutClosure(arg0, arg1, 574, __wbg_adapter_40);
2128
+ export function __wbindgen_closure_wrapper2517(arg0, arg1, arg2) {
2129
+ const ret = makeMutClosure(arg0, arg1, 635, __wbg_adapter_50);
1799
2130
  return addHeapObject(ret);
1800
2131
  }
1801
2132
 
@@ -1817,6 +2148,11 @@ export function __wbindgen_in(arg0, arg1) {
1817
2148
  return ret;
1818
2149
  }
1819
2150
 
2151
+ export function __wbindgen_is_bigint(arg0) {
2152
+ const ret = typeof getObject(arg0) === "bigint";
2153
+ return ret;
2154
+ }
2155
+
1820
2156
  export function __wbindgen_is_function(arg0) {
1821
2157
  const ret = typeof getObject(arg0) === "function";
1822
2158
  return ret;
@@ -1838,6 +2174,11 @@ export function __wbindgen_is_undefined(arg0) {
1838
2174
  return ret;
1839
2175
  }
1840
2176
 
2177
+ export function __wbindgen_jsval_eq(arg0, arg1) {
2178
+ const ret = getObject(arg0) === getObject(arg1);
2179
+ return ret;
2180
+ }
2181
+
1841
2182
  export function __wbindgen_jsval_loose_eq(arg0, arg1) {
1842
2183
  const ret = getObject(arg0) == getObject(arg1);
1843
2184
  return ret;
Binary file
@@ -77,6 +77,10 @@ export const purecrypto_symmetric_encrypt_to_array_buffer: (
77
77
  ) => void;
78
78
  export const generate_ssh_key: (a: number, b: number) => void;
79
79
  export const import_ssh_key: (a: number, b: number, c: number, d: number, e: number) => void;
80
+ export const clientciphers_encrypt: (a: number, b: number, c: number) => void;
81
+ export const clientciphers_decrypt: (a: number, b: number, c: number) => void;
82
+ export const clientciphers_decrypt_list: (a: number, b: number, c: number, d: number) => void;
83
+ export const clientciphers_decrypt_fido2_credentials: (a: number, b: number, c: number) => void;
80
84
  export const clientfolders_decrypt: (a: number, b: number, c: number) => void;
81
85
  export const clienttotp_generate_totp: (
82
86
  a: number,
@@ -88,10 +92,12 @@ export const clienttotp_generate_totp: (
88
92
  ) => void;
89
93
  export const isTestError: (a: number) => number;
90
94
  export const __wbg_cryptoclient_free: (a: number, b: number) => void;
95
+ export const __wbg_clientciphers_free: (a: number, b: number) => void;
91
96
  export const __wbg_clientfolders_free: (a: number, b: number) => void;
92
97
  export const __wbg_clienttotp_free: (a: number, b: number) => void;
93
98
  export const __wbg_vaultclient_free: (a: number, b: number) => void;
94
99
  export const bitwardenclient_vault: (a: number) => number;
100
+ export const vaultclient_ciphers: (a: number) => number;
95
101
  export const vaultclient_folders: (a: number) => number;
96
102
  export const vaultclient_totp: (a: number) => number;
97
103
  export const __wbindgen_malloc: (a: number, b: number) => number;