Download the PHP package ironchoi/eip712-hash-sign without Composer
On this page you can find all versions of the php package ironchoi/eip712-hash-sign. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ironchoi/eip712-hash-sign
More information about ironchoi/eip712-hash-sign
Files in ironchoi/eip712-hash-sign
Package eip712-hash-sign
Short Description Generate Eip712 Hashes for signing
License MIT
Informations about the package eip712-hash-sign
eip-712
This is a library laravel / php to help generata an EIP712 Hash for signing and verifying EIP-712 based messages. It is fully written for php 8.0, and is currently only compatible with the latest specification of EIP-712 (eth_signTypedData_v4).
https://eips.ethereum.org/EIPS/eip-712
Note that this library currently does not handle the signing itself. For this, you can use something like kornrunner\Secp256k1. For some examples please see below.
Installation
Getting Started
First, define your typed data as a JSON string or PHP array, according to the JSON schema specified by EIP-712. For example:
Example
It allows arrays
You many need to recompose signature!!
Sometimes hex doesnt work. You may need to recompose signature
Encoder Functions
Here is a brief description of the functions available in the encoder. For more detailed examples, you can refer to src/tests.
Encoder::encode(SleepFinance\Eip712 $typedData)
This function will return the full EIP-191 encoded message to be signed hashed using Keccak256.
Encoder::getStructHash(SleepFinance\Eip712 $typedData, $type, $data)
This function returns a Keccak-256 hash for a single struct type (e.g. EIP712Domain, Person or Mail).
Encoder::encodeData(Eip712 $typedData, string $type, data)
This function returns the raw ABI encoded data for the struct type.
Encoder::getTypeHash(Eip712 $typedData, string $type)
This function returns the type hash for a struct type. This is the same as Keccak256(EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)), with support optional sub-types automatically included too.
Encoder::encodeType(Eip712 $typedData, string $type)
This function returns the type string before hashing it, e.g. EIP712Domain(string name,string version,uint256 chainId,address verifyingContract), with optional sub-types automatically included too.
Non-standard domains are currently not tested!
It's possible to use a custom domain format, like from the CIP-23 specification, if you want to use a custom implementation of EIP-712.
To do this, Intialize EIP172 with your custom domain; schema validation will be skipped!
Telegram
see you on the flipside!
All versions of eip712-hash-sign with dependencies
kornrunner/solidity Version ^0.2.0
illuminate/collections Version ^8.0|^9.0|^10.9|^11
illuminate/support Version ^8.0|^9.0|^10.9|^11
ironchoi/simple-web3-php Version ^0.1