Add addresses chapter

This commit is contained in:
Jon Staab
2026-04-17 16:43:56 -07:00
parent c7ec9f18fa
commit b96ad44d3a
7 changed files with 826 additions and 41 deletions
+7
View File
@@ -133,6 +133,13 @@ impl PublicKey {
.map_err(|_| KeyError::InvalidKey)?;
Ok(PublicKey(inner))
}
/// Parse from raw bytes (exactly 32).
pub fn from_bytes(bytes: &[u8]) -> Result<Self, KeyError> {
let inner = secp256k1::XOnlyPublicKey::from_slice(bytes)
.map_err(|_| KeyError::InvalidKey)?;
Ok(PublicKey(inner))
}
}
```