Skip to content

Commit

Permalink
fix(sdk-lib-mpc): expose dkls functions from tss module
Browse files Browse the repository at this point in the history
Ticket: HSM-267
  • Loading branch information
islamaminBitGo committed Feb 16, 2024
1 parent f97e109 commit fd1da88
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
3 changes: 2 additions & 1 deletion modules/sdk-lib-mpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
},
"dependencies": {
"@noble/secp256k1": "1.6.3",
"@silencelaboratories/dkls-wasm-ll-node": "0.1.0",
"@silencelaboratories/dkls-wasm-ll-web": "1.0.1-pre.3",
"@silencelaboratories/dkls-wasm-ll-node": "1.0.1-pre.3",
"@types/superagent": "4.1.15",
"@wasmer/wasi": "^1.2.2",
"bigint-crypto-utils": "3.1.4",
Expand Down
6 changes: 5 additions & 1 deletion modules/sdk-lib-mpc/src/tss/ecdsa-dkls/dkg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export class Dkg {
if (this.dkgState != DkgState.Uninitialized) {
throw 'DKG session already initialized';
}
if (typeof window !== 'undefined') {
const initDkls = require('@silencelaboratories/dkls-wasm-ll-web');
await initDkls();
}
this.dkgSession = new KeygenSession(this.n, this.t, this.partyIdx);
try {
const payload = this.dkgSession.createFirstMessage().payload;
Expand Down Expand Up @@ -119,7 +123,7 @@ export class Dkg {
// Update ronud data.
this._deserializeState();
}
if (this.dkgState == DkgState.Round3) {
if (this.dkgState == DkgState.Round2) {
this.chainCodeCommitment = this.dkgSession.calculateChainCodeCommitment();
}
nextRoundDeserializedMessages = {
Expand Down
1 change: 1 addition & 0 deletions modules/sdk-lib-mpc/src/tss/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './ecdsa';
export * from './ecdsa-dkls';
4 changes: 4 additions & 0 deletions webpack/bitgojs.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ module.exports = {
/\@emurgo\/cardano-serialization-lib-nodejs/,
'@emurgo/cardano-serialization-lib-browser'
),
new webpack.NormalModuleReplacementPlugin(
/\@silencelaboratories\/dkls-wasm-ll-node/,
'@silencelaboratories/dkls-wasm-ll-web'
),

new webpack.ContextReplacementPlugin(/cardano-serialization-lib-browser/),
],
Expand Down
13 changes: 9 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4318,10 +4318,15 @@
resolved "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz"
integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==

"@silencelaboratories/[email protected]":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@silencelaboratories/dkls-wasm-ll-node/-/dkls-wasm-ll-node-0.1.0.tgz#49b175187c6c760706540b1ab28ade4285e8d462"
integrity sha512-DTOVmVpRb/P3foeaCky7sD16834Z7kO/oV8DVYbfAUQl30LrqfWBAcQFF4eD+RSNxve5VArsXJWlMM68dWVkDw==
"@silencelaboratories/[email protected]":
version "1.0.1-pre.3"
resolved "https://registry.yarnpkg.com/@silencelaboratories/dkls-wasm-ll-node/-/dkls-wasm-ll-node-1.0.1-pre.3.tgz#eee0d7a61b70b9012b3ca6944c3de52e7ffd0e85"
integrity sha512-i/pr1vZ6Vp29fZGCsP9pIsmAqZH5p2AWNV4mxkpdjc8twSdEC/VBtpj5ayn0jeFbnjnv2yz81Q4HNhOLXVk7VQ==

"@silencelaboratories/[email protected]":
version "1.0.1-pre.3"
resolved "https://registry.yarnpkg.com/@silencelaboratories/dkls-wasm-ll-web/-/dkls-wasm-ll-web-1.0.1-pre.3.tgz#5a64c0836eca66fed6414ac7de90266a9c98c31a"
integrity sha512-EP9SlqUOsjD4S8lSWUvBC1upDD3+MKAR2ejNOXXJRY7vgFhBeiRwGS1MIVSBA6Juop7umEkD/4xiWeWtrvBaFw==

"@sindresorhus/is@^0.14.0":
version "0.14.0"
Expand Down

0 comments on commit fd1da88

Please sign in to comment.