Authentication

1. Introduction

If you want to use Coinstack API, you should send a credential to Coinstack server. The credential plays important roles in assuring that a user request is not modified by any reason and discerning each user request. Steps of the credential is below:

  1. Issue an API key at Coinstack Dashboard.
  2. Issue a token for calling the REST API directly.
  3. Issue an API key for a user-specific configuration.
  4. Configure the credential as per instructions below, and then call Coinstack API.

2. How to Credential

The credential is delivered by two ways.

2.1. Token

When you call the REST API directly, you should include the token into the header of the HTTP request. In this case, the token is exposed by a plain text, hence cryptographic protocols like TLS are recommended when to request.

2.2. Digital Signature

When you call an API provided by Coinstack SDK, you should send the API key and a digital signature created from the method, HMAC-SHA256, correlated with a user request as a private key.

3. Issue and Configure API Key

3.1. Issue API Key

As described above, the credential steps should be preceded to use Coinstack APIs. The first step of the credential is issuing an API Key or API token, which could be provided by Coinstack Dashboard.

3.2. Configure API Key

If you configured the API key or token as an environment value, you could avoid an insufficient code that the key is exposed.

3.2.1. API Token

Shell
# Call REST API with Token in the header with key, 'apiKey'.
curl https://mainnet.cloudwallet.io/ \
    -H "apiKey: YOUR_API_TOKEN_KEY"

3.2.2. API Key

Java
In Environment Variable
// An issued credential is configured as :
// export COINSTACK_ACCESS_KEY_ID="YOUR_COINSTACK_ACCESS_KEY"
// export COINSTACK_SECRET_ACCESS_KEY="YOUR_COINSTACK_SECRET_KEY"

import io.blocko.coinstack.*

CoinStackClient client = new CoinStackClient();
In Constructor
import io.blocko.coinstack.*

CoinStackClient client = new CoinStackClient(new CredentialsProvider() {
            @Override
            public String getAccessKey() {
                return "Issued access key";
            }

            @Override
            public String getSecretKey() {
                return "Issued secret key";
            }
        }, Endpoint.MAINNET);
JavaScript
In Environment Variable
// An issued credential is configured as :
// export COINSTACK_ACCESS_KEY_ID="YOUR_COINSTACK_ACCESS_KEY"
// export COINSTACK_SECRET_ACCESS_KEY="YOUR_COINSTACK_SECRET_KEY"

var CoinStack = require('coinstack-sdk-js')
var client = new CoinStack();
In Constructor
var accessKey = "YOUR_COINSTACK_ACCESS_KEY";
var secretKey = "YOUR_COINSTACK_SECRET_KEY";
var client = new CoinStack(accessKey, secretKey);
Meteor
In Environment Variable
// An issued credential is configured as :
// export COINSTACK_ACCESS_KEY_ID="YOUR_COINSTACK_ACCESS_KEY"
// export COINSTACK_SECRET_ACCESS_KEY="YOUR_COINSTACK_SECRET_KEY"

export COINSTACK_ACCESS_KEY="YOUR_COINSTACK_ACCESS_KEY";
export COINSTACK_SECRET_KEY="YOUR_COINSTACK_SECRET_KEY";
var client = new CoinStack();
In Constructor
var accessKey = "YOUR_COINSTACK_ACCESS_KEY";
var secretKey = "YOUR_COINSTACK_SECRET_KEY";
var client = new CoinStack(accessKey, secretKey);

results matching ""

    No results matching ""