refactor: credential check as ProofRequest method#411
Conversation
887653b to
a95f92b
Compare
a95f92b to
f5ae23c
Compare
| /// - [`CredentialConstraintsCheckError::Storage`] if the credential store query fails. | ||
| /// - [`CredentialConstraintsCheckError::ConstraintTooDeep`] if the constraint tree exceeds depth 2. | ||
| /// - [`CredentialConstraintsCheckError::ConstraintTooLarge`] if the constraint tree exceeds the node limit. | ||
| pub fn check_credentials( |
There was a problem hiding this comment.
I think this is implementing duplicate logic from https://github.com/worldcoin/world-id-protocol/blob/ada9887a40255ce7e8576cbca4e0442c049d887d/crates/primitives/src/request/mod.rs#L374. is this performing any additional action from just exposing that method to foreign code?
There was a problem hiding this comment.
I will reuse this method for constraints evaluation, thanks for sharing.
however, check_credentials applies time constraints per item and returns per-item diagnostics for UI before triggering ZK proof generation.
there are two options (or more, idk) here:
— keep in walletkit: time checks stay here, can't reuse protocol's since they're buried in circuit input validation.
— add to protocol primitives: expose time checks as a reusable method, walletkit just maps storage records → protocol types.
- move check_credentials_against_proof_request into ProofRequest::check_credentials under requests/credential_check.rs - replace manual constraint depth/node checks with validate_constraints() - drop tests that duplicate world-id-primitives coverage
f5ae23c to
43314c8
Compare

Summary
check_credentials_against_proof_requestfree function intoProofRequest::check_credentialsmethod (addresses Paolo's review on add credential pre-flight check against proof requests #404)requests.rs→requests/mod.rswithcredential_checksubmoduleself.0.validate_constraints()?now that world-id-core 0.11.x is available (resolves Dzejkop's TODO)From<ValidationError>forCredentialConstraintsCheckErrorworld-id-primitivescoverage; retains 6 walletkit-specific testsTest plan
cargo test -p walletkit-core requests::credential_checkcargo check --all-features