@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 +20 -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 +19 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import EventEmitter$1, { EventEmitter } from 'eventemitter3';
|
|
2
|
-
import { TraceContext, HashAlgorithm,
|
|
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,30 @@ 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 ??=
|
|
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(readFileSync(wasmPath));
|
|
57
|
+
} else {
|
|
58
|
+
await init();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
45
62
|
* Verify an attestation document using Evervault WASM bindings
|
|
46
63
|
* Accepts base64-encoded attestation document directly
|
|
47
64
|
*
|
|
@@ -841,7 +858,7 @@ var ForwardMPCTransport = class extends EventEmitter2 {
|
|
|
841
858
|
this._isConnected = true;
|
|
842
859
|
this._hadSuccessfulConnection = true;
|
|
843
860
|
this._midSessionReconnectCount = 0;
|
|
844
|
-
this.logger?.
|
|
861
|
+
this.logger?.debug("WebSocket connected", {
|
|
845
862
|
url: this.url
|
|
846
863
|
});
|
|
847
864
|
this.emit("connected");
|