summaryrefslogtreecommitdiff
path: root/1.1.x/src/erlang-oauth/oauth_hmac_sha1.erl
diff options
context:
space:
mode:
Diffstat (limited to '1.1.x/src/erlang-oauth/oauth_hmac_sha1.erl')
-rw-r--r--1.1.x/src/erlang-oauth/oauth_hmac_sha1.erl11
1 files changed, 11 insertions, 0 deletions
diff --git a/1.1.x/src/erlang-oauth/oauth_hmac_sha1.erl b/1.1.x/src/erlang-oauth/oauth_hmac_sha1.erl
new file mode 100644
index 00000000..79d59f37
--- /dev/null
+++ b/1.1.x/src/erlang-oauth/oauth_hmac_sha1.erl
@@ -0,0 +1,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).