// Per-install browser identifier. Replaces the legacy per-device crypto // identity for non-crypto bookkeeping (push tokens, message sender_device_id // metadata) where we just need a stable, opaque id for this browser/install. // // The user-key model has no device-bound crypto; the `devices` table and // `messages.sender_device_id` column still exist but they're now plain // telemetry. Using a localStorage UUID keeps the column populated without // any of the old key-management overhead. const KEY = 'chatapp.installId'; export function ensureInstallId(): string { let id = window.localStorage.getItem(KEY); if (!id) { id = crypto.randomUUID(); window.localStorage.setItem(KEY, id); } return id; }