diff --git a/src/constants/strings.ts b/src/constants/strings.ts index 6c63540d..20f4eae1 100644 --- a/src/constants/strings.ts +++ b/src/constants/strings.ts @@ -17,13 +17,4 @@ export const quaisymbol: string = '\u039e'; // "\uD835\uDF63"; * * @category Constants */ -export const MessagePrefix: string = '\x19Quai Signed Message:\n'; - -/** - * A constant for the [EIP-191](https://eips.ethereum.org/EIPS/eip-191) personal message prefix. - * - * (**i.e.** `"\\x19Ethereum Signed Message:\\n"`) - * - * @category Constants - */ -export const EthMessagePrefix: string = '\x19Ethereum Signed Message:\n'; +export const MessagePrefix: string = '\x19Ethereum Signed Message:\n'; diff --git a/src/hash/index.ts b/src/hash/index.ts index 13eecb1b..115f1c88 100644 --- a/src/hash/index.ts +++ b/src/hash/index.ts @@ -3,7 +3,7 @@ */ export { id } from './id.js'; -export { hashMessage, verifyMessage, ethHashMessage, ethVerifyMessage } from './message.js'; +export { hashMessage, verifyMessage } from './message.js'; export { solidityPacked, solidityPackedKeccak256, solidityPackedSha256 } from './solidity.js'; export { TypedDataEncoder, verifyTypedData } from './typed-data.js'; diff --git a/src/hash/message.ts b/src/hash/message.ts index 5c80215a..2a11d8e9 100644 --- a/src/hash/message.ts +++ b/src/hash/message.ts @@ -5,7 +5,7 @@ import { concat } from '../utils/index.js'; import { toUtf8Bytes } from '../encoding/index.js'; import type { SignatureLike } from '../crypto/index.js'; -import { EthMessagePrefix } from '../constants/strings.js'; + /** * Computes the Quai Network equivalent of the [EIP-191](https://eips.ethereum.org/EIPS/eip-191) personal-sign message * digest to sign. @@ -55,42 +55,3 @@ export function verifyMessage(message: Uint8Array | string, sig: SignatureLike): const digest = hashMessage(message); return recoverAddress(digest, sig); } - -/** - * Computes the [EIP-191](https://eips.ethereum.org/EIPS/eip-191) personal-sign message digest to sign. - * - * This prefixes the message with {@link EthMessagePrefix | **EthMessagePrefix**} and the decimal length of `message` and - * computes the {@link keccak256 | **keccak256**} digest. - * - * If `message` is a string, it is converted to its UTF-8 bytes first. To compute the digest of a - * [**DataHexString**](../types-aliases/DataHex), it must be converted to [**bytes**](../functions/getBytes). - * - * This is the same as `hashMessage` except it uses `EthMessagePrefix` instead of `MessagePrefix` and is available for - * broader compatibility with EVM signing practices. - * - * @category Hash - * @param message - * @returns - */ -export function ethHashMessage(message: Uint8Array | string): string { - if (typeof message === 'string') { - message = toUtf8Bytes(message); - } - return keccak256(concat([toUtf8Bytes(EthMessagePrefix), toUtf8Bytes(String(message.length)), message])); -} - -/** - * Return the address of the private key that produced the signature `sig` during signing for `message`. - * - * This is the same as `verifyMessage` except it uses `EthMessagePrefix` instead of `MessagePrefix` and is available for - * broader compatibility with EVM signing practices. - * - * @category Hash - * @param message - The message that was signed. - * @param sig - The signature to verify. - * @returns {string} The address of the signer. - */ -export function ethVerifyMessage(message: Uint8Array | string, sig: SignatureLike): string { - const digest = ethHashMessage(message); - return recoverAddress(digest, sig); -} diff --git a/src/quais.ts b/src/quais.ts index 25f57520..a0b79fc7 100644 --- a/src/quais.ts +++ b/src/quais.ts @@ -92,8 +92,6 @@ export { id, hashMessage, verifyMessage, - ethHashMessage, - ethVerifyMessage, solidityPacked, solidityPackedKeccak256, solidityPackedSha256,