import { authenticateRelayNode, resolvePhoneRouteForRelay, } from "@/db/relay-control-plane"; import { apiError, readJsonMutation } from "../../../respond"; export async function POST(request: Request) { try { const principal = await authenticateRelayNode(request); const payload = await readJsonMutation<{ route_handle?: string; phone_token_hash?: string; }>(request); return Response.json( await resolvePhoneRouteForRelay({ principal, routeHandle: payload.route_handle ?? "", phoneTokenHash: payload.phone_token_hash ?? "", }), { headers: { "cache-control": "no-store" } }, ); } catch (error) { return apiError(error); } }