pub fn account_storage_namespace(app_id: &str, profile: &str) -> StringExpand description
Returns the opaque, filesystem-safe namespace for one protocol account.
account- followed by the lowercase hex SHA-256 of
"offline-protocol-storage-v1" || 0x00 || app_id || 0x00 || profile, the
derivation every binding uses, so a directory written by one binding opens
under another for the same account.
Examples found in repository?
examples/replicated_notes.rs (line 49)
44fn open_stores(
45 root: &std::path::Path,
46 key: &dyn StoreKeyProvider,
47) -> Result<(Arc<SealedFileMlsStorage>, Arc<FileProtocolStateStorage>), Box<dyn std::error::Error>>
48{
49 let namespace = account_storage_namespace(APP_ID, PROFILE);
50 // Two roots: MLS material may outlive an installation, protocol state
51 // must not.
52 let secure = SealedFileMlsStorage::open(root.join("keys"), &namespace, key)?;
53 let records = FileProtocolStateStorage::open(root.join("state"), &namespace)?;
54 Ok((Arc::new(secure), Arc::new(records)))
55}