pub struct Signature(/* private fields */);Expand description
An Ed25519 signature (64 bytes).
Implementations§
Source§impl Signature
impl Signature
Sourcepub const fn from_bytes(bytes: [u8; 64]) -> Self
pub const fn from_bytes(bytes: [u8; 64]) -> Self
Create from raw bytes.
Sourcepub fn try_from_slice(slice: &[u8]) -> CryptoResult<Self>
pub fn try_from_slice(slice: &[u8]) -> CryptoResult<Self>
Try to create from a slice.
§Errors
Returns CryptoError::InvalidSignatureLength if the slice is not exactly 64 bytes.
Sourcepub fn from_hex(s: &str) -> CryptoResult<Self>
pub fn from_hex(s: &str) -> CryptoResult<Self>
Sourcepub fn from_base64(s: &str) -> CryptoResult<Self>
pub fn from_base64(s: &str) -> CryptoResult<Self>
Decode from base64 string.
§Errors
Returns an error if the string is not valid base64 or not 64 bytes.
Sourcepub fn verify(&self, message: &[u8], public_key: &[u8; 32]) -> CryptoResult<()>
pub fn verify(&self, message: &[u8], public_key: &[u8; 32]) -> CryptoResult<()>
Verify this signature against a message and public key.
§Errors
Returns an error if the public key is invalid or signature verification fails.
Sourcepub fn to_dalek(&self) -> DalekSignature
pub fn to_dalek(&self) -> DalekSignature
Convert to the underlying dalek signature type.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Signature
impl<'de> Deserialize<'de> for Signature
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
Source§impl From<Signature> for Signature
impl From<Signature> for Signature
Source§fn from(sig: DalekSignature) -> Self
fn from(sig: DalekSignature) -> Self
Converts to this type from the input type.
impl Copy for Signature
impl Eq for Signature
impl StructuralPartialEq for Signature
Auto Trait Implementations§
impl Freeze for Signature
impl RefUnwindSafe for Signature
impl Send for Signature
impl Sync for Signature
impl Unpin for Signature
impl UnsafeUnpin for Signature
impl UnwindSafe for Signature
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Upper case
letters are used (e.g. F9B4CA)