/// export declare type TypedData = string | EIP712TypedData | EIP712TypedData[]; interface EIP712TypedData { name: string; type: string; value: any; } export declare type Version = 'V1' | 'V2' | 'V3' | 'V4'; export interface EthEncryptedData { version: string; nonce: string; ephemPublicKey: string; ciphertext: string; } export declare type SignedMsgParams = Required>; export interface MsgParams { data: D; sig?: string; } interface MessageTypeProperty { name: string; type: string; } interface MessageTypes { EIP712Domain: MessageTypeProperty[]; [additionalProperties: string]: MessageTypeProperty[]; } export interface TypedMessage { types: T; primaryType: keyof T; domain: { name?: string; version?: string; chainId?: number; verifyingContract?: string; }; message: Record; } declare const TYPED_MESSAGE_SCHEMA: { type: string; properties: { types: { type: string; additionalProperties: { type: string; items: { type: string; properties: { name: { type: string; }; type: { type: string; }; }; required: string[]; }; }; }; primaryType: { type: string; }; domain: { type: string; }; message: { type: string; }; }; required: string[]; }; /** * A collection of utility functions used for signing typed data */ declare const TypedDataUtils: { /** * Encodes an object by encoding and concatenating each of its members * * @param {string} primaryType - Root type * @param {Object} data - Object to encode * @param {Object} types - Type definitions * @returns {Buffer} - Encoded representation of an object */ encodeData(primaryType: string, data: Record, types: Record, useV4?: boolean): Buffer; /** * Encodes the type of an object by encoding a comma delimited list of its members * * @param {string} primaryType - Root type to encode * @param {Object} types - Type definitions * @returns {string} - Encoded representation of the type of an object */ encodeType(primaryType: string, types: Record): string; /** * Finds all types within a type definition object * * @param {string} primaryType - Root type * @param {Object} types - Type definitions * @param {Array} results - current set of accumulated types * @returns {Array} - Set of all types found in the type definition */ findTypeDependencies(primaryType: string, types: Record, results?: string[]): string[]; /** * Hashes an object * * @param {string} primaryType - Root type * @param {Object} data - Object to hash * @param {Object} types - Type definitions * @returns {Buffer} - Hash of an object */ hashStruct(primaryType: string, data: Record, types: Record, useV4?: boolean): Buffer; /** * Hashes the type of an object * * @param {string} primaryType - Root type to hash * @param {Object} types - Type definitions * @returns {Buffer} - Hash of an object */ hashType(primaryType: string, types: Record): Buffer; /** * Removes properties from a message object that are not defined per EIP-712 * * @param {Object} data - typed message object * @returns {Object} - typed message object with only allowed fields */ sanitizeData(data: string | EIP712TypedData | EIP712TypedData[] | TypedMessage): TypedMessage; /** * Signs a typed message as per EIP-712 and returns its keccak hash * * @param {Object} typedData - Types message data to sign * @returns {Buffer} - keccak hash of the resulting signed message */ sign(typedData: string | EIP712TypedData[] | Partial | Partial>, useV4?: boolean): Buffer; }; declare function concatSig(v: Buffer, r: Buffer, s: Buffer): string; declare function normalize(input: number | string): string; declare function personalSign(privateKey: Buffer, msgParams: MsgParams>): string; declare function recoverPersonalSignature(msgParams: SignedMsgParams>): string; declare function extractPublicKey(msgParams: SignedMsgParams>): string; declare function externalTypedSignatureHash(typedData: EIP712TypedData[]): string; declare function signTypedDataLegacy(privateKey: Buffer, msgParams: MsgParams>): string; declare function recoverTypedSignatureLegacy(msgParams: SignedMsgParams>): string; declare function encrypt(receiverPublicKey: string, msgParams: MsgParams>, version: string): EthEncryptedData; declare function encryptSafely(receiverPublicKey: string, msgParams: MsgParams>, version: string): EthEncryptedData; declare function decrypt(encryptedData: EthEncryptedData, receiverPrivateKey: string): string; declare function decryptSafely(encryptedData: EthEncryptedData, receiverPrivateKey: string): string; declare function getEncryptionPublicKey(privateKey: string): string; /** * A generic entry point for all typed data methods to be passed, includes a version parameter. */ declare function signTypedMessage(privateKey: Buffer, msgParams: MsgParams>, version?: Version): string; declare function recoverTypedMessage(msgParams: SignedMsgParams>, version?: Version): string; declare function signTypedData(privateKey: Buffer, msgParams: MsgParams>): string; declare function signTypedData_v4(privateKey: Buffer, msgParams: MsgParams>): string; declare function recoverTypedSignature(msgParams: SignedMsgParams>): string; declare function recoverTypedSignature_v4(msgParams: SignedMsgParams>): string; export { TYPED_MESSAGE_SCHEMA, TypedDataUtils, concatSig, normalize, personalSign, recoverPersonalSignature, extractPublicKey, externalTypedSignatureHash as typedSignatureHash, signTypedDataLegacy, recoverTypedSignatureLegacy, encrypt, encryptSafely, decrypt, decryptSafely, getEncryptionPublicKey, signTypedMessage, recoverTypedMessage, signTypedData, signTypedData_v4, recoverTypedSignature, recoverTypedSignature_v4, };