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.