Socket
Socket
Sign inDemoInstall

oauth-simple-signature-check

Package Overview
Dependencies
2
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    oauth-simple-signature-check

A simple OAuth 1.0a signature verification package.


Version published
Weekly downloads
19
increased by72.73%
Maintainers
1
Install size
1.02 MB
Created
Weekly downloads
 

Readme

Source

oauth-simple-signature-check

This package is a simple way to quickly test an OAuth 1.0a signature for validity. As it is intended to be extremely simple, there are no configuration options; however, you may use it as a base if you need different behavior. The algorithm for validating OAuth signatures was adapted from this site: http://lti.tools/oauth/

It was originally designed to simplify OAuth signature validation within the LTI (Learning Tools Interopability) spec, but it can be adapted to many other uses as well.

Assumptions

The package works out-of-the-box with Express.js.

The algorithm assumes you are using HMAC-SHA1 within the OAuth 1.0a spec. Again, you can fork this package and easily change this, if needed. It also assumes you are using UTF-8 for encoding (which you should be).

How to use

Call it in your express.js app, within a route. Here is an example:

const validateOAuthSignature = require("oauth-simple-signature-check");

app.post("/", function (req, res) => {
  const isOAuthSignatureValid = validateOAuthSignature(req, process.env.CONSUMER_SECRET); 

  if (isOAuthSignatureValid)
    res.json({ data: {str: "my secret string"} });
  else
    res.json({});
}); 

Keywords

FAQs

Last updated on 17 Aug 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc