Login page and Settings → eGov: relay session with a server-side challenge/nonce, QR + eGov Mobile deep link, polling, one-shot completion; IIN from the signer's certificate (own DER reader), users.egov_iin. The relay is trusted (PM decision): no own XMLDSig check. CLI peppa user egov, mock-kazeds-relay, tests. Dev mode: /_next/static is no-store (Cloudflare cached stale chunks). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
15 lines
616 B
TypeScript
15 lines
616 B
TypeScript
import { egovFlowStatus, PeppaError } from "@peppa/core";
|
|
import { cookies } from "next/headers";
|
|
import { NextResponse } from "next/server";
|
|
import { EGOV_COOKIE } from "@/lib/auth";
|
|
import { db } from "@/lib/db";
|
|
|
|
/** Status of this browser's eGov QR flow: pending | scanned | completed | expired | rejected. */
|
|
export async function GET() {
|
|
try {
|
|
return NextResponse.json({ status: await egovFlowStatus(db, (await cookies()).get(EGOV_COOKIE)?.value ?? "") });
|
|
} catch (e) {
|
|
return NextResponse.json({ error: e instanceof PeppaError ? e.message : "eGov недоступен" }, { status: 502 });
|
|
}
|
|
}
|