Skip to content

Conversation

@2PykeETH
Copy link

@2PykeETH 2PykeETH commented Oct 7, 2025

Summary

This PR extends the IIdentityManagerV2 interface with three new external view functions that enable on-chain access to user verification metadata, verification level, and user type.
These additions enhance contract interoperability and improve front-end and analytics integrations by exposing granular identity state data directly through the interface.


Changes Overview

🧩 Added External View Functions

1. getUserVerification(address user)

Description:
Returns the complete UserVerification struct for a given user, containing all relevant verification data.

Returns:

  • UserVerification struct including:
    • isVerified — Current verification status
    • level — VerificationLevel (e.g., NONE, DEVICE, ORB)
    • userType — UserType (e.g., STUDENT, INSTITUTION, VERIFIER, ADMIN)
    • verificationTimestamp — Timestamp of last verification
    • expirationTimestamp — Expiration time of current verification
    • nullifierHash — Hash identifier used for zero-knowledge validation
    • metadata — Optional metadata string for contextual information

Purpose:

  • Enables full inspection of user verification data by off-chain systems or other smart contracts.
  • Useful for identity dashboards, governance controls, and ZK verification audits.

2. getVerificationLevel(address user)

Description:
Returns the current VerificationLevel enum value for a specified user.

Returns:

  • VerificationLevel — Enum representing the verification tier (e.g., NONE, DEVICE, ORB).

Purpose:

  • Simplifies external calls where only the user’s verification depth is required.
  • Facilitates lightweight access for frontends, verifiers, and identity adapters.

3. getUserType(address user)

Description:
Returns the UserType enum value for the provided user address.

Returns:

  • UserType — Enum representing the user’s category (e.g., STUDENT, INSTITUTION, VERIFIER, ADMIN).

Purpose:

  • Enables efficient role-based checks for access control and permissions logic.
  • Streamlines integration with frontends and automated role assignment systems.

Motivation

These additions make IIdentityManagerV2 a more complete and developer-friendly identity interface by exposing key read-only utilities needed by external contracts, dApps, and off-chain systems.
The goal is to improve transparency, modularity, and accessibility of user verification data across the ecosystem.


Implementation Notes

  • All new functions are external view — ensuring no gas costs for read-only calls.
  • Fully Forge-formatted (forge fmt) for consistent code style.
  • Aligns with previously added verification lifecycle and batch processing functions.
  • Backward compatible with existing interface structure and logic.

Next Steps

  • Integrate these getters into the IdentityManagerV2 implementation contract.
  • Expand test coverage for each new getter function to ensure accurate state reflection.
  • Update front-end identity dashboards to leverage these new view endpoints for improved UX.

Result:
This PR enhances on-chain identity introspection capabilities by adding structured, efficient view functions to IIdentityManagerV2, making verification and user-type data more transparent and accessible across smart contracts and front-end applications.

@SynnekOG SynnekOG self-requested a review October 7, 2025 15:21
@SynnekOG SynnekOG added documentation Improvements or additions to documentation enhancement New feature or request labels Oct 7, 2025
@SynnekOG SynnekOG merged commit f8bda60 into CrediChain:main Oct 7, 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