getEvmAddress
Derives the EIP-55 checksummed EVM address for a secp256k1 public key: keccak-256 over the uncompressed key’s coordinates, last 20 bytes, mixed-case checksum.
Import
Section titled “Import”import { getEvmAddress } from "@category-labs/mera";import { createSecp256k1SigningSession, getEvmAddress,} from "@category-labs/mera";
const session = createSecp256k1SigningSession({ privateKey: crypto.getRandomValues(new Uint8Array(32)),});
const address = getEvmAddress(session.publicKey);// EIP-55 checksummed, like "0x8ba1f109551bD432803012645Ac136ddd64DBA72"Parameters
Section titled “Parameters”publicKey
Section titled “publicKey”- Type:
Uint8Array - Required
A secp256k1 public key, compressed (33 bytes) or uncompressed (65 bytes). Normalized internally, so both forms give the same address.
Returns
Section titled “Returns”An EvmAddress: the EIP-55 mixed-case checksummed address as a 0x-prefixed string. EvmAddress is the structural type `0x${string}`.
Errors
Section titled “Errors”INPUT_INVALID:publicKeyis not valid secp256k1 (wrong length, wrong prefix, or not a point on the curve).