use crate::Timestamp;
use base64::{Engine as _, engine::general_purpose::URL_SAFE_NO_PAD};
use std::fmt::{Display, Formatter};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Metadata<'a> {
pub designation: &'a str,
pub timestamp: &'a Timestamp,
pub seed: &'a [u8; 32],
}
impl Display for Metadata<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(
f,
"-d '{desig}' -t '{ts}' -s '{seed}' ",
seed = URL_SAFE_NO_PAD.encode(self.seed),
desig = self.designation,
ts = self.timestamp
)?;
Ok(())
}
}