#[repr(C)]pub struct Signature { /* private fields */ }
Expand description
Ed25519 signature.
This type represents a container for the byte serialization of an Ed25519 signature, and does not necessarily represent well-formed field or curve elements.
Signature verification libraries are expected to reject invalid field elements at the time a signature is verified.
Implementations§
Source§impl Signature
impl Signature
Sourcepub fn from_bytes(bytes: &SignatureBytes) -> Self
pub fn from_bytes(bytes: &SignatureBytes) -> Self
Parse an Ed25519 signature from a byte slice.
Sourcepub fn from_components(R: ComponentBytes, s: ComponentBytes) -> Self
pub fn from_components(R: ComponentBytes, s: ComponentBytes) -> Self
Parse an Ed25519 signature from its R
and s
components.
Sourcepub fn from_slice(bytes: &[u8]) -> Result<Self>
pub fn from_slice(bytes: &[u8]) -> Result<Self>
Parse an Ed25519 signature from a byte slice.
§Returns
Ok
on successErr
if the input byte slice is not 64-bytes
Sourcepub fn r_bytes(&self) -> &ComponentBytes
pub fn r_bytes(&self) -> &ComponentBytes
Bytes for the R
component of a signature.
Sourcepub fn s_bytes(&self) -> &ComponentBytes
pub fn s_bytes(&self) -> &ComponentBytes
Bytes for the s
component of a signature.
Sourcepub fn to_bytes(&self) -> SignatureBytes
pub fn to_bytes(&self) -> SignatureBytes
Return the inner byte array.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Signature
impl<'de> Deserialize<'de> for Signature
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&[u8; 64]> for Signature
impl From<&[u8; 64]> for Signature
Source§fn from(bytes: &SignatureBytes) -> Self
fn from(bytes: &SignatureBytes) -> Self
Converts to this type from the input type.
Source§impl From<&Signature> for SignatureBytes
impl From<&Signature> for SignatureBytes
Source§fn from(sig: &Signature) -> SignatureBytes
fn from(sig: &Signature) -> SignatureBytes
Converts to this type from the input type.
Source§impl From<[u8; 64]> for Signature
impl From<[u8; 64]> for Signature
Source§fn from(bytes: SignatureBytes) -> Self
fn from(bytes: SignatureBytes) -> Self
Converts to this type from the input type.
Source§impl From<Signature> for SignatureBytes
impl From<Signature> for SignatureBytes
Source§fn from(sig: Signature) -> SignatureBytes
fn from(sig: Signature) -> SignatureBytes
Converts to this type from the input type.
Source§impl FromStr for Signature
Decode a signature from hexadecimal.
impl FromStr for Signature
Decode a signature from hexadecimal.
Upper and lower case hexadecimal are both accepted, however mixed case is rejected.
Source§impl SignatureEncoding for Signature
impl SignatureEncoding for Signature
Source§fn to_bytes(&self) -> SignatureBytes
fn to_bytes(&self) -> SignatureBytes
Encode signature as its byte representation.
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Get the length of this signature when encoded.
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 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