Name: node-http-signature
Owner: Digital Bazaar, Inc.
Description: Reference implementation of Joyent's HTTP Signature Scheme
Created: 2013-04-18 17:40:07.0
Updated: 2014-02-01 16:17:48.0
Pushed: 2016-05-04 15:52:36.0
Homepage: http://www.joyent.com
Size: 140
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
node-http-signature is a node.js library that has client and server components for Joyent's HTTP Signature Scheme.
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.
fs = require('fs');
https = require('https');
httpSignature = require('http-signature');
key = fs.readFileSync('./key.pem', 'ascii');
options = {
st: 'localhost',
rt: 8443,
th: '/',
thod: 'GET',
aders: {}
dds a 'Date' header in, signs it, and adds the
Authorization' header in.
req = https.request(options, function(res) {
nsole.log(res.statusCode);
Signature.sign(req, {
y: key,
yId: './cert.pem'
end();
fs = require('fs');
https = require('https');
httpSignature = require('http-signature');
options = {
y: fs.readFileSync('./key.pem'),
rt: fs.readFileSync('./cert.pem')
s.createServer(options, function (req, res) {
r rc = 200;
r parsed = httpSignature.parseRequest(req);
r pub = fs.readFileSync(parsed.keyId, 'ascii');
(!httpSignature.verifySignature(parsed, pub))
rc = 401;
s.writeHead(rc);
s.end();
isten(8443);
npm install http-signature
MIT.