feat: implement account recovery with encrypted backup bundles

Add recovery code generation (8 codes per setup), Argon2id key derivation,
ChaCha20-Poly1305 encrypted bundles, and server-side zero-knowledge storage.
Each code independently recovers the account. Includes core crypto module,
protobuf service (method IDs 750-752), server domain + handlers, SDK methods,
SQL migration, and CLI commands (/recovery setup, /recovery restore).
This commit is contained in:
2026-03-04 20:12:20 +01:00
parent 5b6d8209f0
commit 12b19b6931
14 changed files with 1120 additions and 1 deletions

View File

@@ -97,6 +97,12 @@ pub mod method_ids {
// Channel (400)
pub const CREATE_CHANNEL: u16 = 400;
// Group management (410-413)
pub const REMOVE_MEMBER: u16 = 410;
pub const UPDATE_GROUP_METADATA: u16 = 411;
pub const LIST_GROUP_MEMBERS: u16 = 412;
pub const ROTATE_KEYS: u16 = 413;
// User (500-501)
pub const RESOLVE_USER: u16 = 500;
pub const RESOLVE_IDENTITY: u16 = 501;
@@ -123,6 +129,18 @@ pub mod method_ids {
pub const PROXY_RESOLVE_USER: u16 = 904;
pub const FEDERATION_HEALTH: u16 = 905;
// Moderation (420-424)
pub const REPORT_MESSAGE: u16 = 420;
pub const BAN_USER: u16 = 421;
pub const UNBAN_USER: u16 = 422;
pub const LIST_REPORTS: u16 = 423;
pub const LIST_BANNED: u16 = 424;
// Recovery (750-752)
pub const STORE_RECOVERY_BUNDLE: u16 = 750;
pub const FETCH_RECOVERY_BUNDLE: u16 = 751;
pub const DELETE_RECOVERY_BUNDLE: u16 = 752;
// Account (950)
pub const DELETE_ACCOUNT: u16 = 950;