During various VC and VP use scenarios, users need to sign specific data to assert their identity or display their authorization. These scenarios include:
Consequently, a reliable, stable, and user-friendly signature system is necessary. In response to this need, we have implemented the EIP-712 Proposal.
Our implementation adheres to EIP-712, structuring the data to be encoded and signed as follows:
encode(domainSeparator, message : 𝕊) = "**\\x19\\x01" ‖ domainSeparator** ‖ hashStruct(message)
The 'version specific data' is the 32-byte domain separator
domainSeparator
The 'data to sign' is the 32-byte
hashStruct(message)
.
domainSeparator
-- is a fixed structure that can be regarded as a 32-bit fixed string. It is calculated as follows:domainSeparator = hashStruct(eip712Domain)
eip712Domain
can include one or more of the following fields:
string name
string version
uint256 chainId
address verifyingContract
bytes32 salt
hashStruct(s : 𝕊) = keccak256(typeHash ‖ encodeData(s))
typeHash = keccak256(encodeType(typeOf(s)))
𝕊
can contain: bytes1
to bytes32
, uint8
to uint256
, int8
to int256
, bool
and address
,bytes
and string
𝕊
struct Credential {
bytes32 digesthash;
}