pub(crate) struct AuxRng(pub(crate) [u8; 32]);
impl rand_core::TryRng for AuxRng {
type Error = core::convert::Infallible;
fn try_next_u32(&mut self) -> Result<u32, Self::Error> {
Ok(0)
}
fn try_next_u64(&mut self) -> Result<u64, Self::Error> {
Ok(0)
}
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Self::Error> {
dest.copy_from_slice(&self.0);
Ok(())
}
}
impl rand_core::TryCryptoRng for AuxRng {}
pub(crate) fn sign_with_aux(
keys: &crate::key::Keys,
unsigned: crate::event::UnsignedEvent,
aux: [u8; 32],
) -> crate::event::Event {
keys.sign_event(unsigned, &mut AuxRng(aux))
.expect("AuxRng cannot fail")
}