由于https://github.com/coinbase/gdax-node#the-authenticated-api-client
const key = 'your_api_key';
const b64secret = 'your_b64_secret';
const passphrase = 'your_passphrase';
const apiURI = 'https://api.gdax.com';
const sandboxURI = 'https://api-public.sandbox.gdax.com';
const authedClient = new Gdax.AuthenticatedClient(key, b64secret, passphrase, apiURI);什么是b64secret?我可以在哪里/如何获得它?它是gdax提供的字符串吗?我应该生成它吗?
我可以承认,我对密码学知之甚少。
感谢您的帮助或有用的链接。
发布于 2017-08-24 21:54:54
在签署任何请求之前,您必须通过
网站创建一个API密钥。…创建密钥后,您将拥有3条信息…:
钥匙
秘密
密钥和API将由GDAX随机生成并提供;密码将由您提供,以进一步保护您的访问。GDAX存储您的密码短语的加了盐的散列,用于验证…
密码是b64secret变量值。
发布于 2018-01-22 21:25:51
你的b64秘密就是你的秘密。不管它的价值是什么。
您可以使用gdax-java库(或已经编写并从gdax api文档引用的其他语言的任何变体)来完成此任务。
如果您打算编写自己的实现,可以使用以下方法对消息进行签名:
private String signMessage(String timestamp, String method, String path) throws NoSuchAlgorithmException, InvalidKeyException {
String prehash = timestamp + method + path;
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
byte[] secretDecoded = Base64.getDecoder().decode(secret);
SecretKeySpec secret_key = new SecretKeySpec(secretDecoded, "HmacSHA256");
sha256_HMAC.init(secret_key);
return Base64.getEncoder().encodeToString(sha256_HMAC.doFinal(prehash.getBytes()));
}请确保您的时间是正确的,因为请求是使用时间敏感的签名进行签名的。
https://stackoverflow.com/questions/45862777
复制相似问题