Function noah_api::anon_creds::ac_open_commitment
source · pub fn ac_open_commitment<R: CryptoRng + RngCore>(
prng: &mut R,
usk: &ACUserSecretKey,
credential: &Credential,
rand: &ACCommitmentKey,
reveal_map: &[bool]
) -> Result<ACRevealProof>Expand description
Produce an AttrsRevealProof for a committed credential produced using key.
Example
use rand_core::SeedableRng;
use rand_chacha::ChaChaRng;
use noah_api::anon_creds::{ac_keygen_issuer, ac_keygen_user, ac_sign, ac_open_commitment, ac_commit, Credential};
let mut prng = ChaChaRng::from_seed([0u8;32]);
let num_attrs = 2;
let (issuer_sk, issuer_pk) = ac_keygen_issuer(&mut prng, num_attrs);
let (user_sk, user_pk) = ac_keygen_user(&mut prng, &issuer_pk);
let attributes = vec![10, 20];
let signature = ac_sign::<ChaChaRng>(&mut prng, &issuer_sk, &user_pk, &attributes[..]).unwrap();
let credential = Credential {
sig:signature,
attrs:attributes,
ipk:issuer_pk,
};
let (commitment,pok,key) = ac_commit::<ChaChaRng>(&mut prng, &user_sk, &credential, b"Some message").unwrap();
let attrs_map = [true, false];
let reveal_sig = ac_open_commitment::<ChaChaRng>(&mut prng, &user_sk, &credential, &key.unwrap(), &attrs_map).unwrap();Run