-- 004_federation.sql: Federation support tables.

-- Map identity keys to their home server domain.
-- Used for routing: if a recipient's home_server != local domain, relay via federation.
CREATE TABLE IF NOT EXISTS identity_home_servers (
    identity_key BLOB PRIMARY KEY,
    home_server  TEXT NOT NULL,
    updated_at   INTEGER NOT NULL
);

-- Known federation peers (other quicnprotochat servers).
CREATE TABLE IF NOT EXISTS federation_peers (
    domain    TEXT PRIMARY KEY,
    last_seen INTEGER NOT NULL,
    is_active INTEGER NOT NULL DEFAULT 1
);
