0
現在、CEX.IOビット交換交換のウェブソケットに接続しようとしています。 Websocketの接続は正常ですが、認証時にエラー:Timestamp is not in 20sec range
があります。私はこのエラーが何か分からない。Golang Gorilla CEX.IO Websocket認証エラー
テストケース1 & 2 for createSignatureはOK(https://cex.io/websocket-api#authentication)です。
認証囲碁コード:
func toHmac256(message string, secret string) string {
key := []byte(secret)
h := hmac.New(sha256.New, key)
h.Write([]byte(message))
return strings.ToUpper(hex.EncodeToString(h.Sum(nil)))
}
func Signature() (string, string) {
nonce := time.Now().Unix() // Edit with Cerise Limón answer
message := strconv.FormatInt(nonce, 10) + "API-KEY"
signature := api.toHmac256(message, "SECRET-KEY")
return signature, nonce
}
'time.Now()。Unix() 'と同じエラーが発生しました。 – LeMoussel
システム時刻が正しいことを確認してください。 –
UNIXの時刻は1970年1月1日(UTC)からの秒数です。あなたのシステムの時計が正しい時刻から20秒以内にセットされていることを確認するようにお願いしています。 –