.. _relay_http_endpoints: ==================== Relay HTTP Endpoints ==================== .. _enroll_key_card: Enroll KeyCard -------------- HTTP Path: ``/v$VERSION/enroll_key_card`` Used by the Client to tell the :term:`Relay` about a :term:`KeyCard` it wants to register. The body payload needs to contain the following information: .. code-block:: json { "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. .. code-block:: json { "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 :term:`Wallet` that has been registerd needs to be used. The :term:`Relay` will then ``ecrecover`` the **WA** from the signature, and check if the User has sufficient access to the :term:`Store`. WebSocket Connection -------------------- HTTP Path: ``/v$VERSION/sessions`` For WebSocket exchange of Protobuf messages, defined in :ref:`ref_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 :ref:`ref_market.mass.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. .. code-block:: json { "ipfs_path": "/ipfs/abcdef...", "url": "https://some.gateway/ipfs/abcdef...." }