Skip to content

Commit

Permalink
Merge pull request #198 from Web3Auth/fix/tss-encoding
Browse files Browse the repository at this point in the history
mpc utils: fix signature encoding
  • Loading branch information
yashovardhan authored Sep 4, 2023
2 parents 6a1394a + e2c2a0a commit a08f675
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions mpc-core-kit/tkey-mpc-react-bitcoin-example/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,7 @@ export const setupWeb3 = async (loginReponse: any, signingParams: any) => {
signatures,
});
await client.cleanup(tss, { signatures, server_coeffs: serverCoeffs });
const sig = {
v: recoveryParam,
r: Buffer.from(r.toString("hex").padStart(64, "0"), "hex"),
s: Buffer.from(s.toString("hex").padStart(64, "0"), "hex"),
};
const sig = { v: recoveryParam, r: r.toArrayLike(Buffer, "be", 32), s: s.toArrayLike(Buffer, "be", 32) };
const sigBuffer = Buffer.concat([sig.r, sig.s]);
return Promise.resolve(sigBuffer);
};
Expand Down
2 changes: 1 addition & 1 deletion mpc-core-kit/tkey-mpc-react-firebase-example/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const setupWeb3 = async (chainConfig: Omit<CustomChainConfig, "chainNames
signatures,
});
await client.cleanup(tss, { signatures, server_coeffs: serverCoeffs });
return { v: recoveryParam, r: Buffer.from(r.toString("hex"), "hex"), s: Buffer.from(s.toString("hex"), "hex") };
return { v: recoveryParam, r: r.toArrayLike(Buffer, "be", 32), s: s.toArrayLike(Buffer, "be", 32) };
};

if (!compressedTSSPubKey) {
Expand Down
2 changes: 1 addition & 1 deletion mpc-core-kit/tkey-mpc-react-popup-example/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const setupWeb3 = async (chainConfig: Omit<CustomChainConfig, "chainNames
signatures,
});
await client.cleanup(tss, { signatures, server_coeffs: serverCoeffs });
return { v: recoveryParam, r: Buffer.from(r.toString("hex"), "hex"), s: Buffer.from(s.toString("hex"), "hex") };
return { v: recoveryParam, r: r.toArrayLike(Buffer, "be", 32), s: s.toArrayLike(Buffer, "be", 32) };
};

if (!compressedTSSPubKey) {
Expand Down

0 comments on commit a08f675

Please sign in to comment.