Relay HTTP Endpoints¶
Enroll KeyCard¶
HTTP Path: /v$VERSION/enroll_key_card
Used by the Client to tell the Relay about a KeyCard it wants to register.
The body payload needs to contain the following information:
{
"store_token_id": "base64(store_token_id.to_bytes(32))",
"key_card": "base64(keyCardPK.public_key.to_bytes())",
"signature": "base64(signature)"
}
For the signature we use EIP-712, as with our other signatures. The typed data defition looks as follows.
{
"types": {
"EIP712Domain": [
{"name": "name", "type": "string"},
{"name": "version", "type": "string"},
{"name": "chainId", "type": "uint256"},
{"name": "verifyingContract", "type": "address"},
],
"Enrollment": [ {"name": "keyCard", "type": "string"} ],
},
"primaryType": "Enrollment",
"domain": {
"name": "MassMarket",
"version": "1",
"chainId": "$chain_id",
"verifyingContract": "$storeRegAddress",
},
"message": {
"keyCard": "keyCardPK.public_key.to_hex()[2:]",
}
}
To create this signature, the Wallet that has been registerd needs to be used. The Relay will then ecrecover
the WA from the signature, and check if the User has sufficient access to the Store.
WebSocket Connection¶
HTTP Path: /v$VERSION/sessions
For WebSocket exchange of Protobuf messages, defined in schema.proto.
Blob Uploads¶
HTTP Path: /v$VERSION/blob-upload?token=abc
Can be used by the client to upload image attachments. The full URL, with the token, can be retreived with the GetBlobUploadURLRequest protobuf message.
The body must be multipart/form-data.
The response will be a JSON object to tell the client where the content is available. For now IPFS might be used.
{
"ipfs_path": "/ipfs/abcdef...",
"url": "https://some.gateway/ipfs/abcdef...."
}