pub struct Signature { /* private fields */ }Expand description
Signature produced by an Chio SigningBackend.
Historically this type wrapped a 64-byte Ed25519 signature. It now carries an algorithm-tagged payload internally while preserving byte-identical serialization and construction helpers for the Ed25519 case.
Implementations§
Source§impl Signature
impl Signature
Sourcepub fn from_bytes(bytes: &[u8; 64]) -> Signature
pub fn from_bytes(bytes: &[u8; 64]) -> Signature
Create from raw 64-byte Ed25519 signature bytes.
Sourcepub fn from_p256_der(bytes: &[u8]) -> Signature
pub fn from_p256_der(bytes: &[u8]) -> Signature
Create a P-256 ECDSA signature from DER-encoded bytes.
Sourcepub fn from_p384_der(bytes: &[u8]) -> Signature
pub fn from_p384_der(bytes: &[u8]) -> Signature
Create a P-384 ECDSA signature from DER-encoded bytes.
Sourcepub fn from_hex(hex_str: &str) -> Result<Signature, Error>
pub fn from_hex(hex_str: &str) -> Result<Signature, Error>
Create from hex-encoded bytes (with optional 0x prefix).
A bare hex string is interpreted as an Ed25519 signature (64 bytes)
for backward compatibility. A p256: or p384: prefix selects ECDSA.
Sourcepub fn to_hex(&self) -> String
pub fn to_hex(&self) -> String
Hex encoding, with algorithm prefix for non-Ed25519 signatures.
Ed25519 signatures render as a bare 128-character lowercase hex string, byte-identical to the historical format.
Sourcepub fn to_bytes(&self) -> [u8; 64]
pub fn to_bytes(&self) -> [u8; 64]
Raw 64-byte Ed25519 representation.
Mirrors the historical API. For non-Ed25519 signatures returns an all-zero placeholder (such signatures never flow through 64-byte-only consumer paths because those paths are Ed25519-specific on-chain anchoring layers that never see FIPS artifacts).
Sourcepub fn algorithm(&self) -> SigningAlgorithm
pub fn algorithm(&self) -> SigningAlgorithm
Which algorithm produced this signature.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Signature
impl<'de> Deserialize<'de> for Signature
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Signature, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Signature, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Serialize for Signature
impl Serialize for Signature
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl Eq 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.