mirror of
https://github.com/fluencelabs/js-peer-id
synced 2025-07-05 21:51:46 +00:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
85dac48621 | |||
f3fc3449c1 | |||
927a6cf078 | |||
73fe2c553f | |||
719ddfe8e2 | |||
037ed87dac | |||
af47794289 | |||
eeb53305c8 |
13
CHANGELOG.md
13
CHANGELOG.md
@ -1,3 +1,16 @@
|
|||||||
|
## [0.14.6](https://github.com/libp2p/js-peer-id/compare/v0.14.4...v0.14.6) (2021-04-06)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [0.14.4](https://github.com/libp2p/js-peer-id/compare/v0.14.3...v0.14.4) (2021-03-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* remove toString side effect that breaks deep equals ([#142](https://github.com/libp2p/js-peer-id/issues/142)) ([eeb5330](https://github.com/libp2p/js-peer-id/commit/eeb53305c8767a6a2b3f610fe9e45a589b4fa972)), closes [#141](https://github.com/libp2p/js-peer-id/issues/141)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [0.14.3](https://github.com/libp2p/js-peer-id/compare/v0.14.2...v0.14.3) (2021-01-26)
|
## [0.14.3](https://github.com/libp2p/js-peer-id/compare/v0.14.2...v0.14.3) (2021-01-26)
|
||||||
|
|
||||||
|
|
||||||
|
16
package.json
16
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "peer-id",
|
"name": "peer-id",
|
||||||
"version": "0.14.3",
|
"version": "0.14.6",
|
||||||
"description": "IPFS Peer Id implementation in Node.js",
|
"description": "IPFS Peer Id implementation in Node.js",
|
||||||
"leadMaintainer": "Vasco Santos <santos.vasco10@gmail.com>",
|
"leadMaintainer": "Vasco Santos <santos.vasco10@gmail.com>",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
@ -13,7 +13,7 @@
|
|||||||
"test:node": "aegir test -t node",
|
"test:node": "aegir test -t node",
|
||||||
"test:browser": "aegir test -t browser -t webworker",
|
"test:browser": "aegir test -t browser -t webworker",
|
||||||
"test:types": "npx tsc",
|
"test:types": "npx tsc",
|
||||||
"release": "aegir release",
|
"release": "aegir release --no-types",
|
||||||
"release-minor": "aegir release --type minor",
|
"release-minor": "aegir release --type minor",
|
||||||
"release-major": "aegir release --type major",
|
"release-major": "aegir release --type major",
|
||||||
"coverage": "aegir coverage",
|
"coverage": "aegir coverage",
|
||||||
@ -39,16 +39,16 @@
|
|||||||
"@types/chai": "^4.2.14",
|
"@types/chai": "^4.2.14",
|
||||||
"@types/dirty-chai": "^2.0.2",
|
"@types/dirty-chai": "^2.0.2",
|
||||||
"@types/mocha": "^8.2.0",
|
"@types/mocha": "^8.2.0",
|
||||||
"aegir": "^30.3.0"
|
"aegir": "^32.2.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cids": "^1.1.5",
|
"cids": "^1.1.6",
|
||||||
"class-is": "^1.1.0",
|
"class-is": "^1.1.0",
|
||||||
"libp2p-crypto": "^0.19.0",
|
"libp2p-crypto": "fluencelabs/js-libp2p-crypto",
|
||||||
"minimist": "^1.2.5",
|
"minimist": "^1.2.5",
|
||||||
"multihashes": "^3.1.1",
|
"multihashes": "^4.0.2",
|
||||||
"protons": "^2.0.0",
|
"protons": "^2.0.0",
|
||||||
"uint8arrays": "^2.0.5"
|
"uint8arrays": "^2.1.4"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -62,9 +62,9 @@
|
|||||||
"Jacob Heun <jacobheun@gmail.com>",
|
"Jacob Heun <jacobheun@gmail.com>",
|
||||||
"Pedro Teixeira <i@pgte.me>",
|
"Pedro Teixeira <i@pgte.me>",
|
||||||
"Stephen Whitmore <stephen.whitmore@gmail.com>",
|
"Stephen Whitmore <stephen.whitmore@gmail.com>",
|
||||||
|
"Alex Potsides <alex@achingbrain.net>",
|
||||||
"Hugo Dias <hugomrdias@gmail.com>",
|
"Hugo Dias <hugomrdias@gmail.com>",
|
||||||
"Maciej Krüger <mkg20001@gmail.com>",
|
"Maciej Krüger <mkg20001@gmail.com>",
|
||||||
"Alex Potsides <alex@achingbrain.net>",
|
|
||||||
"Nate Foss <npfoss@gmail.com>",
|
"Nate Foss <npfoss@gmail.com>",
|
||||||
"Robert Kiel <robert.kiel@validitylabs.org>",
|
"Robert Kiel <robert.kiel@validitylabs.org>",
|
||||||
"Adam Uhlíř <adam@uhlir.dev>",
|
"Adam Uhlíř <adam@uhlir.dev>",
|
||||||
|
@ -137,7 +137,11 @@ class PeerId {
|
|||||||
toString () {
|
toString () {
|
||||||
if (!this._idCIDString) {
|
if (!this._idCIDString) {
|
||||||
const cid = new CID(1, 'libp2p-key', this.id, 'base32')
|
const cid = new CID(1, 'libp2p-key', this.id, 'base32')
|
||||||
this._idCIDString = cid.toBaseEncodedString('base32')
|
|
||||||
|
Object.defineProperty(this, '_idCIDString', {
|
||||||
|
value: cid.toBaseEncodedString('base32'),
|
||||||
|
enumerable: false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
return this._idCIDString
|
return this._idCIDString
|
||||||
}
|
}
|
||||||
|
@ -309,6 +309,18 @@ describe('PeerId', () => {
|
|||||||
expect(peerId.isValid()).to.equal(false)
|
expect(peerId.isValid()).to.equal(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('keys are equal after one is stringified', async () => {
|
||||||
|
const peerId = await PeerId.create(testOpts)
|
||||||
|
const peerId1 = PeerId.createFromB58String(peerId.toB58String())
|
||||||
|
const peerId2 = PeerId.createFromB58String(peerId.toB58String())
|
||||||
|
|
||||||
|
expect(peerId1).to.deep.equal(peerId2)
|
||||||
|
|
||||||
|
peerId1.toString()
|
||||||
|
|
||||||
|
expect(peerId1).to.deep.equal(peerId2)
|
||||||
|
})
|
||||||
|
|
||||||
describe('returns error via cb instead of crashing', () => {
|
describe('returns error via cb instead of crashing', () => {
|
||||||
const garbage = [
|
const garbage = [
|
||||||
uint8ArrayFromString('00010203040506070809', 'base16'),
|
uint8ArrayFromString('00010203040506070809', 'base16'),
|
||||||
|
Reference in New Issue
Block a user