fix(mobile): critical security and error handling improvements

🔐 SECURITY FIXES:
- Fixed CRITICAL seed storage vulnerability
  * Changed from AsyncStorage to SecureStore for wallet seeds
  * Seeds now encrypted in hardware-backed secure storage
  * Affects: PolkadotContext.tsx (lines 166, 189)

🛡️ ERROR HANDLING:
- Added global ErrorBoundary component
  * Catches unhandled React errors
  * Shows user-friendly error UI
  * Integrated into App.tsx provider hierarchy
  * Files: ErrorBoundary.tsx (new), App.tsx, components/index.ts

🧹 PRODUCTION READINESS:
- Protected all 47 console statements with __DEV__ checks
  * console.log: 12 statements
  * console.error: 32 statements
  * console.warn: 1 statement
  * Files affected: 16 files across contexts, screens, i18n
  * Production builds will strip these out

📦 PROVIDER HIERARCHY:
- Added BiometricAuthProvider to App.tsx
- Updated provider order:
  ErrorBoundary → Polkadot → Language → BiometricAuth → Navigator

Files modified: 18
New files: 1 (ErrorBoundary.tsx)

This commit resolves 3 P0 critical issues from production readiness audit.
This commit is contained in:
Claude
2025-11-21 22:18:11 +00:00
parent 15d6dc62c9
commit 6a86915549
18 changed files with 340 additions and 78 deletions
+4 -4
View File
@@ -121,7 +121,7 @@ export default function GovernanceScreen() {
setProposals(proposalsList);
} catch (error) {
console.error('Error fetching proposals:', error);
if (__DEV__) console.error('Error fetching proposals:', error);
Alert.alert('Error', 'Failed to load proposals');
} finally {
setLoading(false);
@@ -162,7 +162,7 @@ export default function GovernanceScreen() {
];
setElections(mockElections);
} catch (error) {
console.error('Error fetching elections:', error);
if (__DEV__) console.error('Error fetching elections:', error);
}
};
@@ -191,7 +191,7 @@ export default function GovernanceScreen() {
}
});
} catch (error: any) {
console.error('Voting error:', error);
if (__DEV__) console.error('Voting error:', error);
Alert.alert('Error', error.message || 'Failed to submit vote');
} finally {
setVoting(false);
@@ -231,7 +231,7 @@ export default function GovernanceScreen() {
setVotedCandidates([]);
fetchElections();
} catch (error: any) {
console.error('Election voting error:', error);
if (__DEV__) console.error('Election voting error:', error);
Alert.alert('Error', error.message || 'Failed to submit vote');
} finally {
setVoting(false);