keygen
Module: keygen
Section titled “Module: keygen”Contents
Section titled “Contents”Structs
KeypairPaths- Paths written by [write_keypair].
Enums
KeygenError- Failure modes for [write_keypair].
Functions
write_keypair- Generate a fresh Ed25519 (PASETO v4) keypair and write it to disk.
firma_authority::keygen::KeygenError
Section titled “firma_authority::keygen::KeygenError”Enum
Failure modes for [write_keypair].
Variants:
Generate(String)- PASETO keypair generation failed.Write{ path: std::path::PathBuf, source: std::io::Error }- Writing the secret or public key file failed.
Trait Implementations:
- Display
fn fmt(self: &Self, __formatter: & mut ::core::fmt::Formatter) -> ::core::fmt::Result
- Error
fn source(self: &Self) -> ::core::option::Option<&dyn ::thiserror::__private18::Error>
- Debug
fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result
firma_authority::keygen::KeypairPaths
Section titled “firma_authority::keygen::KeypairPaths”Struct
Paths written by [write_keypair].
Fields:
secret: std::path::PathBuf- Secret key file (the inputpath).public: std::path::PathBuf- Public key file (pathwith a.pubextension).
Traits: Eq
Trait Implementations:
- PartialEq
fn eq(self: &Self, other: &KeypairPaths) -> bool
- Clone
fn clone(self: &Self) -> KeypairPaths
- Debug
fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result
firma_authority::keygen::write_keypair
Section titled “firma_authority::keygen::write_keypair”Function
Generate a fresh Ed25519 (PASETO v4) keypair and write it to disk.
path receives the secret key; the public key is written alongside it at
path with the extension replaced by .pub. Both files are created with
create_new so an existing key is never silently overwritten — callers
that want to reuse an existing key must check for it first.
On Unix the secret is mode 0o600 and the public key 0o644.
Errors
Section titled “Errors”- [
KeygenError::Generate] when keypair generation fails. - [
KeygenError::Write] when either file cannot be created or written.
fn write_keypair(path: &std::path::Path) -> Result<KeypairPaths, KeygenError>