@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.cjs +22 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +21 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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,32 @@ 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 ??=
|
|
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({
|
|
83
|
+
module: readFileSync(wasmPath)
|
|
84
|
+
});
|
|
85
|
+
} else {
|
|
86
|
+
await init__default.default();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
70
90
|
* Verify an attestation document using Evervault WASM bindings
|
|
71
91
|
* Accepts base64-encoded attestation document directly
|
|
72
92
|
*
|
|
@@ -866,7 +886,7 @@ var ForwardMPCTransport = class extends EventEmitter2__default.default {
|
|
|
866
886
|
this._isConnected = true;
|
|
867
887
|
this._hadSuccessfulConnection = true;
|
|
868
888
|
this._midSessionReconnectCount = 0;
|
|
869
|
-
this.logger?.
|
|
889
|
+
this.logger?.debug("WebSocket connected", {
|
|
870
890
|
url: this.url
|
|
871
891
|
});
|
|
872
892
|
this.emit("connected");
|