Skip to main content

run

Function run 

Source
pub fn run(output_dir: Option<PathBuf>) -> Result<()>
Expand description

Generate an Ed25519 signing key pair.

This function creates a new Ed25519 private/public key pair and saves them to the specified output directory (or current directory if not specified).

§Arguments

  • output_dir - Optional directory to store keys. Defaults to current directory.

§Generated Files

  • private.key: Ed25519 private key (32 bytes, keep secure!)
  • public.key: Ed25519 public key (32 bytes, can be shared)

§Returns

Returns Ok(()) on success, or an error if key generation or file writing fails.

§Security Warning

The private key file MUST be protected with appropriate filesystem permissions:

chmod 600 private.key

§Example

// Generate keys in ~/.hexz/keys
keygen::run(Some(PathBuf::from("/home/user/.hexz/keys")))?;