Documentation ¶
Index ¶
Constants ¶
const ( // CoinbaseBaseURL is the base url of the coinbase api CoinbaseBaseURL = "https://api.coinbase.com/" // APIVersion is the api version used in this package APIVersion = "2017-06-02" )
Variables ¶
var ( // CoinbaseAPIKey is your api key obtained from your coinbase account setting CoinbaseAPIKey = os.Getenv("COINBASE_APIKEY") // CoinbaseAPISecret is your api secret obtained from your coinbase account settings CoinbaseAPISecret = os.Getenv("COINBASE_APISECRET") // CBAccount is the exported singleton to use this package in code CBAccount *APIKeyAuthentication )
Functions ¶
This section is empty.
Types ¶
type APIKeyAuthentication ¶
APIKeyAuthentication Struct implements the Authentication interface and takes care of authenticating RPC requests for clients with the `CoinbaseAPIKey` & `CoinbaseAPISecret` pair
func NewClient ¶
func NewClient(pubkey *string, privkey *string) *APIKeyAuthentication
NewClient return a new client against a pub and priv key pairs
func (APIKeyAuthentication) Authenticate ¶
Authenticate with API Key + Secret authentication requires a request header of the HMAC SHA-256 signature of the "message" as well as an incrementing nonce and the API key
The CB-ACCESS-SIGN header is generated by creating a sha256 HMAC using the secret key on the prehash string timestamp + method + requestPath + body
The timestamp value is the same as the CB-ACCESS-TIMESTAMP header.
The CB-ACCESS-TIMESTAMP header MUST be number of seconds since Unix Epoch.
func (APIKeyAuthentication) GetBaseURL ¶
func (a APIKeyAuthentication) GetBaseURL() string
GetBaseURL return the coinbase api base URL
func (APIKeyAuthentication) GetClient ¶
func (a APIKeyAuthentication) GetClient() *http.Client
GetClient return the authenticated http client