How to use the http-signature.parseRequest function in http-signature

To help you get started, we’ve selected a few http-signature examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github request / request / tests / test-http-signature.js View on Github external
var server = http.createServer(function (req, res) {
  var parsed = httpSignature.parseRequest(req)
  var publicKeyPEM = publicKeyPEMs[parsed.keyId]
  var verified = httpSignature.verifySignature(parsed, publicKeyPEM)
  res.writeHead(verified ? 200 : 400)
  res.end()
})
github restify / node-restify / lib / plugins / authorization.js View on Github external
function parseSignature(request, options) {
    var opts = options || {};
    opts.algorithms = OPTIONS.algorithms;

    try {
        return httpSignature.parseRequest(request, options);
    } catch (e) {
        throw new InvalidHeaderError(
            'Authorization header invalid: ' + e.message
        );
    }
}
github science / openthermo / server / node_modules / restify / lib / plugins / authorization.js View on Github external
function parseSignature(request) {
        try {
                return (httpSignature.parseRequest(request, OPTIONS));
        } catch (e) {
                throw new InvalidHeaderError('Authorization header invalid: ' +
                                             e.message);
        }
}
github restify / node-restify / lib / plugins / authorization.js View on Github external
function parseSignature(request, options) {
    options = options || {};
    options.algorithms = OPTIONS.algorithms;

    try {
        return (httpSignature.parseRequest(request, options));
    } catch (e) {
        throw new InvalidHeaderError('Authorization header invalid: ' +
            e.message);
    }
}
github ornl-sava / nv / node_modules / restify / lib / plugins / authorization.js View on Github external
function parseSignature(request, options) {
    options = options || {};
    options.algorithms = OPTIONS.algorithms;

    try {
        return (httpSignature.parseRequest(request, options));
    } catch (e) {
        throw new InvalidHeaderError('Authorization header invalid: ' +
            e.message);
    }
}
github SmartThingsCommunity / smartapp-sdk-nodejs / lib / util / authorizer.js View on Github external
async isAuthorized(req) {
		try {
			const keyResolver = this._keyResolver
			const parsed = httpSignature.parseRequest(req, undefined)
			const publicKey = await keyResolver.getKey(parsed.keyId)

			if (httpSignature.verifySignature(parsed, publicKey)) {
				return true
			}

			this._logger.error('Forbidden - failed verifySignature')
			return false
		} catch (error) {
			this._logger.exception(error)
			return false
		}
	}
}

http-signature

Reference implementation of Joyent's HTTP Signature scheme.

MIT
Latest version published 1 year ago

Package Health Score

74 / 100
Full package analysis