pub fn export_hex(key: &PrivateKey, options: HexOptions) -> StringExpand description
Export a private key to hex format.
ยงExample
use rustywallet_export::{export_hex, HexOptions};
use rustywallet_keys::prelude::PrivateKey;
let key = PrivateKey::random();
// Default: lowercase, no prefix
let hex = export_hex(&key, HexOptions::new());
assert_eq!(hex.len(), 64);
// With 0x prefix
let hex = export_hex(&key, HexOptions::new().with_prefix(true));
assert!(hex.starts_with("0x"));
assert_eq!(hex.len(), 66);
// Uppercase
let hex = export_hex(&key, HexOptions::new().with_uppercase(true));
assert!(hex.chars().all(|c| !c.is_ascii_lowercase() || !c.is_alphabetic()));