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 { function getEvmAddress(publicKey: Uint8Array): EvmAddress
Derives the EIP-55 checksummed EVM address for a secp256k1 public key.
getEvmAddress } from "@category-labs/mera";import { function createSecp256k1SigningSession({ privateKey, }: CreateSigningSessionOptions): Secp256k1SigningSession
Creates a signing session from a secp256k1 private key.
createSecp256k1SigningSession, function getEvmAddress(publicKey: Uint8Array): EvmAddress
Derives the EIP-55 checksummed EVM address for a secp256k1 public key.
getEvmAddress,} from "@category-labs/mera";
const const session: Secp256k1SigningSession
session = function createSecp256k1SigningSession({ privateKey, }: CreateSigningSessionOptions): Secp256k1SigningSession
Creates a signing session from a secp256k1 private key.
createSecp256k1SigningSession({ privateKey: Uint8Array<ArrayBufferLike>
Curve private key. Must be exactly 32 bytes and, for secp256k1, a valid
scalar.
privateKey: var crypto: Crypto
crypto.Crypto.getRandomValues<Uint8Array<ArrayBuffer>>(array: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>
The Crypto.getRandomValues() method lets you get cryptographically strong random values.
getRandomValues(new var Uint8Array: Uint8ArrayConstructornew (length: number) => Uint8Array<ArrayBuffer> (+6 overloads)
Uint8Array(32)),});
const const address: `0x${string}`
address = function getEvmAddress(publicKey: Uint8Array): EvmAddress
Derives the EIP-55 checksummed EVM address for a secp256k1 public key.
getEvmAddress(const session: Secp256k1SigningSession
session.publicKey: Uint8Array<ArrayBuffer>
65-byte uncompressed secp256k1 public key for the 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”import type { type EvmAddress = `0x${string}`
A 20-byte EVM address as 0x-prefixed hex.
Structural type only: the 0x${string} shape does not constrain length or
hex digits.
EvmAddress } from "@category-labs/mera";
type type ReturnType = `0x${string}`
ReturnType = type EvmAddress = `0x${string}`
A 20-byte EVM address as 0x-prefixed hex.
Structural type only: the 0x${string} shape does not constrain length or
hex digits.
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).