@bitwarden/sdk-internal 0.2.0-main.137 → 0.2.0-main.139

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.
package/VERSION CHANGED
@@ -1 +1 @@
1
- f28b4efe48db42b43f2358fa9d96d0c663450abd
1
+ b99e954e32588adeb2c130b4bac9010e7c973e78
@@ -704,6 +704,13 @@ export interface CipherPermissions {
704
704
  restore: boolean;
705
705
  }
706
706
 
707
+ export interface CipherError extends Error {
708
+ name: "CipherError";
709
+ variant: "MissingFieldError" | "VaultLocked" | "CryptoError" | "AttachmentsWithoutKeys";
710
+ }
711
+
712
+ export function isCipherError(error: any): error is CipherError;
713
+
707
714
  export interface CardView {
708
715
  cardholderName: string | undefined;
709
716
  expMonth: string | undefined;
@@ -830,6 +837,20 @@ export class ClientCiphers {
830
837
  * - `Err(DecryptError)` if decryption fails
831
838
  */
832
839
  decrypt_fido2_credentials(cipher_view: CipherView): Fido2CredentialView[];
840
+ /**
841
+ * Decrypt key
842
+ *
843
+ * This method is a temporary solution to allow typescript client access to decrypted key
844
+ * values, particularly for FIDO2 credentials.
845
+ *
846
+ * # Arguments
847
+ * - `cipher_view` - Decrypted cipher containing the key
848
+ *
849
+ * # Returns
850
+ * - `Ok(String)` containing the decrypted key
851
+ * - `Err(CipherError)`
852
+ */
853
+ decrypt_fido2_private_key(cipher_view: CipherView): string;
833
854
  }
834
855
  export class ClientFolders {
835
856
  private constructor();
@@ -406,6 +406,19 @@ export function isTotpError(error) {
406
406
  }
407
407
  }
408
408
 
409
+ /**
410
+ * @param {any} error
411
+ * @returns {boolean}
412
+ */
413
+ export function isCipherError(error) {
414
+ try {
415
+ const ret = wasm.isCipherError(addBorrowedObject(error));
416
+ return ret !== 0;
417
+ } finally {
418
+ heap[stack_pointer++] = undefined;
419
+ }
420
+ }
421
+
409
422
  /**
410
423
  * @param {LogLevel} level
411
424
  */
@@ -528,7 +541,7 @@ function __wbg_adapter_50(arg0, arg1, arg2) {
528
541
  );
529
542
  }
530
543
 
531
- function __wbg_adapter_215(arg0, arg1, arg2, arg3) {
544
+ function __wbg_adapter_217(arg0, arg1, arg2, arg3) {
532
545
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h33defb2ea0fdb769(
533
546
  arg0,
534
547
  arg1,
@@ -945,6 +958,50 @@ export class ClientCiphers {
945
958
  wasm.__wbindgen_add_to_stack_pointer(16);
946
959
  }
947
960
  }
961
+ /**
962
+ * Decrypt key
963
+ *
964
+ * This method is a temporary solution to allow typescript client access to decrypted key
965
+ * values, particularly for FIDO2 credentials.
966
+ *
967
+ * # Arguments
968
+ * - `cipher_view` - Decrypted cipher containing the key
969
+ *
970
+ * # Returns
971
+ * - `Ok(String)` containing the decrypted key
972
+ * - `Err(CipherError)`
973
+ * @param {CipherView} cipher_view
974
+ * @returns {string}
975
+ */
976
+ decrypt_fido2_private_key(cipher_view) {
977
+ let deferred2_0;
978
+ let deferred2_1;
979
+ try {
980
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
981
+ wasm.clientciphers_decrypt_fido2_private_key(
982
+ retptr,
983
+ this.__wbg_ptr,
984
+ addHeapObject(cipher_view),
985
+ );
986
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
987
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
988
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
989
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
990
+ var ptr1 = r0;
991
+ var len1 = r1;
992
+ if (r3) {
993
+ ptr1 = 0;
994
+ len1 = 0;
995
+ throw takeObject(r2);
996
+ }
997
+ deferred2_0 = ptr1;
998
+ deferred2_1 = len1;
999
+ return getStringFromWasm0(ptr1, len1);
1000
+ } finally {
1001
+ wasm.__wbindgen_add_to_stack_pointer(16);
1002
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1003
+ }
1004
+ }
948
1005
  }
949
1006
 
950
1007
  const ClientFoldersFinalization =
@@ -1801,21 +1858,21 @@ export class VaultClient {
1801
1858
  * @returns {ClientCiphers}
1802
1859
  */
1803
1860
  ciphers() {
1804
- const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
1861
+ const ret = wasm.vaultclient_ciphers(this.__wbg_ptr);
1805
1862
  return ClientCiphers.__wrap(ret);
1806
1863
  }
1807
1864
  /**
1808
1865
  * @returns {ClientFolders}
1809
1866
  */
1810
1867
  folders() {
1811
- const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
1868
+ const ret = wasm.vaultclient_ciphers(this.__wbg_ptr);
1812
1869
  return ClientFolders.__wrap(ret);
1813
1870
  }
1814
1871
  /**
1815
1872
  * @returns {ClientTotp}
1816
1873
  */
1817
1874
  totp() {
1818
- const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
1875
+ const ret = wasm.vaultclient_totp(this.__wbg_ptr);
1819
1876
  return ClientTotp.__wrap(ret);
1820
1877
  }
1821
1878
  }
@@ -2070,7 +2127,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
2070
2127
  const a = state0.a;
2071
2128
  state0.a = 0;
2072
2129
  try {
2073
- return __wbg_adapter_215(a, state0.b, arg0, arg1);
2130
+ return __wbg_adapter_217(a, state0.b, arg0, arg1);
2074
2131
  } finally {
2075
2132
  state0.a = a;
2076
2133
  }
@@ -2439,7 +2496,7 @@ export function __wbindgen_cb_drop(arg0) {
2439
2496
  return ret;
2440
2497
  }
2441
2498
 
2442
- export function __wbindgen_closure_wrapper2552(arg0, arg1, arg2) {
2499
+ export function __wbindgen_closure_wrapper2563(arg0, arg1, arg2) {
2443
2500
  const ret = makeMutClosure(arg0, arg1, 634, __wbg_adapter_50);
2444
2501
  return addHeapObject(ret);
2445
2502
  }
Binary file
@@ -61,6 +61,7 @@ export const isEncryptFileError: (a: number) => number;
61
61
  export const isDecryptError: (a: number) => number;
62
62
  export const isEncryptError: (a: number) => number;
63
63
  export const isTotpError: (a: number) => number;
64
+ export const isCipherError: (a: number) => number;
64
65
  export const __wbg_bitwardenclient_free: (a: number, b: number) => void;
65
66
  export const bitwardenclient_new: (a: number) => number;
66
67
  export const bitwardenclient_echo: (a: number, b: number, c: number, d: number) => void;
@@ -112,10 +113,12 @@ export const purecrypto_symmetric_encrypt_to_array_buffer: (
112
113
  ) => void;
113
114
  export const generate_ssh_key: (a: number, b: number) => void;
114
115
  export const import_ssh_key: (a: number, b: number, c: number, d: number, e: number) => void;
116
+ export const __wbg_clientciphers_free: (a: number, b: number) => void;
115
117
  export const clientciphers_encrypt: (a: number, b: number, c: number) => void;
116
118
  export const clientciphers_decrypt: (a: number, b: number, c: number) => void;
117
119
  export const clientciphers_decrypt_list: (a: number, b: number, c: number, d: number) => void;
118
120
  export const clientciphers_decrypt_fido2_credentials: (a: number, b: number, c: number) => void;
121
+ export const clientciphers_decrypt_fido2_private_key: (a: number, b: number, c: number) => void;
119
122
  export const clientfolders_decrypt: (a: number, b: number, c: number) => void;
120
123
  export const clienttotp_generate_totp: (
121
124
  a: number,
@@ -125,16 +128,15 @@ export const clienttotp_generate_totp: (
125
128
  e: number,
126
129
  f: number,
127
130
  ) => void;
131
+ export const vaultclient_ciphers: (a: number) => number;
132
+ export const vaultclient_totp: (a: number) => number;
128
133
  export const isTestError: (a: number) => number;
134
+ export const bitwardenclient_vault: (a: number) => number;
135
+ export const vaultclient_folders: (a: number) => number;
136
+ export const __wbg_clienttotp_free: (a: number, b: number) => void;
129
137
  export const __wbg_cryptoclient_free: (a: number, b: number) => void;
130
- export const __wbg_clientciphers_free: (a: number, b: number) => void;
131
138
  export const __wbg_clientfolders_free: (a: number, b: number) => void;
132
- export const __wbg_clienttotp_free: (a: number, b: number) => void;
133
139
  export const __wbg_vaultclient_free: (a: number, b: number) => void;
134
- export const bitwardenclient_vault: (a: number) => number;
135
- export const vaultclient_ciphers: (a: number) => number;
136
- export const vaultclient_folders: (a: number) => number;
137
- export const vaultclient_totp: (a: number) => number;
138
140
  export const __wbindgen_malloc: (a: number, b: number) => number;
139
141
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
140
142
  export const __wbindgen_exn_store: (a: number) => void;