Add YAML configuration system and nsec encoding

Configuration system:
- New config module with cascading file search
- Priority: ./fips.yaml > ~/.config/fips/ > ~/.fips.yaml > /etc/fips/
- Identity section with optional nsec (bech32 or hex format)
- Generate new keypair if nsec not configured

Identity module additions:
- encode_nsec() and decode_nsec() for NIP-19 bech32 format
- decode_secret() accepts both nsec and hex formats
- Identity::from_secret_str() constructor

Dependencies: serde, serde_yaml, dirs, hex

41 tests passing (20 identity + 15 config + 6 nsec)
This commit is contained in:
Johnathan Corgan
2026-01-25 01:08:02 +00:00
parent ac2f6a75c8
commit b80b3fbecf
6 changed files with 809 additions and 96 deletions
+4 -2
View File
@@ -3,9 +3,11 @@
//! A distributed, decentralized network routing protocol for mesh nodes
//! connecting over arbitrary transports.
pub mod config;
pub mod identity;
pub use config::{Config, ConfigError, IdentityConfig};
pub use identity::{
decode_npub, encode_npub, AuthChallenge, AuthResponse, FipsAddress, Identity, IdentityError,
NodeId, PeerIdentity,
decode_npub, decode_nsec, decode_secret, encode_npub, encode_nsec, AuthChallenge, AuthResponse,
FipsAddress, Identity, IdentityError, NodeId, PeerIdentity,
};