diff --git a/src/voprf.rs b/src/voprf.rs index 9215083..f4eeee8 100644 --- a/src/voprf.rs +++ b/src/voprf.rs @@ -15,7 +15,7 @@ use core::marker::PhantomData; use derive_where::DeriveWhere; use digest::core_api::BlockSizeUser; -use digest::{Digest, FixedOutputReset}; +use digest::{Digest, FixedOutputReset, Output}; use generic_array::sequence::Concat; use generic_array::typenum::{U1, U11, U2, U20}; use generic_array::GenericArray; @@ -245,7 +245,7 @@ impl NonVerifiableClient input: &[u8], evaluation_element: &EvaluationElement, metadata: Option<&[u8]>, - ) -> Result> { + ) -> Result> { let unblinded_element = evaluation_element.value * &G::scalar_invert(&self.blind); let mut outputs = finalize_after_unblind::( Some((input, unblinded_element)).into_iter(), @@ -330,7 +330,7 @@ impl VerifiableClient, pk: G, metadata: Option<&[u8]>, - ) -> Result> { + ) -> Result> { // `core::array::from_ref` needs a MSRV of 1.53 let inputs: &[&[u8]; 1] = core::slice::from_ref(&input).try_into().unwrap(); let clients: &[Self; 1] = core::slice::from_ref(self).try_into().unwrap(); @@ -397,7 +397,7 @@ impl VerifiableClient NonVerifiableServer { /// Produces a new instance of a [NonVerifiableServer] using a supplied RNG pub fn new(rng: &mut R) -> Result { - let mut seed = GenericArray::<_, H::OutputSize>::default(); + let mut seed = Output::::default(); rng.fill_bytes(&mut seed); Self::new_from_seed(&seed) } @@ -463,7 +463,7 @@ impl NonVerifiableServer impl VerifiableServer { /// Produces a new instance of a [VerifiableServer] using a supplied RNG pub fn new(rng: &mut R) -> Result { - let mut seed = GenericArray::<_, H::OutputSize>::default(); + let mut seed = Output::::default(); rng.fill_bytes(&mut seed); Self::new_from_seed(&seed) } @@ -852,13 +852,15 @@ fn deterministic_blind_unchecked = Map< +type VerifiableUnblindResult<'a, G, H, IC, IM> = Map< Zip< - Map<<&'a IC as IntoIterator>::IntoIter, fn(&VerifiableClient) -> G::Scalar>, + Map< + <&'a IC as IntoIterator>::IntoIter, + fn(&VerifiableClient) -> ::Scalar, + >, <&'a IM as IntoIterator>::IntoIter, >, - fn((G::Scalar, &EvaluationElement)) -> G, + fn((::Scalar, &EvaluationElement)) -> G, >; fn verifiable_unblind< @@ -989,10 +991,9 @@ fn verify_proof( } } -#[allow(type_alias_bounds)] -type FinalizeAfterUnblindResult<'a, G, H: Digest, I, IE> = Map< +type FinalizeAfterUnblindResult<'a, G, H, I, IE> = Map< Zip)>>, - fn(((I, G), (&'a [u8], GenericArray))) -> Result>, + fn(((I, G), (&'a [u8], GenericArray))) -> Result>, >; fn finalize_after_unblind< @@ -1111,7 +1112,7 @@ mod tests { key: G::Scalar, info: &[u8], mode: Mode, - ) -> GenericArray { + ) -> Output { let dst = GenericArray::from(STR_HASH_TO_GROUP).concat(get_context_string::(mode).unwrap()); let point = G::hash_to_curve::(input, dst).unwrap();