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] <support@dependabot.com>

Co-authored-by: Jacob Heun <jacobheun@gmail.com>
Co-authored-by: Alex Potsides <alex@achingbrain.net>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
This commit is contained in:
vms 2020-02-23 19:48:03 +03:00 committed by GitHub
parent b3a70400b0
commit 1dbcfa88b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 10 deletions

View File

@ -1,3 +1,18 @@
<a name="0.12.3"></a>
## [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))
<a name="0.12.2"></a>
## [0.12.2](https://github.com/ipfs/js-libp2p-secio/compare/v0.12.1...v0.12.2) (2020-01-06)
<a name="0.12.1"></a>
## [0.12.1](https://github.com/ipfs/js-libp2p-secio/compare/v0.12.0...v0.12.1) (2019-11-22)

View File

@ -1,6 +1,6 @@
{
"name": "libp2p-secio",
"version": "0.12.1",
"version": "0.12.3",
"description": "Secio implementation in JavaScript",
"leadMaintainer": "Friedel Ziegelmayer <dignifiedquire@gmail.com>",
"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 <alex@achingbrain.net>",
"David Dias <daviddias.p@gmail.com>",
"Dmitriy Ryajov <dryajov@gmail.com>",
"Friedel Ziegelmayer <dignifiedquire@gmail.com>",

View File

@ -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 })