eth-signature-verifier
Version:
Minimal Ethereum signature verifier supporting EIP-712, EIP-191, and eth_sign. No ethers.js or web3.js.
38 lines (37 loc) • 1.18 kB
TypeScript
import type { TypedDataDomain, TypedDataTypes } from './types.js';
/**
* Convert string to UTF-8 bytes (browser compatible)
*/
export declare const toUtf8Bytes: (str: string) => Uint8Array;
/**
* Convert hex string to bytes
*/
export declare const hexToBytes: (hex: string) => Uint8Array;
/**
* Convert bytes to hex string
*/
export declare const bytesToHex: (bytes: Uint8Array) => string;
/**
* Concatenate multiple Uint8Arrays
*/
export declare const concatBytes: (...arrays: Uint8Array[]) => Uint8Array;
/**
* Keccak256 hash function
*/
export declare const keccak256: (data: Uint8Array | string) => string;
/**
* Hash a personal message (for personal_sign/eth_sign)
*/
export declare const hashPersonalMessage: (message: string) => string;
/**
* Recover address from hash and signature
*/
export declare const recoverAddress: (hash: string, signature: string) => string;
/**
* Convert address to checksum format
*/
export declare const toChecksumAddress: (address: string) => string;
/**
* Hash typed data according to EIP-712
*/
export declare const hashTypedData: (domain: TypedDataDomain, types: TypedDataTypes, value: Record<string, any>) => string;