A collection of utility functions used for signing typed data.
Hash a typed message according to EIP-712. The returned message starts with the EIP-712 prefix, which is "1901", followed by the hash of the domain separator, then the data (if any). The result is hashed again and returned.
This function does not sign the message. The resulting hash must still be signed to create an EIP-712 signature.
The typed message to hash.
The EIP-712 version the encoding should comply with.
The hash of the typed message.
Encodes an object by encoding and concatenating each of its members.
The root type.
The object to encode.
Type definitions for all types included in the message.
The EIP-712 version the encoding should comply with.
An encoded representation of an object.
Encodes the type of an object by encoding a comma delimited list of its members.
The root type to encode.
Type definitions for all types included in the message.
An encoded representation of the primary type.
Finds all types within a type definition object.
The root type.
Type definitions for all types included in the message.
The current set of accumulated types.
The set of all types found in the type definition.
Hashes an object.
The root type.
The object to hash.
Type definitions for all types included in the message.
The EIP-712 version the encoding should comply with.
The hash of the object.
Hashes the type of an object.
The root type to hash.
Type definitions for all types included in the message.
The hash of the object type.
Removes properties from a message object that are not defined per EIP-712.
The typed message object.
The typed message object with only allowed fields.
Concatenate an extended ECDSA signature into a single '0x'-prefixed hex string.
The 'v' portion of the signature.
The 'r' portion of the signature.
The 's' portion of the signature.
The concatenated ECDSA signature as a '0x'-prefixed string.
Decrypt a message.
The decryption options.
The encrypted data.
The private key to decrypt with.
The decrypted message.
Decrypt a message that has been encrypted using encryptSafely.
The decryption options.
The encrypted data.
The private key to decrypt with.
The decrypted message.
Encrypt a message.
The encryption options.
The message data.
The public key of the message recipient.
The type of encryption to use.
The encrypted data.
Encrypt a message in a way that obscures the message length.
The message is padded to a multiple of 2048 before being encrypted so that the length of the resulting encrypted message can't be used to guess the exact length of the original message.
The encryption options.
The message data.
The public key of the message recipient.
The type of encryption to use.
The encrypted data.
Recover the public key of the account used to create the given Ethereum signature. The message
must have been signed using the personalSign function, or an equivalent function.
The public key recovery options.
The hex data that was signed.
The '0x'-prefixed hex encoded message signature.
The '0x'-prefixed hex encoded public key of the message signer.
Get the encryption public key for the given key.
The private key to generate the encryption public key with.
The encryption public key.
Normalize the input to a lower-cased '0x'-prefixed hex string.
The value to normalize.
The normalized value.
Create an Ethereum-specific signature for a message.
This function is equivalent to the eth_sign Ethereum JSON-RPC method as specified in EIP-1417,
as well as the MetaMask's personal_sign method.
The personal sign options.
The hex data to sign.
The key to sign with.
The '0x'-prefixed hex encoded signature.
Recover the address of the account used to create the given Ethereum signature. The message
must have been signed using the personalSign function, or an equivalent function.
The signature recovery options.
The hex data that was signed.
The '0x'-prefixed hex encoded message signature.
The '0x'-prefixed hex encoded address of the message signer.
Recover the address of the account that created the given EIP-712 signature. The version provided must match the version used to create the signature.
The signature recovery options.
The typed data that was signed.
The '0x-prefixed hex encoded message signature.
The signing version to use.
The '0x'-prefixed hex address of the signer.
Sign typed data according to EIP-712. The signing differs based upon the version.
V1 is based upon an early version of EIP-712 that lacked some later security improvements, and should generally be neglected in favor of later versions.
V3 is based on EIP-712, except that arrays and recursive data structures are not supported.
V4 is based on EIP-712, and includes full support of arrays and recursive data structures.
The signing options.
The typed data to sign.
The private key to sign with.
The signing version to use.
The '0x'-prefixed hex encoded signature.
Generate the "V1" hash for the provided typed message.
The hash will be generated in accordance with an earlier version of the EIP-712
specification. This hash is used in signTypedData_v1.
The typed message.
The '0x'-prefixed hex encoded hash representing the type of the provided message.
This is the message format used for
V1ofsignTypedData.