A suite to track Project Diva score statistics and ratings / D4DJ event data.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
projectdivar/server/node_modules/twitter-autohook/test/signature.js

17 lines
588 B

const { validateSignature } = require('../');
const assert = require('assert');
const oauth = {
consumer_key: 'test',
consumer_secret: 'test',
token: 'test',
token_secret: 'test',
};
const fixtures = [
{body: 'test=1&other_test=2', header: {'x-twitter-webhooks-signature': 'sha256=25Cu3iwbbiqBTwQRzcKJZwisjf736V2Q8UaTlkfLSoc='}},
{body: '{"test_number":1,"test_string":"two"}', header: {'x-twitter-webhooks-signature': 'sha256=YWHphPn/JFq43jkF0y4/w8R/SelmLjvpunhVFY8JhlI='}},
]
for (const {body, header} of fixtures) {
assert.ok(validateSignature(header, oauth, body));
}