mirror of
https://github.com/fluencelabs/js-peer-id
synced 2025-07-04 14:11:35 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
9922f85693 | |||
843d35e1da | |||
ceeff130fa | |||
8f4027b136 | |||
90835484fe | |||
8bcd9a880e |
@ -22,7 +22,6 @@ jobs:
|
||||
|
||||
- stage: check
|
||||
script:
|
||||
- npx aegir commitlint --travis
|
||||
- npx aegir dep-check
|
||||
- npm run lint
|
||||
|
||||
|
15
CHANGELOG.md
15
CHANGELOG.md
@ -1,3 +1,18 @@
|
||||
<a name="0.12.5"></a>
|
||||
## [0.12.5](https://github.com/libp2p/js-peer-id/compare/v0.12.4...v0.12.5) (2019-09-25)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* inline public key handling for the 0.12.x line ([#102](https://github.com/libp2p/js-peer-id/issues/102)) ([ceeff13](https://github.com/libp2p/js-peer-id/commit/ceeff13))
|
||||
|
||||
|
||||
|
||||
<a name="0.12.4"></a>
|
||||
## [0.12.4](https://github.com/libp2p/js-peer-id/compare/v0.12.3...v0.12.4) (2019-07-23)
|
||||
|
||||
|
||||
|
||||
<a name="0.12.3"></a>
|
||||
## [0.12.3](https://github.com/libp2p/js-peer-id/compare/v0.12.2...v0.12.3) (2019-07-11)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "peer-id",
|
||||
"version": "0.12.3",
|
||||
"version": "0.12.5",
|
||||
"description": "IPFS Peer Id implementation in Node.js",
|
||||
"leadMaintainer": "Pedro Teixeira <i@pgte.me>",
|
||||
"main": "src/index.js",
|
||||
@ -34,14 +34,14 @@
|
||||
},
|
||||
"homepage": "https://github.com/libp2p/js-peer-id",
|
||||
"devDependencies": {
|
||||
"aegir": "^18.2.2",
|
||||
"aegir": "^20.0.0",
|
||||
"bundlesize": "~0.17.1",
|
||||
"chai": "^4.2.0",
|
||||
"dirty-chai": "^2.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"libp2p-crypto": "~0.16.1",
|
||||
"async": "^3.0.1",
|
||||
"async": "^2.6.3",
|
||||
"class-is": "^1.1.0",
|
||||
"multihashes": "~0.4.15"
|
||||
},
|
||||
@ -55,6 +55,7 @@
|
||||
"David Dias <mail@daviddias.me>",
|
||||
"Friedel Ziegelmayer <dignifiedquire@gmail.com>",
|
||||
"Hugo Dias <hugomrdias@gmail.com>",
|
||||
"Jacob Heun <jacobheun@gmail.com>",
|
||||
"Maciej Krüger <mkg20001@gmail.com>",
|
||||
"Michael Garvin <gar+gh@danger.computer>",
|
||||
"Pedro Teixeira <i@pgte.me>",
|
||||
@ -62,6 +63,7 @@
|
||||
"Richard Littauer <richard.littauer@gmail.com>",
|
||||
"Richard Schneider <makaretu@gmail.com>",
|
||||
"Stephen Whitmore <stephen.whitmore@gmail.com>",
|
||||
"Topper Bowers <topper@toppingdesign.com>",
|
||||
"Vasco Santos <vasco.santos@ua.pt>",
|
||||
"Vasco Santos <vasco.santos@moxy.studio>",
|
||||
"Yahya <ya7yaz@gmail.com>",
|
||||
|
@ -9,5 +9,6 @@ PeerId.create((err, id) => {
|
||||
throw err
|
||||
}
|
||||
|
||||
// eslint-disable-next-line
|
||||
console.log(JSON.stringify(id.toJSON(), null, 2))
|
||||
})
|
||||
|
@ -48,6 +48,13 @@ class PeerId {
|
||||
if (this._privKey) {
|
||||
return this._privKey.public
|
||||
}
|
||||
|
||||
const decoded = mh.decode(this.id)
|
||||
|
||||
if (decoded.name === 'identity') {
|
||||
this._pubKey = cryptoKeys.unmarshalPublicKey(decoded.digest)
|
||||
return this._pubKey
|
||||
}
|
||||
}
|
||||
|
||||
set pubKey (pubKey) {
|
||||
|
@ -50,6 +50,16 @@ describe('PeerId', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('can get the public key from a Secp256k1 key', (done) => {
|
||||
PeerId.create({ keyType: 'secp256k1', bits: 256 }, (err, original) => {
|
||||
expect(err).to.not.exist()
|
||||
|
||||
const newId = PeerId.createFromB58String(original.toB58String())
|
||||
expect(original.pubKey.bytes).to.eql(newId.pubKey.bytes)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('isPeerId', (done) => {
|
||||
PeerId.create(testOpts, (err, id) => {
|
||||
expect(err).to.not.exist()
|
||||
|
Reference in New Issue
Block a user