feat: interactive REPL with auto-setup, auto-join, encrypted local storage
REPL auto-setup (zero-friction startup): - OnceLock → RwLock for CLIENT_AUTH to allow delayed init after OPAQUE login - Extract opaque_register/opaque_login helpers from one-shot commands - Token cache (.session file) with QPCE encryption when password provided - Add --username/--password/--state-password to repl subcommand - resolve_access_token: auto-register + login, cache token, prompt interactively - rpassword for secure password input (no echo) Interactive REPL (multi-conversation): - SessionState: identity, hybrid key, ConversationStore, per-conversation GroupMembers - ConversationStore: SQLite-backed conversations + messages with full CRUD - Slash commands: /dm, /group, /invite, /join, /switch, /list, /members, /history, /whoami - Background polling (1s interval) with auto-join from MLS Welcome messages - pending_member pattern: persistent keystore for HPKE init key, replenish after join - Self-DM handled as local-only notepad (no MLS/server channel) - ANSI display module for colored prompts, incoming messages, status/error output Username resolution: - resolveIdentity RPC (@20 in node.capnp): look up username by identity key - Server: resolve_identity_key in Store trait, FileBackedStore, SqlStore - Client: resolve_identity in rpc.rs, used in auto-join for peer display names - resolveUser: bidirectional lookup (username → identity key) Encrypted local storage (nothing in cleartext): - ConversationStore uses SQLCipher when --state-password is provided - Argon2id key derivation with per-database random salt (.convdb-salt, mode 0600) - Transparent migration of existing unencrypted databases via sqlcipher_export - Token cache encrypted with QPCE format (Argon2id + ChaCha20Poly1305) Server changes: - resolveIdentity + resolveUser RPC handlers with auth + validation - Auth: sealed-sender identity binding on enqueue, channel member authorization - Delivery: hybrid decrypt attempts, identity key validation on enqueue - Config: --allow-sealed-sender flag for anonymous delivery mode - zeroize added to server dependencies Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -83,6 +83,14 @@ interface NodeService {
|
||||
# Create a 1:1 channel between the caller and the given peer. Returns a 16-byte channelId (UUID).
|
||||
# Both members can enqueue/fetch for this channel; recipientKey must be the other member.
|
||||
createChannel @18 (peerKey :Data, auth :Auth) -> (channelId :Data);
|
||||
|
||||
# Resolve a username to its Ed25519 identity key (32 bytes).
|
||||
# Returns empty Data if the username is not registered.
|
||||
resolveUser @19 (username :Text, auth :Auth) -> (identityKey :Data);
|
||||
|
||||
# Reverse lookup: resolve an Ed25519 identity key to the registered username.
|
||||
# Returns empty Text if the identity key is not associated with any user.
|
||||
resolveIdentity @20 (identityKey :Data, auth :Auth) -> (username :Text);
|
||||
}
|
||||
|
||||
struct Auth {
|
||||
|
||||
Reference in New Issue
Block a user