@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.
@@ -476,6 +476,25 @@ module.exports.import_ssh_key = function (imported_key, password) {
476
476
  }
477
477
  };
478
478
 
479
+ function passArrayJsValueToWasm0(array, malloc) {
480
+ const ptr = malloc(array.length * 4, 4) >>> 0;
481
+ const mem = getDataViewMemory0();
482
+ for (let i = 0; i < array.length; i++) {
483
+ mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
484
+ }
485
+ WASM_VECTOR_LEN = array.length;
486
+ return ptr;
487
+ }
488
+
489
+ function getArrayJsValueFromWasm0(ptr, len) {
490
+ ptr = ptr >>> 0;
491
+ const mem = getDataViewMemory0();
492
+ const result = [];
493
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
494
+ result.push(takeObject(mem.getUint32(i, true)));
495
+ }
496
+ return result;
497
+ }
479
498
  /**
480
499
  * @param {any} error
481
500
  * @returns {boolean}
@@ -489,7 +508,7 @@ module.exports.isTestError = function (error) {
489
508
  }
490
509
  };
491
510
 
492
- function __wbg_adapter_40(arg0, arg1, arg2) {
511
+ function __wbg_adapter_50(arg0, arg1, arg2) {
493
512
  wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8ef26cc0e999965d(
494
513
  arg0,
495
514
  arg1,
@@ -497,7 +516,7 @@ function __wbg_adapter_40(arg0, arg1, arg2) {
497
516
  );
498
517
  }
499
518
 
500
- function __wbg_adapter_174(arg0, arg1, arg2, arg3) {
519
+ function __wbg_adapter_191(arg0, arg1, arg2, arg3) {
501
520
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h33defb2ea0fdb769(
502
521
  arg0,
503
522
  arg1,
@@ -506,6 +525,103 @@ function __wbg_adapter_174(arg0, arg1, arg2, arg3) {
506
525
  );
507
526
  }
508
527
 
528
+ /**
529
+ * @enum {300 | 301 | 302 | 303 | 304 | 305}
530
+ */
531
+ module.exports.CardLinkedIdType = Object.freeze({
532
+ CardholderName: 300,
533
+ 300: "CardholderName",
534
+ ExpMonth: 301,
535
+ 301: "ExpMonth",
536
+ ExpYear: 302,
537
+ 302: "ExpYear",
538
+ Code: 303,
539
+ 303: "Code",
540
+ Brand: 304,
541
+ 304: "Brand",
542
+ Number: 305,
543
+ 305: "Number",
544
+ });
545
+ /**
546
+ * @enum {0 | 1}
547
+ */
548
+ module.exports.CipherRepromptType = Object.freeze({
549
+ None: 0,
550
+ 0: "None",
551
+ Password: 1,
552
+ 1: "Password",
553
+ });
554
+ /**
555
+ * @enum {1 | 2 | 3 | 4 | 5}
556
+ */
557
+ module.exports.CipherType = Object.freeze({
558
+ Login: 1,
559
+ 1: "Login",
560
+ SecureNote: 2,
561
+ 2: "SecureNote",
562
+ Card: 3,
563
+ 3: "Card",
564
+ Identity: 4,
565
+ 4: "Identity",
566
+ SshKey: 5,
567
+ 5: "SshKey",
568
+ });
569
+ /**
570
+ * @enum {0 | 1 | 2 | 3}
571
+ */
572
+ module.exports.FieldType = Object.freeze({
573
+ Text: 0,
574
+ 0: "Text",
575
+ Hidden: 1,
576
+ 1: "Hidden",
577
+ Boolean: 2,
578
+ 2: "Boolean",
579
+ Linked: 3,
580
+ 3: "Linked",
581
+ });
582
+ /**
583
+ * @enum {400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418}
584
+ */
585
+ module.exports.IdentityLinkedIdType = Object.freeze({
586
+ Title: 400,
587
+ 400: "Title",
588
+ MiddleName: 401,
589
+ 401: "MiddleName",
590
+ Address1: 402,
591
+ 402: "Address1",
592
+ Address2: 403,
593
+ 403: "Address2",
594
+ Address3: 404,
595
+ 404: "Address3",
596
+ City: 405,
597
+ 405: "City",
598
+ State: 406,
599
+ 406: "State",
600
+ PostalCode: 407,
601
+ 407: "PostalCode",
602
+ Country: 408,
603
+ 408: "Country",
604
+ Company: 409,
605
+ 409: "Company",
606
+ Email: 410,
607
+ 410: "Email",
608
+ Phone: 411,
609
+ 411: "Phone",
610
+ Ssn: 412,
611
+ 412: "Ssn",
612
+ Username: 413,
613
+ 413: "Username",
614
+ PassportNumber: 414,
615
+ 414: "PassportNumber",
616
+ LicenseNumber: 415,
617
+ 415: "LicenseNumber",
618
+ FirstName: 416,
619
+ 416: "FirstName",
620
+ LastName: 417,
621
+ 417: "LastName",
622
+ FullName: 418,
623
+ 418: "FullName",
624
+ });
509
625
  /**
510
626
  * @enum {0 | 1 | 2 | 3 | 4}
511
627
  */
@@ -521,6 +637,39 @@ module.exports.LogLevel = Object.freeze({
521
637
  Error: 4,
522
638
  4: "Error",
523
639
  });
640
+ /**
641
+ * @enum {100 | 101}
642
+ */
643
+ module.exports.LoginLinkedIdType = Object.freeze({
644
+ Username: 100,
645
+ 100: "Username",
646
+ Password: 101,
647
+ 101: "Password",
648
+ });
649
+ /**
650
+ * @enum {0}
651
+ */
652
+ module.exports.SecureNoteType = Object.freeze({
653
+ Generic: 0,
654
+ 0: "Generic",
655
+ });
656
+ /**
657
+ * @enum {0 | 1 | 2 | 3 | 4 | 5}
658
+ */
659
+ module.exports.UriMatchType = Object.freeze({
660
+ Domain: 0,
661
+ 0: "Domain",
662
+ Host: 1,
663
+ 1: "Host",
664
+ StartsWith: 2,
665
+ 2: "StartsWith",
666
+ Exact: 3,
667
+ 3: "Exact",
668
+ RegularExpression: 4,
669
+ 4: "RegularExpression",
670
+ Never: 5,
671
+ 5: "Never",
672
+ });
524
673
 
525
674
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
526
675
 
@@ -640,6 +789,154 @@ class BitwardenClient {
640
789
  }
641
790
  module.exports.BitwardenClient = BitwardenClient;
642
791
 
792
+ const ClientCiphersFinalization =
793
+ typeof FinalizationRegistry === "undefined"
794
+ ? { register: () => {}, unregister: () => {} }
795
+ : new FinalizationRegistry((ptr) => wasm.__wbg_clientciphers_free(ptr >>> 0, 1));
796
+
797
+ class ClientCiphers {
798
+ static __wrap(ptr) {
799
+ ptr = ptr >>> 0;
800
+ const obj = Object.create(ClientCiphers.prototype);
801
+ obj.__wbg_ptr = ptr;
802
+ ClientCiphersFinalization.register(obj, obj.__wbg_ptr, obj);
803
+ return obj;
804
+ }
805
+
806
+ __destroy_into_raw() {
807
+ const ptr = this.__wbg_ptr;
808
+ this.__wbg_ptr = 0;
809
+ ClientCiphersFinalization.unregister(this);
810
+ return ptr;
811
+ }
812
+
813
+ free() {
814
+ const ptr = this.__destroy_into_raw();
815
+ wasm.__wbg_clientciphers_free(ptr, 0);
816
+ }
817
+ /**
818
+ * Encrypt cipher
819
+ *
820
+ * # Arguments
821
+ * - `cipher_view` - The decrypted cipher to encrypt
822
+ *
823
+ * # Returns
824
+ * - `Ok(Cipher)` containing the encrypted cipher
825
+ * - `Err(EncryptError)` if encryption fails
826
+ * @param {CipherView} cipher_view
827
+ * @returns {Cipher}
828
+ */
829
+ encrypt(cipher_view) {
830
+ try {
831
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
832
+ wasm.clientciphers_encrypt(retptr, this.__wbg_ptr, addHeapObject(cipher_view));
833
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
834
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
835
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
836
+ if (r2) {
837
+ throw takeObject(r1);
838
+ }
839
+ return takeObject(r0);
840
+ } finally {
841
+ wasm.__wbindgen_add_to_stack_pointer(16);
842
+ }
843
+ }
844
+ /**
845
+ * Decrypt cipher
846
+ *
847
+ * # Arguments
848
+ * - `cipher` - The encrypted cipher to decrypt
849
+ *
850
+ * # Returns
851
+ * - `Ok(CipherView)` containing the decrypted cipher
852
+ * - `Err(DecryptError)` if decryption fails
853
+ * @param {Cipher} cipher
854
+ * @returns {CipherView}
855
+ */
856
+ decrypt(cipher) {
857
+ try {
858
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
859
+ wasm.clientciphers_decrypt(retptr, this.__wbg_ptr, addHeapObject(cipher));
860
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
861
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
862
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
863
+ if (r2) {
864
+ throw takeObject(r1);
865
+ }
866
+ return takeObject(r0);
867
+ } finally {
868
+ wasm.__wbindgen_add_to_stack_pointer(16);
869
+ }
870
+ }
871
+ /**
872
+ * Decrypt list of ciphers
873
+ *
874
+ * # Arguments
875
+ * - `ciphers` - The list of encrypted ciphers to decrypt
876
+ *
877
+ * # Returns
878
+ * - `Ok(Vec<CipherListView>)` containing the decrypted ciphers
879
+ * - `Err(DecryptError)` if decryption fails
880
+ * @param {Cipher[]} ciphers
881
+ * @returns {CipherListView[]}
882
+ */
883
+ decrypt_list(ciphers) {
884
+ try {
885
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
886
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
887
+ const len0 = WASM_VECTOR_LEN;
888
+ wasm.clientciphers_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
889
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
890
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
891
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
892
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
893
+ if (r3) {
894
+ throw takeObject(r2);
895
+ }
896
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
897
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
898
+ return v2;
899
+ } finally {
900
+ wasm.__wbindgen_add_to_stack_pointer(16);
901
+ }
902
+ }
903
+ /**
904
+ * Decrypt FIDO2 credentials
905
+ *
906
+ * # Arguments
907
+ * - `cipher_view` - Cipher to encrypt containing the FIDO2 credential
908
+ *
909
+ * # Returns
910
+ * - `Ok(Vec<Fido2CredentialView>)` containing the decrypted FIDO2 credentials
911
+ * - `Err(DecryptError)` if decryption fails
912
+ * @param {CipherView} cipher_view
913
+ * @returns {Fido2CredentialView[]}
914
+ */
915
+ decrypt_fido2_credentials(cipher_view) {
916
+ try {
917
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
918
+ wasm.clientciphers_decrypt_fido2_credentials(
919
+ retptr,
920
+ this.__wbg_ptr,
921
+ addHeapObject(cipher_view),
922
+ );
923
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
924
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
925
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
926
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
927
+ if (r3) {
928
+ throw takeObject(r2);
929
+ }
930
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
931
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
932
+ return v1;
933
+ } finally {
934
+ wasm.__wbindgen_add_to_stack_pointer(16);
935
+ }
936
+ }
937
+ }
938
+ module.exports.ClientCiphers = ClientCiphers;
939
+
643
940
  const ClientFoldersFinalization =
644
941
  typeof FinalizationRegistry === "undefined"
645
942
  ? { register: () => {}, unregister: () => {} }
@@ -1201,6 +1498,13 @@ class VaultClient {
1201
1498
  const ptr = this.__destroy_into_raw();
1202
1499
  wasm.__wbg_vaultclient_free(ptr, 0);
1203
1500
  }
1501
+ /**
1502
+ * @returns {ClientCiphers}
1503
+ */
1504
+ ciphers() {
1505
+ const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
1506
+ return ClientCiphers.__wrap(ret);
1507
+ }
1204
1508
  /**
1205
1509
  * @returns {ClientFolders}
1206
1510
  */
@@ -1377,6 +1681,17 @@ module.exports.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function (arg0) {
1377
1681
  return ret;
1378
1682
  };
1379
1683
 
1684
+ module.exports.__wbg_instanceof_Map_f3469ce2244d2430 = function (arg0) {
1685
+ let result;
1686
+ try {
1687
+ result = getObject(arg0) instanceof Map;
1688
+ } catch (_) {
1689
+ result = false;
1690
+ }
1691
+ const ret = result;
1692
+ return ret;
1693
+ };
1694
+
1380
1695
  module.exports.__wbg_instanceof_Response_f2cc20d9f7dfd644 = function (arg0) {
1381
1696
  let result;
1382
1697
  try {
@@ -1452,7 +1767,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function (arg0, arg1) {
1452
1767
  const a = state0.a;
1453
1768
  state0.a = 0;
1454
1769
  try {
1455
- return __wbg_adapter_174(a, state0.b, arg0, arg1);
1770
+ return __wbg_adapter_191(a, state0.b, arg0, arg1);
1456
1771
  } finally {
1457
1772
  state0.a = a;
1458
1773
  }
@@ -1781,6 +2096,23 @@ module.exports.__wbindgen_as_number = function (arg0) {
1781
2096
  return ret;
1782
2097
  };
1783
2098
 
2099
+ module.exports.__wbindgen_bigint_from_i64 = function (arg0) {
2100
+ const ret = arg0;
2101
+ return addHeapObject(ret);
2102
+ };
2103
+
2104
+ module.exports.__wbindgen_bigint_from_u64 = function (arg0) {
2105
+ const ret = BigInt.asUintN(64, arg0);
2106
+ return addHeapObject(ret);
2107
+ };
2108
+
2109
+ module.exports.__wbindgen_bigint_get_as_i64 = function (arg0, arg1) {
2110
+ const v = getObject(arg1);
2111
+ const ret = typeof v === "bigint" ? v : undefined;
2112
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
2113
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2114
+ };
2115
+
1784
2116
  module.exports.__wbindgen_boolean_get = function (arg0) {
1785
2117
  const v = getObject(arg0);
1786
2118
  const ret = typeof v === "boolean" ? (v ? 1 : 0) : 2;
@@ -1797,8 +2129,8 @@ module.exports.__wbindgen_cb_drop = function (arg0) {
1797
2129
  return ret;
1798
2130
  };
1799
2131
 
1800
- module.exports.__wbindgen_closure_wrapper2219 = function (arg0, arg1, arg2) {
1801
- const ret = makeMutClosure(arg0, arg1, 574, __wbg_adapter_40);
2132
+ module.exports.__wbindgen_closure_wrapper2517 = function (arg0, arg1, arg2) {
2133
+ const ret = makeMutClosure(arg0, arg1, 635, __wbg_adapter_50);
1802
2134
  return addHeapObject(ret);
1803
2135
  };
1804
2136
 
@@ -1820,6 +2152,11 @@ module.exports.__wbindgen_in = function (arg0, arg1) {
1820
2152
  return ret;
1821
2153
  };
1822
2154
 
2155
+ module.exports.__wbindgen_is_bigint = function (arg0) {
2156
+ const ret = typeof getObject(arg0) === "bigint";
2157
+ return ret;
2158
+ };
2159
+
1823
2160
  module.exports.__wbindgen_is_function = function (arg0) {
1824
2161
  const ret = typeof getObject(arg0) === "function";
1825
2162
  return ret;
@@ -1841,6 +2178,11 @@ module.exports.__wbindgen_is_undefined = function (arg0) {
1841
2178
  return ret;
1842
2179
  };
1843
2180
 
2181
+ module.exports.__wbindgen_jsval_eq = function (arg0, arg1) {
2182
+ const ret = getObject(arg0) === getObject(arg1);
2183
+ return ret;
2184
+ };
2185
+
1844
2186
  module.exports.__wbindgen_jsval_loose_eq = function (arg0, arg1) {
1845
2187
  const ret = getObject(arg0) == getObject(arg1);
1846
2188
  return ret;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitwarden/sdk-internal",
3
- "version": "0.2.0-main.133",
3
+ "version": "0.2.0-main.135",
4
4
  "license": "GPL-3.0",
5
5
  "files": [
6
6
  "bitwarden_wasm_internal_bg.js",