CoinCorners API requires authentication, by providing 3 parameters API Key, Signature and Nonce. You can generate your API keys from your account section by visiting the 'API Keys' page.
This is simply found in your account area.
The signature is a HMAC-SHA256 encoded message which contains your nonce, user id and API key, which is generated using a secret key that can be found also on the 'API Keys' page in your account.'
A nonce is an integer that must be increasing with every request. We suggest using a timestamp.
A pseudo code example:
message = nonce + userid + apikey
signature = CreateSignature(message, apisecret)
It is important to remember that your API Key & Secret must be lowercase.
public static string GetHash(string nonce)
{
string PublicKey = "PublicKey".ToLower();
string UserId = "UserId";
string text = nonce + UserId + PublicKey;
string Key = "SecretKey".ToLower();
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] textBytes = encoding.GetBytes(text.ToLower());
byte[] keyBytes = encoding.GetBytes(key.ToLower()), hashBytes = null;
using (HMACSHA256 hash = new HMACSHA256(keyBytes))
{
hashBytes = hash.ComputeHash(textBytes);
}
return BitConverter.ToString(hashBytes).Replace("-", "").ToLower();
}
<?php
public function Generate_Sig($nonce)
{
$api_secret = strtolower("API Secret Key");
$account_id = "Your UserId";
$api_public = strtolower("API Public Key");
return strtolower(hash_hmac('sha256', $nonce . $account_id . $api_public, $api_secret));
}
?>
require 'date'
require 'httparty'
def GenerateSig
$APIKey = 'Your CoinCorner APIKey'
$APISecret = 'Your CoinCorner APISecret'
$UserId = 'Your CoinCorner UserId'
$nonce = DateTime.now.strftime('%Q')
sig = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), $APISecret, $nonce + $UserId + $APIKey)
end
import hmac
import hashlib
import time
def GenerateSig(nonce):
API_KEY = "Your CoinCorner API Key"
UserId = "Your CoinCorner UserId"
secret_key = "Your CoinCorner API Secret"
data = str(nonce) + UserId + API_KEY
return hmac.new(secret_key, data.encode('utf-8'), hashlib.sha256).hexdigest()
const crypto = require('crypto');
function GenerateSig(nonce) {
var APIKey = 'Your CoinCorner API Key';
var APISecret = 'Your CoinCorner API Secret';
var UserId = 'Your CoinCorner UserId';
const hmac = crypto.createHmac('sha256', APISecret);
var sig = hmac.update(nonce.toString() + UserId + APIKey).digest('hex');
return sig;
}