1.4.0 • Published 5 months ago

http-signature v1.4.0

Weekly downloads
23,577,581
License
MIT
Repository
github
Last release
5 months ago

node-http-signature

node-http-signature is a node.js library that has client and server components for Joyent's HTTP Signature Scheme.

Usage

Note the example below signs a request with the same key/cert used to start an HTTP server. This is almost certainly not what you actually want, but is just used to illustrate the API calls; you will need to provide your own key management in addition to this library.

Client

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

var key = fs.readFileSync('./key.pem', 'ascii');

var options = {
  host: 'localhost',
  port: 8443,
  path: '/',
  method: 'GET',
  headers: {}
};

// Adds a 'Date' header in, signs it, and adds the
// 'Authorization' header in.
var req = https.request(options, function(res) {
  console.log(res.statusCode);
});


httpSignature.sign(req, {
  key: key,
  keyId: './cert.pem',
  keyPassphrase: 'secret' // (optional)
});

req.end();

Server

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

var options = {
  key: fs.readFileSync('./key.pem'),
  cert: fs.readFileSync('./cert.pem')
};

https.createServer(options, function (req, res) {
  var rc = 200;
  var parsed = httpSignature.parseRequest(req);
  var pub = fs.readFileSync(parsed.keyId, 'ascii');
  if (!httpSignature.verifySignature(parsed, pub))
    rc = 401;

  res.writeHead(rc);
  res.end();
}).listen(8443);

Installation

npm install http-signature

License

MIT.

Bugs

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

request@cypress/requestarchetype-librarychinjowwchinjowvuedragdropuploadimagesreact-native-bluetooth2killi8n-react-native-fast-imagetesting-library-publish-soosgyulspecify-importsbabel-specify-imports@icanpm/api-master@arisageha/react-lazyload@cashremit/cr-streamline-icons@penngrove/insomnia-plugin-remoteitreact-native-template-rfbaseairscanairscan-examplebb-chatclauquest.ejshomebridge-airmega-nathanfjohnsonreact-native-esc-pos-sahaab@borisovart/atol-kkt-module@frxf/frxf@digitsole/blackburn-authdeneme323112gql_din_modmutasi-bca@jttechnic/interpreteropenid-passportutyfua_requestjasonkaraniks-bot-request@olivervorasai/slidertypes-giscogoportutilsukor-remasterrequest__no_405react-native-slider-kfexpand-react-bridge@everything-registry/sub-chunk-1871oracle-cloud-jsoci-node-jsoci-commonopengraphnguyenpm-package-mentorchecknumhandlermitch-component-authenticationminiversemhe-requestmggauharnode-red-contrib-omojectnode-red-contrib-smartthingsnode-red-contrib-samsung-automation-studio-nodesphoenix-cyptopeter.you.jqweui.test.publishpixiu-swap-corepixiuswap-libs-sdkopen-overlaynuxtjs-argonpolen-web-components-reactpostman-requestpatternxpinguageng-search-dropdownmoonwalkerswap-default-token-listsmyrequest2ms-restms-rest-ssrf-fixedmpesa-cookiempesa-cookie-jarnative-google-loginnative-kakao-loginpublishing-to-npm-packageqiao.plugin.requestfixpatillades_restify_forkpassport-http-signature@devorso/dcountdown@ansonhkg/utils@apardellass/react-native-audio-streamzona-api-easy-xzona-chain-xzona-xasync-bus@cdevine49/react-numeric-input@catalinaquinteror/mdlinksbirken-react-native-community-image-editor@chakra-swap/core@dinert/echartsbms-requestbloxflipapi@donapot/mylibtest@corelmax/react-native-my2c2p-sdkbungee-request@cleveradssolutions/cas.cordova.adcolony@cleveradssolutions/cas.cordova.admob@cleveradssolutions/cas.cordova.applovin@cleveradssolutions/cas.cordova.facebook@cleveradssolutions/cas.cordova.families@cleveradssolutions/cas.cordova.fyber
1.4.0

5 months ago

1.3.6

2 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

7 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.11.0

9 years ago

0.10.1

9 years ago

0.10.0

11 years ago

0.9.11

11 years ago

0.9.10

11 years ago

0.9.9

12 years ago

0.9.8

12 years ago

0.9.7

12 years ago

0.9.6

12 years ago

0.9.5

13 years ago

0.9.4

13 years ago

0.9.3

13 years ago

0.9.2

13 years ago

0.9.0

13 years ago