@bitwarden/sdk-internal 0.2.0-main.143 → 0.2.0-main.145

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
- 8f0ea145cb2d4e4260f0d924fe5a7c9d3167242d
1
+ fe76be26b4b8c75effa8e82c1e6de4d33539445b
@@ -672,20 +672,6 @@ export interface FolderView {
672
672
  revisionDate: DateTime<Utc>;
673
673
  }
674
674
 
675
- export interface DecryptFileError extends Error {
676
- name: "DecryptFileError";
677
- variant: "Decrypt" | "Io";
678
- }
679
-
680
- export function isDecryptFileError(error: any): error is DecryptFileError;
681
-
682
- export interface EncryptFileError extends Error {
683
- name: "EncryptFileError";
684
- variant: "Encrypt" | "Io";
685
- }
686
-
687
- export function isEncryptFileError(error: any): error is EncryptFileError;
688
-
689
675
  export interface DecryptError extends Error {
690
676
  name: "DecryptError";
691
677
  variant: "Crypto" | "VaultLocked";
@@ -840,6 +826,20 @@ export interface Card {
840
826
  number: EncString | undefined;
841
827
  }
842
828
 
829
+ export interface DecryptFileError extends Error {
830
+ name: "DecryptFileError";
831
+ variant: "Decrypt" | "Io";
832
+ }
833
+
834
+ export function isDecryptFileError(error: any): error is DecryptFileError;
835
+
836
+ export interface EncryptFileError extends Error {
837
+ name: "EncryptFileError";
838
+ variant: "Encrypt" | "Io";
839
+ }
840
+
841
+ export function isEncryptFileError(error: any): error is EncryptFileError;
842
+
843
843
  export interface AttachmentView {
844
844
  id: string | undefined;
845
845
  url: string | undefined;
@@ -905,6 +905,14 @@ export class BitwardenClient {
905
905
  */
906
906
  generator(): GeneratorClient;
907
907
  }
908
+ export class ClientAttachments {
909
+ private constructor();
910
+ free(): void;
911
+ /**
912
+ * Decrypts an attachment's encrypted content
913
+ */
914
+ decrypt_buffer(cipher: Cipher, attachment: Attachment, encrypted_buffer: Uint8Array): Uint8Array;
915
+ }
908
916
  export class ClientCiphers {
909
917
  private constructor();
910
918
  free(): void;
@@ -1112,6 +1120,7 @@ export class SendError {
1112
1120
  export class VaultClient {
1113
1121
  private constructor();
1114
1122
  free(): void;
1123
+ attachments(): ClientAttachments;
1115
1124
  ciphers(): ClientCiphers;
1116
1125
  folders(): ClientFolders;
1117
1126
  totp(): ClientTotp;
@@ -371,9 +371,9 @@ export function isKeyGenerationError(error) {
371
371
  * @param {any} error
372
372
  * @returns {boolean}
373
373
  */
374
- export function isDecryptFileError(error) {
374
+ export function isDecryptError(error) {
375
375
  try {
376
- const ret = wasm.isDecryptFileError(addBorrowedObject(error));
376
+ const ret = wasm.isDecryptError(addBorrowedObject(error));
377
377
  return ret !== 0;
378
378
  } finally {
379
379
  heap[stack_pointer++] = undefined;
@@ -384,9 +384,9 @@ export function isDecryptFileError(error) {
384
384
  * @param {any} error
385
385
  * @returns {boolean}
386
386
  */
387
- export function isEncryptFileError(error) {
387
+ export function isEncryptError(error) {
388
388
  try {
389
- const ret = wasm.isEncryptFileError(addBorrowedObject(error));
389
+ const ret = wasm.isEncryptError(addBorrowedObject(error));
390
390
  return ret !== 0;
391
391
  } finally {
392
392
  heap[stack_pointer++] = undefined;
@@ -397,9 +397,9 @@ export function isEncryptFileError(error) {
397
397
  * @param {any} error
398
398
  * @returns {boolean}
399
399
  */
400
- export function isDecryptError(error) {
400
+ export function isTotpError(error) {
401
401
  try {
402
- const ret = wasm.isDecryptError(addBorrowedObject(error));
402
+ const ret = wasm.isTotpError(addBorrowedObject(error));
403
403
  return ret !== 0;
404
404
  } finally {
405
405
  heap[stack_pointer++] = undefined;
@@ -410,9 +410,9 @@ export function isDecryptError(error) {
410
410
  * @param {any} error
411
411
  * @returns {boolean}
412
412
  */
413
- export function isEncryptError(error) {
413
+ export function isCipherError(error) {
414
414
  try {
415
- const ret = wasm.isEncryptError(addBorrowedObject(error));
415
+ const ret = wasm.isCipherError(addBorrowedObject(error));
416
416
  return ret !== 0;
417
417
  } finally {
418
418
  heap[stack_pointer++] = undefined;
@@ -423,9 +423,9 @@ export function isEncryptError(error) {
423
423
  * @param {any} error
424
424
  * @returns {boolean}
425
425
  */
426
- export function isTotpError(error) {
426
+ export function isDecryptFileError(error) {
427
427
  try {
428
- const ret = wasm.isTotpError(addBorrowedObject(error));
428
+ const ret = wasm.isDecryptFileError(addBorrowedObject(error));
429
429
  return ret !== 0;
430
430
  } finally {
431
431
  heap[stack_pointer++] = undefined;
@@ -436,9 +436,9 @@ export function isTotpError(error) {
436
436
  * @param {any} error
437
437
  * @returns {boolean}
438
438
  */
439
- export function isCipherError(error) {
439
+ export function isEncryptFileError(error) {
440
440
  try {
441
- const ret = wasm.isCipherError(addBorrowedObject(error));
441
+ const ret = wasm.isEncryptFileError(addBorrowedObject(error));
442
442
  return ret !== 0;
443
443
  } finally {
444
444
  heap[stack_pointer++] = undefined;
@@ -567,7 +567,7 @@ function __wbg_adapter_50(arg0, arg1, arg2) {
567
567
  );
568
568
  }
569
569
 
570
- function __wbg_adapter_222(arg0, arg1, arg2, arg3) {
570
+ function __wbg_adapter_224(arg0, arg1, arg2, arg3) {
571
571
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h33defb2ea0fdb769(
572
572
  arg0,
573
573
  arg1,
@@ -847,6 +847,67 @@ export class BitwardenClient {
847
847
  }
848
848
  }
849
849
 
850
+ const ClientAttachmentsFinalization =
851
+ typeof FinalizationRegistry === "undefined"
852
+ ? { register: () => {}, unregister: () => {} }
853
+ : new FinalizationRegistry((ptr) => wasm.__wbg_clientattachments_free(ptr >>> 0, 1));
854
+
855
+ export class ClientAttachments {
856
+ static __wrap(ptr) {
857
+ ptr = ptr >>> 0;
858
+ const obj = Object.create(ClientAttachments.prototype);
859
+ obj.__wbg_ptr = ptr;
860
+ ClientAttachmentsFinalization.register(obj, obj.__wbg_ptr, obj);
861
+ return obj;
862
+ }
863
+
864
+ __destroy_into_raw() {
865
+ const ptr = this.__wbg_ptr;
866
+ this.__wbg_ptr = 0;
867
+ ClientAttachmentsFinalization.unregister(this);
868
+ return ptr;
869
+ }
870
+
871
+ free() {
872
+ const ptr = this.__destroy_into_raw();
873
+ wasm.__wbg_clientattachments_free(ptr, 0);
874
+ }
875
+ /**
876
+ * Decrypts an attachment's encrypted content
877
+ * @param {Cipher} cipher
878
+ * @param {Attachment} attachment
879
+ * @param {Uint8Array} encrypted_buffer
880
+ * @returns {Uint8Array}
881
+ */
882
+ decrypt_buffer(cipher, attachment, encrypted_buffer) {
883
+ try {
884
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
885
+ const ptr0 = passArray8ToWasm0(encrypted_buffer, wasm.__wbindgen_malloc);
886
+ const len0 = WASM_VECTOR_LEN;
887
+ wasm.clientattachments_decrypt_buffer(
888
+ retptr,
889
+ this.__wbg_ptr,
890
+ addHeapObject(cipher),
891
+ addHeapObject(attachment),
892
+ ptr0,
893
+ len0,
894
+ );
895
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
896
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
897
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
898
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
899
+ if (r3) {
900
+ throw takeObject(r2);
901
+ }
902
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
903
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
904
+ return v2;
905
+ } finally {
906
+ wasm.__wbindgen_add_to_stack_pointer(16);
907
+ }
908
+ }
909
+ }
910
+
850
911
  const ClientCiphersFinalization =
851
912
  typeof FinalizationRegistry === "undefined"
852
913
  ? { register: () => {}, unregister: () => {} }
@@ -1989,18 +2050,25 @@ export class VaultClient {
1989
2050
  const ptr = this.__destroy_into_raw();
1990
2051
  wasm.__wbg_vaultclient_free(ptr, 0);
1991
2052
  }
2053
+ /**
2054
+ * @returns {ClientAttachments}
2055
+ */
2056
+ attachments() {
2057
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
2058
+ return ClientAttachments.__wrap(ret);
2059
+ }
1992
2060
  /**
1993
2061
  * @returns {ClientCiphers}
1994
2062
  */
1995
2063
  ciphers() {
1996
- const ret = wasm.vaultclient_ciphers(this.__wbg_ptr);
2064
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
1997
2065
  return ClientCiphers.__wrap(ret);
1998
2066
  }
1999
2067
  /**
2000
2068
  * @returns {ClientFolders}
2001
2069
  */
2002
2070
  folders() {
2003
- const ret = wasm.vaultclient_ciphers(this.__wbg_ptr);
2071
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
2004
2072
  return ClientFolders.__wrap(ret);
2005
2073
  }
2006
2074
  /**
@@ -2262,7 +2330,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
2262
2330
  const a = state0.a;
2263
2331
  state0.a = 0;
2264
2332
  try {
2265
- return __wbg_adapter_222(a, state0.b, arg0, arg1);
2333
+ return __wbg_adapter_224(a, state0.b, arg0, arg1);
2266
2334
  } finally {
2267
2335
  state0.a = a;
2268
2336
  }
@@ -2631,7 +2699,7 @@ export function __wbindgen_cb_drop(arg0) {
2631
2699
  return ret;
2632
2700
  }
2633
2701
 
2634
- export function __wbindgen_closure_wrapper2606(arg0, arg1, arg2) {
2702
+ export function __wbindgen_closure_wrapper2614(arg0, arg1, arg2) {
2635
2703
  const ret = makeMutClosure(arg0, arg1, 642, __wbg_adapter_50);
2636
2704
  return addHeapObject(ret);
2637
2705
  }
Binary file
@@ -58,12 +58,12 @@ export const __wbg_set_outgoingmessage_destination: (a: number, b: number) => vo
58
58
  export const isSshKeyExportError: (a: number) => number;
59
59
  export const isSshKeyImportError: (a: number) => number;
60
60
  export const isKeyGenerationError: (a: number) => number;
61
- export const isDecryptFileError: (a: number) => number;
62
- export const isEncryptFileError: (a: number) => number;
63
61
  export const isDecryptError: (a: number) => number;
64
62
  export const isEncryptError: (a: number) => number;
65
63
  export const isTotpError: (a: number) => number;
66
64
  export const isCipherError: (a: number) => number;
65
+ export const isDecryptFileError: (a: number) => number;
66
+ export const isEncryptFileError: (a: number) => number;
67
67
  export const __wbg_bitwardenclient_free: (a: number, b: number) => void;
68
68
  export const bitwardenclient_new: (a: number) => number;
69
69
  export const bitwardenclient_echo: (a: number, b: number, c: number, d: number) => void;
@@ -118,7 +118,15 @@ export const purecrypto_symmetric_encrypt_to_array_buffer: (
118
118
  ) => void;
119
119
  export const generate_ssh_key: (a: number, b: number) => void;
120
120
  export const import_ssh_key: (a: number, b: number, c: number, d: number, e: number) => void;
121
- export const __wbg_clientciphers_free: (a: number, b: number) => void;
121
+ export const __wbg_clientattachments_free: (a: number, b: number) => void;
122
+ export const clientattachments_decrypt_buffer: (
123
+ a: number,
124
+ b: number,
125
+ c: number,
126
+ d: number,
127
+ e: number,
128
+ f: number,
129
+ ) => void;
122
130
  export const clientciphers_encrypt: (a: number, b: number, c: number) => void;
123
131
  export const clientciphers_decrypt: (a: number, b: number, c: number) => void;
124
132
  export const clientciphers_decrypt_list: (a: number, b: number, c: number, d: number) => void;
@@ -133,15 +141,17 @@ export const clienttotp_generate_totp: (
133
141
  e: number,
134
142
  f: number,
135
143
  ) => void;
136
- export const vaultclient_ciphers: (a: number) => number;
144
+ export const vaultclient_attachments: (a: number) => number;
137
145
  export const vaultclient_totp: (a: number) => number;
138
146
  export const isTestError: (a: number) => number;
139
147
  export const bitwardenclient_vault: (a: number) => number;
148
+ export const vaultclient_ciphers: (a: number) => number;
140
149
  export const vaultclient_folders: (a: number) => number;
141
150
  export const __wbg_generatorclient_free: (a: number, b: number) => void;
142
151
  export const __wbg_vaultclient_free: (a: number, b: number) => void;
143
- export const __wbg_cryptoclient_free: (a: number, b: number) => void;
144
152
  export const __wbg_clienttotp_free: (a: number, b: number) => void;
153
+ export const __wbg_cryptoclient_free: (a: number, b: number) => void;
154
+ export const __wbg_clientciphers_free: (a: number, b: number) => void;
145
155
  export const __wbg_clientfolders_free: (a: number, b: number) => void;
146
156
  export const __wbindgen_malloc: (a: number, b: number) => number;
147
157
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;