Comparing version 0.0.2 to 0.0.3
11
index.js
@@ -11,8 +11,13 @@ | ||
function write (buf) { | ||
return new string_decoder.StringDecoder().write(buf) | ||
return new string_decoder.StringDecoder('hex').write(buf) | ||
} | ||
function match (hmac, sig) { | ||
var str = write(hmac.digest('hex')) | ||
return ('sha1=' + str) === sig | ||
var chunk | ||
, str = 'sha1=' | ||
; | ||
while (null !== (chunk = hmac.read())) { | ||
str += write(chunk) | ||
} | ||
return str === sig | ||
} | ||
@@ -19,0 +24,0 @@ |
{ | ||
"name": "deed", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "verify x-hub-signature", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# deed - verify x-hub-signature | ||
The deed [Node.js](http://nodejs.org/) module verifies [X-Hub-Signature](http://pubsubhubbub.googlecode.com/git/pubsubhubbub-core-0.3.html#aggregatedistribution) headers. | ||
The deed [Node.js](http://nodejs.org/) module verifies [X-Hub-Signature](http://pubsubhubbub.googlecode.com/git/pubsubhubbub-core-0.3.html#authednotify) headers. | ||
@@ -27,5 +27,7 @@ [![Build Status](https://secure.travis-ci.org/michaelnisi/deed.svg)](http://travis-ci.org/michaelnisi/deed) [![David DM](https://david-dm.org/michaelnisi/deed.svg)](http://david-dm.org/michaelnisi/deed) | ||
- `er` The error if an error occures or the authorisation fails | ||
- `req` The verified request | ||
The callback called when **deed** is done receives the request if all went well. | ||
- `er` The error if an error occured or verification failed. | ||
- `req` The verified request. | ||
## exports | ||
@@ -35,4 +37,6 @@ | ||
- `secret` The key to hash the payload | ||
- `req` The request to verify | ||
The sole function exported by the **deed** module checks if the request body hashed with the secret matches the `X-Hub-Signature` header. | ||
- `secret` The key to hash the payload. | ||
- `req` The request to verify. | ||
- `cb` cb() | ||
@@ -39,0 +43,0 @@ |
5399
108
49