mirror of
https://github.com/fluencelabs/js-libp2p-secio
synced 2025-03-15 09:50:55 +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`.
|
||||
|
||||
### `encrypt(id, key, insecure)`
|
||||
### `encrypt(id, key, insecure[, callback])`
|
||||
|
||||
- `id: PeerId` - The id of the node.
|
||||
- `key: RSAPrivateKey` - The private key of the node.
|
||||
- `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.
|
||||
|
||||
|
@ -46,7 +46,7 @@ suite.add('createKey', function (d) {
|
||||
pull(
|
||||
pull.infinite(),
|
||||
pull.take(100),
|
||||
pull.map((val) => Buffer(val.toString())),
|
||||
pull.map((val) => new Buffer(val.toString())),
|
||||
local
|
||||
)
|
||||
|
||||
|
@ -23,7 +23,10 @@ module.exports = {
|
||||
|
||||
if (!callback) {
|
||||
callback = (err) => {
|
||||
throw err
|
||||
if (err) {
|
||||
console.error(err)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,12 +32,8 @@ describe('secio browser <-> nodejs', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('encrypt', (done) => {
|
||||
secio.encrypt(pid, pid._privKey, conn, (err, c) => {
|
||||
expect(err).to.not.exist
|
||||
encryptedConn = c
|
||||
done()
|
||||
})
|
||||
it('encrypt', () => {
|
||||
secio.encrypt(pid, pid._privKey, conn)
|
||||
})
|
||||
|
||||
it('echo', (done) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user