Add /wipe, /wipe-all, and threat model docs.
/wipe overwrites the message log and VACUUMs; identity and friends stay. /wipe-all deletes the data dir after confirm so the next open is a new person. Neither runs without a typed confirm screen.
This commit is contained in:
parent
07aa97711c
commit
5412e020bb
7 changed files with 415 additions and 18 deletions
19
src/store.rs
19
src/store.rs
|
|
@ -364,6 +364,25 @@ impl Store {
|
|||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
/// Overwrite message bodies, delete rows, VACUUM. Identity + friends stay.
|
||||
pub fn wipe_messages(&self) -> Result<()> {
|
||||
self.conn.execute(
|
||||
"UPDATE messages SET plaintext = zeroblob(length(plaintext))",
|
||||
[],
|
||||
)?;
|
||||
self.conn.execute("DELETE FROM messages", [])?;
|
||||
self.conn.execute_batch("VACUUM")?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Delete the data dir. Next `open_at` is a new identity. Caller must drop Store first.
|
||||
pub fn wipe_all(home: &Path) -> Result<()> {
|
||||
if home.exists() {
|
||||
fs::remove_dir_all(home)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn friend_from_row(row: &rusqlite::Row<'_>) -> rusqlite::Result<Friend> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue