A seat given a new token loses its address note: whoever used it before has no claim on it by address, and the next use from the new device is noted afresh

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CCLa2PaEeCj8njQZSWGqHx
This commit is contained in:
Eric WagonerandClaude Fable 5.1 committed 2026-11-10 22:01:19 -05:00
1 parent ecfee5d9c2
commit 067a86bac9
1 file changed
+3
+3
View File
@@ -352,6 +352,8 @@ export function reseat(room: Room, name: PlayerId): { token: string; returned?:
if (!personSeat(room, name)) return { error: "no person sits in that seat" };
const token = randomBytes(16).toString("hex");
const returned = seatToPerson(room, name, hashToken(token));
// Whoever used the seat before has no claim on it by address now: the next use from the new device is noted afresh.
room.addrs.delete(name);
appendLine(room.id, { kind: "reseat", name, tokenHash: hashToken(token), at: new Date().toISOString() });
// A phrase minted with the old token would hand over a seat that no longer answers to it.
for (const [code, t] of transfers) if (t.roomId === room.id && t.name === name) transfers.delete(code);
@@ -1010,6 +1012,7 @@ function rebuildRoom(id: string, lines: RoomLine[]): Room | null {
room.colorChoices.delete(line.name);
} else if (line.kind === "reseat") {
if (personSeat(room, line.name)) seatToPerson(room, line.name, line.tokenHash);
room.addrs.delete(line.name);
} else if (line.kind === "seen") {
room.addrs.set(line.name, line.addr);
} else if (line.kind === "standIn") {