chore: rename quicproquo → quicprochat in Rust workspace

Rename all crate directories, package names, binary names, proto
package/module paths, ALPN strings, env var prefixes, config filenames,
mDNS service names, and plugin ABI symbols from quicproquo/qpq to
quicprochat/qpc.
This commit is contained in:
2026-03-07 18:24:52 +01:00
parent d8c1392587
commit a710037dde
212 changed files with 609 additions and 609 deletions

View File

@@ -0,0 +1,47 @@
CREATE TABLE IF NOT EXISTS key_packages (
id INTEGER PRIMARY KEY AUTOINCREMENT,
identity_key BLOB NOT NULL,
package_data BLOB NOT NULL,
created_at INTEGER DEFAULT (strftime('%s','now'))
);
CREATE TABLE IF NOT EXISTS deliveries (
id INTEGER PRIMARY KEY AUTOINCREMENT,
recipient_key BLOB NOT NULL,
channel_id BLOB NOT NULL DEFAULT X'',
payload BLOB NOT NULL,
created_at INTEGER DEFAULT (strftime('%s','now'))
);
CREATE TABLE IF NOT EXISTS hybrid_keys (
identity_key BLOB PRIMARY KEY,
hybrid_public_key BLOB NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_kp_identity
ON key_packages(identity_key);
CREATE INDEX IF NOT EXISTS idx_del_recipient_channel
ON deliveries(recipient_key, channel_id);
CREATE TABLE IF NOT EXISTS server_setup (
id INTEGER PRIMARY KEY CHECK (id = 1),
setup_data BLOB NOT NULL
);
CREATE TABLE IF NOT EXISTS users (
username TEXT PRIMARY KEY,
opaque_record BLOB NOT NULL,
created_at INTEGER DEFAULT (strftime('%s','now'))
);
CREATE TABLE IF NOT EXISTS user_identity_keys (
username TEXT PRIMARY KEY,
identity_key BLOB NOT NULL
);
CREATE TABLE IF NOT EXISTS endpoints (
identity_key BLOB PRIMARY KEY,
node_addr BLOB NOT NULL,
updated_at INTEGER DEFAULT (strftime('%s','now'))
);

View File

@@ -0,0 +1,21 @@
-- Migration 002: add per-inbox delivery sequence numbers.
--
-- Adds a `seq` column to the deliveries table and a separate counter table
-- that tracks the next sequence number per (recipient_key, channel_id) inbox.
-- The counter is atomically incremented on each enqueue via an UPSERT so
-- sequence numbers are gapless even under concurrent inserts.
--
-- Requires SQLite >= 3.35 (RETURNING clause support; available on Ubuntu 22.04+).
ALTER TABLE deliveries ADD COLUMN seq INTEGER NOT NULL DEFAULT 0;
CREATE TABLE IF NOT EXISTS delivery_seq_counters (
recipient_key BLOB NOT NULL,
channel_id BLOB NOT NULL,
next_seq INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY (recipient_key, channel_id)
);
-- Index lets ORDER BY seq queries use an index scan instead of a sort.
CREATE INDEX IF NOT EXISTS idx_del_seq
ON deliveries (recipient_key, channel_id, seq);

View File

@@ -0,0 +1,13 @@
-- Migration 003: 1:1 DM channels.
-- channel_id is 16 bytes (UUID); member_a and member_b are identity keys in sorted order.
-- Unique on (member_a, member_b) prevents duplicate channels between the same pair.
CREATE TABLE IF NOT EXISTS channels (
channel_id BLOB PRIMARY KEY,
member_a BLOB NOT NULL,
member_b BLOB NOT NULL,
UNIQUE(member_a, member_b)
);
CREATE INDEX IF NOT EXISTS idx_channels_members
ON channels(member_a, member_b);

View File

@@ -0,0 +1,16 @@
-- 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
);

View File

@@ -0,0 +1,4 @@
CREATE TABLE IF NOT EXISTS server_signing_key (
id INTEGER PRIMARY KEY CHECK (id = 1),
seed_data BLOB NOT NULL
);

View File

@@ -0,0 +1,4 @@
CREATE TABLE IF NOT EXISTS kt_log (
id INTEGER PRIMARY KEY CHECK (id = 1),
log_data BLOB NOT NULL
);

View File

@@ -0,0 +1,2 @@
ALTER TABLE deliveries ADD COLUMN expires_at INTEGER;
CREATE INDEX idx_deliveries_expires ON deliveries(expires_at) WHERE expires_at IS NOT NULL;

View File

@@ -0,0 +1,8 @@
CREATE TABLE IF NOT EXISTS devices (
identity_key BLOB NOT NULL,
device_id BLOB NOT NULL,
device_name TEXT NOT NULL DEFAULT '',
registered_at INTEGER NOT NULL DEFAULT (strftime('%s','now')),
PRIMARY KEY (identity_key, device_id)
);
CREATE INDEX IF NOT EXISTS idx_devices_identity ON devices(identity_key);

View File

@@ -0,0 +1,8 @@
CREATE TABLE IF NOT EXISTS sessions (
token BLOB PRIMARY KEY,
username TEXT NOT NULL,
identity_key BLOB NOT NULL,
created_at INTEGER NOT NULL,
expires_at INTEGER NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_sessions_expires ON sessions(expires_at);

View File

@@ -0,0 +1,15 @@
CREATE TABLE IF NOT EXISTS blobs (
blob_id BLOB PRIMARY KEY,
data BLOB NOT NULL,
total_size INTEGER NOT NULL,
mime_type TEXT NOT NULL DEFAULT '',
uploaded_at INTEGER NOT NULL
);
CREATE TABLE IF NOT EXISTS blob_staging (
blob_hash BLOB NOT NULL,
offset INTEGER NOT NULL,
chunk BLOB NOT NULL,
total_size INTEGER NOT NULL,
mime_type TEXT NOT NULL DEFAULT '',
PRIMARY KEY (blob_hash, offset)
);

View File

@@ -0,0 +1,7 @@
-- Recovery bundle storage: encrypted bundles keyed by token_hash.
CREATE TABLE IF NOT EXISTS recovery_bundles (
token_hash BLOB PRIMARY KEY,
bundle BLOB NOT NULL,
ttl_secs INTEGER NOT NULL DEFAULT 0,
created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
);

View File

@@ -0,0 +1,20 @@
-- Moderation tables: reports and bans.
CREATE TABLE IF NOT EXISTS reports (
id INTEGER PRIMARY KEY AUTOINCREMENT,
encrypted_report BLOB NOT NULL,
conversation_id BLOB NOT NULL,
reporter_identity BLOB NOT NULL,
created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
);
CREATE INDEX IF NOT EXISTS idx_reports_created ON reports(created_at);
CREATE TABLE IF NOT EXISTS bans (
identity_key BLOB PRIMARY KEY,
reason TEXT NOT NULL DEFAULT '',
banned_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
expires_at INTEGER NOT NULL DEFAULT 0
);
CREATE INDEX IF NOT EXISTS idx_bans_expires ON bans(expires_at);