-
Notifications
You must be signed in to change notification settings - Fork 28
Async Crypto Endeavour #22
Conversation
}) | ||
|
||
it('add multiaddr', () => { | ||
const pi = new PeerInfo() | ||
expect(pi).to.exist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checking something to exist every time doesn't seem useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
expect(pi).to.exist | ||
const mh = Multiaddr('/ip4/127.0.0.1/tcp/5001') | ||
pi.multiaddr.add(mh) | ||
expect(pi.multiaddrs.length).to.equal(1) | ||
}) | ||
|
||
it('add multiaddr that are buffers', () => { | ||
const pi = new PeerInfo() | ||
expect(pi).to.exist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
expect(pi).to.exist | ||
const mh = Multiaddr('/ip4/127.0.0.1/tcp/5001') | ||
pi.multiaddr.add(mh.buffer) | ||
expect(pi.multiaddrs[0] instanceof Multiaddr).to.equal(true) | ||
}) | ||
|
||
it('add repeated multiaddr', () => { | ||
const pi = new PeerInfo() | ||
expect(pi).to.exist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and it goes on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
How did you solve the PCKS#1 vs PKCS#6. Can we confirm that we are manipulating and storing the keys in the same way as in go? This will be crucial for config file share, identify and secio crypto handshake. |
We already had tests for this (the go interop part) here and in libp2p-crypto. You can see the details of the conversion here: libp2p/js-libp2p-crypto@eb5de10 |
@@ -91,3 +91,13 @@ function Peer (peerId) { | |||
// TODO: add features to fetch multiaddr using filters | |||
// look at https://github.com/whyrusleeping/js-mafmt/blob/master/src/index.js | |||
} | |||
|
|||
Peer.create = (cb) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, to simplify, let's default to use PeerInfo.create
- s/Peer/PeerInfo
- signature becomes
(peerId, callback) =>
- Use always PeerInfo.create everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean with peerId
being optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
return cb(err) | ||
} | ||
|
||
cb(null, new Peer(key)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key? or Id?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
BREAKING CHANGE New method PeerInfo.create(cb) replaces the previous new PeerInfo() to create a fresh id
d4589d4
to
365b130
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
env: CXX=g++-4.8 | ||
- node_js: stable | ||
env: | ||
- SAUCE=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do Sauce on LTS
@diasdavid should be ready now |
Ref libp2p/js-libp2p-crypto#10
BREAKING CHANGE
New method PeerInfo.create(cb) replaces the previous new PeerInfo() to create a fresh id