Add keys chapter
Introduces PublicKey and SecretKey as distinct type-safe wrappers around secp256k1, with hex and NIP-19 bech32 (npub/nsec) encoding. SecretKey has a redacted Debug impl and no Display to reduce accidental leakage; it exposes material only through explicit to_hex / to_nsec. FromStr on both types auto-detects hex vs. bech32. Eight round-trip tests cover encoding, auto-detection, prefix validation, debug redaction, and generation.
This commit is contained in:
@@ -8,5 +8,10 @@ description = "Struct definitions and stateless utilities related to nostr"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
sha2 = "0.10"
|
||||
secp256k1 = { version = "0.29", features = ["global-context", "serde"] }
|
||||
secp256k1 = { version = "0.29", features = ["global-context", "serde", "rand"] }
|
||||
hex = "0.4"
|
||||
bech32 = "0.11"
|
||||
rand = "0.8"
|
||||
scrypt = { version = "0.11", default-features = false, features = ["std"] }
|
||||
chacha20poly1305 = "0.10"
|
||||
unicode-normalization = "0.1"
|
||||
|
||||
Reference in New Issue
Block a user