Skip to content

Latest commit

Β 

History

History
298 lines (242 loc) Β· 7.79 KB

File metadata and controls

298 lines (242 loc) Β· 7.79 KB

πŸš€ Quick Start - Web3 Authentication

Get Started in 5 Minutes

1. Install MetaMask

If you don't have MetaMask installed:

2. Set Environment Variables

cp env.sample .env.local

# Edit .env.local and set:
VITE_WEB3_FUNCTION_ID=your-web3-function-id
VITE_APPWRITE_PROJECT_ID=your-project-id

3. Install & Run

npm install
npm run dev

4. Open in Browser

Navigate to http://localhost:5173


🎯 What You'll See

First Visit

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  [BLURRED BACKGROUND]                β”‚
β”‚                                       β”‚
β”‚  ╔════════════════════════════════╗  β”‚
β”‚  β•‘  πŸ” Welcome to Tenchat    β•‘  β”‚
β”‚  β•‘                                β•‘  β”‚
β”‚  β•‘  πŸ“§ Enter your email           β•‘  β”‚
β”‚  β•‘  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β•‘  β”‚
β”‚  β•‘  β”‚ you@example.com        β”‚   β•‘  β”‚
β”‚  β•‘  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β•‘  β”‚
β”‚  β•‘                                β•‘  β”‚
β”‚  β•‘  [πŸ”— Connect Wallet]          β•‘  β”‚
β”‚  β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

↓ Click "Connect Wallet"

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  🦊 MetaMask Popup                    β”‚
β”‚  Connect with MetaMask?               β”‚
β”‚  [Cancel] [Connect]                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

↓ Click "Connect"

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  🦊 MetaMask Popup                    β”‚
β”‚  Signature Request                    β”‚
β”‚  Sign to authenticate                 β”‚
β”‚  [Cancel] [Sign]                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

↓ Click "Sign"

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  βœ… Success!                          β”‚
β”‚  Welcome to Tenchat               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸŽ›οΈ Main Interface

Once authenticated, you'll see:

Left Sidebar

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ πŸ‘€ 0x742d...16B2    β”‚ ← Your wallet address
β”‚ βœ… Connected         β”‚
β”‚                      β”‚
β”‚ πŸ’° Portfolio         β”‚
β”‚ $1,247.89           β”‚
β”‚ πŸ“ˆ +12.5%           β”‚
β”‚                      β”‚
β”‚ [Send] [Gift]       β”‚
β”‚                      β”‚
β”‚ ─────────────────   β”‚
β”‚                      β”‚
β”‚ Conversations        β”‚
β”‚ β€’ Alice              β”‚
β”‚ β€’ Bob                β”‚
β”‚ β€’ Charlie            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Top Bar

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Tenchat    πŸ”    [Settings] [βš™οΈ]   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Settings (Click βš™οΈ)

╔═══════════════════════════════════════╗
β•‘ πŸ‘€ Settings & Profile                 β•‘
β•‘                                       β•‘
β•‘ [Account] [Wallet] [Notifications]    β•‘
β•‘                                       β•‘
β•‘ WALLET TAB:                           β•‘
β•‘ 0x742d35Cc6634C0532925a3b8D4C2468... β•‘
β•‘ [πŸ“‹ Copy] [πŸ”— View on Etherscan]      β•‘
β•‘                                       β•‘
β•‘ ACCOUNT TAB:                          β•‘
β•‘ Display Name: User 742d35             β•‘
β•‘ Email: user@example.com ⚠️ Unverifiedβ•‘
β•‘ [Logout]                              β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

πŸ”‘ Key Concepts

Your Identity = Your Wallet

Primary:    0x742d35Cc6634C0532925a3b8D4C2468bB3Ff16B2
Secondary:  user@example.com (recovery only)
Password:   ❌ None! (wallet signature instead)

How Authentication Works

  1. You enter your email
  2. Connect your MetaMask wallet
  3. Sign a message to prove ownership
  4. Backend verifies your signature
  5. Session created - you're in!

No Passwords!

  • βœ… Your wallet is your identity
  • βœ… Sign messages to authenticate
  • βœ… Email only for recovery
  • βœ… True Web3 authentication

🎯 Common Actions

Connect Wallet

1. Enter email
2. Click "Connect Wallet"
3. Approve in MetaMask (2 popups)
4. Done!

View Wallet Address

1. Click Settings (βš™οΈ)
2. Go to "Wallet" tab
3. See your full address
4. Click πŸ“‹ to copy

Logout

1. Click Settings (βš™οΈ)
2. Go to "Account" tab
3. Click "Logout"
4. Auth modal appears again

Send Message

1. Click on a conversation
2. Type your message
3. Press Enter or click Send

Send Gift (Web3 Feature)

1. Open a conversation
2. Click Gift button
3. Select token & amount
4. Confirm in MetaMask
5. Gift sent!

⚠️ Troubleshooting

MetaMask Not Detected

Problem: "MetaMask not installed" error
Solution: 
1. Install MetaMask browser extension
2. Reload the page
3. Try again

User Rejected Signature

Problem: "You cancelled the signature request"
Solution: 
1. Click "Connect Wallet" again
2. Approve both MetaMask popups
3. Don't click "Cancel"

Authentication Failed

Problem: "Authentication failed" error
Solution:
1. Check console for errors
2. Verify Web3 function is deployed
3. Check VITE_WEB3_FUNCTION_ID is set
4. Try again

Session Expired

Problem: Logged out unexpectedly
Solution:
1. Normal behavior after some time
2. Just reconnect your wallet
3. Sign the message again

πŸ”’ Security Tips

βœ… Do's

  • Always verify the message you're signing
  • Keep your MetaMask locked when not in use
  • Use a hardware wallet for extra security
  • Never share your private keys

❌ Don'ts

  • Don't sign messages you don't understand
  • Don't connect to suspicious websites
  • Don't use the same wallet for everything
  • Don't approve unlimited token allowances

πŸ“± Mobile Usage

Android

1. Install MetaMask mobile app
2. Open Tenchat in MetaMask browser
3. Follow normal auth flow

iOS

1. Install MetaMask mobile app
2. Open Tenchat in MetaMask browser
3. Follow normal auth flow

πŸŽ“ Learn More

Documentation

  • WEB3_AUTH_COMPLETION.md - Technical details
  • UX_FLOW_DOCUMENTATION.md - Visual flows
  • WEB3_INTEGRATION_SUMMARY.md - Complete overview
  • USAGE_REACT.md - Original specification

Resources


πŸš€ Next Steps

Once you're authenticated:

  1. βœ… Explore the interface
  2. βœ… Check your Settings
  3. βœ… Copy your wallet address
  4. βœ… Start chatting!
  5. βœ… Send your first crypto gift

Ready? Start with npm run dev and open http://localhost:5173 πŸŽ‰