From 9fb4faa7d20b4a7ac59251b8e6aae2c986c74ed4 Mon Sep 17 00:00:00 2001 From: iGroza Date: Tue, 23 Apr 2024 15:53:59 +0700 Subject: [PATCH] fix: add detailed logs --- ...aqq+provider-sss-react-native+0.0.14.patch | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/patches/@haqq+provider-sss-react-native+0.0.14.patch b/patches/@haqq+provider-sss-react-native+0.0.14.patch index 0da2edc68..33b34a757 100644 --- a/patches/@haqq+provider-sss-react-native+0.0.14.patch +++ b/patches/@haqq+provider-sss-react-native+0.0.14.patch @@ -1,8 +1,8 @@ diff --git a/node_modules/@haqq/provider-sss-react-native/src/get-seed.ts b/node_modules/@haqq/provider-sss-react-native/src/get-seed.ts -index f2614e4..41a127a 100644 +index f2614e4..4b853f0 100644 --- a/node_modules/@haqq/provider-sss-react-native/src/get-seed.ts +++ b/node_modules/@haqq/provider-sss-react-native/src/get-seed.ts -@@ -17,27 +17,33 @@ export async function getSeed( +@@ -17,27 +17,38 @@ export async function getSeed( let shares = []; const share1 = await EncryptedStorage.getItem(`${ITEM_KEY}_${account}`); @@ -19,9 +19,15 @@ index f2614e4..41a127a 100644 const content = await storage.getItem(`haqq_${account}`); + console.error('2. content:', JSON.stringify({content}, null, 2)); ++ console.error('2.1. content full:', content); if (content) { - shares.push(JSON.parse(content)); +- shares.push(JSON.parse(content)); ++ try { ++ shares.push(JSON.parse(content)); ++ } catch(err) { ++ console.error('2.2. content parse error:', err); ++ } } shares = shares.filter(Boolean); @@ -36,7 +42,7 @@ index f2614e4..41a127a 100644 if (polynomialIDs.size > 1) { throw new Error('polynomialID not equals'); -@@ -47,8 +53,13 @@ export async function getSeed( +@@ -47,8 +58,13 @@ export async function getSeed( shares.map(s => new BN(s.share, 'hex')), shares.map(s => new BN(s.shareIndex, 'hex')), ); @@ -51,7 +57,7 @@ index f2614e4..41a127a 100644 return {seed, mnemonic}; } diff --git a/node_modules/@haqq/provider-sss-react-native/src/provider.ts b/node_modules/@haqq/provider-sss-react-native/src/provider.ts -index eff020a..69cc598 100644 +index eff020a..33ab70c 100644 --- a/node_modules/@haqq/provider-sss-react-native/src/provider.ts +++ b/node_modules/@haqq/provider-sss-react-native/src/provider.ts @@ -1,5 +1,5 @@ @@ -233,25 +239,28 @@ index eff020a..69cc598 100644 this.emit('signTypedData', true); } catch (e) { if (e instanceof Error) { -@@ -414,6 +437,7 @@ export class ProviderSSSReactNative +@@ -414,16 +437,19 @@ export class ProviderSSSReactNative async updatePin(pin: string) { try { -+ console.error('SSS updatePin', {pin}) ++ console.error('SSS updatePin', {pin}) const share1 = await EncryptedStorage.getItem( `${ITEM_KEY}_${this._options.account.toLowerCase()}`, ); -@@ -423,7 +447,8 @@ export class ProviderSSSReactNative ++ console.error('SSS updatePin share', share1) + + if (share1) { + const password = await this._options.getPassword(); const share = await decryptShare(JSON.parse(share1), password); const share2 = await encryptShare(share, pin); - -+ console.log('-> share1', share1) -+ console.log('-> share2', JSON.stringify(share2, null, 2)) ++ console.error('-> share1', share1) ++ console.error('-> share2', JSON.stringify(share2, null, 2)) await EncryptedStorage.setItem( `${ITEM_KEY}_${this.getIdentifier().toLowerCase()}`, JSON.stringify(share2), -@@ -505,7 +530,7 @@ export class ProviderSSSReactNative +@@ -505,7 +531,7 @@ export class ProviderSSSReactNative * @returns mnemonic */ async getMnemonicPhrase(): Promise {