Commit cde1353
committed
fix(sdk-lib-mpc): use @bitgo/wasm-mps/web in browser for EdDSA DKG
In browsers (webpack), importing @bitgo/wasm-mps resolves to the
--target bundler ESM build which has a race condition between
webpack's async WASM instantiation and __wbg_set_wasm being called.
This causes wasm.ed25519_dkg_round0_process to be undefined when
initDkg() runs.
Mirror the ECDSA pattern in ecdsa-dkls/dkg.ts: detect browser via
`typeof window !== 'undefined'` (excluding Electron via window.process
checks), then use @bitgo/wasm-mps/web which exposes an explicit
init() function — guaranteed ready after await.
Adds a local .d.ts shim for @bitgo/wasm-mps/web until WCI-250
publishes the ./web subpath export with its own types.
Ticket: WCI-2511 parent f3cc4eb commit cde1353
3 files changed
Lines changed: 23 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
56 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
57 | 73 | | |
58 | 74 | | |
59 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1015 | 1015 | | |
1016 | 1016 | | |
1017 | 1017 | | |
1018 | | - | |
1019 | | - | |
1020 | | - | |
1021 | | - | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
1022 | 1022 | | |
1023 | 1023 | | |
1024 | 1024 | | |
| |||
0 commit comments