@keyhive/keyhive 0.0.0-alpha.4 → 0.0.0-alpha.6

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.
@@ -182,11 +182,22 @@ function debugString(val) {
182
182
  return className;
183
183
  }
184
184
 
185
+ function getArrayJsValueFromWasm0(ptr, len) {
186
+ ptr = ptr >>> 0;
187
+ const mem = getDataViewMemory0();
188
+ const result = [];
189
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
190
+ result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
191
+ }
192
+ wasm.__externref_drop_slice(ptr, len);
193
+ return result;
194
+ }
195
+
185
196
  const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
186
197
  ? { register: () => {}, unregister: () => {} }
187
198
  : new FinalizationRegistry(
188
199
  state => {
189
- wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b);
200
+ wasm.__wbindgen_export_7.get(state.dtor)(state.a, state.b);
190
201
  }
191
202
  );
192
203
 
@@ -204,7 +215,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
204
215
  return f(a, state.b, ...args);
205
216
  } finally {
206
217
  if (--state.cnt === 0) {
207
- wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
218
+ wasm.__wbindgen_export_7.get(state.dtor)(a, state.b);
208
219
  CLOSURE_DTORS.unregister(state);
209
220
  } else {
210
221
  state.a = a;
@@ -216,17 +227,6 @@ function makeMutClosure(arg0, arg1, dtor, f) {
216
227
  return real;
217
228
  }
218
229
 
219
- function getArrayJsValueFromWasm0(ptr, len) {
220
- ptr = ptr >>> 0;
221
- const mem = getDataViewMemory0();
222
- const result = [];
223
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
224
- result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
225
- }
226
- wasm.__externref_drop_slice(ptr, len);
227
- return result;
228
- }
229
-
230
230
  function passArray8ToWasm0(arg, malloc) {
231
231
  const ptr = malloc(arg.length * 1, 1) >>> 0;
232
232
  getUint8ArrayMemory0().set(arg, ptr / 1);
@@ -265,11 +265,11 @@ export function setPanicHook() {
265
265
  wasm.setPanicHook();
266
266
  }
267
267
 
268
- function __wbg_adapter_14(arg0, arg1, arg2) {
269
- wasm.closure423_externref_shim(arg0, arg1, arg2);
268
+ function __wbg_adapter_6(arg0, arg1, arg2) {
269
+ wasm.closure430_externref_shim(arg0, arg1, arg2);
270
270
  }
271
271
 
272
- function __wbg_adapter_274(arg0, arg1, arg2, arg3) {
272
+ function __wbg_adapter_270(arg0, arg1, arg2, arg3) {
273
273
  wasm.closure571_externref_shim(arg0, arg1, arg2, arg3);
274
274
  }
275
275
 
@@ -2006,14 +2006,13 @@ export class Keyhive {
2006
2006
  */
2007
2007
  tryEncrypt(doc, content_ref, pred_refs, content) {
2008
2008
  _assertClass(doc, Document);
2009
- var ptr0 = doc.__destroy_into_raw();
2010
2009
  _assertClass(content_ref, ChangeRef);
2011
- var ptr1 = content_ref.__destroy_into_raw();
2012
- const ptr2 = passArrayJsValueToWasm0(pred_refs, wasm.__wbindgen_malloc);
2010
+ var ptr0 = content_ref.__destroy_into_raw();
2011
+ const ptr1 = passArrayJsValueToWasm0(pred_refs, wasm.__wbindgen_malloc);
2012
+ const len1 = WASM_VECTOR_LEN;
2013
+ const ptr2 = passArray8ToWasm0(content, wasm.__wbindgen_malloc);
2013
2014
  const len2 = WASM_VECTOR_LEN;
2014
- const ptr3 = passArray8ToWasm0(content, wasm.__wbindgen_malloc);
2015
- const len3 = WASM_VECTOR_LEN;
2016
- const ret = wasm.keyhive_tryEncrypt(this.__wbg_ptr, ptr0, ptr1, ptr2, len2, ptr3, len3);
2015
+ const ret = wasm.keyhive_tryEncrypt(this.__wbg_ptr, doc.__wbg_ptr, ptr0, ptr1, len1, ptr2, len2);
2017
2016
  return ret;
2018
2017
  }
2019
2018
  /**
@@ -2025,14 +2024,13 @@ export class Keyhive {
2025
2024
  */
2026
2025
  tryEncryptArchive(doc, content_ref, pred_refs, content) {
2027
2026
  _assertClass(doc, Document);
2028
- var ptr0 = doc.__destroy_into_raw();
2029
2027
  _assertClass(content_ref, ChangeRef);
2030
- var ptr1 = content_ref.__destroy_into_raw();
2031
- const ptr2 = passArrayJsValueToWasm0(pred_refs, wasm.__wbindgen_malloc);
2028
+ var ptr0 = content_ref.__destroy_into_raw();
2029
+ const ptr1 = passArrayJsValueToWasm0(pred_refs, wasm.__wbindgen_malloc);
2030
+ const len1 = WASM_VECTOR_LEN;
2031
+ const ptr2 = passArray8ToWasm0(content, wasm.__wbindgen_malloc);
2032
2032
  const len2 = WASM_VECTOR_LEN;
2033
- const ptr3 = passArray8ToWasm0(content, wasm.__wbindgen_malloc);
2034
- const len3 = WASM_VECTOR_LEN;
2035
- const ret = wasm.keyhive_tryEncryptArchive(this.__wbg_ptr, ptr0, ptr1, ptr2, len2, ptr3, len3);
2033
+ const ret = wasm.keyhive_tryEncryptArchive(this.__wbg_ptr, doc.__wbg_ptr, ptr0, ptr1, len1, ptr2, len2);
2036
2034
  return ret;
2037
2035
  }
2038
2036
  /**
@@ -2042,16 +2040,14 @@ export class Keyhive {
2042
2040
  */
2043
2041
  tryDecrypt(doc, encrypted) {
2044
2042
  _assertClass(doc, Document);
2045
- var ptr0 = doc.__destroy_into_raw();
2046
2043
  _assertClass(encrypted, Encrypted);
2047
- var ptr1 = encrypted.__destroy_into_raw();
2048
- const ret = wasm.keyhive_tryDecrypt(this.__wbg_ptr, ptr0, ptr1);
2044
+ const ret = wasm.keyhive_tryDecrypt(this.__wbg_ptr, doc.__wbg_ptr, encrypted.__wbg_ptr);
2049
2045
  if (ret[3]) {
2050
2046
  throw takeFromExternrefTable0(ret[2]);
2051
2047
  }
2052
- var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
2048
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
2053
2049
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
2054
- return v3;
2050
+ return v1;
2055
2051
  }
2056
2052
  /**
2057
2053
  * @param {Agent} to_add
@@ -2130,8 +2126,7 @@ export class Keyhive {
2130
2126
  */
2131
2127
  receiveContactCard(contact_card) {
2132
2128
  _assertClass(contact_card, ContactCard);
2133
- var ptr0 = contact_card.__destroy_into_raw();
2134
- const ret = wasm.keyhive_receiveContactCard(this.__wbg_ptr, ptr0);
2129
+ const ret = wasm.keyhive_receiveContactCard(this.__wbg_ptr, contact_card.__wbg_ptr);
2135
2130
  if (ret[2]) {
2136
2131
  throw takeFromExternrefTable0(ret[1]);
2137
2132
  }
@@ -3123,10 +3118,6 @@ function __wbg_get_imports() {
3123
3118
  const ret = arg0.crypto;
3124
3119
  return ret;
3125
3120
  };
3126
- imports.wbg.__wbg_crypto_92ce5ebc02988b17 = function() { return handleError(function (arg0) {
3127
- const ret = arg0.crypto;
3128
- return ret;
3129
- }, arguments) };
3130
3121
  imports.wbg.__wbg_doccontentrefs_new = function(arg0) {
3131
3122
  const ret = DocContentRefs.__wrap(arg0);
3132
3123
  return ret;
@@ -3203,16 +3194,6 @@ function __wbg_get_imports() {
3203
3194
  const ret = result;
3204
3195
  return ret;
3205
3196
  };
3206
- imports.wbg.__wbg_instanceof_Window_12d20d558ef92592 = function(arg0) {
3207
- let result;
3208
- try {
3209
- result = arg0 instanceof Window;
3210
- } catch (_) {
3211
- result = false;
3212
- }
3213
- const ret = result;
3214
- return ret;
3215
- };
3216
3197
  imports.wbg.__wbg_jsdecrypterror_new = function(arg0) {
3217
3198
  const ret = JsDecryptError.__wrap(arg0);
3218
3199
  return ret;
@@ -3248,7 +3229,7 @@ function __wbg_get_imports() {
3248
3229
  const a = state0.a;
3249
3230
  state0.a = 0;
3250
3231
  try {
3251
- return __wbg_adapter_274(a, state0.b, arg0, arg1);
3232
+ return __wbg_adapter_270(a, state0.b, arg0, arg1);
3252
3233
  } finally {
3253
3234
  state0.a = a;
3254
3235
  }
@@ -3435,11 +3416,6 @@ function __wbg_get_imports() {
3435
3416
  imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
3436
3417
  throw new Error(getStringFromWasm0(arg0, arg1));
3437
3418
  };
3438
- imports.wbg.__wbindgen_cast_133053e9d0cd85aa = function(arg0, arg1) {
3439
- // Cast intrinsic for `Closure(Closure { dtor_idx: 422, function: Function { arguments: [Externref], shim_idx: 423, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3440
- const ret = makeMutClosure(arg0, arg1, 422, __wbg_adapter_14);
3441
- return ret;
3442
- };
3443
3419
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
3444
3420
  // Cast intrinsic for `Ref(String) -> Externref`.
3445
3421
  const ret = getStringFromWasm0(arg0, arg1);
@@ -3452,6 +3428,11 @@ function __wbg_get_imports() {
3452
3428
  const ret = v0;
3453
3429
  return ret;
3454
3430
  };
3431
+ imports.wbg.__wbindgen_cast_85315aadc0a89016 = function(arg0, arg1) {
3432
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 429, function: Function { arguments: [Externref], shim_idx: 430, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3433
+ const ret = makeMutClosure(arg0, arg1, 429, __wbg_adapter_6);
3434
+ return ret;
3435
+ };
3455
3436
  imports.wbg.__wbindgen_cast_ae91babfc5c19b28 = function(arg0, arg1) {
3456
3437
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
3457
3438
  wasm.__wbindgen_free(arg0, arg1 * 4, 4);
Binary file