npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@leisurelink/http-signature

v1.1.1

Published

Reference implementation of Joyent's HTTP Signature scheme.

Downloads

12

Readme

node-http-signature (JWT extension)

A fork of Joyent's HTTP Signature Scheme reference implementation with JWT as an extension.

See Joyent's repository for basic usage and up-to-date information about HTTP Signature.

For reference, you may also peek at HTTP Signature's Internet-Draft status.

Why

HTTP Signature enables the server receiving an HTTP request to trust the identity of the sender as well as the integrity of the message itself without the need for multiple round-trips.

In plain language, this means that the server can trust that the caller is who they say they are (authentic), and that what the server received has not been tampered with in transit (message integrity).

HTTP Signature is:

  • synergistic with the REST architectural style
  • pure HTTP
  • efficient compared to schemes requiring multiple round-trips (e.g. CHAP)

Adding JWT

From the server's point of view, HTTP Signature verifies the identity of a particular network endpoint (the caller) at a particular point in time (at message generation). The confidence this affords the server satisfies many security architectures; however, if the caller makes requests to the server on another security principal's behalf (e.g. an application level user), it is desirable to have the other principal's security related context conveyed with the request. This is where JSON Web Token (JWT) comes in to play.

JSON Web Token encodes a principal's identity claims into a security token that may be trusted across collaborating systems (a federation).

This fork leverages HTTP Signature's built-in extension method to piggy-back a JWT with an HTTP Signature, enabling API endpoints to trust not only the caller (which may be another API endpoint), but also trust an additional security context (the end user).

How

We endeavor to stay entirely drop-in compatible with the forked repository so that libraries that rely on Joyent's module (request, restify, etc.) work correctly when this module is overlaid.

As such, this module doesn't create JSON Web Tokens, it simply includes them in the signature if you provide one.

On the server side, Joyent's reference implementation's will place the provided jwt property on the parsed options: parsed.options.jwt.

Client

var httpSignature = require('http-signature');

function signWithOptionalJwt(req, jwt, keyId, key) {
  var options = {
    key: key,
    keyId: keyId
  };
  if (jwt) options.jwt = jwt;

  httpSignature.sign(req, options);
  return req;
}

Installation

Many node modules already rely on HTTP Signature, so this module is installed by overlaying/patching it in your module's package.json file.

{
  "name": UR-module,
  ...
  "dependencies": {
    ...
    "http-signature": "LeisureLink/node-http-signature",
    ...
  }
}

This module is also published to npm as @leisurelink/http-signature.

License

MIT.

Bugs

See https://github.com/LeisureLink/node-http-signature/issues.