Skip to content

Add secure local storage for wallet and session state #22

Description

@Lakes41

Difficulty: Advanced

Type: Feature

Summary

Persist wallet and session state securely so users do not need to reconnect on every app restart while avoiding unsafe storage of sensitive values.

Current Behaviour

Wallet state is held in a plain Zustand store without persistence. On app restart, the user is redirected to onboarding because isConnected resets to false.

Expected Behaviour

The app should restore non-sensitive wallet state on launch and support secure storage for any future session tokens or wallet integration metadata.

Suggested Implementation

Add a storage adapter using an Expo-compatible secure storage option for sensitive fields and async storage for non-sensitive preferences where appropriate. Rehydrate wallet state during app startup and expose a loading state before redirecting.

Files or Areas Likely Affected

  • src/features/wallet/wallet.store.ts
  • src/features/wallet/useWallet.ts
  • app/index.tsx
  • app/_layout.tsx
  • app/settings.tsx
  • src/lib/storage/
  • tests/

Acceptance Criteria

  • Wallet address can be restored after app restart
  • App startup waits for wallet rehydration before redirecting
  • Reset app state clears persisted wallet data
  • Sensitive future session fields are stored only in secure storage
  • Storage errors are handled gracefully
  • Tests cover rehydration, reset, and failed storage access

Additional Notes

Do not store private keys. This issue is about wallet address/session metadata only.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions