@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.
@@ -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;
@@ -561,7 +561,7 @@ function __wbg_adapter_50(arg0, arg1, arg2) {
561
561
  );
562
562
  }
563
563
 
564
- function __wbg_adapter_222(arg0, arg1, arg2, arg3) {
564
+ function __wbg_adapter_224(arg0, arg1, arg2, arg3) {
565
565
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h33defb2ea0fdb769(
566
566
  arg0,
567
567
  arg1,
@@ -842,6 +842,68 @@ class BitwardenClient {
842
842
  }
843
843
  module.exports.BitwardenClient = BitwardenClient;
844
844
 
845
+ const ClientAttachmentsFinalization =
846
+ typeof FinalizationRegistry === "undefined"
847
+ ? { register: () => {}, unregister: () => {} }
848
+ : new FinalizationRegistry((ptr) => wasm.__wbg_clientattachments_free(ptr >>> 0, 1));
849
+
850
+ class ClientAttachments {
851
+ static __wrap(ptr) {
852
+ ptr = ptr >>> 0;
853
+ const obj = Object.create(ClientAttachments.prototype);
854
+ obj.__wbg_ptr = ptr;
855
+ ClientAttachmentsFinalization.register(obj, obj.__wbg_ptr, obj);
856
+ return obj;
857
+ }
858
+
859
+ __destroy_into_raw() {
860
+ const ptr = this.__wbg_ptr;
861
+ this.__wbg_ptr = 0;
862
+ ClientAttachmentsFinalization.unregister(this);
863
+ return ptr;
864
+ }
865
+
866
+ free() {
867
+ const ptr = this.__destroy_into_raw();
868
+ wasm.__wbg_clientattachments_free(ptr, 0);
869
+ }
870
+ /**
871
+ * Decrypts an attachment's encrypted content
872
+ * @param {Cipher} cipher
873
+ * @param {Attachment} attachment
874
+ * @param {Uint8Array} encrypted_buffer
875
+ * @returns {Uint8Array}
876
+ */
877
+ decrypt_buffer(cipher, attachment, encrypted_buffer) {
878
+ try {
879
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
880
+ const ptr0 = passArray8ToWasm0(encrypted_buffer, wasm.__wbindgen_malloc);
881
+ const len0 = WASM_VECTOR_LEN;
882
+ wasm.clientattachments_decrypt_buffer(
883
+ retptr,
884
+ this.__wbg_ptr,
885
+ addHeapObject(cipher),
886
+ addHeapObject(attachment),
887
+ ptr0,
888
+ len0,
889
+ );
890
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
891
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
892
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
893
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
894
+ if (r3) {
895
+ throw takeObject(r2);
896
+ }
897
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
898
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
899
+ return v2;
900
+ } finally {
901
+ wasm.__wbindgen_add_to_stack_pointer(16);
902
+ }
903
+ }
904
+ }
905
+ module.exports.ClientAttachments = ClientAttachments;
906
+
845
907
  const ClientCiphersFinalization =
846
908
  typeof FinalizationRegistry === "undefined"
847
909
  ? { register: () => {}, unregister: () => {} }
@@ -1995,18 +2057,25 @@ class VaultClient {
1995
2057
  const ptr = this.__destroy_into_raw();
1996
2058
  wasm.__wbg_vaultclient_free(ptr, 0);
1997
2059
  }
2060
+ /**
2061
+ * @returns {ClientAttachments}
2062
+ */
2063
+ attachments() {
2064
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
2065
+ return ClientAttachments.__wrap(ret);
2066
+ }
1998
2067
  /**
1999
2068
  * @returns {ClientCiphers}
2000
2069
  */
2001
2070
  ciphers() {
2002
- const ret = wasm.vaultclient_ciphers(this.__wbg_ptr);
2071
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
2003
2072
  return ClientCiphers.__wrap(ret);
2004
2073
  }
2005
2074
  /**
2006
2075
  * @returns {ClientFolders}
2007
2076
  */
2008
2077
  folders() {
2009
- const ret = wasm.vaultclient_ciphers(this.__wbg_ptr);
2078
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
2010
2079
  return ClientFolders.__wrap(ret);
2011
2080
  }
2012
2081
  /**
@@ -2269,7 +2338,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function (arg0, arg1) {
2269
2338
  const a = state0.a;
2270
2339
  state0.a = 0;
2271
2340
  try {
2272
- return __wbg_adapter_222(a, state0.b, arg0, arg1);
2341
+ return __wbg_adapter_224(a, state0.b, arg0, arg1);
2273
2342
  } finally {
2274
2343
  state0.a = a;
2275
2344
  }
@@ -2638,8 +2707,8 @@ module.exports.__wbindgen_cb_drop = function (arg0) {
2638
2707
  return ret;
2639
2708
  };
2640
2709
 
2641
- module.exports.__wbindgen_closure_wrapper2606 = function (arg0, arg1, arg2) {
2642
- const ret = makeMutClosure(arg0, arg1, 642, __wbg_adapter_50);
2710
+ module.exports.__wbindgen_closure_wrapper2585 = function (arg0, arg1, arg2) {
2711
+ const ret = makeMutClosure(arg0, arg1, 622, __wbg_adapter_50);
2643
2712
  return addHeapObject(ret);
2644
2713
  };
2645
2714
 
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitwarden/sdk-internal",
3
- "version": "0.2.0-main.144",
3
+ "version": "0.2.0-main.146",
4
4
  "license": "GPL-3.0",
5
5
  "files": [
6
6
  "bitwarden_wasm_internal_bg.js",