Get JWT
Authenticate using signed payload to get a JWT for usage in other endpoints
There are multiple valid headers required to be sent as part of this request.
For onboarding examples, refer to go, java and python code in code-samples.
StarkNet Message Hash and Signature
Inspired by EIP-712, (a standard for hashing and signing typed structured data) the encoding of an off-chain message is defined as:
signed_data = Enc[PREFIX_MESSAGE, domain_separator, account, hash_struct(message)]
where:
PREFIX_MESSAGE = "StarkNet Message"domain_separatoris defined as thehash_structof the StarkNetDomain struct:- Struct contains:
name,chainIdandversion chainIdis can be obtained callingGET /system/config
- Struct contains:
accountis the StarkNet account address- The message to be hashed is represented as a struct
hash_struct(message) = Enc[type_hash(MyStruct), Enc[param1], ..., Enc[paramN]]- where
type_hashis defined as in EIP-712 (but usingselectorinstead ofkeccak) - More details on StarkNet - Hash Functions
In case of more complex structure of object, you have to work in the spirit of EIP-712.
This json structure has 4 mandatory items: types, primaryType, domain and message.
These items are designed to be able to be an interface with a wallet.
At sign request, the wallet will display:
messagewill be displayed at the bottom of the wallet display, showing clearly (not in hex) the message to sign. Its structure has to be in accordance with the type listed in primaryType, defined in types.domainwill be shown above the message. Its structure has to be in accordance withStarkNetDomain.
The predefined types that you can use :
felt: for an integer on 251 bits.felt*: for an array of felt.string: for a shortString of 31 ASCII characters max.selector: for a name of a smart contract function.merkletree: for a Root of a Merkle tree, calculated with the provided data.
Specification details: Signing transactions and off-chain messages
Message Hash Sample Code
For a complete message_hash example, refer to python code in code-samples.
Examples:
Headers
Timestamp when signature expires (default 30 min | Max 1 week)