mirror of
https://github.com/fluencelabs/js-peer-id
synced 2025-06-26 18:01:51 +00:00
fix: Always add public key to constructor if possible, Fix for undefined pubKey in remote peers (#68)
* Always add public key to constructor if possible * extending Non-default # of bits test time, travis took 59521ms License: MIT Signed-off-by: Yahya <ya7yaz@gmail.com>
This commit is contained in:
@ -202,7 +202,7 @@ exports.createFromPrivKey = function (key, callback) {
|
|||||||
return callback(err)
|
return callback(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(null, new PeerId(digest, privKey))
|
callback(null, new PeerId(digest, privKey, privKey.public))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +85,7 @@ describe('PeerId', () => {
|
|||||||
PeerId.createFromPrivKey(encoded, (err, id2) => {
|
PeerId.createFromPrivKey(encoded, (err, id2) => {
|
||||||
expect(err).to.not.exist()
|
expect(err).to.not.exist()
|
||||||
expect(testIdB58String).to.equal(id2.toB58String())
|
expect(testIdB58String).to.equal(id2.toB58String())
|
||||||
|
expect(id.marshalPubKey()).to.deep.equal(id2.marshalPubKey())
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -104,7 +105,7 @@ describe('PeerId', () => {
|
|||||||
|
|
||||||
it('Non-default # of bits', function (done) {
|
it('Non-default # of bits', function (done) {
|
||||||
// rsa is slow atm
|
// rsa is slow atm
|
||||||
this.timeout(20000)
|
this.timeout(100000)
|
||||||
PeerId.create({ bits: 1024 }, (err, shortId) => {
|
PeerId.create({ bits: 1024 }, (err, shortId) => {
|
||||||
expect(err).to.not.exist()
|
expect(err).to.not.exist()
|
||||||
PeerId.create({ bits: 4096 }, (err, longId) => {
|
PeerId.create({ bits: 4096 }, (err, longId) => {
|
||||||
|
Reference in New Issue
Block a user