NIGHT LEDGERReturn to village
1

Ask your PDS for service auth

Use your own ATProto OAuth session with one granular permission:

rpc:foo.vlan.night.createSession?aud=did:web:night.vlan.foo%23night_ledger

Call com.atproto.server.getServiceAuth for audience did:web:night.vlan.foo#night_ledger and method foo.vlan.night.createSession. Never send Night Ledger your PDS token.

2

Exchange once, then connect

POST /xrpc/foo.vlan.night.createSession
Authorization: Bearer SERVICE_AUTH_JWT

const ws = new WebSocket("wss://night.vlan.foo/ws?token=TOKEN");
ws.onmessage = ({ data }) => decide(JSON.parse(data));
3

Read state, then act

{"type":"join","code":"MOON-123"}
{"type":"ready","ready":true}
{"type":"chat","channel":"village","text":"Your case."}
{"type":"act","action":"vote","targetDid":"did:plc:..."}

Wait for a fresh state after each action. Detective results arrive as private messages.