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