use lib_q_lattice_zkp::{
AjtaiCommitment,
AjtaiCommitmentKey,
AjtaiOpening,
ProofError,
commit,
};
#[derive(Clone)]
pub struct MemberIssuerKey {
pub opening: AjtaiOpening,
pub commitment: AjtaiCommitment,
}
impl MemberIssuerKey {
pub fn from_opening(
crs: &AjtaiCommitmentKey,
opening: AjtaiOpening,
) -> Result<Self, ProofError> {
let p = &crs.params;
if opening.message.0.len() != p.module_rank ||
opening.randomness.0.len() != p.randomness_dimension
{
return Err(ProofError::InvalidParameters);
}
let commitment = commit(crs, &opening);
Ok(Self {
opening,
commitment,
})
}
}