# The Web3 Auth Module

## Admin Guide

### Overview

The Web3 Auth module provides blockchain-based authentication for Kamailio with integrated ENS (Ethereum Name Service) support. This module replaces traditional password-based verification with Web3 smart contract calls while maintaining full SIP digest authentication compatibility.

The module maintains full compatibility with standard SIP digest authentication while using blockchain smart contracts to verify user credentials. It supports all standard auth functions including WWW-Authenticate, Proxy-Authenticate, and various authentication challenges.

Key features:

- Blockchain authentication via Oasis Sapphire smart contracts

- ENS domain support (alice.eth authentication)

- Multi-network support (ENS on Ethereum, auth on Oasis)

- RFC2617/7616 digest authentication compliance

- Environment variable configuration for containers

### ENS Technical Details

The module implements comprehensive ENS integration with the following technical features:

#### Namehash Calculation

Implements proper ENS namehash calculation according to EIP-137 for converting human-readable names like "alice.eth" into bytes32 hashes used by ENS contracts.

#### Address Resolution

Implements comprehensive ENS address resolution following EIP-137 standards:

- Direct ownership resolution via ENS Registry owner() function

- Dynamic Name Wrapper detection by calling name() on owner contract

- Resolver-based address resolution for wrapped domains (resolver() → addr())

- Fallback to registry owner for non-wrapped domains

- Zero address detection for unregistered domains

- Custom resolver support (respects domain owner's resolver configuration)

For wrapped ENS domains, the module uses the standard ENS resolver pattern instead of directly querying the Name Wrapper contract. This ensures consistent behavior with other ENS-enabled applications and respects the resolver configuration set by the domain owner.

#### Multi-Network Support

- ENS queries on Ethereum mainnet/testnet

- Authentication contracts on Oasis Sapphire (required)

- Automatic RPC endpoint selection

- Fallback to single-network mode when ens_rpc_url not configured

#### Smart Contract Requirements

To use this module, you must deploy and configure a smart contract on Oasis Sapphire:

- Deploy authentication contract on Oasis Sapphire network

- Implement required interface functions (see Functions section for details)

- Configure contract address in Kamailio parameters

### Dependencies

The following modules must be loaded before this module:

- none

External dependencies:

- libcurl - HTTP client library for blockchain RPC calls

- OpenSSL - cryptographic library for digest calculations