3 node-http-signature is a node.js library that has client and server components
4 for Joyent's [HTTP Signature Scheme](http_signing.md).
8 Note the example below signs a request with the same key/cert used to start an
9 HTTP server. This is almost certainly not what you actually want, but is just
10 used to illustrate the API calls; you will need to provide your own key
11 management in addition to this library.
16 var fs = require('fs');
17 var https = require('https');
18 var httpSignature = require('http-signature');
20 var key = fs.readFileSync('./key.pem', 'ascii');
30 // Adds a 'Date' header in, signs it, and adds the
31 // 'Authorization' header in.
32 var req = https.request(options, function(res) {
33 console.log(res.statusCode);
37 httpSignature.sign(req, {
48 var fs = require('fs');
49 var https = require('https');
50 var httpSignature = require('http-signature');
53 key: fs.readFileSync('./key.pem'),
54 cert: fs.readFileSync('./cert.pem')
57 https.createServer(options, function (req, res) {
59 var parsed = httpSignature.parseRequest(req);
60 var pub = fs.readFileSync(parsed.keyId, 'ascii');
61 if (!httpSignature.verifySignature(parsed, pub))
71 npm install http-signature
79 See <https://github.com/joyent/node-http-signature/issues>.