All pages
Powered by GitBook
1 of 1

Loading...

Typed data hashing and signing

Common structure

The whole idea is heavily inspired by EIP-712. To get a signature needed to calculate hash(hash(domain), hash(aci), hash(data)).

hash function is blake2b.

domain is a record containing not required properties:

  • name as string,

  • version as integer,

  • networkId as string,

  • contractAddress

aci is part of a complete contract ACI. It defines a type of data to sign. For example, the ACI

corresponds to the data

domain and data are fate-encoded before hashing. aci is prepared for hashing according to .

Implementation

  • — calculates signature, supported in AccountMemory and in aepp-wallet connection;

  • — calculates the overall hash of typed data to sign;

  • — deterministic hashing of an arbitrary JS value, used to calculate hash(aci);

Examples

as ct-encoded string.
— use for debugging or to prepare the hash value for smart contract.
RFC8785
AccountBase:signTypedData
hashTypedData
hashJson
hashDomain
signing and verifying on aepp side
signing confirmation on wallet side
verifying a signature on contract side
{
  "record": [
    { "name": "foo", "type": "string" },
    { "name": "bar", "type": "int" }
  ]
}
{ "foo": "test", "bar": 42 }