Skip to content

Commit

Permalink
fix: add detailed logs
Browse files Browse the repository at this point in the history
  • Loading branch information
iGroza committed Apr 23, 2024
1 parent 262ae75 commit 9fb4faa
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions patches/@haqq+provider-sss-react-native+0.0.14.patch
Original file line number Diff line number Diff line change
@@ -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}`);
Expand All @@ -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);
Expand All @@ -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')),
);
Expand All @@ -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 @@
Expand Down Expand Up @@ -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<string> {
Expand Down

0 comments on commit 9fb4faa

Please sign in to comment.