@bitwarden/sdk-internal 0.2.0-main.211 → 0.2.0-main.212

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.
@@ -1151,6 +1151,13 @@ export type Utc = unknown;
1151
1151
  */
1152
1152
  export type NonZeroU32 = number;
1153
1153
 
1154
+ export interface Repository<T> {
1155
+ get(id: string): Promise<T | null>;
1156
+ list(): Promise<T[]>;
1157
+ set(id: string, value: T): Promise<void>;
1158
+ remove(id: string): Promise<void>;
1159
+ }
1160
+
1154
1161
  export interface TestError extends Error {
1155
1162
  name: "TestError";
1156
1163
  }
@@ -1181,6 +1188,10 @@ export class BitwardenClient {
1181
1188
  http_get(url: string): Promise<string>;
1182
1189
  crypto(): CryptoClient;
1183
1190
  vault(): VaultClient;
1191
+ /**
1192
+ * Constructs a specific client for platform-specific functionality
1193
+ */
1194
+ platform(): PlatformClient;
1184
1195
  /**
1185
1196
  * Constructs a specific client for generating passwords and passphrases
1186
1197
  */
@@ -1385,6 +1396,11 @@ export class OutgoingMessage {
1385
1396
  get topic(): string | undefined;
1386
1397
  set topic(value: string | null | undefined);
1387
1398
  }
1399
+ export class PlatformClient {
1400
+ private constructor();
1401
+ free(): void;
1402
+ state(): StateClient;
1403
+ }
1388
1404
  /**
1389
1405
  * This module represents a stopgap solution to provide access to primitive crypto functions for JS
1390
1406
  * clients. It is not intended to be used outside of the JS clients and this pattern should not be
@@ -1492,6 +1508,11 @@ export class PureCrypto {
1492
1508
  verifying_key: Uint8Array,
1493
1509
  ): Uint8Array;
1494
1510
  }
1511
+ export class StateClient {
1512
+ private constructor();
1513
+ free(): void;
1514
+ register_cipher_repository(store: Repository<Cipher>): void;
1515
+ }
1495
1516
  export class TotpClient {
1496
1517
  private constructor();
1497
1518
  free(): void;
@@ -705,7 +705,7 @@ function __wbg_adapter_56(arg0, arg1, arg2) {
705
705
  );
706
706
  }
707
707
 
708
- function __wbg_adapter_260(arg0, arg1, arg2, arg3) {
708
+ function __wbg_adapter_271(arg0, arg1, arg2, arg3) {
709
709
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h8776500d04a3e634(
710
710
  arg0,
711
711
  arg1,
@@ -1036,6 +1036,14 @@ class BitwardenClient {
1036
1036
  const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
1037
1037
  return VaultClient.__wrap(ret);
1038
1038
  }
1039
+ /**
1040
+ * Constructs a specific client for platform-specific functionality
1041
+ * @returns {PlatformClient}
1042
+ */
1043
+ platform() {
1044
+ const ret = wasm.bitwardenclient_platform(this.__wbg_ptr);
1045
+ return PlatformClient.__wrap(ret);
1046
+ }
1039
1047
  /**
1040
1048
  * Constructs a specific client for generating passwords and passphrases
1041
1049
  * @returns {GeneratorClient}
@@ -2186,6 +2194,41 @@ class OutgoingMessage {
2186
2194
  }
2187
2195
  module.exports.OutgoingMessage = OutgoingMessage;
2188
2196
 
2197
+ const PlatformClientFinalization =
2198
+ typeof FinalizationRegistry === "undefined"
2199
+ ? { register: () => {}, unregister: () => {} }
2200
+ : new FinalizationRegistry((ptr) => wasm.__wbg_platformclient_free(ptr >>> 0, 1));
2201
+
2202
+ class PlatformClient {
2203
+ static __wrap(ptr) {
2204
+ ptr = ptr >>> 0;
2205
+ const obj = Object.create(PlatformClient.prototype);
2206
+ obj.__wbg_ptr = ptr;
2207
+ PlatformClientFinalization.register(obj, obj.__wbg_ptr, obj);
2208
+ return obj;
2209
+ }
2210
+
2211
+ __destroy_into_raw() {
2212
+ const ptr = this.__wbg_ptr;
2213
+ this.__wbg_ptr = 0;
2214
+ PlatformClientFinalization.unregister(this);
2215
+ return ptr;
2216
+ }
2217
+
2218
+ free() {
2219
+ const ptr = this.__destroy_into_raw();
2220
+ wasm.__wbg_platformclient_free(ptr, 0);
2221
+ }
2222
+ /**
2223
+ * @returns {StateClient}
2224
+ */
2225
+ state() {
2226
+ const ret = wasm.bitwardenclient_platform(this.__wbg_ptr);
2227
+ return StateClient.__wrap(ret);
2228
+ }
2229
+ }
2230
+ module.exports.PlatformClient = PlatformClient;
2231
+
2189
2232
  const PureCryptoFinalization =
2190
2233
  typeof FinalizationRegistry === "undefined"
2191
2234
  ? { register: () => {}, unregister: () => {} }
@@ -2941,6 +2984,40 @@ class PureCrypto {
2941
2984
  }
2942
2985
  module.exports.PureCrypto = PureCrypto;
2943
2986
 
2987
+ const StateClientFinalization =
2988
+ typeof FinalizationRegistry === "undefined"
2989
+ ? { register: () => {}, unregister: () => {} }
2990
+ : new FinalizationRegistry((ptr) => wasm.__wbg_stateclient_free(ptr >>> 0, 1));
2991
+
2992
+ class StateClient {
2993
+ static __wrap(ptr) {
2994
+ ptr = ptr >>> 0;
2995
+ const obj = Object.create(StateClient.prototype);
2996
+ obj.__wbg_ptr = ptr;
2997
+ StateClientFinalization.register(obj, obj.__wbg_ptr, obj);
2998
+ return obj;
2999
+ }
3000
+
3001
+ __destroy_into_raw() {
3002
+ const ptr = this.__wbg_ptr;
3003
+ this.__wbg_ptr = 0;
3004
+ StateClientFinalization.unregister(this);
3005
+ return ptr;
3006
+ }
3007
+
3008
+ free() {
3009
+ const ptr = this.__destroy_into_raw();
3010
+ wasm.__wbg_stateclient_free(ptr, 0);
3011
+ }
3012
+ /**
3013
+ * @param {Repository<Cipher>} store
3014
+ */
3015
+ register_cipher_repository(store) {
3016
+ wasm.stateclient_register_cipher_repository(this.__wbg_ptr, addHeapObject(store));
3017
+ }
3018
+ }
3019
+ module.exports.StateClient = StateClient;
3020
+
2944
3021
  const TotpClientFinalization =
2945
3022
  typeof FinalizationRegistry === "undefined"
2946
3023
  ? { register: () => {}, unregister: () => {} }
@@ -3212,6 +3289,21 @@ module.exports.__wbg_get_b9b93047fe3cf45b = function (arg0, arg1) {
3212
3289
  return addHeapObject(ret);
3213
3290
  };
3214
3291
 
3292
+ module.exports.__wbg_get_f7bd93223b71a83e = function () {
3293
+ return handleError(function (arg0, arg1, arg2) {
3294
+ let deferred0_0;
3295
+ let deferred0_1;
3296
+ try {
3297
+ deferred0_0 = arg1;
3298
+ deferred0_1 = arg2;
3299
+ const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2));
3300
+ return addHeapObject(ret);
3301
+ } finally {
3302
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3303
+ }
3304
+ }, arguments);
3305
+ };
3306
+
3215
3307
  module.exports.__wbg_getwithrefkey_1dc361bd10053bfe = function (arg0, arg1) {
3216
3308
  const ret = getObject(arg0)[getObject(arg1)];
3217
3309
  return addHeapObject(ret);
@@ -3312,6 +3404,13 @@ module.exports.__wbg_length_e2d2a49132c1b256 = function (arg0) {
3312
3404
  return ret;
3313
3405
  };
3314
3406
 
3407
+ module.exports.__wbg_list_a632257712ef903a = function () {
3408
+ return handleError(function (arg0) {
3409
+ const ret = getObject(arg0).list();
3410
+ return addHeapObject(ret);
3411
+ }, arguments);
3412
+ };
3413
+
3315
3414
  module.exports.__wbg_log_cad59bb680daec67 = function (arg0, arg1, arg2, arg3) {
3316
3415
  console.log(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
3317
3416
  };
@@ -3340,7 +3439,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function (arg0, arg1) {
3340
3439
  const a = state0.a;
3341
3440
  state0.a = 0;
3342
3441
  try {
3343
- return __wbg_adapter_260(a, state0.b, arg0, arg1);
3442
+ return __wbg_adapter_271(a, state0.b, arg0, arg1);
3344
3443
  } finally {
3345
3444
  state0.a = a;
3346
3445
  }
@@ -3482,6 +3581,21 @@ module.exports.__wbg_randomFillSync_ac0988aba3254290 = function () {
3482
3581
  }, arguments);
3483
3582
  };
3484
3583
 
3584
+ module.exports.__wbg_remove_bb1b975ea93b448a = function () {
3585
+ return handleError(function (arg0, arg1, arg2) {
3586
+ let deferred0_0;
3587
+ let deferred0_1;
3588
+ try {
3589
+ deferred0_0 = arg1;
3590
+ deferred0_1 = arg2;
3591
+ const ret = getObject(arg0).remove(getStringFromWasm0(arg1, arg2));
3592
+ return addHeapObject(ret);
3593
+ } finally {
3594
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3595
+ }
3596
+ }, arguments);
3597
+ };
3598
+
3485
3599
  module.exports.__wbg_require_60cc747a6bc5215a = function () {
3486
3600
  return handleError(function () {
3487
3601
  const ret = module.require;
@@ -3514,6 +3628,21 @@ module.exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
3514
3628
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
3515
3629
  };
3516
3630
 
3631
+ module.exports.__wbg_set_581efd75a64cfdb7 = function () {
3632
+ return handleError(function (arg0, arg1, arg2, arg3) {
3633
+ let deferred0_0;
3634
+ let deferred0_1;
3635
+ try {
3636
+ deferred0_0 = arg1;
3637
+ deferred0_1 = arg2;
3638
+ const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
3639
+ return addHeapObject(ret);
3640
+ } finally {
3641
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3642
+ }
3643
+ }, arguments);
3644
+ };
3645
+
3517
3646
  module.exports.__wbg_set_65595bdd868b3009 = function (arg0, arg1, arg2) {
3518
3647
  getObject(arg0).set(getObject(arg1), arg2 >>> 0);
3519
3648
  };
@@ -3697,18 +3826,18 @@ module.exports.__wbindgen_cb_drop = function (arg0) {
3697
3826
  return ret;
3698
3827
  };
3699
3828
 
3700
- module.exports.__wbindgen_closure_wrapper2485 = function (arg0, arg1, arg2) {
3701
- const ret = makeMutClosure(arg0, arg1, 722, __wbg_adapter_50);
3829
+ module.exports.__wbindgen_closure_wrapper2654 = function (arg0, arg1, arg2) {
3830
+ const ret = makeMutClosure(arg0, arg1, 795, __wbg_adapter_50);
3702
3831
  return addHeapObject(ret);
3703
3832
  };
3704
3833
 
3705
- module.exports.__wbindgen_closure_wrapper3325 = function (arg0, arg1, arg2) {
3706
- const ret = makeMutClosure(arg0, arg1, 806, __wbg_adapter_53);
3834
+ module.exports.__wbindgen_closure_wrapper3494 = function (arg0, arg1, arg2) {
3835
+ const ret = makeMutClosure(arg0, arg1, 879, __wbg_adapter_53);
3707
3836
  return addHeapObject(ret);
3708
3837
  };
3709
3838
 
3710
- module.exports.__wbindgen_closure_wrapper3738 = function (arg0, arg1, arg2) {
3711
- const ret = makeMutClosure(arg0, arg1, 929, __wbg_adapter_56);
3839
+ module.exports.__wbindgen_closure_wrapper3907 = function (arg0, arg1, arg2) {
3840
+ const ret = makeMutClosure(arg0, arg1, 1002, __wbg_adapter_56);
3712
3841
  return addHeapObject(ret);
3713
3842
  };
3714
3843
 
@@ -151,8 +151,10 @@ export const bitwardenclient_version: (a: number, b: number) => void;
151
151
  export const bitwardenclient_throw: (a: number, b: number, c: number, d: number) => void;
152
152
  export const bitwardenclient_http_get: (a: number, b: number, c: number) => number;
153
153
  export const bitwardenclient_crypto: (a: number) => number;
154
+ export const bitwardenclient_platform: (a: number) => number;
154
155
  export const set_log_level: (a: number) => void;
155
156
  export const init_sdk: (a: number) => void;
157
+ export const stateclient_register_cipher_repository: (a: number, b: number) => void;
156
158
  export const __wbg_purecrypto_free: (a: number, b: number) => void;
157
159
  export const purecrypto_symmetric_decrypt: (
158
160
  a: number,
@@ -309,6 +311,9 @@ export const purecrypto_unwrap_encapsulation_key: (
309
311
  export const bitwardenclient_vault: (a: number) => number;
310
312
  export const bitwardenclient_generator: (a: number) => number;
311
313
  export const bitwardenclient_exporters: (a: number) => number;
314
+ export const __wbg_stateclient_free: (a: number, b: number) => void;
315
+ export const __wbg_platformclient_free: (a: number, b: number) => void;
316
+ export const platformclient_state: (a: number) => number;
312
317
  export const __wbindgen_malloc: (a: number, b: number) => number;
313
318
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
314
319
  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.211",
3
+ "version": "0.2.0-main.212",
4
4
  "license": "GPL-3.0",
5
5
  "files": [
6
6
  "bitwarden_wasm_internal_bg.js",