pub fn create_generated(
path: impl AsRef<Path>,
config: MnemoConfig,
prepare: &mut dyn FnMut(&mut Mnemo) -> Result<()>,
persist: &mut Persist<'_>,
) -> Result<Zeroizing<[u8; 32]>>Expand description
Create a brain at path under a freshly generated key (the keys note,
section 1). In this order, so there’s never a brain at path whose key
is only in memory:
- the key is drawn, and the brain is created under a temp name next to
pathwith the raw-key parameters; prepareruns on it (the CLI writes its manifest), and it’s closed;persistkeeps the key, given the brain’s salt (a key store’sstore_and_check, or a new key file);- the temp file takes
path’s name.
path must not exist. Dead init temps next to it are removed first.
On an error the temp file is removed.