Authentication
The authentication message flow is initiated by the gateway.
The gateway will send a greeting message followed by a challenge request.
The client must then issue an authentication request, which the gateway will respond to with an authentication response
For the purpose of this example, assume the API key is db-89s9vCvwDDKPdQJ5Pb30Fyj9mNUM6.
When connecting to the gateway, the gateway will send two messages:
lsg_version=0.2.0\n
cram=j5pwMHz6vwXruJM4cOwQrQeQE0bImIzT\n
To generate the response, the client first concatenates the cram value and their API key in the format $cram|$key.
In this example, this would be j5pwMHz6vwXruJM4cOwQrQeQE0bImIzT|db-89s9vCvwDDKPdQJ5Pb30Fyj9mNUM6.
The concatenated string is then hashed with SHA-256.
In this example, it produces 6d3c875bb9f8cf503c3ed83ee5f476a3ad53f0c67706c51cf42d2db5ad8ff5a9.
This result is then concatenated with the last five bytes of the API key (also referred to as the bucket_id) in the format $auth-$bucket_id.
With this, the authentication response string is generated as 6d3c875bb9f8cf503c3ed83ee5f476a3ad53f0c67706c51cf42d2db5ad8ff5a9-mNUM6.
The client then sends the authentication message containing this string to the gateway:
auth=6d3c875bb9f8cf503c3ed83ee5f476a3ad53f0c67706c51cf42d2db5ad8ff5a9-mNUM6|dataset=GLBX.MDP3|encoding=dbn|ts_out=0\n
If the key is valid, the gateway will reply with a successful response:
success=1|session_id=135567\n