// A role's UID is unique within its provider-reported server region. Display names are never identity keys. // gameId is optional provider metadata (the official password API may omit it), so it cannot be part of identity. export const roleKey = (role) => JSON.stringify([String(role.channelName || '').trim(), String(role.uid).trim()]); export const hasRoleIdentity = (role) => role?.uid != null && String(role.uid).trim() !== '' && String(role.channelName || '').trim() !== '';