From 1dbcfa88b63325e36bb72101f51b38ce6dd25557 Mon Sep 17 00:00:00 2001 From: vms Date: Sun, 23 Feb 2020 19:48:03 +0300 Subject: [PATCH] sync with master (#1) * chore: update deps (#113) * chore: update contributors * chore: release version v0.12.2 * fix: remove use of assert module (#114) The polyfill is big, we can simulate it by throwing an Error and it doesn't work under React Native. * chore: update contributors * chore: release version v0.12.3 * chore(deps-dev): bump aegir from 20.6.1 to 21.0.2 (#117) Bumps [aegir](https://github.com/ipfs/aegir) from 20.6.1 to 21.0.2. - [Release notes](https://github.com/ipfs/aegir/releases) - [Changelog](https://github.com/ipfs/aegir/blob/master/CHANGELOG.md) - [Commits](https://github.com/ipfs/aegir/compare/v20.6.1...v21.0.2) Signed-off-by: dependabot-preview[bot] Co-authored-by: Jacob Heun Co-authored-by: Alex Potsides Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- CHANGELOG.md | 15 +++++++++++++++ package.json | 15 ++++++++------- src/index.js | 9 ++++++--- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e6e9f3..1631583 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ + +## [0.12.3](https://github.com/ipfs/js-libp2p-secio/compare/v0.12.2...v0.12.3) (2020-02-13) + + +### Bug Fixes + +* remove use of assert module ([#114](https://github.com/ipfs/js-libp2p-secio/issues/114)) ([027e0ad](https://github.com/ipfs/js-libp2p-secio/commit/027e0ad)) + + + + +## [0.12.2](https://github.com/ipfs/js-libp2p-secio/compare/v0.12.1...v0.12.2) (2020-01-06) + + + ## [0.12.1](https://github.com/ipfs/js-libp2p-secio/compare/v0.12.0...v0.12.1) (2019-11-22) diff --git a/package.json b/package.json index 84e4f87..6b38531 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "libp2p-secio", - "version": "0.12.1", + "version": "0.12.3", "description": "Secio implementation in JavaScript", "leadMaintainer": "Friedel Ziegelmayer ", "main": "src/index.js", @@ -36,15 +36,15 @@ "it-pair": "^1.0.0", "it-pb-rpc": "^0.1.4", "it-pipe": "^1.1.0", - "libp2p-crypto": "~0.17.1", - "libp2p-interfaces": "~0.1.3", + "libp2p-crypto": "^0.17.1", + "libp2p-interfaces": "^0.2.1", "multiaddr": "^7.2.1", - "multihashing-async": "~0.8.0", - "peer-id": "~0.13.5", - "protons": "^1.0.1" + "multihashing-async": "^0.8.0", + "peer-id": "^0.13.6", + "protons": "^1.1.0" }, "devDependencies": { - "aegir": "^20.4.1", + "aegir": "^21.0.2", "benchmark": "^2.1.4", "chai": "^4.2.0", "dirty-chai": "^2.0.1", @@ -63,6 +63,7 @@ }, "homepage": "https://github.com/ipfs/js-libp2p-secio", "contributors": [ + "Alex Potsides ", "David Dias ", "Dmitriy Ryajov ", "Friedel Ziegelmayer ", diff --git a/src/index.js b/src/index.js index dca8e49..e40d5af 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,5 @@ 'use strict' -const assert = require('assert') const debug = require('debug') const log = debug('libp2p:secio') log.error = debug('libp2p:secio:error') @@ -11,8 +10,12 @@ const Wrap = require('it-pb-rpc') const { int32BEDecode, int32BEEncode } = require('it-length-prefixed') async function secure (localPeer, duplex, remotePeer) { // returns duplex - assert(localPeer, 'no local private key provided') - assert(duplex, 'no connection for the handshake provided') + if (!localPeer) { + throw new Error('no local private key provided') + } + if (!duplex) { + throw new Error('no connection for the handshake provided') + } const state = new State(localPeer, remotePeer) const wrapped = Wrap(duplex, { lengthDecoder: int32BEDecode, lengthEncoder: int32BEEncode })