Skip to content

Commit

Permalink
fix: use strict signing properly and fix callback issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobheun committed Jul 8, 2019
1 parent 8d7a9b4 commit ca99ce9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 9 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ class PubsubBaseProtocol extends EventEmitter {
this.peerId = this.libp2p.peerInfo.id
}

/**
* If message signing should be required for incoming messages
* @type {boolean}
*/
this.strictSigning = options.strictSigning

/**
* Map of topics to which peers are subscribed to
*
Expand Down Expand Up @@ -374,6 +380,9 @@ class PubsubBaseProtocol extends EventEmitter {
if (err) return callback(err)
callback(null, valid)
})
} else {
// The message is valid
nextTick(callback, null, true)
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions test/pubsub.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ describe('pubsub base protocol', () => {
psA._buildMessage(message, (err, signedMessage) => {
expect(err).to.not.exist()

// const bytesToSign = Buffer.concat([
// SignPrefix,
// Message.encode(normalizeOutRpcMessage(message))
// ])

psA.validate(signedMessage, (err, verified) => {
expect(verified).to.eql(true)
done(err)
Expand Down

0 comments on commit ca99ce9

Please sign in to comment.