Struct safe_core::MDataInfo
[−]
[src]
pub struct MDataInfo { pub name: XorName, pub type_tag: u64, pub enc_info: Option<(Key, Option<Nonce>)>, pub new_enc_info: Option<(Key, Option<Nonce>)>, }
Information allowing to locate and access mutable data on the network.
Fields
name: XorName
Name of the data where the directory is stored.
type_tag: u64
Type tag of the data where the directory is stored.
enc_info: Option<(Key, Option<Nonce>)>
Key to encrypt/decrypt the directory content. and the nonce to be used for keys
new_enc_info: Option<(Key, Option<Nonce>)>
Future encryption info, used for two-phase data reencryption.
Methods
impl MDataInfo
[src]
fn new_private(
name: XorName,
type_tag: u64,
enc_info: (Key, Option<Nonce>)
) -> Self
name: XorName,
type_tag: u64,
enc_info: (Key, Option<Nonce>)
) -> Self
Construct MDataInfo
for private (encrypted) data with a
provided private key.
fn new_public(name: XorName, type_tag: u64) -> Self
Construct MDataInfo
for public data.
fn random_private(type_tag: u64) -> Result<Self, CoreError>
Generate random MDataInfo
for private (encrypted) mutable data.
fn random_public(type_tag: u64) -> Result<Self, CoreError>
Generate random MDataInfo
for public mutable data.
fn enc_key(&self) -> Option<&Key>
Returns the encryption key, if any.
fn nonce(&self) -> Option<&Nonce>
Returns the nonce, inf any.
fn enc_entry_key(&self, plain_text: &[u8]) -> Result<Vec<u8>, CoreError>
encrypt the the key for the mdata entry accordingly
fn enc_entry_value(&self, plain_text: &[u8]) -> Result<Vec<u8>, CoreError>
encrypt the value for this mdata entry accordingly
fn decrypt(&self, cipher: &[u8]) -> Result<Vec<u8>, CoreError>
decrypt key or value of this mdata entry
fn start_new_enc_info(&mut self)
Start the encryption info re-generation by populating the new_enc_info
field with random keys.
fn commit_new_enc_info(&mut self)
Commit the encryption info re-generation by replacing the current encryption info
with new_enc_info
(if any).
fn abort_new_enc_info(&mut self)
Abort the encryption info regeneration by clearing the new_enc_info
field.
Trait Implementations
impl Clone for MDataInfo
[src]
fn clone(&self) -> MDataInfo
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more