Authentication
Beforehand uses Privy for wallet-based authentication.
How It Works
Sign Up
- User provides phone number
- Privy creates embedded wallet
- Wallet address linked to phone number
- User profile created in database
Sign In
- User enters phone number
- Privy verifies (SMS code)
- Wallet unlocked
- User authenticated
Wallet Model
- Non-custodial: User owns private keys
- Embedded: Created automatically, no seed phrase needed
- Recoverable: Can be recovered via phone number
- Exportable: User can export wallet if needed
Integration
- Frontend: Privy React hooks for auth state
- Database: Links Privy user ID to profile
- Contracts: Wallet address used for transactions
- Security: Row-level security based on user ID
Benefits
- Simple UX: No complex wallet setup
- Recovery: Phone-based recovery
- Security: Non-custodial, user controls funds
- Flexibility: Can add social login later