From 0a6cdc566443c18f50995df29f5954c498261edf Mon Sep 17 00:00:00 2001 From: Mitra Ardron Date: Mon, 23 Oct 2017 21:15:35 -0700 Subject: [PATCH 1/4] Fix bug when adding lock on examples_keys --- examples/dweb_transport_ipfs_bundled.js | 5779 +++++++++++++---------- examples/example_keys.html | 5 +- examples/example_styles.css | 2 + 3 files changed, 3292 insertions(+), 2494 deletions(-) diff --git a/examples/dweb_transport_ipfs_bundled.js b/examples/dweb_transport_ipfs_bundled.js index a334c64..4ba9e9d 100644 --- a/examples/dweb_transport_ipfs_bundled.js +++ b/examples/dweb_transport_ipfs_bundled.js @@ -653,7 +653,7 @@ exports.transport = function(url) { return exports.transportpriority.find((t) => t.supports(url)) // First transport that can support this URL }; -},{"./AccessControlList":1,"./Block":2,"./CommonList":3,"./Errors":5,"./KeyChain":6,"./KeyPair":7,"./MutableBlock":8,"./Signature":9,"./SmartDict":10,"./StructuredBlock":11,"./TransportHTTP":13,"./TransportIPFS":14,"url":848}],5:[function(require,module,exports){ +},{"./AccessControlList":1,"./Block":2,"./CommonList":3,"./Errors":5,"./KeyChain":6,"./KeyPair":7,"./MutableBlock":8,"./Signature":9,"./SmartDict":10,"./StructuredBlock":11,"./TransportHTTP":13,"./TransportIPFS":14,"url":845}],5:[function(require,module,exports){ errors = {}; // These are equivalent of python exceptions, will log and raise alert in most cases - exceptions aren't caught @@ -1403,7 +1403,7 @@ exports = module.exports = KeyPair; }).call(this,require("buffer").Buffer) -},{"./Dweb":4,"./SmartDict":10,"buffer":144,"crypto":158,"libsodium-wrappers":543,"multihashes":624}],8:[function(require,module,exports){ +},{"./Dweb":4,"./SmartDict":10,"buffer":144,"crypto":158,"libsodium-wrappers":540,"multihashes":621}],8:[function(require,module,exports){ // ######### Parallel development to MutableBlock.py ######## const CommonList = require("./CommonList"); @@ -2205,7 +2205,7 @@ class Transport { } exports = module.exports = Transport; -},{"url":848}],13:[function(require,module,exports){ +},{"url":845}],13:[function(require,module,exports){ const Transport = require('./Transport.js'); const Dweb = require('./Dweb.js'); const sodium = require("libsodium-wrappers"); // Note for now this has to be Mitra's version as live version doesn't support urlsafebase64 @@ -2409,7 +2409,7 @@ class TransportHTTP extends Transport { exports = module.exports = TransportHTTP; -},{"./Dweb.js":4,"./Transport.js":12,"libsodium-wrappers":543,"node-fetch-npm":657}],14:[function(require,module,exports){ +},{"./Dweb.js":4,"./Transport.js":12,"libsodium-wrappers":540,"node-fetch-npm":654}],14:[function(require,module,exports){ (function (Buffer){ /* This Transport layers builds on IPFS and the YJS DB @@ -2968,7 +2968,7 @@ class TransportIPFS extends Transport { exports = module.exports = TransportIPFS; }).call(this,require("buffer").Buffer) -},{"./Dweb":4,"./Transport":12,"buffer":144,"cids":146,"ipfs":385,"promisify-es6":684,"url":848,"y-array":866,"y-indexeddb":867,"y-ipfs-connector":870,"y-memory":871,"y-text":873,"yjs":883}],15:[function(require,module,exports){ +},{"./Dweb":4,"./Transport":12,"buffer":144,"cids":146,"ipfs":390,"promisify-es6":681,"url":845,"y-array":863,"y-indexeddb":864,"y-ipfs-connector":867,"y-memory":868,"y-text":870,"yjs":880}],15:[function(require,module,exports){ // ######### Parallel development to CommonBlock.py ######## const Dweb = require("./Dweb"); @@ -3109,7 +3109,7 @@ window.sodium = require("libsodium-wrappers"); // Needed for cryptotest //window.TransportIPFS = require('./TransportIPFS'); //TODO-REL4 try oving this to Dweb.TransportIPFS = ... //window.TransportHTTP = require('./TransportHTTP'); -},{"./Dweb":4,"libsodium-wrappers":543}],17:[function(require,module,exports){ +},{"./Dweb":4,"libsodium-wrappers":540}],17:[function(require,module,exports){ module.exports = after function after(count, callback, err_cb) { @@ -3244,7 +3244,7 @@ Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) { return this._getEncoder(enc).encode(data, reporter); }; -},{"../asn1":19,"inherits":287,"vm":862}],21:[function(require,module,exports){ +},{"../asn1":19,"inherits":287,"vm":859}],21:[function(require,module,exports){ var inherits = require('inherits'); var Reporter = require('../base').Reporter; var Buffer = require('buffer').Buffer; @@ -4006,7 +4006,7 @@ Node.prototype._isPrintstr = function isPrintstr(str) { return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str); }; -},{"../base":22,"minimalistic-assert":607}],24:[function(require,module,exports){ +},{"../base":22,"minimalistic-assert":604}],24:[function(require,module,exports){ var inherits = require('inherits'); function Reporter(options) { @@ -5397,7 +5397,7 @@ var objectKeys = Object.keys || function (obj) { }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"util/":853}],34:[function(require,module,exports){ +},{"util/":850}],34:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -5508,7 +5508,7 @@ function rethrow(error) { throw error; } module.exports = exports['default']; -},{"./internal/initialParams":52,"./internal/setImmediate":61,"lodash/isObject":594}],35:[function(require,module,exports){ +},{"./internal/initialParams":52,"./internal/setImmediate":61,"lodash/isObject":591}],35:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -5608,7 +5608,7 @@ function doWhilst(iteratee, test, callback) { _iteratee(next); } module.exports = exports['default']; -},{"./internal/onlyOnce":57,"./internal/slice":62,"./internal/wrapAsync":64,"lodash/noop":598}],37:[function(require,module,exports){ +},{"./internal/onlyOnce":57,"./internal/slice":62,"./internal/wrapAsync":64,"lodash/noop":595}],37:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -5849,7 +5849,7 @@ var eachOfGeneric = (0, _doLimit2.default)(_eachOfLimit2.default, Infinity); * }); */ module.exports = exports['default']; -},{"./eachOfLimit":40,"./internal/breakLoop":45,"./internal/doLimit":47,"./internal/once":56,"./internal/onlyOnce":57,"./internal/wrapAsync":64,"lodash/isArrayLike":590,"lodash/noop":598}],40:[function(require,module,exports){ +},{"./eachOfLimit":40,"./internal/breakLoop":45,"./internal/doLimit":47,"./internal/once":56,"./internal/onlyOnce":57,"./internal/wrapAsync":64,"lodash/isArrayLike":587,"lodash/noop":595}],40:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -6160,7 +6160,7 @@ function _createTester(check, getResult) { }; } module.exports = exports['default']; -},{"./breakLoop":45,"lodash/noop":598}],47:[function(require,module,exports){ +},{"./breakLoop":45,"lodash/noop":595}],47:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -6269,7 +6269,7 @@ function _eachOfLimit(limit) { }; } module.exports = exports['default']; -},{"./breakLoop":45,"./iterator":53,"./once":56,"./onlyOnce":57,"lodash/noop":598}],50:[function(require,module,exports){ +},{"./breakLoop":45,"./iterator":53,"./once":56,"./onlyOnce":57,"lodash/noop":595}],50:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -6345,7 +6345,7 @@ function _filter(eachfn, coll, iteratee, callback) { filter(eachfn, coll, (0, _wrapAsync2.default)(iteratee), callback || _noop2.default); } module.exports = exports['default']; -},{"./wrapAsync":64,"lodash/_arrayMap":566,"lodash/_baseProperty":574,"lodash/isArrayLike":590,"lodash/noop":598}],51:[function(require,module,exports){ +},{"./wrapAsync":64,"lodash/_arrayMap":563,"lodash/_baseProperty":571,"lodash/isArrayLike":587,"lodash/noop":595}],51:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -6440,7 +6440,7 @@ function iterator(coll) { return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll); } module.exports = exports['default']; -},{"./getIterator":51,"lodash/isArrayLike":590,"lodash/keys":597}],54:[function(require,module,exports){ +},{"./getIterator":51,"lodash/isArrayLike":587,"lodash/keys":594}],54:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -6476,7 +6476,7 @@ function _asyncMap(eachfn, arr, iteratee, callback) { }); } module.exports = exports['default']; -},{"./wrapAsync":64,"lodash/noop":598}],55:[function(require,module,exports){ +},{"./wrapAsync":64,"lodash/noop":595}],55:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -6562,7 +6562,7 @@ function _parallel(eachfn, tasks, callback) { }); } module.exports = exports['default']; -},{"./slice":62,"./wrapAsync":64,"lodash/isArrayLike":590,"lodash/noop":598}],59:[function(require,module,exports){ +},{"./slice":62,"./wrapAsync":64,"lodash/isArrayLike":587,"lodash/noop":595}],59:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -6757,7 +6757,7 @@ function queue(worker, concurrency, payload) { return q; } module.exports = exports['default']; -},{"./DoublyLinkedList":44,"./onlyOnce":57,"./setImmediate":61,"./wrapAsync":64,"lodash/_baseIndexOf":569,"lodash/isArray":589,"lodash/noop":598}],60:[function(require,module,exports){ +},{"./DoublyLinkedList":44,"./onlyOnce":57,"./setImmediate":61,"./wrapAsync":64,"lodash/_baseIndexOf":566,"lodash/isArray":586,"lodash/noop":595}],60:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -6824,7 +6824,7 @@ if (hasSetImmediate) { exports.default = wrap(_defer); }).call(this,require('_process')) -},{"./slice":62,"_process":682}],62:[function(require,module,exports){ +},{"./slice":62,"_process":679}],62:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -7388,7 +7388,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de */ exports.default = (0, _doParallel2.default)((0, _createTester2.default)(Boolean, _identity2.default)); module.exports = exports['default']; -},{"./internal/createTester":46,"./internal/doParallel":48,"lodash/identity":587}],72:[function(require,module,exports){ +},{"./internal/createTester":46,"./internal/doParallel":48,"lodash/identity":584}],72:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -7592,7 +7592,7 @@ module.exports = exports['default']; * callback(null, 'done'); * } */ -},{"./internal/once":56,"./internal/onlyOnce":57,"./internal/slice":62,"./internal/wrapAsync":64,"lodash/isArray":589,"lodash/noop":598}],74:[function(require,module,exports){ +},{"./internal/once":56,"./internal/onlyOnce":57,"./internal/slice":62,"./internal/wrapAsync":64,"lodash/isArray":586,"lodash/noop":595}],74:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -7665,7 +7665,7 @@ function whilst(test, iteratee, callback) { _iteratee(next); } module.exports = exports['default']; -},{"./internal/onlyOnce":57,"./internal/slice":62,"./internal/wrapAsync":64,"lodash/noop":598}],75:[function(require,module,exports){ +},{"./internal/onlyOnce":57,"./internal/slice":62,"./internal/wrapAsync":64,"lodash/noop":595}],75:[function(require,module,exports){ /** * Expose `Backoff`. @@ -11204,7 +11204,7 @@ module.exports = { encode: encode } -},{"safe-buffer":790}],82:[function(require,module,exports){ +},{"safe-buffer":787}],82:[function(require,module,exports){ // Blake2B in pure Javascript // Adapted from the reference implementation in RFC7693 // Ported to Javascript by DC - https://github.com/dcposch @@ -17290,7 +17290,7 @@ Decoder.decodeFirst = Decoder.decode module.exports = Decoder }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./constants":88,"./decoder.asm":89,"./simple":94,"./tagged":95,"./utils":96,"bignumber.js":80,"buffer":144,"ieee754":285,"url":848}],91:[function(require,module,exports){ +},{"./constants":88,"./decoder.asm":89,"./simple":94,"./tagged":95,"./utils":96,"bignumber.js":80,"buffer":144,"ieee754":285,"url":845}],91:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -17986,7 +17986,7 @@ class Encoder { module.exports = Encoder }).call(this,require("buffer").Buffer) -},{"./constants":88,"./utils":96,"bignumber.js":80,"buffer":144,"url":848}],93:[function(require,module,exports){ +},{"./constants":88,"./utils":96,"bignumber.js":80,"buffer":144,"url":845}],93:[function(require,module,exports){ 'use strict' // exports.Commented = require('./commented') @@ -18676,7 +18676,7 @@ AES.prototype.scrub = function () { module.exports.AES = AES -},{"safe-buffer":790}],100:[function(require,module,exports){ +},{"safe-buffer":787}],100:[function(require,module,exports){ var aes = require('./aes') var Buffer = require('safe-buffer').Buffer var Transform = require('cipher-base') @@ -18770,7 +18770,7 @@ StreamCipher.prototype.setAAD = function setAAD (buf) { module.exports = StreamCipher -},{"./aes":99,"./ghash":104,"buffer-xor":143,"cipher-base":147,"inherits":287,"safe-buffer":790}],101:[function(require,module,exports){ +},{"./aes":99,"./ghash":104,"buffer-xor":143,"cipher-base":147,"inherits":287,"safe-buffer":787}],101:[function(require,module,exports){ var ciphers = require('./encrypter') var deciphers = require('./decrypter') var modes = require('./modes/list.json') @@ -18908,7 +18908,7 @@ function createDecipher (suite, password) { exports.createDecipher = createDecipher exports.createDecipheriv = createDecipheriv -},{"./aes":99,"./authCipher":100,"./modes":111,"./streamCipher":114,"cipher-base":147,"evp_bytestokey":237,"inherits":287,"safe-buffer":790}],103:[function(require,module,exports){ +},{"./aes":99,"./authCipher":100,"./modes":111,"./streamCipher":114,"cipher-base":147,"evp_bytestokey":237,"inherits":287,"safe-buffer":787}],103:[function(require,module,exports){ var MODES = require('./modes') var AuthCipher = require('./authCipher') var Buffer = require('safe-buffer').Buffer @@ -19024,7 +19024,7 @@ function createCipher (suite, password) { exports.createCipheriv = createCipheriv exports.createCipher = createCipher -},{"./aes":99,"./authCipher":100,"./modes":111,"./streamCipher":114,"cipher-base":147,"evp_bytestokey":237,"inherits":287,"safe-buffer":790}],104:[function(require,module,exports){ +},{"./aes":99,"./authCipher":100,"./modes":111,"./streamCipher":114,"cipher-base":147,"evp_bytestokey":237,"inherits":287,"safe-buffer":787}],104:[function(require,module,exports){ var Buffer = require('safe-buffer').Buffer var ZEROES = Buffer.alloc(16, 0) @@ -19115,7 +19115,7 @@ GHASH.prototype.final = function (abl, bl) { module.exports = GHASH -},{"safe-buffer":790}],105:[function(require,module,exports){ +},{"safe-buffer":787}],105:[function(require,module,exports){ var xor = require('buffer-xor') exports.encrypt = function (self, block) { @@ -19169,7 +19169,7 @@ exports.encrypt = function (self, data, decrypt) { return out } -},{"buffer-xor":143,"safe-buffer":790}],107:[function(require,module,exports){ +},{"buffer-xor":143,"safe-buffer":787}],107:[function(require,module,exports){ var Buffer = require('safe-buffer').Buffer function encryptByte (self, byteParam, decrypt) { @@ -19213,7 +19213,7 @@ exports.encrypt = function (self, chunk, decrypt) { return out } -},{"safe-buffer":790}],108:[function(require,module,exports){ +},{"safe-buffer":787}],108:[function(require,module,exports){ (function (Buffer){ function encryptByte (self, byteParam, decrypt) { var pad = self._cipher.encryptBlock(self._prev) @@ -19558,7 +19558,7 @@ StreamCipher.prototype._final = function () { module.exports = StreamCipher -},{"./aes":99,"cipher-base":147,"inherits":287,"safe-buffer":790}],115:[function(require,module,exports){ +},{"./aes":99,"cipher-base":147,"inherits":287,"safe-buffer":787}],115:[function(require,module,exports){ var ebtk = require('evp_bytestokey') var aes = require('browserify-aes/browser') var DES = require('browserify-des') @@ -19750,7 +19750,7 @@ function getr(priv) { } }).call(this,require("buffer").Buffer) -},{"bn.js":87,"buffer":144,"randombytes":773}],119:[function(require,module,exports){ +},{"bn.js":87,"buffer":144,"randombytes":770}],119:[function(require,module,exports){ (function (Buffer){ const Sha3 = require('js-sha3') @@ -20486,7 +20486,7 @@ module.exports = { } }).call(this,require("buffer").Buffer) -},{"./algorithms.json":122,"./sign":125,"./verify":126,"buffer":144,"create-hash":153,"inherits":287,"stream":833}],125:[function(require,module,exports){ +},{"./algorithms.json":122,"./sign":125,"./verify":126,"buffer":144,"create-hash":153,"inherits":287,"stream":830}],125:[function(require,module,exports){ (function (Buffer){ // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js var createHmac = require('create-hmac') @@ -20635,7 +20635,7 @@ module.exports.getKey = getKey module.exports.makeKey = makeKey }).call(this,require("buffer").Buffer) -},{"./curves.json":123,"bn.js":87,"browserify-rsa":118,"buffer":144,"create-hmac":156,"elliptic":191,"parse-asn1":667}],126:[function(require,module,exports){ +},{"./curves.json":123,"bn.js":87,"browserify-rsa":118,"buffer":144,"create-hmac":156,"elliptic":191,"parse-asn1":664}],126:[function(require,module,exports){ (function (Buffer){ // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js var BN = require('bn.js') @@ -20722,7 +20722,7 @@ function checkValue (b, q) { module.exports = verify }).call(this,require("buffer").Buffer) -},{"./curves.json":123,"bn.js":87,"buffer":144,"elliptic":191,"parse-asn1":667}],127:[function(require,module,exports){ +},{"./curves.json":123,"bn.js":87,"buffer":144,"elliptic":191,"parse-asn1":664}],127:[function(require,module,exports){ 'use strict'; @@ -26499,7 +26499,7 @@ Zlib.prototype._error = function(status) { exports.Zlib = Zlib; }).call(this,require('_process'),require("buffer").Buffer) -},{"_process":682,"buffer":144,"pako/lib/zlib/constants":129,"pako/lib/zlib/deflate.js":131,"pako/lib/zlib/inflate.js":133,"pako/lib/zlib/messages":135,"pako/lib/zlib/zstream":137}],139:[function(require,module,exports){ +},{"_process":679,"buffer":144,"pako/lib/zlib/constants":129,"pako/lib/zlib/deflate.js":131,"pako/lib/zlib/inflate.js":133,"pako/lib/zlib/messages":135,"pako/lib/zlib/zstream":137}],139:[function(require,module,exports){ (function (process,Buffer){ // Copyright Joyent, Inc. and other Node contributors. // @@ -27113,7 +27113,7 @@ util.inherits(InflateRaw, Zlib); util.inherits(Unzip, Zlib); }).call(this,require('_process'),require("buffer").Buffer) -},{"./binding":138,"_process":682,"_stream_transform":785,"assert":33,"buffer":144,"util":853}],140:[function(require,module,exports){ +},{"./binding":138,"_process":679,"_stream_transform":782,"assert":33,"buffer":144,"util":850}],140:[function(require,module,exports){ arguments[4][98][0].apply(exports,arguments) },{"dup":98}],141:[function(require,module,exports){ var basex = require('base-x') @@ -27214,7 +27214,7 @@ module.exports = function base (ALPHABET) { } } -},{"safe-buffer":790}],143:[function(require,module,exports){ +},{"safe-buffer":787}],143:[function(require,module,exports){ (function (Buffer){ module.exports = function xor (a, b) { var length = Math.min(a.length, b.length) @@ -29274,7 +29274,7 @@ CID.codecs = codecs module.exports = CID }).call(this,require("buffer").Buffer) -},{"buffer":144,"multibase":617,"multicodec":619,"multicodec/src/base-table":618,"multicodec/src/varint-table":622,"multihashes":624}],147:[function(require,module,exports){ +},{"buffer":144,"multibase":614,"multicodec":616,"multicodec/src/base-table":615,"multicodec/src/varint-table":619,"multihashes":621}],147:[function(require,module,exports){ var Buffer = require('safe-buffer').Buffer var Transform = require('stream').Transform var StringDecoder = require('string_decoder').StringDecoder @@ -29375,7 +29375,7 @@ CipherBase.prototype._toString = function (value, enc, fin) { module.exports = CipherBase -},{"inherits":287,"safe-buffer":790,"stream":833,"string_decoder":840}],148:[function(require,module,exports){ +},{"inherits":287,"safe-buffer":787,"stream":830,"string_decoder":837}],148:[function(require,module,exports){ /** * Slice reference. */ @@ -29684,7 +29684,7 @@ function objectToString(o) { } }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":433}],152:[function(require,module,exports){ +},{"../../is-buffer/index.js":438}],152:[function(require,module,exports){ (function (Buffer){ var elliptic = require('elliptic'); var BN = require('bn.js'); @@ -29866,7 +29866,7 @@ module.exports = function createHash (alg) { } }).call(this,require("buffer").Buffer) -},{"./md5":155,"buffer":144,"cipher-base":147,"inherits":287,"ripemd160":788,"sha.js":806}],154:[function(require,module,exports){ +},{"./md5":155,"buffer":144,"cipher-base":147,"inherits":287,"ripemd160":785,"sha.js":803}],154:[function(require,module,exports){ (function (Buffer){ 'use strict' var intSize = 4 @@ -30117,7 +30117,7 @@ module.exports = function createHmac (alg, key) { return new Hmac(alg, key) } -},{"./legacy":157,"cipher-base":147,"create-hash/md5":155,"inherits":287,"ripemd160":788,"safe-buffer":790,"sha.js":806}],157:[function(require,module,exports){ +},{"./legacy":157,"cipher-base":147,"create-hash/md5":155,"inherits":287,"ripemd160":785,"safe-buffer":787,"sha.js":803}],157:[function(require,module,exports){ 'use strict' var inherits = require('inherits') var Buffer = require('safe-buffer').Buffer @@ -30165,7 +30165,7 @@ Hmac.prototype._final = function () { } module.exports = Hmac -},{"cipher-base":147,"inherits":287,"safe-buffer":790}],158:[function(require,module,exports){ +},{"cipher-base":147,"inherits":287,"safe-buffer":787}],158:[function(require,module,exports){ 'use strict' exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes') @@ -30259,7 +30259,7 @@ exports.constants = { 'POINT_CONVERSION_HYBRID': 6 } -},{"browserify-cipher":115,"browserify-sign":124,"browserify-sign/algos":121,"create-ecdh":152,"create-hash":153,"create-hmac":156,"diffie-hellman":184,"pbkdf2":671,"public-encrypt":697,"randombytes":773}],159:[function(require,module,exports){ +},{"browserify-cipher":115,"browserify-sign":124,"browserify-sign/algos":121,"create-ecdh":152,"create-hash":153,"create-hmac":156,"diffie-hellman":184,"pbkdf2":668,"public-encrypt":694,"randombytes":770}],159:[function(require,module,exports){ /* @flow */ 'use strict' @@ -30370,7 +30370,7 @@ class KeyTransformDatastore /* :: */ { module.exports = KeyTransformDatastore -},{"pull-stream":726}],161:[function(require,module,exports){ +},{"pull-stream":723}],161:[function(require,module,exports){ /* @flow */ 'use strict' @@ -30563,7 +30563,7 @@ class MountDatastore /* :: */ { module.exports = MountDatastore -},{"./keytransform":160,"async/each":37,"interface-datastore":290,"pull-many":716,"pull-stream":726}],162:[function(require,module,exports){ +},{"./keytransform":160,"async/each":37,"interface-datastore":290,"pull-many":713,"pull-stream":723}],162:[function(require,module,exports){ /* @flow */ 'use strict' @@ -30798,7 +30798,7 @@ exports.Prefix = Prefix exports.Suffix = Suffix exports.NextToLast = NextToLast -},{"./shard-readme":163,"interface-datastore":290,"left-pad":448}],165:[function(require,module,exports){ +},{"./shard-readme":163,"interface-datastore":290,"left-pad":453}],165:[function(require,module,exports){ (function (Buffer){ /* @flow */ 'use strict' @@ -30986,7 +30986,7 @@ class ShardingDatastore { module.exports = ShardingDatastore }).call(this,require("buffer").Buffer) -},{"./keytransform":160,"./shard":164,"async/parallel":66,"async/waterfall":73,"buffer":144,"interface-datastore":290,"pull-stream":726}],166:[function(require,module,exports){ +},{"./keytransform":160,"./shard":164,"async/parallel":66,"async/waterfall":73,"buffer":144,"interface-datastore":290,"pull-stream":723}],166:[function(require,module,exports){ /* @flow */ 'use strict' @@ -31260,7 +31260,7 @@ class LevelDatastore { module.exports = LevelDatastore }).call(this,require("buffer").Buffer) -},{"buffer":144,"interface-datastore":290,"levelup":469,"pull-stream":726}],168:[function(require,module,exports){ +},{"buffer":144,"interface-datastore":290,"levelup":474,"pull-stream":723}],168:[function(require,module,exports){ (function (process){ /** * This is the web browser implementation of `debug()`. @@ -31459,7 +31459,7 @@ function localstorage() { } }).call(this,require('_process')) -},{"./debug":169,"_process":682}],169:[function(require,module,exports){ +},{"./debug":169,"_process":679}],169:[function(require,module,exports){ /** * This is the common logic for both the Node.js and web browser @@ -31686,7 +31686,7 @@ function coerce(val) { return val; } -},{"ms":609}],170:[function(require,module,exports){ +},{"ms":606}],170:[function(require,module,exports){ (function (Buffer){ /*! * @description Recursive object extending @@ -31870,7 +31870,7 @@ DeferredIterator.prototype._operation = function (method, args) { module.exports = DeferredIterator; -},{"abstract-leveldown":176,"util":853}],172:[function(require,module,exports){ +},{"abstract-leveldown":176,"util":850}],172:[function(require,module,exports){ (function (Buffer,process){ var util = require('util') , AbstractLevelDOWN = require('abstract-leveldown').AbstractLevelDOWN @@ -31930,7 +31930,7 @@ module.exports = DeferredLevelDOWN module.exports.DeferredIterator = DeferredIterator }).call(this,{"isBuffer":require("../is-buffer/index.js")},require('_process')) -},{"../is-buffer/index.js":433,"./deferred-iterator":171,"_process":682,"abstract-leveldown":176,"util":853}],173:[function(require,module,exports){ +},{"../is-buffer/index.js":438,"./deferred-iterator":171,"_process":679,"abstract-leveldown":176,"util":850}],173:[function(require,module,exports){ (function (process){ /* Copyright (c) 2017 Rod Vagg, MIT License */ @@ -32022,7 +32022,7 @@ AbstractChainedBatch.prototype.write = function (options, callback) { module.exports = AbstractChainedBatch }).call(this,require('_process')) -},{"_process":682}],174:[function(require,module,exports){ +},{"_process":679}],174:[function(require,module,exports){ (function (process){ /* Copyright (c) 2017 Rod Vagg, MIT License */ @@ -32075,7 +32075,7 @@ AbstractIterator.prototype.end = function (callback) { module.exports = AbstractIterator }).call(this,require('_process')) -},{"_process":682}],175:[function(require,module,exports){ +},{"_process":679}],175:[function(require,module,exports){ (function (Buffer,process){ /* Copyright (c) 2017 Rod Vagg, MIT License */ @@ -32350,7 +32350,7 @@ AbstractLevelDOWN.prototype._checkKey = function (obj, type) { module.exports = AbstractLevelDOWN }).call(this,{"isBuffer":require("../../../is-buffer/index.js")},require('_process')) -},{"../../../is-buffer/index.js":433,"./abstract-chained-batch":173,"./abstract-iterator":174,"_process":682,"xtend":865}],176:[function(require,module,exports){ +},{"../../../is-buffer/index.js":438,"./abstract-chained-batch":173,"./abstract-iterator":174,"_process":679,"xtend":862}],176:[function(require,module,exports){ exports.AbstractLevelDOWN = require('./abstract-leveldown') exports.AbstractIterator = require('./abstract-iterator') exports.AbstractChainedBatch = require('./abstract-chained-batch') @@ -32448,7 +32448,7 @@ proto._update = function _update(inp, inOff, out, outOff) { } }; -},{"inherits":287,"minimalistic-assert":607}],180:[function(require,module,exports){ +},{"inherits":287,"minimalistic-assert":604}],180:[function(require,module,exports){ 'use strict'; var assert = require('minimalistic-assert'); @@ -32591,7 +32591,7 @@ Cipher.prototype._finalDecrypt = function _finalDecrypt() { return this._unpad(out); }; -},{"minimalistic-assert":607}],181:[function(require,module,exports){ +},{"minimalistic-assert":604}],181:[function(require,module,exports){ 'use strict'; var assert = require('minimalistic-assert'); @@ -32736,7 +32736,7 @@ DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) { utils.rip(l, r, out, off); }; -},{"../des":178,"inherits":287,"minimalistic-assert":607}],182:[function(require,module,exports){ +},{"../des":178,"inherits":287,"minimalistic-assert":604}],182:[function(require,module,exports){ 'use strict'; var assert = require('minimalistic-assert'); @@ -32793,7 +32793,7 @@ EDE.prototype._update = function _update(inp, inOff, out, outOff) { EDE.prototype._pad = DES.prototype._pad; EDE.prototype._unpad = DES.prototype._unpad; -},{"../des":178,"inherits":287,"minimalistic-assert":607}],183:[function(require,module,exports){ +},{"../des":178,"inherits":287,"minimalistic-assert":604}],183:[function(require,module,exports){ 'use strict'; exports.readUInt32BE = function readUInt32BE(bytes, off) { @@ -33265,7 +33265,7 @@ function formatReturnValue(bn, enc) { } }).call(this,require("buffer").Buffer) -},{"./generatePrime":186,"bn.js":87,"buffer":144,"miller-rabin":606,"randombytes":773}],186:[function(require,module,exports){ +},{"./generatePrime":186,"bn.js":87,"buffer":144,"miller-rabin":603,"randombytes":770}],186:[function(require,module,exports){ var randomBytes = require('randombytes'); module.exports = findPrime; findPrime.simpleSieve = simpleSieve; @@ -33372,7 +33372,7 @@ function findPrime(bits, gen) { } -},{"bn.js":87,"miller-rabin":606,"randombytes":773}],187:[function(require,module,exports){ +},{"bn.js":87,"miller-rabin":603,"randombytes":770}],187:[function(require,module,exports){ module.exports={ "modp1": { "gen": "02", @@ -33743,7 +33743,7 @@ Duplexify.prototype.end = function(data, enc, cb) { module.exports = Duplexify }).call(this,require('_process'),require("buffer").Buffer) -},{"_process":682,"buffer":144,"end-of-stream":209,"inherits":287,"readable-stream":784,"stream-shift":838}],191:[function(require,module,exports){ +},{"_process":679,"buffer":144,"end-of-stream":209,"inherits":287,"readable-stream":781,"stream-shift":835}],191:[function(require,module,exports){ 'use strict'; var elliptic = exports; @@ -37599,7 +37599,7 @@ function intFromLE(bytes) { utils.intFromLE = intFromLE; -},{"bn.js":87,"minimalistic-assert":607,"minimalistic-crypto-utils":608}],206:[function(require,module,exports){ +},{"bn.js":87,"minimalistic-assert":604,"minimalistic-crypto-utils":605}],206:[function(require,module,exports){ module.exports={ "_args": [ [ @@ -37910,7 +37910,7 @@ var eos = function(stream, opts, callback) { module.exports = eos; -},{"once":661}],210:[function(require,module,exports){ +},{"once":658}],210:[function(require,module,exports){ module.exports = require('./socket'); @@ -38669,7 +38669,7 @@ Socket.prototype.filterUpgrades = function (upgrades) { }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./transport":212,"./transports/index":213,"component-emitter":149,"debug":219,"engine.io-parser":221,"indexof":286,"parseqs":668,"parseuri":669}],212:[function(require,module,exports){ +},{"./transport":212,"./transports/index":213,"component-emitter":149,"debug":219,"engine.io-parser":221,"indexof":286,"parseqs":665,"parseuri":666}],212:[function(require,module,exports){ /** * Module dependencies. */ @@ -39784,7 +39784,7 @@ Polling.prototype.uri = function () { return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query; }; -},{"../transport":212,"component-inherit":150,"debug":219,"engine.io-parser":221,"parseqs":668,"xmlhttprequest-ssl":218,"yeast":874}],217:[function(require,module,exports){ +},{"../transport":212,"component-inherit":150,"debug":219,"engine.io-parser":221,"parseqs":665,"xmlhttprequest-ssl":218,"yeast":871}],217:[function(require,module,exports){ (function (global){ /** * Module dependencies. @@ -40074,7 +40074,7 @@ WS.prototype.check = function () { }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../transport":212,"component-inherit":150,"debug":219,"engine.io-parser":221,"parseqs":668,"ws":98,"yeast":874}],218:[function(require,module,exports){ +},{"../transport":212,"component-inherit":150,"debug":219,"engine.io-parser":221,"parseqs":665,"ws":98,"yeast":871}],218:[function(require,module,exports){ (function (global){ // browser shim for xmlhttprequest module @@ -40304,7 +40304,7 @@ function localstorage() { } }).call(this,require('_process')) -},{"./debug":220,"_process":682}],220:[function(require,module,exports){ +},{"./debug":220,"_process":679}],220:[function(require,module,exports){ /** * This is the common logic for both the Node.js and web browser @@ -40508,7 +40508,7 @@ function coerce(val) { return val; } -},{"ms":609}],221:[function(require,module,exports){ +},{"ms":606}],221:[function(require,module,exports){ (function (global){ /** * Module dependencies. @@ -42166,7 +42166,7 @@ Account.prototype.isEmpty = function () { } }).call(this,require("buffer").Buffer) -},{"buffer":144,"ethereumjs-util":234,"rlp":789}],229:[function(require,module,exports){ +},{"buffer":144,"ethereumjs-util":234,"rlp":786}],229:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -43073,7 +43073,7 @@ exports.defineProperties = function (self, fields, data) { }; }).call(this,require("buffer").Buffer) -},{"assert":33,"bn.js":87,"buffer":144,"create-hash":153,"ethjs-util":235,"keccak":441,"rlp":789,"secp256k1":791}],231:[function(require,module,exports){ +},{"assert":33,"bn.js":87,"buffer":144,"create-hash":153,"ethjs-util":235,"keccak":446,"rlp":786,"secp256k1":788}],231:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -43640,7 +43640,7 @@ module.exports={ },{}],233:[function(require,module,exports){ arguments[4][230][0].apply(exports,arguments) -},{"assert":33,"bn.js":87,"buffer":144,"create-hash":153,"dup":230,"ethjs-util":235,"keccak":441,"rlp":789,"secp256k1":791}],234:[function(require,module,exports){ +},{"assert":33,"bn.js":87,"buffer":144,"create-hash":153,"dup":230,"ethjs-util":235,"keccak":446,"rlp":786,"secp256k1":788}],234:[function(require,module,exports){ (function (Buffer){ const SHA3 = require('keccakjs') const secp256k1 = require('secp256k1') @@ -44345,7 +44345,7 @@ exports.defineProperties = function (self, fields, data) { } }).call(this,require("buffer").Buffer) -},{"assert":33,"bn.js":87,"buffer":144,"create-hash":153,"keccakjs":447,"rlp":789,"secp256k1":791}],235:[function(require,module,exports){ +},{"assert":33,"bn.js":87,"buffer":144,"create-hash":153,"keccakjs":452,"rlp":786,"secp256k1":788}],235:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -44568,7 +44568,7 @@ module.exports = { isHexString: isHexString }; }).call(this,require("buffer").Buffer) -},{"buffer":144,"is-hex-prefixed":435,"strip-hex-prefix":841}],236:[function(require,module,exports){ +},{"buffer":144,"is-hex-prefixed":440,"strip-hex-prefix":838}],236:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -44919,7 +44919,7 @@ function EVP_BytesToKey (password, salt, keyBits, ivLen) { module.exports = EVP_BytesToKey -},{"md5.js":603,"safe-buffer":790}],238:[function(require,module,exports){ +},{"md5.js":600,"safe-buffer":787}],238:[function(require,module,exports){ /** * This library modifies the diff-patch-match library by Neil Fraser * by removing the patch and match functionality and certain advanced @@ -46068,7 +46068,7 @@ HashBase.prototype._digest = function () { module.exports = HashBase }).call(this,require("buffer").Buffer) -},{"buffer":144,"inherits":287,"stream":833}],246:[function(require,module,exports){ +},{"buffer":144,"inherits":287,"stream":830}],246:[function(require,module,exports){ var hash = exports; hash.utils = require('./hash/utils'); @@ -46179,7 +46179,7 @@ BlockHash.prototype._pad = function pad() { return res; }; -},{"./utils":257,"minimalistic-assert":607}],248:[function(require,module,exports){ +},{"./utils":257,"minimalistic-assert":604}],248:[function(require,module,exports){ 'use strict'; var utils = require('./utils'); @@ -46228,7 +46228,7 @@ Hmac.prototype.digest = function digest(enc) { return this.outer.digest(enc); }; -},{"./utils":257,"minimalistic-assert":607}],249:[function(require,module,exports){ +},{"./utils":257,"minimalistic-assert":604}],249:[function(require,module,exports){ 'use strict'; var utils = require('./utils'); @@ -46600,7 +46600,7 @@ SHA256.prototype._digest = function digest(enc) { return utils.split32(this.h, 'big'); }; -},{"../common":247,"../utils":257,"./common":256,"minimalistic-assert":607}],254:[function(require,module,exports){ +},{"../common":247,"../utils":257,"./common":256,"minimalistic-assert":604}],254:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); @@ -46969,7 +46969,7 @@ function g1_512_lo(xh, xl) { return r; } -},{"../common":247,"../utils":257,"minimalistic-assert":607}],256:[function(require,module,exports){ +},{"../common":247,"../utils":257,"minimalistic-assert":604}],256:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); @@ -47275,7 +47275,7 @@ function shr64_lo(ah, al, num) { } exports.shr64_lo = shr64_lo; -},{"inherits":287,"minimalistic-assert":607}],258:[function(require,module,exports){ +},{"inherits":287,"minimalistic-assert":604}],258:[function(require,module,exports){ 'use strict'; var hash = require('hash.js'); @@ -47390,7 +47390,7 @@ HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) { return utils.encode(res, enc); }; -},{"hash.js":246,"minimalistic-assert":607,"minimalistic-crypto-utils":608}],259:[function(require,module,exports){ +},{"hash.js":246,"minimalistic-assert":604,"minimalistic-crypto-utils":605}],259:[function(require,module,exports){ var http = require('http') var url = require('url') @@ -47423,7 +47423,7 @@ function validateParams (params) { return params } -},{"http":834,"url":848}],260:[function(require,module,exports){ +},{"http":831,"url":845}],260:[function(require,module,exports){ 'use strict' const cloneDeep = require('lodash.clonedeep') @@ -47479,11 +47479,11 @@ function hyperdiff (orig, dist, props) { module.exports = hyperdiff -},{"debug":261,"lodash.clonedeep":545,"lodash.pullat":557}],261:[function(require,module,exports){ +},{"debug":261,"lodash.clonedeep":542,"lodash.pullat":554}],261:[function(require,module,exports){ arguments[4][168][0].apply(exports,arguments) -},{"./debug":262,"_process":682,"dup":168}],262:[function(require,module,exports){ +},{"./debug":262,"_process":679,"dup":168}],262:[function(require,module,exports){ arguments[4][169][0].apply(exports,arguments) -},{"dup":169,"ms":609}],263:[function(require,module,exports){ +},{"dup":169,"ms":606}],263:[function(require,module,exports){ (function (Buffer){ "use strict" @@ -48428,7 +48428,7 @@ InternalDecoderCesu8.prototype.end = function() { } }).call(this,require("buffer").Buffer) -},{"buffer":144,"string_decoder":840}],267:[function(require,module,exports){ +},{"buffer":144,"string_decoder":837}],267:[function(require,module,exports){ (function (Buffer){ "use strict" @@ -51084,7 +51084,7 @@ module.exports = function (iconv) { } }).call(this,require("buffer").Buffer) -},{"buffer":144,"stream":833}],282:[function(require,module,exports){ +},{"buffer":144,"stream":830}],282:[function(require,module,exports){ (function (process,Buffer){ "use strict" @@ -51229,7 +51229,7 @@ if (nodeVer) { }).call(this,require('_process'),require("buffer").Buffer) -},{"../encodings":265,"./bom-handling":280,"./extend-node":281,"./streams":283,"_process":682,"buffer":144}],283:[function(require,module,exports){ +},{"../encodings":265,"./bom-handling":280,"./extend-node":281,"./streams":283,"_process":679,"buffer":144}],283:[function(require,module,exports){ (function (Buffer){ "use strict" @@ -51353,7 +51353,7 @@ IconvLiteDecoderStream.prototype.collect = function(cb) { }).call(this,require("buffer").Buffer) -},{"buffer":144,"stream":833}],284:[function(require,module,exports){ +},{"buffer":144,"stream":830}],284:[function(require,module,exports){ /** * Copyright (c) 2016 Tim Kuijsten * @@ -51491,7 +51491,7 @@ function idbReadableStream(db, storeName, opts) { module.exports = idbReadableStream -},{"stream":833,"xtend":865}],285:[function(require,module,exports){ +},{"stream":830,"xtend":862}],285:[function(require,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = nBytes * 8 - mLen - 1 @@ -51675,7 +51675,7 @@ module.exports = class Connection { } } -},{"pull-defer/duplex":707}],289:[function(require,module,exports){ +},{"pull-defer/duplex":704}],289:[function(require,module,exports){ 'use strict' exports.Connection = require('./connection') @@ -52124,7 +52124,7 @@ function namespaceValue (ns /* : string */) /* : string */ { module.exports = Key }).call(this,require("buffer").Buffer) -},{"buffer":144,"path":670,"uuid/v4":856}],292:[function(require,module,exports){ +},{"buffer":144,"path":667,"uuid/v4":853}],292:[function(require,module,exports){ /* @flow */ 'use strict' @@ -52256,7 +52256,7 @@ class MemoryDatastore { module.exports = MemoryDatastore -},{"./key":291,"./utils":293,"async/setImmediate":70,"pull-stream":726}],293:[function(require,module,exports){ +},{"./key":291,"./utils":293,"async/setImmediate":70,"pull-stream":723}],293:[function(require,module,exports){ 'use strict' const pull = require('pull-stream') @@ -52337,7 +52337,7 @@ exports.tmpdir = () => { return path.join(os.tmpdir(), uuid()) } -},{"os":662,"path":670,"pull-defer/source":710,"pull-stream":726,"uuid/v4":856}],294:[function(require,module,exports){ +},{"os":659,"path":667,"pull-defer/source":707,"pull-stream":723,"uuid/v4":853}],294:[function(require,module,exports){ 'use strict'; var ip = exports; @@ -52755,7 +52755,7 @@ ip.fromLong = function(ipl) { (ipl & 255) ); }; -},{"buffer":144,"os":662}],295:[function(require,module,exports){ +},{"buffer":144,"os":659}],295:[function(require,module,exports){ 'use strict' const SECOND = 1000 @@ -53057,7 +53057,7 @@ class DecisionEngine { module.exports = DecisionEngine -},{"../types/message":302,"../types/wantlist":305,"../utils":306,"./ledger":297,"async/each":37,"async/eachSeries":42,"async/map":65,"async/setImmediate":70,"async/waterfall":73,"lodash.debounce":546,"lodash.find":548,"lodash.groupby":550,"lodash.pullallwith":556,"lodash.uniqwith":562,"lodash.values":563}],297:[function(require,module,exports){ +},{"../types/message":302,"../types/wantlist":305,"../utils":306,"./ledger":297,"async/each":37,"async/eachSeries":42,"async/map":65,"async/setImmediate":70,"async/waterfall":73,"lodash.debounce":543,"lodash.find":545,"lodash.groupby":547,"lodash.pullallwith":553,"lodash.uniqwith":559,"lodash.values":560}],297:[function(require,module,exports){ 'use strict' const Wantlist = require('../types/wantlist') @@ -53489,7 +53489,7 @@ class Bitswap { module.exports = Bitswap -},{"./decision-engine":296,"./network":299,"./notifications":300,"./utils":306,"./want-manager":307,"async/each":37,"async/map":65,"async/reject":68,"async/series":69,"async/waterfall":73,"once":661}],299:[function(require,module,exports){ +},{"./decision-engine":296,"./network":299,"./notifications":300,"./utils":306,"./want-manager":307,"async/each":37,"async/map":65,"async/reject":68,"async/series":69,"async/waterfall":73,"once":658}],299:[function(require,module,exports){ 'use strict' const lp = require('pull-length-prefixed') @@ -53681,7 +53681,7 @@ function writeMessage (conn, msg, callback) { module.exports = Network -},{"./constants":295,"./types/message":302,"./utils":306,"async/each":37,"async/setImmediate":70,"async/waterfall":73,"pull-length-prefixed":715,"pull-stream":726}],300:[function(require,module,exports){ +},{"./constants":295,"./types/message":302,"./utils":306,"async/each":37,"async/setImmediate":70,"async/waterfall":73,"pull-length-prefixed":712,"pull-stream":723}],300:[function(require,module,exports){ 'use strict' const EventEmitter = require('events').EventEmitter @@ -54050,7 +54050,7 @@ BitswapMessage.deserialize = (raw, callback) => { BitswapMessage.Entry = Entry module.exports = BitswapMessage -},{"./entry":301,"./message.proto":303,"assert":33,"async/each":37,"cids":146,"ipfs-block":316,"lodash.isequalwith":553,"multicodec/src/name-table":620,"multihashing-async":628,"protons":695,"varint-decoder":857}],303:[function(require,module,exports){ +},{"./entry":301,"./message.proto":303,"assert":33,"async/each":37,"cids":146,"ipfs-block":316,"lodash.isequalwith":550,"multicodec/src/name-table":617,"multihashing-async":625,"protons":692,"varint-decoder":854}],303:[function(require,module,exports){ 'use strict' // from: https://github.com/ipfs/go-ipfs/blob/master/exchange/bitswap/message/pb/message.proto @@ -54200,7 +54200,7 @@ class Wantlist { Wantlist.Entry = Entry module.exports = Wantlist -},{"./entry":304,"lodash.sortby":559}],306:[function(require,module,exports){ +},{"./entry":304,"lodash.sortby":556}],306:[function(require,module,exports){ 'use strict' const debug = require('debug') @@ -54432,7 +54432,7 @@ module.exports = class MsgQueue { } } -},{"../types/message":302,"../utils":306,"lodash.debounce":546}],309:[function(require,module,exports){ +},{"../types/message":302,"../utils":306,"lodash.debounce":543}],309:[function(require,module,exports){ 'use strict' /** @@ -54684,7 +54684,7 @@ CID.isCID = (other) => { module.exports = CID }).call(this,require("buffer").Buffer) -},{"buffer":144,"multibase":617,"multicodec":312,"multicodec/src/base-table":311,"multicodec/src/varint-table":315,"multihashes":624}],311:[function(require,module,exports){ +},{"buffer":144,"multibase":614,"multicodec":312,"multicodec/src/base-table":311,"multicodec/src/varint-table":315,"multihashes":621}],311:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -54845,7 +54845,7 @@ exports.getCodec = (prefixedData) => { } }).call(this,require("buffer").Buffer) -},{"./name-table":313,"./util":314,"./varint-table":315,"buffer":144,"varint":860}],313:[function(require,module,exports){ +},{"./name-table":313,"./util":314,"./varint-table":315,"buffer":144,"varint":857}],313:[function(require,module,exports){ 'use strict' const baseTable = require('./base-table') @@ -54892,7 +54892,7 @@ function varintBufferDecode (input) { } }).call(this,require("buffer").Buffer) -},{"buffer":144,"varint":860}],315:[function(require,module,exports){ +},{"buffer":144,"varint":857}],315:[function(require,module,exports){ 'use strict' const baseTable = require('./base-table') const varintBufferEncode = require('./util').varintBufferEncode @@ -54977,7 +54977,7 @@ class Block { module.exports = Block }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":433,"cids":310}],317:[function(require,module,exports){ +},{"../../is-buffer/index.js":438,"cids":310}],317:[function(require,module,exports){ 'use strict' const EventEmitter = require('events') @@ -55068,7 +55068,7 @@ module.exports = class Connection extends EventEmitter { } } -},{"./encoding":318,"./protocol":320,"events":236,"pull-pushable":721,"pull-stream":726}],318:[function(require,module,exports){ +},{"./encoding":318,"./protocol":320,"events":236,"pull-pushable":718,"pull-stream":723}],318:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -55236,16 +55236,16 @@ class PubSubRoom extends EventEmitter { } } -},{"./connection":317,"./encoding":318,"./protocol":320,"events":236,"hyperdiff":260,"lodash.clonedeep":545,"pull-stream":726,"timers":843}],320:[function(require,module,exports){ +},{"./connection":317,"./encoding":318,"./protocol":320,"events":236,"hyperdiff":260,"lodash.clonedeep":542,"pull-stream":723,"timers":840}],320:[function(require,module,exports){ 'use strict' module.exports = 'ipfs-pubsub-room/v1' },{}],321:[function(require,module,exports){ arguments[4][219][0].apply(exports,arguments) -},{"./debug":322,"_process":682,"dup":219}],322:[function(require,module,exports){ +},{"./debug":322,"_process":679,"dup":219}],322:[function(require,module,exports){ arguments[4][220][0].apply(exports,arguments) -},{"dup":220,"ms":609}],323:[function(require,module,exports){ +},{"dup":220,"ms":606}],323:[function(require,module,exports){ 'use strict' const Key = require('interface-datastore').Key @@ -55286,7 +55286,7 @@ module.exports = (store) => { } } -},{"interface-datastore":290,"safe-buffer":790}],324:[function(require,module,exports){ +},{"interface-datastore":290,"safe-buffer":787}],324:[function(require,module,exports){ 'use strict' exports.create = function createBackend (name, path, options) { @@ -55559,7 +55559,7 @@ module.exports = (store) => { } } -},{"async/queue":67,"async/waterfall":73,"interface-datastore":290,"lodash.get":549,"lodash.has":551,"lodash.set":558,"safe-buffer":790}],327:[function(require,module,exports){ +},{"async/queue":67,"async/waterfall":73,"interface-datastore":290,"lodash.get":546,"lodash.has":548,"lodash.set":555,"safe-buffer":787}],327:[function(require,module,exports){ 'use strict' // Default configuration for a repo in the browser @@ -55585,7 +55585,7 @@ module.exports = { } } -},{"datastore-level":167,"level-js":461}],328:[function(require,module,exports){ +},{"datastore-level":167,"level-js":466}],328:[function(require,module,exports){ 'use strict' const waterfall = require('async/waterfall') @@ -55815,7 +55815,7 @@ function buildOptions (_options) { return options } -},{"./api-addr":323,"./backends":324,"./blockstore":325,"./config":326,"./default-options":327,"./lock":329,"./lock-memory":329,"./version":330,"assert":33,"async/each":37,"async/parallel":66,"async/series":69,"async/waterfall":73,"debug":321,"path":670}],329:[function(require,module,exports){ +},{"./api-addr":323,"./backends":324,"./blockstore":325,"./config":326,"./default-options":327,"./lock":329,"./lock-memory":329,"./version":330,"assert":33,"async/each":37,"async/parallel":66,"async/series":69,"async/waterfall":73,"debug":321,"path":667}],329:[function(require,module,exports){ 'use strict' const debug = require('debug') @@ -55996,7 +55996,7 @@ module.exports = function balancedReduceToRoot (reduce, options) { } } -},{"pull-batch":703,"pull-pair":717,"pull-pushable":721,"pull-stream":726}],333:[function(require,module,exports){ +},{"pull-batch":700,"pull-pair":714,"pull-pushable":718,"pull-stream":723}],333:[function(require,module,exports){ 'use strict' const balancedReducer = require('./balanced-reducer') @@ -56177,7 +56177,7 @@ module.exports = function (createChunker, ipldResolver, createReducer, _options) } }).call(this,require("buffer").Buffer) -},{"./reduce":338,"async/parallel":66,"async/waterfall":73,"buffer":144,"cids":146,"deep-extend":331,"ipfs-unixfs":360,"ipld-dag-pb":403,"pull-stream":726,"pull-through":757}],335:[function(require,module,exports){ +},{"./reduce":338,"async/parallel":66,"async/waterfall":73,"buffer":144,"cids":146,"deep-extend":331,"ipfs-unixfs":360,"ipld-dag-pb":408,"pull-stream":723,"pull-through":754}],335:[function(require,module,exports){ 'use strict' const pullPushable = require('pull-pushable') @@ -56199,7 +56199,7 @@ module.exports = function createBuildStream (createStrategy, ipldResolver, optio } } -},{"pull-pushable":721,"pull-write":759}],336:[function(require,module,exports){ +},{"pull-pushable":718,"pull-write":756}],336:[function(require,module,exports){ 'use strict' const pull = require('pull-stream') @@ -56238,7 +56238,7 @@ module.exports = function (reduce, options) { } } -},{"pull-batch":703,"pull-pair":717,"pull-pushable":721,"pull-stream":726}],337:[function(require,module,exports){ +},{"pull-batch":700,"pull-pair":714,"pull-pushable":718,"pull-stream":723}],337:[function(require,module,exports){ 'use strict' const assert = require('assert') @@ -56338,7 +56338,7 @@ module.exports = function (file, ipldResolver, options) { } } -},{"async/waterfall":73,"cids":146,"ipfs-unixfs":360,"ipld-dag-pb":403}],339:[function(require,module,exports){ +},{"async/waterfall":73,"cids":146,"ipfs-unixfs":360,"ipld-dag-pb":408}],339:[function(require,module,exports){ 'use strict' const trickleReducer = require('./trickle-reducer') @@ -56500,7 +56500,7 @@ module.exports = function trickleReduceToRoot (reduce, options) { } } -},{"pull-batch":703,"pull-pair":717,"pull-pause":720,"pull-pushable":721,"pull-stream":726,"pull-through":757,"pull-write":759}],341:[function(require,module,exports){ +},{"pull-batch":700,"pull-pair":714,"pull-pause":717,"pull-pushable":718,"pull-stream":723,"pull-through":754,"pull-write":756}],341:[function(require,module,exports){ 'use strict' const pullBlock = require('pull-block') @@ -56510,7 +56510,7 @@ module.exports = (options) => { return pullBlock(maxSize, { zeroPadding: false, emitEmpty: true }) } -},{"pull-block":704}],342:[function(require,module,exports){ +},{"pull-block":701}],342:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -56525,7 +56525,7 @@ module.exports = (multihash) => { } }).call(this,{"isBuffer":require("../../../is-buffer/index.js")}) -},{"../../../is-buffer/index.js":433,"multihashes":624}],343:[function(require,module,exports){ +},{"../../../is-buffer/index.js":438,"multihashes":621}],343:[function(require,module,exports){ 'use strict' const path = require('path') @@ -56575,7 +56575,7 @@ function dirExporter (node, name, pathRest, ipldResolver, resolve, parent) { return cat(streams) } -},{"cids":146,"path":670,"pull-cat":705,"pull-paramap":718,"pull-stream":726}],344:[function(require,module,exports){ +},{"cids":146,"path":667,"pull-cat":702,"pull-paramap":715,"pull-stream":723}],344:[function(require,module,exports){ 'use strict' const path = require('path') @@ -56649,7 +56649,7 @@ function shardedDirExporter (node, name, pathRest, ipldResolver, resolve, parent return cat(streams) } -},{"./clean-multihash":342,"cids":146,"path":670,"pull-cat":705,"pull-paramap":718,"pull-stream":726}],345:[function(require,module,exports){ +},{"./clean-multihash":342,"cids":146,"path":667,"pull-cat":702,"pull-paramap":715,"pull-stream":723}],345:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -56698,7 +56698,7 @@ module.exports = (node, name, pathRest, ipldResolver) => { } }).call(this,require("buffer").Buffer) -},{"buffer":144,"cids":146,"ipfs-unixfs":360,"pull-paramap":718,"pull-stream":726,"pull-traverse":758}],346:[function(require,module,exports){ +},{"buffer":144,"cids":146,"ipfs-unixfs":360,"pull-paramap":715,"pull-stream":723,"pull-traverse":755}],346:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -56765,7 +56765,7 @@ module.exports = (path, dag) => { } }).call(this,{"isBuffer":require("../../../is-buffer/index.js")}) -},{"../../../is-buffer/index.js":433,"./resolve":348,"cids":146,"pull-defer":708,"pull-stream":726}],347:[function(require,module,exports){ +},{"../../../is-buffer/index.js":438,"./resolve":348,"cids":146,"pull-defer":705,"pull-stream":723}],347:[function(require,module,exports){ 'use strict' const path = require('path') @@ -56803,7 +56803,7 @@ function sanitizeCID (cid) { return new CID(cid.version, cid.codec, cid.multihash) } -},{"cids":146,"path":670,"pull-defer":708,"pull-stream":726}],348:[function(require,module,exports){ +},{"cids":146,"path":667,"pull-defer":705,"pull-stream":723}],348:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -56840,7 +56840,7 @@ function typeOf (node) { } }).call(this,{"isBuffer":require("../../../is-buffer/index.js")}) -},{"../../../is-buffer/index.js":433,"./dir-flat":343,"./dir-hamt-sharded":344,"./file":345,"./object":347,"ipfs-unixfs":360,"pull-stream":726}],349:[function(require,module,exports){ +},{"../../../is-buffer/index.js":438,"./dir-flat":343,"./dir-hamt-sharded":344,"./file":345,"./object":347,"ipfs-unixfs":360,"pull-stream":723}],349:[function(require,module,exports){ (function (process){ 'use strict' @@ -57133,7 +57133,7 @@ function asyncTransformBucket (bucket, asyncMap, asyncReduce, callback) { module.exports = Bucket }).call(this,require('_process')) -},{"./consumable-hash":351,"_process":682,"async/eachSeries":42,"async/map":65,"sparse-array":831}],350:[function(require,module,exports){ +},{"./consumable-hash":351,"_process":679,"async/eachSeries":42,"async/map":65,"sparse-array":828}],350:[function(require,module,exports){ 'use strict' const START_MASKS = [ @@ -57324,7 +57324,7 @@ class InfiniteHash { } }).call(this,{"isBuffer":require("../../../is-buffer/index.js")},require('_process')) -},{"../../../is-buffer/index.js":433,"./consumable-buffer":350,"_process":682,"async/whilst":74}],352:[function(require,module,exports){ +},{"../../../is-buffer/index.js":438,"./consumable-buffer":350,"_process":679,"async/whilst":74}],352:[function(require,module,exports){ 'use strict' const Bucket = require('./bucket') @@ -57434,7 +57434,7 @@ function createDirFlat (props, _options) { } }).call(this,require('_process')) -},{"./dir":355,"_process":682,"async/eachSeries":42,"async/waterfall":73,"cids":146,"ipfs-unixfs":360,"ipld-dag-pb":403}],354:[function(require,module,exports){ +},{"./dir":355,"_process":679,"async/eachSeries":42,"async/waterfall":73,"cids":146,"ipfs-unixfs":360,"ipld-dag-pb":408}],354:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -57611,7 +57611,7 @@ function flush (options, bucket, path, ipldResolver, source, callback) { } }).call(this,require("buffer").Buffer) -},{"../hamt":352,"./dir":355,"async/waterfall":73,"async/whilst":74,"buffer":144,"cids":146,"ipfs-unixfs":360,"ipld-dag-pb":403,"left-pad":448,"multihashing-async":628}],355:[function(require,module,exports){ +},{"../hamt":352,"./dir":355,"async/waterfall":73,"async/whilst":74,"buffer":144,"cids":146,"ipfs-unixfs":360,"ipld-dag-pb":408,"left-pad":453,"multihashing-async":625}],355:[function(require,module,exports){ 'use strict' module.exports = class Dir { @@ -57799,7 +57799,7 @@ module.exports = function (ipldResolver, _options) { } }).call(this,require('_process')) -},{"../builder":337,"../chunker/fixed-size":341,"./tree-builder":358,"_process":682,"assert":33,"async/setImmediate":70,"pull-pause":720,"pull-pushable":721,"pull-stream":726,"pull-write":759}],358:[function(require,module,exports){ +},{"../builder":337,"../chunker/fixed-size":341,"./tree-builder":358,"_process":679,"assert":33,"async/setImmediate":70,"pull-pause":717,"pull-pushable":718,"pull-stream":723,"pull-write":756}],358:[function(require,module,exports){ (function (process){ 'use strict' @@ -58020,7 +58020,7 @@ function notEmpty (str) { } }).call(this,require('_process')) -},{"./dir":355,"./dir-flat":353,"./flat-to-shard":356,"_process":682,"async/eachOfSeries":41,"async/eachSeries":42,"async/queue":67,"async/waterfall":73,"pull-pushable":721,"pull-write":759}],359:[function(require,module,exports){ +},{"./dir":355,"./dir-flat":353,"./flat-to-shard":356,"_process":679,"async/eachOfSeries":41,"async/eachSeries":42,"async/queue":67,"async/waterfall":73,"pull-pushable":718,"pull-write":756}],359:[function(require,module,exports){ 'use strict' exports.importer = exports.Importer = require('./importer') @@ -58130,7 +58130,7 @@ Data.unmarshal = (marsheled) => { exports = module.exports = Data -},{"./unixfs.proto":361,"protons":695}],361:[function(require,module,exports){ +},{"./unixfs.proto":361,"protons":692}],361:[function(require,module,exports){ 'use strict' module.exports = `message Data { @@ -58157,13 +58157,1468 @@ message Metadata { }` },{}],362:[function(require,module,exports){ +'use strict' + +const connect = require('pull-ws/client') +const mafmt = require('mafmt') +const includes = require('lodash.includes') +const Connection = require('interface-connection').Connection + +const maToUrl = require('./ma-to-url') +const debug = require('debug') +const log = debug('libp2p:websockets:dialer') + +const createListener = require('./listener') + +class WebSockets { + dial (ma, options, callback) { + if (typeof options === 'function') { + callback = options + options = {} + } + + callback = callback || function () {} + + const url = maToUrl(ma) + log('dialing %s', url) + const socket = connect(url, { + binary: true, + onConnect: (err) => { + callback(err) + } + }) + + const conn = new Connection(socket) + conn.getObservedAddrs = (cb) => cb(null, [ma]) + conn.close = (cb) => socket.close(cb) + + return conn + } + + createListener (options, handler) { + if (typeof options === 'function') { + handler = options + options = {} + } + + return createListener(options, handler) + } + + filter (multiaddrs) { + if (!Array.isArray(multiaddrs)) { + multiaddrs = [multiaddrs] + } + + return multiaddrs.filter((ma) => { + if (includes(ma.protoNames(), 'p2p-circuit')) { + return false + } + + if (includes(ma.protoNames(), 'ipfs')) { + ma = ma.decapsulate('ipfs') + } + + return mafmt.WebSockets.matches(ma) || + mafmt.WebSocketsSecure.matches(ma) + }) + } +} + +module.exports = WebSockets + +},{"./listener":363,"./ma-to-url":364,"debug":168,"interface-connection":289,"lodash.includes":549,"mafmt":599,"pull-ws/client":758}],363:[function(require,module,exports){ +'use strict' + +const Connection = require('interface-connection').Connection +const includes = require('lodash.includes') +const multiaddr = require('multiaddr') +const os = require('os') + +function noop () {} + +const createServer = require('pull-ws/server') || noop + +module.exports = (options, handler) => { + const listener = createServer((socket) => { + socket.getObservedAddrs = (callback) => { + // TODO research if we can reuse the address in anyway + return callback(null, []) + } + + handler(new Connection(socket)) + }) + + let listeningMultiaddr + + listener._listen = listener.listen + listener.listen = (ma, callback) => { + callback = callback || noop + listeningMultiaddr = ma + + if (includes(ma.protoNames(), 'ipfs')) { + ma = ma.decapsulate('ipfs') + } + + listener._listen(ma.toOptions(), callback) + } + + listener.getAddrs = (callback) => { + const multiaddrs = [] + const address = listener.address() + + if (!address) { + return callback(new Error('Listener is not ready yet')) + } + + let ipfsId = listeningMultiaddr.getPeerId() + + // Because TCP will only return the IPv6 version + // we need to capture from the passed multiaddr + if (listeningMultiaddr.toString().indexOf('ip4') !== -1) { + let m = listeningMultiaddr.decapsulate('tcp') + m = m.encapsulate('/tcp/' + address.port + '/ws') + if (listeningMultiaddr.getPeerId()) { + m = m.encapsulate('/ipfs/' + ipfsId) + } + + if (m.toString().indexOf('0.0.0.0') !== -1) { + const netInterfaces = os.networkInterfaces() + Object.keys(netInterfaces).forEach((niKey) => { + netInterfaces[niKey].forEach((ni) => { + if (ni.family === 'IPv4') { + multiaddrs.push(multiaddr(m.toString().replace('0.0.0.0', ni.address))) + } + }) + }) + } else { + multiaddrs.push(m) + } + } + + callback(null, multiaddrs) + } + + return listener +} + +},{"interface-connection":289,"lodash.includes":549,"multiaddr":609,"os":659,"pull-ws/server":98}],364:[function(require,module,exports){ +'use strict' + +const debug = require('debug') +const log = debug('libp2p:websockets:dialer') + +function maToUrl (ma) { + const maStrSplit = ma.toString().split('/') + + let proto + try { + proto = ma.protoNames().filter((proto) => { + return proto === 'ws' || proto === 'wss' + })[0] + } catch (e) { + log(e) + throw new Error('Not a valid websocket address', e) + } + + let port + try { + port = ma.stringTuples().filter((tuple) => { + if (tuple[0] === ma.protos().filter((proto) => { + return proto.name === 'tcp' + })[0].code) { + return true + } + })[0][1] + } catch (e) { + log('No port, skipping') + } + + let url = `${proto}://${maStrSplit[2]}${(port && (port !== 80 || port !== 443) ? `:${port}` : '')}` + + return url +} + +module.exports = maToUrl + +},{"debug":168}],365:[function(require,module,exports){ +/* eslint quote-props: off */ +/* eslint key-spacing: off */ +'use strict' + +exports.names = Object.freeze({ + 'sha1': 0x11, + 'sha2-256': 0x12, + 'sha2-512': 0x13, + 'sha3-224': 0x17, + 'sha3-256': 0x16, + 'sha3-384': 0x15, + 'sha3-512': 0x14, + 'shake-128': 0x18, + 'shake-256': 0x19, + 'keccak-224': 0x1A, + 'keccak-256': 0x1B, + 'keccak-384': 0x1C, + 'keccak-512': 0x1D, + 'murmur3-128': 0x22, + 'murmur3-32': 0x23, + 'blake2b-8': 0xb201, + 'blake2b-16': 0xb202, + 'blake2b-24': 0xb203, + 'blake2b-32': 0xb204, + 'blake2b-40': 0xb205, + 'blake2b-48': 0xb206, + 'blake2b-56': 0xb207, + 'blake2b-64': 0xb208, + 'blake2b-72': 0xb209, + 'blake2b-80': 0xb20a, + 'blake2b-88': 0xb20b, + 'blake2b-96': 0xb20c, + 'blake2b-104': 0xb20d, + 'blake2b-112': 0xb20e, + 'blake2b-120': 0xb20f, + 'blake2b-128': 0xb210, + 'blake2b-136': 0xb211, + 'blake2b-144': 0xb212, + 'blake2b-152': 0xb213, + 'blake2b-160': 0xb214, + 'blake2b-168': 0xb215, + 'blake2b-176': 0xb216, + 'blake2b-184': 0xb217, + 'blake2b-192': 0xb218, + 'blake2b-200': 0xb219, + 'blake2b-208': 0xb21a, + 'blake2b-216': 0xb21b, + 'blake2b-224': 0xb21c, + 'blake2b-232': 0xb21d, + 'blake2b-240': 0xb21e, + 'blake2b-248': 0xb21f, + 'blake2b-256': 0xb220, + 'blake2b-264': 0xb221, + 'blake2b-272': 0xb222, + 'blake2b-280': 0xb223, + 'blake2b-288': 0xb224, + 'blake2b-296': 0xb225, + 'blake2b-304': 0xb226, + 'blake2b-312': 0xb227, + 'blake2b-320': 0xb228, + 'blake2b-328': 0xb229, + 'blake2b-336': 0xb22a, + 'blake2b-344': 0xb22b, + 'blake2b-352': 0xb22c, + 'blake2b-360': 0xb22d, + 'blake2b-368': 0xb22e, + 'blake2b-376': 0xb22f, + 'blake2b-384': 0xb230, + 'blake2b-392': 0xb231, + 'blake2b-400': 0xb232, + 'blake2b-408': 0xb233, + 'blake2b-416': 0xb234, + 'blake2b-424': 0xb235, + 'blake2b-432': 0xb236, + 'blake2b-440': 0xb237, + 'blake2b-448': 0xb238, + 'blake2b-456': 0xb239, + 'blake2b-464': 0xb23a, + 'blake2b-472': 0xb23b, + 'blake2b-480': 0xb23c, + 'blake2b-488': 0xb23d, + 'blake2b-496': 0xb23e, + 'blake2b-504': 0xb23f, + 'blake2b-512': 0xb240, + 'blake2s-8': 0xb241, + 'blake2s-16': 0xb242, + 'blake2s-24': 0xb243, + 'blake2s-32': 0xb244, + 'blake2s-40': 0xb245, + 'blake2s-48': 0xb246, + 'blake2s-56': 0xb247, + 'blake2s-64': 0xb248, + 'blake2s-72': 0xb249, + 'blake2s-80': 0xb24a, + 'blake2s-88': 0xb24b, + 'blake2s-96': 0xb24c, + 'blake2s-104': 0xb24d, + 'blake2s-112': 0xb24e, + 'blake2s-120': 0xb24f, + 'blake2s-128': 0xb250, + 'blake2s-136': 0xb251, + 'blake2s-144': 0xb252, + 'blake2s-152': 0xb253, + 'blake2s-160': 0xb254, + 'blake2s-168': 0xb255, + 'blake2s-176': 0xb256, + 'blake2s-184': 0xb257, + 'blake2s-192': 0xb258, + 'blake2s-200': 0xb259, + 'blake2s-208': 0xb25a, + 'blake2s-216': 0xb25b, + 'blake2s-224': 0xb25c, + 'blake2s-232': 0xb25d, + 'blake2s-240': 0xb25e, + 'blake2s-248': 0xb25f, + 'blake2s-256': 0xb260, + 'Skein256-8': 0xb301, + 'Skein256-16': 0xb302, + 'Skein256-24': 0xb303, + 'Skein256-32': 0xb304, + 'Skein256-40': 0xb305, + 'Skein256-48': 0xb306, + 'Skein256-56': 0xb307, + 'Skein256-64': 0xb308, + 'Skein256-72': 0xb309, + 'Skein256-80': 0xb30a, + 'Skein256-88': 0xb30b, + 'Skein256-96': 0xb30c, + 'Skein256-104': 0xb30d, + 'Skein256-112': 0xb30e, + 'Skein256-120': 0xb30f, + 'Skein256-128': 0xb310, + 'Skein256-136': 0xb311, + 'Skein256-144': 0xb312, + 'Skein256-152': 0xb313, + 'Skein256-160': 0xb314, + 'Skein256-168': 0xb315, + 'Skein256-176': 0xb316, + 'Skein256-184': 0xb317, + 'Skein256-192': 0xb318, + 'Skein256-200': 0xb319, + 'Skein256-208': 0xb31a, + 'Skein256-216': 0xb31b, + 'Skein256-224': 0xb31c, + 'Skein256-232': 0xb31d, + 'Skein256-240': 0xb31e, + 'Skein256-248': 0xb31f, + 'Skein256-256': 0xb320, + 'Skein512-8': 0xb321, + 'Skein512-16': 0xb322, + 'Skein512-24': 0xb323, + 'Skein512-32': 0xb324, + 'Skein512-40': 0xb325, + 'Skein512-48': 0xb326, + 'Skein512-56': 0xb327, + 'Skein512-64': 0xb328, + 'Skein512-72': 0xb329, + 'Skein512-80': 0xb32a, + 'Skein512-88': 0xb32b, + 'Skein512-96': 0xb32c, + 'Skein512-104': 0xb32d, + 'Skein512-112': 0xb32e, + 'Skein512-120': 0xb32f, + 'Skein512-128': 0xb330, + 'Skein512-136': 0xb331, + 'Skein512-144': 0xb332, + 'Skein512-152': 0xb333, + 'Skein512-160': 0xb334, + 'Skein512-168': 0xb335, + 'Skein512-176': 0xb336, + 'Skein512-184': 0xb337, + 'Skein512-192': 0xb338, + 'Skein512-200': 0xb339, + 'Skein512-208': 0xb33a, + 'Skein512-216': 0xb33b, + 'Skein512-224': 0xb33c, + 'Skein512-232': 0xb33d, + 'Skein512-240': 0xb33e, + 'Skein512-248': 0xb33f, + 'Skein512-256': 0xb340, + 'Skein512-264': 0xb341, + 'Skein512-272': 0xb342, + 'Skein512-280': 0xb343, + 'Skein512-288': 0xb344, + 'Skein512-296': 0xb345, + 'Skein512-304': 0xb346, + 'Skein512-312': 0xb347, + 'Skein512-320': 0xb348, + 'Skein512-328': 0xb349, + 'Skein512-336': 0xb34a, + 'Skein512-344': 0xb34b, + 'Skein512-352': 0xb34c, + 'Skein512-360': 0xb34d, + 'Skein512-368': 0xb34e, + 'Skein512-376': 0xb34f, + 'Skein512-384': 0xb350, + 'Skein512-392': 0xb351, + 'Skein512-400': 0xb352, + 'Skein512-408': 0xb353, + 'Skein512-416': 0xb354, + 'Skein512-424': 0xb355, + 'Skein512-432': 0xb356, + 'Skein512-440': 0xb357, + 'Skein512-448': 0xb358, + 'Skein512-456': 0xb359, + 'Skein512-464': 0xb35a, + 'Skein512-472': 0xb35b, + 'Skein512-480': 0xb35c, + 'Skein512-488': 0xb35d, + 'Skein512-496': 0xb35e, + 'Skein512-504': 0xb35f, + 'Skein512-512': 0xb360, + 'Skein1024-8': 0xb361, + 'Skein1024-16': 0xb362, + 'Skein1024-24': 0xb363, + 'Skein1024-32': 0xb364, + 'Skein1024-40': 0xb365, + 'Skein1024-48': 0xb366, + 'Skein1024-56': 0xb367, + 'Skein1024-64': 0xb368, + 'Skein1024-72': 0xb369, + 'Skein1024-80': 0xb36a, + 'Skein1024-88': 0xb36b, + 'Skein1024-96': 0xb36c, + 'Skein1024-104': 0xb36d, + 'Skein1024-112': 0xb36e, + 'Skein1024-120': 0xb36f, + 'Skein1024-128': 0xb370, + 'Skein1024-136': 0xb371, + 'Skein1024-144': 0xb372, + 'Skein1024-152': 0xb373, + 'Skein1024-160': 0xb374, + 'Skein1024-168': 0xb375, + 'Skein1024-176': 0xb376, + 'Skein1024-184': 0xb377, + 'Skein1024-192': 0xb378, + 'Skein1024-200': 0xb379, + 'Skein1024-208': 0xb37a, + 'Skein1024-216': 0xb37b, + 'Skein1024-224': 0xb37c, + 'Skein1024-232': 0xb37d, + 'Skein1024-240': 0xb37e, + 'Skein1024-248': 0xb37f, + 'Skein1024-256': 0xb380, + 'Skein1024-264': 0xb381, + 'Skein1024-272': 0xb382, + 'Skein1024-280': 0xb383, + 'Skein1024-288': 0xb384, + 'Skein1024-296': 0xb385, + 'Skein1024-304': 0xb386, + 'Skein1024-312': 0xb387, + 'Skein1024-320': 0xb388, + 'Skein1024-328': 0xb389, + 'Skein1024-336': 0xb38a, + 'Skein1024-344': 0xb38b, + 'Skein1024-352': 0xb38c, + 'Skein1024-360': 0xb38d, + 'Skein1024-368': 0xb38e, + 'Skein1024-376': 0xb38f, + 'Skein1024-384': 0xb390, + 'Skein1024-392': 0xb391, + 'Skein1024-400': 0xb392, + 'Skein1024-408': 0xb393, + 'Skein1024-416': 0xb394, + 'Skein1024-424': 0xb395, + 'Skein1024-432': 0xb396, + 'Skein1024-440': 0xb397, + 'Skein1024-448': 0xb398, + 'Skein1024-456': 0xb399, + 'Skein1024-464': 0xb39a, + 'Skein1024-472': 0xb39b, + 'Skein1024-480': 0xb39c, + 'Skein1024-488': 0xb39d, + 'Skein1024-496': 0xb39e, + 'Skein1024-504': 0xb39f, + 'Skein1024-512': 0xb3a0, + 'Skein1024-520': 0xb3a1, + 'Skein1024-528': 0xb3a2, + 'Skein1024-536': 0xb3a3, + 'Skein1024-544': 0xb3a4, + 'Skein1024-552': 0xb3a5, + 'Skein1024-560': 0xb3a6, + 'Skein1024-568': 0xb3a7, + 'Skein1024-576': 0xb3a8, + 'Skein1024-584': 0xb3a9, + 'Skein1024-592': 0xb3aa, + 'Skein1024-600': 0xb3ab, + 'Skein1024-608': 0xb3ac, + 'Skein1024-616': 0xb3ad, + 'Skein1024-624': 0xb3ae, + 'Skein1024-632': 0xb3af, + 'Skein1024-640': 0xb3b0, + 'Skein1024-648': 0xb3b1, + 'Skein1024-656': 0xb3b2, + 'Skein1024-664': 0xb3b3, + 'Skein1024-672': 0xb3b4, + 'Skein1024-680': 0xb3b5, + 'Skein1024-688': 0xb3b6, + 'Skein1024-696': 0xb3b7, + 'Skein1024-704': 0xb3b8, + 'Skein1024-712': 0xb3b9, + 'Skein1024-720': 0xb3ba, + 'Skein1024-728': 0xb3bb, + 'Skein1024-736': 0xb3bc, + 'Skein1024-744': 0xb3bd, + 'Skein1024-752': 0xb3be, + 'Skein1024-760': 0xb3bf, + 'Skein1024-768': 0xb3c0, + 'Skein1024-776': 0xb3c1, + 'Skein1024-784': 0xb3c2, + 'Skein1024-792': 0xb3c3, + 'Skein1024-800': 0xb3c4, + 'Skein1024-808': 0xb3c5, + 'Skein1024-816': 0xb3c6, + 'Skein1024-824': 0xb3c7, + 'Skein1024-832': 0xb3c8, + 'Skein1024-840': 0xb3c9, + 'Skein1024-848': 0xb3ca, + 'Skein1024-856': 0xb3cb, + 'Skein1024-864': 0xb3cc, + 'Skein1024-872': 0xb3cd, + 'Skein1024-880': 0xb3ce, + 'Skein1024-888': 0xb3cf, + 'Skein1024-896': 0xb3d0, + 'Skein1024-904': 0xb3d1, + 'Skein1024-912': 0xb3d2, + 'Skein1024-920': 0xb3d3, + 'Skein1024-928': 0xb3d4, + 'Skein1024-936': 0xb3d5, + 'Skein1024-944': 0xb3d6, + 'Skein1024-952': 0xb3d7, + 'Skein1024-960': 0xb3d8, + 'Skein1024-968': 0xb3d9, + 'Skein1024-976': 0xb3da, + 'Skein1024-984': 0xb3db, + 'Skein1024-992': 0xb3dc, + 'Skein1024-1000': 0xb3dd, + 'Skein1024-1008': 0xb3de, + 'Skein1024-1016': 0xb3df, + 'Skein1024-1024': 0xb3e0 +}) + +exports.codes = Object.freeze({ + 0x11: 'sha1', + 0x12: 'sha2-256', + 0x13: 'sha2-512', + 0x17: 'sha3-224', + 0x16: 'sha3-256', + 0x15: 'sha3-384', + 0x14: 'sha3-512', + 0x18: 'shake-128', + 0x19: 'shake-256', + 0x1A: 'keccak-224', + 0x1B: 'keccak-256', + 0x1C: 'keccak-384', + 0x1D: 'keccak-512', + 0x22: 'murmur3-128', + 0x23: 'murmur3-32', + + // blake2 + 0xb201: 'blake2b-8', + 0xb202: 'blake2b-16', + 0xb203: 'blake2b-24', + 0xb204: 'blake2b-32', + 0xb205: 'blake2b-40', + 0xb206: 'blake2b-48', + 0xb207: 'blake2b-56', + 0xb208: 'blake2b-64', + 0xb209: 'blake2b-72', + 0xb20a: 'blake2b-80', + 0xb20b: 'blake2b-88', + 0xb20c: 'blake2b-96', + 0xb20d: 'blake2b-104', + 0xb20e: 'blake2b-112', + 0xb20f: 'blake2b-120', + 0xb210: 'blake2b-128', + 0xb211: 'blake2b-136', + 0xb212: 'blake2b-144', + 0xb213: 'blake2b-152', + 0xb214: 'blake2b-160', + 0xb215: 'blake2b-168', + 0xb216: 'blake2b-176', + 0xb217: 'blake2b-184', + 0xb218: 'blake2b-192', + 0xb219: 'blake2b-200', + 0xb21a: 'blake2b-208', + 0xb21b: 'blake2b-216', + 0xb21c: 'blake2b-224', + 0xb21d: 'blake2b-232', + 0xb21e: 'blake2b-240', + 0xb21f: 'blake2b-248', + 0xb220: 'blake2b-256', + 0xb221: 'blake2b-264', + 0xb222: 'blake2b-272', + 0xb223: 'blake2b-280', + 0xb224: 'blake2b-288', + 0xb225: 'blake2b-296', + 0xb226: 'blake2b-304', + 0xb227: 'blake2b-312', + 0xb228: 'blake2b-320', + 0xb229: 'blake2b-328', + 0xb22a: 'blake2b-336', + 0xb22b: 'blake2b-344', + 0xb22c: 'blake2b-352', + 0xb22d: 'blake2b-360', + 0xb22e: 'blake2b-368', + 0xb22f: 'blake2b-376', + 0xb230: 'blake2b-384', + 0xb231: 'blake2b-392', + 0xb232: 'blake2b-400', + 0xb233: 'blake2b-408', + 0xb234: 'blake2b-416', + 0xb235: 'blake2b-424', + 0xb236: 'blake2b-432', + 0xb237: 'blake2b-440', + 0xb238: 'blake2b-448', + 0xb239: 'blake2b-456', + 0xb23a: 'blake2b-464', + 0xb23b: 'blake2b-472', + 0xb23c: 'blake2b-480', + 0xb23d: 'blake2b-488', + 0xb23e: 'blake2b-496', + 0xb23f: 'blake2b-504', + 0xb240: 'blake2b-512', + 0xb241: 'blake2s-8', + 0xb242: 'blake2s-16', + 0xb243: 'blake2s-24', + 0xb244: 'blake2s-32', + 0xb245: 'blake2s-40', + 0xb246: 'blake2s-48', + 0xb247: 'blake2s-56', + 0xb248: 'blake2s-64', + 0xb249: 'blake2s-72', + 0xb24a: 'blake2s-80', + 0xb24b: 'blake2s-88', + 0xb24c: 'blake2s-96', + 0xb24d: 'blake2s-104', + 0xb24e: 'blake2s-112', + 0xb24f: 'blake2s-120', + 0xb250: 'blake2s-128', + 0xb251: 'blake2s-136', + 0xb252: 'blake2s-144', + 0xb253: 'blake2s-152', + 0xb254: 'blake2s-160', + 0xb255: 'blake2s-168', + 0xb256: 'blake2s-176', + 0xb257: 'blake2s-184', + 0xb258: 'blake2s-192', + 0xb259: 'blake2s-200', + 0xb25a: 'blake2s-208', + 0xb25b: 'blake2s-216', + 0xb25c: 'blake2s-224', + 0xb25d: 'blake2s-232', + 0xb25e: 'blake2s-240', + 0xb25f: 'blake2s-248', + 0xb260: 'blake2s-256', + + // skein + 0xb301: 'Skein256-8', + 0xb302: 'Skein256-16', + 0xb303: 'Skein256-24', + 0xb304: 'Skein256-32', + 0xb305: 'Skein256-40', + 0xb306: 'Skein256-48', + 0xb307: 'Skein256-56', + 0xb308: 'Skein256-64', + 0xb309: 'Skein256-72', + 0xb30a: 'Skein256-80', + 0xb30b: 'Skein256-88', + 0xb30c: 'Skein256-96', + 0xb30d: 'Skein256-104', + 0xb30e: 'Skein256-112', + 0xb30f: 'Skein256-120', + 0xb310: 'Skein256-128', + 0xb311: 'Skein256-136', + 0xb312: 'Skein256-144', + 0xb313: 'Skein256-152', + 0xb314: 'Skein256-160', + 0xb315: 'Skein256-168', + 0xb316: 'Skein256-176', + 0xb317: 'Skein256-184', + 0xb318: 'Skein256-192', + 0xb319: 'Skein256-200', + 0xb31a: 'Skein256-208', + 0xb31b: 'Skein256-216', + 0xb31c: 'Skein256-224', + 0xb31d: 'Skein256-232', + 0xb31e: 'Skein256-240', + 0xb31f: 'Skein256-248', + 0xb320: 'Skein256-256', + 0xb321: 'Skein512-8', + 0xb322: 'Skein512-16', + 0xb323: 'Skein512-24', + 0xb324: 'Skein512-32', + 0xb325: 'Skein512-40', + 0xb326: 'Skein512-48', + 0xb327: 'Skein512-56', + 0xb328: 'Skein512-64', + 0xb329: 'Skein512-72', + 0xb32a: 'Skein512-80', + 0xb32b: 'Skein512-88', + 0xb32c: 'Skein512-96', + 0xb32d: 'Skein512-104', + 0xb32e: 'Skein512-112', + 0xb32f: 'Skein512-120', + 0xb330: 'Skein512-128', + 0xb331: 'Skein512-136', + 0xb332: 'Skein512-144', + 0xb333: 'Skein512-152', + 0xb334: 'Skein512-160', + 0xb335: 'Skein512-168', + 0xb336: 'Skein512-176', + 0xb337: 'Skein512-184', + 0xb338: 'Skein512-192', + 0xb339: 'Skein512-200', + 0xb33a: 'Skein512-208', + 0xb33b: 'Skein512-216', + 0xb33c: 'Skein512-224', + 0xb33d: 'Skein512-232', + 0xb33e: 'Skein512-240', + 0xb33f: 'Skein512-248', + 0xb340: 'Skein512-256', + 0xb341: 'Skein512-264', + 0xb342: 'Skein512-272', + 0xb343: 'Skein512-280', + 0xb344: 'Skein512-288', + 0xb345: 'Skein512-296', + 0xb346: 'Skein512-304', + 0xb347: 'Skein512-312', + 0xb348: 'Skein512-320', + 0xb349: 'Skein512-328', + 0xb34a: 'Skein512-336', + 0xb34b: 'Skein512-344', + 0xb34c: 'Skein512-352', + 0xb34d: 'Skein512-360', + 0xb34e: 'Skein512-368', + 0xb34f: 'Skein512-376', + 0xb350: 'Skein512-384', + 0xb351: 'Skein512-392', + 0xb352: 'Skein512-400', + 0xb353: 'Skein512-408', + 0xb354: 'Skein512-416', + 0xb355: 'Skein512-424', + 0xb356: 'Skein512-432', + 0xb357: 'Skein512-440', + 0xb358: 'Skein512-448', + 0xb359: 'Skein512-456', + 0xb35a: 'Skein512-464', + 0xb35b: 'Skein512-472', + 0xb35c: 'Skein512-480', + 0xb35d: 'Skein512-488', + 0xb35e: 'Skein512-496', + 0xb35f: 'Skein512-504', + 0xb360: 'Skein512-512', + 0xb361: 'Skein1024-8', + 0xb362: 'Skein1024-16', + 0xb363: 'Skein1024-24', + 0xb364: 'Skein1024-32', + 0xb365: 'Skein1024-40', + 0xb366: 'Skein1024-48', + 0xb367: 'Skein1024-56', + 0xb368: 'Skein1024-64', + 0xb369: 'Skein1024-72', + 0xb36a: 'Skein1024-80', + 0xb36b: 'Skein1024-88', + 0xb36c: 'Skein1024-96', + 0xb36d: 'Skein1024-104', + 0xb36e: 'Skein1024-112', + 0xb36f: 'Skein1024-120', + 0xb370: 'Skein1024-128', + 0xb371: 'Skein1024-136', + 0xb372: 'Skein1024-144', + 0xb373: 'Skein1024-152', + 0xb374: 'Skein1024-160', + 0xb375: 'Skein1024-168', + 0xb376: 'Skein1024-176', + 0xb377: 'Skein1024-184', + 0xb378: 'Skein1024-192', + 0xb379: 'Skein1024-200', + 0xb37a: 'Skein1024-208', + 0xb37b: 'Skein1024-216', + 0xb37c: 'Skein1024-224', + 0xb37d: 'Skein1024-232', + 0xb37e: 'Skein1024-240', + 0xb37f: 'Skein1024-248', + 0xb380: 'Skein1024-256', + 0xb381: 'Skein1024-264', + 0xb382: 'Skein1024-272', + 0xb383: 'Skein1024-280', + 0xb384: 'Skein1024-288', + 0xb385: 'Skein1024-296', + 0xb386: 'Skein1024-304', + 0xb387: 'Skein1024-312', + 0xb388: 'Skein1024-320', + 0xb389: 'Skein1024-328', + 0xb38a: 'Skein1024-336', + 0xb38b: 'Skein1024-344', + 0xb38c: 'Skein1024-352', + 0xb38d: 'Skein1024-360', + 0xb38e: 'Skein1024-368', + 0xb38f: 'Skein1024-376', + 0xb390: 'Skein1024-384', + 0xb391: 'Skein1024-392', + 0xb392: 'Skein1024-400', + 0xb393: 'Skein1024-408', + 0xb394: 'Skein1024-416', + 0xb395: 'Skein1024-424', + 0xb396: 'Skein1024-432', + 0xb397: 'Skein1024-440', + 0xb398: 'Skein1024-448', + 0xb399: 'Skein1024-456', + 0xb39a: 'Skein1024-464', + 0xb39b: 'Skein1024-472', + 0xb39c: 'Skein1024-480', + 0xb39d: 'Skein1024-488', + 0xb39e: 'Skein1024-496', + 0xb39f: 'Skein1024-504', + 0xb3a0: 'Skein1024-512', + 0xb3a1: 'Skein1024-520', + 0xb3a2: 'Skein1024-528', + 0xb3a3: 'Skein1024-536', + 0xb3a4: 'Skein1024-544', + 0xb3a5: 'Skein1024-552', + 0xb3a6: 'Skein1024-560', + 0xb3a7: 'Skein1024-568', + 0xb3a8: 'Skein1024-576', + 0xb3a9: 'Skein1024-584', + 0xb3aa: 'Skein1024-592', + 0xb3ab: 'Skein1024-600', + 0xb3ac: 'Skein1024-608', + 0xb3ad: 'Skein1024-616', + 0xb3ae: 'Skein1024-624', + 0xb3af: 'Skein1024-632', + 0xb3b0: 'Skein1024-640', + 0xb3b1: 'Skein1024-648', + 0xb3b2: 'Skein1024-656', + 0xb3b3: 'Skein1024-664', + 0xb3b4: 'Skein1024-672', + 0xb3b5: 'Skein1024-680', + 0xb3b6: 'Skein1024-688', + 0xb3b7: 'Skein1024-696', + 0xb3b8: 'Skein1024-704', + 0xb3b9: 'Skein1024-712', + 0xb3ba: 'Skein1024-720', + 0xb3bb: 'Skein1024-728', + 0xb3bc: 'Skein1024-736', + 0xb3bd: 'Skein1024-744', + 0xb3be: 'Skein1024-752', + 0xb3bf: 'Skein1024-760', + 0xb3c0: 'Skein1024-768', + 0xb3c1: 'Skein1024-776', + 0xb3c2: 'Skein1024-784', + 0xb3c3: 'Skein1024-792', + 0xb3c4: 'Skein1024-800', + 0xb3c5: 'Skein1024-808', + 0xb3c6: 'Skein1024-816', + 0xb3c7: 'Skein1024-824', + 0xb3c8: 'Skein1024-832', + 0xb3c9: 'Skein1024-840', + 0xb3ca: 'Skein1024-848', + 0xb3cb: 'Skein1024-856', + 0xb3cc: 'Skein1024-864', + 0xb3cd: 'Skein1024-872', + 0xb3ce: 'Skein1024-880', + 0xb3cf: 'Skein1024-888', + 0xb3d0: 'Skein1024-896', + 0xb3d1: 'Skein1024-904', + 0xb3d2: 'Skein1024-912', + 0xb3d3: 'Skein1024-920', + 0xb3d4: 'Skein1024-928', + 0xb3d5: 'Skein1024-936', + 0xb3d6: 'Skein1024-944', + 0xb3d7: 'Skein1024-952', + 0xb3d8: 'Skein1024-960', + 0xb3d9: 'Skein1024-968', + 0xb3da: 'Skein1024-976', + 0xb3db: 'Skein1024-984', + 0xb3dc: 'Skein1024-992', + 0xb3dd: 'Skein1024-1000', + 0xb3de: 'Skein1024-1008', + 0xb3df: 'Skein1024-1016', + 0xb3e0: 'Skein1024-1024' +}) + +exports.defaultLengths = Object.freeze({ + 0x11: 20, + 0x12: 32, + 0x13: 64, + 0x17: 28, + 0x16: 32, + 0x15: 48, + 0x14: 64, + 0x18: 32, + 0x19: 64, + 0x1A: 28, + 0x1B: 32, + 0x1C: 48, + 0x1D: 64, + 0x22: 32, + + 0xb201: 0x01, + 0xb202: 0x02, + 0xb203: 0x03, + 0xb204: 0x04, + 0xb205: 0x05, + 0xb206: 0x06, + 0xb207: 0x07, + 0xb208: 0x08, + 0xb209: 0x09, + 0xb20a: 0x0a, + 0xb20b: 0x0b, + 0xb20c: 0x0c, + 0xb20d: 0x0d, + 0xb20e: 0x0e, + 0xb20f: 0x0f, + 0xb210: 0x10, + 0xb211: 0x11, + 0xb212: 0x12, + 0xb213: 0x13, + 0xb214: 0x14, + 0xb215: 0x15, + 0xb216: 0x16, + 0xb217: 0x17, + 0xb218: 0x18, + 0xb219: 0x19, + 0xb21a: 0x1a, + 0xb21b: 0x1b, + 0xb21c: 0x1c, + 0xb21d: 0x1d, + 0xb21e: 0x1e, + 0xb21f: 0x1f, + 0xb220: 0x20, + 0xb221: 0x21, + 0xb222: 0x22, + 0xb223: 0x23, + 0xb224: 0x24, + 0xb225: 0x25, + 0xb226: 0x26, + 0xb227: 0x27, + 0xb228: 0x28, + 0xb229: 0x29, + 0xb22a: 0x2a, + 0xb22b: 0x2b, + 0xb22c: 0x2c, + 0xb22d: 0x2d, + 0xb22e: 0x2e, + 0xb22f: 0x2f, + 0xb230: 0x30, + 0xb231: 0x31, + 0xb232: 0x32, + 0xb233: 0x33, + 0xb234: 0x34, + 0xb235: 0x35, + 0xb236: 0x36, + 0xb237: 0x37, + 0xb238: 0x38, + 0xb239: 0x39, + 0xb23a: 0x3a, + 0xb23b: 0x3b, + 0xb23c: 0x3c, + 0xb23d: 0x3d, + 0xb23e: 0x3e, + 0xb23f: 0x3f, + 0xb240: 0x40, + 0xb241: 0x01, + 0xb242: 0x02, + 0xb243: 0x03, + 0xb244: 0x04, + 0xb245: 0x05, + 0xb246: 0x06, + 0xb247: 0x07, + 0xb248: 0x08, + 0xb249: 0x09, + 0xb24a: 0x0a, + 0xb24b: 0x0b, + 0xb24c: 0x0c, + 0xb24d: 0x0d, + 0xb24e: 0x0e, + 0xb24f: 0x0f, + 0xb250: 0x10, + 0xb251: 0x11, + 0xb252: 0x12, + 0xb253: 0x13, + 0xb254: 0x14, + 0xb255: 0x15, + 0xb256: 0x16, + 0xb257: 0x17, + 0xb258: 0x18, + 0xb259: 0x19, + 0xb25a: 0x1a, + 0xb25b: 0x1b, + 0xb25c: 0x1c, + 0xb25d: 0x1d, + 0xb25e: 0x1e, + 0xb25f: 0x1f, + 0xb260: 0x20, + 0xb301: 0x01, + 0xb302: 0x02, + 0xb303: 0x03, + 0xb304: 0x04, + 0xb305: 0x05, + 0xb306: 0x06, + 0xb307: 0x07, + 0xb308: 0x08, + 0xb309: 0x09, + 0xb30a: 0x0a, + 0xb30b: 0x0b, + 0xb30c: 0x0c, + 0xb30d: 0x0d, + 0xb30e: 0x0e, + 0xb30f: 0x0f, + 0xb310: 0x10, + 0xb311: 0x11, + 0xb312: 0x12, + 0xb313: 0x13, + 0xb314: 0x14, + 0xb315: 0x15, + 0xb316: 0x16, + 0xb317: 0x17, + 0xb318: 0x18, + 0xb319: 0x19, + 0xb31a: 0x1a, + 0xb31b: 0x1b, + 0xb31c: 0x1c, + 0xb31d: 0x1d, + 0xb31e: 0x1e, + 0xb31f: 0x1f, + 0xb320: 0x20, + 0xb321: 0x01, + 0xb322: 0x02, + 0xb323: 0x03, + 0xb324: 0x04, + 0xb325: 0x05, + 0xb326: 0x06, + 0xb327: 0x07, + 0xb328: 0x08, + 0xb329: 0x09, + 0xb32a: 0x0a, + 0xb32b: 0x0b, + 0xb32c: 0x0c, + 0xb32d: 0x0d, + 0xb32e: 0x0e, + 0xb32f: 0x0f, + 0xb330: 0x10, + 0xb331: 0x11, + 0xb332: 0x12, + 0xb333: 0x13, + 0xb334: 0x14, + 0xb335: 0x15, + 0xb336: 0x16, + 0xb337: 0x17, + 0xb338: 0x18, + 0xb339: 0x19, + 0xb33a: 0x1a, + 0xb33b: 0x1b, + 0xb33c: 0x1c, + 0xb33d: 0x1d, + 0xb33e: 0x1e, + 0xb33f: 0x1f, + 0xb340: 0x20, + 0xb341: 0x21, + 0xb342: 0x22, + 0xb343: 0x23, + 0xb344: 0x24, + 0xb345: 0x25, + 0xb346: 0x26, + 0xb347: 0x27, + 0xb348: 0x28, + 0xb349: 0x29, + 0xb34a: 0x2a, + 0xb34b: 0x2b, + 0xb34c: 0x2c, + 0xb34d: 0x2d, + 0xb34e: 0x2e, + 0xb34f: 0x2f, + 0xb350: 0x30, + 0xb351: 0x31, + 0xb352: 0x32, + 0xb353: 0x33, + 0xb354: 0x34, + 0xb355: 0x35, + 0xb356: 0x36, + 0xb357: 0x37, + 0xb358: 0x38, + 0xb359: 0x39, + 0xb35a: 0x3a, + 0xb35b: 0x3b, + 0xb35c: 0x3c, + 0xb35d: 0x3d, + 0xb35e: 0x3e, + 0xb35f: 0x3f, + 0xb360: 0x40, + 0xb361: 0x01, + 0xb362: 0x02, + 0xb363: 0x03, + 0xb364: 0x04, + 0xb365: 0x05, + 0xb366: 0x06, + 0xb367: 0x07, + 0xb368: 0x08, + 0xb369: 0x09, + 0xb36a: 0x0a, + 0xb36b: 0x0b, + 0xb36c: 0x0c, + 0xb36d: 0x0d, + 0xb36e: 0x0e, + 0xb36f: 0x0f, + 0xb370: 0x10, + 0xb371: 0x11, + 0xb372: 0x12, + 0xb373: 0x13, + 0xb374: 0x14, + 0xb375: 0x15, + 0xb376: 0x16, + 0xb377: 0x17, + 0xb378: 0x18, + 0xb379: 0x19, + 0xb37a: 0x1a, + 0xb37b: 0x1b, + 0xb37c: 0x1c, + 0xb37d: 0x1d, + 0xb37e: 0x1e, + 0xb37f: 0x1f, + 0xb380: 0x20, + 0xb381: 0x21, + 0xb382: 0x22, + 0xb383: 0x23, + 0xb384: 0x24, + 0xb385: 0x25, + 0xb386: 0x26, + 0xb387: 0x27, + 0xb388: 0x28, + 0xb389: 0x29, + 0xb38a: 0x2a, + 0xb38b: 0x2b, + 0xb38c: 0x2c, + 0xb38d: 0x2d, + 0xb38e: 0x2e, + 0xb38f: 0x2f, + 0xb390: 0x30, + 0xb391: 0x31, + 0xb392: 0x32, + 0xb393: 0x33, + 0xb394: 0x34, + 0xb395: 0x35, + 0xb396: 0x36, + 0xb397: 0x37, + 0xb398: 0x38, + 0xb399: 0x39, + 0xb39a: 0x3a, + 0xb39b: 0x3b, + 0xb39c: 0x3c, + 0xb39d: 0x3d, + 0xb39e: 0x3e, + 0xb39f: 0x3f, + 0xb3a0: 0x40, + 0xb3a1: 0x41, + 0xb3a2: 0x42, + 0xb3a3: 0x43, + 0xb3a4: 0x44, + 0xb3a5: 0x45, + 0xb3a6: 0x46, + 0xb3a7: 0x47, + 0xb3a8: 0x48, + 0xb3a9: 0x49, + 0xb3aa: 0x4a, + 0xb3ab: 0x4b, + 0xb3ac: 0x4c, + 0xb3ad: 0x4d, + 0xb3ae: 0x4e, + 0xb3af: 0x4f, + 0xb3b0: 0x50, + 0xb3b1: 0x51, + 0xb3b2: 0x52, + 0xb3b3: 0x53, + 0xb3b4: 0x54, + 0xb3b5: 0x55, + 0xb3b6: 0x56, + 0xb3b7: 0x57, + 0xb3b8: 0x58, + 0xb3b9: 0x59, + 0xb3ba: 0x5a, + 0xb3bb: 0x5b, + 0xb3bc: 0x5c, + 0xb3bd: 0x5d, + 0xb3be: 0x5e, + 0xb3bf: 0x5f, + 0xb3c0: 0x60, + 0xb3c1: 0x61, + 0xb3c2: 0x62, + 0xb3c3: 0x63, + 0xb3c4: 0x64, + 0xb3c5: 0x65, + 0xb3c6: 0x66, + 0xb3c7: 0x67, + 0xb3c8: 0x68, + 0xb3c9: 0x69, + 0xb3ca: 0x6a, + 0xb3cb: 0x6b, + 0xb3cc: 0x6c, + 0xb3cd: 0x6d, + 0xb3ce: 0x6e, + 0xb3cf: 0x6f, + 0xb3d0: 0x70, + 0xb3d1: 0x71, + 0xb3d2: 0x72, + 0xb3d3: 0x73, + 0xb3d4: 0x74, + 0xb3d5: 0x75, + 0xb3d6: 0x76, + 0xb3d7: 0x77, + 0xb3d8: 0x78, + 0xb3d9: 0x79, + 0xb3da: 0x7a, + 0xb3db: 0x7b, + 0xb3dc: 0x7c, + 0xb3dd: 0x7d, + 0xb3de: 0x7e, + 0xb3df: 0x7f, + 0xb3e0: 0x80 +}) + +},{}],366:[function(require,module,exports){ +(function (Buffer){ +/** + * Multihash implementation in JavaScript. + * + * @module multihash + */ +'use strict' + +const bs58 = require('bs58') + +const cs = require('./constants') + +exports.names = cs.names +exports.codes = cs.codes +exports.defaultLengths = cs.defaultLengths + +const varint = require('varint') + +/** + * Convert the given multihash to a hex encoded string. + * + * @param {Buffer} hash + * @returns {string} + */ +exports.toHexString = function toHexString (hash) { + if (!Buffer.isBuffer(hash)) { + throw new Error('must be passed a buffer') + } + + return hash.toString('hex') +} + +/** + * Convert the given hex encoded string to a multihash. + * + * @param {string} hash + * @returns {Buffer} + */ +exports.fromHexString = function fromHexString (hash) { + return Buffer.from(hash, 'hex') +} + +/** + * Convert the given multihash to a base58 encoded string. + * + * @param {Buffer} hash + * @returns {string} + */ +exports.toB58String = function toB58String (hash) { + if (!Buffer.isBuffer(hash)) { + throw new Error('must be passed a buffer') + } + + return bs58.encode(hash) +} + +/** + * Convert the given base58 encoded string to a multihash. + * + * @param {string|Buffer} hash + * @returns {Buffer} + */ +exports.fromB58String = function fromB58String (hash) { + let encoded = hash + if (Buffer.isBuffer(hash)) { + encoded = hash.toString() + } + + return Buffer.from(bs58.decode(encoded)) +} + +/** + * Decode a hash from the given multihash. + * + * @param {Buffer} buf + * @returns {{code: number, name: string, length: number, digest: Buffer}} result + */ +exports.decode = function decode (buf) { + if (!(Buffer.isBuffer(buf))) { + throw new Error('multihash must be a Buffer') + } + + if (buf.length < 3) { + throw new Error('multihash too short. must be > 3 bytes.') + } + + let code = varint.decode(buf) + if (!exports.isValidCode(code)) { + throw new Error(`multihash unknown function code: 0x${code.toString(16)}`) + } + buf = buf.slice(varint.decode.bytes) + + let len = varint.decode(buf) + if (len < 1) { + throw new Error(`multihash invalid length: 0x${len.toString(16)}`) + } + buf = buf.slice(varint.decode.bytes) + + if (buf.length !== len) { + throw new Error(`multihash length inconsistent: 0x${buf.toString('hex')}`) + } + + return { + code: code, + name: cs.codes[code], + length: len, + digest: buf + } +} + +/** + * Encode a hash digest along with the specified function code. + * + * > **Note:** the length is derived from the length of the digest itself. + * + * @param {Buffer} digest + * @param {string|number} code + * @param {number} [length] + * @returns {Buffer} + */ +exports.encode = function encode (digest, code, length) { + if (!digest || !code) { + throw new Error('multihash encode requires at least two args: digest, code') + } + + // ensure it's a hashfunction code. + const hashfn = exports.coerceCode(code) + + if (!(Buffer.isBuffer(digest))) { + throw new Error('digest should be a Buffer') + } + + if (length == null) { + length = digest.length + } + + if (length && digest.length !== length) { + throw new Error('digest length should be equal to specified length.') + } + + return Buffer.concat([ + Buffer.from(varint.encode(hashfn)), + Buffer.from(varint.encode(length)), + digest + ]) +} + +/** + * Converts a hash function name into the matching code. + * If passed a number it will return the number if it's a valid code. + * @param {string|number} name + * @returns {number} + */ +exports.coerceCode = function coerceCode (name) { + let code = name + + if (typeof name === 'string') { + if (!cs.names[name]) { + throw new Error(`Unrecognized hash function named: ${name}`) + } + code = cs.names[name] + } + + if (typeof code !== 'number') { + throw new Error(`Hash function code should be a number. Got: ${code}`) + } + + if (!cs.codes[code] && !exports.isAppCode(code)) { + throw new Error(`Unrecognized function code: ${code}`) + } + + return code +} + +/** + * Checks wether a code is part of the app range + * + * @param {number} code + * @returns {boolean} + */ +exports.isAppCode = function appCode (code) { + return code > 0 && code < 0x10 +} + +/** + * Checks whether a multihash code is valid. + * + * @param {number} code + * @returns {boolean} + */ +exports.isValidCode = function validCode (code) { + if (exports.isAppCode(code)) { + return true + } + + if (cs.codes[code]) { + return true + } + + return false +} + +/** + * Check if the given buffer is a valid multihash. Throws an error if it is not valid. + * + * @param {Buffer} multihash + * @returns {undefined} + * @throws {Error} + */ +function validate (multihash) { + exports.decode(multihash) // throws if bad. +} +exports.validate = validate + +/** + * Returns a prefix from a valid multihash. Throws an error if it is not valid. + * + * @param {Buffer} multihash + * @returns {undefined} + * @throws {Error} + */ +exports.prefix = function prefix (multihash) { + validate(multihash) + + return multihash.slice(0, 2) +} + +}).call(this,require("buffer").Buffer) +},{"./constants":365,"bs58":141,"buffer":144,"varint":857}],367:[function(require,module,exports){ module.exports={ "_from": "git+https://git@github.com/ipfs/js-ipfs.git", "_id": "ipfs@0.26.0", "_inBundle": false, - "_integrity": "sha1-Fp5oBfVlKlrGMzvBbLZDgFEg7KE=", + "_integrity": "sha1-gklKTz4fahp0L8MGEJ9dM+qweR4=", "_location": "/ipfs", - "_phantomChildren": {}, + "_phantomChildren": { + "bs58": "4.0.1", + "camelcase": "4.1.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "interface-connection": "0.3.2", + "lodash.includes": "4.3.0", + "mafmt": "3.0.1", + "os-locale": "2.1.0", + "pull-ws": "3.3.0", + "read-pkg-up": "2.0.0", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "varint": "5.0.0", + "which-module": "2.0.0", + "y18n": "3.2.1", + "yargs-parser": "7.0.0" + }, "_requested": { "type": "git", "raw": "git+https://git@github.com/ipfs/js-ipfs.git", @@ -58176,7 +59631,7 @@ module.exports={ "#USER", "/" ], - "_resolved": "git+https://git@github.com/ipfs/js-ipfs.git#77881fd1805782853dbf29da8ab2f0173c1a525e", + "_resolved": "git+https://git@github.com/ipfs/js-ipfs.git#319c1c9830262ab5c05bf99fc525d8883d3178cb", "_spec": "git+https://git@github.com/ipfs/js-ipfs.git", "_where": "/Users/mitra/git/_github_internetarchive/dweb-transport", "author": { @@ -58419,18 +59874,18 @@ module.exports={ "dependencies": { "async": "^2.5.0", "bl": "^1.2.1", - "boom": "^5.2.0", + "boom": "^6.0.0", "byteman": "^1.3.5", - "cids": "^0.5.1", - "debug": "^3.0.1", - "file-type": "^6.1.0", - "filesize": "^3.5.10", + "cids": "^0.5.2", + "debug": "^3.1.0", + "file-type": "^7.2.0", + "filesize": "^3.5.11", "fsm-event": "^2.1.0", "get-folder-size": "^1.0.0", "glob": "^7.1.2", - "hapi": "^16.5.2", + "hapi": "^16.6.2", "hapi-set-header": "^1.0.2", - "hoek": "^4.2.0", + "hoek": "^5.0.0", "ipfs-api": "^14.3.7", "ipfs-bitswap": "~0.17.2", "ipfs-block": "~0.6.0", @@ -58439,10 +59894,10 @@ module.exports={ "ipfs-repo": "~0.17.0", "ipfs-unixfs": "~0.1.13", "ipfs-unixfs-engine": "~0.22.5", - "ipld-resolver": "~0.13.2", + "ipld-resolver": "~0.13.4", "is-ipfs": "^0.3.2", "is-stream": "^1.1.0", - "joi": "^10.6.0", + "joi": "^13.0.1", "libp2p": "~0.12.4", "libp2p-floodsub": "~0.11.1", "libp2p-kad-dht": "~0.5.1", @@ -58450,9 +59905,9 @@ module.exports={ "libp2p-multiplex": "~0.5.0", "libp2p-railing": "~0.7.1", "libp2p-secio": "~0.8.1", - "libp2p-tcp": "~0.11.0", + "libp2p-tcp": "~0.11.1", "libp2p-webrtc-star": "~0.13.2", - "libp2p-websockets": "~0.10.1", + "libp2p-websockets": "~0.10.2", "lodash.flatmap": "^4.5.0", "lodash.get": "^4.4.2", "lodash.sortby": "^4.7.0", @@ -58461,14 +59916,14 @@ module.exports={ "mime-types": "^2.1.17", "mkdirp": "~0.5.1", "multiaddr": "^3.0.1", - "multihashes": "~0.4.9", + "multihashes": "~0.4.12", "once": "^1.4.0", "path-exists": "^3.0.0", "peer-book": "~0.5.1", - "peer-id": "~0.10.1", + "peer-id": "~0.10.2", "peer-info": "~0.11.0", "progress": "^2.0.0", - "prom-client": "^10.1.0", + "prom-client": "^10.2.0", "prometheus-gc-stats": "^0.5.0", "promisify-es6": "^1.0.3", "pull-abortable": "^4.1.1", @@ -58487,8 +59942,8 @@ module.exports={ "tar-stream": "^1.5.4", "temp": "~0.8.3", "through2": "^2.0.3", - "update-notifier": "^2.2.0", - "yargs": "8.0.2" + "update-notifier": "^2.3.0", + "yargs": "9.0.1" }, "deprecated": false, "description": "JavaScript implementation of the IPFS specification", @@ -58500,23 +59955,23 @@ module.exports={ "detect-node": "^2.0.3", "dir-compare": "^1.4.0", "dirty-chai": "^2.0.1", - "eslint-plugin-react": "^7.3.0", + "eslint-plugin-react": "^7.4.0", "execa": "^0.8.0", "expose-loader": "^0.7.3", "form-data": "^2.3.1", "gulp": "^3.9.1", "interface-ipfs-core": "~0.32.1", - "ipfsd-ctl": "~0.23.0", + "ipfsd-ctl": "~0.24.0", "left-pad": "^1.1.3", "lodash": "^4.17.4", - "mocha": "^3.5.2", + "mocha": "^4.0.1", "ncp": "^2.0.0", "nexpect": "^0.5.0", "pre-commit": "^1.2.2", "pretty-bytes": "^4.0.2", "qs": "^6.5.1", "random-fs": "^1.0.3", - "rimraf": "^2.6.1", + "rimraf": "^2.6.2", "stream-to-promise": "^2.2.0", "transform-loader": "^0.2.4" }, @@ -58532,7 +59987,7 @@ module.exports={ "main": "src/core/index.js", "name": "ipfs", "optionalDependencies": { - "prom-client": "^10.1.0", + "prom-client": "^10.2.0", "prometheus-gc-stats": "^0.5.0" }, "pre-commit": [ @@ -58572,7 +60027,7 @@ module.exports={ "version": "0.26.0" } -},{}],363:[function(require,module,exports){ +},{}],368:[function(require,module,exports){ 'use strict' const waterfall = require('async/waterfall') @@ -58684,7 +60139,7 @@ module.exports = (self) => { }) } -},{"async/series":69,"async/waterfall":73,"deep-extend":170}],364:[function(require,module,exports){ +},{"async/series":69,"async/waterfall":73,"deep-extend":170}],369:[function(require,module,exports){ 'use strict' const OFFLINE_ERROR = require('../utils').OFFLINE_ERROR @@ -58724,7 +60179,7 @@ module.exports = function bitswap (self) { } } -},{"../utils":390}],365:[function(require,module,exports){ +},{"../utils":395}],370:[function(require,module,exports){ 'use strict' const Block = require('ipfs-block') @@ -58809,7 +60264,7 @@ function cleanCid (cid) { return new CID(cid) } -},{"async/waterfall":73,"cids":146,"ipfs-block":316,"multihashes":624,"multihashing-async":628}],366:[function(require,module,exports){ +},{"async/waterfall":73,"cids":146,"ipfs-block":316,"multihashes":366,"multihashing-async":625}],371:[function(require,module,exports){ 'use strict' const defaultNodes = require('../runtime/config-nodejs.json').Bootstrap @@ -58881,7 +60336,7 @@ module.exports = function bootstrap (self) { } } -},{"../runtime/config-nodejs.json":386}],367:[function(require,module,exports){ +},{"../runtime/config-nodejs.json":391}],372:[function(require,module,exports){ 'use strict' const promisify = require('promisify-es6') @@ -58905,7 +60360,7 @@ module.exports = function config (self) { } } -},{"promisify-es6":684}],368:[function(require,module,exports){ +},{"promisify-es6":681}],373:[function(require,module,exports){ 'use strict' const promisify = require('promisify-es6') @@ -58985,7 +60440,7 @@ module.exports = function dag (self) { } } -},{"cids":146,"promisify-es6":684,"pull-stream":726}],369:[function(require,module,exports){ +},{"cids":146,"promisify-es6":681,"pull-stream":723}],374:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -59152,7 +60607,7 @@ module.exports = (self) => { } }).call(this,{"isBuffer":require("../../../../is-buffer/index.js")}) -},{"../../../../is-buffer/index.js":433,"async/each":37,"async/every":43,"cids":146,"peer-id":677,"promisify-es6":684}],370:[function(require,module,exports){ +},{"../../../../is-buffer/index.js":438,"async/each":37,"async/every":43,"cids":146,"peer-id":674,"promisify-es6":681}],375:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -59176,6 +60631,14 @@ module.exports = function files (self) { shardSplitThreshold: self._options.EXPERIMENTAL.sharding ? 1000 : Infinity }, options) + let total = 0 + let prog = opts.progress || (() => {}) + const progress = (bytes) => { + total += bytes + prog(total) + } + + opts.progress = progress return pull( pull.map(normalizeContent), pull.flatten(), @@ -59221,18 +60684,9 @@ module.exports = function files (self) { return callback(new Error('Invalid arguments, data must be an object, Buffer or readable stream')) } - let total = 0 - let prog = options.progress || (() => {}) - const progress = (bytes) => { - total += bytes - prog(total) - } - - options.progress = progress pull( - pull.values(normalizeContent(data)), - importer(self._ipldResolver, options), - pull.asyncMap(prepareFile.bind(null, self, options)), + pull.values([data]), + createAddPullStream(options), sort((a, b) => { if (a.path < b.path) return 1 if (a.path > b.path) return -1 @@ -59371,7 +60825,7 @@ class AddStreamDuplex extends Duplex { } }).call(this,{"isBuffer":require("../../../../is-buffer/index.js")}) -},{"../../../../is-buffer/index.js":433,"async/waterfall":73,"cids":146,"ipfs-unixfs-engine":359,"is-stream":437,"promisify-es6":684,"pull-pushable":721,"pull-sort":724,"pull-stream":726,"pull-stream-to-stream":725,"stream":784,"stream-to-pull-stream":839}],371:[function(require,module,exports){ +},{"../../../../is-buffer/index.js":438,"async/waterfall":73,"cids":146,"ipfs-unixfs-engine":359,"is-stream":442,"promisify-es6":681,"pull-pushable":718,"pull-sort":721,"pull-stream":723,"pull-stream-to-stream":722,"stream":781,"stream-to-pull-stream":836}],376:[function(require,module,exports){ 'use strict' const promisify = require('promisify-es6') @@ -59398,7 +60852,7 @@ module.exports = function id (self) { }) } -},{"async/setImmediate":70,"promisify-es6":684}],372:[function(require,module,exports){ +},{"async/setImmediate":70,"promisify-es6":681}],377:[function(require,module,exports){ 'use strict' exports.preStart = require('./pre-start') @@ -59422,7 +60876,7 @@ exports.bitswap = require('./bitswap') exports.pubsub = require('./pubsub') exports.dht = require('./dht') -},{"./bitswap":364,"./block":365,"./bootstrap":366,"./config":367,"./dag":368,"./dht":369,"./files":370,"./id":371,"./init":373,"./is-online":374,"./libp2p":375,"./object":376,"./ping":377,"./pre-start":378,"./pubsub":379,"./repo":380,"./start":381,"./stop":382,"./swarm":383,"./version":384}],373:[function(require,module,exports){ +},{"./bitswap":369,"./block":370,"./bootstrap":371,"./config":372,"./dag":373,"./dht":374,"./files":375,"./id":376,"./init":378,"./is-online":379,"./libp2p":380,"./object":381,"./ping":382,"./pre-start":383,"./pubsub":384,"./repo":385,"./start":386,"./stop":387,"./swarm":388,"./version":389}],378:[function(require,module,exports){ 'use strict' const peerId = require('peer-id') @@ -59515,7 +60969,7 @@ module.exports = function init (self) { }) } -},{"../runtime/config-nodejs.json":386,"./init-assets":98,"async/parallel":66,"async/waterfall":73,"peer-id":677,"promisify-es6":684}],374:[function(require,module,exports){ +},{"../runtime/config-nodejs.json":391,"./init-assets":98,"async/parallel":66,"async/waterfall":73,"peer-id":674,"promisify-es6":681}],379:[function(require,module,exports){ 'use strict' module.exports = function isOnline (self) { @@ -59524,7 +60978,7 @@ module.exports = function isOnline (self) { } } -},{}],375:[function(require,module,exports){ +},{}],380:[function(require,module,exports){ 'use strict' // libp2p-nodejs gets replaced by libp2p-browser when webpacked/browserified @@ -59587,7 +61041,7 @@ module.exports = function libp2p (self) { } } -},{"../runtime/libp2p-nodejs":387,"lodash.get":549,"promisify-es6":684}],376:[function(require,module,exports){ +},{"../runtime/libp2p-nodejs":392,"lodash.get":546,"promisify-es6":681}],381:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -59891,7 +61345,7 @@ module.exports = function object (self) { } }).call(this,require("buffer").Buffer) -},{"assert":33,"async/waterfall":73,"buffer":144,"cids":146,"ipfs-unixfs":360,"ipld-dag-pb":403,"multihashes":624,"promisify-es6":684}],377:[function(require,module,exports){ +},{"assert":33,"async/waterfall":73,"buffer":144,"cids":146,"ipfs-unixfs":360,"ipld-dag-pb":408,"multihashes":366,"promisify-es6":681}],382:[function(require,module,exports){ 'use strict' const promisify = require('promisify-es6') @@ -59902,7 +61356,7 @@ module.exports = function ping (self) { }) } -},{"promisify-es6":684}],378:[function(require,module,exports){ +},{"promisify-es6":681}],383:[function(require,module,exports){ 'use strict' const peerId = require('peer-id') @@ -59944,7 +61398,7 @@ module.exports = function preStart (self) { } } -},{"async/waterfall":73,"mafmt":602,"multiaddr":612,"peer-id":677,"peer-info":678}],379:[function(require,module,exports){ +},{"async/waterfall":73,"mafmt":599,"multiaddr":609,"peer-id":674,"peer-info":675}],384:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -60045,7 +61499,7 @@ module.exports = function pubsub (self) { } }).call(this,{"isBuffer":require("../../../../is-buffer/index.js")}) -},{"../../../../is-buffer/index.js":433,"../utils":390,"async/setImmediate":70,"promisify-es6":684}],380:[function(require,module,exports){ +},{"../../../../is-buffer/index.js":438,"../utils":395,"async/setImmediate":70,"promisify-es6":681}],385:[function(require,module,exports){ 'use strict' module.exports = function repo (self) { @@ -60064,7 +61518,7 @@ module.exports = function repo (self) { } } -},{}],381:[function(require,module,exports){ +},{}],386:[function(require,module,exports){ 'use strict' const series = require('async/series') @@ -60127,7 +61581,7 @@ module.exports = (self) => { }) } -},{"async/series":69,"async/setImmediate":70,"ipfs-bitswap":298,"libp2p-floodsub":494,"promisify-es6":684}],382:[function(require,module,exports){ +},{"async/series":69,"async/setImmediate":70,"ipfs-bitswap":298,"libp2p-floodsub":499,"promisify-es6":681}],387:[function(require,module,exports){ 'use strict' const series = require('async/series') @@ -60173,7 +61627,7 @@ module.exports = (self) => { } } -},{"async/series":69}],383:[function(require,module,exports){ +},{"async/series":69}],388:[function(require,module,exports){ 'use strict' const multiaddr = require('multiaddr') @@ -60266,7 +61720,7 @@ module.exports = function swarm (self) { } } -},{"../utils":390,"lodash.values":563,"multiaddr":612,"promisify-es6":684}],384:[function(require,module,exports){ +},{"../utils":395,"lodash.values":560,"multiaddr":609,"promisify-es6":681}],389:[function(require,module,exports){ 'use strict' const pkg = require('../../../package.json') @@ -60287,7 +61741,7 @@ module.exports = function version (self) { }) } -},{"../../../package.json":362,"promisify-es6":684}],385:[function(require,module,exports){ +},{"../../../package.json":367,"promisify-es6":681}],390:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -60411,7 +61865,7 @@ exports.createNode = (options) => { } }).call(this,require("buffer").Buffer) -},{"./boot":363,"./components":372,"./runtime/repo-nodejs":388,"./state":389,"buffer":144,"cids":146,"debug":168,"deep-extend":170,"events":236,"ipfs-block-service":309,"ipld-resolver":432,"multiaddr":612,"multihashes":624,"peer-book":676,"peer-id":677,"peer-info":678}],386:[function(require,module,exports){ +},{"./boot":368,"./components":377,"./runtime/repo-nodejs":393,"./state":394,"buffer":144,"cids":146,"debug":168,"deep-extend":170,"events":236,"ipfs-block-service":309,"ipld-resolver":437,"multiaddr":609,"multihashes":366,"peer-book":673,"peer-id":674,"peer-info":675}],391:[function(require,module,exports){ module.exports={ "Addresses": { "Swarm": [ @@ -60441,7 +61895,7 @@ module.exports={ ] } -},{}],387:[function(require,module,exports){ +},{}],392:[function(require,module,exports){ 'use strict' const WS = require('libp2p-websockets') @@ -60484,7 +61938,7 @@ class Node extends libp2p { module.exports = Node -},{"libp2p":542,"libp2p-multiplex":504,"libp2p-railing":512,"libp2p-secio":520,"libp2p-webrtc-star":532,"libp2p-websockets":539}],388:[function(require,module,exports){ +},{"libp2p":539,"libp2p-multiplex":509,"libp2p-railing":517,"libp2p-secio":525,"libp2p-webrtc-star":537,"libp2p-websockets":362}],393:[function(require,module,exports){ 'use strict' const IPFSRepo = require('ipfs-repo') @@ -60494,7 +61948,7 @@ module.exports = (dir) => { return new IPFSRepo(repoPath) } -},{"ipfs-repo":328}],389:[function(require,module,exports){ +},{"ipfs-repo":328}],394:[function(require,module,exports){ 'use strict' const debug = require('debug') @@ -60561,18 +62015,18 @@ module.exports = (self) => { return s } -},{"debug":168,"fsm-event":239}],390:[function(require,module,exports){ +},{"debug":168,"fsm-event":239}],395:[function(require,module,exports){ 'use strict' exports.OFFLINE_ERROR = new Error('This command must be run in online mode. Try running \'ipfs daemon\' first.') -},{}],391:[function(require,module,exports){ +},{}],396:[function(require,module,exports){ 'use strict' exports.util = require('./util.js') exports.resolver = require('./resolver.js') -},{"./resolver.js":392,"./util.js":393}],392:[function(require,module,exports){ +},{"./resolver.js":397,"./util.js":398}],397:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -60710,7 +62164,7 @@ exports.isLink = (block, path, callback) => { } }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":433,"./util":393,"traverse":846}],393:[function(require,module,exports){ +},{"../../is-buffer/index.js":438,"./util":398,"traverse":843}],398:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -60831,7 +62285,7 @@ exports.cid = (dagNode, callback) => { } }).call(this,require("buffer").Buffer) -},{"./resolver":392,"async/setImmediate":70,"async/waterfall":73,"borc":93,"buffer":144,"cids":146,"is-circular":434,"multihashing-async":628}],394:[function(require,module,exports){ +},{"./resolver":397,"async/setImmediate":70,"async/waterfall":73,"borc":93,"buffer":144,"cids":146,"is-circular":439,"multihashing-async":625}],399:[function(require,module,exports){ 'use strict' const DAGLink = require('./index.js') @@ -60843,7 +62297,7 @@ function create (name, size, multihash, callback) { module.exports = create -},{"./index.js":395}],395:[function(require,module,exports){ +},{"./index.js":400}],400:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -60908,7 +62362,7 @@ exports = module.exports = DAGLink exports.create = require('./create') }).call(this,{"isBuffer":require("../../../is-buffer/index.js")}) -},{"../../../is-buffer/index.js":433,"./create":394,"assert":33,"multihashes":624}],396:[function(require,module,exports){ +},{"../../../is-buffer/index.js":438,"./create":399,"assert":33,"multihashes":621}],401:[function(require,module,exports){ 'use strict' const dagNodeUtil = require('./util') @@ -60945,7 +62399,7 @@ function addLink (node, link, callback) { module.exports = addLink -},{"./../dag-link":395,"./create":398,"./util":401}],397:[function(require,module,exports){ +},{"./../dag-link":400,"./create":403,"./util":406}],402:[function(require,module,exports){ 'use strict' const dagNodeUtil = require('./util') @@ -60961,7 +62415,7 @@ function clone (dagNode, callback) { module.exports = clone -},{"./create":398,"./util":401}],398:[function(require,module,exports){ +},{"./create":403,"./util":406}],403:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -61031,7 +62485,7 @@ function create (data, dagLinks, hashAlg, callback) { module.exports = create }).call(this,require("buffer").Buffer) -},{"../util.js":405,"./../dag-link":395,"./index.js":399,"./util.js":401,"buffer":144,"multihashing-async":628,"stable":832}],399:[function(require,module,exports){ +},{"../util.js":410,"./../dag-link":400,"./index.js":404,"./util.js":406,"buffer":144,"multihashing-async":625,"stable":829}],404:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -61119,7 +62573,7 @@ exports.addLink = require('./addLink') exports.rmLink = require('./rmLink') }).call(this,require("buffer").Buffer) -},{"./addLink":396,"./clone":397,"./create":398,"./rmLink":400,"assert":33,"buffer":144,"multihashes":624}],400:[function(require,module,exports){ +},{"./addLink":401,"./clone":402,"./create":403,"./rmLink":405,"assert":33,"buffer":144,"multihashes":621}],405:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -61146,7 +62600,7 @@ function rmLink (dagNode, nameOrMultihash, callback) { module.exports = rmLink }).call(this,{"isBuffer":require("../../../is-buffer/index.js")}) -},{"../../../is-buffer/index.js":433,"./create":398,"./util":401}],401:[function(require,module,exports){ +},{"../../../is-buffer/index.js":438,"./create":403,"./util":406}],406:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -61191,7 +62645,7 @@ exports.linkSort = linkSort exports.toDAGLink = toDAGLink }).call(this,require("buffer").Buffer) -},{"./../dag-link":395,"buffer":144}],402:[function(require,module,exports){ +},{"./../dag-link":400,"buffer":144}],407:[function(require,module,exports){ 'use strict' module.exports = `// An IPFS MerkleDAG Link @@ -61217,7 +62671,7 @@ message PBNode { optional bytes Data = 1; }` -},{}],403:[function(require,module,exports){ +},{}],408:[function(require,module,exports){ 'use strict' exports.DAGNode = require('./dag-node') @@ -61230,7 +62684,7 @@ exports.DAGLink = require('./dag-link') exports.resolver = require('./resolver') exports.util = require('./util') -},{"./dag-link":395,"./dag-node":399,"./resolver":404,"./util":405}],404:[function(require,module,exports){ +},{"./dag-link":400,"./dag-node":404,"./resolver":409,"./util":410}],409:[function(require,module,exports){ 'use strict' const waterfall = require('async/waterfall') @@ -61357,7 +62811,7 @@ exports.isLink = (block, path, callback) => { }) } -},{"./util":405,"async/waterfall":73}],405:[function(require,module,exports){ +},{"./util":410,"async/waterfall":73}],410:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -61430,7 +62884,7 @@ exports.deserialize = deserialize exports.cid = cid }).call(this,require("buffer").Buffer) -},{"./dag-link":395,"./dag-node":399,"./dag.proto.js":402,"buffer":144,"cids":146,"protons":695}],406:[function(require,module,exports){ +},{"./dag-link":400,"./dag-node":404,"./dag.proto.js":407,"buffer":144,"cids":146,"protons":692}],411:[function(require,module,exports){ (function (Buffer){ 'use strict' const EthAccount = require('ethereumjs-account') @@ -61504,7 +62958,7 @@ function mapFromEthObj (account, options, callback) { } }).call(this,require("buffer").Buffer) -},{"../util/cidFromHash":415,"../util/createResolver":417,"../util/emptyCodeHash":420,"buffer":144,"ethereumjs-account":228}],407:[function(require,module,exports){ +},{"../util/cidFromHash":420,"../util/createResolver":422,"../util/emptyCodeHash":425,"buffer":144,"ethereumjs-account":228}],412:[function(require,module,exports){ 'use strict' const waterfall = require('async/waterfall') const each = require('async/each') @@ -61576,7 +63030,7 @@ function mapFromEthObj (ethBlockList, options, callback) { }) } -},{"../eth-block":408,"../util/cidFromHash":415,"../util/createResolver":417,"async/asyncify":34,"async/each":37,"async/waterfall":73,"ethereumjs-block/header":229,"multihashing-async":628,"rlp":789}],408:[function(require,module,exports){ +},{"../eth-block":413,"../util/cidFromHash":420,"../util/createResolver":422,"async/asyncify":34,"async/each":37,"async/waterfall":73,"ethereumjs-block/header":229,"multihashing-async":625,"rlp":786}],413:[function(require,module,exports){ 'use strict' const EthBlockHeader = require('ethereumjs-block/header') const createResolver = require('../util/createResolver') @@ -61677,7 +63131,7 @@ function mapFromEthObj (ethObj, options, callback) { callback(null, paths) } -},{"../util/cidFromHash":415,"../util/createResolver":417,"ethereumjs-block/header":229}],409:[function(require,module,exports){ +},{"../util/cidFromHash":420,"../util/createResolver":422,"ethereumjs-block/header":229}],414:[function(require,module,exports){ 'use strict' /* eslint max-nested-callbacks: ["error", 5] */ @@ -61688,7 +63142,7 @@ const ethStateTrieResolver = createTrieResolver('eth-state-trie', ethAccountSnap module.exports = ethStateTrieResolver -},{"../eth-account-snapshot":406,"../util/createTrieResolver":418}],410:[function(require,module,exports){ +},{"../eth-account-snapshot":411,"../util/createTrieResolver":423}],415:[function(require,module,exports){ 'use strict' /* eslint max-nested-callbacks: ["error", 5] */ @@ -61698,7 +63152,7 @@ const ethStorageTrieResolver = createTrieResolver('eth-storage-trie') module.exports = ethStorageTrieResolver -},{"../util/createTrieResolver":418}],411:[function(require,module,exports){ +},{"../util/createTrieResolver":423}],416:[function(require,module,exports){ 'use strict' /* eslint max-nested-callbacks: ["error", 5] */ @@ -61709,7 +63163,7 @@ const ethTxTrieResolver = createTrieResolver('eth-tx-trie', ethTxResolver) module.exports = ethTxTrieResolver -},{"../eth-tx":412,"../util/createTrieResolver":418}],412:[function(require,module,exports){ +},{"../eth-tx":417,"../util/createTrieResolver":423}],417:[function(require,module,exports){ 'use strict' const EthTx = require('ethereumjs-tx') const createResolver = require('../util/createResolver') @@ -61784,7 +63238,7 @@ function mapFromEthObj (tx, options, callback) { callback(null, paths) } -},{"../util/cidFromHash":415,"../util/createResolver":417,"ethereumjs-tx":231}],413:[function(require,module,exports){ +},{"../util/cidFromHash":420,"../util/createResolver":422,"ethereumjs-tx":231}],418:[function(require,module,exports){ 'use strict' exports.ethAccountSnapshot = require('../eth-account-snapshot') @@ -61795,7 +63249,7 @@ exports.ethStorageTrie = require('../eth-storage-trie') exports.ethTx = require('../eth-tx') exports.ethTxTrie = require('../eth-tx-trie') -},{"../eth-account-snapshot":406,"../eth-block":408,"../eth-block-list":407,"../eth-state-trie":409,"../eth-storage-trie":410,"../eth-tx":412,"../eth-tx-trie":411}],414:[function(require,module,exports){ +},{"../eth-account-snapshot":411,"../eth-block":413,"../eth-block-list":412,"../eth-state-trie":414,"../eth-storage-trie":415,"../eth-tx":417,"../eth-tx-trie":416}],419:[function(require,module,exports){ 'use strict' const cidFromHash = require('./cidFromHash') @@ -61807,7 +63261,7 @@ function cidFromEthObj (multicodec, ethObj) { return cid } -},{"./cidFromHash":415}],415:[function(require,module,exports){ +},{"./cidFromHash":420}],420:[function(require,module,exports){ 'use strict' const CID = require('cids') const multihashes = require('multihashes') @@ -61820,7 +63274,7 @@ function cidFromHash (codec, hashBuffer) { return cid } -},{"cids":146,"multihashes":624}],416:[function(require,module,exports){ +},{"cids":146,"multihashes":621}],421:[function(require,module,exports){ module.exports = createIsLink function createIsLink (resolve) { @@ -61843,7 +63297,7 @@ function createIsLink (resolve) { } } -},{}],417:[function(require,module,exports){ +},{}],422:[function(require,module,exports){ 'use strict' const waterfall = require('async/waterfall') const createIsLink = require('../util/createIsLink') @@ -61946,7 +63400,7 @@ function createResolver (multicodec, EthObjClass, mapFromEthObject) { }) } } -},{"../util/createIsLink":416,"../util/createUtil":419,"async/waterfall":73}],418:[function(require,module,exports){ +},{"../util/createIsLink":421,"../util/createUtil":424,"async/waterfall":73}],423:[function(require,module,exports){ (function (Buffer){ 'use strict' const each = require('async/each') @@ -62058,7 +63512,7 @@ function nibbleToPath (data) { return data.map((num) => num.toString(16)).join('/') } }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":433,"./cidFromEthObj":414,"./cidFromHash":415,"./createIsLink":416,"./createResolver":417,"./createUtil":419,"./isExternalLink":421,"./toIpfsBlock":422,"async/asyncify":34,"async/each":37,"async/waterfall":73,"merkle-patricia-tree/trieNode":605,"rlp":789}],419:[function(require,module,exports){ +},{"../../is-buffer/index.js":438,"./cidFromEthObj":419,"./cidFromHash":420,"./createIsLink":421,"./createResolver":422,"./createUtil":424,"./isExternalLink":426,"./toIpfsBlock":427,"async/asyncify":34,"async/each":37,"async/waterfall":73,"merkle-patricia-tree/trieNode":602,"rlp":786}],424:[function(require,module,exports){ const cidFromEthObj = require('./cidFromEthObj') const asyncify = require('async/asyncify') @@ -62072,19 +63526,19 @@ function createUtil (multicodec, EthObjClass) { } } -},{"./cidFromEthObj":414,"async/asyncify":34}],420:[function(require,module,exports){ +},{"./cidFromEthObj":419,"async/asyncify":34}],425:[function(require,module,exports){ (function (Buffer){ // this is the hash of the empty code (SHA3_NULL) module.exports = new Buffer('c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470', 'hex') }).call(this,require("buffer").Buffer) -},{"buffer":144}],421:[function(require,module,exports){ +},{"buffer":144}],426:[function(require,module,exports){ module.exports = isExternalLink function isExternalLink (obj) { return Boolean(obj['/']) } -},{}],422:[function(require,module,exports){ +},{}],427:[function(require,module,exports){ const IpfsBlock = require('ipfs-block') const CID = require('cids') const multihashing = require('multihashing-async') @@ -62101,11 +63555,11 @@ function toIpfsBlock (multicodec, value, callback) { }) } -},{"cids":146,"ipfs-block":316,"multihashing-async":628}],423:[function(require,module,exports){ +},{"cids":146,"ipfs-block":316,"multihashing-async":625}],428:[function(require,module,exports){ arguments[4][311][0].apply(exports,arguments) -},{"buffer":144,"dup":311}],424:[function(require,module,exports){ -arguments[4][391][0].apply(exports,arguments) -},{"./resolver.js":425,"./util.js":426,"dup":391}],425:[function(require,module,exports){ +},{"buffer":144,"dup":311}],429:[function(require,module,exports){ +arguments[4][396][0].apply(exports,arguments) +},{"./resolver.js":430,"./util.js":431,"dup":396}],430:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -62261,7 +63715,7 @@ exports.isLink = (block, path, callback) => { } }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":433,"./util":426,"traverse":846}],426:[function(require,module,exports){ +},{"../../is-buffer/index.js":438,"./util":431,"traverse":843}],431:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -62343,7 +63797,7 @@ exports.cid = (dagNode, callback) => { } }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":433,"./resolver":425,"./util/commit":427,"./util/tag":428,"./util/tree":429,"./util/util":430,"async/setImmediate":70,"async/waterfall":73,"cids":146,"multihashing-async":628}],427:[function(require,module,exports){ +},{"../../is-buffer/index.js":438,"./resolver":430,"./util/commit":432,"./util/tag":433,"./util/tree":434,"./util/util":435,"async/setImmediate":70,"async/waterfall":73,"cids":146,"multihashing-async":625}],432:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -62436,7 +63890,7 @@ exports.deserialize = (data, callback) => { } }).call(this,require("buffer").Buffer) -},{"./util":430,"async/setImmediate":70,"buffer":144,"smart-buffer":817}],428:[function(require,module,exports){ +},{"./util":435,"async/setImmediate":70,"buffer":144,"smart-buffer":814}],433:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -62505,7 +63959,7 @@ exports.deserialize = (data, callback) => { } }).call(this,require("buffer").Buffer) -},{"./util":430,"async/setImmediate":70,"buffer":144,"smart-buffer":817}],429:[function(require,module,exports){ +},{"./util":435,"async/setImmediate":70,"buffer":144,"smart-buffer":814}],434:[function(require,module,exports){ 'use strict' const setImmediate = require('async/setImmediate') @@ -62563,7 +64017,7 @@ exports.deserialize = (data, callback) => { setImmediate(() => callback(null, res)) } -},{"./util":430,"async/setImmediate":70,"smart-buffer":817}],430:[function(require,module,exports){ +},{"./util":435,"async/setImmediate":70,"smart-buffer":814}],435:[function(require,module,exports){ 'use strict' const SmartBuffer = require('smart-buffer').SmartBuffer @@ -62630,7 +64084,7 @@ exports.cidToSha = (cidBuf) => { return mh.digest } -},{"cids":146,"multicodec/src/base-table":423,"multihashes":624,"multihashes/src/constants":623,"smart-buffer":817}],431:[function(require,module,exports){ +},{"cids":146,"multicodec/src/base-table":428,"multihashes":621,"multihashes/src/constants":620,"smart-buffer":814}],436:[function(require,module,exports){ 'use strict' const CID = require('cids') @@ -62661,7 +64115,7 @@ module.exports = { } } -},{"cids":146}],432:[function(require,module,exports){ +},{"cids":146}],437:[function(require,module,exports){ 'use strict' const Block = require('ipfs-block') @@ -63087,7 +64541,7 @@ IPLDResolver.inMemory = function (callback) { module.exports = IPLDResolver -},{"async/doUntil":35,"async/map":65,"async/series":69,"async/waterfall":73,"cids":146,"interface-datastore":290,"ipfs-block":316,"ipfs-block-service":309,"ipfs-repo":328,"ipld-dag-cbor":391,"ipld-dag-pb":403,"ipld-ethereum":413,"ipld-git":424,"ipld-raw":431,"path":670,"pull-defer":708,"pull-stream":726,"pull-traverse":758}],433:[function(require,module,exports){ +},{"async/doUntil":35,"async/map":65,"async/series":69,"async/waterfall":73,"cids":146,"interface-datastore":290,"ipfs-block":316,"ipfs-block-service":309,"ipfs-repo":328,"ipld-dag-cbor":396,"ipld-dag-pb":408,"ipld-ethereum":418,"ipld-git":429,"ipld-raw":436,"path":667,"pull-defer":705,"pull-stream":723,"pull-traverse":755}],438:[function(require,module,exports){ /*! * Determine if an object is a Buffer * @@ -63110,7 +64564,7 @@ function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } -},{}],434:[function(require,module,exports){ +},{}],439:[function(require,module,exports){ module.exports = isCircular /** @@ -63156,7 +64610,7 @@ CircularChecker.prototype.isCircular = function (obj, seen) { return false } -},{}],435:[function(require,module,exports){ +},{}],440:[function(require,module,exports){ /** * Returns a `Boolean` on whether or not the a `String` starts with '0x' * @param {String} str the string input value @@ -63171,13 +64625,13 @@ module.exports = function isHexPrefixed(str) { return str.slice(0, 2) === '0x'; } -},{}],436:[function(require,module,exports){ +},{}],441:[function(require,module,exports){ module.exports = isPromise; function isPromise(obj) { return obj && typeof obj.then === 'function'; } -},{}],437:[function(require,module,exports){ +},{}],442:[function(require,module,exports){ 'use strict'; var isStream = module.exports = function (stream) { @@ -63200,9 +64654,9 @@ isStream.transform = function (stream) { return isStream.duplex(stream) && typeof stream._transform === 'function' && typeof stream._transformState === 'object'; }; -},{}],438:[function(require,module,exports){ +},{}],443:[function(require,module,exports){ arguments[4][243][0].apply(exports,arguments) -},{"dup":243}],439:[function(require,module,exports){ +},{"dup":243}],444:[function(require,module,exports){ (function (process,global){ /** * [js-sha3]{@link https://github.com/emn178/js-sha3} @@ -63828,7 +65282,7 @@ arguments[4][243][0].apply(exports,arguments) })(); }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":682}],440:[function(require,module,exports){ +},{"_process":679}],445:[function(require,module,exports){ 'use strict' module.exports = parseJson @@ -63862,11 +65316,11 @@ function parseJson (txt, reviver, context) { } } -},{}],441:[function(require,module,exports){ +},{}],446:[function(require,module,exports){ 'use strict' module.exports = require('./lib/api')(require('./lib/keccak')) -},{"./lib/api":442,"./lib/keccak":446}],442:[function(require,module,exports){ +},{"./lib/api":447,"./lib/keccak":451}],447:[function(require,module,exports){ 'use strict' var createKeccak = require('./keccak') var createShake = require('./shake') @@ -63896,7 +65350,7 @@ module.exports = function (KeccakState) { } } -},{"./keccak":443,"./shake":444}],443:[function(require,module,exports){ +},{"./keccak":448,"./shake":449}],448:[function(require,module,exports){ 'use strict' var Buffer = require('safe-buffer').Buffer var Transform = require('stream').Transform @@ -63982,7 +65436,7 @@ module.exports = function (KeccakState) { return Keccak } -},{"inherits":287,"safe-buffer":790,"stream":833}],444:[function(require,module,exports){ +},{"inherits":287,"safe-buffer":787,"stream":830}],449:[function(require,module,exports){ 'use strict' var Buffer = require('safe-buffer').Buffer var Transform = require('stream').Transform @@ -64059,7 +65513,7 @@ module.exports = function (KeccakState) { return Shake } -},{"inherits":287,"safe-buffer":790,"stream":833}],445:[function(require,module,exports){ +},{"inherits":287,"safe-buffer":787,"stream":830}],450:[function(require,module,exports){ 'use strict' var P1600_ROUND_CONSTANTS = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648] @@ -64248,7 +65702,7 @@ exports.p1600 = function (s) { } } -},{}],446:[function(require,module,exports){ +},{}],451:[function(require,module,exports){ 'use strict' var Buffer = require('safe-buffer').Buffer var keccakState = require('./keccak-state-unroll') @@ -64320,10 +65774,10 @@ Keccak.prototype.copy = function (dest) { module.exports = Keccak -},{"./keccak-state-unroll":445,"safe-buffer":790}],447:[function(require,module,exports){ +},{"./keccak-state-unroll":450,"safe-buffer":787}],452:[function(require,module,exports){ module.exports = require('browserify-sha3').SHA3Hash -},{"browserify-sha3":119}],448:[function(require,module,exports){ +},{"browserify-sha3":119}],453:[function(require,module,exports){ /* This program is free software. It comes without any warranty, to * the extent permitted by applicable law. You can redistribute it * and/or modify it under the terms of the Do What The Fuck You Want @@ -64377,7 +65831,7 @@ function leftPad (str, len, ch) { return pad + str; } -},{}],449:[function(require,module,exports){ +},{}],454:[function(require,module,exports){ var encodings = require('./lib/encodings'); module.exports = Codec; @@ -64485,7 +65939,7 @@ Codec.prototype.valueAsBuffer = function(opts){ }; -},{"./lib/encodings":450}],450:[function(require,module,exports){ +},{"./lib/encodings":455}],455:[function(require,module,exports){ (function (Buffer){ exports.utf8 = exports['utf-8'] = { encode: function(data){ @@ -64565,7 +66019,7 @@ function isBinary(data){ } }).call(this,require("buffer").Buffer) -},{"buffer":144}],451:[function(require,module,exports){ +},{"buffer":144}],456:[function(require,module,exports){ /* Copyright (c) 2012-2017 LevelUP contributors * See list at * MIT License @@ -64589,7 +66043,7 @@ module.exports = { , EncodingError : createError('EncodingError', LevelUPError) } -},{"errno":225}],452:[function(require,module,exports){ +},{"errno":225}],457:[function(require,module,exports){ var inherits = require('inherits'); var Readable = require('readable-stream').Readable; var extend = require('xtend'); @@ -64647,12 +66101,12 @@ ReadStream.prototype._cleanup = function(){ }; -},{"inherits":287,"level-errors":451,"readable-stream":459,"xtend":865}],453:[function(require,module,exports){ +},{"inherits":287,"level-errors":456,"readable-stream":464,"xtend":862}],458:[function(require,module,exports){ module.exports = Array.isArray || function (arr) { return Object.prototype.toString.call(arr) == '[object Array]'; }; -},{}],454:[function(require,module,exports){ +},{}],459:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -64745,7 +66199,7 @@ function forEach (xs, f) { } }).call(this,require('_process')) -},{"./_stream_readable":456,"./_stream_writable":458,"_process":682,"core-util-is":151,"inherits":287}],455:[function(require,module,exports){ +},{"./_stream_readable":461,"./_stream_writable":463,"_process":679,"core-util-is":151,"inherits":287}],460:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -64793,7 +66247,7 @@ PassThrough.prototype._transform = function(chunk, encoding, cb) { cb(null, chunk); }; -},{"./_stream_transform":457,"core-util-is":151,"inherits":287}],456:[function(require,module,exports){ +},{"./_stream_transform":462,"core-util-is":151,"inherits":287}],461:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -65748,7 +67202,7 @@ function indexOf (xs, x) { } }).call(this,require('_process')) -},{"./_stream_duplex":454,"_process":682,"buffer":144,"core-util-is":151,"events":236,"inherits":287,"isarray":453,"stream":833,"string_decoder/":460,"util":98}],457:[function(require,module,exports){ +},{"./_stream_duplex":459,"_process":679,"buffer":144,"core-util-is":151,"events":236,"inherits":287,"isarray":458,"stream":830,"string_decoder/":465,"util":98}],462:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -65959,7 +67413,7 @@ function done(stream, er) { return stream.push(null); } -},{"./_stream_duplex":454,"core-util-is":151,"inherits":287}],458:[function(require,module,exports){ +},{"./_stream_duplex":459,"core-util-is":151,"inherits":287}],463:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -66440,7 +67894,7 @@ function endWritable(stream, state, cb) { } }).call(this,require('_process')) -},{"./_stream_duplex":454,"_process":682,"buffer":144,"core-util-is":151,"inherits":287,"stream":833}],459:[function(require,module,exports){ +},{"./_stream_duplex":459,"_process":679,"buffer":144,"core-util-is":151,"inherits":287,"stream":830}],464:[function(require,module,exports){ (function (process){ exports = module.exports = require('./lib/_stream_readable.js'); exports.Stream = require('stream'); @@ -66454,7 +67908,7 @@ if (!process.browser && process.env.READABLE_STREAM === 'disable') { } }).call(this,require('_process')) -},{"./lib/_stream_duplex.js":454,"./lib/_stream_passthrough.js":455,"./lib/_stream_readable.js":456,"./lib/_stream_transform.js":457,"./lib/_stream_writable.js":458,"_process":682,"stream":833}],460:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":459,"./lib/_stream_passthrough.js":460,"./lib/_stream_readable.js":461,"./lib/_stream_transform.js":462,"./lib/_stream_writable.js":463,"_process":679,"stream":830}],465:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -66677,7 +68131,7 @@ function base64DetectIncompleteChar(buffer) { this.charLength = this.charReceived ? 3 : 0; } -},{"buffer":144}],461:[function(require,module,exports){ +},{"buffer":144}],466:[function(require,module,exports){ (function (process,Buffer){ module.exports = Level @@ -66979,7 +68433,7 @@ Level.destroy = function(db, callback) { } }).call(this,require('_process'),require("buffer").Buffer) -},{"./iterator":462,"_process":682,"abstract-leveldown":466,"buffer":144,"util":853,"xtend":865}],462:[function(require,module,exports){ +},{"./iterator":467,"_process":679,"abstract-leveldown":471,"buffer":144,"util":850,"xtend":862}],467:[function(require,module,exports){ (function (process,Buffer){ var util = require('util') var AbstractIterator = require('abstract-leveldown').AbstractIterator @@ -67166,7 +68620,7 @@ Iterator.prototype._next = function(callback) { } }).call(this,require('_process'),require("buffer").Buffer) -},{"_process":682,"abstract-leveldown":466,"buffer":144,"idb-readable-stream":284,"ltgt":601,"stream":833,"util":853,"xtend":865}],463:[function(require,module,exports){ +},{"_process":679,"abstract-leveldown":471,"buffer":144,"idb-readable-stream":284,"ltgt":598,"stream":830,"util":850,"xtend":862}],468:[function(require,module,exports){ (function (process){ /* Copyright (c) 2013 Rod Vagg, MIT License */ @@ -67249,7 +68703,7 @@ AbstractChainedBatch.prototype.write = function (options, callback) { module.exports = AbstractChainedBatch }).call(this,require('_process')) -},{"_process":682}],464:[function(require,module,exports){ +},{"_process":679}],469:[function(require,module,exports){ (function (process){ /* Copyright (c) 2013 Rod Vagg, MIT License */ @@ -67302,7 +68756,7 @@ AbstractIterator.prototype.end = function (callback) { module.exports = AbstractIterator }).call(this,require('_process')) -},{"_process":682}],465:[function(require,module,exports){ +},{"_process":679}],470:[function(require,module,exports){ (function (Buffer,process){ /* Copyright (c) 2013 Rod Vagg, MIT License */ @@ -67578,11 +69032,11 @@ AbstractLevelDOWN.prototype._checkKey = function (obj, type) { module.exports = AbstractLevelDOWN }).call(this,{"isBuffer":require("../../../is-buffer/index.js")},require('_process')) -},{"../../../is-buffer/index.js":433,"./abstract-chained-batch":463,"./abstract-iterator":464,"_process":682,"xtend":865}],466:[function(require,module,exports){ +},{"../../../is-buffer/index.js":438,"./abstract-chained-batch":468,"./abstract-iterator":469,"_process":679,"xtend":862}],471:[function(require,module,exports){ arguments[4][176][0].apply(exports,arguments) -},{"./abstract-chained-batch":463,"./abstract-iterator":464,"./abstract-leveldown":465,"./is-leveldown":467,"dup":176}],467:[function(require,module,exports){ +},{"./abstract-chained-batch":468,"./abstract-iterator":469,"./abstract-leveldown":470,"./is-leveldown":472,"dup":176}],472:[function(require,module,exports){ arguments[4][177][0].apply(exports,arguments) -},{"./abstract-leveldown":465,"dup":177}],468:[function(require,module,exports){ +},{"./abstract-leveldown":470,"dup":177}],473:[function(require,module,exports){ /* Copyright (c) 2012-2016 LevelUP contributors * See list at * MIT License @@ -67667,7 +69121,7 @@ Batch.prototype.write = function (callback) { module.exports = Batch -},{"./util":470,"level-errors":451}],469:[function(require,module,exports){ +},{"./util":475,"level-errors":456}],474:[function(require,module,exports){ (function (process){ /* Copyright (c) 2012-2016 LevelUP contributors * See list at @@ -68034,7 +69488,7 @@ module.exports.repair = deprecate( ) }).call(this,require('_process')) -},{"./batch":468,"./leveldown":98,"./util":470,"_process":682,"deferred-leveldown":172,"events":236,"level-codec":449,"level-errors":451,"level-iterator-stream":452,"prr":696,"util":853,"xtend":865}],470:[function(require,module,exports){ +},{"./batch":473,"./leveldown":98,"./util":475,"_process":679,"deferred-leveldown":172,"events":236,"level-codec":454,"level-errors":456,"level-iterator-stream":457,"prr":693,"util":850,"xtend":862}],475:[function(require,module,exports){ /* Copyright (c) 2012-2016 LevelUP contributors * See list at * MIT License @@ -68070,7 +69524,7 @@ module.exports = { isDefined: isDefined } -},{}],471:[function(require,module,exports){ +},{}],476:[function(require,module,exports){ 'use strict' const secp256k1 = require('secp256k1') @@ -68161,7 +69615,7 @@ module.exports = (randomBytes) => { } } -},{"async/setImmediate":70,"multihashing-async":628,"secp256k1":792}],472:[function(require,module,exports){ +},{"async/setImmediate":70,"multihashing-async":625,"secp256k1":789}],477:[function(require,module,exports){ 'use strict' const multihashing = require('multihashing-async') @@ -68281,7 +69735,7 @@ module.exports = (keysProtobuf, randomBytes, crypto) => { } } -},{"./crypto":471,"multihashing-async":628}],473:[function(require,module,exports){ +},{"./crypto":476,"multihashing-async":625}],478:[function(require,module,exports){ /** * @file Web Cryptography API shim * @author Artem S Vybornov @@ -68881,7 +70335,7 @@ module.exports = function webcryptoShim (global) { } } -},{}],474:[function(require,module,exports){ +},{}],479:[function(require,module,exports){ 'use strict' const crypto = require('browserify-aes') @@ -68891,7 +70345,7 @@ module.exports = { createDecipheriv: crypto.createDecipheriv } -},{"browserify-aes":101}],475:[function(require,module,exports){ +},{"browserify-aes":101}],480:[function(require,module,exports){ 'use strict' const ciphers = require('./ciphers') @@ -68923,7 +70377,7 @@ exports.create = function (key, iv, callback) { callback(null, res) } -},{"./ciphers":474}],476:[function(require,module,exports){ +},{"./ciphers":479}],481:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -68966,7 +70420,7 @@ exports.create = function (hashType, secret, callback) { } }).call(this,require("buffer").Buffer) -},{"../nodeify":489,"../webcrypto.js":492,"./lengths":477,"buffer":144}],477:[function(require,module,exports){ +},{"../nodeify":494,"../webcrypto.js":497,"./lengths":482,"buffer":144}],482:[function(require,module,exports){ 'use strict' module.exports = { @@ -68975,7 +70429,7 @@ module.exports = { SHA512: 64 } -},{}],478:[function(require,module,exports){ +},{}],483:[function(require,module,exports){ 'use strict' const hmac = require('./hmac') @@ -68989,7 +70443,7 @@ exports.hmac = hmac exports.keys = keys exports.randomBytes = require('./random-bytes') -},{"./aes":475,"./hmac":476,"./keys":483,"./random-bytes":490}],479:[function(require,module,exports){ +},{"./aes":480,"./hmac":481,"./keys":488,"./random-bytes":495}],484:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -69120,7 +70574,7 @@ function unmarshalPrivateKey (curve, key) { } }).call(this,require("buffer").Buffer) -},{"../nodeify":489,"../util":491,"../webcrypto.js":492,"asn1.js":19,"buffer":144}],480:[function(require,module,exports){ +},{"../nodeify":494,"../util":496,"../webcrypto.js":497,"asn1.js":19,"buffer":144}],485:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -69287,7 +70741,7 @@ module.exports = { } }).call(this,require("buffer").Buffer) -},{"./ed25519":481,"./keys.proto":485,"buffer":144,"multihashing-async":628,"protons":695}],481:[function(require,module,exports){ +},{"./ed25519":486,"./keys.proto":490,"buffer":144,"multihashing-async":625,"protons":692}],486:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -69337,7 +70791,7 @@ exports.hashAndVerify = function (key, sig, msg, callback) { } }).call(this,require("buffer").Buffer) -},{"async/setImmediate":70,"buffer":144,"tweetnacl":847}],482:[function(require,module,exports){ +},{"async/setImmediate":70,"buffer":144,"tweetnacl":844}],487:[function(require,module,exports){ 'use strict' const ecdh = require('./ecdh') @@ -69350,7 +70804,7 @@ module.exports = (curve, callback) => { ecdh.generateEphmeralKeyPair(curve, callback) } -},{"./ecdh":479}],483:[function(require,module,exports){ +},{"./ecdh":484}],488:[function(require,module,exports){ 'use strict' const protobuf = require('protons') @@ -69463,7 +70917,7 @@ exports.marshalPrivateKey = (key, type) => { return key.bytes } -},{"../random-bytes":490,"./ed25519-class":480,"./ephemeral-keys":482,"./key-stretcher":484,"./keys.proto":485,"./rsa-class":487,"libp2p-crypto-secp256k1":472,"protons":695}],484:[function(require,module,exports){ +},{"../random-bytes":495,"./ed25519-class":485,"./ephemeral-keys":487,"./key-stretcher":489,"./keys.proto":490,"./rsa-class":492,"libp2p-crypto-secp256k1":477,"protons":692}],489:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -69575,7 +71029,7 @@ module.exports = (cipherType, hash, secret, callback) => { } }).call(this,require("buffer").Buffer) -},{"../hmac":476,"async/whilst":74,"buffer":144}],485:[function(require,module,exports){ +},{"../hmac":481,"async/whilst":74,"buffer":144}],490:[function(require,module,exports){ 'use strict' module.exports = `enum KeyType { @@ -69591,7 +71045,7 @@ message PrivateKey { required KeyType Type = 1; required bytes Data = 2; }` -},{}],486:[function(require,module,exports){ +},{}],491:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -69714,7 +71168,7 @@ function derivePublicFromPrivate (jwKey) { } }).call(this,require("buffer").Buffer) -},{"../nodeify":489,"../webcrypto.js":492,"./rsa-utils":488,"buffer":144}],487:[function(require,module,exports){ +},{"../nodeify":494,"../webcrypto.js":497,"./rsa-utils":493,"buffer":144}],492:[function(require,module,exports){ 'use strict' const multihashing = require('multihashing-async') @@ -69849,7 +71303,7 @@ module.exports = { generateKeyPair } -},{"./keys.proto":485,"./rsa":486,"multihashing-async":628,"protons":695}],488:[function(require,module,exports){ +},{"./keys.proto":490,"./rsa":491,"multihashing-async":625,"protons":692}],493:[function(require,module,exports){ 'use strict' const asn1 = require('asn1.js') @@ -69965,7 +71419,7 @@ exports.jwkToPkix = function (jwk) { }, 'der') } -},{"./../util":491,"asn1.js":19}],489:[function(require,module,exports){ +},{"./../util":496,"asn1.js":19}],494:[function(require,module,exports){ 'use strict' // Based on npmjs.com/nodeify but without additional `nextTick` calls @@ -69978,7 +71432,7 @@ module.exports = function nodeify (promise, cb) { }) } -},{}],490:[function(require,module,exports){ +},{}],495:[function(require,module,exports){ 'use strict' const rsa = require('./keys/rsa') @@ -69993,7 +71447,7 @@ function randomBytes (number) { module.exports = randomBytes -},{"./keys/rsa":486}],491:[function(require,module,exports){ +},{"./keys/rsa":491}],496:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -70017,7 +71471,7 @@ exports.toBn = function toBn (str) { } }).call(this,require("buffer").Buffer) -},{"asn1.js":19,"buffer":144}],492:[function(require,module,exports){ +},{"asn1.js":19,"buffer":144}],497:[function(require,module,exports){ /* global self */ 'use strict' @@ -70035,7 +71489,7 @@ module.exports = () => { throw new Error('Please use an environment with crypto support') } -},{"webcrypto-shim":473}],493:[function(require,module,exports){ +},{"webcrypto-shim":478}],498:[function(require,module,exports){ 'use strict' const debug = require('debug') @@ -70048,7 +71502,7 @@ module.exports = { multicodec: '/floodsub/1.0.0' } -},{"debug":168}],494:[function(require,module,exports){ +},{"debug":168}],499:[function(require,module,exports){ 'use strict' const EventEmitter = require('events') @@ -70391,7 +71845,7 @@ class FloodSub extends EventEmitter { module.exports = FloodSub -},{"./config":493,"./message":495,"./peer":498,"./utils":499,"assert":33,"async/each":37,"async/setImmediate":70,"events":236,"lodash.values":563,"pull-length-prefixed":715,"pull-stream":726,"safe-buffer":790,"time-cache":842}],495:[function(require,module,exports){ +},{"./config":498,"./message":500,"./peer":503,"./utils":504,"assert":33,"async/each":37,"async/setImmediate":70,"events":236,"lodash.values":560,"pull-length-prefixed":712,"pull-stream":723,"safe-buffer":787,"time-cache":839}],500:[function(require,module,exports){ 'use strict' const protons = require('protons') @@ -70403,7 +71857,7 @@ exports = module.exports exports.rpc = rpcProto exports.td = topicDescriptorProto -},{"./rpc.proto.js":496,"./topic-descriptor.proto.js":497,"protons":695}],496:[function(require,module,exports){ +},{"./rpc.proto.js":501,"./topic-descriptor.proto.js":502,"protons":692}],501:[function(require,module,exports){ 'use strict' module.exports = ` message RPC { @@ -70423,7 +71877,7 @@ message RPC { } }` -},{}],497:[function(require,module,exports){ +},{}],502:[function(require,module,exports){ 'use strict' module.exports = ` // topicCID = cid(merkledag_protobuf(topicDescriptor)); (not the topic.name) @@ -70455,7 +71909,7 @@ message TopicDescriptor { } }` -},{}],498:[function(require,module,exports){ +},{}],503:[function(require,module,exports){ 'use strict' const lp = require('pull-length-prefixed') @@ -70630,7 +72084,7 @@ class Peer { module.exports = Peer -},{"./message":495,"async/setImmediate":70,"pull-length-prefixed":715,"pull-pushable":721,"pull-stream":726}],499:[function(require,module,exports){ +},{"./message":500,"async/setImmediate":70,"pull-length-prefixed":712,"pull-pushable":718,"pull-stream":723}],504:[function(require,module,exports){ 'use strict' const crypto = require('libp2p-crypto') @@ -70700,7 +72154,7 @@ exports.ensureArray = (maybeArray) => { return maybeArray } -},{"libp2p-crypto":478}],500:[function(require,module,exports){ +},{"libp2p-crypto":483}],505:[function(require,module,exports){ 'use strict' const PeerInfo = require('peer-info') const PeerId = require('peer-id') @@ -70761,7 +72215,7 @@ function hasObservedAddr (input) { return input.observedAddr && input.observedAddr.length > 0 } -},{"./message":503,"multiaddr":612,"peer-id":677,"peer-info":678,"pull-length-prefixed":715,"pull-stream":726}],501:[function(require,module,exports){ +},{"./message":508,"multiaddr":609,"peer-id":674,"peer-info":675,"pull-length-prefixed":712,"pull-stream":723}],506:[function(require,module,exports){ 'use strict' exports = module.exports @@ -70769,7 +72223,7 @@ exports.multicodec = '/ipfs/id/1.0.0' exports.listener = require('./listener') exports.dialer = require('./dialer') -},{"./dialer":500,"./listener":502}],502:[function(require,module,exports){ +},{"./dialer":505,"./listener":507}],507:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -70806,7 +72260,7 @@ module.exports = (conn, pInfoSelf) => { } }).call(this,require("buffer").Buffer) -},{"./message":503,"buffer":144,"pull-length-prefixed":715,"pull-stream":726}],503:[function(require,module,exports){ +},{"./message":508,"buffer":144,"pull-length-prefixed":712,"pull-stream":723}],508:[function(require,module,exports){ 'use strict' const protons = require('protons') @@ -70838,7 +72292,7 @@ message Identify { module.exports = protons(schema).Identify -},{"protons":695}],504:[function(require,module,exports){ +},{"protons":692}],509:[function(require,module,exports){ 'use strict' const Multiplex = require('multiplex') @@ -70871,12 +72325,12 @@ exports.multicodec = MULTIPLEX_CODEC exports.dialer = (conn) => create(conn, false) exports.listener = (conn) => create(conn, true) -},{"./multiplex-codec":505,"./muxer":506,"multiplex":637,"pull-stream-to-stream":725,"pump":768}],505:[function(require,module,exports){ +},{"./multiplex-codec":510,"./muxer":511,"multiplex":634,"pull-stream-to-stream":722,"pump":765}],510:[function(require,module,exports){ 'use strict' module.exports = '/mplex/6.7.0' -},{}],506:[function(require,module,exports){ +},{}],511:[function(require,module,exports){ 'use strict' const EventEmitter = require('events').EventEmitter @@ -70947,7 +72401,7 @@ function catchError (stream) { } } -},{"./multiplex-codec":505,"async/setImmediate":70,"events":236,"interface-connection":289,"pull-catch":706,"pull-stream":726,"stream-to-pull-stream":839}],507:[function(require,module,exports){ +},{"./multiplex-codec":510,"async/setImmediate":70,"events":236,"interface-connection":289,"pull-catch":703,"pull-stream":723,"stream-to-pull-stream":836}],512:[function(require,module,exports){ 'use strict' module.exports = { @@ -70955,7 +72409,7 @@ module.exports = { PING_LENGTH: 32 } -},{}],508:[function(require,module,exports){ +},{}],513:[function(require,module,exports){ 'use strict' const pull = require('pull-stream') @@ -71007,7 +72461,7 @@ exports = module.exports exports.mount = mount exports.unmount = unmount -},{"./constants":507,"debug":168,"pull-handshake":712,"pull-stream":726}],509:[function(require,module,exports){ +},{"./constants":512,"debug":168,"pull-handshake":709,"pull-stream":723}],514:[function(require,module,exports){ 'use strict' const handler = require('./handler') @@ -71016,7 +72470,7 @@ exports = module.exports = require('./ping') exports.mount = handler.mount exports.unmount = handler.unmount -},{"./handler":508,"./ping":510}],510:[function(require,module,exports){ +},{"./handler":513,"./ping":515}],515:[function(require,module,exports){ 'use strict' const EventEmitter = require('events').EventEmitter @@ -71097,7 +72551,7 @@ class Ping extends EventEmitter { module.exports = Ping -},{"./constants":507,"./util":511,"debug":168,"events":236,"pull-handshake":712,"pull-stream":726}],511:[function(require,module,exports){ +},{"./constants":512,"./util":516,"debug":168,"events":236,"pull-handshake":709,"pull-stream":723}],516:[function(require,module,exports){ 'use strict' const crypto = require('libp2p-crypto') @@ -71112,7 +72566,7 @@ exports.rnd = (length) => { return crypto.randomBytes(length) } -},{"./constants":507,"libp2p-crypto":478}],512:[function(require,module,exports){ +},{"./constants":512,"libp2p-crypto":483}],517:[function(require,module,exports){ 'use strict' const PeerId = require('peer-id') @@ -71164,7 +72618,7 @@ class Railing extends EventEmitter { module.exports = Railing -},{"async/setImmediate":70,"debug":168,"events":236,"multiaddr":612,"peer-id":677,"peer-info":678}],513:[function(require,module,exports){ +},{"async/setImmediate":70,"debug":168,"events":236,"multiaddr":609,"peer-id":674,"peer-info":675}],518:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -71247,7 +72701,7 @@ function ensureBuffer () { } }).call(this,require("buffer").Buffer) -},{"buffer":144,"pull-length-prefixed":715,"pull-stream":726}],514:[function(require,module,exports){ +},{"buffer":144,"pull-length-prefixed":712,"pull-stream":723}],519:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -71449,7 +72903,7 @@ exports.verifyNonce = (state, n2) => { } }).call(this,require("buffer").Buffer) -},{"../support":522,"./secio.proto":519,"async/parallel":66,"async/waterfall":73,"buffer":144,"debug":168,"libp2p-crypto":478,"peer-id":677,"protons":695}],515:[function(require,module,exports){ +},{"../support":527,"./secio.proto":524,"async/parallel":66,"async/waterfall":73,"buffer":144,"debug":168,"libp2p-crypto":483,"peer-id":674,"protons":692}],520:[function(require,module,exports){ 'use strict' const debug = require('debug') @@ -71488,7 +72942,7 @@ module.exports = function exchange (state, cb) { }) } -},{"../support":522,"./crypto":514,"async/waterfall":73,"debug":168}],516:[function(require,module,exports){ +},{"../support":527,"./crypto":519,"async/waterfall":73,"debug":168}],521:[function(require,module,exports){ 'use strict' const pull = require('pull-stream') @@ -71550,7 +73004,7 @@ module.exports = function finish (state, cb) { }) } -},{"../etm":513,"./crypto":514,"debug":168,"pull-handshake":712,"pull-stream":726}],517:[function(require,module,exports){ +},{"../etm":518,"./crypto":519,"debug":168,"pull-handshake":709,"pull-stream":723}],522:[function(require,module,exports){ 'use strict' const series = require('async/series') @@ -71580,7 +73034,7 @@ module.exports = function handshake (state) { return state.stream } -},{"./exchange":515,"./finish":516,"./propose":518,"async/series":69}],518:[function(require,module,exports){ +},{"./exchange":520,"./finish":521,"./propose":523,"async/series":69}],523:[function(require,module,exports){ 'use strict' const debug = require('debug') @@ -71617,7 +73071,7 @@ module.exports = function propose (state, cb) { }) } -},{"../support":522,"./crypto":514,"async/waterfall":73,"debug":168}],519:[function(require,module,exports){ +},{"../support":527,"./crypto":519,"async/waterfall":73,"debug":168}],524:[function(require,module,exports){ 'use strict' module.exports = `message Propose { @@ -71633,7 +73087,7 @@ message Exchange { optional bytes signature = 2; }` -},{}],520:[function(require,module,exports){ +},{}],525:[function(require,module,exports){ 'use strict' const pull = require('pull-stream') @@ -71677,7 +73131,7 @@ module.exports = { } } -},{"./handshake":517,"./state":521,"interface-connection":289,"pull-stream":726}],521:[function(require,module,exports){ +},{"./handshake":522,"./state":526,"interface-connection":289,"pull-stream":723}],526:[function(require,module,exports){ 'use strict' const handshake = require('pull-handshake') @@ -71751,7 +73205,7 @@ class State { module.exports = State -},{"pull-defer":708,"pull-handshake":712}],522:[function(require,module,exports){ +},{"pull-defer":705,"pull-handshake":709}],527:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -71890,7 +73344,7 @@ exports.read = function read (reader, cb) { } }).call(this,require("buffer").Buffer) -},{"async/parallel":66,"buffer":144,"libp2p-crypto":478,"multihashing-async":628,"pull-length-prefixed":715,"pull-stream":726}],523:[function(require,module,exports){ +},{"async/parallel":66,"buffer":144,"libp2p-crypto":483,"multihashing-async":625,"pull-length-prefixed":712,"pull-stream":723}],528:[function(require,module,exports){ 'use strict' const identify = require('libp2p-identify') @@ -72004,7 +73458,7 @@ module.exports = function connection (swarm) { } } -},{"./plaintext":529,"./protocol-muxer":530,"async/setImmediate":70,"async/waterfall":73,"debug":168,"libp2p-identify":501,"multistream-select":642}],524:[function(require,module,exports){ +},{"./plaintext":534,"./protocol-muxer":535,"async/setImmediate":70,"async/waterfall":73,"debug":168,"libp2p-identify":506,"multistream-select":639}],529:[function(require,module,exports){ 'use strict' const multistream = require('multistream-select') @@ -72209,7 +73663,7 @@ function dial (swarm) { module.exports = dial -},{"./get-peer-info":525,"./protocol-muxer":530,"async/setImmediate":70,"debug":168,"interface-connection":289,"multistream-select":642}],525:[function(require,module,exports){ +},{"./get-peer-info":530,"./protocol-muxer":535,"async/setImmediate":70,"debug":168,"interface-connection":289,"multistream-select":639}],530:[function(require,module,exports){ 'use strict' const PeerId = require('peer-id') @@ -72252,7 +73706,7 @@ function getPeerInfo (peer, peerBook) { module.exports = getPeerInfo -},{"multiaddr":612,"peer-id":677,"peer-info":678}],526:[function(require,module,exports){ +},{"multiaddr":609,"peer-id":674,"peer-info":675}],531:[function(require,module,exports){ 'use strict' const util = require('util') @@ -72389,7 +73843,7 @@ function Swarm (peerInfo, peerBook) { } } -},{"./connection":523,"./dial":524,"./get-peer-info":525,"./plaintext":529,"./protocol-muxer":530,"./transport":531,"assert":33,"async/each":37,"async/series":69,"events":236,"util":853}],527:[function(require,module,exports){ +},{"./connection":528,"./dial":529,"./get-peer-info":530,"./plaintext":534,"./protocol-muxer":535,"./transport":536,"assert":33,"async/each":37,"async/series":69,"events":236,"util":850}],532:[function(require,module,exports){ 'use strict' const map = require('async/map') @@ -72479,7 +73933,7 @@ class LimitDialer { module.exports = LimitDialer -},{"./queue":528,"async/map":65,"debug":168}],528:[function(require,module,exports){ +},{"./queue":533,"async/map":65,"debug":168}],533:[function(require,module,exports){ 'use strict' const Connection = require('interface-connection').Connection @@ -72558,1594 +74012,315 @@ class DialQueue { */ _dialWithTimeout (transport, addr, callback) { timeout((cb) => { - const conn = transport.dial(addr, (err) => { - if (err) { - return cb(err) - } - - cb(null, conn) - }) - }, this.dialTimeout)(callback) - } - - /** - * Add new work to the queue. - * - * @param {SwarmTransport} transport - * @param {Multiaddr} addr - * @param {CancelToken} token - * @param {function(Error, Connection)} callback - * @returns {void} - */ - push (transport, addr, token, callback) { - this.queue.push({transport, addr, token}, callback) - } -} - -module.exports = DialQueue - -},{"async/queue":67,"async/timeout":72,"debug":168,"interface-connection":289,"pull-stream":726}],529:[function(require,module,exports){ -'use strict' - -module.exports = { - tag: '/plaintext/1.0.0', - encrypt (id, privKey, conn) { - return conn - } -} - -},{}],530:[function(require,module,exports){ -'use strict' - -const multistream = require('multistream-select') - -module.exports = function protocolMuxer (protocols, conn) { - const ms = new multistream.Listener() - - Object.keys(protocols).forEach((protocol) => { - if (!protocol) { - return - } - - ms.addHandler(protocol, protocols[protocol].handlerFunc, protocols[protocol].matchFunc) - }) - - ms.handle(conn, (err) => { - if (err) { - // the multistream handshake failed - } - }) -} - -},{"multistream-select":642}],531:[function(require,module,exports){ -'use strict' - -const parallel = require('async/parallel') -const once = require('once') -const debug = require('debug') -const log = debug('libp2p:swarm:transport') - -const protocolMuxer = require('./protocol-muxer') -const LimitDialer = require('./limit-dialer') - -// number of concurrent outbound dials to make per peer, same as go-libp2p-swarm -const defaultPerPeerRateLimit = 8 - -// the amount of time a single dial has to succeed -// TODO this should be exposed as a option -const dialTimeout = 30 * 1000 - -module.exports = function (swarm) { - const dialer = new LimitDialer(defaultPerPeerRateLimit, dialTimeout) - - return { - add (key, transport, options, callback) { - if (typeof options === 'function') { - callback = options - options = {} - } - - callback = callback || noop - - log('adding %s', key) - if (swarm.transports[key]) { - throw new Error('There is already a transport with this key') - } - swarm.transports[key] = transport - if (!swarm.transports[key].listeners) { - swarm.transports[key].listeners = [] - } - - callback() - }, - - dial (key, pi, callback) { - const t = swarm.transports[key] - let multiaddrs = pi.multiaddrs.toArray() - - if (!Array.isArray(multiaddrs)) { - multiaddrs = [multiaddrs] - } - log('dialing %s', key, multiaddrs.map((m) => m.toString())) - // filter the multiaddrs that are actually valid for this transport (use a func from the transport itself) (maybe even make the transport do that) - multiaddrs = dialables(t, multiaddrs) - - dialer.dialMany(pi.id, t, multiaddrs, (err, success) => { - if (err) { - return callback(err) - } - - pi.connect(success.multiaddr) - swarm._peerBook.put(pi) - callback(null, success.conn) - }) - }, - - listen (key, options, handler, callback) { - // if no handler is passed, we pass conns to protocolMuxer - if (!handler) { - handler = protocolMuxer.bind(null, swarm.protocols) - } - - const multiaddrs = dialables(swarm.transports[key], swarm._peerInfo.multiaddrs.distinct()) - - const transport = swarm.transports[key] - - if (!transport.listeners) { - transport.listeners = [] - } - - let freshMultiaddrs = [] - - const createListeners = multiaddrs.map((ma) => { - return (cb) => { - const done = once(cb) - const listener = transport.createListener(handler) - listener.once('error', done) - - listener.listen(ma, (err) => { - if (err) { - return done(err) - } - listener.removeListener('error', done) - listener.getAddrs((err, addrs) => { - if (err) { - return done(err) - } - freshMultiaddrs = freshMultiaddrs.concat(addrs) - transport.listeners.push(listener) - done() - }) - }) - } - }) - - parallel(createListeners, (err) => { - if (err) { - return callback(err) - } - - // cause we can listen on port 0 or 0.0.0.0 - swarm._peerInfo.multiaddrs.replace(multiaddrs, freshMultiaddrs) - callback() - }) - }, - - close (key, callback) { - const transport = swarm.transports[key] - - if (!transport) { - return callback(new Error(`Trying to close non existing transport: ${key}`)) - } - - parallel(transport.listeners.map((listener) => { - return (cb) => { - listener.close(cb) - } - }), callback) - } - } -} - -function dialables (tp, multiaddrs) { - return tp.filter(multiaddrs) -} - -function noop () {} - -},{"./limit-dialer":527,"./protocol-muxer":530,"async/parallel":66,"debug":168,"once":661}],532:[function(require,module,exports){ -'use strict' - -const debug = require('debug') -const log = debug('libp2p:webrtc-star') -const multiaddr = require('multiaddr') -const mafmt = require('mafmt') -const io = require('socket.io-client') -const EE = require('events').EventEmitter -const SimplePeer = require('simple-peer') -const PeerId = require('peer-id') -const PeerInfo = require('peer-info') -const Connection = require('interface-connection').Connection -const toPull = require('stream-to-pull-stream') -const once = require('once') -const setImmediate = require('async/setImmediate') -const webrtcSupport = require('webrtcsupport') -const utils = require('./utils') -const cleanUrlSIO = utils.cleanUrlSIO -const cleanMultiaddr = utils.cleanMultiaddr - -const noop = once(() => {}) - -const sioOptions = { - transports: ['websocket'], - 'force new connection': true -} - -class WebRTCStar { - constructor (options) { - options = options || {} - - this.maSelf = undefined - - this.sioOptions = { - transports: ['websocket'], - 'force new connection': true - } - - if (options.wrtc) { - this.wrtc = options.wrtc - } - - this.discovery = new EE() - this.discovery.start = (callback) => { setImmediate(callback) } - this.discovery.stop = (callback) => { setImmediate(callback) } - - this.listenersRefs = {} - this._peerDiscovered = this._peerDiscovered.bind(this) - } - - dial (ma, options, callback) { - if (typeof options === 'function') { - callback = options - options = {} - } - - callback = callback ? once(callback) : noop - - const intentId = (~~(Math.random() * 1e9)).toString(36) + Date.now() - - const sioClient = this - .listenersRefs[Object.keys(this.listenersRefs)[0]].io - - const spOptions = { initiator: true, trickle: false } - - // Use custom WebRTC implementation - if (this.wrtc) { spOptions.wrtc = this.wrtc } - - const channel = new SimplePeer(spOptions) - - const conn = new Connection(toPull.duplex(channel)) - let connected = false - - channel.on('signal', (signal) => { - sioClient.emit('ss-handshake', { - intentId: intentId, - srcMultiaddr: this.maSelf.toString(), - dstMultiaddr: ma.toString(), - signal: signal - }) - }) - - channel.once('timeout', () => callback(new Error('timeout'))) - - channel.once('error', (err) => { - if (!connected) { callback(err) } - }) - - // NOTE: aegir segfaults if we do .once on the socket.io event emitter and we - // are clueless as to why. - sioClient.on('ws-handshake', (offer) => { - if (offer.intentId === intentId && offer.err) { - return callback(new Error(offer.err)) - } - - if (offer.intentId !== intentId || !offer.answer) { - return - } - - channel.once('connect', () => { - connected = true - conn.destroy = channel.destroy.bind(channel) - - channel.once('close', () => conn.destroy()) - - conn.getObservedAddrs = (callback) => callback(null, [ma]) - - callback(null, conn) - }) - - channel.signal(offer.signal) - }) - - return conn - } - - createListener (options, handler) { - if (typeof options === 'function') { - handler = options - options = {} - } - - const listener = new EE() - - listener.listen = (ma, callback) => { - callback = callback ? once(callback) : noop - - if (!webrtcSupport.support && !this.wrtc) { - return setImmediate(() => callback(new Error('no WebRTC support'))) - } - - this.maSelf = ma - - const sioUrl = cleanUrlSIO(ma) - - log('Dialing to Signalling Server on: ' + sioUrl) - - listener.io = io.connect(sioUrl, sioOptions) - - listener.io.once('connect_error', callback) - listener.io.once('error', (err) => { - listener.emit('error', err) - listener.emit('close') - }) - - listener.io.on('ws-handshake', incommingDial) - listener.io.on('ws-peer', this._peerDiscovered) - - listener.io.on('connect', () => { - listener.io.emit('ss-join', ma.toString()) - }) - - listener.io.once('connect', () => { - listener.emit('listening') - callback() - }) - - const self = this - function incommingDial (offer) { - if (offer.answer || offer.err) { - return - } - - const spOptions = { trickle: false } - - // Use custom WebRTC implementation - if (self.wrtc) { spOptions.wrtc = self.wrtc } - - const channel = new SimplePeer(spOptions) - - const conn = new Connection(toPull.duplex(channel)) - - channel.once('connect', () => { - conn.getObservedAddrs = (callback) => { - return callback(null, [offer.srcMultiaddr]) - } - - listener.emit('connection', conn) - handler(conn) - }) - - channel.once('signal', (signal) => { - offer.signal = signal - offer.answer = true - listener.io.emit('ss-handshake', offer) - }) - - channel.signal(offer.signal) - } - } - - listener.close = (callback) => { - callback = callback ? once(callback) : noop - - listener.io.emit('ss-leave') - - setImmediate(() => { - listener.emit('close') - callback() - }) - } - - listener.getAddrs = (callback) => { - setImmediate(() => callback(null, [this.maSelf])) - } - - this.listenersRefs[multiaddr.toString()] = listener - return listener - } - - filter (multiaddrs) { - if (!Array.isArray(multiaddrs)) { - multiaddrs = [multiaddrs] - } - return multiaddrs.filter((ma) => mafmt.WebRTCStar.matches(ma)) - } - - _peerDiscovered (maStr) { - log('Peer Discovered:', maStr) - maStr = cleanMultiaddr(maStr) - - const split = maStr.split('/ipfs/') - const peerIdStr = split[split.length - 1] - const peerId = PeerId.createFromB58String(peerIdStr) - const peerInfo = new PeerInfo(peerId) - peerInfo.multiaddrs.add(multiaddr(maStr)) - this.discovery.emit('peer', peerInfo) - } -} - -module.exports = WebRTCStar - -},{"./utils":533,"async/setImmediate":70,"debug":168,"events":236,"interface-connection":289,"mafmt":602,"multiaddr":612,"once":661,"peer-id":677,"peer-info":678,"simple-peer":814,"socket.io-client":818,"stream-to-pull-stream":839,"webrtcsupport":863}],533:[function(require,module,exports){ -'use strict' - -const multiaddr = require('multiaddr') - -function cleanUrlSIO (ma) { - const maStrSplit = ma.toString().split('/') - - if (!multiaddr.isName(ma)) { - return 'http://' + maStrSplit[2] + ':' + maStrSplit[4] - } else { - const wsProto = ma.protos()[1].name - - if (wsProto === 'ws') { - return 'http://' + maStrSplit[2] - } else if (wsProto === 'wss') { - return 'https://' + maStrSplit[2] - } else { - throw new Error('invalid multiaddr' + ma.toString()) - } - } -} - -function cleanMultiaddr (maStr) { - const legacy = '/libp2p-webrtc-star' - - if (maStr.indexOf(legacy) !== -1) { - maStr = maStr.substring(legacy.length, maStr.length) - let ma = multiaddr(maStr) - const tuppleIPFS = ma.stringTuples().filter((tupple) => { - return tupple[0] === 421 // ipfs code - })[0] - - ma = ma.decapsulate('ipfs') - ma = ma.encapsulate('p2p-webrtc-star') - ma = ma.encapsulate(`/ipfs/${tuppleIPFS[1]}`) - maStr = ma.toString() - } - - return maStr -} - -exports = module.exports -exports.cleanUrlSIO = cleanUrlSIO -exports.cleanMultiaddr = cleanMultiaddr - -},{"multiaddr":612}],534:[function(require,module,exports){ -'use strict' - -const multiaddr = require('multiaddr') - -/* - * Valid combinations - */ -const DNS4 = base('dns4') -const DNS6 = base('dns6') -const _DNS = or( - base('dns'), - DNS4, - DNS6 -) - -const IP = or(base('ip4'), base('ip6')) -const TCP = and(IP, base('tcp')) -const UDP = and(IP, base('udp')) -const UTP = and(UDP, base('utp')) - -const DNS = or( - and(_DNS, base('tcp')), - _DNS -) - -const WebSockets = or( - and(TCP, base('ws')), - and(DNS, base('ws')) -) - -const WebSocketsSecure = or( - and(TCP, base('wss')), - and(DNS, base('wss')) -) - -const HTTP = or( - and(TCP, base('http')), - and(DNS), - and(DNS, base('http')) -) - -const WebRTCStar = or( - and(base('libp2p-webrtc-star'), WebSockets, base('ipfs')), - and(base('libp2p-webrtc-star'), WebSocketsSecure, base('ipfs')) -) - -const WebRTCDirect = and(base('libp2p-webrtc-direct'), HTTP) - -const Reliable = or( - WebSockets, - WebSocketsSecure, - HTTP, - WebRTCStar, - WebRTCDirect, - TCP, - UTP -) - -let _IPFS = or( - and(Reliable, base('ipfs')), - WebRTCStar, - base('ipfs') -) - -const _Circuit = or( - and(_IPFS, base('p2p-circuit'), _IPFS), - and(_IPFS, base('p2p-circuit')), - and(base('p2p-circuit'), _IPFS), - and(Reliable, base('p2p-circuit')), - and(base('p2p-circuit'), Reliable), - base('p2p-circuit') -) - -const CircuitRecursive = () => or( - and(_Circuit, CircuitRecursive), - _Circuit -) - -const Circuit = CircuitRecursive() - -const IPFS = or( - and(Circuit, _IPFS, Circuit), - and(_IPFS, Circuit), - and(Circuit, _IPFS), - Circuit, - _IPFS -) - -exports.DNS = DNS -exports.DNS4 = DNS4 -exports.DNS6 = DNS6 -exports.IP = IP -exports.TCP = TCP -exports.UDP = UDP -exports.UTP = UTP -exports.HTTP = HTTP -exports.WebSockets = WebSockets -exports.WebSocketsSecure = WebSocketsSecure -exports.WebRTCStar = WebRTCStar -exports.WebRTCDirect = WebRTCDirect -exports.Reliable = Reliable -exports.Circuit = Circuit -exports.IPFS = IPFS - -/* - * Validation funcs - */ - -function and () { - const args = Array.from(arguments) - - function matches (a) { - if (typeof a === 'string') { - a = multiaddr(a) - } - let out = partialMatch(a.protoNames()) - if (out === null) { - return false - } - return out.length === 0 - } - - function partialMatch (a) { - if (a.length < args.length) { - return null - } - args.some(function (arg) { - a = typeof arg === 'function' ? arg().partialMatch(a) : arg.partialMatch(a) - if (a === null) { - return true - } - }) - - return a - } - - return { - input: args, - matches: matches, - partialMatch: partialMatch - } -} - -function or () { - const args = Array.from(arguments) - - function matches (a) { - if (typeof a === 'string') { - a = multiaddr(a) - } - const out = partialMatch(a.protoNames()) - if (out === null) { - return false - } - return out.length === 0 - } - - function partialMatch (a) { - let out = null - args.some(function (arg) { - const res = typeof arg === 'function' ? arg().partialMatch(a) : arg.partialMatch(a) - if (res) { - out = res - return true - } - }) - - return out - } - - const result = { - toString: function () { return '{ ' + args.join(' ') + ' }' }, - input: args, - matches: matches, - partialMatch: partialMatch - } - - return result -} - -function base (n) { - const name = n - - function matches (a) { - if (typeof a === 'string') { - a = multiaddr(a) - } - - const pnames = a.protoNames() - if (pnames.length === 1 && pnames[0] === name) { - return true - } - return false - } - - function partialMatch (protos) { - if (protos.length === 0) { - return null - } - - if (protos[0] === name) { - return protos.slice(1) - } - return null - } - - return { - toString: function () { return name }, - matches: matches, - partialMatch: partialMatch - } -} - -},{"multiaddr":537}],535:[function(require,module,exports){ -(function (Buffer){ -'use strict' - -const map = require('lodash.map') -const filter = require('lodash.filter') -const convert = require('./convert') -const protocols = require('./protocols-table') -const varint = require('varint') - -// export codec -module.exports = { - stringToStringTuples: stringToStringTuples, - stringTuplesToString: stringTuplesToString, - - tuplesToStringTuples: tuplesToStringTuples, - stringTuplesToTuples: stringTuplesToTuples, - - bufferToTuples: bufferToTuples, - tuplesToBuffer: tuplesToBuffer, - - bufferToString: bufferToString, - stringToBuffer: stringToBuffer, - - fromString: fromString, - fromBuffer: fromBuffer, - validateBuffer: validateBuffer, - isValidBuffer: isValidBuffer, - cleanPath: cleanPath, - - ParseError: ParseError, - protoFromTuple: protoFromTuple, - - sizeForAddr: sizeForAddr -} - -// string -> [[str name, str addr]... ] -function stringToStringTuples (str) { - const tuples = [] - const parts = str.split('/').slice(1) // skip first empty elem - if (parts.length === 1 && parts[0] === '') { - return [] - } - - for (let p = 0; p < parts.length; p++) { - const part = parts[p] - const proto = protocols(part) - - if (proto.size === 0) { - tuples.push([part]) - continue - } - - p++ // advance addr part - if (p >= parts.length) { - throw ParseError('invalid address: ' + str) - } - - tuples.push([part, parts[p]]) - } - - return tuples -} - -// [[str name, str addr]... ] -> string -function stringTuplesToString (tuples) { - const parts = [] - map(tuples, function (tup) { - const proto = protoFromTuple(tup) - parts.push(proto.name) - if (tup.length > 1) { - parts.push(tup[1]) - } - }) - - return '/' + parts.join('/') -} - -// [[str name, str addr]... ] -> [[int code, Buffer]... ] -function stringTuplesToTuples (tuples) { - return map(tuples, function (tup) { - if (!Array.isArray(tup)) { - tup = [tup] - } - const proto = protoFromTuple(tup) - if (tup.length > 1) { - return [proto.code, convert.toBuffer(proto.code, tup[1])] - } - return [proto.code] - }) -} - -// [[int code, Buffer]... ] -> [[str name, str addr]... ] -function tuplesToStringTuples (tuples) { - return map(tuples, function (tup) { - const proto = protoFromTuple(tup) - if (tup.length > 1) { - return [proto.code, convert.toString(proto.code, tup[1])] - } - return [proto.code] - }) -} - -// [[int code, Buffer ]... ] -> Buffer -function tuplesToBuffer (tuples) { - return fromBuffer(Buffer.concat(map(tuples, function (tup) { - const proto = protoFromTuple(tup) - let buf = new Buffer(varint.encode(proto.code)) - - if (tup.length > 1) { - buf = Buffer.concat([buf, tup[1]]) // add address buffer - } - - return buf - }))) -} - -function sizeForAddr (p, addr) { - if (p.size > 0) { - return p.size / 8 - } else if (p.size === 0) { - return 0 - } else { - const size = varint.decode(addr) - return size + varint.decode.bytes - } -} - -// Buffer -> [[int code, Buffer ]... ] -function bufferToTuples (buf) { - const tuples = [] - let i = 0 - while (i < buf.length) { - const code = varint.decode(buf, i) - const n = varint.decode.bytes - - const p = protocols(code) - - const size = sizeForAddr(p, buf.slice(i + n)) - - if (size === 0) { - tuples.push([code]) - i += n - continue - } - - const addr = buf.slice(i + n, i + n + size) - - i += (size + n) - - if (i > buf.length) { // did not end _exactly_ at buffer.length - throw ParseError('Invalid address buffer: ' + buf.toString('hex')) - } - - // ok, tuple seems good. - tuples.push([code, addr]) - } - - return tuples -} - -// Buffer -> String -function bufferToString (buf) { - const a = bufferToTuples(buf) - const b = tuplesToStringTuples(a) - return stringTuplesToString(b) -} - -// String -> Buffer -function stringToBuffer (str) { - str = cleanPath(str) - const a = stringToStringTuples(str) - const b = stringTuplesToTuples(a) - - return tuplesToBuffer(b) -} - -// String -> Buffer -function fromString (str) { - return stringToBuffer(str) -} - -// Buffer -> Buffer -function fromBuffer (buf) { - const err = validateBuffer(buf) - if (err) throw err - return new Buffer(buf) // copy -} - -function validateBuffer (buf) { - try { - bufferToTuples(buf) // try to parse. will throw if breaks - } catch (err) { - return err - } -} - -function isValidBuffer (buf) { - return validateBuffer(buf) === undefined -} - -function cleanPath (str) { - return '/' + filter(str.trim().split('/')).join('/') -} - -function ParseError (str) { - return new Error('Error parsing address: ' + str) -} - -function protoFromTuple (tup) { - const proto = protocols(tup[0]) - return proto -} - -}).call(this,require("buffer").Buffer) -},{"./convert":536,"./protocols-table":538,"buffer":144,"lodash.filter":547,"lodash.map":555,"varint":860}],536:[function(require,module,exports){ -(function (Buffer){ -'use strict' - -const ip = require('ip') -const protocols = require('./protocols-table') -const bs58 = require('bs58') -const varint = require('varint') - -module.exports = Convert - -// converts (serializes) addresses -function Convert (proto, a) { - if (a instanceof Buffer) { - return Convert.toString(proto, a) - } else { - return Convert.toBuffer(proto, a) - } -} - -Convert.toString = function convertToString (proto, buf) { - proto = protocols(proto) - switch (proto.code) { - case 4: // ipv4 - case 41: // ipv6 - return ip.toString(buf) - - case 6: // tcp - case 17: // udp - case 33: // dccp - case 132: // sctp - return buf2port(buf) + const conn = transport.dial(addr, (err) => { + if (err) { + return cb(err) + } - case 53: // dns - case 54: // dns4 - case 55: // dns6 - return buf2str(buf) + cb(null, conn) + }) + }, this.dialTimeout)(callback) + } - case 421: // ipfs - return buf2mh(buf) - default: - return buf.toString('hex') // no clue. convert to hex + /** + * Add new work to the queue. + * + * @param {SwarmTransport} transport + * @param {Multiaddr} addr + * @param {CancelToken} token + * @param {function(Error, Connection)} callback + * @returns {void} + */ + push (transport, addr, token, callback) { + this.queue.push({transport, addr, token}, callback) } } -Convert.toBuffer = function convertToBuffer (proto, str) { - proto = protocols(proto) - switch (proto.code) { - case 4: // ipv4 - case 41: // ipv6 - return ip.toBuffer(str) - - case 6: // tcp - case 17: // udp - case 33: // dccp - case 132: // sctp - return port2buf(parseInt(str, 10)) +module.exports = DialQueue - case 53: // dns - case 54: // dns4 - case 55: // dns6 - return str2buf(str) +},{"async/queue":67,"async/timeout":72,"debug":168,"interface-connection":289,"pull-stream":723}],534:[function(require,module,exports){ +'use strict' - case 421: // ipfs - return mh2buf(str) - default: - return new Buffer(str, 'hex') // no clue. convert from hex +module.exports = { + tag: '/plaintext/1.0.0', + encrypt (id, privKey, conn) { + return conn } } -function port2buf (port) { - const buf = new Buffer(2) - buf.writeUInt16BE(port, 0) - return buf -} +},{}],535:[function(require,module,exports){ +'use strict' -function buf2port (buf) { - return buf.readUInt16BE(0) -} +const multistream = require('multistream-select') -function str2buf (str) { - const buf = new Buffer(str) - const size = new Buffer(varint.encode(buf.length)) - return Buffer.concat([size, buf]) -} +module.exports = function protocolMuxer (protocols, conn) { + const ms = new multistream.Listener() -function buf2str (buf) { - const size = varint.decode(buf) - buf = buf.slice(varint.decode.bytes) + Object.keys(protocols).forEach((protocol) => { + if (!protocol) { + return + } - if (buf.length !== size) { - throw new Error('inconsistent lengths') - } + ms.addHandler(protocol, protocols[protocol].handlerFunc, protocols[protocol].matchFunc) + }) - return buf.toString() + ms.handle(conn, (err) => { + if (err) { + // the multistream handshake failed + } + }) } -function mh2buf (hash) { - // the address is a varint prefixed multihash string representation - const mh = new Buffer(bs58.decode(hash)) - const size = new Buffer(varint.encode(mh.length)) - return Buffer.concat([size, mh]) -} +},{"multistream-select":639}],536:[function(require,module,exports){ +'use strict' -function buf2mh (buf) { - const size = varint.decode(buf) - const address = buf.slice(varint.decode.bytes) +const parallel = require('async/parallel') +const once = require('once') +const debug = require('debug') +const log = debug('libp2p:swarm:transport') - if (address.length !== size) { - throw new Error('inconsistent lengths') - } +const protocolMuxer = require('./protocol-muxer') +const LimitDialer = require('./limit-dialer') - return bs58.encode(address) -} +// number of concurrent outbound dials to make per peer, same as go-libp2p-swarm +const defaultPerPeerRateLimit = 8 -}).call(this,require("buffer").Buffer) -},{"./protocols-table":538,"bs58":141,"buffer":144,"ip":294,"varint":860}],537:[function(require,module,exports){ -(function (Buffer){ -'use strict' +// the amount of time a single dial has to succeed +// TODO this should be exposed as a option +const dialTimeout = 30 * 1000 -const map = require('lodash.map') -const extend = require('xtend') -const codec = require('./codec') -const protocols = require('./protocols-table') -const varint = require('varint') -const bs58 = require('bs58') +module.exports = function (swarm) { + const dialer = new LimitDialer(defaultPerPeerRateLimit, dialTimeout) -const NotImplemented = new Error('Sorry, Not Implemented Yet.') + return { + add (key, transport, options, callback) { + if (typeof options === 'function') { + callback = options + options = {} + } -exports = module.exports = Multiaddr + callback = callback || noop -/** - * Creates a [multiaddr](https://github.com/multiformats/multiaddr) from - * a Buffer, String or another Multiaddr instance - * public key. - * @class Multiaddr - * @param {(String|Buffer|Multiaddr)} addr - If String or Buffer, needs to adhere - * to the address format of a [multiaddr](https://github.com/multiformats/multiaddr#string-format) - * @example - * Multiaddr('/ip4/127.0.0.1/tcp/4001') - * // - */ -function Multiaddr (addr) { - if (!(this instanceof Multiaddr)) { - return new Multiaddr(addr) - } + log('adding %s', key) + if (swarm.transports[key]) { + throw new Error('There is already a transport with this key') + } + swarm.transports[key] = transport + if (!swarm.transports[key].listeners) { + swarm.transports[key].listeners = [] + } - // default - addr = addr || '' + callback() + }, - if (addr instanceof Buffer) { - /** - * @type {Buffer} - The raw bytes representing this multiaddress - */ - this.buffer = codec.fromBuffer(addr) - } else if (typeof addr === 'string' || addr instanceof String) { - this.buffer = codec.fromString(addr) - } else if (addr.buffer && addr.protos && addr.protoCodes) { // Multiaddr - this.buffer = codec.fromBuffer(addr.buffer) // validate + copy buffer - } else { - throw new Error('addr must be a string, Buffer, or another Multiaddr') - } -} + dial (key, pi, callback) { + const t = swarm.transports[key] + let multiaddrs = pi.multiaddrs.toArray() -/** - * Returns Multiaddr as a String - * - * @returns {String} - * @example - * Multiaddr('/ip4/127.0.0.1/tcp/4001').toString() - * // '/ip4/127.0.0.1/tcp/4001' - */ -Multiaddr.prototype.toString = function toString () { - return codec.bufferToString(this.buffer) -} + if (!Array.isArray(multiaddrs)) { + multiaddrs = [multiaddrs] + } + log('dialing %s', key, multiaddrs.map((m) => m.toString())) + // filter the multiaddrs that are actually valid for this transport (use a func from the transport itself) (maybe even make the transport do that) + multiaddrs = dialables(t, multiaddrs) -/** - * Returns Multiaddr as a convinient options object to be used with net.createConnection - * - * @returns {{family: String, host: String, transport: String, port: String}} - * @example - * Multiaddr('/ip4/127.0.0.1/tcp/4001').toOptions() - * // { family: 'ipv4', host: '127.0.0.1', transport: 'tcp', port: '4001' } - */ -Multiaddr.prototype.toOptions = function toOptions () { - const opts = {} - const parsed = this.toString().split('/') - opts.family = parsed[1] === 'ip4' ? 'ipv4' : 'ipv6' - opts.host = parsed[2] - opts.transport = parsed[3] - opts.port = parsed[4] - return opts -} + dialer.dialMany(pi.id, t, multiaddrs, (err, success) => { + if (err) { + return callback(err) + } -/** - * Returns Multiaddr as a human-readable string - * - * @returns {String} - * @example - * Multiaddr('/ip4/127.0.0.1/tcp/4001').inspect() - * // '' - */ -Multiaddr.prototype.inspect = function inspect () { - return '' -} + pi.connect(success.multiaddr) + swarm._peerBook.put(pi) + callback(null, success.conn) + }) + }, -/** - * Returns the protocols the Multiaddr is defined with, as an array of objects, in - * left-to-right order. Each object contains the protocol code, protocol name, - * and the size of its address space in bits. - * [See list of protocols](https://github.com/multiformats/multiaddr/blob/master/protocols.csv) - * - * @returns {Array.} protocols - All the protocols the address is composed of - * @returns {Number} protocols[].code - * @returns {Number} protocols[].size - * @returns {String} protocols[].name - * @example - * Multiaddr('/ip4/127.0.0.1/tcp/4001').protos() - * // [ { code: 4, size: 32, name: 'ip4' }, - * // { code: 6, size: 16, name: 'tcp' } ] - */ -Multiaddr.prototype.protos = function protos () { - return map(this.protoCodes(), function (code) { - return extend(protocols(code)) - // copy to prevent users from modifying the internal objs. - }) -} + listen (key, options, handler, callback) { + // if no handler is passed, we pass conns to protocolMuxer + if (!handler) { + handler = protocolMuxer.bind(null, swarm.protocols) + } -/** - * Returns the codes of the protocols in left-to-right order. - * [See list of protocols](https://github.com/multiformats/multiaddr/blob/master/protocols.csv) - * - * @returns {Array.} protocol codes - * @example - * Multiaddr('/ip4/127.0.0.1/tcp/4001').protoCodes() - * // [ 4, 6 ] - */ -Multiaddr.prototype.protoCodes = function protoCodes () { - const codes = [] - const buf = this.buffer - let i = 0 - while (i < buf.length) { - const code = varint.decode(buf, i) - const n = varint.decode.bytes + const multiaddrs = dialables(swarm.transports[key], swarm._peerInfo.multiaddrs.distinct()) - const p = protocols(code) - const size = codec.sizeForAddr(p, buf.slice(i + n)) + const transport = swarm.transports[key] - i += (size + n) - codes.push(code) - } + if (!transport.listeners) { + transport.listeners = [] + } - return codes -} + let freshMultiaddrs = [] -/** - * Returns the names of the protocols in left-to-right order. - * [See list of protocols](https://github.com/multiformats/multiaddr/blob/master/protocols.csv) - * - * @return {Array.} protocol names - * @example - * Multiaddr('/ip4/127.0.0.1/tcp/4001').protoNames() - * // [ 'ip4', 'tcp' ] - */ -Multiaddr.prototype.protoNames = function protoNames () { - return map(this.protos(), function (proto) { - return proto.name - }) -} + const createListeners = multiaddrs.map((ma) => { + return (cb) => { + const done = once(cb) + const listener = transport.createListener(handler) + listener.once('error', done) -/** - * Returns a tuple of parts - * - * @return {Array.} tuples - * @return {Number} tuples[].0 code of protocol - * @return {Buffer} tuples[].1 contents of address - * @example - * Multiaddr("/ip4/127.0.0.1/tcp/4001").tuples() - * // [ [ 4, ], [ 6, ] ] - */ -Multiaddr.prototype.tuples = function tuples () { - return codec.bufferToTuples(this.buffer) -} + listener.listen(ma, (err) => { + if (err) { + return done(err) + } + listener.removeListener('error', done) + listener.getAddrs((err, addrs) => { + if (err) { + return done(err) + } + freshMultiaddrs = freshMultiaddrs.concat(addrs) + transport.listeners.push(listener) + done() + }) + }) + } + }) -/** - * Returns a tuple of string/number parts - * - * @return {Array.} tuples - * @return {Number} tuples[].0 code of protocol - * @return {(String|Number)} tuples[].1 contents of address - * @example - * Multiaddr("/ip4/127.0.0.1/tcp/4001").stringTuples() - * // [ [ 4, '127.0.0.1' ], [ 6, 4001 ] ] - */ -Multiaddr.prototype.stringTuples = function stringTuples () { - const t = codec.bufferToTuples(this.buffer) - return codec.tuplesToStringTuples(t) -} + parallel(createListeners, (err) => { + if (err) { + return callback(err) + } -/** - * Encapsulates a Multiaddr in another Multiaddr - * - * @param {Multiaddr} addr - Multiaddr to add into this Multiaddr - * @return {Multiaddr} - * @example - * const mh1 = Multiaddr('/ip4/8.8.8.8/tcp/1080') - * // - * - * const mh2 = Multiaddr('/ip4/127.0.0.1/tcp/4001') - * // - * - * const mh3 = mh1.encapsulate(mh2) - * // - * - * mh3.toString() - * // '/ip4/8.8.8.8/tcp/1080/ip4/127.0.0.1/tcp/4001' - */ -Multiaddr.prototype.encapsulate = function encapsulate (addr) { - addr = Multiaddr(addr) - return Multiaddr(this.toString() + addr.toString()) -} + // cause we can listen on port 0 or 0.0.0.0 + swarm._peerInfo.multiaddrs.replace(multiaddrs, freshMultiaddrs) + callback() + }) + }, -/** - * Decapsulates a Multiaddr from another Multiaddr - * - * @param {Multiaddr} addr - Multiaddr to remove from this Multiaddr - * @return {Multiaddr} - * @example - * const mh1 = Multiaddr('/ip4/8.8.8.8/tcp/1080') - * // - * - * const mh2 = Multiaddr('/ip4/127.0.0.1/tcp/4001') - * // - * - * const mh3 = mh1.encapsulate(mh2) - * // - * - * mh3.decapsulate(mh2).toString() - * // '/ip4/8.8.8.8/tcp/1080' - */ -Multiaddr.prototype.decapsulate = function decapsulate (addr) { - addr = addr.toString() - const s = this.toString() - const i = s.lastIndexOf(addr) - if (i < 0) { - throw new Error('Address ' + this + ' does not contain subaddress: ' + addr) - } - return Multiaddr(s.slice(0, i)) -} + close (key, callback) { + const transport = swarm.transports[key] -/** - * Extract the peerId if the multiaddr contains one - * - * @return {String|null} peerId - The id of the peer or null if invalid or missing from the ma - * @example - * const mh1 = Multiaddr('/ip4/8.8.8.8/tcp/1080/ipfs/QmValidBase58string') - * // - * - * // should return QmValidBase58string or null if the id is missing or invalid - * const peerId = mh1.getPeerId() - */ -Multiaddr.prototype.getPeerId = function getPeerId () { - let b58str = null - try { - b58str = this.stringTuples().filter((tuple) => { - if (tuple[0] === protocols.names['ipfs'].code) { - return true + if (!transport) { + return callback(new Error(`Trying to close non existing transport: ${key}`)) } - })[0][1] - bs58.decode(b58str) - } catch (e) { - b58str = null + parallel(transport.listeners.map((listener) => { + return (cb) => { + listener.close(cb) + } + }), callback) + } } - - return b58str -} - -/** - * Checks if two Multiaddrs are the same - * - * @param {Multiaddr} addr - * @return {Bool} - * @example - * const mh1 = Multiaddr('/ip4/8.8.8.8/tcp/1080') - * // - * - * const mh2 = Multiaddr('/ip4/127.0.0.1/tcp/4001') - * // - * - * mh1.equals(mh1) - * // true - * - * mh1.equals(mh2) - * // false - */ -Multiaddr.prototype.equals = function equals (addr) { - return this.buffer.equals(addr.buffer) } -/** - * Gets a Multiaddrs node-friendly address object. Note that protocol information - * is left out: in Node (and most network systems) the protocol is unknowable - * given only the address. - * - * Has to be a ThinWaist Address, otherwise throws error - * - * @returns {{family: String, address: String, port: String}} - * @throws {Error} Throws error if Multiaddr is not a Thin Waist address - * @example - * Multiaddr('/ip4/127.0.0.1/tcp/4001').nodeAddress() - * // {family: 'IPv4', address: '127.0.0.1', port: '4001'} - */ -Multiaddr.prototype.nodeAddress = function nodeAddress () { - if (!this.isThinWaistAddress()) { - throw new Error('Multiaddr must be "thin waist" address for nodeAddress.') - } - - const codes = this.protoCodes() - const parts = this.toString().split('/').slice(1) - return { - family: (codes[0] === 41) ? 'IPv6' : 'IPv4', - address: parts[1], // ip addr - port: parts[3] // tcp or udp port - } +function dialables (tp, multiaddrs) { + return tp.filter(multiaddrs) } -/** - * Creates a Multiaddr from a node-friendly address object - * - * @param {String} addr - * @param {String} transport - * @returns {Multiaddr} multiaddr - * @throws {Error} Throws error if addr is not truthy - * @throws {Error} Throws error if transport is not truthy - * @example - * Multiaddr.fromNodeAddress({address: '127.0.0.1', port: '4001'}, 'tcp') - * // - */ -Multiaddr.fromNodeAddress = function fromNodeAddress (addr, transport) { - if (!addr) throw new Error('requires node address object') - if (!transport) throw new Error('requires transport protocol') - const ip = (addr.family === 'IPv6') ? 'ip6' : 'ip4' - return Multiaddr('/' + [ip, addr.address, transport, addr.port].join('/')) -} +function noop () {} -// TODO find a better example, not sure about it's good enough -/** - * Returns if a Multiaddr is a Thin Waist address or not. - * - * Thin Waist is if a Multiaddr adheres to the standard combination of: - * - * `{IPv4, IPv6}/{TCP, UDP}` - * - * @param {Multiaddr} [addr] - Defaults to using `this` instance - * @returns {Boolean} isThinWaistAddress - * @example - * const mh1 = Multiaddr('/ip4/127.0.0.1/tcp/4001') - * // - * const mh2 = Multiaddr('/ip4/192.168.2.1/tcp/5001') - * // - * const mh3 = mh1.encapsulate(mh2) - * // - * mh1.isThinWaistAddress() - * // true - * mh2.isThinWaistAddress() - * // true - * mh3.isThinWaistAddress() - * // false - */ -Multiaddr.prototype.isThinWaistAddress = function isThinWaistAddress (addr) { - const protos = (addr || this).protos() +},{"./limit-dialer":532,"./protocol-muxer":535,"async/parallel":66,"debug":168,"once":658}],537:[function(require,module,exports){ +'use strict' - if (protos.length !== 2) { - return false - } +const debug = require('debug') +const log = debug('libp2p:webrtc-star') +const multiaddr = require('multiaddr') +const mafmt = require('mafmt') +const io = require('socket.io-client') +const EE = require('events').EventEmitter +const SimplePeer = require('simple-peer') +const PeerId = require('peer-id') +const PeerInfo = require('peer-info') +const Connection = require('interface-connection').Connection +const toPull = require('stream-to-pull-stream') +const once = require('once') +const setImmediate = require('async/setImmediate') +const webrtcSupport = require('webrtcsupport') +const utils = require('./utils') +const cleanUrlSIO = utils.cleanUrlSIO +const cleanMultiaddr = utils.cleanMultiaddr - if (protos[0].code !== 4 && protos[0].code !== 41) { - return false - } - if (protos[1].code !== 6 && protos[1].code !== 17) { - return false - } - return true -} +const noop = once(() => {}) -// TODO rename this to something else than "stupid string" -/** - * Converts a "stupid string" into a Multiaddr. - * - * Stupid string format: - * ``` - * ://[:] - * udp4://1.2.3.4:5678 - * ``` - * - * @param {String} [str] - String in the "stupid" format - * @throws {NotImplemented} - * @returns {undefined} - * @todo Not Implemented yet - */ -Multiaddr.prototype.fromStupidString = function fromStupidString (str) { - throw NotImplemented +const sioOptions = { + transports: ['websocket'], + 'force new connection': true } -/** - * Object containing table, names and codes of all supported protocols. - * To get the protocol values from a Multiaddr, you can use - * [`.protos()`](#multiaddrprotos), - * [`.protoCodes()`](#multiaddrprotocodes) or - * [`.protoNames()`](#multiaddrprotonames) - * - * @instance - * @returns {{table: Array, names: Object, codes: Object}} - * - */ -Multiaddr.protocols = protocols +class WebRTCStar { + constructor (options) { + options = options || {} -/** - * Returns if something is a Multiaddr or not - * - * @param {Multiaddr} addr - * @return {Bool} isMultiaddr - * @example - * Multiaddr.isMultiaddr(Multiaddr('/ip4/127.0.0.1/tcp/4001')) - * // true - * Multiaddr.isMultiaddr('/ip4/127.0.0.1/tcp/4001') - * // false - */ -Multiaddr.isMultiaddr = function isMultiaddr (addr) { - if (addr.constructor && addr.constructor.name) { - return addr.constructor.name === 'Multiaddr' - } + this.maSelf = undefined - return Boolean( - addr.fromStupidString && - addr.protos - ) -} + this.sioOptions = { + transports: ['websocket'], + 'force new connection': true + } -/** - * Returns if something is a Multiaddr that is a name - * - * @param {Multiaddr} addr - * @return {Bool} isName - */ -Multiaddr.isName = function isName (addr) { - if (!Multiaddr.isMultiaddr(addr)) { - return false - } + if (options.wrtc) { + this.wrtc = options.wrtc + } - // if a part of the multiaddr is resolvable, then return true - return addr.protos().some((proto) => proto.resolvable) -} + this.discovery = new EE() + this.discovery.start = (callback) => { setImmediate(callback) } + this.discovery.stop = (callback) => { setImmediate(callback) } -/** - * Returns an array of multiaddrs, by resolving the multiaddr that is a name - * - * @param {Multiaddr} addr - * - * @param {Function} callback - * @return {Bool} isName - */ -Multiaddr.resolve = function resolve (addr, callback) { - if (!Multiaddr.isMultiaddr(addr) || !Multiaddr.isName(addr)) { - return callback(new Error('not a valid name')) + this.listenersRefs = {} + this._peerDiscovered = this._peerDiscovered.bind(this) } - /* - * Needs more consideration from spec design: - * - what to return - * - how to achieve it in the browser? - */ - return callback(new Error('not implemented yet')) -} - -}).call(this,require("buffer").Buffer) -},{"./codec":535,"./protocols-table":538,"bs58":141,"buffer":144,"lodash.map":555,"varint":860,"xtend":865}],538:[function(require,module,exports){ -'use strict' - -const map = require('lodash.map') - -function Protocols (proto) { - if (typeof (proto) === 'number') { - if (Protocols.codes[proto]) { - return Protocols.codes[proto] + dial (ma, options, callback) { + if (typeof options === 'function') { + callback = options + options = {} } - throw new Error('no protocol with code: ' + proto) - } else if (typeof (proto) === 'string' || proto instanceof String) { - if (Protocols.names[proto]) { - return Protocols.names[proto] - } + callback = callback ? once(callback) : noop - throw new Error('no protocol with name: ' + proto) - } + const intentId = (~~(Math.random() * 1e9)).toString(36) + Date.now() - throw new Error('invalid protocol id type: ' + proto) -} + const sioClient = this + .listenersRefs[Object.keys(this.listenersRefs)[0]].io -const V = -1 -Protocols.lengthPrefixedVarSize = V -Protocols.V = V + const spOptions = { initiator: true, trickle: false } -Protocols.table = [ - [4, 32, 'ip4'], - [6, 16, 'tcp'], - [17, 16, 'udp'], - [33, 16, 'dccp'], - [41, 128, 'ip6'], - [53, V, 'dns', 'resolvable'], - [54, V, 'dns4', 'resolvable'], - [55, V, 'dns6', 'resolvable'], - [132, 16, 'sctp'], - // all of the below use varint for size - [302, 0, 'utp'], - [421, Protocols.lengthPrefixedVarSize, 'ipfs'], - [480, 0, 'http'], - [443, 0, 'https'], - [477, 0, 'ws'], - [478, 0, 'wss'], - [275, 0, 'libp2p-webrtc-star'], - [276, 0, 'libp2p-webrtc-direct'], - [290, 0, 'p2p-circuit'] -] + // Use custom WebRTC implementation + if (this.wrtc) { spOptions.wrtc = this.wrtc } -Protocols.names = {} -Protocols.codes = {} + const channel = new SimplePeer(spOptions) -// populate tables -map(Protocols.table, function (row) { - const proto = p.apply(null, row) - Protocols.codes[proto.code] = proto - Protocols.names[proto.name] = proto -}) + const conn = new Connection(toPull.duplex(channel)) + let connected = false -Protocols.object = p + channel.on('signal', (signal) => { + sioClient.emit('ss-handshake', { + intentId: intentId, + srcMultiaddr: this.maSelf.toString(), + dstMultiaddr: ma.toString(), + signal: signal + }) + }) -function p (code, size, name, resolvable) { - return { - code: code, - size: size, - name: name, - resolvable: Boolean(resolvable) - } -} + channel.once('timeout', () => callback(new Error('timeout'))) -module.exports = Protocols + channel.once('error', (err) => { + if (!connected) { callback(err) } + }) -},{"lodash.map":555}],539:[function(require,module,exports){ -'use strict' + // NOTE: aegir segfaults if we do .once on the socket.io event emitter and we + // are clueless as to why. + sioClient.on('ws-handshake', (offer) => { + if (offer.intentId === intentId && offer.err) { + return callback(new Error(offer.err)) + } -const connect = require('pull-ws/client') -const mafmt = require('mafmt') -const includes = require('lodash.includes') -const Connection = require('interface-connection').Connection + if (offer.intentId !== intentId || !offer.answer) { + return + } -const maToUrl = require('./ma-to-url') -const debug = require('debug') -const log = debug('libp2p:websockets:dialer') + channel.once('connect', () => { + connected = true + conn.destroy = channel.destroy.bind(channel) -const createListener = require('./listener') + channel.once('close', () => conn.destroy()) -class WebSockets { - dial (ma, options, callback) { - if (typeof options === 'function') { - callback = options - options = {} - } + conn.getObservedAddrs = (callback) => callback(null, [ma]) - callback = callback || function () {} + callback(null, conn) + }) - const url = maToUrl(ma) - log('dialing %s', url) - const socket = connect(url, { - binary: true, - onConnect: (err) => callback(err) + channel.signal(offer.signal) }) - const conn = new Connection(socket) - conn.getObservedAddrs = (callback) => callback(null, [ma]) - conn.close = (callback) => socket.close(callback) - return conn } @@ -74155,104 +74330,163 @@ class WebSockets { options = {} } - return createListener(options, handler) - } + const listener = new EE() - filter (multiaddrs) { - if (!Array.isArray(multiaddrs)) { - multiaddrs = [multiaddrs] - } + listener.listen = (ma, callback) => { + callback = callback ? once(callback) : noop - return multiaddrs.filter((ma) => { - if (includes(ma.protoNames(), 'ipfs')) { - ma = ma.decapsulate('ipfs') + if (!webrtcSupport.support && !this.wrtc) { + return setImmediate(() => callback(new Error('no WebRTC support'))) } - return mafmt.WebSockets.matches(ma) || mafmt.WebSocketsSecure.matches(ma) - }) - } -} -module.exports = WebSockets + this.maSelf = ma -},{"./listener":540,"./ma-to-url":541,"debug":168,"interface-connection":289,"lodash.includes":552,"mafmt":534,"pull-ws/client":761}],540:[function(require,module,exports){ -'use strict' + const sioUrl = cleanUrlSIO(ma) -const Connection = require('interface-connection').Connection -const includes = require('lodash.includes') -function noop () {} -const createServer = require('pull-ws/server') || noop + log('Dialing to Signalling Server on: ' + sioUrl) -module.exports = (options, handler) => { - const listener = createServer((socket) => { - socket.getObservedAddrs = (callback) => { - // TODO research if we can reuse the address in anyway - return callback(null, []) + listener.io = io.connect(sioUrl, sioOptions) + + listener.io.once('connect_error', callback) + listener.io.once('error', (err) => { + listener.emit('error', err) + listener.emit('close') + }) + + listener.io.on('ws-handshake', incommingDial) + listener.io.on('ws-peer', this._peerDiscovered) + + listener.io.on('connect', () => { + listener.io.emit('ss-join', ma.toString()) + }) + + listener.io.once('connect', () => { + listener.emit('listening') + callback() + }) + + const self = this + function incommingDial (offer) { + if (offer.answer || offer.err) { + return + } + + const spOptions = { trickle: false } + + // Use custom WebRTC implementation + if (self.wrtc) { spOptions.wrtc = self.wrtc } + + const channel = new SimplePeer(spOptions) + + const conn = new Connection(toPull.duplex(channel)) + + channel.once('connect', () => { + conn.getObservedAddrs = (callback) => { + return callback(null, [offer.srcMultiaddr]) + } + + listener.emit('connection', conn) + handler(conn) + }) + + channel.once('signal', (signal) => { + offer.signal = signal + offer.answer = true + listener.io.emit('ss-handshake', offer) + }) + + channel.signal(offer.signal) + } } - handler(new Connection(socket)) - }) + listener.close = (callback) => { + callback = callback ? once(callback) : noop - let listeningMultiaddr + listener.io.emit('ss-leave') - listener._listen = listener.listen - listener.listen = (ma, callback) => { - callback = callback || noop - listeningMultiaddr = ma + setImmediate(() => { + listener.emit('close') + callback() + }) + } - if (includes(ma.protoNames(), 'ipfs')) { - ma = ma.decapsulate('ipfs') + listener.getAddrs = (callback) => { + setImmediate(() => callback(null, [this.maSelf])) } - listener._listen(ma.toOptions(), callback) + this.listenersRefs[multiaddr.toString()] = listener + return listener } - listener.getAddrs = (callback) => { - callback(null, [listeningMultiaddr]) + filter (multiaddrs) { + if (!Array.isArray(multiaddrs)) { + multiaddrs = [multiaddrs] + } + return multiaddrs.filter((ma) => mafmt.WebRTCStar.matches(ma)) } - return listener + _peerDiscovered (maStr) { + log('Peer Discovered:', maStr) + maStr = cleanMultiaddr(maStr) + + const split = maStr.split('/ipfs/') + const peerIdStr = split[split.length - 1] + const peerId = PeerId.createFromB58String(peerIdStr) + const peerInfo = new PeerInfo(peerId) + peerInfo.multiaddrs.add(multiaddr(maStr)) + this.discovery.emit('peer', peerInfo) + } } -},{"interface-connection":289,"lodash.includes":552,"pull-ws/server":98}],541:[function(require,module,exports){ +module.exports = WebRTCStar + +},{"./utils":538,"async/setImmediate":70,"debug":168,"events":236,"interface-connection":289,"mafmt":599,"multiaddr":609,"once":658,"peer-id":674,"peer-info":675,"simple-peer":811,"socket.io-client":815,"stream-to-pull-stream":836,"webrtcsupport":860}],538:[function(require,module,exports){ 'use strict' -const debug = require('debug') -const log = debug('libp2p:websockets:dialer') +const multiaddr = require('multiaddr') -function maToUrl (ma) { +function cleanUrlSIO (ma) { const maStrSplit = ma.toString().split('/') - let proto - try { - proto = ma.protoNames().filter((proto) => { - return proto === 'ws' || proto === 'wss' - })[0] - } catch (e) { - log(e) - throw new Error('Not a valid websocket address', e) - } + if (!multiaddr.isName(ma)) { + return 'http://' + maStrSplit[2] + ':' + maStrSplit[4] + } else { + const wsProto = ma.protos()[1].name - let port - try { - port = ma.stringTuples().filter((tuple) => { - if (tuple[0] === ma.protos().filter((proto) => { - return proto.name === 'tcp' - })[0].code) { - return true - } - })[0][1] - } catch (e) { - log('No port, skipping') + if (wsProto === 'ws') { + return 'http://' + maStrSplit[2] + } else if (wsProto === 'wss') { + return 'https://' + maStrSplit[2] + } else { + throw new Error('invalid multiaddr' + ma.toString()) + } } +} - let url = `${proto}://${maStrSplit[2]}${(port && (port !== 80 || port !== 443) ? `:${port}` : '')}` +function cleanMultiaddr (maStr) { + const legacy = '/libp2p-webrtc-star' - return url + if (maStr.indexOf(legacy) !== -1) { + maStr = maStr.substring(legacy.length, maStr.length) + let ma = multiaddr(maStr) + const tuppleIPFS = ma.stringTuples().filter((tupple) => { + return tupple[0] === 421 // ipfs code + })[0] + + ma = ma.decapsulate('ipfs') + ma = ma.encapsulate('p2p-webrtc-star') + ma = ma.encapsulate(`/ipfs/${tuppleIPFS[1]}`) + maStr = ma.toString() + } + + return maStr } -module.exports = maToUrl +exports = module.exports +exports.cleanUrlSIO = cleanUrlSIO +exports.cleanMultiaddr = cleanMultiaddr -},{"debug":168}],542:[function(require,module,exports){ +},{"multiaddr":609}],539:[function(require,module,exports){ 'use strict' const EventEmitter = require('events').EventEmitter @@ -74580,7 +74814,7 @@ class Node extends EventEmitter { module.exports = Node -},{"assert":33,"async/each":37,"async/series":69,"async/setImmediate":70,"events":236,"libp2p-ping":509,"libp2p-swarm":526,"mafmt":602,"multiaddr":612,"peer-book":676,"peer-id":677,"peer-info":678}],543:[function(require,module,exports){ +},{"assert":33,"async/each":37,"async/series":69,"async/setImmediate":70,"events":236,"libp2p-ping":514,"libp2p-swarm":531,"mafmt":599,"multiaddr":609,"peer-book":673,"peer-id":674,"peer-info":675}],540:[function(require,module,exports){ (function (process){ (function (root, factory) { if (typeof process === "object" && typeof process.stdout === "undefined") { @@ -79208,7 +79442,7 @@ module.exports = Node }))); }).call(this,require('_process')) -},{"_process":682,"libsodium":544}],544:[function(require,module,exports){ +},{"_process":679,"libsodium":541}],541:[function(require,module,exports){ (function (process){ (function (root, factory) { if (typeof define === "function" && define.amd) { @@ -79242,7 +79476,7 @@ return{_sodium_library_version_minor:Re,_sodium_hex2bin:Na,_crypto_pwhash_passwd })); }).call(this,require('_process')) -},{"_process":682,"crypto":158,"fs":140,"path":670}],545:[function(require,module,exports){ +},{"_process":679,"crypto":158,"fs":140,"path":667}],542:[function(require,module,exports){ (function (global){ /** * lodash (Custom Build) @@ -80994,7 +81228,7 @@ function stubFalse() { module.exports = cloneDeep; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],546:[function(require,module,exports){ +},{}],543:[function(require,module,exports){ (function (global){ /** * lodash (Custom Build) @@ -81375,7 +81609,7 @@ function toNumber(value) { module.exports = debounce; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],547:[function(require,module,exports){ +},{}],544:[function(require,module,exports){ (function (global){ /** * lodash (Custom Build) @@ -83745,7 +83979,7 @@ function property(path) { module.exports = filter; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],548:[function(require,module,exports){ +},{}],545:[function(require,module,exports){ (function (global){ /** * lodash (Custom Build) @@ -86202,7 +86436,7 @@ function property(path) { module.exports = find; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],549:[function(require,module,exports){ +},{}],546:[function(require,module,exports){ (function (global){ /** * lodash (Custom Build) @@ -87137,7 +87371,7 @@ function get(object, path, defaultValue) { module.exports = get; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],550:[function(require,module,exports){ +},{}],547:[function(require,module,exports){ (function (global){ /** * lodash (Custom Build) @@ -89510,7 +89744,7 @@ function property(path) { module.exports = groupBy; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],551:[function(require,module,exports){ +},{}],548:[function(require,module,exports){ (function (global){ /** * lodash (Custom Build) @@ -90603,7 +90837,7 @@ function has(object, path) { module.exports = has; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],552:[function(require,module,exports){ +},{}],549:[function(require,module,exports){ /** * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` @@ -91350,7 +91584,7 @@ function values(object) { module.exports = includes; -},{}],553:[function(require,module,exports){ +},{}],550:[function(require,module,exports){ (function (global){ /** * lodash (Custom Build) @@ -93009,7 +93243,7 @@ function keys(object) { module.exports = isEqualWith; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],554:[function(require,module,exports){ +},{}],551:[function(require,module,exports){ /** * lodash 3.0.8 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` @@ -93086,7 +93320,7 @@ function isObject(value) { module.exports = isFunction; -},{}],555:[function(require,module,exports){ +},{}],552:[function(require,module,exports){ (function (global){ /** * lodash (Custom Build) @@ -95456,7 +95690,7 @@ function property(path) { module.exports = map; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],556:[function(require,module,exports){ +},{}],553:[function(require,module,exports){ /** * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` @@ -95673,7 +95907,7 @@ function pullAllWith(array, values, comparator) { module.exports = pullAllWith; -},{}],557:[function(require,module,exports){ +},{}],554:[function(require,module,exports){ (function (global){ /** * lodash (Custom Build) @@ -97072,7 +97306,7 @@ function get(object, path, defaultValue) { module.exports = pullAt; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],558:[function(require,module,exports){ +},{}],555:[function(require,module,exports){ (function (global){ /** * lodash (Custom Build) @@ -98066,7 +98300,7 @@ function set(object, path, value) { module.exports = set; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],559:[function(require,module,exports){ +},{}],556:[function(require,module,exports){ (function (global){ /** * lodash (Custom Build) @@ -100700,7 +100934,7 @@ function property(path) { module.exports = sortBy; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],560:[function(require,module,exports){ +},{}],557:[function(require,module,exports){ (function (global){ /** * lodash (Custom Build) @@ -101143,7 +101377,7 @@ function toNumber(value) { module.exports = throttle; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],561:[function(require,module,exports){ +},{}],558:[function(require,module,exports){ (function (global){ /** * lodash (Custom Build) @@ -103561,7 +103795,7 @@ function property(path) { module.exports = uniqBy; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],562:[function(require,module,exports){ +},{}],559:[function(require,module,exports){ (function (global){ /** * lodash (Custom Build) @@ -104463,7 +104697,7 @@ function noop() { module.exports = uniqWith; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],563:[function(require,module,exports){ +},{}],560:[function(require,module,exports){ /** * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` @@ -104932,7 +105166,7 @@ function values(object) { module.exports = values; -},{}],564:[function(require,module,exports){ +},{}],561:[function(require,module,exports){ var root = require('./_root'); /** Built-in value references. */ @@ -104940,7 +105174,7 @@ var Symbol = root.Symbol; module.exports = Symbol; -},{"./_root":585}],565:[function(require,module,exports){ +},{"./_root":582}],562:[function(require,module,exports){ var baseTimes = require('./_baseTimes'), isArguments = require('./isArguments'), isArray = require('./isArray'), @@ -104991,7 +105225,7 @@ function arrayLikeKeys(value, inherited) { module.exports = arrayLikeKeys; -},{"./_baseTimes":575,"./_isIndex":579,"./isArguments":588,"./isArray":589,"./isBuffer":591,"./isTypedArray":596}],566:[function(require,module,exports){ +},{"./_baseTimes":572,"./_isIndex":576,"./isArguments":585,"./isArray":586,"./isBuffer":588,"./isTypedArray":593}],563:[function(require,module,exports){ /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. @@ -105014,7 +105248,7 @@ function arrayMap(array, iteratee) { module.exports = arrayMap; -},{}],567:[function(require,module,exports){ +},{}],564:[function(require,module,exports){ /** * The base implementation of `_.findIndex` and `_.findLastIndex` without * support for iteratee shorthands. @@ -105040,7 +105274,7 @@ function baseFindIndex(array, predicate, fromIndex, fromRight) { module.exports = baseFindIndex; -},{}],568:[function(require,module,exports){ +},{}],565:[function(require,module,exports){ var Symbol = require('./_Symbol'), getRawTag = require('./_getRawTag'), objectToString = require('./_objectToString'); @@ -105070,7 +105304,7 @@ function baseGetTag(value) { module.exports = baseGetTag; -},{"./_Symbol":564,"./_getRawTag":578,"./_objectToString":583}],569:[function(require,module,exports){ +},{"./_Symbol":561,"./_getRawTag":575,"./_objectToString":580}],566:[function(require,module,exports){ var baseFindIndex = require('./_baseFindIndex'), baseIsNaN = require('./_baseIsNaN'), strictIndexOf = require('./_strictIndexOf'); @@ -105092,7 +105326,7 @@ function baseIndexOf(array, value, fromIndex) { module.exports = baseIndexOf; -},{"./_baseFindIndex":567,"./_baseIsNaN":571,"./_strictIndexOf":586}],570:[function(require,module,exports){ +},{"./_baseFindIndex":564,"./_baseIsNaN":568,"./_strictIndexOf":583}],567:[function(require,module,exports){ var baseGetTag = require('./_baseGetTag'), isObjectLike = require('./isObjectLike'); @@ -105112,7 +105346,7 @@ function baseIsArguments(value) { module.exports = baseIsArguments; -},{"./_baseGetTag":568,"./isObjectLike":595}],571:[function(require,module,exports){ +},{"./_baseGetTag":565,"./isObjectLike":592}],568:[function(require,module,exports){ /** * The base implementation of `_.isNaN` without support for number objects. * @@ -105126,7 +105360,7 @@ function baseIsNaN(value) { module.exports = baseIsNaN; -},{}],572:[function(require,module,exports){ +},{}],569:[function(require,module,exports){ var baseGetTag = require('./_baseGetTag'), isLength = require('./isLength'), isObjectLike = require('./isObjectLike'); @@ -105188,7 +105422,7 @@ function baseIsTypedArray(value) { module.exports = baseIsTypedArray; -},{"./_baseGetTag":568,"./isLength":593,"./isObjectLike":595}],573:[function(require,module,exports){ +},{"./_baseGetTag":565,"./isLength":590,"./isObjectLike":592}],570:[function(require,module,exports){ var isPrototype = require('./_isPrototype'), nativeKeys = require('./_nativeKeys'); @@ -105220,7 +105454,7 @@ function baseKeys(object) { module.exports = baseKeys; -},{"./_isPrototype":580,"./_nativeKeys":581}],574:[function(require,module,exports){ +},{"./_isPrototype":577,"./_nativeKeys":578}],571:[function(require,module,exports){ /** * The base implementation of `_.property` without support for deep paths. * @@ -105236,7 +105470,7 @@ function baseProperty(key) { module.exports = baseProperty; -},{}],575:[function(require,module,exports){ +},{}],572:[function(require,module,exports){ /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. @@ -105258,7 +105492,7 @@ function baseTimes(n, iteratee) { module.exports = baseTimes; -},{}],576:[function(require,module,exports){ +},{}],573:[function(require,module,exports){ /** * The base implementation of `_.unary` without support for storing metadata. * @@ -105274,7 +105508,7 @@ function baseUnary(func) { module.exports = baseUnary; -},{}],577:[function(require,module,exports){ +},{}],574:[function(require,module,exports){ (function (global){ /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; @@ -105282,7 +105516,7 @@ var freeGlobal = typeof global == 'object' && global && global.Object === Object module.exports = freeGlobal; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],578:[function(require,module,exports){ +},{}],575:[function(require,module,exports){ var Symbol = require('./_Symbol'); /** Used for built-in method references. */ @@ -105330,7 +105564,7 @@ function getRawTag(value) { module.exports = getRawTag; -},{"./_Symbol":564}],579:[function(require,module,exports){ +},{"./_Symbol":561}],576:[function(require,module,exports){ /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -105354,7 +105588,7 @@ function isIndex(value, length) { module.exports = isIndex; -},{}],580:[function(require,module,exports){ +},{}],577:[function(require,module,exports){ /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -105374,7 +105608,7 @@ function isPrototype(value) { module.exports = isPrototype; -},{}],581:[function(require,module,exports){ +},{}],578:[function(require,module,exports){ var overArg = require('./_overArg'); /* Built-in method references for those with the same name as other `lodash` methods. */ @@ -105382,7 +105616,7 @@ var nativeKeys = overArg(Object.keys, Object); module.exports = nativeKeys; -},{"./_overArg":584}],582:[function(require,module,exports){ +},{"./_overArg":581}],579:[function(require,module,exports){ var freeGlobal = require('./_freeGlobal'); /** Detect free variable `exports`. */ @@ -105406,7 +105640,7 @@ var nodeUtil = (function() { module.exports = nodeUtil; -},{"./_freeGlobal":577}],583:[function(require,module,exports){ +},{"./_freeGlobal":574}],580:[function(require,module,exports){ /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -105430,7 +105664,7 @@ function objectToString(value) { module.exports = objectToString; -},{}],584:[function(require,module,exports){ +},{}],581:[function(require,module,exports){ /** * Creates a unary function that invokes `func` with its argument transformed. * @@ -105447,7 +105681,7 @@ function overArg(func, transform) { module.exports = overArg; -},{}],585:[function(require,module,exports){ +},{}],582:[function(require,module,exports){ var freeGlobal = require('./_freeGlobal'); /** Detect free variable `self`. */ @@ -105458,7 +105692,7 @@ var root = freeGlobal || freeSelf || Function('return this')(); module.exports = root; -},{"./_freeGlobal":577}],586:[function(require,module,exports){ +},{"./_freeGlobal":574}],583:[function(require,module,exports){ /** * A specialized version of `_.indexOf` which performs strict equality * comparisons of values, i.e. `===`. @@ -105483,7 +105717,7 @@ function strictIndexOf(array, value, fromIndex) { module.exports = strictIndexOf; -},{}],587:[function(require,module,exports){ +},{}],584:[function(require,module,exports){ /** * This method returns the first argument it receives. * @@ -105506,7 +105740,7 @@ function identity(value) { module.exports = identity; -},{}],588:[function(require,module,exports){ +},{}],585:[function(require,module,exports){ var baseIsArguments = require('./_baseIsArguments'), isObjectLike = require('./isObjectLike'); @@ -105544,7 +105778,7 @@ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsAr module.exports = isArguments; -},{"./_baseIsArguments":570,"./isObjectLike":595}],589:[function(require,module,exports){ +},{"./_baseIsArguments":567,"./isObjectLike":592}],586:[function(require,module,exports){ /** * Checks if `value` is classified as an `Array` object. * @@ -105572,7 +105806,7 @@ var isArray = Array.isArray; module.exports = isArray; -},{}],590:[function(require,module,exports){ +},{}],587:[function(require,module,exports){ var isFunction = require('./isFunction'), isLength = require('./isLength'); @@ -105607,7 +105841,7 @@ function isArrayLike(value) { module.exports = isArrayLike; -},{"./isFunction":592,"./isLength":593}],591:[function(require,module,exports){ +},{"./isFunction":589,"./isLength":590}],588:[function(require,module,exports){ var root = require('./_root'), stubFalse = require('./stubFalse'); @@ -105647,7 +105881,7 @@ var isBuffer = nativeIsBuffer || stubFalse; module.exports = isBuffer; -},{"./_root":585,"./stubFalse":599}],592:[function(require,module,exports){ +},{"./_root":582,"./stubFalse":596}],589:[function(require,module,exports){ var baseGetTag = require('./_baseGetTag'), isObject = require('./isObject'); @@ -105686,7 +105920,7 @@ function isFunction(value) { module.exports = isFunction; -},{"./_baseGetTag":568,"./isObject":594}],593:[function(require,module,exports){ +},{"./_baseGetTag":565,"./isObject":591}],590:[function(require,module,exports){ /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -105723,7 +105957,7 @@ function isLength(value) { module.exports = isLength; -},{}],594:[function(require,module,exports){ +},{}],591:[function(require,module,exports){ /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) @@ -105756,7 +105990,7 @@ function isObject(value) { module.exports = isObject; -},{}],595:[function(require,module,exports){ +},{}],592:[function(require,module,exports){ /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". @@ -105787,7 +106021,7 @@ function isObjectLike(value) { module.exports = isObjectLike; -},{}],596:[function(require,module,exports){ +},{}],593:[function(require,module,exports){ var baseIsTypedArray = require('./_baseIsTypedArray'), baseUnary = require('./_baseUnary'), nodeUtil = require('./_nodeUtil'); @@ -105816,7 +106050,7 @@ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedA module.exports = isTypedArray; -},{"./_baseIsTypedArray":572,"./_baseUnary":576,"./_nodeUtil":582}],597:[function(require,module,exports){ +},{"./_baseIsTypedArray":569,"./_baseUnary":573,"./_nodeUtil":579}],594:[function(require,module,exports){ var arrayLikeKeys = require('./_arrayLikeKeys'), baseKeys = require('./_baseKeys'), isArrayLike = require('./isArrayLike'); @@ -105855,7 +106089,7 @@ function keys(object) { module.exports = keys; -},{"./_arrayLikeKeys":565,"./_baseKeys":573,"./isArrayLike":590}],598:[function(require,module,exports){ +},{"./_arrayLikeKeys":562,"./_baseKeys":570,"./isArrayLike":587}],595:[function(require,module,exports){ /** * This method returns `undefined`. * @@ -105874,7 +106108,7 @@ function noop() { module.exports = noop; -},{}],599:[function(require,module,exports){ +},{}],596:[function(require,module,exports){ /** * This method returns `false`. * @@ -105894,7 +106128,7 @@ function stubFalse() { module.exports = stubFalse; -},{}],600:[function(require,module,exports){ +},{}],597:[function(require,module,exports){ var looper = module.exports = function (fun) { (function next () { @@ -105910,7 +106144,7 @@ var looper = module.exports = function (fun) { })() } -},{}],601:[function(require,module,exports){ +},{}],598:[function(require,module,exports){ (function (Buffer){ exports.compare = function (a, b) { @@ -106083,7 +106317,7 @@ exports.filter = function (range, compare) { }).call(this,{"isBuffer":require("../is-buffer/index.js")}) -},{"../is-buffer/index.js":433}],602:[function(require,module,exports){ +},{"../is-buffer/index.js":438}],599:[function(require,module,exports){ 'use strict' const multiaddr = require('multiaddr') @@ -106310,7 +106544,7 @@ function base (n) { } } -},{"multiaddr":612}],603:[function(require,module,exports){ +},{"multiaddr":609}],600:[function(require,module,exports){ (function (Buffer){ 'use strict' var inherits = require('inherits') @@ -106459,7 +106693,7 @@ function fnI (a, b, c, d, m, k, s) { module.exports = MD5 }).call(this,require("buffer").Buffer) -},{"buffer":144,"hash-base":604,"inherits":287}],604:[function(require,module,exports){ +},{"buffer":144,"hash-base":601,"inherits":287}],601:[function(require,module,exports){ 'use strict' var Buffer = require('safe-buffer').Buffer var Transform = require('stream').Transform @@ -106556,7 +106790,7 @@ HashBase.prototype._digest = function () { module.exports = HashBase -},{"inherits":287,"safe-buffer":790,"stream":833}],605:[function(require,module,exports){ +},{"inherits":287,"safe-buffer":787,"stream":830}],602:[function(require,module,exports){ (function (Buffer){ const rlp = require('rlp') const ethUtil = require('ethereumjs-util') @@ -106815,7 +107049,7 @@ function isRawNode (node) { } }).call(this,require("buffer").Buffer) -},{"buffer":144,"ethereumjs-util":234,"rlp":789}],606:[function(require,module,exports){ +},{"buffer":144,"ethereumjs-util":234,"rlp":786}],603:[function(require,module,exports){ var bn = require('bn.js'); var brorand = require('brorand'); @@ -106930,7 +107164,7 @@ MillerRabin.prototype.getDivisor = function getDivisor(n, k) { return false; }; -},{"bn.js":87,"brorand":97}],607:[function(require,module,exports){ +},{"bn.js":87,"brorand":97}],604:[function(require,module,exports){ module.exports = assert; function assert(val, msg) { @@ -106943,7 +107177,7 @@ assert.equal = function assertEqual(l, r, msg) { throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r)); }; -},{}],608:[function(require,module,exports){ +},{}],605:[function(require,module,exports){ 'use strict'; var utils = exports; @@ -107003,7 +107237,7 @@ utils.encode = function encode(arr, enc) { return arr; }; -},{}],609:[function(require,module,exports){ +},{}],606:[function(require,module,exports){ /** * Helpers. */ @@ -107157,13 +107391,801 @@ function plural(ms, n, name) { return Math.ceil(ms / n) + ' ' + name + 's'; } -},{}],610:[function(require,module,exports){ -arguments[4][535][0].apply(exports,arguments) -},{"./convert":611,"./protocols-table":613,"buffer":144,"dup":535,"lodash.filter":547,"lodash.map":555,"varint":860}],611:[function(require,module,exports){ -arguments[4][536][0].apply(exports,arguments) -},{"./protocols-table":613,"bs58":141,"buffer":144,"dup":536,"ip":294,"varint":860}],612:[function(require,module,exports){ -arguments[4][537][0].apply(exports,arguments) -},{"./codec":610,"./protocols-table":613,"bs58":141,"buffer":144,"dup":537,"lodash.map":555,"varint":860,"xtend":865}],613:[function(require,module,exports){ +},{}],607:[function(require,module,exports){ +(function (Buffer){ +'use strict' + +const map = require('lodash.map') +const filter = require('lodash.filter') +const convert = require('./convert') +const protocols = require('./protocols-table') +const varint = require('varint') + +// export codec +module.exports = { + stringToStringTuples: stringToStringTuples, + stringTuplesToString: stringTuplesToString, + + tuplesToStringTuples: tuplesToStringTuples, + stringTuplesToTuples: stringTuplesToTuples, + + bufferToTuples: bufferToTuples, + tuplesToBuffer: tuplesToBuffer, + + bufferToString: bufferToString, + stringToBuffer: stringToBuffer, + + fromString: fromString, + fromBuffer: fromBuffer, + validateBuffer: validateBuffer, + isValidBuffer: isValidBuffer, + cleanPath: cleanPath, + + ParseError: ParseError, + protoFromTuple: protoFromTuple, + + sizeForAddr: sizeForAddr +} + +// string -> [[str name, str addr]... ] +function stringToStringTuples (str) { + const tuples = [] + const parts = str.split('/').slice(1) // skip first empty elem + if (parts.length === 1 && parts[0] === '') { + return [] + } + + for (let p = 0; p < parts.length; p++) { + const part = parts[p] + const proto = protocols(part) + + if (proto.size === 0) { + tuples.push([part]) + continue + } + + p++ // advance addr part + if (p >= parts.length) { + throw ParseError('invalid address: ' + str) + } + + tuples.push([part, parts[p]]) + } + + return tuples +} + +// [[str name, str addr]... ] -> string +function stringTuplesToString (tuples) { + const parts = [] + map(tuples, function (tup) { + const proto = protoFromTuple(tup) + parts.push(proto.name) + if (tup.length > 1) { + parts.push(tup[1]) + } + }) + + return '/' + parts.join('/') +} + +// [[str name, str addr]... ] -> [[int code, Buffer]... ] +function stringTuplesToTuples (tuples) { + return map(tuples, function (tup) { + if (!Array.isArray(tup)) { + tup = [tup] + } + const proto = protoFromTuple(tup) + if (tup.length > 1) { + return [proto.code, convert.toBuffer(proto.code, tup[1])] + } + return [proto.code] + }) +} + +// [[int code, Buffer]... ] -> [[str name, str addr]... ] +function tuplesToStringTuples (tuples) { + return map(tuples, function (tup) { + const proto = protoFromTuple(tup) + if (tup.length > 1) { + return [proto.code, convert.toString(proto.code, tup[1])] + } + return [proto.code] + }) +} + +// [[int code, Buffer ]... ] -> Buffer +function tuplesToBuffer (tuples) { + return fromBuffer(Buffer.concat(map(tuples, function (tup) { + const proto = protoFromTuple(tup) + let buf = new Buffer(varint.encode(proto.code)) + + if (tup.length > 1) { + buf = Buffer.concat([buf, tup[1]]) // add address buffer + } + + return buf + }))) +} + +function sizeForAddr (p, addr) { + if (p.size > 0) { + return p.size / 8 + } else if (p.size === 0) { + return 0 + } else { + const size = varint.decode(addr) + return size + varint.decode.bytes + } +} + +// Buffer -> [[int code, Buffer ]... ] +function bufferToTuples (buf) { + const tuples = [] + let i = 0 + while (i < buf.length) { + const code = varint.decode(buf, i) + const n = varint.decode.bytes + + const p = protocols(code) + + const size = sizeForAddr(p, buf.slice(i + n)) + + if (size === 0) { + tuples.push([code]) + i += n + continue + } + + const addr = buf.slice(i + n, i + n + size) + + i += (size + n) + + if (i > buf.length) { // did not end _exactly_ at buffer.length + throw ParseError('Invalid address buffer: ' + buf.toString('hex')) + } + + // ok, tuple seems good. + tuples.push([code, addr]) + } + + return tuples +} + +// Buffer -> String +function bufferToString (buf) { + const a = bufferToTuples(buf) + const b = tuplesToStringTuples(a) + return stringTuplesToString(b) +} + +// String -> Buffer +function stringToBuffer (str) { + str = cleanPath(str) + const a = stringToStringTuples(str) + const b = stringTuplesToTuples(a) + + return tuplesToBuffer(b) +} + +// String -> Buffer +function fromString (str) { + return stringToBuffer(str) +} + +// Buffer -> Buffer +function fromBuffer (buf) { + const err = validateBuffer(buf) + if (err) throw err + return new Buffer(buf) // copy +} + +function validateBuffer (buf) { + try { + bufferToTuples(buf) // try to parse. will throw if breaks + } catch (err) { + return err + } +} + +function isValidBuffer (buf) { + return validateBuffer(buf) === undefined +} + +function cleanPath (str) { + return '/' + filter(str.trim().split('/')).join('/') +} + +function ParseError (str) { + return new Error('Error parsing address: ' + str) +} + +function protoFromTuple (tup) { + const proto = protocols(tup[0]) + return proto +} + +}).call(this,require("buffer").Buffer) +},{"./convert":608,"./protocols-table":610,"buffer":144,"lodash.filter":544,"lodash.map":552,"varint":857}],608:[function(require,module,exports){ +(function (Buffer){ +'use strict' + +const ip = require('ip') +const protocols = require('./protocols-table') +const bs58 = require('bs58') +const varint = require('varint') + +module.exports = Convert + +// converts (serializes) addresses +function Convert (proto, a) { + if (a instanceof Buffer) { + return Convert.toString(proto, a) + } else { + return Convert.toBuffer(proto, a) + } +} + +Convert.toString = function convertToString (proto, buf) { + proto = protocols(proto) + switch (proto.code) { + case 4: // ipv4 + case 41: // ipv6 + return ip.toString(buf) + + case 6: // tcp + case 17: // udp + case 33: // dccp + case 132: // sctp + return buf2port(buf) + + case 53: // dns + case 54: // dns4 + case 55: // dns6 + return buf2str(buf) + + case 421: // ipfs + return buf2mh(buf) + default: + return buf.toString('hex') // no clue. convert to hex + } +} + +Convert.toBuffer = function convertToBuffer (proto, str) { + proto = protocols(proto) + switch (proto.code) { + case 4: // ipv4 + case 41: // ipv6 + return ip.toBuffer(str) + + case 6: // tcp + case 17: // udp + case 33: // dccp + case 132: // sctp + return port2buf(parseInt(str, 10)) + + case 53: // dns + case 54: // dns4 + case 55: // dns6 + return str2buf(str) + + case 421: // ipfs + return mh2buf(str) + default: + return new Buffer(str, 'hex') // no clue. convert from hex + } +} + +function port2buf (port) { + const buf = new Buffer(2) + buf.writeUInt16BE(port, 0) + return buf +} + +function buf2port (buf) { + return buf.readUInt16BE(0) +} + +function str2buf (str) { + const buf = new Buffer(str) + const size = new Buffer(varint.encode(buf.length)) + return Buffer.concat([size, buf]) +} + +function buf2str (buf) { + const size = varint.decode(buf) + buf = buf.slice(varint.decode.bytes) + + if (buf.length !== size) { + throw new Error('inconsistent lengths') + } + + return buf.toString() +} + +function mh2buf (hash) { + // the address is a varint prefixed multihash string representation + const mh = new Buffer(bs58.decode(hash)) + const size = new Buffer(varint.encode(mh.length)) + return Buffer.concat([size, mh]) +} + +function buf2mh (buf) { + const size = varint.decode(buf) + const address = buf.slice(varint.decode.bytes) + + if (address.length !== size) { + throw new Error('inconsistent lengths') + } + + return bs58.encode(address) +} + +}).call(this,require("buffer").Buffer) +},{"./protocols-table":610,"bs58":141,"buffer":144,"ip":294,"varint":857}],609:[function(require,module,exports){ +(function (Buffer){ +'use strict' + +const map = require('lodash.map') +const extend = require('xtend') +const codec = require('./codec') +const protocols = require('./protocols-table') +const varint = require('varint') +const bs58 = require('bs58') + +const NotImplemented = new Error('Sorry, Not Implemented Yet.') + +exports = module.exports = Multiaddr + +/** + * Creates a [multiaddr](https://github.com/multiformats/multiaddr) from + * a Buffer, String or another Multiaddr instance + * public key. + * @class Multiaddr + * @param {(String|Buffer|Multiaddr)} addr - If String or Buffer, needs to adhere + * to the address format of a [multiaddr](https://github.com/multiformats/multiaddr#string-format) + * @example + * Multiaddr('/ip4/127.0.0.1/tcp/4001') + * // + */ +function Multiaddr (addr) { + if (!(this instanceof Multiaddr)) { + return new Multiaddr(addr) + } + + // default + addr = addr || '' + + if (addr instanceof Buffer) { + /** + * @type {Buffer} - The raw bytes representing this multiaddress + */ + this.buffer = codec.fromBuffer(addr) + } else if (typeof addr === 'string' || addr instanceof String) { + this.buffer = codec.fromString(addr) + } else if (addr.buffer && addr.protos && addr.protoCodes) { // Multiaddr + this.buffer = codec.fromBuffer(addr.buffer) // validate + copy buffer + } else { + throw new Error('addr must be a string, Buffer, or another Multiaddr') + } +} + +/** + * Returns Multiaddr as a String + * + * @returns {String} + * @example + * Multiaddr('/ip4/127.0.0.1/tcp/4001').toString() + * // '/ip4/127.0.0.1/tcp/4001' + */ +Multiaddr.prototype.toString = function toString () { + return codec.bufferToString(this.buffer) +} + +/** + * Returns Multiaddr as a convinient options object to be used with net.createConnection + * + * @returns {{family: String, host: String, transport: String, port: String}} + * @example + * Multiaddr('/ip4/127.0.0.1/tcp/4001').toOptions() + * // { family: 'ipv4', host: '127.0.0.1', transport: 'tcp', port: '4001' } + */ +Multiaddr.prototype.toOptions = function toOptions () { + const opts = {} + const parsed = this.toString().split('/') + opts.family = parsed[1] === 'ip4' ? 'ipv4' : 'ipv6' + opts.host = parsed[2] + opts.transport = parsed[3] + opts.port = parsed[4] + return opts +} + +/** + * Returns Multiaddr as a human-readable string + * + * @returns {String} + * @example + * Multiaddr('/ip4/127.0.0.1/tcp/4001').inspect() + * // '' + */ +Multiaddr.prototype.inspect = function inspect () { + return '' +} + +/** + * Returns the protocols the Multiaddr is defined with, as an array of objects, in + * left-to-right order. Each object contains the protocol code, protocol name, + * and the size of its address space in bits. + * [See list of protocols](https://github.com/multiformats/multiaddr/blob/master/protocols.csv) + * + * @returns {Array.} protocols - All the protocols the address is composed of + * @returns {Number} protocols[].code + * @returns {Number} protocols[].size + * @returns {String} protocols[].name + * @example + * Multiaddr('/ip4/127.0.0.1/tcp/4001').protos() + * // [ { code: 4, size: 32, name: 'ip4' }, + * // { code: 6, size: 16, name: 'tcp' } ] + */ +Multiaddr.prototype.protos = function protos () { + return map(this.protoCodes(), function (code) { + return extend(protocols(code)) + // copy to prevent users from modifying the internal objs. + }) +} + +/** + * Returns the codes of the protocols in left-to-right order. + * [See list of protocols](https://github.com/multiformats/multiaddr/blob/master/protocols.csv) + * + * @returns {Array.} protocol codes + * @example + * Multiaddr('/ip4/127.0.0.1/tcp/4001').protoCodes() + * // [ 4, 6 ] + */ +Multiaddr.prototype.protoCodes = function protoCodes () { + const codes = [] + const buf = this.buffer + let i = 0 + while (i < buf.length) { + const code = varint.decode(buf, i) + const n = varint.decode.bytes + + const p = protocols(code) + const size = codec.sizeForAddr(p, buf.slice(i + n)) + + i += (size + n) + codes.push(code) + } + + return codes +} + +/** + * Returns the names of the protocols in left-to-right order. + * [See list of protocols](https://github.com/multiformats/multiaddr/blob/master/protocols.csv) + * + * @return {Array.} protocol names + * @example + * Multiaddr('/ip4/127.0.0.1/tcp/4001').protoNames() + * // [ 'ip4', 'tcp' ] + */ +Multiaddr.prototype.protoNames = function protoNames () { + return map(this.protos(), function (proto) { + return proto.name + }) +} + +/** + * Returns a tuple of parts + * + * @return {Array.} tuples + * @return {Number} tuples[].0 code of protocol + * @return {Buffer} tuples[].1 contents of address + * @example + * Multiaddr("/ip4/127.0.0.1/tcp/4001").tuples() + * // [ [ 4, ], [ 6, ] ] + */ +Multiaddr.prototype.tuples = function tuples () { + return codec.bufferToTuples(this.buffer) +} + +/** + * Returns a tuple of string/number parts + * + * @return {Array.} tuples + * @return {Number} tuples[].0 code of protocol + * @return {(String|Number)} tuples[].1 contents of address + * @example + * Multiaddr("/ip4/127.0.0.1/tcp/4001").stringTuples() + * // [ [ 4, '127.0.0.1' ], [ 6, 4001 ] ] + */ +Multiaddr.prototype.stringTuples = function stringTuples () { + const t = codec.bufferToTuples(this.buffer) + return codec.tuplesToStringTuples(t) +} + +/** + * Encapsulates a Multiaddr in another Multiaddr + * + * @param {Multiaddr} addr - Multiaddr to add into this Multiaddr + * @return {Multiaddr} + * @example + * const mh1 = Multiaddr('/ip4/8.8.8.8/tcp/1080') + * // + * + * const mh2 = Multiaddr('/ip4/127.0.0.1/tcp/4001') + * // + * + * const mh3 = mh1.encapsulate(mh2) + * // + * + * mh3.toString() + * // '/ip4/8.8.8.8/tcp/1080/ip4/127.0.0.1/tcp/4001' + */ +Multiaddr.prototype.encapsulate = function encapsulate (addr) { + addr = Multiaddr(addr) + return Multiaddr(this.toString() + addr.toString()) +} + +/** + * Decapsulates a Multiaddr from another Multiaddr + * + * @param {Multiaddr} addr - Multiaddr to remove from this Multiaddr + * @return {Multiaddr} + * @example + * const mh1 = Multiaddr('/ip4/8.8.8.8/tcp/1080') + * // + * + * const mh2 = Multiaddr('/ip4/127.0.0.1/tcp/4001') + * // + * + * const mh3 = mh1.encapsulate(mh2) + * // + * + * mh3.decapsulate(mh2).toString() + * // '/ip4/8.8.8.8/tcp/1080' + */ +Multiaddr.prototype.decapsulate = function decapsulate (addr) { + addr = addr.toString() + const s = this.toString() + const i = s.lastIndexOf(addr) + if (i < 0) { + throw new Error('Address ' + this + ' does not contain subaddress: ' + addr) + } + return Multiaddr(s.slice(0, i)) +} + +/** + * Extract the peerId if the multiaddr contains one + * + * @return {String|null} peerId - The id of the peer or null if invalid or missing from the ma + * @example + * const mh1 = Multiaddr('/ip4/8.8.8.8/tcp/1080/ipfs/QmValidBase58string') + * // + * + * // should return QmValidBase58string or null if the id is missing or invalid + * const peerId = mh1.getPeerId() + */ +Multiaddr.prototype.getPeerId = function getPeerId () { + let b58str = null + try { + b58str = this.stringTuples().filter((tuple) => { + if (tuple[0] === protocols.names['ipfs'].code) { + return true + } + })[0][1] + + bs58.decode(b58str) + } catch (e) { + b58str = null + } + + return b58str +} + +/** + * Checks if two Multiaddrs are the same + * + * @param {Multiaddr} addr + * @return {Bool} + * @example + * const mh1 = Multiaddr('/ip4/8.8.8.8/tcp/1080') + * // + * + * const mh2 = Multiaddr('/ip4/127.0.0.1/tcp/4001') + * // + * + * mh1.equals(mh1) + * // true + * + * mh1.equals(mh2) + * // false + */ +Multiaddr.prototype.equals = function equals (addr) { + return this.buffer.equals(addr.buffer) +} + +/** + * Gets a Multiaddrs node-friendly address object. Note that protocol information + * is left out: in Node (and most network systems) the protocol is unknowable + * given only the address. + * + * Has to be a ThinWaist Address, otherwise throws error + * + * @returns {{family: String, address: String, port: String}} + * @throws {Error} Throws error if Multiaddr is not a Thin Waist address + * @example + * Multiaddr('/ip4/127.0.0.1/tcp/4001').nodeAddress() + * // {family: 'IPv4', address: '127.0.0.1', port: '4001'} + */ +Multiaddr.prototype.nodeAddress = function nodeAddress () { + if (!this.isThinWaistAddress()) { + throw new Error('Multiaddr must be "thin waist" address for nodeAddress.') + } + + const codes = this.protoCodes() + const parts = this.toString().split('/').slice(1) + return { + family: (codes[0] === 41) ? 'IPv6' : 'IPv4', + address: parts[1], // ip addr + port: parts[3] // tcp or udp port + } +} + +/** + * Creates a Multiaddr from a node-friendly address object + * + * @param {String} addr + * @param {String} transport + * @returns {Multiaddr} multiaddr + * @throws {Error} Throws error if addr is not truthy + * @throws {Error} Throws error if transport is not truthy + * @example + * Multiaddr.fromNodeAddress({address: '127.0.0.1', port: '4001'}, 'tcp') + * // + */ +Multiaddr.fromNodeAddress = function fromNodeAddress (addr, transport) { + if (!addr) throw new Error('requires node address object') + if (!transport) throw new Error('requires transport protocol') + const ip = (addr.family === 'IPv6') ? 'ip6' : 'ip4' + return Multiaddr('/' + [ip, addr.address, transport, addr.port].join('/')) +} + +// TODO find a better example, not sure about it's good enough +/** + * Returns if a Multiaddr is a Thin Waist address or not. + * + * Thin Waist is if a Multiaddr adheres to the standard combination of: + * + * `{IPv4, IPv6}/{TCP, UDP}` + * + * @param {Multiaddr} [addr] - Defaults to using `this` instance + * @returns {Boolean} isThinWaistAddress + * @example + * const mh1 = Multiaddr('/ip4/127.0.0.1/tcp/4001') + * // + * const mh2 = Multiaddr('/ip4/192.168.2.1/tcp/5001') + * // + * const mh3 = mh1.encapsulate(mh2) + * // + * mh1.isThinWaistAddress() + * // true + * mh2.isThinWaistAddress() + * // true + * mh3.isThinWaistAddress() + * // false + */ +Multiaddr.prototype.isThinWaistAddress = function isThinWaistAddress (addr) { + const protos = (addr || this).protos() + + if (protos.length !== 2) { + return false + } + + if (protos[0].code !== 4 && protos[0].code !== 41) { + return false + } + if (protos[1].code !== 6 && protos[1].code !== 17) { + return false + } + return true +} + +// TODO rename this to something else than "stupid string" +/** + * Converts a "stupid string" into a Multiaddr. + * + * Stupid string format: + * ``` + * ://[:] + * udp4://1.2.3.4:5678 + * ``` + * + * @param {String} [str] - String in the "stupid" format + * @throws {NotImplemented} + * @returns {undefined} + * @todo Not Implemented yet + */ +Multiaddr.prototype.fromStupidString = function fromStupidString (str) { + throw NotImplemented +} + +/** + * Object containing table, names and codes of all supported protocols. + * To get the protocol values from a Multiaddr, you can use + * [`.protos()`](#multiaddrprotos), + * [`.protoCodes()`](#multiaddrprotocodes) or + * [`.protoNames()`](#multiaddrprotonames) + * + * @instance + * @returns {{table: Array, names: Object, codes: Object}} + * + */ +Multiaddr.protocols = protocols + +/** + * Returns if something is a Multiaddr or not + * + * @param {Multiaddr} addr + * @return {Bool} isMultiaddr + * @example + * Multiaddr.isMultiaddr(Multiaddr('/ip4/127.0.0.1/tcp/4001')) + * // true + * Multiaddr.isMultiaddr('/ip4/127.0.0.1/tcp/4001') + * // false + */ +Multiaddr.isMultiaddr = function isMultiaddr (addr) { + if (addr.constructor && addr.constructor.name) { + return addr.constructor.name === 'Multiaddr' + } + + return Boolean( + addr.fromStupidString && + addr.protos + ) +} + +/** + * Returns if something is a Multiaddr that is a name + * + * @param {Multiaddr} addr + * @return {Bool} isName + */ +Multiaddr.isName = function isName (addr) { + if (!Multiaddr.isMultiaddr(addr)) { + return false + } + + // if a part of the multiaddr is resolvable, then return true + return addr.protos().some((proto) => proto.resolvable) +} + +/** + * Returns an array of multiaddrs, by resolving the multiaddr that is a name + * + * @param {Multiaddr} addr + * + * @param {Function} callback + * @return {Bool} isName + */ +Multiaddr.resolve = function resolve (addr, callback) { + if (!Multiaddr.isMultiaddr(addr) || !Multiaddr.isName(addr)) { + return callback(new Error('not a valid name')) + } + + /* + * Needs more consideration from spec design: + * - what to return + * - how to achieve it in the browser? + */ + return callback(new Error('not implemented yet')) +} + +}).call(this,require("buffer").Buffer) +},{"./codec":607,"./protocols-table":610,"bs58":141,"buffer":144,"lodash.map":552,"varint":857,"xtend":862}],610:[function(require,module,exports){ 'use strict' const map = require('lodash.map') @@ -107236,7 +108258,7 @@ function p (code, size, name, resolvable) { module.exports = Protocols -},{"lodash.map":555}],614:[function(require,module,exports){ +},{"lodash.map":552}],611:[function(require,module,exports){ 'use strict' class Base { @@ -107264,7 +108286,7 @@ class Base { module.exports = Base -},{}],615:[function(require,module,exports){ +},{}],612:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -107288,7 +108310,7 @@ module.exports = function base16 (alphabet) { } }).call(this,require("buffer").Buffer) -},{"buffer":144}],616:[function(require,module,exports){ +},{"buffer":144}],613:[function(require,module,exports){ 'use strict' const Base = require('./base.js') @@ -107326,7 +108348,7 @@ module.exports = { codes: codes } -},{"./base.js":614,"./base16":615,"base-x":76}],617:[function(require,module,exports){ +},{"./base.js":611,"./base16":612,"base-x":76}],614:[function(require,module,exports){ (function (Buffer){ /** * Implementation of the [multibase](https://github.com/multiformats/multibase) specification. @@ -107466,7 +108488,7 @@ function getBase (nameOrCode) { } }).call(this,require("buffer").Buffer) -},{"./constants":616,"buffer":144}],618:[function(require,module,exports){ +},{"./constants":613,"buffer":144}],615:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -107559,11 +108581,11 @@ exports['torrent-info'] = Buffer.from('7b', 'hex') exports['torrent-file'] = Buffer.from('7c', 'hex') }).call(this,require("buffer").Buffer) -},{"buffer":144}],619:[function(require,module,exports){ +},{"buffer":144}],616:[function(require,module,exports){ arguments[4][312][0].apply(exports,arguments) -},{"./name-table":620,"./util":621,"./varint-table":622,"buffer":144,"dup":312,"varint":860}],620:[function(require,module,exports){ +},{"./name-table":617,"./util":618,"./varint-table":619,"buffer":144,"dup":312,"varint":857}],617:[function(require,module,exports){ arguments[4][313][0].apply(exports,arguments) -},{"./base-table":618,"dup":313}],621:[function(require,module,exports){ +},{"./base-table":615,"dup":313}],618:[function(require,module,exports){ (function (Buffer){ 'use strict' const varint = require('varint') @@ -107596,9 +108618,9 @@ function varintBufferDecode (input) { } }).call(this,require("buffer").Buffer) -},{"buffer":144,"varint":860}],622:[function(require,module,exports){ +},{"buffer":144,"varint":857}],619:[function(require,module,exports){ arguments[4][315][0].apply(exports,arguments) -},{"./base-table":618,"./util":621,"dup":315}],623:[function(require,module,exports){ +},{"./base-table":615,"./util":618,"dup":315}],620:[function(require,module,exports){ /* eslint quote-props: off */ /* eslint key-spacing: off */ 'use strict' @@ -108619,236 +109641,9 @@ exports.defaultLengths = Object.freeze({ 0xb3e0: 0x80 }) -},{}],624:[function(require,module,exports){ -(function (Buffer){ -/** - * Multihash implementation in JavaScript. - * - * @module multihash - */ -'use strict' - -const bs58 = require('bs58') - -const cs = require('./constants') - -exports.names = cs.names -exports.codes = cs.codes -exports.defaultLengths = cs.defaultLengths - -const varint = require('varint') - -/** - * Convert the given multihash to a hex encoded string. - * - * @param {Buffer} hash - * @returns {string} - */ -exports.toHexString = function toHexString (hash) { - if (!Buffer.isBuffer(hash)) { - throw new Error('must be passed a buffer') - } - - return hash.toString('hex') -} - -/** - * Convert the given hex encoded string to a multihash. - * - * @param {string} hash - * @returns {Buffer} - */ -exports.fromHexString = function fromHexString (hash) { - return Buffer.from(hash, 'hex') -} - -/** - * Convert the given multihash to a base58 encoded string. - * - * @param {Buffer} hash - * @returns {string} - */ -exports.toB58String = function toB58String (hash) { - if (!Buffer.isBuffer(hash)) { - throw new Error('must be passed a buffer') - } - - return bs58.encode(hash) -} - -/** - * Convert the given base58 encoded string to a multihash. - * - * @param {string|Buffer} hash - * @returns {Buffer} - */ -exports.fromB58String = function fromB58String (hash) { - let encoded = hash - if (Buffer.isBuffer(hash)) { - encoded = hash.toString() - } - - return Buffer.from(bs58.decode(encoded)) -} - -/** - * Decode a hash from the given multihash. - * - * @param {Buffer} buf - * @returns {{code: number, name: string, length: number, digest: Buffer}} result - */ -exports.decode = function decode (buf) { - if (!(Buffer.isBuffer(buf))) { - throw new Error('multihash must be a Buffer') - } - - if (buf.length < 3) { - throw new Error('multihash too short. must be > 3 bytes.') - } - - let code = varint.decode(buf) - if (!exports.isValidCode(code)) { - throw new Error(`multihash unknown function code: 0x${code.toString(16)}`) - } - buf = buf.slice(varint.decode.bytes) - - let len = varint.decode(buf) - if (len < 1) { - throw new Error(`multihash invalid length: 0x${len.toString(16)}`) - } - buf = buf.slice(varint.decode.bytes) - - if (buf.length !== len) { - throw new Error(`multihash length inconsistent: 0x${buf.toString('hex')}`) - } - - return { - code: code, - name: cs.codes[code], - length: len, - digest: buf - } -} - -/** - * Encode a hash digest along with the specified function code. - * - * > **Note:** the length is derived from the length of the digest itself. - * - * @param {Buffer} digest - * @param {string|number} code - * @param {number} [length] - * @returns {Buffer} - */ -exports.encode = function encode (digest, code, length) { - if (!digest || !code) { - throw new Error('multihash encode requires at least two args: digest, code') - } - - // ensure it's a hashfunction code. - const hashfn = exports.coerceCode(code) - - if (!(Buffer.isBuffer(digest))) { - throw new Error('digest should be a Buffer') - } - - if (length == null) { - length = digest.length - } - - if (length && digest.length !== length) { - throw new Error('digest length should be equal to specified length.') - } - - return Buffer.concat([ - Buffer.from(varint.encode(hashfn)), - Buffer.from(varint.encode(length)), - digest - ]) -} - -/** - * Converts a hash function name into the matching code. - * If passed a number it will return the number if it's a valid code. - * @param {string|number} name - * @returns {number} - */ -exports.coerceCode = function coerceCode (name) { - let code = name - - if (typeof name === 'string') { - if (!cs.names[name]) { - throw new Error(`Unrecognized hash function named: ${name}`) - } - code = cs.names[name] - } - - if (typeof code !== 'number') { - throw new Error(`Hash function code should be a number. Got: ${code}`) - } - - if (!cs.codes[code] && !exports.isAppCode(code)) { - throw new Error(`Unrecognized function code: ${code}`) - } - - return code -} - -/** - * Checks wether a code is part of the app range - * - * @param {number} code - * @returns {boolean} - */ -exports.isAppCode = function appCode (code) { - return code > 0 && code < 0x10 -} - -/** - * Checks whether a multihash code is valid. - * - * @param {number} code - * @returns {boolean} - */ -exports.isValidCode = function validCode (code) { - if (exports.isAppCode(code)) { - return true - } - - if (cs.codes[code]) { - return true - } - - return false -} - -/** - * Check if the given buffer is a valid multihash. Throws an error if it is not valid. - * - * @param {Buffer} multihash - * @returns {undefined} - * @throws {Error} - */ -function validate (multihash) { - exports.decode(multihash) // throws if bad. -} -exports.validate = validate - -/** - * Returns a prefix from a valid multihash. Throws an error if it is not valid. - * - * @param {Buffer} multihash - * @returns {undefined} - * @throws {Error} - */ -exports.prefix = function prefix (multihash) { - validate(multihash) - - return multihash.slice(0, 2) -} - -}).call(this,require("buffer").Buffer) -},{"./constants":623,"bs58":141,"buffer":144,"varint":860}],625:[function(require,module,exports){ +},{}],621:[function(require,module,exports){ +arguments[4][366][0].apply(exports,arguments) +},{"./constants":620,"bs58":141,"buffer":144,"dup":366,"varint":857}],622:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -108887,7 +109682,7 @@ module.exports = (table) => { } }).call(this,require("buffer").Buffer) -},{"./utils":629,"blakejs":84,"buffer":144}],626:[function(require,module,exports){ +},{"./utils":626,"blakejs":84,"buffer":144}],623:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -108949,7 +109744,7 @@ module.exports = { } }).call(this,require("buffer").Buffer) -},{"buffer":144,"nodeify":660}],627:[function(require,module,exports){ +},{"buffer":144,"nodeify":657}],624:[function(require,module,exports){ 'use strict' const sha3 = require('js-sha3') @@ -108982,7 +109777,7 @@ module.exports = { addBlake: require('./blake') } -},{"./blake":625,"./crypto-sha1-2":626,"./utils":629,"js-sha3":439,"murmurhash3js":650}],628:[function(require,module,exports){ +},{"./blake":622,"./crypto-sha1-2":623,"./utils":626,"js-sha3":444,"murmurhash3js":647}],625:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -109125,7 +109920,7 @@ Multihashing.functions = { crypto.addBlake(Multihashing.functions) }).call(this,require("buffer").Buffer) -},{"./crypto":627,"buffer":144,"multihashes":624}],629:[function(require,module,exports){ +},{"./crypto":624,"buffer":144,"multihashes":621}],626:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -109172,11 +109967,11 @@ exports.fromNumberTo32BitBuf = (doWork, other) => (input) => { } }).call(this,require("buffer").Buffer) -},{"async/setImmediate":70,"buffer":144}],630:[function(require,module,exports){ +},{"async/setImmediate":70,"buffer":144}],627:[function(require,module,exports){ arguments[4][219][0].apply(exports,arguments) -},{"./debug":631,"_process":682,"dup":219}],631:[function(require,module,exports){ +},{"./debug":628,"_process":679,"dup":219}],628:[function(require,module,exports){ arguments[4][220][0].apply(exports,arguments) -},{"dup":220,"ms":609}],632:[function(require,module,exports){ +},{"dup":220,"ms":606}],629:[function(require,module,exports){ module.exports = read var MSB = 0x80 @@ -109208,7 +110003,7 @@ function read(buf, offset) { return res } -},{}],633:[function(require,module,exports){ +},{}],630:[function(require,module,exports){ module.exports = encode var MSB = 0x80 @@ -109236,14 +110031,14 @@ function encode(num, out, offset) { return out } -},{}],634:[function(require,module,exports){ +},{}],631:[function(require,module,exports){ module.exports = { encode: require('./encode.js') , decode: require('./decode.js') , encodingLength: require('./length.js') } -},{"./decode.js":632,"./encode.js":633,"./length.js":635}],635:[function(require,module,exports){ +},{"./decode.js":629,"./encode.js":630,"./length.js":632}],632:[function(require,module,exports){ var N1 = Math.pow(2, 7) var N2 = Math.pow(2, 14) @@ -109270,7 +110065,7 @@ module.exports = function (value) { ) } -},{}],636:[function(require,module,exports){ +},{}],633:[function(require,module,exports){ (function (Buffer){ 'use strict' /* @flow */ @@ -109468,7 +110263,7 @@ class Channel extends stream.Duplex { module.exports = Channel }).call(this,require("buffer").Buffer) -},{"buffer":144,"debug":630,"events":236,"readable-stream":784}],637:[function(require,module,exports){ +},{"buffer":144,"debug":627,"events":236,"readable-stream":781}],634:[function(require,module,exports){ (function (Buffer){ 'use strict' /* @flow */ @@ -109957,17 +110752,17 @@ class Multiplex extends stream.Duplex { module.exports = Multiplex }).call(this,require("buffer").Buffer) -},{"./channel":636,"buffer":144,"debug":630,"duplexify":190,"readable-stream":784,"varint":634}],638:[function(require,module,exports){ +},{"./channel":633,"buffer":144,"debug":627,"duplexify":190,"readable-stream":781,"varint":631}],635:[function(require,module,exports){ arguments[4][219][0].apply(exports,arguments) -},{"./debug":639,"_process":682,"dup":219}],639:[function(require,module,exports){ +},{"./debug":636,"_process":679,"dup":219}],636:[function(require,module,exports){ arguments[4][220][0].apply(exports,arguments) -},{"dup":220,"ms":609}],640:[function(require,module,exports){ +},{"dup":220,"ms":606}],637:[function(require,module,exports){ 'use strict' exports = module.exports exports.PROTOCOL_ID = '/multistream/1.0.0' -},{}],641:[function(require,module,exports){ +},{}],638:[function(require,module,exports){ 'use strict' const varint = require('varint') @@ -110116,7 +110911,7 @@ function collectLs (conn) { module.exports = Dialer -},{"../select":648,"../util":649,"./../constants":640,"interface-connection":289,"once":661,"pull-length-prefixed":715,"pull-stream":726,"varint":860}],642:[function(require,module,exports){ +},{"../select":645,"../util":646,"./../constants":637,"interface-connection":289,"once":658,"pull-length-prefixed":712,"pull-stream":723,"varint":857}],639:[function(require,module,exports){ 'use strict' exports.Listener = exports.listener = require('./listener') @@ -110124,7 +110919,7 @@ exports.Dialer = exports.dialer = require('./dialer') exports.matchSemver = require('./listener/match-semver') exports.matchExact = require('./listener/match-exact') -},{"./dialer":641,"./listener":643,"./listener/match-exact":645,"./listener/match-semver":646}],643:[function(require,module,exports){ +},{"./dialer":638,"./listener":640,"./listener/match-exact":642,"./listener/match-semver":643}],640:[function(require,module,exports){ 'use strict' const pull = require('pull-stream') @@ -110237,7 +111032,7 @@ class Listener { module.exports = Listener -},{"../select":648,"./../constants":640,"./../util":649,"./ls-handler":644,"./match-exact":645,"./select-handler":647,"assert":33,"interface-connection":289,"lodash.isfunction":554,"pull-stream":726}],644:[function(require,module,exports){ +},{"../select":645,"./../constants":637,"./../util":646,"./ls-handler":641,"./match-exact":642,"./select-handler":644,"assert":33,"interface-connection":289,"lodash.isfunction":551,"pull-stream":723}],641:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -110278,7 +111073,7 @@ function lsHandler (self, conn) { module.exports = lsHandler }).call(this,require("buffer").Buffer) -},{"buffer":144,"pull-length-prefixed":715,"pull-stream":726,"varint":860}],645:[function(require,module,exports){ +},{"buffer":144,"pull-length-prefixed":712,"pull-stream":723,"varint":857}],642:[function(require,module,exports){ 'use strict' /** @@ -110297,7 +111092,7 @@ function matchExact (myProtocol, senderProtocol, callback) { module.exports = matchExact -},{}],646:[function(require,module,exports){ +},{}],643:[function(require,module,exports){ 'use strict' const semver = require('semver') @@ -110331,7 +111126,7 @@ function matchSemver (myProtocol, senderProtocol, callback) { module.exports = matchSemver -},{"semver":804}],647:[function(require,module,exports){ +},{"semver":801}],644:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -110411,7 +111206,7 @@ function matcher (protocol, handlers, callback) { module.exports = selectHandler }).call(this,require("buffer").Buffer) -},{"../util.js":649,"async/some":71,"buffer":144,"interface-connection":289,"pull-handshake":712,"pull-length-prefixed":715}],648:[function(require,module,exports){ +},{"../util.js":646,"async/some":71,"buffer":144,"interface-connection":289,"pull-handshake":709,"pull-length-prefixed":712}],645:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -110450,7 +111245,7 @@ function select (multicodec, callback, log) { module.exports = select }).call(this,require("buffer").Buffer) -},{"./util":649,"buffer":144,"pull-handshake":712,"pull-length-prefixed":715}],649:[function(require,module,exports){ +},{"./util":646,"buffer":144,"pull-handshake":709,"pull-length-prefixed":712}],646:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -110518,10 +111313,10 @@ exports.log.listener = () => { } }).call(this,require("buffer").Buffer) -},{"buffer":144,"debug":638,"pull-length-prefixed":715,"pull-stream":726}],650:[function(require,module,exports){ +},{"buffer":144,"debug":635,"pull-length-prefixed":712,"pull-stream":723}],647:[function(require,module,exports){ module.exports = require('./lib/murmurHash3js'); -},{"./lib/murmurHash3js":651}],651:[function(require,module,exports){ +},{"./lib/murmurHash3js":648}],648:[function(require,module,exports){ /* jshint -W086: true */ // +----------------------------------------------------------------------+ // | murmurHash3js.js v3.0.1 // https://github.com/pid/murmurHash3js @@ -111085,7 +111880,7 @@ module.exports = require('./lib/murmurHash3js'); } })(this); -},{}],652:[function(require,module,exports){ +},{}],649:[function(require,module,exports){ 'use strict' // Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js // (MIT licensed) @@ -111196,7 +111991,7 @@ Object.defineProperty(Blob.prototype, Symbol.toStringTag, { configurable: true }) -},{"safe-buffer":790}],653:[function(require,module,exports){ +},{"safe-buffer":787}],650:[function(require,module,exports){ (function (global){ 'use strict' @@ -111611,7 +112406,7 @@ exports.writeToStream = function writeToStream (dest, instance) { Body.Promise = global.Promise }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./blob.js":652,"./fetch-error.js":655,"encoding":207,"json-parse-better-errors":440,"safe-buffer":790,"stream":833}],654:[function(require,module,exports){ +},{"./blob.js":649,"./fetch-error.js":652,"encoding":207,"json-parse-better-errors":445,"safe-buffer":787,"stream":830}],651:[function(require,module,exports){ 'use strict' /** * A set of utilities borrowed from Node.js' _http_common.js @@ -111705,7 +112500,7 @@ function checkInvalidHeaderChar (val) { } exports.checkInvalidHeaderChar = checkInvalidHeaderChar -},{}],655:[function(require,module,exports){ +},{}],652:[function(require,module,exports){ 'use strict' /** @@ -111742,7 +112537,7 @@ FetchError.prototype = Object.create(Error.prototype) FetchError.prototype.constructor = FetchError FetchError.prototype.name = 'FetchError' -},{}],656:[function(require,module,exports){ +},{}],653:[function(require,module,exports){ 'use strict' /** @@ -112040,7 +112835,7 @@ Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { module.exports = Headers -},{"./common.js":654}],657:[function(require,module,exports){ +},{"./common.js":651}],654:[function(require,module,exports){ (function (global){ 'use strict' @@ -112258,7 +113053,7 @@ exports.Response = Response exports.FetchError = FetchError }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./body.js":653,"./fetch-error":655,"./headers":656,"./request":658,"./response":659,"http":834,"https":259,"stream":833,"url":848,"zlib":139}],658:[function(require,module,exports){ +},{"./body.js":650,"./fetch-error":652,"./headers":653,"./request":655,"./response":656,"http":831,"https":259,"stream":830,"url":845,"zlib":139}],655:[function(require,module,exports){ 'use strict' /** @@ -112434,7 +113229,7 @@ exports.getNodeRequestOptions = function getNodeRequestOptions (request) { }) } -},{"./body.js":653,"./headers.js":656,"url":848}],659:[function(require,module,exports){ +},{"./body.js":650,"./headers.js":653,"url":845}],656:[function(require,module,exports){ 'use strict' /** @@ -112507,7 +113302,7 @@ Object.defineProperty(Response.prototype, Symbol.toStringTag, { }) module.exports = Response -},{"./body.js":653,"./headers.js":656,"http":834}],660:[function(require,module,exports){ +},{"./body.js":650,"./headers.js":653,"http":831}],657:[function(require,module,exports){ (function (process){ var Promise = require('promise'); var isPromise = require('is-promise'); @@ -112564,7 +113359,7 @@ function NodeifyPromise(fn) { NodeifyPromise.prototype = Object.create(Promise.prototype); NodeifyPromise.prototype.constructor = NodeifyPromise; }).call(this,require('_process')) -},{"_process":682,"is-promise":436,"promise":683}],661:[function(require,module,exports){ +},{"_process":679,"is-promise":441,"promise":680}],658:[function(require,module,exports){ var wrappy = require('wrappy') module.exports = wrappy(once) module.exports.strict = wrappy(onceStrict) @@ -112608,7 +113403,7 @@ function onceStrict (fn) { return f } -},{"wrappy":864}],662:[function(require,module,exports){ +},{"wrappy":861}],659:[function(require,module,exports){ exports.endianness = function () { return 'LE' }; exports.hostname = function () { @@ -112655,7 +113450,7 @@ exports.tmpdir = exports.tmpDir = function () { exports.EOL = '\n'; -},{}],663:[function(require,module,exports){ +},{}],660:[function(require,module,exports){ module.exports={"2.16.840.1.101.3.4.1.1": "aes-128-ecb", "2.16.840.1.101.3.4.1.2": "aes-128-cbc", "2.16.840.1.101.3.4.1.3": "aes-128-ofb", @@ -112669,7 +113464,7 @@ module.exports={"2.16.840.1.101.3.4.1.1": "aes-128-ecb", "2.16.840.1.101.3.4.1.43": "aes-256-ofb", "2.16.840.1.101.3.4.1.44": "aes-256-cfb" } -},{}],664:[function(require,module,exports){ +},{}],661:[function(require,module,exports){ // from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js // Fedor, you are amazing. 'use strict' @@ -112793,7 +113588,7 @@ exports.signature = asn1.define('signature', function () { ) }) -},{"./certificate":665,"asn1.js":19}],665:[function(require,module,exports){ +},{"./certificate":662,"asn1.js":19}],662:[function(require,module,exports){ // from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js // thanks to @Rantanen @@ -112883,7 +113678,7 @@ var X509Certificate = asn.define('X509Certificate', function () { module.exports = X509Certificate -},{"asn1.js":19}],666:[function(require,module,exports){ +},{"asn1.js":19}],663:[function(require,module,exports){ (function (Buffer){ // adapted from https://github.com/apatil/pemstrip var findProc = /Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m @@ -112917,7 +113712,7 @@ module.exports = function (okey, password) { } }).call(this,require("buffer").Buffer) -},{"browserify-aes":101,"buffer":144,"evp_bytestokey":237}],667:[function(require,module,exports){ +},{"browserify-aes":101,"buffer":144,"evp_bytestokey":237}],664:[function(require,module,exports){ (function (Buffer){ var asn1 = require('./asn1') var aesid = require('./aesid.json') @@ -113027,7 +113822,7 @@ function decrypt (data, password) { } }).call(this,require("buffer").Buffer) -},{"./aesid.json":663,"./asn1":664,"./fixProc":666,"browserify-aes":101,"buffer":144,"pbkdf2":671}],668:[function(require,module,exports){ +},{"./aesid.json":660,"./asn1":661,"./fixProc":663,"browserify-aes":101,"buffer":144,"pbkdf2":668}],665:[function(require,module,exports){ /** * Compiles a querystring * Returns string representation of the object @@ -113066,7 +113861,7 @@ exports.decode = function(qs){ return qry; }; -},{}],669:[function(require,module,exports){ +},{}],666:[function(require,module,exports){ /** * Parses an URI * @@ -113107,7 +113902,7 @@ module.exports = function parseuri(str) { return uri; }; -},{}],670:[function(require,module,exports){ +},{}],667:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -113335,13 +114130,13 @@ var substr = 'ab'.substr(-1) === 'b' ; }).call(this,require('_process')) -},{"_process":682}],671:[function(require,module,exports){ +},{"_process":679}],668:[function(require,module,exports){ exports.pbkdf2 = require('./lib/async') exports.pbkdf2Sync = require('./lib/sync') -},{"./lib/async":672,"./lib/sync":675}],672:[function(require,module,exports){ +},{"./lib/async":669,"./lib/sync":672}],669:[function(require,module,exports){ (function (process,global){ var checkParameters = require('./precondition') var defaultEncoding = require('./default-encoding') @@ -113443,7 +114238,7 @@ module.exports = function (password, salt, iterations, keylen, digest, callback) } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./default-encoding":673,"./precondition":674,"./sync":675,"_process":682,"safe-buffer":790}],673:[function(require,module,exports){ +},{"./default-encoding":670,"./precondition":671,"./sync":672,"_process":679,"safe-buffer":787}],670:[function(require,module,exports){ (function (process){ var defaultEncoding /* istanbul ignore next */ @@ -113457,7 +114252,7 @@ if (process.browser) { module.exports = defaultEncoding }).call(this,require('_process')) -},{"_process":682}],674:[function(require,module,exports){ +},{"_process":679}],671:[function(require,module,exports){ var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs module.exports = function (iterations, keylen) { if (typeof iterations !== 'number') { @@ -113477,7 +114272,7 @@ module.exports = function (iterations, keylen) { } } -},{}],675:[function(require,module,exports){ +},{}],672:[function(require,module,exports){ var md5 = require('create-hash/md5') var rmd160 = require('ripemd160') var sha = require('sha.js') @@ -113580,7 +114375,7 @@ function pbkdf2 (password, salt, iterations, keylen, digest) { module.exports = pbkdf2 -},{"./default-encoding":673,"./precondition":674,"create-hash/md5":155,"ripemd160":788,"safe-buffer":790,"sha.js":806}],676:[function(require,module,exports){ +},{"./default-encoding":670,"./precondition":671,"create-hash/md5":155,"ripemd160":785,"safe-buffer":787,"sha.js":803}],673:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -113699,7 +114494,7 @@ class PeerBook { module.exports = PeerBook }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":433,"bs58":141,"peer-id":677,"peer-info":678}],677:[function(require,module,exports){ +},{"../../is-buffer/index.js":438,"bs58":141,"peer-id":674,"peer-info":675}],674:[function(require,module,exports){ (function (Buffer){ /* * Id is an object representation of a peer Id. a peer Id is a multihash @@ -113967,7 +114762,7 @@ function toB64Opt (val) { } }).call(this,require("buffer").Buffer) -},{"assert":33,"async/waterfall":73,"buffer":144,"libp2p-crypto":478,"multihashes":624}],678:[function(require,module,exports){ +},{"assert":33,"async/waterfall":73,"buffer":144,"libp2p-crypto":483,"multihashes":621}],675:[function(require,module,exports){ 'use strict' const Id = require('peer-id') @@ -114030,7 +114825,7 @@ PeerInfo.isPeerInfo = (peerInfo) => { module.exports = PeerInfo -},{"./multiaddr-set":679,"./utils":680,"assert":33,"peer-id":677}],679:[function(require,module,exports){ +},{"./multiaddr-set":676,"./utils":677,"assert":33,"peer-id":674}],676:[function(require,module,exports){ 'use strict' const ensureMultiaddr = require('./utils').ensureMultiaddr @@ -114130,7 +114925,7 @@ class MultiaddrSet { module.exports = MultiaddrSet -},{"./utils":680,"lodash.uniqby":561}],680:[function(require,module,exports){ +},{"./utils":677,"lodash.uniqby":558}],677:[function(require,module,exports){ 'use strict' const multiaddr = require('multiaddr') @@ -114147,7 +114942,7 @@ module.exports = { ensureMultiaddr: ensureMultiaddr } -},{"multiaddr":612}],681:[function(require,module,exports){ +},{"multiaddr":609}],678:[function(require,module,exports){ (function (process){ 'use strict'; @@ -114194,7 +114989,7 @@ function nextTick(fn, arg1, arg2, arg3) { } }).call(this,require('_process')) -},{"_process":682}],682:[function(require,module,exports){ +},{"_process":679}],679:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -114380,7 +115175,7 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],683:[function(require,module,exports){ +},{}],680:[function(require,module,exports){ (function (process){ var isPromise = require('is-promise') @@ -114481,7 +115276,7 @@ Promise.use = function (extension) { extensions.push(extension); }; }).call(this,require('_process')) -},{"_process":682,"is-promise":436}],684:[function(require,module,exports){ +},{"_process":679,"is-promise":441}],681:[function(require,module,exports){ /** PROMISIFY CALLBACK-STYLE FUNCTIONS TO ES6 PROMISES * * EXAMPLE: @@ -114549,7 +115344,7 @@ if (typeof exports === "undefined") { this["promisify"] = module.exports; } -},{}],685:[function(require,module,exports){ +},{}],682:[function(require,module,exports){ var parse = require('./parse') var stringify = require('./stringify') @@ -114557,7 +115352,7 @@ module.exports = parse module.exports.parse = parse module.exports.stringify = stringify -},{"./parse":686,"./stringify":687}],686:[function(require,module,exports){ +},{"./parse":683,"./stringify":684}],683:[function(require,module,exports){ var tokenize = require('./tokenize') var MAX_RANGE = 0x1FFFFFFF @@ -115267,7 +116062,7 @@ var parse = function (buf) { module.exports = parse -},{"./tokenize":688}],687:[function(require,module,exports){ +},{"./tokenize":685}],684:[function(require,module,exports){ var onfield = function (f, result) { var prefix = f.repeated ? 'repeated' : f.required ? 'required' : 'optional' if (f.type === 'map') prefix = 'map<' + f.map.from + ',' + f.map.to + '>' @@ -115461,7 +116256,7 @@ module.exports = function (schema) { return result.map(indent('')).join('\n') } -},{}],688:[function(require,module,exports){ +},{}],685:[function(require,module,exports){ module.exports = function (sch) { var noComments = function (line) { var i = line.indexOf('//') @@ -115500,7 +116295,7 @@ module.exports = function (sch) { .filter(noMultilineComments()) } -},{}],689:[function(require,module,exports){ +},{}],686:[function(require,module,exports){ /* eslint max-depth: 1 */ 'use strict' @@ -115734,7 +116529,7 @@ var defaultValue = function (f, def) { module.exports = compileDecode -},{"./utils":694,"varint":860}],690:[function(require,module,exports){ +},{"./utils":691,"varint":857}],687:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -115868,7 +116663,7 @@ function compileEncode (m, resolve, enc, oneofs, encodingLength) { module.exports = compileEncode }).call(this,require("buffer").Buffer) -},{"./utils":694,"buffer":144,"varint":860}],691:[function(require,module,exports){ +},{"./utils":691,"buffer":144,"varint":857}],688:[function(require,module,exports){ 'use strict' var defined = require('./utils').defined @@ -115972,7 +116767,7 @@ function compileEncodingLength (m, enc, oneofs) { module.exports = compileEncodingLength -},{"./utils":694,"varint":860}],692:[function(require,module,exports){ +},{"./utils":691,"varint":857}],689:[function(require,module,exports){ 'use strict' var varint = require('varint') @@ -116267,7 +117062,7 @@ exports.float = (function () { return encoder(5, encode, decode, encodingLength) })() -},{"safe-buffer":790,"signed-varint":813,"varint":860}],693:[function(require,module,exports){ +},{"safe-buffer":787,"signed-varint":810,"varint":857}],690:[function(require,module,exports){ 'use strict' var encodings = require('./encodings') @@ -116434,14 +117229,14 @@ module.exports = function (schema, extraEncodings) { })) } -},{"./decode":689,"./encode":690,"./encoding-length":691,"./encodings":692,"varint":860}],694:[function(require,module,exports){ +},{"./decode":686,"./encode":687,"./encoding-length":688,"./encodings":689,"varint":857}],691:[function(require,module,exports){ 'use strict' exports.defined = function (val) { return val !== null && val !== undefined && (typeof val !== 'number' || !isNaN(val)) } -},{}],695:[function(require,module,exports){ +},{}],692:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -116484,9 +117279,9 @@ module.exports = function (proto, opts) { } }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":433,"./compile":693,"protocol-buffers-schema":685}],696:[function(require,module,exports){ +},{"../../is-buffer/index.js":438,"./compile":690,"protocol-buffers-schema":682}],693:[function(require,module,exports){ arguments[4][226][0].apply(exports,arguments) -},{"dup":226}],697:[function(require,module,exports){ +},{"dup":226}],694:[function(require,module,exports){ exports.publicEncrypt = require('./publicEncrypt'); exports.privateDecrypt = require('./privateDecrypt'); @@ -116497,7 +117292,7 @@ exports.privateEncrypt = function privateEncrypt(key, buf) { exports.publicDecrypt = function publicDecrypt(key, buf) { return exports.privateDecrypt(key, buf, true); }; -},{"./privateDecrypt":699,"./publicEncrypt":700}],698:[function(require,module,exports){ +},{"./privateDecrypt":696,"./publicEncrypt":697}],695:[function(require,module,exports){ (function (Buffer){ var createHash = require('create-hash'); module.exports = function (seed, len) { @@ -116516,7 +117311,7 @@ function i2ops(c) { return out; } }).call(this,require("buffer").Buffer) -},{"buffer":144,"create-hash":153}],699:[function(require,module,exports){ +},{"buffer":144,"create-hash":153}],696:[function(require,module,exports){ (function (Buffer){ var parseKeys = require('parse-asn1'); var mgf = require('./mgf'); @@ -116627,7 +117422,7 @@ function compare(a, b){ return dif; } }).call(this,require("buffer").Buffer) -},{"./mgf":698,"./withPublic":701,"./xor":702,"bn.js":87,"browserify-rsa":118,"buffer":144,"create-hash":153,"parse-asn1":667}],700:[function(require,module,exports){ +},{"./mgf":695,"./withPublic":698,"./xor":699,"bn.js":87,"browserify-rsa":118,"buffer":144,"create-hash":153,"parse-asn1":664}],697:[function(require,module,exports){ (function (Buffer){ var parseKeys = require('parse-asn1'); var randomBytes = require('randombytes'); @@ -116725,7 +117520,7 @@ function nonZero(len, crypto) { return out; } }).call(this,require("buffer").Buffer) -},{"./mgf":698,"./withPublic":701,"./xor":702,"bn.js":87,"browserify-rsa":118,"buffer":144,"create-hash":153,"parse-asn1":667,"randombytes":773}],701:[function(require,module,exports){ +},{"./mgf":695,"./withPublic":698,"./xor":699,"bn.js":87,"browserify-rsa":118,"buffer":144,"create-hash":153,"parse-asn1":664,"randombytes":770}],698:[function(require,module,exports){ (function (Buffer){ var bn = require('bn.js'); function withPublic(paddedMsg, key) { @@ -116738,7 +117533,7 @@ function withPublic(paddedMsg, key) { module.exports = withPublic; }).call(this,require("buffer").Buffer) -},{"bn.js":87,"buffer":144}],702:[function(require,module,exports){ +},{"bn.js":87,"buffer":144}],699:[function(require,module,exports){ module.exports = function xor(a, b) { var len = a.length; var i = -1; @@ -116747,7 +117542,7 @@ module.exports = function xor(a, b) { } return a }; -},{}],703:[function(require,module,exports){ +},{}],700:[function(require,module,exports){ 'use strict' const through = require('pull-through') @@ -116781,7 +117576,7 @@ module.exports = function block (_maxLength) { ) } -},{"pull-through":757}],704:[function(require,module,exports){ +},{"pull-through":754}],701:[function(require,module,exports){ 'use strict' var through = require('pull-through') @@ -116870,7 +117665,7 @@ module.exports = function block (size, opts) { }) } -},{"pull-through":757,"safe-buffer":790}],705:[function(require,module,exports){ +},{"pull-through":754,"safe-buffer":787}],702:[function(require,module,exports){ var noop = function () {} function abortAll(ary, abort, cb) { @@ -116913,7 +117708,7 @@ module.exports = function (streams) { -},{}],706:[function(require,module,exports){ +},{}],703:[function(require,module,exports){ module.exports = function Catch (onError) { onError = onError || function noop () {} var errd @@ -116936,7 +117731,7 @@ module.exports = function Catch (onError) { } } -},{}],707:[function(require,module,exports){ +},{}],704:[function(require,module,exports){ var Source = require('./source') var Sink = require('./sink') @@ -116959,14 +117754,14 @@ module.exports = function () { } -},{"./sink":709,"./source":710}],708:[function(require,module,exports){ +},{"./sink":706,"./source":707}],705:[function(require,module,exports){ exports.source = require('./source') exports.through = require('./through') exports.sink = require('./sink') exports.duplex = require('./duplex') -},{"./duplex":707,"./sink":709,"./source":710,"./through":711}],709:[function(require,module,exports){ +},{"./duplex":704,"./sink":706,"./source":707,"./through":708}],706:[function(require,module,exports){ module.exports = function (stream) { var read, started = false, id = Math.random() @@ -116987,7 +117782,7 @@ module.exports = function (stream) { return consume } -},{}],710:[function(require,module,exports){ +},{}],707:[function(require,module,exports){ module.exports = function () { var _read, _cb, abortCb, _end @@ -117019,7 +117814,7 @@ module.exports = function () { } -},{}],711:[function(require,module,exports){ +},{}],708:[function(require,module,exports){ module.exports = function () { var read, reader, cb, abort, stream @@ -117049,7 +117844,7 @@ module.exports = function () { return delayed } -},{}],712:[function(require,module,exports){ +},{}],709:[function(require,module,exports){ var Reader = require('pull-reader') var Writer = require('pull-pushable') var cat = require('pull-cat') @@ -117100,7 +117895,7 @@ module.exports = function (opts, _cb) { } } -},{"pull-cat":705,"pull-pair":717,"pull-pushable":721,"pull-reader":722}],713:[function(require,module,exports){ +},{"pull-cat":702,"pull-pair":714,"pull-pushable":718,"pull-reader":719}],710:[function(require,module,exports){ 'use strict' const varint = require('varint') @@ -117225,7 +118020,7 @@ function readMessage (reader, size, cb) { }) } -},{"pull-pushable":721,"pull-reader":722,"safe-buffer":790,"varint":860}],714:[function(require,module,exports){ +},{"pull-pushable":718,"pull-reader":719,"safe-buffer":787,"varint":857}],711:[function(require,module,exports){ 'use strict' const Buffer = require('safe-buffer').Buffer @@ -117287,7 +118082,7 @@ function createPool () { return Buffer.alloc(poolSize) } -},{"safe-buffer":790,"varint":860}],715:[function(require,module,exports){ +},{"safe-buffer":787,"varint":857}],712:[function(require,module,exports){ 'use strict' const encode = require('./encode') @@ -117297,7 +118092,7 @@ exports.encode = encode exports.decode = d.decode exports.decodeFromReader = d.decodeFromReader -},{"./decode":713,"./encode":714}],716:[function(require,module,exports){ +},{"./decode":710,"./encode":711}],713:[function(require,module,exports){ /* @@ -117433,7 +118228,7 @@ module.exports = function (ary) { } -},{}],717:[function(require,module,exports){ +},{}],714:[function(require,module,exports){ 'use strict' //a pair of pull streams where one drains from the other @@ -117465,7 +118260,7 @@ module.exports = function () { } -},{}],718:[function(require,module,exports){ +},{}],715:[function(require,module,exports){ var looper = require('looper') module.exports = function (map, width, inOrder) { inOrder = inOrder === undefined ? true : inOrder @@ -117535,7 +118330,7 @@ module.exports = function (map, width, inOrder) { } -},{"looper":719}],719:[function(require,module,exports){ +},{"looper":716}],716:[function(require,module,exports){ module.exports = function (fn) { @@ -117561,7 +118356,7 @@ module.exports = function (fn) { -},{}],720:[function(require,module,exports){ +},{}],717:[function(require,module,exports){ module.exports = function (onPause) { @@ -117598,7 +118393,7 @@ module.exports = function (onPause) { -},{}],721:[function(require,module,exports){ +},{}],718:[function(require,module,exports){ module.exports = pullPushable function pullPushable (separated, onClose) { @@ -117687,7 +118482,7 @@ function pullPushable (separated, onClose) { } } -},{}],722:[function(require,module,exports){ +},{}],719:[function(require,module,exports){ 'use strict' var State = require('./state') @@ -117811,7 +118606,7 @@ module.exports = function (timeout) { -},{"./state":723}],723:[function(require,module,exports){ +},{"./state":720}],720:[function(require,module,exports){ (function (Buffer){ module.exports = function () { @@ -117888,7 +118683,7 @@ module.exports = function () { }).call(this,require("buffer").Buffer) -},{"buffer":144}],724:[function(require,module,exports){ +},{"buffer":144}],721:[function(require,module,exports){ var Source = require('pull-defer/source') var pull = require('pull-stream') @@ -117908,7 +118703,7 @@ module.exports = function (compare) { } -},{"pull-defer/source":710,"pull-stream":726}],725:[function(require,module,exports){ +},{"pull-defer/source":707,"pull-stream":723}],722:[function(require,module,exports){ (function (process){ var Stream = require('stream') @@ -118062,7 +118857,7 @@ function duplex (reader, read) { } }).call(this,require('_process')) -},{"_process":682,"stream":833}],726:[function(require,module,exports){ +},{"_process":679,"stream":830}],723:[function(require,module,exports){ 'use strict' var sources = require('./sources') @@ -118083,7 +118878,7 @@ for(var k in sinks) exports[k] = sinks[k] -},{"./pull":727,"./sinks":732,"./sources":739,"./throughs":748}],727:[function(require,module,exports){ +},{"./pull":724,"./sinks":729,"./sources":736,"./throughs":745}],724:[function(require,module,exports){ 'use strict' module.exports = function pull (a) { @@ -118134,7 +118929,7 @@ module.exports = function pull (a) { return read } -},{}],728:[function(require,module,exports){ +},{}],725:[function(require,module,exports){ 'use strict' var reduce = require('./reduce') @@ -118146,7 +118941,7 @@ module.exports = function collect (cb) { }, [], cb) } -},{"./reduce":735}],729:[function(require,module,exports){ +},{"./reduce":732}],726:[function(require,module,exports){ 'use strict' var reduce = require('./reduce') @@ -118157,7 +118952,7 @@ module.exports = function concat (cb) { }, '', cb) } -},{"./reduce":735}],730:[function(require,module,exports){ +},{"./reduce":732}],727:[function(require,module,exports){ 'use strict' module.exports = function drain (op, done) { @@ -118207,7 +119002,7 @@ module.exports = function drain (op, done) { return sink } -},{}],731:[function(require,module,exports){ +},{}],728:[function(require,module,exports){ 'use strict' function id (e) { return e } @@ -118237,7 +119032,7 @@ module.exports = function find (test, cb) { -},{"../util/prop":755,"./drain":730}],732:[function(require,module,exports){ +},{"../util/prop":752,"./drain":727}],729:[function(require,module,exports){ 'use strict' module.exports = { @@ -118251,7 +119046,7 @@ module.exports = { } -},{"./collect":728,"./concat":729,"./drain":730,"./find":731,"./log":733,"./on-end":734,"./reduce":735}],733:[function(require,module,exports){ +},{"./collect":725,"./concat":726,"./drain":727,"./find":728,"./log":730,"./on-end":731,"./reduce":732}],730:[function(require,module,exports){ 'use strict' var drain = require('./drain') @@ -118262,7 +119057,7 @@ module.exports = function log (done) { }, done) } -},{"./drain":730}],734:[function(require,module,exports){ +},{"./drain":727}],731:[function(require,module,exports){ 'use strict' var drain = require('./drain') @@ -118271,7 +119066,7 @@ module.exports = function onEnd (done) { return drain(null, done) } -},{"./drain":730}],735:[function(require,module,exports){ +},{"./drain":727}],732:[function(require,module,exports){ 'use strict' var drain = require('./drain') @@ -118295,7 +119090,7 @@ module.exports = function reduce (reducer, acc, cb ) { return sink } -},{"./drain":730}],736:[function(require,module,exports){ +},{"./drain":727}],733:[function(require,module,exports){ 'use strict' module.exports = function count (max) { @@ -118310,7 +119105,7 @@ module.exports = function count (max) { -},{}],737:[function(require,module,exports){ +},{}],734:[function(require,module,exports){ 'use strict' //a stream that ends immediately. module.exports = function empty () { @@ -118319,7 +119114,7 @@ module.exports = function empty () { } } -},{}],738:[function(require,module,exports){ +},{}],735:[function(require,module,exports){ 'use strict' //a stream that errors immediately. module.exports = function error (err) { @@ -118329,7 +119124,7 @@ module.exports = function error (err) { } -},{}],739:[function(require,module,exports){ +},{}],736:[function(require,module,exports){ 'use strict' module.exports = { keys: require('./keys'), @@ -118341,7 +119136,7 @@ module.exports = { error: require('./error') } -},{"./count":736,"./empty":737,"./error":738,"./infinite":740,"./keys":741,"./once":742,"./values":743}],740:[function(require,module,exports){ +},{"./count":733,"./empty":734,"./error":735,"./infinite":737,"./keys":738,"./once":739,"./values":740}],737:[function(require,module,exports){ 'use strict' module.exports = function infinite (generate) { generate = generate || Math.random @@ -118353,7 +119148,7 @@ module.exports = function infinite (generate) { -},{}],741:[function(require,module,exports){ +},{}],738:[function(require,module,exports){ 'use strict' var values = require('./values') module.exports = function (object) { @@ -118362,7 +119157,7 @@ module.exports = function (object) { -},{"./values":743}],742:[function(require,module,exports){ +},{"./values":740}],739:[function(require,module,exports){ 'use strict' var abortCb = require('../util/abort-cb') @@ -118380,7 +119175,7 @@ module.exports = function once (value, onAbort) { -},{"../util/abort-cb":754}],743:[function(require,module,exports){ +},{"../util/abort-cb":751}],740:[function(require,module,exports){ 'use strict' var abortCb = require('../util/abort-cb') @@ -118405,7 +119200,7 @@ module.exports = function values (array, onAbort) { } } -},{"../util/abort-cb":754}],744:[function(require,module,exports){ +},{"../util/abort-cb":751}],741:[function(require,module,exports){ 'use strict' function id (e) { return e } @@ -118450,7 +119245,7 @@ module.exports = function asyncMap (map) { -},{"../util/prop":755}],745:[function(require,module,exports){ +},{"../util/prop":752}],742:[function(require,module,exports){ 'use strict' var tester = require('../util/tester') @@ -118461,7 +119256,7 @@ module.exports = function filterNot (test) { return filter(function (data) { return !test(data) }) } -},{"../util/tester":756,"./filter":746}],746:[function(require,module,exports){ +},{"../util/tester":753,"./filter":743}],743:[function(require,module,exports){ 'use strict' var tester = require('../util/tester') @@ -118487,7 +119282,7 @@ module.exports = function filter (test) { } -},{"../util/tester":756}],747:[function(require,module,exports){ +},{"../util/tester":753}],744:[function(require,module,exports){ 'use strict' var values = require('../sources/values') @@ -118536,7 +119331,7 @@ module.exports = function flatten () { } -},{"../sources/once":742,"../sources/values":743}],748:[function(require,module,exports){ +},{"../sources/once":739,"../sources/values":740}],745:[function(require,module,exports){ 'use strict' module.exports = { @@ -118554,7 +119349,7 @@ module.exports = { -},{"./async-map":744,"./filter":746,"./filter-not":745,"./flatten":747,"./map":749,"./non-unique":750,"./take":751,"./through":752,"./unique":753}],749:[function(require,module,exports){ +},{"./async-map":741,"./filter":743,"./filter-not":742,"./flatten":744,"./map":746,"./non-unique":747,"./take":748,"./through":749,"./unique":750}],746:[function(require,module,exports){ 'use strict' function id (e) { return e } @@ -118579,7 +119374,7 @@ module.exports = function map (mapper) { } } -},{"../util/prop":755}],750:[function(require,module,exports){ +},{"../util/prop":752}],747:[function(require,module,exports){ 'use strict' var unique = require('./unique') @@ -118589,7 +119384,7 @@ module.exports = function nonUnique (field) { return unique(field, true) } -},{"./unique":753}],751:[function(require,module,exports){ +},{"./unique":750}],748:[function(require,module,exports){ 'use strict' //read a number of items and then stop. @@ -118632,7 +119427,7 @@ module.exports = function take (test, opts) { } } -},{}],752:[function(require,module,exports){ +},{}],749:[function(require,module,exports){ 'use strict' //a pass through stream that doesn't change the value. @@ -118657,7 +119452,7 @@ module.exports = function through (op, onEnd) { } } -},{}],753:[function(require,module,exports){ +},{}],750:[function(require,module,exports){ 'use strict' function id (e) { return e } @@ -118677,7 +119472,7 @@ module.exports = function unique (field, invert) { } -},{"../util/prop":755,"./filter":746}],754:[function(require,module,exports){ +},{"../util/prop":752,"./filter":743}],751:[function(require,module,exports){ module.exports = function abortCb(cb, abort, onAbort) { cb(abort) onAbort && onAbort(abort === true ? null: abort) @@ -118685,7 +119480,7 @@ module.exports = function abortCb(cb, abort, onAbort) { } -},{}],755:[function(require,module,exports){ +},{}],752:[function(require,module,exports){ module.exports = function prop (key) { return key && ( 'string' == typeof key @@ -118696,7 +119491,7 @@ module.exports = function prop (key) { ) } -},{}],756:[function(require,module,exports){ +},{}],753:[function(require,module,exports){ var prop = require('./prop') function id (e) { return e } @@ -118709,7 +119504,7 @@ module.exports = function tester (test) { ) } -},{"./prop":755}],757:[function(require,module,exports){ +},{"./prop":752}],754:[function(require,module,exports){ var looper = require('looper') module.exports = function (writer, ender) { @@ -118780,7 +119575,7 @@ module.exports = function (writer, ender) { } -},{"looper":600}],758:[function(require,module,exports){ +},{"looper":597}],755:[function(require,module,exports){ var once = exports.once = function (value) { @@ -118873,7 +119668,7 @@ function (start, createStream) { } -},{}],759:[function(require,module,exports){ +},{}],756:[function(require,module,exports){ //another idea: buffer 2* the max, but only call write with half of that, //this could manage cases where the read ahead is latent. Hmm, we probably //shouldn't guess at that here, just handle write latency. @@ -118965,9 +119760,9 @@ module.exports = function (write, reduce, max, cb) { } -},{"looper":760}],760:[function(require,module,exports){ -arguments[4][719][0].apply(exports,arguments) -},{"dup":719}],761:[function(require,module,exports){ +},{"looper":757}],757:[function(require,module,exports){ +arguments[4][716][0].apply(exports,arguments) +},{"dup":716}],758:[function(require,module,exports){ 'use strict'; //load websocket library if we are not in the browser @@ -119007,7 +119802,7 @@ module.exports = function (addr, opts) { module.exports.connect = module.exports -},{"./duplex":762,"./web-socket":766,"./ws-url":767}],762:[function(require,module,exports){ +},{"./duplex":759,"./web-socket":763,"./ws-url":764}],759:[function(require,module,exports){ var source = require('./source') var sink = require('./sink') @@ -119032,7 +119827,7 @@ function duplex (ws, opts) { }; -},{"./sink":764,"./source":765}],763:[function(require,module,exports){ +},{"./sink":761,"./source":762}],760:[function(require,module,exports){ module.exports = function(socket, callback) { var remove = socket && (socket.removeEventListener || socket.removeListener); @@ -119065,7 +119860,7 @@ module.exports = function(socket, callback) { socket.addEventListener('error', handleErr); }; -},{}],764:[function(require,module,exports){ +},{}],761:[function(require,module,exports){ (function (process){ var ready = require('./ready'); @@ -119123,7 +119918,7 @@ module.exports = function(socket, opts) { } }).call(this,require('_process')) -},{"./ready":763,"_process":682}],765:[function(require,module,exports){ +},{"./ready":760,"_process":679}],762:[function(require,module,exports){ /** ### `source(socket)` @@ -119211,11 +120006,11 @@ module.exports = function(socket, cb) { return read; }; -},{"safe-buffer":790}],766:[function(require,module,exports){ +},{"safe-buffer":787}],763:[function(require,module,exports){ module.exports = 'undefined' === typeof WebSocket ? require('ws') : WebSocket -},{"ws":98}],767:[function(require,module,exports){ +},{"ws":98}],764:[function(require,module,exports){ var rurl = require('relative-url') var map = {http:'ws', https:'wss'} var def = 'ws' @@ -119225,7 +120020,7 @@ module.exports = function (url, location) { -},{"relative-url":787}],768:[function(require,module,exports){ +},{"relative-url":784}],765:[function(require,module,exports){ var once = require('once') var eos = require('end-of-stream') var fs = require('fs') // we only need fs to get the ReadStream and WriteStream prototypes @@ -119307,7 +120102,7 @@ var pump = function () { module.exports = pump -},{"end-of-stream":209,"fs":98,"once":661}],769:[function(require,module,exports){ +},{"end-of-stream":209,"fs":98,"once":658}],766:[function(require,module,exports){ (function (global){ /*! https://mths.be/punycode v1.4.1 by @mathias */ ;(function(root) { @@ -119844,7 +120639,7 @@ module.exports = pump }(this)); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],770:[function(require,module,exports){ +},{}],767:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -119930,7 +120725,7 @@ var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; -},{}],771:[function(require,module,exports){ +},{}],768:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -120017,13 +120812,13 @@ var objectKeys = Object.keys || function (obj) { return res; }; -},{}],772:[function(require,module,exports){ +},{}],769:[function(require,module,exports){ 'use strict'; exports.decode = exports.parse = require('./decode'); exports.encode = exports.stringify = require('./encode'); -},{"./decode":770,"./encode":771}],773:[function(require,module,exports){ +},{"./decode":767,"./encode":768}],770:[function(require,module,exports){ (function (process,global){ 'use strict' @@ -120065,10 +120860,10 @@ function randomBytes (size, cb) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":682,"safe-buffer":790}],774:[function(require,module,exports){ +},{"_process":679,"safe-buffer":787}],771:[function(require,module,exports){ module.exports = require('./lib/_stream_duplex.js'); -},{"./lib/_stream_duplex.js":775}],775:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":772}],772:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -120193,7 +120988,7 @@ function forEach(xs, f) { f(xs[i], i); } } -},{"./_stream_readable":777,"./_stream_writable":779,"core-util-is":151,"inherits":287,"process-nextick-args":681}],776:[function(require,module,exports){ +},{"./_stream_readable":774,"./_stream_writable":776,"core-util-is":151,"inherits":287,"process-nextick-args":678}],773:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -120241,7 +121036,7 @@ function PassThrough(options) { PassThrough.prototype._transform = function (chunk, encoding, cb) { cb(null, chunk); }; -},{"./_stream_transform":778,"core-util-is":151,"inherits":287}],777:[function(require,module,exports){ +},{"./_stream_transform":775,"core-util-is":151,"inherits":287}],774:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -121251,7 +122046,7 @@ function indexOf(xs, x) { return -1; } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./_stream_duplex":775,"./internal/streams/BufferList":780,"./internal/streams/destroy":781,"./internal/streams/stream":782,"_process":682,"core-util-is":151,"events":236,"inherits":287,"isarray":438,"process-nextick-args":681,"safe-buffer":790,"string_decoder/":840,"util":98}],778:[function(require,module,exports){ +},{"./_stream_duplex":772,"./internal/streams/BufferList":777,"./internal/streams/destroy":778,"./internal/streams/stream":779,"_process":679,"core-util-is":151,"events":236,"inherits":287,"isarray":443,"process-nextick-args":678,"safe-buffer":787,"string_decoder/":837,"util":98}],775:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -121466,7 +122261,7 @@ function done(stream, er, data) { return stream.push(null); } -},{"./_stream_duplex":775,"core-util-is":151,"inherits":287}],779:[function(require,module,exports){ +},{"./_stream_duplex":772,"core-util-is":151,"inherits":287}],776:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -122133,7 +122928,7 @@ Writable.prototype._destroy = function (err, cb) { cb(err); }; }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./_stream_duplex":775,"./internal/streams/destroy":781,"./internal/streams/stream":782,"_process":682,"core-util-is":151,"inherits":287,"process-nextick-args":681,"safe-buffer":790,"util-deprecate":850}],780:[function(require,module,exports){ +},{"./_stream_duplex":772,"./internal/streams/destroy":778,"./internal/streams/stream":779,"_process":679,"core-util-is":151,"inherits":287,"process-nextick-args":678,"safe-buffer":787,"util-deprecate":847}],777:[function(require,module,exports){ 'use strict'; /**/ @@ -122208,7 +123003,7 @@ module.exports = function () { return BufferList; }(); -},{"safe-buffer":790}],781:[function(require,module,exports){ +},{"safe-buffer":787}],778:[function(require,module,exports){ 'use strict'; /**/ @@ -122281,13 +123076,13 @@ module.exports = { destroy: destroy, undestroy: undestroy }; -},{"process-nextick-args":681}],782:[function(require,module,exports){ +},{"process-nextick-args":678}],779:[function(require,module,exports){ module.exports = require('events').EventEmitter; -},{"events":236}],783:[function(require,module,exports){ +},{"events":236}],780:[function(require,module,exports){ module.exports = require('./readable').PassThrough -},{"./readable":784}],784:[function(require,module,exports){ +},{"./readable":781}],781:[function(require,module,exports){ exports = module.exports = require('./lib/_stream_readable.js'); exports.Stream = exports; exports.Readable = exports; @@ -122296,13 +123091,13 @@ exports.Duplex = require('./lib/_stream_duplex.js'); exports.Transform = require('./lib/_stream_transform.js'); exports.PassThrough = require('./lib/_stream_passthrough.js'); -},{"./lib/_stream_duplex.js":775,"./lib/_stream_passthrough.js":776,"./lib/_stream_readable.js":777,"./lib/_stream_transform.js":778,"./lib/_stream_writable.js":779}],785:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":772,"./lib/_stream_passthrough.js":773,"./lib/_stream_readable.js":774,"./lib/_stream_transform.js":775,"./lib/_stream_writable.js":776}],782:[function(require,module,exports){ module.exports = require('./readable').Transform -},{"./readable":784}],786:[function(require,module,exports){ +},{"./readable":781}],783:[function(require,module,exports){ module.exports = require('./lib/_stream_writable.js'); -},{"./lib/_stream_writable.js":779}],787:[function(require,module,exports){ +},{"./lib/_stream_writable.js":776}],784:[function(require,module,exports){ //normalize a ws url. var URL = require('url') @@ -122400,7 +123195,7 @@ module.exports = function (url, location, protocolMap, defaultProtocol) { -},{"url":848}],788:[function(require,module,exports){ +},{"url":845}],785:[function(require,module,exports){ (function (Buffer){ 'use strict' var inherits = require('inherits') @@ -122695,7 +123490,7 @@ function fn5 (a, b, c, d, e, m, k, s) { module.exports = RIPEMD160 }).call(this,require("buffer").Buffer) -},{"buffer":144,"hash-base":245,"inherits":287}],789:[function(require,module,exports){ +},{"buffer":144,"hash-base":245,"inherits":287}],786:[function(require,module,exports){ (function (Buffer){ const assert = require('assert') /** @@ -122928,7 +123723,7 @@ function toBuffer (v) { } }).call(this,require("buffer").Buffer) -},{"assert":33,"buffer":144}],790:[function(require,module,exports){ +},{"assert":33,"buffer":144}],787:[function(require,module,exports){ /* eslint-disable node/no-deprecated-api */ var buffer = require('buffer') var Buffer = buffer.Buffer @@ -122992,15 +123787,15 @@ SafeBuffer.allocUnsafeSlow = function (size) { return buffer.SlowBuffer(size) } -},{"buffer":144}],791:[function(require,module,exports){ +},{"buffer":144}],788:[function(require,module,exports){ 'use strict' module.exports = require('./lib')(require('./lib/elliptic')) -},{"./lib":796,"./lib/elliptic":795}],792:[function(require,module,exports){ +},{"./lib":793,"./lib/elliptic":792}],789:[function(require,module,exports){ 'use strict' module.exports = require('./lib')(require('./lib/js')) -},{"./lib":796,"./lib/js":802}],793:[function(require,module,exports){ +},{"./lib":793,"./lib/js":799}],790:[function(require,module,exports){ (function (Buffer){ 'use strict' var toString = Object.prototype.toString @@ -123048,7 +123843,7 @@ exports.isNumberInInterval = function (number, x, y, message) { } }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":433}],794:[function(require,module,exports){ +},{"../../is-buffer/index.js":438}],791:[function(require,module,exports){ 'use strict' var Buffer = require('safe-buffer').Buffer var bip66 = require('bip66') @@ -123248,7 +124043,7 @@ exports.signatureImportLax = function (sig) { return { r: r, s: s } } -},{"bip66":81,"safe-buffer":790}],795:[function(require,module,exports){ +},{"bip66":81,"safe-buffer":787}],792:[function(require,module,exports){ 'use strict' var Buffer = require('safe-buffer').Buffer var createHash = require('create-hash') @@ -123498,7 +124293,7 @@ exports.ecdhUnsafe = function (publicKey, privateKey, compressed) { return Buffer.from(pair.pub.mul(scalar).encode(true, compressed)) } -},{"../messages.json":803,"bn.js":87,"create-hash":153,"elliptic":191,"safe-buffer":790}],796:[function(require,module,exports){ +},{"../messages.json":800,"bn.js":87,"create-hash":153,"elliptic":191,"safe-buffer":787}],793:[function(require,module,exports){ 'use strict' var assert = require('./assert') var der = require('./der') @@ -123731,7 +124526,7 @@ module.exports = function (secp256k1) { } } -},{"./assert":793,"./der":794,"./messages.json":803}],797:[function(require,module,exports){ +},{"./assert":790,"./der":791,"./messages.json":800}],794:[function(require,module,exports){ 'use strict' var Buffer = require('safe-buffer').Buffer var optimized = require('./optimized') @@ -124395,7 +125190,7 @@ BN.tmp.words = new Array(10) module.exports = BN -},{"./optimized":798,"safe-buffer":790}],798:[function(require,module,exports){ +},{"./optimized":795,"safe-buffer":787}],795:[function(require,module,exports){ 'use strict' exports.umulTo10x10 = function (num1, num2, out) { var a = num1.words @@ -124969,7 +125764,7 @@ exports.umulTo10x10 = function (num1, num2, out) { return out } -},{}],799:[function(require,module,exports){ +},{}],796:[function(require,module,exports){ 'use strict' var BN = require('./bn') @@ -125150,7 +125945,7 @@ Object.defineProperty(ECJPoint.prototype, 'inf', { module.exports = ECJPoint -},{"./bn":797}],800:[function(require,module,exports){ +},{"./bn":794}],797:[function(require,module,exports){ 'use strict' var Buffer = require('safe-buffer').Buffer var BN = require('./bn') @@ -125334,7 +126129,7 @@ ECPoint.prototype._getNAFPoints = function (wnd) { module.exports = ECPoint -},{"./bn":797,"./ecjpoint":799,"safe-buffer":790}],801:[function(require,module,exports){ +},{"./bn":794,"./ecjpoint":796,"safe-buffer":787}],798:[function(require,module,exports){ 'use strict' var Buffer = require('safe-buffer').Buffer var BN = require('./bn') @@ -125452,7 +126247,7 @@ ECPointG.prototype.mulAdd = function (k1, p2, k2) { module.exports = new ECPointG() -},{"./bn":797,"./ecjpoint":799,"./ecpoint":800,"safe-buffer":790}],802:[function(require,module,exports){ +},{"./bn":794,"./ecjpoint":796,"./ecpoint":797,"safe-buffer":787}],799:[function(require,module,exports){ 'use strict' var Buffer = require('safe-buffer').Buffer var createHash = require('create-hash') @@ -125679,7 +126474,7 @@ exports.ecdhUnsafe = function (publicKey, privateKey, compressed) { return point.mul(scalar).toPublicKey(compressed) } -},{"../messages.json":803,"./bn":797,"./ecpoint":800,"./ecpointg":801,"create-hash":153,"drbg.js/hmac":188,"safe-buffer":790}],803:[function(require,module,exports){ +},{"../messages.json":800,"./bn":794,"./ecpoint":797,"./ecpointg":798,"create-hash":153,"drbg.js/hmac":188,"safe-buffer":787}],800:[function(require,module,exports){ module.exports={ "COMPRESSED_TYPE_INVALID": "compressed should be a boolean", "EC_PRIVATE_KEY_TYPE_INVALID": "private key should be a Buffer", @@ -125717,7 +126512,7 @@ module.exports={ "TWEAK_LENGTH_INVALID": "tweak length is invalid" } -},{}],804:[function(require,module,exports){ +},{}],801:[function(require,module,exports){ (function (process){ exports = module.exports = SemVer; @@ -127017,7 +127812,7 @@ function intersects(r1, r2, loose) { } }).call(this,require('_process')) -},{"_process":682}],805:[function(require,module,exports){ +},{"_process":679}],802:[function(require,module,exports){ (function (Buffer){ // prototype class for hash functions function Hash (blockSize, finalSize) { @@ -127090,7 +127885,7 @@ Hash.prototype._update = function () { module.exports = Hash }).call(this,require("buffer").Buffer) -},{"buffer":144}],806:[function(require,module,exports){ +},{"buffer":144}],803:[function(require,module,exports){ var exports = module.exports = function SHA (algorithm) { algorithm = algorithm.toLowerCase() @@ -127107,7 +127902,7 @@ exports.sha256 = require('./sha256') exports.sha384 = require('./sha384') exports.sha512 = require('./sha512') -},{"./sha":807,"./sha1":808,"./sha224":809,"./sha256":810,"./sha384":811,"./sha512":812}],807:[function(require,module,exports){ +},{"./sha":804,"./sha1":805,"./sha224":806,"./sha256":807,"./sha384":808,"./sha512":809}],804:[function(require,module,exports){ (function (Buffer){ /* * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined @@ -127204,7 +127999,7 @@ Sha.prototype._hash = function () { module.exports = Sha }).call(this,require("buffer").Buffer) -},{"./hash":805,"buffer":144,"inherits":287}],808:[function(require,module,exports){ +},{"./hash":802,"buffer":144,"inherits":287}],805:[function(require,module,exports){ (function (Buffer){ /* * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined @@ -127306,7 +128101,7 @@ Sha1.prototype._hash = function () { module.exports = Sha1 }).call(this,require("buffer").Buffer) -},{"./hash":805,"buffer":144,"inherits":287}],809:[function(require,module,exports){ +},{"./hash":802,"buffer":144,"inherits":287}],806:[function(require,module,exports){ (function (Buffer){ /** * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined @@ -127362,7 +128157,7 @@ Sha224.prototype._hash = function () { module.exports = Sha224 }).call(this,require("buffer").Buffer) -},{"./hash":805,"./sha256":810,"buffer":144,"inherits":287}],810:[function(require,module,exports){ +},{"./hash":802,"./sha256":807,"buffer":144,"inherits":287}],807:[function(require,module,exports){ (function (Buffer){ /** * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined @@ -127500,7 +128295,7 @@ Sha256.prototype._hash = function () { module.exports = Sha256 }).call(this,require("buffer").Buffer) -},{"./hash":805,"buffer":144,"inherits":287}],811:[function(require,module,exports){ +},{"./hash":802,"buffer":144,"inherits":287}],808:[function(require,module,exports){ (function (Buffer){ var inherits = require('inherits') var SHA512 = require('./sha512') @@ -127560,7 +128355,7 @@ Sha384.prototype._hash = function () { module.exports = Sha384 }).call(this,require("buffer").Buffer) -},{"./hash":805,"./sha512":812,"buffer":144,"inherits":287}],812:[function(require,module,exports){ +},{"./hash":802,"./sha512":809,"buffer":144,"inherits":287}],809:[function(require,module,exports){ (function (Buffer){ var inherits = require('inherits') var Hash = require('./hash') @@ -127823,7 +128618,7 @@ Sha512.prototype._hash = function () { module.exports = Sha512 }).call(this,require("buffer").Buffer) -},{"./hash":805,"buffer":144,"inherits":287}],813:[function(require,module,exports){ +},{"./hash":802,"buffer":144,"inherits":287}],810:[function(require,module,exports){ var varint = require('varint') exports.encode = function encode (v, b, o) { v = v >= 0 ? v*2 : v*-2 - 1 @@ -127841,7 +128636,7 @@ exports.encodingLength = function (v) { return varint.encodingLength(v >= 0 ? v*2 : v*-2 - 1) } -},{"varint":860}],814:[function(require,module,exports){ +},{"varint":857}],811:[function(require,module,exports){ (function (Buffer){ module.exports = Peer @@ -128647,11 +129442,11 @@ Peer.prototype._transformConstraints = function (constraints) { function noop () {} }).call(this,require("buffer").Buffer) -},{"buffer":144,"debug":815,"get-browser-rtc":241,"inherits":287,"randombytes":773,"readable-stream":784}],815:[function(require,module,exports){ +},{"buffer":144,"debug":812,"get-browser-rtc":241,"inherits":287,"randombytes":770,"readable-stream":781}],812:[function(require,module,exports){ arguments[4][219][0].apply(exports,arguments) -},{"./debug":816,"_process":682,"dup":219}],816:[function(require,module,exports){ +},{"./debug":813,"_process":679,"dup":219}],813:[function(require,module,exports){ arguments[4][220][0].apply(exports,arguments) -},{"dup":220,"ms":609}],817:[function(require,module,exports){ +},{"dup":220,"ms":606}],814:[function(require,module,exports){ (function (Buffer){ "use strict"; // The default Buffer size if one is not provided. @@ -129391,7 +130186,7 @@ class SmartBuffer { exports.SmartBuffer = SmartBuffer; }).call(this,require("buffer").Buffer) -},{"buffer":144}],818:[function(require,module,exports){ +},{"buffer":144}],815:[function(require,module,exports){ /** * Module dependencies. @@ -129487,7 +130282,7 @@ exports.connect = lookup; exports.Manager = require('./manager'); exports.Socket = require('./socket'); -},{"./manager":819,"./socket":821,"./url":822,"debug":823,"socket.io-parser":826}],819:[function(require,module,exports){ +},{"./manager":816,"./socket":818,"./url":819,"debug":820,"socket.io-parser":823}],816:[function(require,module,exports){ /** * Module dependencies. @@ -130062,7 +130857,7 @@ Manager.prototype.onreconnect = function () { this.emitAll('reconnect', attempt); }; -},{"./on":820,"./socket":821,"backo2":75,"component-bind":148,"component-emitter":149,"debug":823,"engine.io-client":210,"indexof":286,"socket.io-parser":826}],820:[function(require,module,exports){ +},{"./on":817,"./socket":818,"backo2":75,"component-bind":148,"component-emitter":149,"debug":820,"engine.io-client":210,"indexof":286,"socket.io-parser":823}],817:[function(require,module,exports){ /** * Module exports. @@ -130088,7 +130883,7 @@ function on (obj, ev, fn) { }; } -},{}],821:[function(require,module,exports){ +},{}],818:[function(require,module,exports){ /** * Module dependencies. @@ -130508,7 +131303,7 @@ Socket.prototype.compress = function (compress) { return this; }; -},{"./on":820,"component-bind":148,"component-emitter":149,"debug":823,"parseqs":668,"socket.io-parser":826,"to-array":844}],822:[function(require,module,exports){ +},{"./on":817,"component-bind":148,"component-emitter":149,"debug":820,"parseqs":665,"socket.io-parser":823,"to-array":841}],819:[function(require,module,exports){ (function (global){ /** @@ -130587,11 +131382,11 @@ function url (uri, loc) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"debug":823,"parseuri":669}],823:[function(require,module,exports){ +},{"debug":820,"parseuri":666}],820:[function(require,module,exports){ arguments[4][219][0].apply(exports,arguments) -},{"./debug":824,"_process":682,"dup":219}],824:[function(require,module,exports){ +},{"./debug":821,"_process":679,"dup":219}],821:[function(require,module,exports){ arguments[4][220][0].apply(exports,arguments) -},{"dup":220,"ms":609}],825:[function(require,module,exports){ +},{"dup":220,"ms":606}],822:[function(require,module,exports){ (function (global){ /*global Blob,File*/ @@ -130736,7 +131531,7 @@ exports.removeBlobs = function(data, callback) { }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./is-buffer":827,"isarray":830}],826:[function(require,module,exports){ +},{"./is-buffer":824,"isarray":827}],823:[function(require,module,exports){ /** * Module dependencies. @@ -131138,7 +131933,7 @@ function error() { }; } -},{"./binary":825,"./is-buffer":827,"component-emitter":149,"debug":828,"has-binary2":242}],827:[function(require,module,exports){ +},{"./binary":822,"./is-buffer":824,"component-emitter":149,"debug":825,"has-binary2":242}],824:[function(require,module,exports){ (function (global){ module.exports = isBuf; @@ -131155,13 +131950,13 @@ function isBuf(obj) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],828:[function(require,module,exports){ +},{}],825:[function(require,module,exports){ arguments[4][219][0].apply(exports,arguments) -},{"./debug":829,"_process":682,"dup":219}],829:[function(require,module,exports){ +},{"./debug":826,"_process":679,"dup":219}],826:[function(require,module,exports){ arguments[4][220][0].apply(exports,arguments) -},{"dup":220,"ms":609}],830:[function(require,module,exports){ +},{"dup":220,"ms":606}],827:[function(require,module,exports){ arguments[4][243][0].apply(exports,arguments) -},{"dup":243}],831:[function(require,module,exports){ +},{"dup":243}],828:[function(require,module,exports){ 'use strict' // JS treats subjects of bitwise operators as SIGNED 32 bit numbers, @@ -131410,7 +132205,7 @@ function sortInternal (a, b) { function valueOnly (elem) { return elem[1] } -},{}],832:[function(require,module,exports){ +},{}],829:[function(require,module,exports){ //! stable.js 0.1.6, https://github.com/Two-Screen/stable //! © 2017 Angry Bytes and contributors. MIT licensed. @@ -131523,7 +132318,7 @@ else { })(); -},{}],833:[function(require,module,exports){ +},{}],830:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -131652,7 +132447,7 @@ Stream.prototype.pipe = function(dest, options) { return dest; }; -},{"events":236,"inherits":287,"readable-stream/duplex.js":774,"readable-stream/passthrough.js":783,"readable-stream/readable.js":784,"readable-stream/transform.js":785,"readable-stream/writable.js":786}],834:[function(require,module,exports){ +},{"events":236,"inherits":287,"readable-stream/duplex.js":771,"readable-stream/passthrough.js":780,"readable-stream/readable.js":781,"readable-stream/transform.js":782,"readable-stream/writable.js":783}],831:[function(require,module,exports){ (function (global){ var ClientRequest = require('./lib/request') var extend = require('xtend') @@ -131734,7 +132529,7 @@ http.METHODS = [ 'UNSUBSCRIBE' ] }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./lib/request":836,"builtin-status-codes":145,"url":848,"xtend":865}],835:[function(require,module,exports){ +},{"./lib/request":833,"builtin-status-codes":145,"url":845,"xtend":862}],832:[function(require,module,exports){ (function (global){ exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream) @@ -131807,7 +132602,7 @@ function isFunction (value) { xhr = null // Help gc }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],836:[function(require,module,exports){ +},{}],833:[function(require,module,exports){ (function (process,global,Buffer){ var capability = require('./capability') var inherits = require('inherits') @@ -132117,7 +132912,7 @@ var unsafeHeaders = [ ] }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./capability":835,"./response":837,"_process":682,"buffer":144,"inherits":287,"readable-stream":784,"to-arraybuffer":845}],837:[function(require,module,exports){ +},{"./capability":832,"./response":834,"_process":679,"buffer":144,"inherits":287,"readable-stream":781,"to-arraybuffer":842}],834:[function(require,module,exports){ (function (process,global,Buffer){ var capability = require('./capability') var inherits = require('inherits') @@ -132303,7 +133098,7 @@ IncomingMessage.prototype._onXHRProgress = function () { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./capability":835,"_process":682,"buffer":144,"inherits":287,"readable-stream":784}],838:[function(require,module,exports){ +},{"./capability":832,"_process":679,"buffer":144,"inherits":287,"readable-stream":781}],835:[function(require,module,exports){ module.exports = shift function shift (stream) { @@ -132325,7 +133120,7 @@ function getStateLength (state) { return state.length } -},{}],839:[function(require,module,exports){ +},{}],836:[function(require,module,exports){ (function (process){ var pull = require('pull-stream/pull') var looper = require('looper') @@ -132566,7 +133361,7 @@ exports.transform = function (stream) { }).call(this,require('_process')) -},{"_process":682,"looper":600,"pull-stream/pull":727}],840:[function(require,module,exports){ +},{"_process":679,"looper":597,"pull-stream/pull":724}],837:[function(require,module,exports){ 'use strict'; var Buffer = require('safe-buffer').Buffer; @@ -132839,7 +133634,7 @@ function simpleWrite(buf) { function simpleEnd(buf) { return buf && buf.length ? this.write(buf) : ''; } -},{"safe-buffer":790}],841:[function(require,module,exports){ +},{"safe-buffer":787}],838:[function(require,module,exports){ var isHexPrefixed = require('is-hex-prefixed'); /** @@ -132855,7 +133650,7 @@ module.exports = function stripHexPrefix(str) { return isHexPrefixed(str) ? str.slice(2) : str; } -},{"is-hex-prefixed":435}],842:[function(require,module,exports){ +},{"is-hex-prefixed":440}],839:[function(require,module,exports){ 'use strict' const throttle = require('lodash.throttle') @@ -132914,7 +133709,7 @@ function getTimeElapsed (prevTime) { return Math.floor(a / 1000) } -},{"lodash.throttle":560}],843:[function(require,module,exports){ +},{"lodash.throttle":557}],840:[function(require,module,exports){ var nextTick = require('process/browser.js').nextTick; var apply = Function.prototype.apply; var slice = Array.prototype.slice; @@ -132991,7 +133786,7 @@ exports.setImmediate = typeof setImmediate === "function" ? setImmediate : funct exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { delete immediateIds[id]; }; -},{"process/browser.js":682}],844:[function(require,module,exports){ +},{"process/browser.js":679}],841:[function(require,module,exports){ module.exports = toArray function toArray(list, index) { @@ -133006,7 +133801,7 @@ function toArray(list, index) { return array } -},{}],845:[function(require,module,exports){ +},{}],842:[function(require,module,exports){ var Buffer = require('buffer').Buffer module.exports = function (buf) { @@ -133035,7 +133830,7 @@ module.exports = function (buf) { } } -},{"buffer":144}],846:[function(require,module,exports){ +},{"buffer":144}],843:[function(require,module,exports){ var traverse = module.exports = function (obj) { return new Traverse(obj); }; @@ -133351,7 +134146,7 @@ var hasOwnProperty = Object.hasOwnProperty || function (obj, key) { return key in obj; }; -},{}],847:[function(require,module,exports){ +},{}],844:[function(require,module,exports){ (function(nacl) { 'use strict'; @@ -135730,7 +136525,7 @@ nacl.setPRNG = function(fn) { })(typeof module !== 'undefined' && module.exports ? module.exports : (self.nacl = self.nacl || {})); -},{"crypto":98}],848:[function(require,module,exports){ +},{"crypto":98}],845:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -136464,7 +137259,7 @@ Url.prototype.parseHost = function() { if (host) this.hostname = host; }; -},{"./util":849,"punycode":769,"querystring":772}],849:[function(require,module,exports){ +},{"./util":846,"punycode":766,"querystring":769}],846:[function(require,module,exports){ 'use strict'; module.exports = { @@ -136482,7 +137277,7 @@ module.exports = { } }; -},{}],850:[function(require,module,exports){ +},{}],847:[function(require,module,exports){ (function (global){ /** @@ -136553,16 +137348,16 @@ function config (name) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],851:[function(require,module,exports){ +},{}],848:[function(require,module,exports){ arguments[4][287][0].apply(exports,arguments) -},{"dup":287}],852:[function(require,module,exports){ +},{"dup":287}],849:[function(require,module,exports){ module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; } -},{}],853:[function(require,module,exports){ +},{}],850:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -137152,7 +137947,7 @@ function hasOwnProperty(obj, prop) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":852,"_process":682,"inherits":851}],854:[function(require,module,exports){ +},{"./support/isBuffer":849,"_process":679,"inherits":848}],851:[function(require,module,exports){ /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX @@ -137177,7 +137972,7 @@ function bytesToUuid(buf, offset) { module.exports = bytesToUuid; -},{}],855:[function(require,module,exports){ +},{}],852:[function(require,module,exports){ (function (global){ // Unique ID creation requires a high quality random # generator. In the // browser this is a little complicated due to unknown quality of Math.random() @@ -137214,7 +138009,7 @@ if (!rng) { module.exports = rng; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],856:[function(require,module,exports){ +},{}],853:[function(require,module,exports){ var rng = require('./lib/rng'); var bytesToUuid = require('./lib/bytesToUuid'); @@ -137245,7 +138040,7 @@ function v4(options, buf, offset) { module.exports = v4; -},{"./lib/bytesToUuid":854,"./lib/rng":855}],857:[function(require,module,exports){ +},{"./lib/bytesToUuid":851,"./lib/rng":852}],854:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -137268,7 +138063,7 @@ module.exports = (buf) => { } }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":433,"varint":860}],858:[function(require,module,exports){ +},{"../../is-buffer/index.js":438,"varint":857}],855:[function(require,module,exports){ module.exports = read var MSB = 0x80 @@ -137299,13 +138094,13 @@ function read(buf, offset) { return res } -},{}],859:[function(require,module,exports){ -arguments[4][633][0].apply(exports,arguments) -},{"dup":633}],860:[function(require,module,exports){ -arguments[4][634][0].apply(exports,arguments) -},{"./decode.js":858,"./encode.js":859,"./length.js":861,"dup":634}],861:[function(require,module,exports){ -arguments[4][635][0].apply(exports,arguments) -},{"dup":635}],862:[function(require,module,exports){ +},{}],856:[function(require,module,exports){ +arguments[4][630][0].apply(exports,arguments) +},{"dup":630}],857:[function(require,module,exports){ +arguments[4][631][0].apply(exports,arguments) +},{"./decode.js":855,"./encode.js":856,"./length.js":858,"dup":631}],858:[function(require,module,exports){ +arguments[4][632][0].apply(exports,arguments) +},{"dup":632}],859:[function(require,module,exports){ var indexOf = require('indexof'); var Object_keys = function (obj) { @@ -137445,7 +138240,7 @@ exports.createContext = Script.createContext = function (context) { return copy; }; -},{"indexof":286}],863:[function(require,module,exports){ +},{"indexof":286}],860:[function(require,module,exports){ /* global self */ // created by @HenrikJoreteg @@ -137494,7 +138289,7 @@ module.exports = { getUserMedia: getUserMedia } -},{}],864:[function(require,module,exports){ +},{}],861:[function(require,module,exports){ // Returns a wrapper function that returns a wrapped callback // The wrapper function should do some stuff, and return a // presumably different callback function. @@ -137529,7 +138324,7 @@ function wrappy (fn, cb) { } } -},{}],865:[function(require,module,exports){ +},{}],862:[function(require,module,exports){ module.exports = extend var hasOwnProperty = Object.prototype.hasOwnProperty; @@ -137550,7 +138345,7 @@ function extend() { return target } -},{}],866:[function(require,module,exports){ +},{}],863:[function(require,module,exports){ /* global Y */ 'use strict' @@ -137907,7 +138702,7 @@ if (typeof Y !== 'undefined') { extend(Y) } -},{}],867:[function(require,module,exports){ +},{}],864:[function(require,module,exports){ /* global Y, IDBKeyRange, indexedDB, localStorage, IDBRequest, IDBOpenDBRequest, IDBCursor, IDBCursorWithValue, addEventListener */ 'use strict' // Thx to @jed for this script https://gist.github.com/jed/982883 @@ -138268,19 +139063,19 @@ if (typeof Y !== 'undefined') { extend(Y) } -},{}],868:[function(require,module,exports){ +},{}],865:[function(require,module,exports){ 'use strict' module.exports = (data) => JSON.parse(data.toString()) -},{}],869:[function(require,module,exports){ +},{}],866:[function(require,module,exports){ (function (Buffer){ 'use strict' module.exports = (message) => Buffer.from(JSON.stringify(message)) }).call(this,require("buffer").Buffer) -},{"buffer":144}],870:[function(require,module,exports){ +},{"buffer":144}],867:[function(require,module,exports){ /* global Y */ 'use strict' @@ -138481,7 +139276,7 @@ function localEncode (m) { return JSON.stringify(m) } -},{"./decode":868,"./encode":869,"async/queue":67,"async/setImmediate":70,"debug":168,"events":236,"ipfs-pubsub-room":319,"safe-buffer":790}],871:[function(require,module,exports){ +},{"./decode":865,"./encode":866,"async/queue":67,"async/setImmediate":70,"debug":168,"events":236,"ipfs-pubsub-room":319,"safe-buffer":787}],868:[function(require,module,exports){ /* global Y */ 'use strict' @@ -138555,7 +139350,7 @@ if (typeof Y !== 'undefined') { extend(Y) } -},{"./RedBlackTree.js":872}],872:[function(require,module,exports){ +},{"./RedBlackTree.js":869}],869:[function(require,module,exports){ 'use strict' /* @@ -139060,7 +139855,7 @@ module.exports = function (Y) { Y.utils.RBTree = RBTree } -},{}],873:[function(require,module,exports){ +},{}],870:[function(require,module,exports){ /* global Y, Element */ 'use strict' @@ -139640,7 +140435,7 @@ if (typeof Y !== 'undefined') { extend(Y) } -},{"fast-diff":238}],874:[function(require,module,exports){ +},{"fast-diff":238}],871:[function(require,module,exports){ 'use strict'; var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('') @@ -139710,11 +140505,11 @@ yeast.encode = encode; yeast.decode = decode; module.exports = yeast; -},{}],875:[function(require,module,exports){ +},{}],872:[function(require,module,exports){ arguments[4][219][0].apply(exports,arguments) -},{"./debug":876,"_process":682,"dup":219}],876:[function(require,module,exports){ +},{"./debug":873,"_process":679,"dup":219}],873:[function(require,module,exports){ arguments[4][220][0].apply(exports,arguments) -},{"dup":220,"ms":609}],877:[function(require,module,exports){ +},{"dup":220,"ms":606}],874:[function(require,module,exports){ function canRead (auth) { return auth === 'read' || auth === 'write' } function canWrite (auth) { return auth === 'write' } @@ -140201,7 +140996,7 @@ module.exports = function (Y/* :any */) { Y.AbstractConnector = AbstractConnector } -},{}],878:[function(require,module,exports){ +},{}],875:[function(require,module,exports){ /* global getRandom, async */ 'use strict' @@ -140381,7 +141176,7 @@ module.exports = function (Y) { Y.Test = Test } -},{}],879:[function(require,module,exports){ +},{}],876:[function(require,module,exports){ /* @flow */ 'use strict' @@ -140987,7 +141782,7 @@ module.exports = function (Y /* :any */) { Y.AbstractDatabase = AbstractDatabase } -},{}],880:[function(require,module,exports){ +},{}],877:[function(require,module,exports){ /* @flow */ 'use strict' @@ -141403,7 +142198,7 @@ module.exports = function (Y/* :any */) { Y.Struct = Struct } -},{}],881:[function(require,module,exports){ +},{}],878:[function(require,module,exports){ /* @flow */ 'use strict' @@ -142503,7 +143298,7 @@ module.exports = function (Y/* :any */) { Y.Transaction = TransactionInterface } -},{}],882:[function(require,module,exports){ +},{}],879:[function(require,module,exports){ /* @flow */ 'use strict' @@ -143300,7 +144095,7 @@ module.exports = function (Y /* : any*/) { Y.utils.generateGuid = generateGuid } -},{}],883:[function(require,module,exports){ +},{}],880:[function(require,module,exports){ /* @flow */ 'use strict' @@ -143539,4 +144334,4 @@ class YConfig { } } -},{"./Connector.js":877,"./Connectors/Test.js":878,"./Database.js":879,"./Struct.js":880,"./Transaction.js":881,"./Utils.js":882,"debug":875}]},{},[16]); +},{"./Connector.js":874,"./Connectors/Test.js":875,"./Database.js":876,"./Struct.js":877,"./Transaction.js":878,"./Utils.js":879,"debug":872}]},{},[16]); diff --git a/examples/example_keys.html b/examples/example_keys.html index ee1c03b..cfec2bc 100644 --- a/examples/example_keys.html +++ b/examples/example_keys.html @@ -100,7 +100,8 @@ hide('aclnew_div'); let dict = form2dict("newaclform"); //name let kc = document.getElementById('keylist_header').source; // The KeyChain being added to. - return Dweb.AccessControlList.p_new({name: dict.name, _acl: kc}, true, {keygen: true}, verbose, null, kc ); //(data, master, key, verbose, options, kc) + return Dweb.AccessControlList.p_new({name: dict.name, _acl: kc}, true, {keygen: true}, verbose, null, kc ) //(data, master, key, verbose, options, kc) + .then((acl) => _showkeyorlock(acl)); // Put in UI, as listmonitor return rejected as duplicate } function p_key_click(el) { if (verbose) console.log("p_key_click ---"); @@ -131,7 +132,7 @@ - +
Starting
    diff --git a/examples/example_styles.css b/examples/example_styles.css index 7e0d314..55aede4 100644 --- a/examples/example_styles.css +++ b/examples/example_styles.css @@ -68,3 +68,5 @@ .examplesacademic #metadataresults [name=doi_org_metadata_title] {font-weight: bold;} .examplesacademic #searchresults li {text-align: left; margin-bottom: 10px;} .examplesacademic #searchresults span {display: inline-block;}/*Try and keep each part together*/ + +.exampleskeys .inline_ul {display: grid; grid-template-columns: repeat(auto-fit, minmax(7em, 1fr)); grid-auto-flow: dense;} From 58cd5540587cd8e96ee42f872f2f86cf0279ed7d Mon Sep 17 00:00:00 2001 From: Mitra Ardron Date: Tue, 24 Oct 2017 12:08:31 -0700 Subject: [PATCH 2/4] Update README.md --- README.md | 162 ++++++++++++++++++++++++++---------------- examples/htmlutils.js | 4 +- examples/index.html | 1 + 3 files changed, 105 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index 7a14284..5d12767 100644 --- a/README.md +++ b/README.md @@ -2,83 +2,125 @@ Welcome to the Internet Archive's Decentralized Wed (Dweb) libraries. -## Running the examples -Once the source is checked out, you should be able to open any of the files: -[example_block.html](examples/example_block.html); -[example_smartdict.html](examples/example_smartdict.html); -[example_list.html](examples/example_list.html); -or [objbrowser.html](examples/objbrowser.html); -directly in your browser. +VERBOSE -IMPORTANT - DO THIS ON CHROME NOT ON FIREFOX - SEE "Major Issues" +## Running the examples +The examples can run either from the [dweb.me/examples](https://dweb.me/examples) server, +or once the source is checked out, locally from your file system. + +- example_block.html: [IPFS](https://dweb.me/examples/example_block.html) + or [HTTP](https://dweb.me/examples/example_block.html?transport=HTTP) +- example_smartdict.html: [IPFS](https://dweb.me/examples/example_smartdict.html) + or [HTTP](https://dweb.me/examples/example_smartdict.html?transport=HTTP); +- example_list.html: [IPFS](https://dweb.me/examples/example_list.html) + or [HTTP](https://dweb.me/examples/example_list.html?transport=HTTP) +- example_academic.html: [IPFS](https://dweb.me/examples/example_academic.html) + or [HTTP](https://dweb.me/examples/example_academic.html?transport=HTTP) +- example_keys.html: [IPFS](https://dweb.me/examples/example_keys.html) + or [HTTP](https://dweb.me/examples/example_keys.html?transport=HTTP); +- [objbrowser.html](https://dweb.me/examples/objbrowser.html); + +**Browser Support**: This should work on Chrome and Firefox (Safari doesn't support many newer features), +see below for IPFS bugs, + +**Verbosity**: You can get debugging output by appending verbose=true to the URLs, +this shows up in your console and also (for HTTP) in our server logs. ###BLOCK example -In your browser, open the file: examples/example_block.html -Type some text into the editor and hit Save -A hash should appear below. -If it doesn't then open the browser console (e.g. Firefox/tools/Web Developer/Web Console) -Click "FetchIt" and the data should be returned. +- In your browser, open examples/example_block.html: +[IPFS](https://dweb.me/examples/example_block.html) +or [HTTP](https://dweb.me/examples/example_block.html?transport=HTTP) +- Type some text into the editor and hit Save +- A hash should appear below. +- If it doesn't then run with the verbose argument +[IPFS](https://dweb.me/examples/example_block.html?verbose=true) +or [HTTP](https://dweb.me/examples/example_block.html?transport=HTTP&verbose=true) +and open the browser console (e.g. Firefox/tools/Web Developer/Web Console) +- Click "FetchIt" and the data should be returned. ###SMART DICT example -In your browser, open the file: examples/example_smartdict.html -Type some text into the name, and a HTML color nmae into the color (e.g. "red") and hit Save -A hash should appear below. -If it doesn't then open the browser console (e.g. Firefox/tools/Web Developer/Web Console) -Click "FetchIt" and the data should be returned and displayed. -Hover over "Object Browser" to see the structure of the object. +- In your browser, open example_smartdict.html +[IPFS](https://dweb.me/examples/example_smartdict.html) +or [HTTP](https://dweb.me/examples/example_smartdict.html?transport=HTTP); +- Type some text into the name, and a HTML color nmae into the color (e.g. "red") and hit Save +- A hash should appear below. +- Click "FetchIt" and the data should be returned and displayed. +- Hover over "Object Browser" to see the structure of the object. ###COMMON LIST example -In your browser, open the file: examples/example_smartdict.html -Click New and enter a name for your list -A blank list should appear along with the name and hashes (retrieved from Dweb) -Enter something in the text field and hit Send -The item should be announced to the list and appear in the text field above. - -The link icons next to the private hash can be opened on another machine and gives +- In your browser, open the file: example_list.html: +[IPFS](https://dweb.me/examples/example_list.html) +or [HTTP](https://dweb.me/examples/example_list.html?transport=HTTP) +- Click New and enter a name for your list +- A blank list should appear along with the name and hashes (retrieved from Dweb) +- Enter something in the text field and hit Send +- The item should be announced to the list and appear in the text field above. +- The link icons next to the private hash can be opened on another machine and gives the user ability to also write to the list. - -The link icon next to the public hash will only give them the ability to display the list. - -Hover over "Object Browser" to see the structure of the object. +- The link icon next to the public hash will only give them the ability to display the list. +- Hover over "Object Browser" to see the structure of the object. + +###ACADEMIC DOCS example + +This is a work in progress, dependent on the incompleteness of both the Academic Document virtual collection at Archive.org and +the bugs/issues in IPFS. + +- In your browser, open the file: example_academic.html: +[IPFS](https://dweb.me/examples/example_academic.html) +or [HTTP](https://dweb.me/examples/example_academic.html?transport=HTTP) +- Enter a search term +(use just one word, as there are problems with multi-word search) +- A list of papers should be returned, along with their DOI. +- Clicking on a DOI will find metadata on it. +(Currently (24Oct2017) we don't have most of those DOI's, so you probably won't see a location) +- Instead try DOI: 10.1001/jama.2009.1064 or DOI: 10.1002/asjc.98 +- As you search for these DOI's the paper is pushed into our contenthash server, and IPFS. +- You should see metadata on that paper, and a list of ways to receive it. +- The first three fetch from: the Archive's contenthash server; and from two IPFS http gateways. +- The last link fetches directly in the browser without coming to the Archive or any other single point of failure. +- (Unfortunately there is currently (24Oct2017) a problem with the IPFS API which means only one of those two DOI's above will work) ###AUTHENTICATION example -In your browser, open the file: examples/example_keys.html -Click on the "KeyChain icon" -Click on Register -Choose a name for your first keychain, remember exactly how you spelled and capitalised it. -Choose a long and complex passphrase that is easy for you to remember and hard for others to guess, ideally include numbers and punctuation, but you'll need to remember this exactly. +- In your browser, open the file: examples/example_keys.html: +[IPFS](https://dweb.me/examples/example_keys.html) +or [HTTP](https://dweb.me/examples/example_keys.html?transport=HTTP) +- Click on the "KeyChain icon" +- Click on Register +- Choose a name for your first keychain, remember exactly how you spelled and capitalised it. +- Choose a long and complex passphrase that is easy for you to remember and hard for others to guess, ideally include numbers and punctuation, but you'll need to remember this exactly. Note there is no way to change a name or password later, since there is no central authority to change them with. -Your name should appear next to the keyhain icon. -Click on your name. -A box should appear showing that you have no keys. -Click on New Key, give it a name (which you dont have to remember) and click Generate -The new key should show up. -Click on "New Access Control List, give it a name (which you dont have to remember) and click Generate -... This example is still being written, and will be expanded here. -Click on the Key - you should get a prompt which you can copy the URL out of. +- Your name should appear next to the keyhain icon, click on it. +- A box should appear showing that you have no keys. +- Click on New Key, give it a name (which you dont have to remember) and click Generate +- The new key should show up, Click on it. +- Copy and Paste the "url" of the hash (including the full string from http: or ipfs:) +- Click on "New Access Control List", give it a name (which you dont have to remember) and click Generate +- Click on "new key" +- Give it a name (you don't have to remember it); and `paste the URL +- You have now created a Lock, and given yourself access to it. + +Further examples will demonstrate using the lock. ## Installing a compilable version -If you haven't already, then install npm from [https://nodejs.org/en/download] -And on a Mac you'll need Xcode from the App store. -Then install the dependencies: ```> npm install --dev``` - -Note that this gets a forked version of libsodium-wrappers from (Mitra's repository)[https://github.com/mitra42/libsodium.js], +- Checkout the repository +- If you haven't already, then install [npm](https://nodejs.org/en/download) +- And on a Mac you'll need Xcode from the App store. +- Then install the dependencies: ```> npm install --dev``` +- Note that this gets a forked version of libsodium-wrappers from [Mitra's repository][https://github.com/mitra42/libsodium.js], as the current libsodium-wrappers release doesn't have urlsafebase54. - -Often the first run of ```> npm install --dev``` generates a lot of warnings and a second, +- Often the first run of ```> npm install --dev``` generates a lot of warnings and a second, virtually clean run gives more confidence that the install worked. +- Now compile the javascript library for the browser: ```> npm run bundle_transport_ipfs``` +- If this worked without errors, try the node specific test. ```> npm run test``` +- This should start a IPFS instance, and generate some messages ending in "delaying 10 secs" and "Completed test". +- It will leave the IPFS instance running and usually will need a Ctrl-C to exit. -Now compile the javascript library for the browser: ```> npm run bundle_transport_ipfs``` - -If this worked without errors, try the node specific test. ```> npm run test``` - -This should start a IPFS instance, and generate some messages ending in "delaying 10 secs" and "Completed test". -It will leave the IPFS instance running and usually will need a Ctrl-C to exit. - -##Major Issues +##Major Browser Issues -Please not there is an issue with IPFS on some Firefox versions (seen on 54.0.1, not on 49.0.2 for example) that is currently leaking Threads and slowing the machine down -drastically. This is being explored! Use it on Chrome for now, and expect it to crash every 5 minutes. +Please not there is an issue with IPFS on some Firefox versions (seen on 54.0.1, not on 49.0.2 for example) +that is currently leaking Threads and slowing the machine down drastically. This is being explored! +Use it on Chrome for now, and expect it to crash every 5 minutes. +The HTTP versions don't have this problem, but also don't support live notification of changes. ##See also: diff --git a/examples/htmlutils.js b/examples/htmlutils.js index fff77b1..e77021c 100644 --- a/examples/htmlutils.js +++ b/examples/htmlutils.js @@ -113,7 +113,7 @@ function addtemplatedchild(el, ...dict) { el: An HTML element, or a string with the id of one. html: html to add under outerelement - dict: Dictionary with parameters to replace in html, it looks for nodes with name="xxx" and replaces text inside it with dict[xxx] + dict: Dictionary with parameters to replace in html, it looks for nodes with name="xyz" and replaces text inside it with dict[xxx] */ el = (typeof(el) === "string") ? document.getElementById(el) : el; let el_li = el.getElementsByClassName("template")[0].cloneNode(true); // Copy first child with class=Template @@ -131,7 +131,7 @@ function addhtml(el, htmleach, dict) { //TODO merge into addtemplatechild - note el: An HTML element, or a string with the id of one. html: html to add under outerelement - dict: Dictionary with parameters to replace in html, it looks for nodes with name="xxx" and replaces text inside it with dict[xxx] + dict: Dictionary with parameters to replace in html, it looks for nodes with name="xyz" and replaces text inside it with dict[xxx] */ el = (typeof(el) === "string") ? document.getElementById(el) : el; let el_li = document.createElement('div'); // usually a 'li' but could be a 'div' diff --git a/examples/index.html b/examples/index.html index 0c4cffa..aa4a69f 100644 --- a/examples/index.html +++ b/examples/index.html @@ -9,6 +9,7 @@
  • Block - edit, store, retrieve IPFS HTTP
  • Smart Dictionary - edit, store, retrieve IPFS HTTP
  • List - create, add to, retrieve IPFS HTTP
  • +
  • Academic Documents search IPFS HTTP
  • Keys & Authentication - create manage etc IPFS HTTP
From f2dca33933a882771f608f6a85322ec059da8737 Mon Sep 17 00:00:00 2001 From: Mitra Ardron Date: Tue, 24 Oct 2017 12:10:37 -0700 Subject: [PATCH 3/4] console.assert > throw Error --- js/Block.js | 2 +- js/CommonList.js | 6 +++--- js/Errors.js | 17 +++++++++++++++++ js/KeyChain.js | 6 +++--- js/KeyPair.js | 27 +++++++++++++-------------- js/MutableBlock.js | 6 +++--- js/Signature.js | 4 ++-- js/StructuredBlock.js | 8 ++++---- js/Transport.js | 20 ++++++++++---------- js/TransportHTTP.js | 2 +- js/TransportIPFS.js | 8 ++++---- js/Transportable.js | 4 ++-- 12 files changed, 63 insertions(+), 47 deletions(-) diff --git a/js/Block.js b/js/Block.js index cf903eb..8adfd30 100644 --- a/js/Block.js +++ b/js/Block.js @@ -37,7 +37,7 @@ class Block extends Transportable { blk.p_store(verbose) // Store it to transport .then(() => Block.p_fetch(blk._url, verbose)) .then((blk2) => { - console.assert(blk2._data.toString() === blk._data, "Block should survive round trip"); + if (blk2._data.toString() !== blk._data) throw new CodingError("Block should survive round trip"); resolve(blk2); }) .catch((err) => { console.log("Block Test failed", err); reject(err); }) diff --git a/js/CommonList.js b/js/CommonList.js index ee96d87..4d057ff 100644 --- a/js/CommonList.js +++ b/js/CommonList.js @@ -169,8 +169,8 @@ class CommonList extends SmartDict { } } - publicurl() { console.assert(false, "XXX Undefined function CommonList.publicurl"); } // For access via web - privateurl() { console.assert(false, "XXX Undefined function CommonList.privateurl"); } // For access via web + publicurl() { throw new Dweb.errors.ToBeImplementedError("Undefined function CommonList.publicurl"); } // For access via web + privateurl() { throw new Dweb.errors.ToBeImplementedError("Undefined function CommonList.privateurl"); } // For access via web p_push(obj, verbose ) { /* @@ -208,7 +208,7 @@ class CommonList extends SmartDict { if (!url) throw new Dweb.errors.CodingError("Empty url is a coding error"); if (!this._master) throw new Dweb.errors.ForbiddenError("Must be master to sign something"); let sig = Dweb.Signature.sign(this, url, verbose); //returns a new Signature - console.assert(sig.signature, "Must be a signature"); + if (!sig.signature) throw new CodingError("Must be a signature"); return sig } p_add(sig, verbose) { diff --git a/js/Errors.js b/js/Errors.js index ce05521..c99cf1e 100644 --- a/js/Errors.js +++ b/js/Errors.js @@ -9,6 +9,14 @@ class ToBeImplementedError extends Error { } errors.ToBeImplementedError = ToBeImplementedError; +class ObsoleteError extends Error { + constructor(message) { + super("Obsolete: " + message); + this.name = "ObsoleteError" + } +} +errors.ObsoleteError = ObsoleteError; + //TODO TransportError is wanted in TransportHTTP but its out of scope there. Think about moving to Transport class class TransportError extends Error { constructor(message) { @@ -38,6 +46,15 @@ class EncryptionError extends Error { } errors.EncryptionError = EncryptionError; +// Use this something that should have been signed isn't - this is externally signed, i.e. a data rather than coding error +class SigningError extends Error { + constructor(message) { + super(message || "Signing Error"); + this.name = "SigningError" + } +} +errors.SigningError = SigningError; + class ForbiddenError extends Error { constructor(message) { super(message || "Forbidden failure"); diff --git a/js/KeyChain.js b/js/KeyChain.js index c9f957b..30e7968 100644 --- a/js/KeyChain.js +++ b/js/KeyChain.js @@ -202,12 +202,12 @@ class KeyChain extends CommonList { .then(() => sb.p_store(verbose)) .then(() => { let mvk = KeyChain.mykeys(Dweb.KeyPair); - console.assert(mvk[0].name === vkpname, "Should find viewerkeypair stored above"); + if (mvk[0].name !== vkpname) throw new CodingError("Should find viewerkeypair stored above"); if (verbose) console.log("KEYCHAIN 6: Check can fetch and decrypt - should use viewerkeypair stored above"); return Dweb.SmartDict.p_fetch(sb._url, verbose); // Will be StructuredBlock, fetched and decrypted }) .then((sb2) => { - console.assert(sb2.data === qbf, "Data should survive round trip"); + if (sb2.data !== qbf) throw new CodingError("Data should survive round trip"); if (verbose) console.log("KEYCHAIN 7: Check can store content via an MB"); //MB.new(acl, contentacl, name, _allowunsafestore, content, signandstore, verbose) }) @@ -220,7 +220,7 @@ class KeyChain extends CommonList { .then((newpublicmb) => mb = newpublicmb) .then(() => mb.p_list_then_current(verbose)) .then(() => { - console.assert(mb.content() === qbf, "Data should round trip through ACL"); + if (mb.content() !== qbf) throw new CodingError("Data should round trip through ACL"); }) .then(() => { diff --git a/js/KeyPair.js b/js/KeyPair.js index 1063e2f..32a8c90 100644 --- a/js/KeyPair.js +++ b/js/KeyPair.js @@ -44,9 +44,9 @@ class KeyPair extends SmartDict { if (name === "key") { this._key_setter(value); } else if (name === "private") { - console.assert(false, "XXX Undefined functionality KeyPair.private.setter"); + throw new Dweb.errors.ToBeImplementedError("Undefined functionality KeyPair.private.setter"); } else if (name === "public") { - console.assert(false, "XXX Undefined functionality KeyPair.public.setter"); + throw new Dweb.errors.ToBeImplementedError("Undefined functionality KeyPair.public.setter"); } else { super.__setattr__(name, value); } @@ -69,7 +69,7 @@ class KeyPair extends SmartDict { value.seed = "01234567890123456789012345678901"; // Note this is seed from mnemonic above console.log("Faking mnemonic encoding for now") } else { - console.assert(false, "MNEMONIC STILL TO BE IMPLEMENTED"); //TODO-mnemonic + throw new ToBeImplementedError("MNEMONIC STILL TO BE IMPLEMENTED"); //TODO-mnemonic } } if (value.passphrase) { @@ -136,8 +136,7 @@ class KeyPair extends SmartDict { :returns: Dict suitable for storing in _key */ let key = {}; - //console.assert(sodium.crypto_box_SEEDBYTES === sodium.crypto_sign_SEEDBYTES, "KeyPair.keygen assuming seed lengths same"); - console.assert(sodium.crypto_box_SEEDBYTES === seed.length, "Seed should be", sodium.crypto_box_SEEDBYTES, "but is", seed.length); + if (sodium.crypto_box_SEEDBYTES !== seed.length) throw new CodingError("Seed should be", sodium.crypto_box_SEEDBYTES, "but is", seed.length); key.seed = seed; if (keytype === Dweb.KeyPair.KEYTYPESIGN || keytype === Dweb.KeyPair.KEYTYPESIGNANDENCRYPT) { key.sign = sodium.crypto_sign_seed_keypair(key.seed); // Object { publicKey: Uint8Array[32], privateKey: Uint8Array[64], keyType: "ed25519" } @@ -172,8 +171,8 @@ class KeyPair extends SmartDict { //See https://github.com/jedisct1/libsodium.js/issues/91 for issues if (!this._key) { this._key = {}} // Only handles NACL style keys if (tag === "NACL PUBLIC") { this._key["encrypt"] = {"publicKey": hasharr}; - } else if (tag === "NACL PRIVATE") { console.assert(false, "_importkey: Cant (yet) import Private key "+value+" normally use SEED"); - } else if (tag === "NACL SIGNING") { console.assert(false, "_importkey: Cant (yet) import Signing key "+value+" normally use SEED"); + } else if (tag === "NACL PRIVATE") { throw new ToBeImplementedError("_importkey: Cant (yet) import Private key "+value+" normally use SEED"); + } else if (tag === "NACL SIGNING") { throw new ToBeImplementedError("_importkey: Cant (yet) import Signing key "+value+" normally use SEED"); } else if (tag === "NACL SEED") { this._key = KeyPair._keyfromseed(hasharr, Dweb.KeyPair.KEYTYPESIGNANDENCRYPT); } else if (tag === "NACL VERIFY") { this._key["sign"] = {"publicKey": hasharr}; } else { throw new ToBeImplementedError("_importkey: Cant (yet) import "+value) } @@ -190,9 +189,9 @@ class KeyPair extends SmartDict { return res; } - //private() { console.assert(false, "XXX Undefined function KeyPair.private"); } //TODO private is a reserved word in JS - //public() { console.assert(false, "XXX Undefined function KeyPair.public"); } //TODO public is a reserved word in JS - mnemonic() { console.assert(false, "XXX Undefined function KeyPair.mnemonic"); } + //private() { throw new Dweb.errors.ToBeImplementedError("Undefined function KeyPair.private"); } //TODO private is a reserved word in JS + //public() { throw new Dweb.errors.ToBeImplementedError("Undefined function KeyPair.public"); } //TODO public is a reserved word in JS + mnemonic() { throw new Dweb.errors.ToBeImplementedError("Undefined function KeyPair.mnemonic"); } privateexport() { /* @@ -203,7 +202,7 @@ class KeyPair extends SmartDict { if (key.seed) { return "NACL SEED:" + (typeof(key.seed) === "string" ? key.seed : sodium.to_urlsafebase64(key.seed)); } else { - console.assert(false, "XXX Undefined function KeyPair.privateexport witghout seed", key); //TODO should export full set of keys prob as JSON + throw new Dweb.errors.ToBeImplementedError("Undefined function KeyPair.privateexport witghout seed", key); //TODO should export full set of keys prob as JSON } } @@ -232,7 +231,7 @@ class KeyPair extends SmartDict { :return: str, binary encryption of data or urlsafebase64 */ // Assumes nacl.public.PrivateKey or nacl.signing.SigningKey - console.assert(signer, "Until PyNaCl bindings have secretbox we require a signer and have to add authentication"); + if (!signer) throw new CodingError("Until PyNaCl bindings have secretbox we require a signer and have to add authentication"); //box = nacl.public.Box(signer.keypair._key.encrypt.privateKey, self._key.encrypt.publicKey) //return box.encrypt(data, encoder=(nacl.encoding.URLSafeBase64Encoder if b64 else nacl.encoding.RawEncoder)) const nonce = sodium.randombytes_buf(sodium.crypto_box_NONCEBYTES); @@ -275,7 +274,7 @@ class KeyPair extends SmartDict { :param url: URL being signed, it could really be any data, :return: signature that can be verified with verify */ - console.assert(signable); + if (!signable) throw new CodingError("Needs signable") if (! this._key.sign.privateKey) { throw new Dweb.errors.EncryptionError("Can't sign with out private key. Key =" + JSON.stringify(this._key)); } @@ -295,7 +294,7 @@ class KeyPair extends SmartDict { let sig = sodium.from_urlsafebase64(urlb64sig); let tested = sodium.crypto_sign_verify_detached(sig, signable, this._key.sign.publicKey); - console.assert(tested, "Signature not verified"); //TODO decide what to do at this point - might throw exception + if (!tested) throw new SigningError("Signature not verified"); //TODO decide what to do at this point - might throw exception return true; } diff --git a/js/MutableBlock.js b/js/MutableBlock.js index ff59b2b..42d9e45 100644 --- a/js/MutableBlock.js +++ b/js/MutableBlock.js @@ -35,9 +35,9 @@ class MutableBlock extends CommonList { // Note any follow on .then is applied to the MB, not to the content, and the content might not have been loaded. } - p_update(){ console.assert(false, "Need to define p_ function")} + p_update(){ throw new ToBeImplementedError("Need to define p_ function")} - async_update(type, data, verbose, success, error) { console.trace(); console.assert(false, "OBSOLETE"); //TODO-IPFS obsolete with p_fetch // Send new data for this item to dWeb + async_update(type, data, verbose, success, error) { throw new ObsoleteError("MutableBlock.async_update"); //TODO-IPFS obsolete with p_fetch // Send new data for this item to dWeb this.transport().async_update(this, this._url, type, data, verbose, success, error); //TODO-IPFS when obsolete can obsolete transport.async_update } @@ -54,7 +54,7 @@ class MutableBlock extends CommonList { } file() { - console.assert(false, "XXX Undefined function MutableBlock.file"); + throw new Dweb.errors.ToBeImplementedError("Undefined function MutableBlock.file"); } // Retrieving data p_signandstore(verbose){ //TODO-AUTHENTICATION - add options to remove old signatures by same diff --git a/js/Signature.js b/js/Signature.js index 3122743..59c32de 100644 --- a/js/Signature.js +++ b/js/Signature.js @@ -51,7 +51,7 @@ class Signature extends SmartDict { */ let date = new Date(Date.now()); if (!commonlist._publicurl) commonlist.p_store(verbose); // Sets _publicurl sync, while storing async - console.assert(commonlist._publicurl, "Signature.sign should be a publicurl by here"); + if (!commonlist._publicurl) throw new CodingError("Signature.sign should be a publicurl by here"); let sig = new Signature({"date": date, "url": url, "signedby": commonlist._publicurl}); sig.signature = commonlist.keypair.sign(sig.signable()); return sig @@ -109,7 +109,7 @@ class Signature extends SmartDict { sig = Dweb.Signature.sign(commonlist,signedblock._url, verbose); //commonlist, url, verbose commonlist._allowunsafestore = false; if (verbose) console.log("test_Signatures verification"); - console.assert(commonlist.verify(sig, verbose),"Should verify"); + if (!commonlist.verify(sig, verbose)) throw new CodingError("Should verify"); }) } diff --git a/js/StructuredBlock.js b/js/StructuredBlock.js index 15722dc..3e3000f 100644 --- a/js/StructuredBlock.js +++ b/js/StructuredBlock.js @@ -34,7 +34,7 @@ class StructuredBlock extends SmartDict { if (name === "links") { let links = value; for (let len = links.length, i=0; i result.data) @@ -349,7 +349,7 @@ class TransportIPFS extends Transport { :param boolean verbose: True for debugging output :resolve array: An array of objects as stored on the list. */ - console.assert(this.options.listmethod === "yarrays"); + if (this.options.listmethod !== "yarrays") throw new CodingError("Only support yarrays"); return this.p__yarray(url, verbose) .then((y) => y.share.array.toArray().filter((obj) => (obj.signedby === url))) .then((res) => { @@ -433,7 +433,7 @@ class TransportIPFS extends Transport { :resolve array: An array of objects as stored on the list. */ //TODO-REVERSE this needs implementing once list structure on IPFS more certain - console.assert(false, "XXX Undefined function TransportHTTP.rawreverse"); } + throw new Dweb.errors.ToBeImplementedError("Undefined function TransportHTTP.rawreverse"); } p_rawstore(data, verbose) { /* @@ -491,7 +491,7 @@ class TransportIPFS extends Transport { } */ async_update(self, url, type, data, verbose, success, error) { - console.trace(); console.assert(false, "OBSOLETE"); //TODO-IPFS obsolete with p_* + throw new ObsoleteError("OBSOLETE"); //TODO-IPFS obsolete with p_* this.async_post("update", url, type, data, verbose, success, error); } diff --git a/js/Transportable.js b/js/Transportable.js index 3f1a910..4130b3f 100644 --- a/js/Transportable.js +++ b/js/Transportable.js @@ -83,8 +83,8 @@ class Transportable { return Dweb.transport(url).p_rawfetch(url, verbose) // Fetch the data Throws TransportError immediately if url invalid, expect it to catch if Transport fails } - file() { console.assert(false, "XXX Undefined function Transportable.file"); } //TODO-BACKPORT from Python - xurl() { console.assert(false, "XXX Undefined function Transportable.url"); } //TODO-BACKPORT from Python if not deleted there. + file() { throw new Dweb.errors.ToBeImplementedError("Undefined function Transportable.file"); } //TODO-BACKPORT from Python + xurl() { throw new Dweb.errors.ToBeImplementedError("Undefined function Transportable.url"); } //TODO-BACKPORT from Python if not deleted there. content() { throw new Dweb.errors.IntentionallyUnimplementedError("Intentionally undefined function Transportable.content - superclass should define"); } p_updatelist() { throw new Dweb.errors.IntentionallyUnimplementedError("Intentionally undefined function Transportable.p_updatelist - meaningless except on CL"); } From 34c4f21f3af86ef4222819d3a5a8d19b9b11a0f9 Mon Sep 17 00:00:00 2001 From: Mitra Ardron Date: Tue, 24 Oct 2017 12:18:02 -0700 Subject: [PATCH 4/4] Remove obsolete XXX --- examples/htmlutils.js | 4 ++-- js/CommonList.js | 4 +--- js/KeyPair.js | 2 -- js/Transport.js | 2 +- js/TransportIPFS.js | 2 +- js/test.js | 1 - 6 files changed, 5 insertions(+), 10 deletions(-) diff --git a/examples/htmlutils.js b/examples/htmlutils.js index e77021c..57826d4 100644 --- a/examples/htmlutils.js +++ b/examples/htmlutils.js @@ -113,7 +113,7 @@ function addtemplatedchild(el, ...dict) { el: An HTML element, or a string with the id of one. html: html to add under outerelement - dict: Dictionary with parameters to replace in html, it looks for nodes with name="xyz" and replaces text inside it with dict[xxx] + dict: Dictionary with parameters to replace in html, it looks for nodes with name="xyz" and replaces text inside it with dict[xyz] */ el = (typeof(el) === "string") ? document.getElementById(el) : el; let el_li = el.getElementsByClassName("template")[0].cloneNode(true); // Copy first child with class=Template @@ -131,7 +131,7 @@ function addhtml(el, htmleach, dict) { //TODO merge into addtemplatechild - note el: An HTML element, or a string with the id of one. html: html to add under outerelement - dict: Dictionary with parameters to replace in html, it looks for nodes with name="xyz" and replaces text inside it with dict[xxx] + dict: Dictionary with parameters to replace in html, it looks for nodes with name="xyz" and replaces text inside it with dict[xyz] */ el = (typeof(el) === "string") ? document.getElementById(el) : el; let el_li = document.createElement('div'); // usually a 'li' but could be a 'div' diff --git a/js/CommonList.js b/js/CommonList.js index 4d057ff..ab02f17 100644 --- a/js/CommonList.js +++ b/js/CommonList.js @@ -235,10 +235,8 @@ class CommonList extends SmartDict { // ----- Listener interface ----- see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget for the pattern addEventListener(type, callback) { - console.log("XXX@CL.addEventListener",type); if (!(type in this._listeners)) this._listeners[type] = []; this._listeners[type].push(callback); - console.log("XXX@CL.addEventListener done") } removeEventListener(type, callback) { @@ -252,7 +250,7 @@ class CommonList extends SmartDict { } } dispatchEvent(event) { - console.log("XXX@CL.dispatchEvent",event); + console.log("CL.dispatchEvent",event); if (!(event.type in this._listeners)) return true; let stack = this._listeners[event.type]; console.log("THIS=",this, "event.target=",event.target); diff --git a/js/KeyPair.js b/js/KeyPair.js index 32a8c90..e0c7754 100644 --- a/js/KeyPair.js +++ b/js/KeyPair.js @@ -1,5 +1,4 @@ const sodium = require("libsodium-wrappers"); -//Uncomment to debug, check urlsafe occurs: console.log("XXX@keypair:2",sodium) const SmartDict = require("./SmartDict"); const Dweb = require("./Dweb"); const crypto = require('crypto'); // Needed to do a simple sha256 which doesnt appear to be in libsodium @@ -144,7 +143,6 @@ class KeyPair extends SmartDict { if (keytype === Dweb.KeyPair.KEYTYPEENCRYPT || keytype === Dweb.KeyPair.KEYTYPESIGNANDENCRYPT) { key.encrypt = sodium.crypto_box_seed_keypair(key.seed); // Object { publicKey: Uint8Array[32], privateKey: Uint8Array[64] } <