summaryrefslogtreecommitdiff
path: root/src/erlang-oauth/oauth_hmac_sha1.erl
blob: 79d59f3709d83227469120a3f05346708f120975 (plain)
1
2
3
4
5
6
7
8
9
10
11
-module(oauth_hmac_sha1).

-export([signature/3, verify/4]).


signature(BaseString, CS, TS) ->
  Key = oauth_uri:calate("&", [CS, TS]),
  base64:encode_to_string(crypto:sha_mac(Key, BaseString)).

verify(Signature, BaseString, CS, TS) ->
  couch_util:verify(signature(BaseString, CS, TS), Signature).