Skip to content

feat: persist wallet and session state securely#52

Open
shadrach68 wants to merge 1 commit into
Adamantine-guild:mainfrom
shadrach68:localStorage
Open

feat: persist wallet and session state securely#52
shadrach68 wants to merge 1 commit into
Adamantine-guild:mainfrom
shadrach68:localStorage

Conversation

@shadrach68

Copy link
Copy Markdown

Summary This PR implements secure persistence for wallet and session states, ensuring users remain connected across app restarts without compromising sensitive data. It introduces a hybrid storage approach using AsyncStorage for non-sensitive preferences and Expo SecureStore for session tokens.

Key Changes

  • Hybrid Storage Architecture : Created a new storage utility that wraps AsyncStorage and SecureStore with standardized error handling.

  • State Persistence : Integrated Zustand persist middleware into wallet.store.ts and session.store.ts .

  • Smooth Rehydration : Updated the entry screen to handle the hydration lifecycle, preventing flashes of unauthenticated states during startup.

  • Secure Data Clearing : Enhanced the reset flow to purge all persisted data when a user logs out or resets the app.

  • Testing : Added a new storage test suite and global mocks to ensure reliable rehydration and storage error handling.
    Acceptance Criteria Verified

  • Wallet address is restored after app restart.

  • Startup flow waits for hydration before redirecting.

  • Session tokens are stored exclusively in Secure Storage.

  • Resetting app state clears all persisted data.

  • Storage errors are handled gracefully without crashing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add secure local storage for wallet and session state

1 participant