From 4561076904cbdd79bfe4acc0f8415758381fd471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Guti=C3=A9rrez?= <35082514+alezmad@users.noreply.github.com> Date: Mon, 13 Apr 2026 19:02:09 +0100 Subject: [PATCH] fix(broker): accept pubkey in mesh create + use in member row Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/broker/src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/broker/src/index.ts b/apps/broker/src/index.ts index 7df9f28..a32dbc0 100644 --- a/apps/broker/src/index.ts +++ b/apps/broker/src/index.ts @@ -5031,7 +5031,7 @@ import { meshPermission } from "@turbostarter/db/schema/mesh"; /** POST /cli/mesh/create — create a new mesh via CLI. */ async function handleCliMeshCreate(req: IncomingMessage, res: ServerResponse, started: number): Promise { - let body: { user_id: string; name: string; slug?: string; template?: string; description?: string }; + let body: { user_id: string; name: string; pubkey?: string; slug?: string; template?: string; description?: string }; try { const chunks: Buffer[] = []; for await (const chunk of req) chunks.push(chunk as Buffer); @@ -5073,9 +5073,10 @@ async function handleCliMeshCreate(req: IncomingMessage, res: ServerResponse, st // Create owner member const memberId = generateId(); + const peerPubkey = body.pubkey ?? "pending"; await db.execute(sql` INSERT INTO mesh.member (id, mesh_id, user_id, peer_pubkey, display_name, role) - VALUES (${memberId}, ${meshId}, ${body.user_id}, ${"pending"}, ${body.name + "-owner"}, ${"admin"}) + VALUES (${memberId}, ${meshId}, ${body.user_id}, ${peerPubkey}, ${body.name + "-owner"}, ${"admin"}) `); writeJson(res, 200, { id: meshId, slug, name: body.name, member_id: memberId });