mirror of
https://github.com/fluencelabs/js-peer-id
synced 2025-07-04 18:21:59 +00:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
9922f85693 | |||
843d35e1da | |||
ceeff130fa |
@ -22,7 +22,6 @@ jobs:
|
|||||||
|
|
||||||
- stage: check
|
- stage: check
|
||||||
script:
|
script:
|
||||||
- npx aegir commitlint --travis
|
|
||||||
- npx aegir dep-check
|
- npx aegir dep-check
|
||||||
- npm run lint
|
- npm run lint
|
||||||
|
|
||||||
|
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,3 +1,13 @@
|
|||||||
|
<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>
|
<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)
|
## [0.12.4](https://github.com/libp2p/js-peer-id/compare/v0.12.3...v0.12.4) (2019-07-23)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "peer-id",
|
"name": "peer-id",
|
||||||
"version": "0.12.4",
|
"version": "0.12.5",
|
||||||
"description": "IPFS Peer Id implementation in Node.js",
|
"description": "IPFS Peer Id implementation in Node.js",
|
||||||
"leadMaintainer": "Pedro Teixeira <i@pgte.me>",
|
"leadMaintainer": "Pedro Teixeira <i@pgte.me>",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
@ -63,6 +63,7 @@
|
|||||||
"Richard Littauer <richard.littauer@gmail.com>",
|
"Richard Littauer <richard.littauer@gmail.com>",
|
||||||
"Richard Schneider <makaretu@gmail.com>",
|
"Richard Schneider <makaretu@gmail.com>",
|
||||||
"Stephen Whitmore <stephen.whitmore@gmail.com>",
|
"Stephen Whitmore <stephen.whitmore@gmail.com>",
|
||||||
|
"Topper Bowers <topper@toppingdesign.com>",
|
||||||
"Vasco Santos <vasco.santos@ua.pt>",
|
"Vasco Santos <vasco.santos@ua.pt>",
|
||||||
"Vasco Santos <vasco.santos@moxy.studio>",
|
"Vasco Santos <vasco.santos@moxy.studio>",
|
||||||
"Yahya <ya7yaz@gmail.com>",
|
"Yahya <ya7yaz@gmail.com>",
|
||||||
|
@ -48,6 +48,13 @@ class PeerId {
|
|||||||
if (this._privKey) {
|
if (this._privKey) {
|
||||||
return this._privKey.public
|
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) {
|
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) => {
|
it('isPeerId', (done) => {
|
||||||
PeerId.create(testOpts, (err, id) => {
|
PeerId.create(testOpts, (err, id) => {
|
||||||
expect(err).to.not.exist()
|
expect(err).to.not.exist()
|
||||||
|
Reference in New Issue
Block a user