Background
The application currently relies solely on local storage to save user preferences (theme, slippage tolerance, notification settings), which are lost if the user clears their cache or switches devices.
Problem
Without a secure off-chain authentication mechanism, there is no way to persist user preferences to a backend database tied to their wallet address.
Expected Outcome
Implementation of EIP-4361 (Sign-In with Ethereum) to establish authenticated sessions, allowing the backend to securely store and retrieve user preferences.
Suggested Implementation
- Implement SIWE message generation and signature requests in the frontend.
- Send signed messages to the
/auth/verify backend endpoint to receive a JWT session token.
- Store the JWT securely in an HttpOnly cookie or memory.
- Fetch user profile settings from the backend upon successful authentication.
Acceptance Criteria
Likely Affected Files
src/services/auth.ts
src/hooks/useSIWE.ts
src/components/Profile/ProfileSettings.tsx
Requirements
- The SIWE message must include a random nonce fetched from the backend to prevent replay attacks.
Background
The application currently relies solely on local storage to save user preferences (theme, slippage tolerance, notification settings), which are lost if the user clears their cache or switches devices.
Problem
Without a secure off-chain authentication mechanism, there is no way to persist user preferences to a backend database tied to their wallet address.
Expected Outcome
Implementation of EIP-4361 (Sign-In with Ethereum) to establish authenticated sessions, allowing the backend to securely store and retrieve user preferences.
Suggested Implementation
/auth/verifybackend endpoint to receive a JWT session token.Acceptance Criteria
Likely Affected Files
src/services/auth.tssrc/hooks/useSIWE.tssrc/components/Profile/ProfileSettings.tsxRequirements