1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! Functionality needed by the anonymity revoker.
use super::{secret_sharing::*, types::*};
use crate::{curve_arithmetic::*, elgamal::Message};

/// Reveal the `idCredPub` based on the given shares.
/// It is important to remember that this always succeeds in computing
/// something. It simply does polynomial interpolation. Whether the resulting
/// value is meaningful must be ensured by the caller, e.g., by making sure that
/// the threshold is compatible with the number of shares.
pub fn reveal_id_cred_pub<C: Curve>(shares: &[(ArIdentity, Message<C>)]) -> C {
    reveal_in_group(
        &shares
            .iter()
            .map(|(n, m)| (*n, m.value))
            .collect::<Vec<_>>(),
    )
}

/// Reveal the PRF key based on the given shares.
/// It is important to remember that this always succeeds in computing
/// something. It simply does polynomial interpolation. Whether the resulting
/// value is meaningful must be ensured by the caller, e.g., by making sure that
/// the threshold is compatible with the number of shares.
pub fn reveal_prf_key<C: Curve>(shares: &[(ArIdentity, Value<C>)]) -> C::Scalar { reveal(shares) }