← Files FingerprintARCHIVED FILE

skills/fingerprint-nextjs/snippets/route-handler.ts

519 Bytes · Oct 3, 2026 · 06:27 UTC

↓ Download file

// app/api/login/route.ts — verify the event_id before running the sensitive handler.
import { verifyEvent } from '@/lib/fingerprint-server'

export async function POST(request: Request) {
  const { username, password, eventId } = await request.json()

  const check = await verifyEvent(eventId)
  if (!check.ok) {
    return Response.json({ error: 'blocked', reason: check.reason }, { status: 403 })
  }

  // ...proceed; bind check.visitorId to the account, then run login...
  return Response.json({ ok: true })
}

SHA-256: a346d5df6062443a44ea9982bd5d9c20096b5d77f0815b2ef48e620b2041839c