Generating a new user rotates the identity but never deletes the data derived
from the old one. delete_identity() (rust/src/api/identity.rs:287) clears
the in-memory identity, the persisted identity row, the trade-key mappings and
the logs — but the trades table (full My Trades history) and the
messages table (chat history) survive, and the in-memory sessions are not
emptied either. The new identity starts with fresh keys yet inherits the
previous user's entire trade list and conversations.
This is a privacy issue, not just cosmetic: the point of "Generate new user"
is a clean start. The code's own comment shows the intent ("a new mnemonic
must start counting from zero instead of inheriting") but it was only applied
to keys, not data. The leftover rows are also functionally dead — their trade
keys were cleared, so nothing can operate on those orders anymore.
Reproduce
Account → Generate new user → My Trades still lists every order (and chat)
from the previous identity.
Proposed fix
- Add
clear_trades / clear_messages to the DB trait (+ SQLite and
IndexedDB backends), mirroring the existing clear_trade_keys.
- Call them from
delete_identity(), and empty the in-memory
session_manager there too.
- Dart: invalidate
rawTradesProvider after IdentityService.regenerate()
so the UI reflects the clean slate immediately.
Related: the configurable retention setting (#131) will need the same bulk
DB operations.
Generating a new user rotates the identity but never deletes the data derived
from the old one.
delete_identity()(rust/src/api/identity.rs:287) clearsthe in-memory identity, the persisted identity row, the trade-key mappings and
the logs — but the
tradestable (full My Trades history) and themessagestable (chat history) survive, and the in-memory sessions are notemptied either. The new identity starts with fresh keys yet inherits the
previous user's entire trade list and conversations.
This is a privacy issue, not just cosmetic: the point of "Generate new user"
is a clean start. The code's own comment shows the intent ("a new mnemonic
must start counting from zero instead of inheriting") but it was only applied
to keys, not data. The leftover rows are also functionally dead — their trade
keys were cleared, so nothing can operate on those orders anymore.
Reproduce
Account → Generate new user → My Trades still lists every order (and chat)
from the previous identity.
Proposed fix
clear_trades/clear_messagesto the DB trait (+ SQLite andIndexedDB backends), mirroring the existing
clear_trade_keys.delete_identity(), and empty the in-memorysession_managerthere too.rawTradesProviderafterIdentityService.regenerate()so the UI reflects the clean slate immediately.
Related: the configurable retention setting (#131) will need the same bulk
DB operations.