From d6253f85cd9bacac75975780b0fa1e04e78e2b3c Mon Sep 17 00:00:00 2001 From: ieow Date: Wed, 5 Jun 2024 08:09:12 +0800 Subject: [PATCH 1/2] fix: react native buffer toString issue --- src/mpcCoreKit.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mpcCoreKit.ts b/src/mpcCoreKit.ts index 4fb3ebaf..a681dabb 100644 --- a/src/mpcCoreKit.ts +++ b/src/mpcCoreKit.ts @@ -1200,7 +1200,8 @@ export class Web3AuthMPCCoreKit implements ICoreKit { } if (tssPubKey.length === FIELD_ELEMENT_HEX_LEN + 1) { - tssPubKey = tssPubKey.subarray(1); + // Buffer is needed as react native buffer polyfill not able to polyfill subarray function + tssPubKey = Buffer.from(tssPubKey.subarray(1)); } // session is needed for authentication to the web3auth infrastructure holding the factor 1 From 312b93482de6e0c18418b5c078943d1291537023 Mon Sep 17 00:00:00 2001 From: ieow Date: Wed, 12 Jun 2024 12:31:40 +0800 Subject: [PATCH 2/2] fix: merge conflict --- src/mpcCoreKit.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mpcCoreKit.ts b/src/mpcCoreKit.ts index 4cc74684..e7be4107 100644 --- a/src/mpcCoreKit.ts +++ b/src/mpcCoreKit.ts @@ -1233,7 +1233,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit { } // Client lib expects pub key in XY-format, base64-encoded. - const tssPubKeyBase64 = tssPubKey.toSEC1(secp256k1).subarray(1).toString("base64"); + const tssPubKeyBase64 = Buffer.from(tssPubKey.toSEC1(secp256k1).subarray(1)).toString("base64"); const client = new Client(currentSession, clientIndex, partyIndexes, endpoints, sockets, share, tssPubKeyBase64, true, this._tssLib.lib);