antenna_client_shared/storage.rs
1use antenna_protocol::Identity;
2use anyhow::Result;
3
4/// Persistence contract for the local node's identity. Each platform implements this with
5/// its own backend (web → localStorage, native → JSON file). The contract is the same:
6/// load may return `None` if no identity has been saved yet (or the persisted blob is
7/// malformed); save must overwrite atomically.
8pub trait IdentityStorage {
9 fn load_identity(&self) -> Option<Identity>;
10 fn save_identity(&self, identity: &Identity) -> Result<()>;
11}