From b757ed248e6d1cbede6da109e8bbe3d4ddbe1f8a Mon Sep 17 00:00:00 2001 From: Chad Miller Date: Mon, 5 Jan 2026 08:35:42 -0800 Subject: [PATCH] feat: add PLC directory registration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- scripts/setup.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/scripts/setup.js b/scripts/setup.js index c6bfae8..180b1a2 100644 --- a/scripts/setup.js +++ b/scripts/setup.js @@ -317,6 +317,27 @@ function base32Encode(bytes) { return result } +// === PLC DIRECTORY REGISTRATION === + +async function registerWithPlc(plcUrl, did, operation) { + const url = `${plcUrl}/${encodeURIComponent(did)}` + + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(operation) + }) + + if (!response.ok) { + const text = await response.text() + throw new Error(`PLC registration failed: ${response.status} ${text}`) + } + + return true +} + // === MAIN === async function main() { @@ -348,7 +369,12 @@ async function main() { console.log(` Handle: ${fullHandle}`) console.log('') - // TODO: Register with plc.directory + // Step 3: Register with PLC directory + console.log(`Registering with ${opts.plcUrl}...`) + await registerWithPlc(opts.plcUrl, did, operation) + console.log(' Registered successfully!') + console.log('') + // TODO: Initialize PDS // TODO: Notify relay } -- 2.51.2