Skip to content

Instantly share code, notes, and snippets.

@jamesduncombe
Last active May 5, 2016 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesduncombe/e5bedd76673feed560c365e0dbc2444c to your computer and use it in GitHub Desktop.
Save jamesduncombe/e5bedd76673feed560c365e0dbc2444c to your computer and use it in GitHub Desktop.
Function for generating the API signature for Vaultoro's API - https://api.vaultoro.com
defmodule Vaultoro do
@doc """
secret = The Vaultoro secret generated along with your API key
endpoint = The full URL that you are requesting (with all params) e.g: https://api.vaultoro.com/1/balance?nonce=9&apikey=_MY_API_KEY_
"""
def signature(secret, endpoint) do
:crypto.hmac(:sha256, secret, endpoint)
|> Base.encode16(case: :lower)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment