Skip to content

Integrate Sign-In with Ethereum (SIWE) for Off-Chain User Profiles #90

Description

@Lakes41

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

  • Users are prompted to sign a standard SIWE message upon clicking "Sign In".
  • Preferences persist across different browsers and devices for the same wallet address.
  • Signature requests use the correct domain and URI to prevent replay attacks.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSRelated to GrantFox Open Source Software initiativesMaybe RewardedPotential for a reward based on contributionOfficial Campaign | FWC26Period after the official FIFA World Cup 2026 campaignadvancedRequires advanced knowledge or skillsbackend-integrationBackend integration taskssecuritySecurity vulnerabilities or improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions