fix(call-to-play): key actors by stable peer identity

Participant maps and creator authorization previously used display names, so
two peers left at the default Commander name collapsed into one participant
and could exercise each other's creator controls through the normal client.

Carry a stable actor_id separately from actor_name. The peer overwrites actor_id
on every local publish, and live event envelopes are accepted only when the
known peer, source, and event actor match. The frontend keys participants and
authorization by actor_id while retaining actor_name for display. This follows
the trusted-LAN model and is not cryptographic authentication against a hostile
peer.

Test Plan:
- `just fmt` -- passed
- `just clippy` -- passed
- `just test` -- passed
- `just frontend-test` -- passed, 21 tests
- `just build` -- passed
- `just peer-cli-tests S48` -- passed
- `git diff --cached --check` -- passed
This commit is contained in:
2026-07-21 22:40:59 +02:00
parent 0f53bc4b78
commit 29eacabcc0
19 changed files with 197 additions and 69 deletions
+5 -3
View File
@@ -528,17 +528,19 @@ card. Usernames are colored deterministically by a hash of the name.
type Nomination = {
id: string;
gameId: string;
creator: string; // username of the caller
creatorId: string; // stable peer ID of the caller
creator: string; // display name of the caller
maxPlayers: number;
createdAt: number; // ms epoch
scheduledFor: number | null; // ms epoch clock time; null = play-now
deadline: number; // play-now: createdAt + durationMin; scheduled: === scheduledFor
participants: Record<string, { // keyed by username
participants: Record<string, { // keyed by stable peer ID
name: string; // current display name
status: 'ready' | 'in' | 'pending';
joinedAt: number;
readyAt?: number; // ms epoch a 'pending' buffer elapses
}>;
messages: { id: string; from: string; text: string; at: number }[];
messages: { id: string; fromId: string; from: string; text: string; at: number }[];
state: 'open' | 'done' | 'started';
startedAt?: number;
};