pub struct Ed25519Signer { /* private fields */ }Expand description
In-process Ed25519 signer.
Implementations§
Source§impl Ed25519Signer
impl Ed25519Signer
Sourcepub fn generate() -> Self
pub fn generate() -> Self
Generate a fresh keypair. The key id is derived from the public key (first 32 hex chars of its SHA-256) so ids are collision-resistant and never chosen by an attacker.
Round-20 F5: defense-in-depth against a compromised
getrandom (VM without entropy, cloud image with a broken
/dev/urandom) — regenerate rather than accept an
all-zero or all-0xFF seed. Reader-side already refuses
these known-weak seeds (round-14); this closes the gap
for generator-side. Astronomically unlikely from a healthy
OsRng, but the failure mode is silent installation of a
globally-predictable keypair — cheap to guard.
Sourcepub fn from_seed(seed: &[u8; 32]) -> Self
pub fn from_seed(seed: &[u8; 32]) -> Self
Load from a 32-byte secret seed.
Round-19 F2: takes &[u8; 32] (borrow), not by value. Passing
the seed by value materializes a caller-owned temp slot on
the stack that Rust does not guarantee to zeroize on drop —
the round-18 F5 Zeroizing<[u8; 32]> wrapper only zeroizes
the slot IT owns, not the copy the callee received. By taking
a reference we let the caller keep the seed inside a
Zeroizing and never lose control of the memory.