Socket
Socket
Sign inDemoInstall

jws-jwk

Package Overview
Dependencies
6
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jws-jwk

Adds (some) support for JWKs to node-jws


Version published
Weekly downloads
323
decreased by-0.31%
Maintainers
1
Install size
388 kB
Created
Weekly downloads
 

Readme

Source

Dependency Status License

node-jws-jwk

This is basically just node-jws augmented so that secretOrKey can be a JWK or set of JWKs.

Install

$ npm install jws-jwk

Example

var jws = require('jws-jwk');

var signature = getJWSFromSomwhere();
var jwk = { kid: '1234', kty: 'RSA', n: '12345...XYZ=', e: 'AQAB' };

if (jws.verify(signature, jwk)) {
  // Do stuff here, signature was verified using the JWK
}

Overriding node-jws

You might want to make it so when other code you are using does the following, the module in the variable jws is augmented.

var jws = require('jws');

One reason to do this is to make modules using node-jws work with JWKs, e.g. jsonwebtoken. Requiring node-jws-jwk like so will add its augmented functions to the node-jws module:

var jws = require('jws-jwk').shim();

In-Browser Usage

This module shims in jsrsasign when browserified to make jws.verify work in-browser (with JWKs and normally).

References

  1. node-jws
  2. JSON Web Key (JWK) Draft 31

Keywords

FAQs

Last updated on 02 Oct 2014

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