HandleLib
Canonical handle validation and escrow key derivation.
Library used by the launchpad and fee vault for social handle checks and escrow key derivation.
Handles must arrive already normalized (lowercase). The library validates, it does not transform.
Platforms
| Constant | Value |
|---|---|
PLATFORM_X | 1 |
PLATFORM_GITHUB | 2 |
KIND_WALLET | 3 |
validate
function validate(uint8 platform, string memory handle) internal pure;X: length 1 to 15, charset [a-z0-9_].
GitHub: length 1 to 39, charset [a-z0-9-], no leading or trailing hyphen, and no two hyphens in a row.
Anything else → InvalidPlatform or InvalidHandle.
hashHandle
function hashHandle(string memory handle) internal pure returns (bytes32);keccak256(bytes(handle)).
deriveIdentityKey
function deriveIdentityKey(uint8 platform, bytes32 handleHash)
internal pure returns (bytes32);keccak256(abi.encodePacked(platform, handleHash)).
deriveWalletKey
function deriveWalletKey(address wallet) internal pure returns (bytes32);keccak256(abi.encodePacked(uint8(3), bytes32(uint256(uint160(wallet))))).
Kind byte 3 keeps wallet keys disjoint from social keys. Wallet beneficiaries claim with claimWallet(wallet) and no attestation.