Indexer.sol

Overview

Indexer.sol defines the NameIndex smart contract, which functions as a name-to-wallet address indexer with multifactor ownership verification. It manages mappings between a human-readable name and a wallet address, enforces ownership through a multi-step cryptographic proof process, and interacts with Mirror contracts to validate ownership. The contract includes mechanisms to ensure sufficient contract balance, owner verification via cryptographic proofs, and allows controlled updates to the associated wallet address.

This contract is designed to operate under strict validation rules, ensuring that only authorized entities can update or confirm ownership. It leverages external libraries and imported contracts such as VerifiersLib, Mirror, and Modifiers for security, validation, and permission management.


Contract: NameIndex

State Variables

Variable

Type

Description

version

string

Constant contract version identifier "1.0.0".

_name

string

Static string representing the indexed name, set during contract deployment.

_wallet

address

Address of the wallet associated with the indexed name.

_root

address

Address of the root contract or owner with special privileges.

_rootPubkey

uint256

Public key of the root owner for authorization checks.


Constructor

constructor (
    address wallet,
    uint256 rootPubkey,
    uint128 index,
    address root
) accept

Private Functions

ensureBalance

function ensureBalance() private pure

Public Functions

isOwner

function isOwner(
    address wallet,
    string zkid,
    bytes proof,
    uint256 epk,
    bytes epk_sig,
    uint64 epk_expire_at,
    bytes jwk_modulus,
    bytes kid,
    uint64 jwk_modulus_expire_at,
    uint8 index_mod_4,
    string iss_base_64,
    string provider,
    string header_base_64,
    uint256 pub_recovery_key,
    bytes pub_recovery_key_sig,
    uint256 jwk_update_key,
    bytes jwk_update_key_sig,
    mapping(uint256 => bytes) root_provider_certificates,
    uint256 owner_pubkey,
    uint128 index
) public view accept

isOwnerRoot

function isOwnerRoot(
    address wallet,
    string zkid,
    bytes proof,
    uint256 epk,
    bytes epk_sig,
    uint64 epk_expire_at,
    bytes jwk_modulus,
    bytes kid,
    uint64 jwk_modulus_expire_at,
    uint8 index_mod_4,
    string iss_base_64,
    string provider,
    string header_base_64,
    uint256 pub_recovery_key,
    bytes pub_recovery_key_sig,
    uint256 jwk_update_key,
    bytes jwk_update_key_sig,
    mapping(uint256 => bytes) root_provider_certificates,
    uint256 owner_pubkey,
    address mirror
) public onlyOwnerPubkey(_rootPubkey) accept

setNewWallet

function setNewWallet(address wallet) public senderIs(_wallet) accept

destroyNode

function destroyNode() public senderIs(address(this)) accept

getDetails

function getDetails() external view returns(string name, address wallet)

getVersion

function getVersion() external pure returns(string, string)

Implementation Details


Interaction with Other Contracts and Libraries


Diagram: NameIndex Contract Structure

classDiagram
class NameIndex {
-string version
-string _name
-address _wallet
-address _root
-uint256 _rootPubkey
+constructor(wallet, rootPubkey, index, root)
-ensureBalance()
+isOwner(wallet, zkid, proof, epk, epk_sig, epk_expire_at, jwk_modulus, kid, jwk_modulus_expire_at, index_mod_4, iss_base_64, provider, header_base_64, pub_recovery_key, pub_recovery_key_sig, jwk_update_key, jwk_update_key_sig, root_provider_certificates, owner_pubkey, index)
+isOwnerRoot(wallet, zkid, proof, epk, epk_sig, epk_expire_at, jwk_modulus, kid, jwk_modulus_expire_at, index_mod_4, iss_base_64, provider, header_base_64, pub_recovery_key, pub_recovery_key_sig, jwk_update_key, jwk_update_key_sig, root_provider_certificates, owner_pubkey, mirror)
+setNewWallet(wallet)
+destroyNode()
+getDetails() string,string
+getVersion() string,string
}
NameIndex ..|> Modifiers
NameIndex o-- Mirror : calls
NameIndex ..> VerifiersLib : uses

References