Struct aether_lib::identity::PublicId
source · [−]pub struct PublicId { /* private fields */ }
Expand description
Primitive to represent public identity of a user. Used by a user to store other users’
identities
Different from Id
as it is meant to be used to store only public key. So, only used to
represent identity of other users
Implementations
sourceimpl PublicId
impl PublicId
sourcepub fn from_base64(key: &str) -> Result<PublicId, AetherError>
pub fn from_base64(key: &str) -> Result<PublicId, AetherError>
Decode the given base64 string into a PublicId
Errors
AetherError::Base64DecodeError
- If the given string is not valid base64
sourcepub fn public_key_to_base64(&self) -> Result<String, AetherError>
pub fn public_key_to_base64(&self) -> Result<String, AetherError>
Convert public key to a base64 encoded string Encodes public key as DER and then encodes DER into base64
sourcepub fn public_encrypt(&self, from: &[u8]) -> Result<Vec<u8>, AetherError>
pub fn public_encrypt(&self, from: &[u8]) -> Result<Vec<u8>, AetherError>
Encrypt given bytes using the public key
sourcepub fn public_decrypt(&self, from: &[u8]) -> Result<Vec<u8>, AetherError>
pub fn public_decrypt(&self, from: &[u8]) -> Result<Vec<u8>, AetherError>
Decrypt given bytes using the public key
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for PublicId
impl Send for PublicId
impl Sync for PublicId
impl Unpin for PublicId
impl UnwindSafe for PublicId
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more