Skip to main content
All contracts are deployed on Base Sepolia (chain ID 84532). Solidity version: ^0.8.28.

Deployment addresses

ABIs are exported from @hyperauth/contracts:

DIDRegistry

Anchors off-chain DIDs to on-chain accounts. Compatible with W3C DID Core v1.0. Inherits Ownable.

DidDocument struct

State variables

Functions

register

Registers a new DID with a human-readable alias. msg.sender is set as the controller. Reverts if the DID is already registered, the controller already has a DID, aliasHash is zero, or the alias is already claimed. Emits: DIDRegistered, AliasRegistered.

update

Updates the metadata IPFS CID. Only callable by the DID’s controller. Reverts if msg.sender is not the controller, or if the DID is deactivated. Emits: DIDUpdated.

deactivate

Deactivates a DID and cleans up alias mappings. Only callable by the controller. Sets active = false. Removes controllerToDid, aliases, and didToAlias entries. Emits: DIDDeactivated.

resolve

Returns the DidDocument for the given DID hash.

resolveAlias

Resolves an alias hash to its DID document. Returns a zero-initialized DidDocument if the alias is not registered. Used by the frontend to check alias availability.

Events


HyperAuthAccount

ERC-4337 smart account. Inherits BaseAccount from @account-abstraction/contracts. Uses P-256 (secp256r1) signature verification via the LibP256 library.

State variables

Constructor

Sets the immutable entry point and public key coordinates.

Functions

getOwner

Returns the P-256 public key coordinates that own this account.

_validateSignature

Validates an ERC-4337 UserOperation signature. Overrides BaseAccount._validateSignature. Expects userOp.signature to be exactly 64 bytes: ABI-encoded (uint256 r, uint256 s). Verifies using LibP256.verifySignature against the stored public key. Returns 0 (success) or SIG_VALIDATION_FAILED.

entryPoint

Returns IEntryPoint(ENTRY_POINT). Overrides BaseAccount.entryPoint.

receive

Accepts ETH deposits.

HyperAuthFactory

Deploys HyperAuthAccount contracts deterministically via CREATE2. The predicted address depends on the P-256 public key coordinates and an optional salt.

State variables

Constructor

Deploys a template HyperAuthAccount(entryPoint_, 0, 0) and stores it as ACCOUNT_IMPLEMENTATION.

Functions

createAccount

Deploys a HyperAuthAccount via CREATE2. If the account already exists at the predicted address, returns the existing address without deploying. The CREATE2 salt is keccak256(abi.encodePacked(pubKeyX, pubKeyY, salt)). Reverts with "Create2 failed" if deployment fails. Emits: AccountCreated.

getAddress

Pre-computes the account address without deploying. Used by the frontend to derive the smart account address before the UserOperation is submitted.

Events


AccountHelper

Stateless lens contract. Aggregates HyperAuthAccount and DIDRegistry state into a single eth_call. Deploy once, never upgrade.

State variables

AccountState struct

Functions

getAccountState

Fetches complete account state in one call. Returns early with zero-valued fields (except isActive = false) if the account has no deployed code. Steps performed:
  1. Checks account.code.length > 0 to set isActive.
  2. Calls HyperAuthAccount.getNonce() for the nonce.
  3. Calls HyperAuthAccount.getOwner() for the public key coordinates.
  4. Calls DIDRegistry.controllerToDid(account) for the DID hash.

SessionSBT

ERC-721 Soulbound Token for session management. Name: "HyperAuth Session", symbol: "HYS". Inherits ERC721, Ownable.

State variables

Functions

mintSession

Mints a new session token to the given address. Only callable by the contract owner (the authorized HyperAuth bundler or factory). Returns the token ID of the minted token.

revokeSession

Marks a session token as revoked. Only callable by the contract owner. Does not burn the token; sets isRevoked[tokenId] = true.

isRevoked (mapping)

Returns true for a given token ID if that session has been revoked.

Soulbound behavior

Overrides ERC721._update. Allows minting (from == address(0)) and burning (to == address(0)), but reverts with "SessionSBT: Token is Soulbound" for any transfer between non-zero addresses.

LibP256

Library for P-256 (secp256r1) signature verification. Used internally by HyperAuthAccount._validateSignature. Not deployed standalone.
Verifies a P-256 ECDSA signature. Uses Base’s RIP-7212 P-256 precompile where available.