feat(chat): enable HushChat by default + legacy (non-mnemonic) wallet support

Flip DRAGONX_ENABLE_CHAT to default ON (a fresh configure now builds chat in),
and make full-node chat work for every wallet + any daemon.

Legacy compat: chat identity is derived from the wallet's mnemonic
(z_exportmnemonic) for a portable, SDXLite-compatible identity — but a legacy
random-seed wallet has no mnemonic, and released daemons don't have that RPC at
all. Provisioning now falls back to a stable z-address's spending key
(z_exportkey) in those cases: a functional, wallet-local identity that works on
any daemon. Since a chat identity is local (peers learn your public key from
your message headers, not your derivation), interop is unaffected; only
cross-client portability needs the mnemonic. The spending key is an in-memory
KDF input over a key the wallet already holds, wiped after use — no new exposure.

Stability: the chosen chat z-address (the reply-to in headers AND the legacy
identity source) is now persisted in settings (chat_reply_zaddr), so the
identity + reply address don't shift when new addresses are generated.
chatReplyZaddr() picks the smallest spendable z-addr once and reuses it.

CLAUDE.md updated to reflect the default flip. Verified: Linux + Windows build
with chat ON, fresh-configure default confirmed ON, ctest 100%, hygiene clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-06 22:16:35 -05:00
parent f5bde67f64
commit 6c08a08127
6 changed files with 69 additions and 24 deletions

View File

@@ -600,7 +600,7 @@ private:
// feature is off, already provisioned, in flight, or unavailable.
void maybeProvisionChatIdentity();
void provisionChatIdentityFromSecret(std::string secret);
std::string chatReplyZaddr() const; // a stable wallet z-addr for outgoing headers
std::string chatReplyZaddr(); // a stable (persisted) wallet z-addr for chat
std::string generateChatLocalId(const char* prefix, int numBytes) const; // unique echo id / cid
void broadcastChatMemos(const chat::OutgoingChatMemos& memos); // full-node z_sendmany / lite
void broadcastChatMemosLite(const chat::OutgoingChatMemos& memos); // lite two-recipient send