Signature Operation
For example:
The signature may be different if the request text is different, therefore the request should be normalized before signing. The following signature steps will take the order query on the above side as an example.
Signature Method:
1. The request Method (GET or POST, WebSocket use GET), append line break "\n"
2. The host with lower case, append line break "\n"
3. The path(WebSocket is fixed to /users/self/verify), append line break "\n". (Take the path from /api, such as /bsc/api/v1/order/orders, which is actually /api/v1/order/orders)
4. Timestamp, append line break "\n"
5. API Access Key, append line break "\n" if parameters are not empty.
Notice, "data" in Post method is not parameter.
6. The parameters are URL encoded, and ordered based on ASCII(Use UTF-8 encoding and URL encoded, the hex must be upper case. For example, The semicolon ':' should be encoded as '%3A', The space should be encoded as '%20'). For example below is the original parameters:
Then above parameter should be ordered like below:
Use char "&" to concatenate all parameters.
7. Assemble the pre-signed text:
8. Calculate the signature and pass the following two parameters into the encrypted hash function(HmacSHA256):
pre-signed text
your Secret Key
Encode the hash code with base-64 to generate the signature
9. Put the signature into request header 'ABOARD-SIGNATURE'.
Last updated