You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by ro...@apache.org on 2015/07/12 14:01:01 UTC
[34/59] [abbrv] couchdb-nmo git commit: remove request module
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/lib/parser.js
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/lib/parser.js b/node_modules/request/node_modules/http-signature/lib/parser.js
deleted file mode 100644
index fd9ac10..0000000
--- a/node_modules/request/node_modules/http-signature/lib/parser.js
+++ /dev/null
@@ -1,304 +0,0 @@
-// Copyright 2012 Joyent, Inc. All rights reserved.
-
-var assert = require('assert-plus');
-var util = require('util');
-
-
-
-///--- Globals
-
-var Algorithms = {
- 'rsa-sha1': true,
- 'rsa-sha256': true,
- 'rsa-sha512': true,
- 'dsa-sha1': true,
- 'hmac-sha1': true,
- 'hmac-sha256': true,
- 'hmac-sha512': true
-};
-
-var State = {
- New: 0,
- Params: 1
-};
-
-var ParamsState = {
- Name: 0,
- Quote: 1,
- Value: 2,
- Comma: 3
-};
-
-
-
-///--- Specific Errors
-
-function HttpSignatureError(message, caller) {
- if (Error.captureStackTrace)
- Error.captureStackTrace(this, caller || HttpSignatureError);
-
- this.message = message;
- this.name = caller.name;
-}
-util.inherits(HttpSignatureError, Error);
-
-function ExpiredRequestError(message) {
- HttpSignatureError.call(this, message, ExpiredRequestError);
-}
-util.inherits(ExpiredRequestError, HttpSignatureError);
-
-
-function InvalidHeaderError(message) {
- HttpSignatureError.call(this, message, InvalidHeaderError);
-}
-util.inherits(InvalidHeaderError, HttpSignatureError);
-
-
-function InvalidParamsError(message) {
- HttpSignatureError.call(this, message, InvalidParamsError);
-}
-util.inherits(InvalidParamsError, HttpSignatureError);
-
-
-function MissingHeaderError(message) {
- HttpSignatureError.call(this, message, MissingHeaderError);
-}
-util.inherits(MissingHeaderError, HttpSignatureError);
-
-
-
-///--- Exported API
-
-module.exports = {
-
- /**
- * Parses the 'Authorization' header out of an http.ServerRequest object.
- *
- * Note that this API will fully validate the Authorization header, and throw
- * on any error. It will not however check the signature, or the keyId format
- * as those are specific to your environment. You can use the options object
- * to pass in extra constraints.
- *
- * As a response object you can expect this:
- *
- * {
- * "scheme": "Signature",
- * "params": {
- * "keyId": "foo",
- * "algorithm": "rsa-sha256",
- * "headers": [
- * "date" or "x-date",
- * "content-md5"
- * ],
- * "signature": "base64"
- * },
- * "signingString": "ready to be passed to crypto.verify()"
- * }
- *
- * @param {Object} request an http.ServerRequest.
- * @param {Object} options an optional options object with:
- * - clockSkew: allowed clock skew in seconds (default 300).
- * - headers: required header names (def: date or x-date)
- * - algorithms: algorithms to support (default: all).
- * @return {Object} parsed out object (see above).
- * @throws {TypeError} on invalid input.
- * @throws {InvalidHeaderError} on an invalid Authorization header error.
- * @throws {InvalidParamsError} if the params in the scheme are invalid.
- * @throws {MissingHeaderError} if the params indicate a header not present,
- * either in the request headers from the params,
- * or not in the params from a required header
- * in options.
- * @throws {ExpiredRequestError} if the value of date or x-date exceeds skew.
- */
- parseRequest: function parseRequest(request, options) {
- assert.object(request, 'request');
- assert.object(request.headers, 'request.headers');
- if (options === undefined) {
- options = {};
- }
- if (options.headers === undefined) {
- options.headers = [request.headers['x-date'] ? 'x-date' : 'date'];
- }
- assert.object(options, 'options');
- assert.arrayOfString(options.headers, 'options.headers');
- assert.optionalNumber(options.clockSkew, 'options.clockSkew');
-
- if (!request.headers.authorization)
- throw new MissingHeaderError('no authorization header present in ' +
- 'the request');
-
- options.clockSkew = options.clockSkew || 300;
-
-
- var i = 0;
- var state = State.New;
- var substate = ParamsState.Name;
- var tmpName = '';
- var tmpValue = '';
-
- var parsed = {
- scheme: '',
- params: {},
- signingString: '',
-
- get algorithm() {
- return this.params.algorithm.toUpperCase();
- },
-
- get keyId() {
- return this.params.keyId;
- }
-
- };
-
- var authz = request.headers.authorization;
- for (i = 0; i < authz.length; i++) {
- var c = authz.charAt(i);
-
- switch (Number(state)) {
-
- case State.New:
- if (c !== ' ') parsed.scheme += c;
- else state = State.Params;
- break;
-
- case State.Params:
- switch (Number(substate)) {
-
- case ParamsState.Name:
- var code = c.charCodeAt(0);
- // restricted name of A-Z / a-z
- if ((code >= 0x41 && code <= 0x5a) || // A-Z
- (code >= 0x61 && code <= 0x7a)) { // a-z
- tmpName += c;
- } else if (c === '=') {
- if (tmpName.length === 0)
- throw new InvalidHeaderError('bad param format');
- substate = ParamsState.Quote;
- } else {
- throw new InvalidHeaderError('bad param format');
- }
- break;
-
- case ParamsState.Quote:
- if (c === '"') {
- tmpValue = '';
- substate = ParamsState.Value;
- } else {
- throw new InvalidHeaderError('bad param format');
- }
- break;
-
- case ParamsState.Value:
- if (c === '"') {
- parsed.params[tmpName] = tmpValue;
- substate = ParamsState.Comma;
- } else {
- tmpValue += c;
- }
- break;
-
- case ParamsState.Comma:
- if (c === ',') {
- tmpName = '';
- substate = ParamsState.Name;
- } else {
- throw new InvalidHeaderError('bad param format');
- }
- break;
-
- default:
- throw new Error('Invalid substate');
- }
- break;
-
- default:
- throw new Error('Invalid substate');
- }
-
- }
-
- if (!parsed.params.headers || parsed.params.headers === '') {
- if (request.headers['x-date']) {
- parsed.params.headers = ['x-date'];
- } else {
- parsed.params.headers = ['date'];
- }
- } else {
- parsed.params.headers = parsed.params.headers.split(' ');
- }
-
- // Minimally validate the parsed object
- if (!parsed.scheme || parsed.scheme !== 'Signature')
- throw new InvalidHeaderError('scheme was not "Signature"');
-
- if (!parsed.params.keyId)
- throw new InvalidHeaderError('keyId was not specified');
-
- if (!parsed.params.algorithm)
- throw new InvalidHeaderError('algorithm was not specified');
-
- if (!parsed.params.signature)
- throw new InvalidHeaderError('signature was not specified');
-
- // Check the algorithm against the official list
- parsed.params.algorithm = parsed.params.algorithm.toLowerCase();
- if (!Algorithms[parsed.params.algorithm])
- throw new InvalidParamsError(parsed.params.algorithm +
- ' is not supported');
-
- // Build the signingString
- for (i = 0; i < parsed.params.headers.length; i++) {
- var h = parsed.params.headers[i].toLowerCase();
- parsed.params.headers[i] = h;
-
- if (h !== 'request-line') {
- var value = request.headers[h];
- if (!value)
- throw new MissingHeaderError(h + ' was not in the request');
- parsed.signingString += h + ': ' + value;
- } else {
- parsed.signingString +=
- request.method + ' ' + request.url + ' HTTP/' + request.httpVersion;
- }
-
- if ((i + 1) < parsed.params.headers.length)
- parsed.signingString += '\n';
- }
-
- // Check against the constraints
- var date;
- if (request.headers.date || request.headers['x-date']) {
- if (request.headers['x-date']) {
- date = new Date(request.headers['x-date']);
- } else {
- date = new Date(request.headers.date);
- }
- var now = new Date();
- var skew = Math.abs(now.getTime() - date.getTime());
-
- if (skew > options.clockSkew * 1000) {
- throw new ExpiredRequestError('clock skew of ' +
- (skew / 1000) +
- 's was greater than ' +
- options.clockSkew + 's');
- }
- }
-
- options.headers.forEach(function (hdr) {
- // Remember that we already checked any headers in the params
- // were in the request, so if this passes we're good.
- if (parsed.params.headers.indexOf(hdr) < 0)
- throw new MissingHeaderError(hdr + ' was not a signed header');
- });
-
- if (options.algorithms) {
- if (options.algorithms.indexOf(parsed.params.algorithm) === -1)
- throw new InvalidParamsError(parsed.params.algorithm +
- ' is not a supported algorithm');
- }
-
- return parsed;
- }
-
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/lib/signer.js
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/lib/signer.js b/node_modules/request/node_modules/http-signature/lib/signer.js
deleted file mode 100644
index 3507f4d..0000000
--- a/node_modules/request/node_modules/http-signature/lib/signer.js
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright 2012 Joyent, Inc. All rights reserved.
-
-var assert = require('assert-plus');
-var crypto = require('crypto');
-var http = require('http');
-
-var sprintf = require('util').format;
-
-
-
-///--- Globals
-
-var Algorithms = {
- 'rsa-sha1': true,
- 'rsa-sha256': true,
- 'rsa-sha512': true,
- 'dsa-sha1': true,
- 'hmac-sha1': true,
- 'hmac-sha256': true,
- 'hmac-sha512': true
-};
-
-var Authorization =
- 'Signature keyId="%s",algorithm="%s",headers="%s",signature="%s"';
-
-
-
-///--- Specific Errors
-
-function MissingHeaderError(message) {
- this.name = 'MissingHeaderError';
- this.message = message;
- this.stack = (new Error()).stack;
-}
-MissingHeaderError.prototype = new Error();
-
-
-function InvalidAlgorithmError(message) {
- this.name = 'InvalidAlgorithmError';
- this.message = message;
- this.stack = (new Error()).stack;
-}
-InvalidAlgorithmError.prototype = new Error();
-
-
-
-///--- Internal Functions
-
-function _pad(val) {
- if (parseInt(val, 10) < 10) {
- val = '0' + val;
- }
- return val;
-}
-
-
-function _rfc1123() {
- var date = new Date();
-
- var months = ['Jan',
- 'Feb',
- 'Mar',
- 'Apr',
- 'May',
- 'Jun',
- 'Jul',
- 'Aug',
- 'Sep',
- 'Oct',
- 'Nov',
- 'Dec'];
- var days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
- return days[date.getUTCDay()] + ', ' +
- _pad(date.getUTCDate()) + ' ' +
- months[date.getUTCMonth()] + ' ' +
- date.getUTCFullYear() + ' ' +
- _pad(date.getUTCHours()) + ':' +
- _pad(date.getUTCMinutes()) + ':' +
- _pad(date.getUTCSeconds()) +
- ' GMT';
-}
-
-
-
-///--- Exported API
-
-module.exports = {
-
- /**
- * Adds an 'Authorization' header to an http.ClientRequest object.
- *
- * Note that this API will add a Date header if it's not already set. Any
- * other headers in the options.headers array MUST be present, or this
- * will throw.
- *
- * You shouldn't need to check the return type; it's just there if you want
- * to be pedantic.
- *
- * @param {Object} request an instance of http.ClientRequest.
- * @param {Object} options signing parameters object:
- * - {String} keyId required.
- * - {String} key required (either a PEM or HMAC key).
- * - {Array} headers optional; defaults to ['date'].
- * - {String} algorithm optional; defaults to 'rsa-sha256'.
- * - {String} httpVersion optional; defaults to '1.1'.
- * @return {Boolean} true if Authorization (and optionally Date) were added.
- * @throws {TypeError} on bad parameter types (input).
- * @throws {InvalidAlgorithmError} if algorithm was bad.
- * @throws {MissingHeaderError} if a header to be signed was specified but
- * was not present.
- */
- signRequest: function signRequest(request, options) {
- assert.object(request, 'request');
- assert.object(options, 'options');
- assert.optionalString(options.algorithm, 'options.algorithm');
- assert.string(options.keyId, 'options.keyId');
- assert.optionalArrayOfString(options.headers, 'options.headers');
- assert.optionalString(options.httpVersion, 'options.httpVersion');
-
- if (!request.getHeader('Date'))
- request.setHeader('Date', _rfc1123());
- if (!options.headers)
- options.headers = ['date'];
- if (!options.algorithm)
- options.algorithm = 'rsa-sha256';
- if (!options.httpVersion)
- options.httpVersion = '1.1';
-
- options.algorithm = options.algorithm.toLowerCase();
-
- if (!Algorithms[options.algorithm])
- throw new InvalidAlgorithmError(options.algorithm + ' is not supported');
-
- var i;
- var stringToSign = '';
- for (i = 0; i < options.headers.length; i++) {
- if (typeof (options.headers[i]) !== 'string')
- throw new TypeError('options.headers must be an array of Strings');
-
- var h = options.headers[i].toLowerCase();
-
- if (h !== 'request-line') {
- var value = request.getHeader(h);
- if (!value) {
- throw new MissingHeaderError(h + ' was not in the request');
- }
- stringToSign += h + ': ' + value;
- } else {
- stringToSign +=
- request.method + ' ' + request.path + ' HTTP/' + options.httpVersion;
- }
-
- if ((i + 1) < options.headers.length)
- stringToSign += '\n';
- }
-
- var alg = options.algorithm.match(/(hmac|rsa)-(\w+)/);
- var signature;
- if (alg[1] === 'hmac') {
- var hmac = crypto.createHmac(alg[2].toUpperCase(), options.key);
- hmac.update(stringToSign);
- signature = hmac.digest('base64');
- } else {
- var signer = crypto.createSign(options.algorithm.toUpperCase());
- signer.update(stringToSign);
- signature = signer.sign(options.key, 'base64');
- }
-
- request.setHeader('Authorization', sprintf(Authorization,
- options.keyId,
- options.algorithm,
- options.headers.join(' '),
- signature));
-
- return true;
- }
-
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/lib/util.js
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/lib/util.js b/node_modules/request/node_modules/http-signature/lib/util.js
deleted file mode 100644
index e7d915e..0000000
--- a/node_modules/request/node_modules/http-signature/lib/util.js
+++ /dev/null
@@ -1,304 +0,0 @@
-// Copyright 2012 Joyent, Inc. All rights reserved.
-
-var assert = require('assert-plus');
-var crypto = require('crypto');
-
-var asn1 = require('asn1');
-var ctype = require('ctype');
-
-
-
-///--- Helpers
-
-function readNext(buffer, offset) {
- var len = ctype.ruint32(buffer, 'big', offset);
- offset += 4;
-
- var newOffset = offset + len;
-
- return {
- data: buffer.slice(offset, newOffset),
- offset: newOffset
- };
-}
-
-
-function writeInt(writer, buffer) {
- writer.writeByte(0x02); // ASN1.Integer
- writer.writeLength(buffer.length);
-
- for (var i = 0; i < buffer.length; i++)
- writer.writeByte(buffer[i]);
-
- return writer;
-}
-
-
-function rsaToPEM(key) {
- var buffer;
- var der;
- var exponent;
- var i;
- var modulus;
- var newKey = '';
- var offset = 0;
- var type;
- var tmp;
-
- try {
- buffer = new Buffer(key.split(' ')[1], 'base64');
-
- tmp = readNext(buffer, offset);
- type = tmp.data.toString();
- offset = tmp.offset;
-
- if (type !== 'ssh-rsa')
- throw new Error('Invalid ssh key type: ' + type);
-
- tmp = readNext(buffer, offset);
- exponent = tmp.data;
- offset = tmp.offset;
-
- tmp = readNext(buffer, offset);
- modulus = tmp.data;
- } catch (e) {
- throw new Error('Invalid ssh key: ' + key);
- }
-
- // DER is a subset of BER
- der = new asn1.BerWriter();
-
- der.startSequence();
-
- der.startSequence();
- der.writeOID('1.2.840.113549.1.1.1');
- der.writeNull();
- der.endSequence();
-
- der.startSequence(0x03); // bit string
- der.writeByte(0x00);
-
- // Actual key
- der.startSequence();
- writeInt(der, modulus);
- writeInt(der, exponent);
- der.endSequence();
-
- // bit string
- der.endSequence();
-
- der.endSequence();
-
- tmp = der.buffer.toString('base64');
- for (i = 0; i < tmp.length; i++) {
- if ((i % 64) === 0)
- newKey += '\n';
- newKey += tmp.charAt(i);
- }
-
- if (!/\\n$/.test(newKey))
- newKey += '\n';
-
- return '-----BEGIN PUBLIC KEY-----' + newKey + '-----END PUBLIC KEY-----\n';
-}
-
-
-function dsaToPEM(key) {
- var buffer;
- var offset = 0;
- var tmp;
- var der;
- var newKey = '';
-
- var type;
- var p;
- var q;
- var g;
- var y;
-
- try {
- buffer = new Buffer(key.split(' ')[1], 'base64');
-
- tmp = readNext(buffer, offset);
- type = tmp.data.toString();
- offset = tmp.offset;
-
- /* JSSTYLED */
- if (!/^ssh-ds[as].*/.test(type))
- throw new Error('Invalid ssh key type: ' + type);
-
- tmp = readNext(buffer, offset);
- p = tmp.data;
- offset = tmp.offset;
-
- tmp = readNext(buffer, offset);
- q = tmp.data;
- offset = tmp.offset;
-
- tmp = readNext(buffer, offset);
- g = tmp.data;
- offset = tmp.offset;
-
- tmp = readNext(buffer, offset);
- y = tmp.data;
- } catch (e) {
- console.log(e.stack);
- throw new Error('Invalid ssh key: ' + key);
- }
-
- // DER is a subset of BER
- der = new asn1.BerWriter();
-
- der.startSequence();
-
- der.startSequence();
- der.writeOID('1.2.840.10040.4.1');
-
- der.startSequence();
- writeInt(der, p);
- writeInt(der, q);
- writeInt(der, g);
- der.endSequence();
-
- der.endSequence();
-
- der.startSequence(0x03); // bit string
- der.writeByte(0x00);
- writeInt(der, y);
- der.endSequence();
-
- der.endSequence();
-
- tmp = der.buffer.toString('base64');
- for (var i = 0; i < tmp.length; i++) {
- if ((i % 64) === 0)
- newKey += '\n';
- newKey += tmp.charAt(i);
- }
-
- if (!/\\n$/.test(newKey))
- newKey += '\n';
-
- return '-----BEGIN PUBLIC KEY-----' + newKey + '-----END PUBLIC KEY-----\n';
-}
-
-
-///--- API
-
-module.exports = {
-
- /**
- * Converts an OpenSSH public key (rsa only) to a PKCS#8 PEM file.
- *
- * The intent of this module is to interoperate with OpenSSL only,
- * specifically the node crypto module's `verify` method.
- *
- * @param {String} key an OpenSSH public key.
- * @return {String} PEM encoded form of the RSA public key.
- * @throws {TypeError} on bad input.
- * @throws {Error} on invalid ssh key formatted data.
- */
- sshKeyToPEM: function sshKeyToPEM(key) {
- assert.string(key, 'ssh_key');
-
- /* JSSTYLED */
- if (/^ssh-rsa.*/.test(key))
- return rsaToPEM(key);
-
- /* JSSTYLED */
- if (/^ssh-ds[as].*/.test(key))
- return dsaToPEM(key);
-
- throw new Error('Only RSA and DSA public keys are allowed');
- },
-
-
- /**
- * Generates an OpenSSH fingerprint from an ssh public key.
- *
- * @param {String} key an OpenSSH public key.
- * @return {String} key fingerprint.
- * @throws {TypeError} on bad input.
- * @throws {Error} if what you passed doesn't look like an ssh public key.
- */
- fingerprint: function fingerprint(key) {
- assert.string(key, 'ssh_key');
-
- var pieces = key.split(' ');
- if (!pieces || !pieces.length || pieces.length < 2)
- throw new Error('invalid ssh key');
-
- var data = new Buffer(pieces[1], 'base64');
-
- var hash = crypto.createHash('md5');
- hash.update(data);
- var digest = hash.digest('hex');
-
- var fp = '';
- for (var i = 0; i < digest.length; i++) {
- if (i && i % 2 === 0)
- fp += ':';
-
- fp += digest[i];
- }
-
- return fp;
- },
-
- /**
- * Converts a PKGCS#8 PEM file to an OpenSSH public key (rsa)
- *
- * The reverse of the above function.
- */
- pemToRsaSSHKey: function pemToRsaSSHKey(pem, comment) {
- assert.equal('string', typeof pem, 'typeof pem');
-
- // chop off the BEGIN PUBLIC KEY and END PUBLIC KEY portion
- var cleaned = pem.split('\n').slice(1, -2).join('');
-
- var buf = new Buffer(cleaned, 'base64');
-
- var der = new asn1.BerReader(buf);
-
- der.readSequence();
- der.readSequence();
-
- var oid = der.readOID();
- assert.equal(oid, '1.2.840.113549.1.1.1', 'pem not in RSA format');
-
- // Null -- XXX this probably isn't good practice
- der.readByte();
- der.readByte();
-
- // bit string sequence
- der.readSequence(0x03);
- der.readByte();
- der.readSequence();
-
- // modulus
- assert.equal(der.peek(), asn1.Ber.Integer, 'modulus not an integer');
- der._offset = der.readLength(der.offset + 1);
- var modulus = der._buf.slice(der.offset, der.offset + der.length);
- der._offset += der.length;
-
- // exponent
- assert.equal(der.peek(), asn1.Ber.Integer, 'exponent not an integer');
- der._offset = der.readLength(der.offset + 1);
- var exponent = der._buf.slice(der.offset, der.offset + der.length);
- der._offset += der.length;
-
- // now, make the key
- var type = new Buffer('ssh-rsa');
- var buffer = new Buffer(4 + type.length + 4 + modulus.length + 4 + exponent.length);
- var i = 0;
- buffer.writeUInt32BE(type.length, i); i += 4;
- type.copy(buffer, i); i += type.length;
- buffer.writeUInt32BE(exponent.length, i); i += 4;
- exponent.copy(buffer, i); i += exponent.length;
- buffer.writeUInt32BE(modulus.length, i); i += 4;
- modulus.copy(buffer, i); i += modulus.length;
-
- var s = type.toString() + ' ' + buffer.toString('base64') + ' ' + (comment || '');
- return s;
- }
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/lib/verify.js
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/lib/verify.js b/node_modules/request/node_modules/http-signature/lib/verify.js
deleted file mode 100644
index 5bf9589..0000000
--- a/node_modules/request/node_modules/http-signature/lib/verify.js
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2011 Joyent, Inc. All rights reserved.
-
-var assert = require('assert-plus');
-var crypto = require('crypto');
-
-
-
-///--- Exported API
-
-module.exports = {
-
- /**
- * Simply wraps up the node crypto operations for you, and returns
- * true or false. You are expected to pass in an object that was
- * returned from `parse()`.
- *
- * @param {Object} parsedSignature the object you got from `parse`.
- * @param {String} key either an RSA private key PEM or HMAC secret.
- * @return {Boolean} true if valid, false otherwise.
- * @throws {TypeError} if you pass in bad arguments.
- */
- verifySignature: function verifySignature(parsedSignature, key) {
- assert.object(parsedSignature, 'parsedSignature');
- assert.string(key, 'key');
-
- var alg = parsedSignature.algorithm.match(/(HMAC|RSA|DSA)-(\w+)/);
- if (!alg || alg.length !== 3)
- throw new TypeError('parsedSignature: unsupported algorithm ' +
- parsedSignature.algorithm);
-
- if (alg[1] === 'HMAC') {
- var hmac = crypto.createHmac(alg[2].toUpperCase(), key);
- hmac.update(parsedSignature.signingString);
- return (hmac.digest('base64') === parsedSignature.params.signature);
- } else {
- var verify = crypto.createVerify(alg[0]);
- verify.update(parsedSignature.signingString);
- return verify.verify(key, parsedSignature.params.signature, 'base64');
- }
- }
-
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore b/node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore
deleted file mode 100644
index eb03e3e..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore
+++ /dev/null
@@ -1,2 +0,0 @@
-node_modules
-*.log
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE b/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE
deleted file mode 100644
index 9b5dcdb..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2011 Mark Cavage, All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md b/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md
deleted file mode 100644
index 7cebf7a..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md
+++ /dev/null
@@ -1,50 +0,0 @@
-node-asn1 is a library for encoding and decoding ASN.1 datatypes in pure JS.
-Currently BER encoding is supported; at some point I'll likely have to do DER.
-
-## Usage
-
-Mostly, if you're *actually* needing to read and write ASN.1, you probably don't
-need this readme to explain what and why. If you have no idea what ASN.1 is,
-see this: ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc
-
-The source is pretty much self-explanatory, and has read/write methods for the
-common types out there.
-
-### Decoding
-
-The following reads an ASN.1 sequence with a boolean.
-
- var Ber = require('asn1').Ber;
-
- var reader = new Ber.Reader(new Buffer([0x30, 0x03, 0x01, 0x01, 0xff]));
-
- reader.readSequence();
- console.log('Sequence len: ' + reader.length);
- if (reader.peek() === Ber.Boolean)
- console.log(reader.readBoolean());
-
-### Encoding
-
-The following generates the same payload as above.
-
- var Ber = require('asn1').Ber;
-
- var writer = new Ber.Writer();
-
- writer.startSequence();
- writer.writeBoolean(true);
- writer.endSequence();
-
- console.log(writer.buffer);
-
-## Installation
-
- npm install asn1
-
-## License
-
-MIT.
-
-## Bugs
-
-See <https://github.com/mcavage/node-asn1/issues>.
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js b/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js
deleted file mode 100644
index ff21d4f..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2011 Mark Cavage <mc...@gmail.com> All rights reserved.
-
-
-module.exports = {
-
- newInvalidAsn1Error: function(msg) {
- var e = new Error();
- e.name = 'InvalidAsn1Error';
- e.message = msg || '';
- return e;
- }
-
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js b/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js
deleted file mode 100644
index 4fb90ae..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2011 Mark Cavage <mc...@gmail.com> All rights reserved.
-
-var errors = require('./errors');
-var types = require('./types');
-
-var Reader = require('./reader');
-var Writer = require('./writer');
-
-
-///--- Exports
-
-module.exports = {
-
- Reader: Reader,
-
- Writer: Writer
-
-};
-
-for (var t in types) {
- if (types.hasOwnProperty(t))
- module.exports[t] = types[t];
-}
-for (var e in errors) {
- if (errors.hasOwnProperty(e))
- module.exports[e] = errors[e];
-}
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js b/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js
deleted file mode 100644
index bd3357a..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js
+++ /dev/null
@@ -1,267 +0,0 @@
-// Copyright 2011 Mark Cavage <mc...@gmail.com> All rights reserved.
-
-var assert = require('assert');
-
-var ASN1 = require('./types');
-var errors = require('./errors');
-
-
-///--- Globals
-
-var newInvalidAsn1Error = errors.newInvalidAsn1Error;
-
-
-
-///--- API
-
-function Reader(data) {
- if (!data || !Buffer.isBuffer(data))
- throw new TypeError('data must be a node Buffer');
-
- this._buf = data;
- this._size = data.length;
-
- // These hold the "current" state
- this._len = 0;
- this._offset = 0;
-
- var self = this;
- this.__defineGetter__('length', function() { return self._len; });
- this.__defineGetter__('offset', function() { return self._offset; });
- this.__defineGetter__('remain', function() {
- return self._size - self._offset;
- });
- this.__defineGetter__('buffer', function() {
- return self._buf.slice(self._offset);
- });
-}
-
-
-/**
- * Reads a single byte and advances offset; you can pass in `true` to make this
- * a "peek" operation (i.e., get the byte, but don't advance the offset).
- *
- * @param {Boolean} peek true means don't move offset.
- * @return {Number} the next byte, null if not enough data.
- */
-Reader.prototype.readByte = function(peek) {
- if (this._size - this._offset < 1)
- return null;
-
- var b = this._buf[this._offset] & 0xff;
-
- if (!peek)
- this._offset += 1;
-
- return b;
-};
-
-
-Reader.prototype.peek = function() {
- return this.readByte(true);
-};
-
-
-/**
- * Reads a (potentially) variable length off the BER buffer. This call is
- * not really meant to be called directly, as callers have to manipulate
- * the internal buffer afterwards.
- *
- * As a result of this call, you can call `Reader.length`, until the
- * next thing called that does a readLength.
- *
- * @return {Number} the amount of offset to advance the buffer.
- * @throws {InvalidAsn1Error} on bad ASN.1
- */
-Reader.prototype.readLength = function(offset) {
- if (offset === undefined)
- offset = this._offset;
-
- if (offset >= this._size)
- return null;
-
- var lenB = this._buf[offset++] & 0xff;
- if (lenB === null)
- return null;
-
- if ((lenB & 0x80) == 0x80) {
- lenB &= 0x7f;
-
- if (lenB == 0)
- throw newInvalidAsn1Error('Indefinite length not supported');
-
- if (lenB > 4)
- throw newInvalidAsn1Error('encoding too long');
-
- if (this._size - offset < lenB)
- return null;
-
- this._len = 0;
- for (var i = 0; i < lenB; i++)
- this._len = (this._len << 8) + (this._buf[offset++] & 0xff);
-
- } else {
- // Wasn't a variable length
- this._len = lenB;
- }
-
- return offset;
-};
-
-
-/**
- * Parses the next sequence in this BER buffer.
- *
- * To get the length of the sequence, call `Reader.length`.
- *
- * @return {Number} the sequence's tag.
- */
-Reader.prototype.readSequence = function(tag) {
- var seq = this.peek();
- if (seq === null)
- return null;
- if (tag !== undefined && tag !== seq)
- throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
- ': got 0x' + seq.toString(16));
-
- var o = this.readLength(this._offset + 1); // stored in `length`
- if (o === null)
- return null;
-
- this._offset = o;
- return seq;
-};
-
-
-Reader.prototype.readInt = function() {
- return this._readTag(ASN1.Integer);
-};
-
-
-Reader.prototype.readBoolean = function() {
- return (this._readTag(ASN1.Boolean) === 0 ? false : true);
-};
-
-
-Reader.prototype.readEnumeration = function() {
- return this._readTag(ASN1.Enumeration);
-};
-
-
-Reader.prototype.readString = function(tag, retbuf) {
- if (!tag)
- tag = ASN1.OctetString;
-
- var b = this.peek();
- if (b === null)
- return null;
-
- if (b !== tag)
- throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
- ': got 0x' + b.toString(16));
-
- var o = this.readLength(this._offset + 1); // stored in `length`
-
- if (o === null)
- return null;
-
- if (this.length > this._size - o)
- return null;
-
- this._offset = o;
-
- if (this.length === 0)
- return '';
-
- var str = this._buf.slice(this._offset, this._offset + this.length);
- this._offset += this.length;
-
- return retbuf ? str : str.toString('utf8');
-};
-
-Reader.prototype.readOID = function(tag) {
- if (!tag)
- tag = ASN1.OID;
-
- var b = this.peek();
- if (b === null)
- return null;
-
- if (b !== tag)
- throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
- ': got 0x' + b.toString(16));
-
- var o = this.readLength(this._offset + 1); // stored in `length`
- if (o === null)
- return null;
-
- if (this.length > this._size - o)
- return null;
-
- this._offset = o;
-
- var values = [];
- var value = 0;
-
- for (var i = 0; i < this.length; i++) {
- var byte = this._buf[this._offset++] & 0xff;
-
- value <<= 7;
- value += byte & 0x7f;
- if ((byte & 0x80) == 0) {
- values.push(value);
- value = 0;
- }
- }
-
- value = values.shift();
- values.unshift(value % 40);
- values.unshift((value / 40) >> 0);
-
- return values.join('.');
-};
-
-
-Reader.prototype._readTag = function(tag) {
- assert.ok(tag !== undefined);
-
- var b = this.peek();
-
- if (b === null)
- return null;
-
- if (b !== tag)
- throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
- ': got 0x' + b.toString(16));
-
- var o = this.readLength(this._offset + 1); // stored in `length`
- if (o === null)
- return null;
-
- if (this.length > 4)
- throw newInvalidAsn1Error('Integer too long: ' + this.length);
-
- if (this.length > this._size - o)
- return null;
- this._offset = o;
-
- var fb = this._buf[this._offset++];
- var value = 0;
-
- value = fb & 0x7F;
- for (var i = 1; i < this.length; i++) {
- value <<= 8;
- value |= (this._buf[this._offset++] & 0xff);
- }
-
- if ((fb & 0x80) == 0x80)
- value = -value;
-
- return value;
-};
-
-
-
-///--- Exported API
-
-module.exports = Reader;
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js b/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js
deleted file mode 100644
index 8aea000..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2011 Mark Cavage <mc...@gmail.com> All rights reserved.
-
-
-module.exports = {
- EOC: 0,
- Boolean: 1,
- Integer: 2,
- BitString: 3,
- OctetString: 4,
- Null: 5,
- OID: 6,
- ObjectDescriptor: 7,
- External: 8,
- Real: 9, // float
- Enumeration: 10,
- PDV: 11,
- Utf8String: 12,
- RelativeOID: 13,
- Sequence: 16,
- Set: 17,
- NumericString: 18,
- PrintableString: 19,
- T61String: 20,
- VideotexString: 21,
- IA5String: 22,
- UTCTime: 23,
- GeneralizedTime: 24,
- GraphicString: 25,
- VisibleString: 26,
- GeneralString: 28,
- UniversalString: 29,
- CharacterString: 30,
- BMPString: 31,
- Constructor: 32,
- Context: 128
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js b/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js
deleted file mode 100644
index 7b445cc..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js
+++ /dev/null
@@ -1,317 +0,0 @@
-// Copyright 2011 Mark Cavage <mc...@gmail.com> All rights reserved.
-
-var assert = require('assert');
-var ASN1 = require('./types');
-var errors = require('./errors');
-
-
-///--- Globals
-
-var newInvalidAsn1Error = errors.newInvalidAsn1Error;
-
-var DEFAULT_OPTS = {
- size: 1024,
- growthFactor: 8
-};
-
-
-///--- Helpers
-
-function merge(from, to) {
- assert.ok(from);
- assert.equal(typeof(from), 'object');
- assert.ok(to);
- assert.equal(typeof(to), 'object');
-
- var keys = Object.getOwnPropertyNames(from);
- keys.forEach(function(key) {
- if (to[key])
- return;
-
- var value = Object.getOwnPropertyDescriptor(from, key);
- Object.defineProperty(to, key, value);
- });
-
- return to;
-}
-
-
-
-///--- API
-
-function Writer(options) {
- options = merge(DEFAULT_OPTS, options || {});
-
- this._buf = new Buffer(options.size || 1024);
- this._size = this._buf.length;
- this._offset = 0;
- this._options = options;
-
- // A list of offsets in the buffer where we need to insert
- // sequence tag/len pairs.
- this._seq = [];
-
- var self = this;
- this.__defineGetter__('buffer', function() {
- if (self._seq.length)
- throw new InvalidAsn1Error(self._seq.length + ' unended sequence(s)');
-
- return self._buf.slice(0, self._offset);
- });
-}
-
-
-Writer.prototype.writeByte = function(b) {
- if (typeof(b) !== 'number')
- throw new TypeError('argument must be a Number');
-
- this._ensure(1);
- this._buf[this._offset++] = b;
-};
-
-
-Writer.prototype.writeInt = function(i, tag) {
- if (typeof(i) !== 'number')
- throw new TypeError('argument must be a Number');
- if (typeof(tag) !== 'number')
- tag = ASN1.Integer;
-
- var sz = 4;
-
- while ((((i & 0xff800000) === 0) || ((i & 0xff800000) === 0xff800000)) &&
- (sz > 1)) {
- sz--;
- i <<= 8;
- }
-
- if (sz > 4)
- throw new InvalidAsn1Error('BER ints cannot be > 0xffffffff');
-
- this._ensure(2 + sz);
- this._buf[this._offset++] = tag;
- this._buf[this._offset++] = sz;
-
- while (sz-- > 0) {
- this._buf[this._offset++] = ((i & 0xff000000) >> 24);
- i <<= 8;
- }
-
-};
-
-
-Writer.prototype.writeNull = function() {
- this.writeByte(ASN1.Null);
- this.writeByte(0x00);
-};
-
-
-Writer.prototype.writeEnumeration = function(i, tag) {
- if (typeof(i) !== 'number')
- throw new TypeError('argument must be a Number');
- if (typeof(tag) !== 'number')
- tag = ASN1.Enumeration;
-
- return this.writeInt(i, tag);
-};
-
-
-Writer.prototype.writeBoolean = function(b, tag) {
- if (typeof(b) !== 'boolean')
- throw new TypeError('argument must be a Boolean');
- if (typeof(tag) !== 'number')
- tag = ASN1.Boolean;
-
- this._ensure(3);
- this._buf[this._offset++] = tag;
- this._buf[this._offset++] = 0x01;
- this._buf[this._offset++] = b ? 0xff : 0x00;
-};
-
-
-Writer.prototype.writeString = function(s, tag) {
- if (typeof(s) !== 'string')
- throw new TypeError('argument must be a string (was: ' + typeof(s) + ')');
- if (typeof(tag) !== 'number')
- tag = ASN1.OctetString;
-
- var len = Buffer.byteLength(s);
- this.writeByte(tag);
- this.writeLength(len);
- if (len) {
- this._ensure(len);
- this._buf.write(s, this._offset);
- this._offset += len;
- }
-};
-
-
-Writer.prototype.writeBuffer = function(buf, tag) {
- if (typeof(tag) !== 'number')
- throw new TypeError('tag must be a number');
- if (!Buffer.isBuffer(buf))
- throw new TypeError('argument must be a buffer');
-
- this.writeByte(tag);
- this.writeLength(buf.length);
- this._ensure(buf.length);
- buf.copy(this._buf, this._offset, 0, buf.length);
- this._offset += buf.length;
-};
-
-
-Writer.prototype.writeStringArray = function(strings) {
- if ((!strings instanceof Array))
- throw new TypeError('argument must be an Array[String]');
-
- var self = this;
- strings.forEach(function(s) {
- self.writeString(s);
- });
-};
-
-// This is really to solve DER cases, but whatever for now
-Writer.prototype.writeOID = function(s, tag) {
- if (typeof(s) !== 'string')
- throw new TypeError('argument must be a string');
- if (typeof(tag) !== 'number')
- tag = ASN1.OID;
-
- if (!/^([0-9]+\.){3,}[0-9]+$/.test(s))
- throw new Error('argument is not a valid OID string');
-
- function encodeOctet(bytes, octet) {
- if (octet < 128) {
- bytes.push(octet);
- } else if (octet < 16384) {
- bytes.push((octet >>> 7) | 0x80);
- bytes.push(octet & 0x7F);
- } else if (octet < 2097152) {
- bytes.push((octet >>> 14) | 0x80);
- bytes.push(((octet >>> 7) | 0x80) & 0xFF);
- bytes.push(octet & 0x7F);
- } else if (octet < 268435456) {
- bytes.push((octet >>> 21) | 0x80);
- bytes.push(((octet >>> 14) | 0x80) & 0xFF);
- bytes.push(((octet >>> 7) | 0x80) & 0xFF);
- bytes.push(octet & 0x7F);
- } else {
- bytes.push(((octet >>> 28) | 0x80) & 0xFF);
- bytes.push(((octet >>> 21) | 0x80) & 0xFF);
- bytes.push(((octet >>> 14) | 0x80) & 0xFF);
- bytes.push(((octet >>> 7) | 0x80) & 0xFF);
- bytes.push(octet & 0x7F);
- }
- }
-
- var tmp = s.split('.');
- var bytes = [];
- bytes.push(parseInt(tmp[0], 10) * 40 + parseInt(tmp[1], 10));
- tmp.slice(2).forEach(function(b) {
- encodeOctet(bytes, parseInt(b, 10));
- });
-
- var self = this;
- this._ensure(2 + bytes.length);
- this.writeByte(tag);
- this.writeLength(bytes.length);
- bytes.forEach(function(b) {
- self.writeByte(b);
- });
-};
-
-
-Writer.prototype.writeLength = function(len) {
- if (typeof(len) !== 'number')
- throw new TypeError('argument must be a Number');
-
- this._ensure(4);
-
- if (len <= 0x7f) {
- this._buf[this._offset++] = len;
- } else if (len <= 0xff) {
- this._buf[this._offset++] = 0x81;
- this._buf[this._offset++] = len;
- } else if (len <= 0xffff) {
- this._buf[this._offset++] = 0x82;
- this._buf[this._offset++] = len >> 8;
- this._buf[this._offset++] = len;
- } else if (len <= 0xffffff) {
- this._shift(start, len, 1);
- this._buf[this._offset++] = 0x83;
- this._buf[this._offset++] = len >> 16;
- this._buf[this._offset++] = len >> 8;
- this._buf[this._offset++] = len;
- } else {
- throw new InvalidAsn1ERror('Length too long (> 4 bytes)');
- }
-};
-
-Writer.prototype.startSequence = function(tag) {
- if (typeof(tag) !== 'number')
- tag = ASN1.Sequence | ASN1.Constructor;
-
- this.writeByte(tag);
- this._seq.push(this._offset);
- this._ensure(3);
- this._offset += 3;
-};
-
-
-Writer.prototype.endSequence = function() {
- var seq = this._seq.pop();
- var start = seq + 3;
- var len = this._offset - start;
-
- if (len <= 0x7f) {
- this._shift(start, len, -2);
- this._buf[seq] = len;
- } else if (len <= 0xff) {
- this._shift(start, len, -1);
- this._buf[seq] = 0x81;
- this._buf[seq + 1] = len;
- } else if (len <= 0xffff) {
- this._buf[seq] = 0x82;
- this._buf[seq + 1] = len >> 8;
- this._buf[seq + 2] = len;
- } else if (len <= 0xffffff) {
- this._shift(start, len, 1);
- this._buf[seq] = 0x83;
- this._buf[seq + 1] = len >> 16;
- this._buf[seq + 2] = len >> 8;
- this._buf[seq + 3] = len;
- } else {
- throw new InvalidAsn1Error('Sequence too long');
- }
-};
-
-
-Writer.prototype._shift = function(start, len, shift) {
- assert.ok(start !== undefined);
- assert.ok(len !== undefined);
- assert.ok(shift);
-
- this._buf.copy(this._buf, start + shift, start, start + len);
- this._offset += shift;
-};
-
-Writer.prototype._ensure = function(len) {
- assert.ok(len);
-
- if (this._size - this._offset < len) {
- var sz = this._size * this._options.growthFactor;
- if (sz - this._offset < len)
- sz += len;
-
- var buf = new Buffer(sz);
-
- this._buf.copy(buf, 0, 0, this._offset);
- this._buf = buf;
- this._size = sz;
- }
-};
-
-
-
-///--- Exported API
-
-module.exports = Writer;
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js b/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js
deleted file mode 100644
index d1766e7..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2011 Mark Cavage <mc...@gmail.com> All rights reserved.
-
-// If you have no idea what ASN.1 or BER is, see this:
-// ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc
-
-var Ber = require('./ber/index');
-
-
-
-///--- Exported API
-
-module.exports = {
-
- Ber: Ber,
-
- BerReader: Ber.Reader,
-
- BerWriter: Ber.Writer
-
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json b/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json
deleted file mode 100644
index 8c68193..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json
+++ /dev/null
@@ -1,63 +0,0 @@
-{
- "author": {
- "name": "Mark Cavage",
- "email": "mcavage@gmail.com"
- },
- "contributors": [
- {
- "name": "David Gwynne",
- "email": "loki@animata.net"
- },
- {
- "name": "Yunong Xiao",
- "email": "yunong@joyent.com"
- }
- ],
- "name": "asn1",
- "description": "Contains parsers and serializers for ASN.1 (currently BER only)",
- "version": "0.1.11",
- "repository": {
- "type": "git",
- "url": "git://github.com/mcavage/node-asn1.git"
- },
- "main": "lib/index.js",
- "engines": {
- "node": ">=0.4.9"
- },
- "dependencies": {},
- "devDependencies": {
- "tap": "0.1.4"
- },
- "scripts": {
- "pretest": "which gjslint; if [[ \"$?\" = 0 ]] ; then gjslint --nojsdoc -r lib -r tst; else echo \"Missing gjslint. Skipping lint\"; fi",
- "test": "tap ./tst"
- },
- "_npmUser": {
- "name": "mcavage",
- "email": "mcavage@gmail.com"
- },
- "_id": "asn1@0.1.11",
- "_engineSupported": true,
- "_npmVersion": "1.1.0-beta-4",
- "_nodeVersion": "v0.6.6",
- "_defaultsLoaded": true,
- "dist": {
- "shasum": "559be18376d08a4ec4dbe80877d27818639b2df7",
- "tarball": "http://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz"
- },
- "maintainers": [
- {
- "name": "mcavage",
- "email": "mcavage@gmail.com"
- }
- ],
- "directories": {},
- "_shasum": "559be18376d08a4ec4dbe80877d27818639b2df7",
- "_resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz",
- "_from": "asn1@0.1.11",
- "bugs": {
- "url": "https://github.com/mcavage/node-asn1/issues"
- },
- "readme": "ERROR: No README data found!",
- "homepage": "https://github.com/mcavage/node-asn1"
-}
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js b/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js
deleted file mode 100644
index 0b78b47..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js
+++ /dev/null
@@ -1,172 +0,0 @@
-// Copyright 2011 Mark Cavage <mc...@gmail.com> All rights reserved.
-
-var test = require('tap').test;
-
-
-
-///--- Globals
-
-var BerReader;
-
-
-
-///--- Tests
-
-test('load library', function(t) {
- BerReader = require('../../lib/index').BerReader;
- t.ok(BerReader);
- try {
- new BerReader();
- t.fail('Should have thrown');
- } catch (e) {
- t.ok(e instanceof TypeError, 'Should have been a type error');
- }
- t.end();
-});
-
-
-test('read byte', function(t) {
- var reader = new BerReader(new Buffer([0xde]));
- t.ok(reader);
- t.equal(reader.readByte(), 0xde, 'wrong value');
- t.end();
-});
-
-
-test('read 1 byte int', function(t) {
- var reader = new BerReader(new Buffer([0x02, 0x01, 0x03]));
- t.ok(reader);
- t.equal(reader.readInt(), 0x03, 'wrong value');
- t.equal(reader.length, 0x01, 'wrong length');
- t.end();
-});
-
-
-test('read 2 byte int', function(t) {
- var reader = new BerReader(new Buffer([0x02, 0x02, 0x7e, 0xde]));
- t.ok(reader);
- t.equal(reader.readInt(), 0x7ede, 'wrong value');
- t.equal(reader.length, 0x02, 'wrong length');
- t.end();
-});
-
-
-test('read 3 byte int', function(t) {
- var reader = new BerReader(new Buffer([0x02, 0x03, 0x7e, 0xde, 0x03]));
- t.ok(reader);
- t.equal(reader.readInt(), 0x7ede03, 'wrong value');
- t.equal(reader.length, 0x03, 'wrong length');
- t.end();
-});
-
-
-test('read 4 byte int', function(t) {
- var reader = new BerReader(new Buffer([0x02, 0x04, 0x7e, 0xde, 0x03, 0x01]));
- t.ok(reader);
- t.equal(reader.readInt(), 0x7ede0301, 'wrong value');
- t.equal(reader.length, 0x04, 'wrong length');
- t.end();
-});
-
-
-test('read boolean true', function(t) {
- var reader = new BerReader(new Buffer([0x01, 0x01, 0xff]));
- t.ok(reader);
- t.equal(reader.readBoolean(), true, 'wrong value');
- t.equal(reader.length, 0x01, 'wrong length');
- t.end();
-});
-
-
-test('read boolean false', function(t) {
- var reader = new BerReader(new Buffer([0x01, 0x01, 0x00]));
- t.ok(reader);
- t.equal(reader.readBoolean(), false, 'wrong value');
- t.equal(reader.length, 0x01, 'wrong length');
- t.end();
-});
-
-
-test('read enumeration', function(t) {
- var reader = new BerReader(new Buffer([0x0a, 0x01, 0x20]));
- t.ok(reader);
- t.equal(reader.readEnumeration(), 0x20, 'wrong value');
- t.equal(reader.length, 0x01, 'wrong length');
- t.end();
-});
-
-
-test('read string', function(t) {
- var dn = 'cn=foo,ou=unit,o=test';
- var buf = new Buffer(dn.length + 2);
- buf[0] = 0x04;
- buf[1] = Buffer.byteLength(dn);
- buf.write(dn, 2);
- var reader = new BerReader(buf);
- t.ok(reader);
- t.equal(reader.readString(), dn, 'wrong value');
- t.equal(reader.length, dn.length, 'wrong length');
- t.end();
-});
-
-
-test('read sequence', function(t) {
- var reader = new BerReader(new Buffer([0x30, 0x03, 0x01, 0x01, 0xff]));
- t.ok(reader);
- t.equal(reader.readSequence(), 0x30, 'wrong value');
- t.equal(reader.length, 0x03, 'wrong length');
- t.equal(reader.readBoolean(), true, 'wrong value');
- t.equal(reader.length, 0x01, 'wrong length');
- t.end();
-});
-
-
-test('anonymous LDAPv3 bind', function(t) {
- var BIND = new Buffer(14);
- BIND[0] = 0x30; // Sequence
- BIND[1] = 12; // len
- BIND[2] = 0x02; // ASN.1 Integer
- BIND[3] = 1; // len
- BIND[4] = 0x04; // msgid (make up 4)
- BIND[5] = 0x60; // Bind Request
- BIND[6] = 7; // len
- BIND[7] = 0x02; // ASN.1 Integer
- BIND[8] = 1; // len
- BIND[9] = 0x03; // v3
- BIND[10] = 0x04; // String (bind dn)
- BIND[11] = 0; // len
- BIND[12] = 0x80; // ContextSpecific (choice)
- BIND[13] = 0; // simple bind
-
- // Start testing ^^
- var ber = new BerReader(BIND);
- t.equal(ber.readSequence(), 48, 'Not an ASN.1 Sequence');
- t.equal(ber.length, 12, 'Message length should be 12');
- t.equal(ber.readInt(), 4, 'Message id should have been 4');
- t.equal(ber.readSequence(), 96, 'Bind Request should have been 96');
- t.equal(ber.length, 7, 'Bind length should have been 7');
- t.equal(ber.readInt(), 3, 'LDAP version should have been 3');
- t.equal(ber.readString(), '', 'Bind DN should have been empty');
- t.equal(ber.length, 0, 'string length should have been 0');
- t.equal(ber.readByte(), 0x80, 'Should have been ContextSpecific (choice)');
- t.equal(ber.readByte(), 0, 'Should have been simple bind');
- t.equal(null, ber.readByte(), 'Should be out of data');
- t.end();
-});
-
-
-test('long string', function(t) {
- var buf = new Buffer(256);
- var o;
- var s =
- '2;649;CN=Red Hat CS 71GA Demo,O=Red Hat CS 71GA Demo,C=US;' +
- 'CN=RHCS Agent - admin01,UID=admin01,O=redhat,C=US [1] This is ' +
- 'Teena Vradmin\'s description.';
- buf[0] = 0x04;
- buf[1] = 0x81;
- buf[2] = 0x94;
- buf.write(s, 3);
- var ber = new BerReader(buf.slice(0, 3 + s.length));
- t.equal(ber.readString(), s);
- t.end();
-});
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js b/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js
deleted file mode 100644
index add0b9f..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js
+++ /dev/null
@@ -1,296 +0,0 @@
-// Copyright 2011 Mark Cavage <mc...@gmail.com> All rights reserved.
-
-var test = require('tap').test;
-var sys = require('sys');
-
-///--- Globals
-
-var BerWriter;
-
-var BerReader;
-
-
-///--- Tests
-
-test('load library', function(t) {
- BerWriter = require('../../lib/index').BerWriter;
- t.ok(BerWriter);
- t.ok(new BerWriter());
- t.end();
-});
-
-
-test('write byte', function(t) {
- var writer = new BerWriter();
-
- writer.writeByte(0xC2);
- var ber = writer.buffer;
-
- t.ok(ber);
- t.equal(ber.length, 1, 'Wrong length');
- t.equal(ber[0], 0xC2, 'value wrong');
-
- t.end();
-});
-
-
-test('write 1 byte int', function(t) {
- var writer = new BerWriter();
-
- writer.writeInt(0x7f);
- var ber = writer.buffer;
-
- t.ok(ber);
- t.equal(ber.length, 3, 'Wrong length for an int: ' + ber.length);
- t.equal(ber[0], 0x02, 'ASN.1 tag wrong (2) -> ' + ber[0]);
- t.equal(ber[1], 0x01, 'length wrong(1) -> ' + ber[1]);
- t.equal(ber[2], 0x7f, 'value wrong(3) -> ' + ber[2]);
-
- t.end();
-});
-
-
-test('write 2 byte int', function(t) {
- var writer = new BerWriter();
-
- writer.writeInt(0x7ffe);
- var ber = writer.buffer;
-
- t.ok(ber);
- t.equal(ber.length, 4, 'Wrong length for an int');
- t.equal(ber[0], 0x02, 'ASN.1 tag wrong');
- t.equal(ber[1], 0x02, 'length wrong');
- t.equal(ber[2], 0x7f, 'value wrong (byte 1)');
- t.equal(ber[3], 0xfe, 'value wrong (byte 2)');
-
- t.end();
-});
-
-
-test('write 3 byte int', function(t) {
- var writer = new BerWriter();
-
- writer.writeInt(0x7ffffe);
- var ber = writer.buffer;
-
- t.ok(ber);
- t.equal(ber.length, 5, 'Wrong length for an int');
- t.equal(ber[0], 0x02, 'ASN.1 tag wrong');
- t.equal(ber[1], 0x03, 'length wrong');
- t.equal(ber[2], 0x7f, 'value wrong (byte 1)');
- t.equal(ber[3], 0xff, 'value wrong (byte 2)');
- t.equal(ber[4], 0xfe, 'value wrong (byte 3)');
-
- t.end();
-});
-
-
-test('write 4 byte int', function(t) {
- var writer = new BerWriter();
-
- writer.writeInt(0x7ffffffe);
- var ber = writer.buffer;
-
- t.ok(ber);
-
- t.equal(ber.length, 6, 'Wrong length for an int');
- t.equal(ber[0], 0x02, 'ASN.1 tag wrong');
- t.equal(ber[1], 0x04, 'length wrong');
- t.equal(ber[2], 0x7f, 'value wrong (byte 1)');
- t.equal(ber[3], 0xff, 'value wrong (byte 2)');
- t.equal(ber[4], 0xff, 'value wrong (byte 3)');
- t.equal(ber[5], 0xfe, 'value wrong (byte 4)');
-
- t.end();
-});
-
-
-test('write boolean', function(t) {
- var writer = new BerWriter();
-
- writer.writeBoolean(true);
- writer.writeBoolean(false);
- var ber = writer.buffer;
-
- t.ok(ber);
- t.equal(ber.length, 6, 'Wrong length');
- t.equal(ber[0], 0x01, 'tag wrong');
- t.equal(ber[1], 0x01, 'length wrong');
- t.equal(ber[2], 0xff, 'value wrong');
- t.equal(ber[3], 0x01, 'tag wrong');
- t.equal(ber[4], 0x01, 'length wrong');
- t.equal(ber[5], 0x00, 'value wrong');
-
- t.end();
-});
-
-
-test('write string', function(t) {
- var writer = new BerWriter();
- writer.writeString('hello world');
- var ber = writer.buffer;
-
- t.ok(ber);
- t.equal(ber.length, 13, 'wrong length');
- t.equal(ber[0], 0x04, 'wrong tag');
- t.equal(ber[1], 11, 'wrong length');
- t.equal(ber.slice(2).toString('utf8'), 'hello world', 'wrong value');
-
- t.end();
-});
-
-test('write buffer', function(t) {
- var writer = new BerWriter();
- // write some stuff to start with
- writer.writeString('hello world');
- var ber = writer.buffer;
- var buf = new Buffer([0x04, 0x0b, 0x30, 0x09, 0x02, 0x01, 0x0f, 0x01, 0x01,
- 0xff, 0x01, 0x01, 0xff]);
- writer.writeBuffer(buf.slice(2, buf.length), 0x04);
- ber = writer.buffer;
-
- t.ok(ber);
- t.equal(ber.length, 26, 'wrong length');
- t.equal(ber[0], 0x04, 'wrong tag');
- t.equal(ber[1], 11, 'wrong length');
- t.equal(ber.slice(2, 13).toString('utf8'), 'hello world', 'wrong value');
- t.equal(ber[13], buf[0], 'wrong tag');
- t.equal(ber[14], buf[1], 'wrong length');
- for (var i = 13, j = 0; i < ber.length && j < buf.length; i++, j++) {
- t.equal(ber[i], buf[j], 'buffer contents not identical');
- }
- t.end();
-});
-
-test('write string array', function(t) {
- var writer = new BerWriter();
- writer.writeStringArray(['hello world', 'fubar!']);
- var ber = writer.buffer;
-
- t.ok(ber);
-
- t.equal(ber.length, 21, 'wrong length');
- t.equal(ber[0], 0x04, 'wrong tag');
- t.equal(ber[1], 11, 'wrong length');
- t.equal(ber.slice(2, 13).toString('utf8'), 'hello world', 'wrong value');
-
- t.equal(ber[13], 0x04, 'wrong tag');
- t.equal(ber[14], 6, 'wrong length');
- t.equal(ber.slice(15).toString('utf8'), 'fubar!', 'wrong value');
-
- t.end();
-});
-
-
-test('resize internal buffer', function(t) {
- var writer = new BerWriter({size: 2});
- writer.writeString('hello world');
- var ber = writer.buffer;
-
- t.ok(ber);
- t.equal(ber.length, 13, 'wrong length');
- t.equal(ber[0], 0x04, 'wrong tag');
- t.equal(ber[1], 11, 'wrong length');
- t.equal(ber.slice(2).toString('utf8'), 'hello world', 'wrong value');
-
- t.end();
-});
-
-
-test('sequence', function(t) {
- var writer = new BerWriter({size: 25});
- writer.startSequence();
- writer.writeString('hello world');
- writer.endSequence();
- var ber = writer.buffer;
-
- t.ok(ber);
- console.log(ber);
- t.equal(ber.length, 15, 'wrong length');
- t.equal(ber[0], 0x30, 'wrong tag');
- t.equal(ber[1], 13, 'wrong length');
- t.equal(ber[2], 0x04, 'wrong tag');
- t.equal(ber[3], 11, 'wrong length');
- t.equal(ber.slice(4).toString('utf8'), 'hello world', 'wrong value');
-
- t.end();
-});
-
-
-test('nested sequence', function(t) {
- var writer = new BerWriter({size: 25});
- writer.startSequence();
- writer.writeString('hello world');
- writer.startSequence();
- writer.writeString('hello world');
- writer.endSequence();
- writer.endSequence();
- var ber = writer.buffer;
-
- t.ok(ber);
- t.equal(ber.length, 30, 'wrong length');
- t.equal(ber[0], 0x30, 'wrong tag');
- t.equal(ber[1], 28, 'wrong length');
- t.equal(ber[2], 0x04, 'wrong tag');
- t.equal(ber[3], 11, 'wrong length');
- t.equal(ber.slice(4, 15).toString('utf8'), 'hello world', 'wrong value');
- t.equal(ber[15], 0x30, 'wrong tag');
- t.equal(ber[16], 13, 'wrong length');
- t.equal(ber[17], 0x04, 'wrong tag');
- t.equal(ber[18], 11, 'wrong length');
- t.equal(ber.slice(19, 30).toString('utf8'), 'hello world', 'wrong value');
-
- t.end();
-});
-
-
-test('LDAP bind message', function(t) {
- var dn = 'cn=foo,ou=unit,o=test';
- var writer = new BerWriter();
- writer.startSequence();
- writer.writeInt(3); // msgid = 3
- writer.startSequence(0x60); // ldap bind
- writer.writeInt(3); // ldap v3
- writer.writeString(dn);
- writer.writeByte(0x80);
- writer.writeByte(0x00);
- writer.endSequence();
- writer.endSequence();
- var ber = writer.buffer;
-
- t.ok(ber);
- t.equal(ber.length, 35, 'wrong length (buffer)');
- t.equal(ber[0], 0x30, 'wrong tag');
- t.equal(ber[1], 33, 'wrong length');
- t.equal(ber[2], 0x02, 'wrong tag');
- t.equal(ber[3], 1, 'wrong length');
- t.equal(ber[4], 0x03, 'wrong value');
- t.equal(ber[5], 0x60, 'wrong tag');
- t.equal(ber[6], 28, 'wrong length');
- t.equal(ber[7], 0x02, 'wrong tag');
- t.equal(ber[8], 1, 'wrong length');
- t.equal(ber[9], 0x03, 'wrong value');
- t.equal(ber[10], 0x04, 'wrong tag');
- t.equal(ber[11], dn.length, 'wrong length');
- t.equal(ber.slice(12, 33).toString('utf8'), dn, 'wrong value');
- t.equal(ber[33], 0x80, 'wrong tag');
- t.equal(ber[34], 0x00, 'wrong len');
-
- t.end();
-});
-
-
-test('Write OID', function(t) {
- var oid = '1.2.840.113549.1.1.1';
- var writer = new BerWriter();
- writer.writeOID(oid);
-
- var ber = writer.buffer;
- t.ok(ber);
- console.log(require('util').inspect(ber));
- console.log(require('util').inspect(new Buffer([0x06, 0x09, 0x2a, 0x86,
- 0x48, 0x86, 0xf7, 0x0d,
- 0x01, 0x01, 0x01])));
-
- t.end();
-});
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md b/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md
deleted file mode 100644
index c0c3a53..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md
+++ /dev/null
@@ -1,126 +0,0 @@
-# node-assert-plus
-
-This library is a super small wrapper over node's assert module that has two
-things: (1) the ability to disable assertions with the environment variable
-NODE_NDEBUG, and (2) some API wrappers for argument testing. Like
-`assert.string(myArg, 'myArg')`. As a simple example, most of my code looks
-like this:
-
- var assert = require('assert-plus');
-
- function fooAccount(options, callback) {
- assert.object(options, 'options');
- assert.number(options.id, 'options.id);
- assert.bool(options.isManager, 'options.isManager');
- assert.string(options.name, 'options.name');
- assert.arrayOfString(options.email, 'options.email');
- assert.func(callback, 'callback');
-
- // Do stuff
- callback(null, {});
- }
-
-# API
-
-All methods that *aren't* part of node's core assert API are simply assumed to
-take an argument, and then a string 'name' that's not a message; `AssertionError`
-will be thrown if the assertion fails with a message like:
-
- AssertionError: foo (string) is required
- at test (/home/mark/work/foo/foo.js:3:9)
- at Object.<anonymous> (/home/mark/work/foo/foo.js:15:1)
- at Module._compile (module.js:446:26)
- at Object..js (module.js:464:10)
- at Module.load (module.js:353:31)
- at Function._load (module.js:311:12)
- at Array.0 (module.js:484:10)
- at EventEmitter._tickCallback (node.js:190:38)
-
-from:
-
- function test(foo) {
- assert.string(foo, 'foo');
- }
-
-There you go. You can check that arrays are of a homogenous type with `Arrayof$Type`:
-
- function test(foo) {
- assert.arrayOfString(foo, 'foo');
- }
-
-You can assert IFF an argument is not `undefined` (i.e., an optional arg):
-
- assert.optionalString(foo, 'foo');
-
-Lastly, you can opt-out of assertion checking altogether by setting the
-environment variable `NODE_NDEBUG=1`. This is pseudo-useful if you have
-lots of assertions, and don't want to pay `typeof ()` taxes to v8 in
-production.
-
-The complete list of APIs is:
-
-* assert.bool
-* assert.buffer
-* assert.func
-* assert.number
-* assert.object
-* assert.string
-* assert.arrayOfBool
-* assert.arrayOfFunc
-* assert.arrayOfNumber
-* assert.arrayOfObject
-* assert.arrayOfString
-* assert.optionalBool
-* assert.optionalBuffer
-* assert.optionalFunc
-* assert.optionalNumber
-* assert.optionalObject
-* assert.optionalString
-* assert.optionalArrayOfBool
-* assert.optionalArrayOfFunc
-* assert.optionalArrayOfNumber
-* assert.optionalArrayOfObject
-* assert.optionalArrayOfString
-* assert.AssertionError
-* assert.fail
-* assert.ok
-* assert.equal
-* assert.notEqual
-* assert.deepEqual
-* assert.notDeepEqual
-* assert.strictEqual
-* assert.notStrictEqual
-* assert.throws
-* assert.doesNotThrow
-* assert.ifError
-
-# Installation
-
- npm install assert-plus
-
-## License
-
-The MIT License (MIT)
-Copyright (c) 2012 Mark Cavage
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-## Bugs
-
-See <https://github.com/mcavage/node-assert-plus/issues>.
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js b/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js
deleted file mode 100644
index ff2ba02..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js
+++ /dev/null
@@ -1,245 +0,0 @@
-// Copyright (c) 2012, Mark Cavage. All rights reserved.
-
-var assert = require('assert');
-var Stream = require('stream').Stream;
-var util = require('util');
-
-
-
-///--- Globals
-
-var NDEBUG = process.env.NODE_NDEBUG || false;
-var UUID_REGEXP = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
-
-
-
-///--- Messages
-
-var ARRAY_TYPE_REQUIRED = '%s ([%s]) required';
-var TYPE_REQUIRED = '%s (%s) is required';
-
-
-
-///--- Internal
-
-function capitalize(str) {
- return (str.charAt(0).toUpperCase() + str.slice(1));
-}
-
-function uncapitalize(str) {
- return (str.charAt(0).toLowerCase() + str.slice(1));
-}
-
-function _() {
- return (util.format.apply(util, arguments));
-}
-
-
-function _assert(arg, type, name, stackFunc) {
- if (!NDEBUG) {
- name = name || type;
- stackFunc = stackFunc || _assert.caller;
- var t = typeof (arg);
-
- if (t !== type) {
- throw new assert.AssertionError({
- message: _(TYPE_REQUIRED, name, type),
- actual: t,
- expected: type,
- operator: '===',
- stackStartFunction: stackFunc
- });
- }
- }
-}
-
-
-function _instanceof(arg, type, name, stackFunc) {
- if (!NDEBUG) {
- name = name || type;
- stackFunc = stackFunc || _instanceof.caller;
-
- if (!(arg instanceof type)) {
- throw new assert.AssertionError({
- message: _(TYPE_REQUIRED, name, type.name),
- actual: _getClass(arg),
- expected: type.name,
- operator: 'instanceof',
- stackStartFunction: stackFunc
- });
- }
- }
-}
-
-function _getClass(object) {
- return (Object.prototype.toString.call(object).slice(8, -1));
-};
-
-
-
-///--- API
-
-function array(arr, type, name) {
- if (!NDEBUG) {
- name = name || type;
-
- if (!Array.isArray(arr)) {
- throw new assert.AssertionError({
- message: _(ARRAY_TYPE_REQUIRED, name, type),
- actual: typeof (arr),
- expected: 'array',
- operator: 'Array.isArray',
- stackStartFunction: array.caller
- });
- }
-
- for (var i = 0; i < arr.length; i++) {
- _assert(arr[i], type, name, array);
- }
- }
-}
-
-
-function bool(arg, name) {
- _assert(arg, 'boolean', name, bool);
-}
-
-
-function buffer(arg, name) {
- if (!Buffer.isBuffer(arg)) {
- throw new assert.AssertionError({
- message: _(TYPE_REQUIRED, name || '', 'Buffer'),
- actual: typeof (arg),
- expected: 'buffer',
- operator: 'Buffer.isBuffer',
- stackStartFunction: buffer
- });
- }
-}
-
-
-function func(arg, name) {
- _assert(arg, 'function', name);
-}
-
-
-function number(arg, name) {
- _assert(arg, 'number', name);
- if (!NDEBUG && (isNaN(arg) || !isFinite(arg))) {
- throw new assert.AssertionError({
- message: _(TYPE_REQUIRED, name, 'number'),
- actual: arg,
- expected: 'number',
- operator: 'isNaN',
- stackStartFunction: number
- });
- }
-}
-
-
-function object(arg, name) {
- _assert(arg, 'object', name);
-}
-
-
-function stream(arg, name) {
- _instanceof(arg, Stream, name);
-}
-
-
-function date(arg, name) {
- _instanceof(arg, Date, name);
-}
-
-function regexp(arg, name) {
- _instanceof(arg, RegExp, name);
-}
-
-
-function string(arg, name) {
- _assert(arg, 'string', name);
-}
-
-
-function uuid(arg, name) {
- string(arg, name);
- if (!NDEBUG && !UUID_REGEXP.test(arg)) {
- throw new assert.AssertionError({
- message: _(TYPE_REQUIRED, name, 'uuid'),
- actual: 'string',
- expected: 'uuid',
- operator: 'test',
- stackStartFunction: uuid
- });
- }
-}
-
-
-///--- Exports
-
-module.exports = {
- bool: bool,
- buffer: buffer,
- date: date,
- func: func,
- number: number,
- object: object,
- regexp: regexp,
- stream: stream,
- string: string,
- uuid: uuid
-};
-
-
-Object.keys(module.exports).forEach(function (k) {
- if (k === 'buffer')
- return;
-
- var name = 'arrayOf' + capitalize(k);
-
- if (k === 'bool')
- k = 'boolean';
- if (k === 'func')
- k = 'function';
- module.exports[name] = function (arg, name) {
- array(arg, k, name);
- };
-});
-
-Object.keys(module.exports).forEach(function (k) {
- var _name = 'optional' + capitalize(k);
- var s = uncapitalize(k.replace('arrayOf', ''));
- if (s === 'bool')
- s = 'boolean';
- if (s === 'func')
- s = 'function';
-
- if (k.indexOf('arrayOf') !== -1) {
- module.exports[_name] = function (arg, name) {
- if (!NDEBUG && arg !== undefined) {
- array(arg, s, name);
- }
- };
- } else {
- module.exports[_name] = function (arg, name) {
- if (!NDEBUG && arg !== undefined) {
- _assert(arg, s, name);
- }
- };
- }
-});
-
-
-// Reexport built-in assertions
-Object.keys(assert).forEach(function (k) {
- if (k === 'AssertionError') {
- module.exports[k] = assert[k];
- return;
- }
-
- module.exports[k] = function () {
- if (!NDEBUG) {
- assert[k].apply(assert[k], arguments);
- }
- };
-});
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json b/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json
deleted file mode 100644
index 1b935b6..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "author": {
- "name": "Mark Cavage",
- "email": "mcavage@gmail.com"
- },
- "name": "assert-plus",
- "description": "Extra assertions on top of node's assert module",
- "version": "0.1.5",
- "main": "./assert.js",
- "devDependencies": {},
- "optionalDependencies": {},
- "repository": {
- "type": "git",
- "url": "https://github.com/mcavage/node-assert-plus.git"
- },
- "engines": {
- "node": ">=0.8"
- },
- "bugs": {
- "url": "https://github.com/mcavage/node-assert-plus/issues"
- },
- "dependencies": {},
- "_id": "assert-plus@0.1.5",
- "dist": {
- "shasum": "ee74009413002d84cec7219c6ac811812e723160",
- "tarball": "http://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz"
- },
- "_from": "assert-plus@>=0.1.5 <0.2.0",
- "_npmVersion": "1.3.11",
- "_npmUser": {
- "name": "mcavage",
- "email": "mcavage@gmail.com"
- },
- "maintainers": [
- {
- "name": "mcavage",
- "email": "mcavage@gmail.com"
- }
- ],
- "directories": {},
- "_shasum": "ee74009413002d84cec7219c6ac811812e723160",
- "_resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz",
- "readme": "ERROR: No README data found!",
- "homepage": "https://github.com/mcavage/node-assert-plus",
- "scripts": {}
-}
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/ctype/.npmignore
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/ctype/.npmignore b/node_modules/request/node_modules/http-signature/node_modules/ctype/.npmignore
deleted file mode 100644
index dc6d3b2..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/ctype/.npmignore
+++ /dev/null
@@ -1 +0,0 @@
-tst/
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG b/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG
deleted file mode 100644
index 426da9e..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG
+++ /dev/null
@@ -1,78 +0,0 @@
-This contains tickets fixed in each version release in reverse chronological
-order. There is one ticket per line. Each commits message has the tickets fixed
-in it. The commit message also has the corresponding github issue. i.e. CTYPE-42
-would be issue 42. Each issue can be found at:
-https://github.com/rmustacc/node-ctype/issues/%d.
-
-v0.5.3
-CTYPE-50 Release 0.5.3
-Contributed by Nick Schonning:
-CTYPE-49 Add repository section to package.json
-Contributed by Jonathan Ong:
-CTYPE-48 Create .npmignore
-
-v0.5.2
-CTYPE-46 Release 0.5.2
-CTYPE-45 error in setEndian logic
-
-v0.5.1
-CTYPE-44 Release 0.5.1
-Contributed by Terin Stock:
-CTYPE-41 CTypeParser.writeStruct should return its offset
-Contributed by Terin Stock:
-CTYPE-42 int64_t returns wrong size
-
-v0.5.0
-CTYPE-40 Release 0.5.0
-CTYPE-39 want > 0.6 engine support
-
-v0.4.0
-CTYPE-37 Release v0.4.0
-CTYPE-6 want additional entry point for write
-CTYPE-20 Add 64-bit int support into core parser
-CTYPE-31 Fix bounds errors node/2129
-CTYPE-33 Update copyright holders
-CTYPE-34 ctf.js confuses sign bit.
-CTYPE-35 Make the README more useful for getting started
-CTYPE-36 want manual page on ctio functions
-
-v0.3.1
-CTYPE-29 Release 0.3.1
-CTYPE-28 Want v0.6 npm support
-
-v0.3.0
-CTYPE-27 Release v0.3.0
-CTYPE-26 Want alternate default char behavior
-
-v0.2.1
-CTYPE-25 Release v0.2.1
-CTYPE-24 Writing structs is busted
-
-v0.2.0:
-CTYPE-23 Release v0.2.0
-CTYPE-21 Add support for CTF JSON data
-CTYPE-22 Add Javascriptlint profile
-CTYPE-15 Pull in ctio updates from node/master
-
-v0.1.0:
-CTYPE-18 Bump version to v0.1.0
-CTYPE-17 Fix nested structures
-CTYPE-16 Remove extraneous logging
-CTYPE-14 toAbs64 and toApprox64 are not exported
-
-v0.0.3:
-CTYPE-12 Bump version to v0.0.3
-CTYPE-11 fix typo in wuint64
-CTYPE-10 Integrate jsstyle
-
-v0.0.2:
-CTYPE-8 dump npm version to v0.0.2
-CTYPE-9 want changelog
-CTYPE-7 fix typo in detypes.
-
-v0.0.1:
-CTYPE-5 Missing from NPM registry
-CTYPE-4 int16_t calls wrong read function
-CTYPE-3 API example types are missing quotes as strings
-CTYPE-2 doc missing 64-bit functions
-CTYPE-1 Need license
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE b/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE
deleted file mode 100644
index 22ced3e..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE
+++ /dev/null
@@ -1,24 +0,0 @@
-The following license applies to all files unless the file is specified below.
-Each file specified below has its license information embedded in it:
-
-tools/jsstyle
-
-Copyright 2011, Robert Mustacchi. All rights reserved.
-Copyright 2011, Joyent, Inc. All rights reserved.
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-IN THE SOFTWARE.
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/7ee4acde/node_modules/request/node_modules/http-signature/node_modules/ctype/README
----------------------------------------------------------------------
diff --git a/node_modules/request/node_modules/http-signature/node_modules/ctype/README b/node_modules/request/node_modules/http-signature/node_modules/ctype/README
deleted file mode 100644
index 4efd7ee..0000000
--- a/node_modules/request/node_modules/http-signature/node_modules/ctype/README
+++ /dev/null
@@ -1,82 +0,0 @@
-Node-CType is a way to read and write binary data in structured and easy to use
-format. Its name comes from the C header file.
-
-To get started, simply clone the repository or use npm to install it. Once it is
-there, simply require it.
-
-git clone git://github.com/rmustacc/node-ctype
-npm install ctype
-var mod_ctype = require('ctype')
-
-
-There are two APIs that you can use, depending on what abstraction you'd like.
-The low level API let's you read and write individual integers and floats from
-buffers. The higher level API let's you read and write structures of these. To
-illustrate this, let's looks look at how we would read and write a binary
-encoded x,y point.
-
-In C we would define this structure as follows:
-
-typedef struct point {
- uint16_t p_x;
- uint16_t p_y;
-} point_t;
-
-To read a binary encoded point from a Buffer, we first need to create a CType
-parser (where we specify the endian and other options) and add the typedef.
-
-var parser = new mod_ctype.Parser({ endian: 'big' });
-parser.typedef('point_t', [
- { x: { type: 'uint16_t' } },
- { y: { type: 'uint16_t' } }
-]);
-
-From here, given a buffer buf and an offset into it, we can read a point.
-
-var out = parser.readData([ { point: { type: 'point_t' } } ], buffer, 0);
-console.log(out);
-{ point: { x: 23, y: 42 } }
-
-Another way to get the same information would be to use the low level methods.
-Note that these require you to manually deal with the offset. Here's how we'd
-get the same values of x and y from the buffer.
-
-var x = mod_ctype.ruint16(buf, 'big', 0);
-var y = mod_ctype.ruint16(buf, 'big', 2);
-console.log(x + ', ' + y);
-23, 42
-
-The true power of this API comes from the ability to define and nest typedefs,
-just as you would in C. By default, the following types are defined by default.
-Note that they return a Number, unless indicated otherwise.
-
- * int8_t
- * int16_t
- * int32_t
- * int64_t (returns an array where val[0] << 32 + val[1] would be the value)
- * uint8_t
- * uint16_t
- * uint32_t
- * uint64_t (returns an array where val[0] << 32 + val[1] would be the value)
- * float
- * double
- * char (either returns a buffer with that character or a uint8_t)
- * char[] (returns an object with the buffer and the number of characters read which is either the total amount requested or until the first 0)
-
-
-ctf2json integration:
-
-Node-CType supports consuming the output of ctf2json. Once you read in a JSON file,
-all you have to do to add all the definitions it contains is:
-
-var data, parser;
-data = JSON.parse(parsedJSONData);
-parser = mod_ctype.parseCTF(data, { endian: 'big' });
-
-For more documentation, see the file README.old. Full documentation is in the
-process of being rewritten as a series of manual pages which will be available
-in the repository and online for viewing.
-
-To read the ctio manual page simple run, from the root of the workspace:
-
-man -Mman -s 3ctype ctio