Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

calamarble-xhub-sns

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

calamarble-xhub-sns

check the signature of a http request and if valid post to an AWS SNS topic

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

calamarble-xhub-sns

Auto-publish to an Amazon SNS topic after a X-Hub-Signature check

Checks the signature of a http request and if valid post the body of the request to a configurable existing AWS SNS topic.

Usage

With express.js

import express from 'express';
import bodyParser from 'body-parser';
import { apiEndpoint } from 'calamarble-xhub-sns';

const expressConfig = {
    port: 8088,
    postPath: '/mywebhook',
    messages: {
        serverRunning: port => `Server running on port ${port}`
    }
};
const xHubSnsConfig = {
    algo: 'sha1',
    secret: 'MY_APP_SECRET',
    topicArn: 'arn:aws:sns:us-east-1:XXXXX:yyyyy',
    awsConfig: {
        region: 'us-east-1'
    }
    messages: {
        wrongSignature: 'Content signature don\'t match'
    }
};
const app = express();
const postEndPoint = apiEndpoint(xHubConfig);
app.use(bodyParser.raw({ type: 'application/json' }));
app.post(expressConfig.postPath, postEndPoint);
app.listen(expressConfig.port, () => console.log(`Server running on port ${expressConfig.port}`));

With claudia-api-builder

import ApiBuilder from 'claudia-api-builder';
import { apiEndpoint as webhookPost} from 'calamarble-xhub-sns';

const api = new ApiBuilder();
const xHubConfig = {
    algo: 'sha1',
    secret: 'MY_APP_SECRET',
    topicArn: 'arn:aws:sns:us-east-1:XXXXX:yyyyy',
    messages: {
        wrongSignature: 'Content signature don\'t match'
    }
}

api.post('/fbwebhook', webhookPost(xHubConfig));

export { api as default };

Remember to copy the file policies/sns-publish.json and include it in your claudia create --policies command line argument when creating your lambdas.

Keywords

FAQs

Package last updated on 16 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc