celo-poll/lib/auth/admin.ts
2025-12-08 16:31:30 +03:00

19 lines
640 B
TypeScript

// ⚠️ CRITICAL: Replace these placeholder FIDs with your real Farcaster IDs before deploying to production
// To find your FID: Visit https://warpcast.com/~/settings or use the Farcaster API
// Example: const ADMIN_FIDS = ['12345', '67890', '11111']
//
// TODO: Add your admin FIDs here:
const ADMIN_FIDS = process.env.ADMIN_FIDS?.split(',') || ['1', '2', '3']
export function isAdmin(fid: string): boolean {
return ADMIN_FIDS.includes(fid)
}
export function requireAdmin(fid: string | null | undefined): void {
if (!fid || !isAdmin(fid)) {
throw new Error('Unauthorized: Admin access required')
}
}
export { ADMIN_FIDS }