/// Recreates a PoP for verification, keeping intermediate values.
Recreates a PoP for verification, keeping intermediate values.
Recreates a PoP for verification keeping intermediate values .
fn verification_pop_data<'a>(
    dkg_id: IDkgId,
    sender: &'a [u8],
    key: (EphemeralPublicKeyBytes, EphemeralPopBytes),
) -> Result<PopData<'_>, DkgVerifyEphemeralError> {
    let (public_key_bytes, pop_bytes) = key;
    let public_key: EphemeralPublicKey = public_key_bytes
        .try_into()
        .map_err(DkgVerifyEphemeralError::MalformedPublicKeyError)?;
    let pop: EphemeralPop = pop_bytes
        .try_into()
        .map_err(DkgVerifyEphemeralError::MalformedPopError)?;
    let h_digest = HDigest::<'a> {
        dkg_id,
        public_key_bytes,
        sender,
    };
    let c_digest = {
        let spec_h: EphemeralPublicKey = h_digest.hash_to_secp256k1();
        let spec_t: EphemeralPublicKey =
            EphemeralPublicKey::from(&pop.spec_s) + public_key * &-pop.spec_c.clone();
        let spec_u: EphemeralPublicKey =
            (spec_h.clone() * &pop.spec_s) + (pop.spec_ext.clone() * &-pop.spec_c.clone());
        ChallengeDigest::<'a> {
            dkg_id,
            h_bytes: EphemeralPublicKeyBytes::from(&spec_h),
            public_key_bytes,
            ext_bytes: EphemeralPublicKeyBytes::from(&pop.spec_ext),
            t_bytes: EphemeralPublicKeyBytes::from(&spec_t),
            u_bytes: EphemeralPublicKeyBytes::from(&spec_u),
            sender,
        }
    };
    Ok(PopData {
        public_key_bytes,
        pop,
        h_digest,
        c_digest,
    })
}
fn verification_pop_data < ' a > ( dkg_id : IDkgId , sender : & ' a [ u8 ] , key : ( EphemeralPublicKeyBytes , EphemeralPopBytes ) , ) -> Result < PopData < ' _ > , DkgVerifyEphemeralError > { let ( public_key_bytes , pop_bytes ) = key ; let public_key : EphemeralPublicKey = public_key_bytes . try_into ( ) . map_err ( DkgVerifyEphemeralError :: MalformedPublicKeyError ) ? ; let pop : EphemeralPop = pop_bytes . try_into ( ) . map_err ( DkgVerifyEphemeralError :: MalformedPopError ) ? ; let h_digest = HDigest :: < ' a > { dkg_id , public_key_bytes , sender , } ; let c_digest = { let spec_h : EphemeralPublicKey = h_digest . hash_to_secp256k1 ( ) ; let spec_t : EphemeralPublicKey = EphemeralPublicKey :: from ( & pop . spec_s ) + public_key * & - pop . spec_c . clone ( ) ; let spec_u : EphemeralPublicKey = ( spec_h . clone ( ) * & pop . spec_s ) + ( pop . spec_ext . clone ( ) * & - pop . spec_c . clone ( ) ) ; ChallengeDigest :: < ' a > { dkg_id , h_bytes : EphemeralPublicKeyBytes :: from ( & spec_h ) , public_key_bytes , ext_bytes : EphemeralPublicKeyBytes :: from ( & pop . spec_ext ) , t_bytes : EphemeralPublicKeyBytes :: from ( & spec_t ) , u_bytes : EphemeralPublicKeyBytes :: from ( & spec_u ) , sender , } } ; Ok ( PopData { public_key_bytes , pop , h_digest , c_digest , } ) }
Recreates a PoP for verification, keeping intermediate values.
Recreates a PoP for verification keeping intermediate values .
dkg_id
IDkgId
sender
&'a [u8]
key
(EphemeralPublicKeyBytes, EphemeralPopBytes)