# Authentication Quick Reference

> **TL;DR:** We have two auth systems. Use **Supabase Auth** for production (vault-service). **Quantum Service Auth** is for crypto testing.

## Which Table Should I Use?

### 🔐 For Production Password Management
**Use:** `user_profiles` + Supabase Auth (`auth.users`)
- Browser extension ✅
- Password sharing ✅
- Multi-device sync ✅
- OAuth providers (future) ✅

### 🧪 For Quantum Crypto Testing
**Use:** `users` (quantum-service)
- Encryption/decryption testing ✅
- Algorithm benchmarking ✅
- Standalone quantum operations ✅

## Quick Commands

### Register User (Supabase Auth - Production)
```typescript
const { data, error } = await supabase.auth.signUp({
  email: 'user@example.com',
  password: 'SecurePassword123!'
});
```

### Register User (Quantum Service - Testing)
```bash
curl -X POST http://localhost:8000/api/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"test@example.com","master_password":"TestPass123!","preferred_algorithm":"CRYSTALS-Kyber-768"}'
```

## Security Status

| Table | RLS | Policies | Status |
|-------|-----|----------|--------|
| `users` | ✅ | 3 policies | **Secured** |
| `user_profiles` | ✅ | 2 policies | **Secured** |
| `auth.users` | ✅ | Supabase managed | **Secured** |

## Migration Path

```
v1.0 (Current)          v1.5 (Hybrid)           v2.0 (Unified)
┌──────────────┐       ┌──────────────┐       ┌──────────────┐
│ users        │       │ users        │       │   REMOVED    │
│ (quantum)    │  -->  │ (deprecated) │  -->  │              │
└──────────────┘       └──────────────┘       └──────────────┘
┌──────────────┐       ┌──────────────┐       ┌──────────────┐
│user_profiles │       │user_profiles │       │user_profiles │
│ (vault)      │  -->  │ (primary)    │  -->  │ (only)       │
└──────────────┘       └──────────────┘       └──────────────┘
```

## Need More Details?
See: `/docs/architecture/DUAL-AUTH-ARCHITECTURE.md`
