rfunds-online/app/api/internal/provision/route.ts

22 lines
875 B
TypeScript

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).
*
* Payload: { space, description, admin_email, public, owner_did }
* The owner_did identifies who registered the space via the registry.
*
* rfunds has no server-side database — spaces are managed client-side.
* This endpoint acknowledges the provisioning request.
*/
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: "rfunds space acknowledged" });
}