Skip to content

Commit

Permalink
update api v2 en doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Xie committed Mar 12, 2015
1 parent 7269ae0 commit 335cb13
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/views/documents/api_v2.en.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@
pre: code
| # canonical_verb is HTTP verb like GET/POST in upcase.
# canonical_uri is request path like /api/v2/markets.
# canonical_query is the request query sort in alphabetica order, including access_key and tonce, e.g. access_key=xxx&foo=bar&tonce=123456789
# canonical_query is the request query sorted in alphabetica order, including access_key and tonce, e.g. access_key=xxx&foo=bar&tonce=123456789
# The combined string looks like: GET|/api/v2/markets|access_key=xxx&foo=bar&tonce=123456789
def payload
"\#{canonical_verb}|\#{canonical_uri}|\#{canonical_query}"
end

p Note: query parameters are sorted in payload, so it must be "access_key=xxx&foo=bar" not "foo=bar&&access_key=xxx".
p Suppose my secret key is 'yyy', then the result of HMAC-SHA256 of above payload is:
pre: code
| hash = HMAC-SHA256('GET|/api/v2/markets|access_key=xxx&foo=bar&tonce=123456789', 'yyy').to_hex
Expand Down

0 comments on commit 335cb13

Please sign in to comment.