summaryrefslogtreecommitdiff
path: root/src/erlang-oauth/oauth_hmac_sha1.erl
blob: 69064edd9ceef7c19e0dfa86908ed8fe500acf38 (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) ->
  Signature =:= signature(BaseString, CS, TS).