@bitwarden/sdk-internal 0.2.0-main.144 → 0.2.0-main.146

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
- 202849503951de24a7b7487e9e97eff844346091
1
+ d27f58be6bbe85be0ade4315330533c4822b9810
@@ -131,7 +131,7 @@ export type InitUserCryptoMethod =
131
131
  deviceKey: {
132
132
  device_key: string;
133
133
  protected_device_private_key: EncString;
134
- device_protected_user_key: AsymmetricEncString;
134
+ device_protected_user_key: UnsignedSharedKey;
135
135
  };
136
136
  }
137
137
  | { keyConnector: { master_key: string; user_key: string } };
@@ -140,8 +140,8 @@ export type InitUserCryptoMethod =
140
140
  * Auth requests supports multiple initialization methods.
141
141
  */
142
142
  export type AuthRequestMethod =
143
- | { userKey: { protected_user_key: AsymmetricEncString } }
144
- | { masterKey: { protected_master_key: AsymmetricEncString; auth_request_key: EncString } };
143
+ | { userKey: { protected_user_key: UnsignedSharedKey } }
144
+ | { masterKey: { protected_master_key: UnsignedSharedKey; auth_request_key: EncString } };
145
145
 
146
146
  /**
147
147
  * Represents the request to initialize the user\'s organizational cryptographic state.
@@ -150,7 +150,7 @@ export interface InitOrgCryptoRequest {
150
150
  /**
151
151
  * The encryption keys for all the organizations the user is a part of
152
152
  */
153
- organizationKeys: Map<Uuid, AsymmetricEncString>;
153
+ organizationKeys: Map<Uuid, UnsignedSharedKey>;
154
154
  }
155
155
 
156
156
  /**
@@ -270,7 +270,7 @@ export interface ClientSettings {
270
270
  deviceType?: DeviceType;
271
271
  }
272
272
 
273
- export type AsymmetricEncString = string;
273
+ export type UnsignedSharedKey = string;
274
274
 
275
275
  export type EncString = string;
276
276
 
@@ -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;
@@ -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,8 +2699,8 @@ export function __wbindgen_cb_drop(arg0) {
2631
2699
  return ret;
2632
2700
  }
2633
2701
 
2634
- export function __wbindgen_closure_wrapper2606(arg0, arg1, arg2) {
2635
- const ret = makeMutClosure(arg0, arg1, 642, __wbg_adapter_50);
2702
+ export function __wbindgen_closure_wrapper2585(arg0, arg1, arg2) {
2703
+ const ret = makeMutClosure(arg0, arg1, 622, __wbg_adapter_50);
2636
2704
  return addHeapObject(ret);
2637
2705
  }
2638
2706
 
Binary file
@@ -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,16 +141,18 @@ 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
- export const __wbg_vaultclient_free: (a: number, b: number) => void;
143
151
  export const __wbg_cryptoclient_free: (a: number, b: number) => void;
152
+ export const __wbg_vaultclient_free: (a: number, b: number) => void;
144
153
  export const __wbg_clienttotp_free: (a: number, b: number) => void;
145
154
  export const __wbg_clientfolders_free: (a: number, b: number) => void;
155
+ export const __wbg_clientciphers_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;
148
158
  export const __wbindgen_exn_store: (a: number) => void;