Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit c240d49

Browse files
vasco-santosAlan Shaw
authored andcommitted
fix: use class is function on ipns (#1617)
As `instance of` fails using different versions of a module, it was changed to use `class-is`. Needs: - [x] [js-peer-id#84](libp2p/js-peer-id#84) - [x] [interface-datastore#24](ipfs/interface-datastore#24) Fixes #1615
1 parent 89ca551 commit c240d49

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"hapi-set-header": "^1.0.2",
9898
"hoek": "^5.0.3",
9999
"human-to-milliseconds": "^1.0.0",
100-
"interface-datastore": "~0.5.0",
100+
"interface-datastore": "~0.6.0",
101101
"ipfs-api": "^24.0.0",
102102
"ipfs-bitswap": "~0.20.3",
103103
"ipfs-block": "~0.7.1",
@@ -111,7 +111,7 @@
111111
"ipld": "~0.17.3",
112112
"ipld-dag-cbor": "~0.12.1",
113113
"ipld-dag-pb": "~0.14.6",
114-
"ipns": "~0.2.0",
114+
"ipns": "~0.3.0",
115115
"is-ipfs": "~0.4.2",
116116
"is-pull-stream": "~0.0.0",
117117
"is-stream": "^1.1.0",
@@ -141,7 +141,7 @@
141141
"multihashes": "~0.4.13",
142142
"once": "^1.4.0",
143143
"peer-book": "~0.8.0",
144-
"peer-id": "~0.11.0",
144+
"peer-id": "~0.12.0",
145145
"peer-info": "~0.14.1",
146146
"progress": "^2.0.0",
147147
"promisify-es6": "^1.0.3",

src/core/ipns/publisher.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class IpnsPublisher {
5151
}
5252

5353
_putRecordToRouting (record, peerId, callback) {
54-
if (!(peerId instanceof PeerId)) {
54+
if (!(PeerId.isPeerId(peerId))) {
5555
const errMsg = `peerId received is not valid`
5656

5757
log.error(errMsg)
@@ -90,7 +90,7 @@ class IpnsPublisher {
9090
}
9191

9292
_publishEntry (key, entry, peerId, callback) {
93-
if (!(key instanceof Key)) {
93+
if (!(Key.isKey(key))) {
9494
const errMsg = `datastore key does not have a valid format`
9595

9696
log.error(errMsg)
@@ -123,7 +123,7 @@ class IpnsPublisher {
123123
}
124124

125125
_publishPublicKey (key, publicKey, peerId, callback) {
126-
if (!(key instanceof Key)) {
126+
if ((!Key.isKey(key))) {
127127
const errMsg = `datastore key does not have a valid format`
128128

129129
log.error(errMsg)
@@ -163,7 +163,7 @@ class IpnsPublisher {
163163
// Returns the record this node has published corresponding to the given peer ID.
164164
// If `checkRouting` is true and we have no existing record, this method will check the routing system for any existing records.
165165
_getPublished (peerId, options, callback) {
166-
if (!(peerId instanceof PeerId)) {
166+
if (!(PeerId.isPeerId(peerId))) {
167167
const errMsg = `peerId received is not valid`
168168

169169
log.error(errMsg)
@@ -216,7 +216,7 @@ class IpnsPublisher {
216216
}
217217

218218
_updateOrCreateRecord (privKey, value, validity, peerId, callback) {
219-
if (!(peerId instanceof PeerId)) {
219+
if (!(PeerId.isPeerId(peerId))) {
220220
const errMsg = `peerId received is not valid`
221221

222222
log.error(errMsg)

src/core/ipns/republisher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class IpnsRepublisher {
151151
}
152152

153153
_getPreviousValue (peerId, callback) {
154-
if (!(peerId instanceof PeerId)) {
154+
if (!(PeerId.isPeerId(peerId))) {
155155
const errMsg = `peerId received is not valid`
156156

157157
log.error(errMsg)

0 commit comments

Comments
 (0)