Skip to content

Conversation

malgus01
Copy link
Contributor

Pull Request

Summary

This PR introduces the verifyAndExecute external function in IdentityManagerV2, enabling user verification via World ID proofs with proper validation, expiration handling, and event emission.

Changes

  • Added
    • /// VERIFICATION FUNCTIONS section header for clarity.
    • verifyAndExecute external function:
      • Validates nullifiers, prevents duplicate verification, and checks expiration.
      • Calls worldId.verifyProof to ensure proof authenticity.
      • Records nullifier usage.
      • Determines verification level (ORB vs. DEVICE) based on groupId.
      • Stores verification data via _storeVerification.
      • Emits UserVerified event.
  • Modified
    • Refactored constructor formatting for readability.
  • Formatting
    • Applied forge fmt for consistent style.

Motivation

  • Provides a secure, external entry point for verifying users against World ID.
  • Ensures strong protection against:
    • Duplicate verifications (nullifier reuse).
    • Invalid or expired verification attempts.
  • Establishes event-based transparency for off-chain indexing.

Next Steps

  • Add unit tests for verifyAndExecute covering:
    • Successful verification (ORB and DEVICE).
    • Duplicate nullifier rejection.
    • Expired timestamp reverts.
    • Already verified user reverts.
  • Integrate with frontend flows for onboarding verified users.

@0xRiz0 0xRiz0 self-requested a review September 16, 2025 16:11
@0xRiz0 0xRiz0 added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 16, 2025
@0xRiz0 0xRiz0 merged commit 6c76521 into CrediChain:main Sep 16, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants