pub struct ClientStateTable { /* private fields */ }Expand description
The client’s complete encrypted state: a map from H(keyword) → KeywordState.
Stored encrypted on the client device. The encryption key is K_state from the MasterKeySet, which is derived from the user’s password and never leaves the client.
Implementations§
Source§impl ClientStateTable
impl ClientStateTable
Sourcepub fn get_or_create(&mut self, keyword_hash: [u8; 32]) -> &mut KeywordState
pub fn get_or_create(&mut self, keyword_hash: [u8; 32]) -> &mut KeywordState
Get or create the state for a keyword.
Sourcepub fn get(&self, keyword_hash: &[u8; 32]) -> Option<&KeywordState>
pub fn get(&self, keyword_hash: &[u8; 32]) -> Option<&KeywordState>
Get an existing state (read-only).
Sourcepub fn export_encrypted(
&self,
keys: &MasterKeySet,
) -> Result<Vec<u8>, VaultError>
pub fn export_encrypted( &self, keys: &MasterKeySet, ) -> Result<Vec<u8>, VaultError>
Serialise + AES-256-GCM encrypt the entire table. The returned bytes can be stored anywhere (IndexedDB, disk, etc.).
Sourcepub fn import_encrypted(
blob: &[u8],
keys: &MasterKeySet,
) -> Result<Self, VaultError>
pub fn import_encrypted( blob: &[u8], keys: &MasterKeySet, ) -> Result<Self, VaultError>
Decrypt and deserialise a blob produced by export_encrypted.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClientStateTable
impl RefUnwindSafe for ClientStateTable
impl Send for ClientStateTable
impl Sync for ClientStateTable
impl Unpin for ClientStateTable
impl UnsafeUnpin for ClientStateTable
impl UnwindSafe for ClientStateTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more