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

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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import EventEmitter$1, { EventEmitter } from 'eventemitter3';
2
- import { TraceContext, HashAlgorithm, BaseWebSocketMessage, encryptKeyshare, WebSocketError } from '@dynamic-labs-wallet/forward-mpc-shared';
2
+ import { BaseWebSocketMessage, TraceContext, HashAlgorithm, encryptKeyshare, WebSocketError } from '@dynamic-labs-wallet/forward-mpc-shared';
3
3
  export { BaseWebSocketMessage, ErrorResponse, HandshakeV1RequestMessage, HandshakeV1ResponseMessage, SignMessageV1RequestMessage, SignMessageV1ResponseMessage, WebSocketError, WebSocketErrorType } from '@dynamic-labs-wallet/forward-mpc-shared';
4
4
  import { SigningAlgorithm } from '@dynamic-labs-wallet/core';
5
5
  export { SigningAlgorithm } from '@dynamic-labs-wallet/core';
@@ -386,6 +386,12 @@ declare class NitroAttestationVerifier implements AttestationVerifier {
386
386
  * On failure the promise is cleared so the next call may retry.
387
387
  */
388
388
  private ensureWasmInitialized;
389
+ /**
390
+ * Initialises the WASM module with environment-appropriate loading.
391
+ * In Node.js, fetch() does not support file:// URLs, so we read the
392
+ * .wasm binary from disk and use initSync() instead.
393
+ */
394
+ private initWasm;
389
395
  /**
390
396
  * Verify an attestation document using Evervault WASM bindings
391
397
  * Accepts base64-encoded attestation document directly
package/dist/index.js CHANGED
@@ -35,13 +35,32 @@ var NitroAttestationVerifier = class {
35
35
  * On failure the promise is cleared so the next call may retry.
36
36
  */
37
37
  ensureWasmInitialized() {
38
- this.wasmInitPromise ??= init().then(() => void 0).catch((error) => {
38
+ this.wasmInitPromise ??= this.initWasm().then(() => void 0).catch((error) => {
39
39
  this.wasmInitPromise = null;
40
40
  throw new Error(`Failed to initialize WASM module: ${error instanceof Error ? error.message : "Unknown error"}`);
41
41
  });
42
42
  return this.wasmInitPromise;
43
43
  }
44
44
  /**
45
+ * Initialises the WASM module with environment-appropriate loading.
46
+ * In Node.js, fetch() does not support file:// URLs, so we read the
47
+ * .wasm binary from disk and use initSync() instead.
48
+ */
49
+ async initWasm() {
50
+ if (typeof process !== "undefined" && process.versions?.node) {
51
+ const { readFileSync } = await import('fs');
52
+ const { createRequire } = await import('module');
53
+ const require2 = createRequire(import.meta.url);
54
+ const wasmPath = require2.resolve("@evervault/wasm-attestation-bindings/index_bg.wasm");
55
+ const { initSync } = await import('@evervault/wasm-attestation-bindings');
56
+ initSync({
57
+ module: readFileSync(wasmPath)
58
+ });
59
+ } else {
60
+ await init();
61
+ }
62
+ }
63
+ /**
45
64
  * Verify an attestation document using Evervault WASM bindings
46
65
  * Accepts base64-encoded attestation document directly
47
66
  *
@@ -841,7 +860,7 @@ var ForwardMPCTransport = class extends EventEmitter2 {
841
860
  this._isConnected = true;
842
861
  this._hadSuccessfulConnection = true;
843
862
  this._midSessionReconnectCount = 0;
844
- this.logger?.info("WebSocket connected", {
863
+ this.logger?.debug("WebSocket connected", {
845
864
  url: this.url
846
865
  });
847
866
  this.emit("connected");