#[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 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
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)