pub struct KeyBlock { /* private fields */ }
Expand description
A struct representing the key block with two public keys:
- an encryption public key and
- a hash public key.
Implementations§
Source§impl KeyBlock
impl KeyBlock
Sourcepub fn is_enc_pubkey_valid(&self) -> bool
pub fn is_enc_pubkey_valid(&self) -> bool
Checks if the encryption public key is valid.
§Returns
true
if the encryption public key is valid.false
if the encryption public key is invalid.
Sourcepub fn is_hash_pubkey_valid(&self) -> bool
pub fn is_hash_pubkey_valid(&self) -> bool
Checks if the hash public key is valid.
§Returns
true
if the hash public key is valid.false
if the hash public key is invalid.
Sourcepub fn get_enc_pubkey(&self) -> &[u8; 32]
pub fn get_enc_pubkey(&self) -> &[u8; 32]
Sourcepub fn get_hash_pubkey(&self) -> &[u8; 32]
pub fn get_hash_pubkey(&self) -> &[u8; 32]
Sourcepub fn get_enc_pubkey_mut(&mut self) -> &mut [u8; 32]
pub fn get_enc_pubkey_mut(&mut self) -> &mut [u8; 32]
Retrieves a mutable reference to the encryption public key.
§Returns
- A mutable reference to the encryption public key (32 bytes).
Sourcepub fn get_hash_pubkey_mut(&mut self) -> &mut [u8; 32]
pub fn get_hash_pubkey_mut(&mut self) -> &mut [u8; 32]
Retrieves a mutable reference to the hash public key.
§Returns
- A mutable reference to the hash public key (32 bytes).
Trait Implementations§
Source§impl BinarySize for KeyBlock
impl BinarySize for KeyBlock
Source§fn binary_size() -> usize
fn binary_size() -> usize
Returns the binary size of the KeyBlock
in bytes.
Since the struct contains two 32-byte fields (enc_pubkey
and hash_pubkey
), the total size is 64 bytes.
§Returns
64
: The size in bytes required to serialize aKeyBlock
.
Source§impl FromStream for KeyBlock
impl FromStream for KeyBlock
Source§fn read_from<R>(&mut self, reader: &mut R) -> Result<(), Error>
fn read_from<R>(&mut self, reader: &mut R) -> Result<(), Error>
Deserializes a KeyBlock
from a stream.
This method reads 64 bytes (32 bytes for each of the enc_pubkey
and hash_pubkey
) from the provided
reader and populates the KeyBlock
instance fields accordingly.
§Parameters
reader
: A mutable reference to a reader implementingio::Read
andio::Seek
.
§Returns
Ok(())
: If theKeyBlock
was successfully deserialized.Err(Error)
: If an error occurs while reading from the stream.
Auto Trait Implementations§
impl Freeze for KeyBlock
impl RefUnwindSafe for KeyBlock
impl Send for KeyBlock
impl Sync for KeyBlock
impl Unpin for KeyBlock
impl UnwindSafe for KeyBlock
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