Skip to main content

world_id_proof/
lib.rs

1#![cfg_attr(not(test), warn(unused_crate_dependencies))]
2
3use eddsa_babyjubjub::EdDSAPrivateKey;
4use world_id_primitives::{
5    TREE_DEPTH, authenticator::AuthenticatorPublicKeySet, merkle::MerkleInclusionProof,
6};
7use zeroize::{Zeroize, ZeroizeOnDrop};
8
9pub mod credential_blinding_factor;
10pub mod nullifier;
11pub mod proof;
12
13/// Inputs from the Authenticator to generate a nullifier or blinding factor.
14#[derive(Zeroize, ZeroizeOnDrop)]
15pub struct AuthenticatorProofInput {
16    /// The set of all public keys for all the user's authenticators.
17    #[zeroize(skip)]
18    key_set: AuthenticatorPublicKeySet,
19    /// Inclusion proof in the World ID Registry.
20    #[zeroize(skip)]
21    inclusion_proof: MerkleInclusionProof<TREE_DEPTH>,
22    /// The off-chain signer key for the Authenticator.
23    private_key: EdDSAPrivateKey,
24    /// The index at which the authenticator key is located in the `key_set`.
25    key_index: u64,
26}
27
28impl AuthenticatorProofInput {
29    /// Creates a new authenticator proof input.
30    #[must_use]
31    pub const fn new(
32        key_set: AuthenticatorPublicKeySet,
33        inclusion_proof: MerkleInclusionProof<TREE_DEPTH>,
34        private_key: EdDSAPrivateKey,
35        key_index: u64,
36    ) -> Self {
37        Self {
38            key_set,
39            inclusion_proof,
40            private_key,
41            key_index,
42        }
43    }
44}