@@ -51,7 +51,7 @@ class IpnsPublisher {
51
51
}
52
52
53
53
_putRecordToRouting ( record , peerId , callback ) {
54
- if ( ! ( peerId instanceof PeerId ) ) {
54
+ if ( ! ( PeerId . isPeerId ( peerId ) ) ) {
55
55
const errMsg = `peerId received is not valid`
56
56
57
57
log . error ( errMsg )
@@ -90,7 +90,7 @@ class IpnsPublisher {
90
90
}
91
91
92
92
_publishEntry ( key , entry , peerId , callback ) {
93
- if ( ! ( key instanceof Key ) ) {
93
+ if ( ! ( Key . isKey ( key ) ) ) {
94
94
const errMsg = `datastore key does not have a valid format`
95
95
96
96
log . error ( errMsg )
@@ -123,7 +123,7 @@ class IpnsPublisher {
123
123
}
124
124
125
125
_publishPublicKey ( key , publicKey , peerId , callback ) {
126
- if ( ! ( key instanceof Key ) ) {
126
+ if ( ( ! Key . isKey ( key ) ) ) {
127
127
const errMsg = `datastore key does not have a valid format`
128
128
129
129
log . error ( errMsg )
@@ -163,7 +163,7 @@ class IpnsPublisher {
163
163
// Returns the record this node has published corresponding to the given peer ID.
164
164
// If `checkRouting` is true and we have no existing record, this method will check the routing system for any existing records.
165
165
_getPublished ( peerId , options , callback ) {
166
- if ( ! ( peerId instanceof PeerId ) ) {
166
+ if ( ! ( PeerId . isPeerId ( peerId ) ) ) {
167
167
const errMsg = `peerId received is not valid`
168
168
169
169
log . error ( errMsg )
@@ -216,7 +216,7 @@ class IpnsPublisher {
216
216
}
217
217
218
218
_updateOrCreateRecord ( privKey , value , validity , peerId , callback ) {
219
- if ( ! ( peerId instanceof PeerId ) ) {
219
+ if ( ! ( PeerId . isPeerId ( peerId ) ) ) {
220
220
const errMsg = `peerId received is not valid`
221
221
222
222
log . error ( errMsg )
0 commit comments