@dynamic-labs-wallet/forward-mpc-client 0.5.1 → 0.5.2

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/dist/index.cjs CHANGED
@@ -10,6 +10,7 @@ var fpTs = require('fp-ts');
10
10
  var core = require('@dynamic-labs-wallet/core');
11
11
  var isows = require('isows');
12
12
 
13
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
13
14
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
15
 
15
16
  function _interopNamespace(e) {
@@ -60,13 +61,30 @@ var NitroAttestationVerifier = class {
60
61
  * On failure the promise is cleared so the next call may retry.
61
62
  */
62
63
  ensureWasmInitialized() {
63
- this.wasmInitPromise ??= init__default.default().then(() => void 0).catch((error) => {
64
+ this.wasmInitPromise ??= this.initWasm().then(() => void 0).catch((error) => {
64
65
  this.wasmInitPromise = null;
65
66
  throw new Error(`Failed to initialize WASM module: ${error instanceof Error ? error.message : "Unknown error"}`);
66
67
  });
67
68
  return this.wasmInitPromise;
68
69
  }
69
70
  /**
71
+ * Initialises the WASM module with environment-appropriate loading.
72
+ * In Node.js, fetch() does not support file:// URLs, so we read the
73
+ * .wasm binary from disk and use initSync() instead.
74
+ */
75
+ async initWasm() {
76
+ if (typeof process !== "undefined" && process.versions?.node) {
77
+ const { readFileSync } = await import('fs');
78
+ const { createRequire } = await import('module');
79
+ const require2 = createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
80
+ const wasmPath = require2.resolve("@evervault/wasm-attestation-bindings/index_bg.wasm");
81
+ const { initSync } = await import('@evervault/wasm-attestation-bindings');
82
+ initSync(readFileSync(wasmPath));
83
+ } else {
84
+ await init__default.default();
85
+ }
86
+ }
87
+ /**
70
88
  * Verify an attestation document using Evervault WASM bindings
71
89
  * Accepts base64-encoded attestation document directly
72
90
  *
@@ -866,7 +884,7 @@ var ForwardMPCTransport = class extends EventEmitter2__default.default {
866
884
  this._isConnected = true;
867
885
  this._hadSuccessfulConnection = true;
868
886
  this._midSessionReconnectCount = 0;
869
- this.logger?.info("WebSocket connected", {
887
+ this.logger?.debug("WebSocket connected", {
870
888
  url: this.url
871
889
  });
872
890
  this.emit("connected");