-- v0 -> v1: Xessenger end-to-end encryption (QA-289) -- Users switched on, and the master key the bridge pinned for each when it switched them on. CREATE TABLE xessenger_e2ee_user ( bridge_id TEXT NOT NULL, user_mxid TEXT NOT NULL, pinned_master_key TEXT NOT NULL, enabled_at BIGINT NOT NULL, PRIMARY KEY (bridge_id, user_mxid) ); -- Hashed ghost MXIDs and the network user each stands for, sealed with the store key. CREATE TABLE xessenger_ghost_hash ( bridge_id TEXT NOT NULL, mxid TEXT NOT NULL, sealed_ghost TEXT NOT NULL, PRIMARY KEY (bridge_id, mxid) ); -- What each encrypted metadata state event last said, as a fingerprint under the store key, so -- unchanged metadata is not resent. CREATE TABLE xessenger_e2ee_meta ( bridge_id TEXT NOT NULL, room_id TEXT NOT NULL, state_key TEXT NOT NULL, sent_mac TEXT NOT NULL, PRIMARY KEY (bridge_id, room_id, state_key) ); -- Encrypted copies of pictures: the keys of each, sealed with the store key. CREATE TABLE xessenger_e2ee_media ( bridge_id TEXT NOT NULL, source_mxc TEXT NOT NULL, sealed_file TEXT NOT NULL, PRIMARY KEY (bridge_id, source_mxc) ); -- Hashed ghosts whose plaintext ghost's global profile was withheld because no plaintext room -- needed it yet. CREATE TABLE xessenger_ghost_withheld ( bridge_id TEXT NOT NULL, mxid TEXT NOT NULL, PRIMARY KEY (bridge_id, mxid) );