feat: replace supabase auth with citizen/visa identity system for P2P

Replace all supabase.auth.getUser() calls with P2PIdentityContext that
resolves identity from on-chain citizen NFT or off-chain visa system.

- Add identityToUUID() in shared/lib/identity.ts (UUID v5 from citizen/visa number)
- Add P2PIdentityContext with citizen NFT detection and visa fallback
- Add p2p_visa migration for off-chain visa issuance
- Refactor p2p-fiat.ts: all functions now accept userId parameter
- Fix all P2P components to use useP2PIdentity() instead of useAuth()
- Update verify-deposit edge function: walletToUUID -> identityToUUID
- Add P2PLayout with identity gate (wallet/citizen/visa checks)
- Wrap all P2P routes with P2PLayout in App.tsx
This commit is contained in:
2026-02-23 19:54:57 +03:00
parent aa3a49f0f6
commit a80a2cfb07
25 changed files with 594 additions and 237 deletions
+6 -5
View File
@@ -10,6 +10,7 @@ import { AuthProvider } from '@/contexts/AuthContext';
import { DashboardProvider } from '@/contexts/DashboardContext';
import { ReferralProvider } from '@/contexts/ReferralContext';
import { ProtectedRoute } from '@/components/ProtectedRoute';
import { P2PLayout } from '@/components/p2p/P2PLayout';
import { Toaster } from '@/components/ui/toaster';
import { ErrorBoundary } from '@/components/ErrorBoundary';
import { initSentry } from '@/lib/sentry';
@@ -180,27 +181,27 @@ function App() {
} />
<Route path="/p2p" element={
<ProtectedRoute allowTelegramSession>
<P2PPlatform />
<P2PLayout><P2PPlatform /></P2PLayout>
</ProtectedRoute>
} />
<Route path="/p2p/trade/:tradeId" element={
<ProtectedRoute allowTelegramSession>
<P2PTrade />
<P2PLayout><P2PTrade /></P2PLayout>
</ProtectedRoute>
} />
<Route path="/p2p/orders" element={
<ProtectedRoute allowTelegramSession>
<P2POrders />
<P2PLayout><P2POrders /></P2PLayout>
</ProtectedRoute>
} />
<Route path="/p2p/dispute/:disputeId" element={
<ProtectedRoute allowTelegramSession>
<P2PDispute />
<P2PLayout><P2PDispute /></P2PLayout>
</ProtectedRoute>
} />
<Route path="/p2p/merchant" element={
<ProtectedRoute allowTelegramSession>
<P2PMerchantDashboard />
<P2PLayout><P2PMerchantDashboard /></P2PLayout>
</ProtectedRoute>
} />
<Route path="/dex" element={