30 lines
694 B
Rust
Raw Normal View History

2025-08-12 13:10:46 -03:00
use std::io::{Cursor, Read};
use crate::{PublicKey, Signature};
impl PublicKey {
// TODO: remove unwraps and return Result
pub(crate) fn from_cursor(cursor: &mut Cursor<&[u8]>) -> Self {
let mut value = [0u8; 32];
cursor.read_exact(&mut value).unwrap();
Self(value)
}
pub(crate) fn to_bytes(&self) -> &[u8] {
&self.0
}
2025-08-12 13:10:46 -03:00
}
impl Signature {
// TODO: remove unwraps and return Result
pub(crate) fn from_cursor(cursor: &mut Cursor<&[u8]>) -> Self {
let mut value = [0u8; 64];
cursor.read_exact(&mut value).unwrap();
Self { value }
}
pub(crate) fn to_bytes(&self) -> &[u8] {
&self.value
}
2025-08-12 13:10:46 -03:00
}