import { NextResponse } from "next/server"; /** * Internal provision endpoint — called by rSpace Registry when activating * this app for a space. No auth required (only reachable from Docker network). * * rmaps uses client-side rooms keyed by space slug. * Acknowledges provisioning; room is created when users join. * * Payload from registry: * { space, description, admin_email, public, owner_did } * * The owner_did identifies who registered the space and is the only person * (besides admin API key holders) who can modify it via the registry. * Apps can query GET registry.rspace.online/spaces/{name}/owner to verify. */ export async function POST(request: Request) { const body = await request.json(); const space: string = body.space?.trim(); if (!space) { return NextResponse.json({ error: "Missing space name" }, { status: 400 }); } const ownerDid: string = body.owner_did || ""; return NextResponse.json({ status: "ok", space, owner_did: ownerDid, message: "rmaps space acknowledged, room created on first join", }); }