http_message_signatures/keys
Ed25519 key material.
A thin, domain-scoped wrapper over kryptos/eddsa fixed to the Ed25519
curve, so callers never need to import kryptos directly or think about
kryptos/eddsa.Curve.
Types
pub type KeyError {
InvalidPem
InvalidBase64
InvalidKeyBytes
}
Constructors
-
InvalidPem -
InvalidBase64 -
InvalidKeyBytes
pub type PrivateKey =
eddsa.PrivateKey
pub type PublicKey =
eddsa.PublicKey
Values
pub fn generate() -> #(eddsa.PrivateKey, eddsa.PublicKey)
Generates a new Ed25519 key pair.
pub fn key_pair_from_base64(
seed: String,
) -> Result(#(eddsa.PrivateKey, eddsa.PublicKey), KeyError)
Loads a private key (and its derived public key) from a base64-encoded 32-byte seed — the format Open Payments-style ecosystems commonly use to distribute raw Ed25519 keys.
pub fn key_pair_from_pem(
pem: String,
) -> Result(#(eddsa.PrivateKey, eddsa.PublicKey), KeyError)
Loads a private key (and its derived public key) from a PKCS#8 PEM.
pub fn private_key_to_pem(
key: eddsa.PrivateKey,
) -> Result(String, KeyError)
Exports a private key as a PKCS#8 PEM.
pub fn public_key_from_base64(
bytes: String,
) -> Result(eddsa.PublicKey, KeyError)
Loads a public key from a base64-encoded 32-byte point.
pub fn public_key_from_pem(
pem: String,
) -> Result(eddsa.PublicKey, KeyError)
Loads a public key from an SPKI PEM.
pub fn public_key_to_pem(
key: eddsa.PublicKey,
) -> Result(String, KeyError)
Exports a public key as an SPKI PEM.