From e2c2a0a0e171b8758e36fd9eb269a87a666cee88 Mon Sep 17 00:00:00 2001 From: Matthias Geihs Date: Mon, 28 Aug 2023 00:15:54 +0800 Subject: [PATCH] mpc utils: fix signature encoding --- mpc-core-kit/tkey-mpc-react-bitcoin-example/src/utils.ts | 6 +----- mpc-core-kit/tkey-mpc-react-firebase-example/src/utils.ts | 2 +- mpc-core-kit/tkey-mpc-react-popup-example/src/utils.ts | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/mpc-core-kit/tkey-mpc-react-bitcoin-example/src/utils.ts b/mpc-core-kit/tkey-mpc-react-bitcoin-example/src/utils.ts index dbcc8d2c..3cdbd141 100644 --- a/mpc-core-kit/tkey-mpc-react-bitcoin-example/src/utils.ts +++ b/mpc-core-kit/tkey-mpc-react-bitcoin-example/src/utils.ts @@ -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); }; diff --git a/mpc-core-kit/tkey-mpc-react-firebase-example/src/utils.ts b/mpc-core-kit/tkey-mpc-react-firebase-example/src/utils.ts index 5ed2ad05..9af87112 100644 --- a/mpc-core-kit/tkey-mpc-react-firebase-example/src/utils.ts +++ b/mpc-core-kit/tkey-mpc-react-firebase-example/src/utils.ts @@ -141,7 +141,7 @@ export const setupWeb3 = async (chainConfig: Omit