Create a public key from raw bytes
(bytes: &[u8; 32])
| 24 | |
| 25 | /// Create a public key from raw bytes |
| 26 | pub fn from_bytes(bytes: &[u8; 32]) -> Result<Self, IdentityError> { |
| 27 | let key = VerifyingKey::from_bytes(bytes) |
| 28 | .map_err(|e| IdentityError::InvalidKey(e.to_string()))?; |
| 29 | Ok(PublicKey(key)) |
| 30 | } |
| 31 | |
| 32 | /// Get the raw bytes of the public key |
| 33 | pub fn as_bytes(&self) -> &[u8; 32] { |