pub struct PublicKey { /* private fields */ }Expand description
An Ed25519 public key for verifying signatures.
Implementations§
Source§impl PublicKey
impl PublicKey
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Create a public key from raw bytes (32 bytes).
Sourcepub fn from_base64(s: &str) -> Result<Self>
pub fn from_base64(s: &str) -> Result<Self>
Decode a public key from base64.
Sourcepub fn verify(&self, message: &[u8], signature: &[u8; 64]) -> Result<()>
pub fn verify(&self, message: &[u8], signature: &[u8; 64]) -> Result<()>
Verify a signature on a message.
Sourcepub fn save_to_file<P: AsRef<Path>>(&self, path: P) -> Result<()>
pub fn save_to_file<P: AsRef<Path>>(&self, path: P) -> Result<()>
Save the public key to a file.
Sourcepub fn load_from_file<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn load_from_file<P: AsRef<Path>>(path: P) -> Result<Self>
Load a public key from a file.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PublicKey
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
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