// Persistent trusted-peer list ("Add device" flow) — separate from the // ephemeral one-shot QR room pairing in pairing/ephemeral.ts. export interface TrustedPeer { id: string // hex Ed25519 pubkey label: string addedAt: number } const KEY = 'flit_keyring' export function listTrusted(): TrustedPeer[] { try { return JSON.parse(localStorage.getItem(KEY) ?? '[]') } catch { return [] } } export function addTrusted(id: string, label: string): void { const peers = listTrusted().filter(p => p.id !== id) peers.push({ id, label, addedAt: Date.now() }) localStorage.setItem(KEY, JSON.stringify(peers)) } export function removeTrusted(id: string): void { localStorage.setItem(KEY, JSON.stringify(listTrusted().filter(p => p.id !== id))) } export function isTrusted(id: string): boolean { return listTrusted().some(p => p.id === id) }