Axios 加密 POST 参数
Axios Encrypted POST parameters
我想使用来自 bitgrail 的 API(文档:https://bitgrail.com/api-documentation)。并要求结余金额。为此,您必须使用 HMAC-SHA512 和您的 API-Secret.
设置一个 SIGNATURE,其中包括加密的 post 参数
所以你必须发送这个数据:
Header:
KEY - Public API key
SIGNATURE - encrypted POST parameters with HMAC-SHA512 alghoritm using your secret API key
数据:
nonce - Integer number, always greater then nonce of previous call.
但每次我尝试发送请求时,我都会收到来自 Bitgrail 的 'Authentication failed'-Error。
参数设置如下:
params = {}
params.nonce = n();
然后像这样加密:
let hmac = crypto.createHmac('sha512', 'MYSECRET');
let digest = hmac.update(params.toString()).digest('hex');
let signature = new Buffer(digest).toString('base64');
可能 'params.toString()' 不工作。我必须将 params 变量设置为数组吗?
我自己用 const 算出来的 { URLSearchParams } = require('url');
并删除此行:let signature = new Buffer(digest).toString('base64');
并仅使用摘要作为签名。
我想使用来自 bitgrail 的 API(文档:https://bitgrail.com/api-documentation)。并要求结余金额。为此,您必须使用 HMAC-SHA512 和您的 API-Secret.
设置一个 SIGNATURE,其中包括加密的 post 参数所以你必须发送这个数据:
Header:
KEY - Public API key
SIGNATURE - encrypted POST parameters with HMAC-SHA512 alghoritm using your secret API key
数据:
nonce - Integer number, always greater then nonce of previous call.
但每次我尝试发送请求时,我都会收到来自 Bitgrail 的 'Authentication failed'-Error。
参数设置如下:
params = {}
params.nonce = n();
然后像这样加密:
let hmac = crypto.createHmac('sha512', 'MYSECRET');
let digest = hmac.update(params.toString()).digest('hex');
let signature = new Buffer(digest).toString('base64');
可能 'params.toString()' 不工作。我必须将 params 变量设置为数组吗?
我自己用 const 算出来的 { URLSearchParams } = require('url');
并删除此行:let signature = new Buffer(digest).toString('base64');
并仅使用摘要作为签名。