#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct ObfuscationKey([u8; 32]);
impl ObfuscationKey {
pub const SIZE: usize = size_of::<Self>();
pub const ZERO: Self = Self([0u8; 32]);
pub const fn as_bytes(&self) -> &[u8; 32] {
&self.0
}
#[cfg(feature = "std")]
pub fn generate() -> Self {
use rand::RngExt;
let mut bytes = [0u8; 32];
rand::rng().fill(&mut bytes);
Self(bytes)
}
}
impl From<[u8; 32]> for ObfuscationKey {
fn from(bytes: [u8; 32]) -> Self {
Self(bytes)
}
}
impl Default for ObfuscationKey {
fn default() -> Self {
Self::ZERO
}
}