Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

feat: add browser <-> nodejs test #30

Merged
merged 7 commits into from
Nov 11, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kind of misleading, saying it returns a 'insecure connection'


Expand Down
2 changes: 1 addition & 1 deletion benchmarks/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ module.exports = {

if (!callback) {
callback = (err) => {
throw err
if (err) {
console.error(err)
throw err
}
}
}

Expand Down
8 changes: 2 additions & 6 deletions test/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait, it doesn't yield a wrapped encrypted conn?

})

it('echo', (done) => {
Expand Down