Skip to main content

generate_ed25519_key

Function generate_ed25519_key 

Source
pub fn generate_ed25519_key(rng: &mut impl CryptoRng) -> Result<String, Error>
Expand description

Generate an Ed25519 signing key, returned as a PKCS#8 PEM.

PEM rather than raw bytes because that is what other implementations expect to find in a stored private key — Mastodon reads its keypairs.private_key with OpenSSL::PKey.read — so a key written here stays readable by a server pointed at the same database.

§Errors

Returns an error if the key cannot be encoded.