pub struct Vault<P: BoxProvider> { /* private fields */ }Expand description
A enclave of data that is encrypted under one Key.
Implementations§
Source§impl<P: BoxProvider> Vault<P>
impl<P: BoxProvider> Vault<P>
Sourcepub fn init_vault(key: &Key<P>) -> Vault<P>
pub fn init_vault(key: &Key<P>) -> Vault<P>
Initialize a new Vault
Sourcepub fn add_or_update_record(
&mut self,
key: &Key<P>,
id: ChainId,
data: &[u8],
record_hint: RecordHint,
) -> Result<(), RecordError<P::Error>>
pub fn add_or_update_record( &mut self, key: &Key<P>, id: ChainId, data: &[u8], record_hint: RecordHint, ) -> Result<(), RecordError<P::Error>>
Sourcepub fn extend<I>(
&mut self,
key: &Key<P>,
entries: I,
) -> Result<(), RecordError<P::Error>>
pub fn extend<I>( &mut self, key: &Key<P>, entries: I, ) -> Result<(), RecordError<P::Error>>
Extend the stored entries with entries from another vault with the same key. In case of duplicated records, the existing record is dropped in favor of the new one.
Sourcepub fn export_record(&self, rid: &RecordId) -> Option<Record>
pub fn export_record(&self, rid: &RecordId) -> Option<Record>
Export record stored in the current vault. This clones the encrypted record without removing it.
Sourcepub fn get_guard(
&self,
key: &Key<P>,
id: ChainId,
) -> Result<Buffer<u8>, RecordError<P::Error>>
pub fn get_guard( &self, key: &Key<P>, id: ChainId, ) -> Result<Buffer<u8>, RecordError<P::Error>>
Sourcepub fn garbage_collect(&mut self)
pub fn garbage_collect(&mut self)
Sorts through all of the vault entries and garbage collects any revoked entries.
Sourcepub fn get_blob_id(
&self,
key: &Key<P>,
id: ChainId,
) -> Result<BlobId, RecordError<P::Error>>
pub fn get_blob_id( &self, key: &Key<P>, id: ChainId, ) -> Result<BlobId, RecordError<P::Error>>
Trait Implementations§
Source§impl<'de, P> Deserialize<'de> for Vault<P>where
P: Deserialize<'de> + BoxProvider,
impl<'de, P> Deserialize<'de> for Vault<P>where
P: Deserialize<'de> + BoxProvider,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<P> !Freeze for Vault<P>
impl<P> !RefUnwindSafe for Vault<P>
impl<P> Send for Vault<P>where
P: Send,
impl<P> Sync for Vault<P>where
P: Sync,
impl<P> Unpin for Vault<P>where
P: Unpin,
impl<P> UnwindSafe for Vault<P>where
P: UnwindSafe,
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