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

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
+ c2434ae3b338ba1aff2672cead79a960448a76d7
@@ -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 =
@@ -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_wrapper2559(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;
@@ -116,6 +117,7 @@ export const clientciphers_encrypt: (a: number, b: number, c: number) => void;
116
117
  export const clientciphers_decrypt: (a: number, b: number, c: number) => void;
117
118
  export const clientciphers_decrypt_list: (a: number, b: number, c: number, d: number) => void;
118
119
  export const clientciphers_decrypt_fido2_credentials: (a: number, b: number, c: number) => void;
120
+ export const clientciphers_decrypt_fido2_private_key: (a: number, b: number, c: number) => void;
119
121
  export const clientfolders_decrypt: (a: number, b: number, c: number) => void;
120
122
  export const clienttotp_generate_totp: (
121
123
  a: number,