bithumb-pro / bithumb.pro-official-api-docs

rest and websocket api doc
22 stars 26 forks source link

Signature fail websocket #26

Open SerhiiKashuk opened 4 years ago

SerhiiKashuk commented 4 years ago

Failed signature, when I send cmd authKey

godlikers commented 4 years ago

if you use java, this is a simple demo for websocket(https://github.com/bithumb-pro/java-api-client/blob/master/src/main/java/cn/bithumb/pro/api/service/BithumbProProApiWebSocketClientImpl.java)

SerhiiKashuk commented 4 years ago

ok.(https://github.com/bithumb-pro/java-api-client/blob/master/src/main/java/cn/bithumb/pro/api/security/HmacSHA256Signer.java) What map should I set to the method 'sign' in this class? Could you get example?

SerhiiKashuk commented 4 years ago

ok.(https://github.com/bithumb-pro/java-api-client/blob/master/src/main/java/cn/bithumb/pro/api/security/HmacSHA256Signer.java) What map should I set to the method 'sign' in this class? Could you get example?I need you help!

godlikers commented 4 years ago

sorted map

SerhiiKashuk commented 4 years ago

Could you give me example?

godlikers commented 4 years ago

if use java, just use TreeMap (sorted by key in dict)

SerhiiKashuk commented 4 years ago

Map<String, Object> params = new TreeMap<>(); params.put("request","/message/realtime"); params.put("timestamp",System.currentTimeMillis()); params.put("apiKey", "4b6**cb0d0f2e69");

It's my solution. Right?

godlikers commented 4 years ago

i am so sorry about that, i miss your message. for websocket signature, like:( request path="/message/realtime" signatureString=request path + current timestamp(millisecond) + apiKey apiSignature = sha256_HMAC(signatureString,secretKey)) and the authKey cmd like {"cmd":"authKey","args":["apiKey","timestamp"(millisecond,type is string),"apiSignature"]}