mirror of
https://github.com/fluencelabs/js-libp2p-secio
synced 2025-03-16 02:10:52 +00:00
fix tests
This commit is contained in:
parent
b7650194a9
commit
ddb43af01a
@ -43,11 +43,12 @@ const secio = require('libp2p-secio')
|
|||||||
|
|
||||||
The current `secio` tag, usable in `multistream`.
|
The current `secio` tag, usable in `multistream`.
|
||||||
|
|
||||||
### `encrypt(id, key, insecure)`
|
### `encrypt(id, key, insecure[, callback])`
|
||||||
|
|
||||||
- `id: PeerId` - The id of the node.
|
- `id: PeerId` - The id of the node.
|
||||||
- `key: RSAPrivateKey` - The private key of the node.
|
- `key: RSAPrivateKey` - The private key of the node.
|
||||||
- `insecure: PullStream` - The insecure connection.
|
- `insecure: PullStream` - The insecure connection.
|
||||||
|
- `callback: Function` - Called if an error happens during the initialization.
|
||||||
|
|
||||||
Returns the `insecure` connection provided, wrapped with secio. This is a pull-stream.
|
Returns the `insecure` connection provided, wrapped with secio. This is a pull-stream.
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ suite.add('createKey', function (d) {
|
|||||||
pull(
|
pull(
|
||||||
pull.infinite(),
|
pull.infinite(),
|
||||||
pull.take(100),
|
pull.take(100),
|
||||||
pull.map((val) => Buffer(val.toString())),
|
pull.map((val) => new Buffer(val.toString())),
|
||||||
local
|
local
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,7 +23,10 @@ module.exports = {
|
|||||||
|
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
callback = (err) => {
|
callback = (err) => {
|
||||||
throw err
|
if (err) {
|
||||||
|
console.error(err)
|
||||||
|
throw err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,12 +32,8 @@ describe('secio browser <-> nodejs', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('encrypt', (done) => {
|
it('encrypt', () => {
|
||||||
secio.encrypt(pid, pid._privKey, conn, (err, c) => {
|
secio.encrypt(pid, pid._privKey, conn)
|
||||||
expect(err).to.not.exist
|
|
||||||
encryptedConn = c
|
|
||||||
done()
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('echo', (done) => {
|
it('echo', (done) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user