import { enqueue } from '#server/utils/queue' import { requireSession } from '#server/utils/server-session' /** * Enqueue an SSH key rotation for the current `(did, installationId)`. * * The actual rotation runs in the worker: delete the existing * `sh.tangled.publicKey` PDS record, drop the local row, generate a fresh * keypair, publish the new public half. Doing this via the queue (rather * than inline like the signup path) means a slow PDS doesn't tie up the * request and we get retry semantics for free. */ export default defineEventHandler(async event => { const session = await requireSession(event) const row = await enqueue('atproto.publish-pubkey', { did: session.did, installationId: session.installationId, force: true, }) return { jobId: row?.id ?? null } })