Socket
Socket
Sign inDemoInstall

socializr

Package Overview
Dependencies
14
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.3 to 0.0.4

38

lib/providers/facebook.js
var stream = require('stream')
, util = require('util')
, crypto = require('crypto')
, request = require('superagent')

@@ -19,17 +20,19 @@ , oauth1a = require('../auth/oauth1a')

function PubSubConnection(){
function PubSubConnection(secret){
this.appSecret = secret;
};
PubSubConnection.prototype.verifyToken = function(){
return this.verifyToken = oauth1a.makeNonce();
};
PubSubConnection.prototype.verify = function(){
PubSubConnection.prototype.validateSignature = function(data){
var decipher = crypto.createDecipher('AES-128-CBC-HMAC-SHA1', this.appSecret);
decipher.update('sha1='+data, 'hex');
return decipher.final('utf8');
};
PubSubConnection.prototype.verify = function(){
};
function Facebook(opts){

@@ -47,2 +50,4 @@

this.subscribedFields = FB_DEFAULT_PAGE_SUBSCRIBED_FIELDS;
this._pubsubConnections = {};
};

@@ -92,2 +97,8 @@ util.inherits(Facebook, Transform);

Facebook.prototype.subscribe = function(token,cb){
var conn = new PubSubConnection( this.appSecret)
, verify_token = conn.verifyToken()
;
this._pubsubConnections[ verify_token] = conn;
this._graphRequest( this.appId + '/subscriptions', 'POST', {

@@ -97,3 +108,3 @@ object: 'page',

fields: this.subscribedFields.join(','),
verify_token: oauth1a.makeNonce(),
verify_token: verify_token,
access_token: this.appAccessToken

@@ -109,2 +120,3 @@ },function(res){

return function(req, res, next){
console.log(res.get('X-Hub-Signature'));
res.pipe( this);

@@ -115,2 +127,6 @@ next();

Facebook.prototype.isVerifyToken = function(token){
return this._pubsubConnections.hasOwnProperty( token);
};
Facebook.prototype.verify = function(){

@@ -122,3 +138,7 @@ var _this = this;

res.send();
if( _this.isVerifyToken( req.query['hub.verify_token'])){
res.send(req.query['hub.challenge']);
}else {
res.send('false');
}
next();

@@ -125,0 +145,0 @@ };

{
"name": "socializr",
"version": "0.0.3",
"version": "0.0.4",
"description": "Read data streams from several social networks.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc