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.
We are using ERC-4361: Sign-In with Ethereum to authenticate the KeyCard.
We are adding the following fields to the resources
field of the message
:
mass-relay:$relayID
mass-shop:$shopID
mass-keycard:$keycardPublicKey
SIWE gives us the encoding of the message
as a string but we still need to create a signature
, using EIP-191. The JSON payload for the HTTP request is thus:
{
"message": /* ERC-4361 message string */,
"signature": base64(signature)
}
To create this signature, the Wallet that has been registered with the Shop Registry needs to be used. The Relay will then ecrecover
the WA from the signature, and check if the User has sufficient access to the Shop.
For reference, the code our frontend uses can be found here: https://github.com/masslbs/Tennessine/blob/f3d423841ec7a4a1e6109670a788eb1591d45122/packages/client/mod.ts#L614-L626
WebSocket Connection¶
HTTP Path: /v$VERSION/sessions
For exchange of Protobuf messages via WebSocket. See Transport Overview for message definitions.
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 retrieved 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...."
}