Skip to content

Commit

Permalink
mpc utils: fix signature encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasgeihs committed Aug 27, 2023
1 parent 6a1394a commit e2c2a0a
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 e2c2a0a

Please sign in to comment.