-
Notifications
You must be signed in to change notification settings - Fork 19
feat: feature-flag provekit dependencies behind provekit feature
#708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| use secrecy::ExposeSecret; | ||
| #[cfg(feature = "provekit")] | ||
| use world_id_primitives::OwnershipProof; | ||
| use world_id_primitives::{ | ||
| Credential, FieldElement, OwnershipProof, ProofRequest, ProofResponse, RequestItem, | ||
| ResponseItem, SessionId, SessionNullifier, ZeroKnowledgeProof, | ||
| Credential, FieldElement, ProofRequest, ProofResponse, RequestItem, ResponseItem, SessionId, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. /otto - what is this about?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a consequence of how Rust's The fix is to split #[cfg(feature = "provekit")]
use world_id_primitives::OwnershipProof;Without this, you'd get a compilation error when building without |
||
| SessionNullifier, ZeroKnowledgeProof, | ||
| }; | ||
| use world_id_proof::{ | ||
| AuthenticatorProofInput, FullOprfOutput, OprfEntrypoint, ProofCompression, | ||
|
|
@@ -14,6 +16,7 @@ use crate::{ | |
| error::AuthenticatorError, | ||
| }; | ||
| use world_id_primitives::TREE_DEPTH; | ||
| #[cfg(feature = "provekit")] | ||
| use world_id_proof::{ | ||
| circuit_inputs::OwnershipProofCircuitInput, ownership_proof::generate_ownership_proof, | ||
| }; | ||
|
|
@@ -437,6 +440,7 @@ impl Authenticator { | |
| /// | ||
| /// # Returns | ||
| /// The [`OwnershipProof`] containing the ZKP and Merkle root. | ||
| #[cfg(feature = "provekit")] | ||
| pub async fn prove_credential_sub( | ||
| &self, | ||
| nonce: FieldElement, | ||
|
|
@@ -473,7 +477,7 @@ impl Authenticator { | |
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| #[cfg(all(test, feature = "provekit"))] | ||
| mod tests { | ||
| use crate::{ | ||
| authenticator::Authenticator, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,13 @@ embed-zkeys = ["authenticator", "world-id-proof/embed-zkeys"] | |
| compress-zkeys = ["authenticator", "embed-zkeys", "world-id-proof/compress-zkeys"] | ||
| # Compress the tar archive with zstd | ||
| zstd-compress-zkeys = ["authenticator", "embed-zkeys", "world-id-proof/zstd-compress-zkeys"] | ||
| # Enable ProveKit-backed ownership proofs. | ||
| provekit = [ | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: |
||
| "authenticator", | ||
| "world-id-proof/zk-ownership-prove", | ||
| "world-id-authenticator/provekit", | ||
| "world-id-primitives/provekit", | ||
| ] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: provekit = [
"authenticator",
"world-id-authenticator/provekit",
]The explicit listing is fine as defensive redundancy (protects against dependency restructuring), but adds maintenance surface. Up to you whether to keep them — if you do, a brief comment like |
||
|
|
||
| issuer = [ | ||
| "dep:world-id-issuer", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,13 +20,16 @@ pub use oprf_query::{FullOprfOutput, OprfEntrypoint}; | |
| pub mod proof; | ||
| pub use proof::*; | ||
|
|
||
| #[cfg(feature = "provekit")] | ||
| use provekit_common::{InputMap, InputValue, NoirElement}; | ||
|
|
||
| #[cfg(feature = "provekit")] | ||
| use world_id_primitives::FieldElement; | ||
|
|
||
| #[cfg(any(feature = "zk-ownership-prove", feature = "zk-ownership-verify"))] | ||
| #[cfg(feature = "provekit")] | ||
| pub mod ownership_proof; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This widens the gate from This is fine and simpler. Just noting the subtle behavior change for awareness. The
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Observation: this gate broadened from |
||
|
|
||
| #[cfg(feature = "provekit")] | ||
| pub use provekit_common::{NoirProof, WhirR1CSProof}; | ||
|
|
||
| /// Error type for OPRF operations and proof generation. | ||
|
|
@@ -55,14 +58,17 @@ pub enum ProofError { | |
| InternalError(#[from] eyre::Report), | ||
| } | ||
|
|
||
| #[cfg(feature = "provekit")] | ||
| pub trait NoirCircuitInput { | ||
| fn into_witness(self) -> Result<InputMap, ProofError>; | ||
| } | ||
|
|
||
| #[cfg(feature = "provekit")] | ||
| pub trait NoirRepresentable { | ||
| fn into_noir_value(self) -> InputValue; | ||
| } | ||
|
|
||
| #[cfg(feature = "provekit")] | ||
| impl NoirRepresentable for FieldElement { | ||
| fn into_noir_value(self) -> InputValue { | ||
| InputValue::Field(NoirElement::from_repr(*self)) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same nit as in
core/Cargo.toml:"world-id-primitives/provekit"is already transitively activated throughworld-id-proof/zk-ownership-prove→provekit→world-id-primitives/provekit. Harmless, but removable for simplicity.