From 4d328a35c0752be2d8464dcf0aa85474ca837dad Mon Sep 17 00:00:00 2001 From: vyzo Date: Thu, 2 May 2019 20:15:55 +0300 Subject: [PATCH] strict message signing by default --- pubsub.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pubsub.go b/pubsub.go index 79e48d0..c8a0e91 100644 --- a/pubsub.go +++ b/pubsub.go @@ -164,6 +164,7 @@ func NewPubSub(ctx context.Context, h host.Host, rt PubSubRouter, opts ...Option rt: rt, signID: h.ID(), signKey: h.Peerstore().PrivKey(h.ID()), + signStrict: true, incoming: make(chan *RPC, 32), publish: make(chan *Message), newPeers: make(chan peer.ID), @@ -231,6 +232,7 @@ func WithMessageSigning(enabled bool) Option { } } else { p.signKey = nil + p.signStrict = false } return nil } @@ -256,11 +258,8 @@ func WithMessageAuthor(author peer.ID) Option { } } -// WithStrictSignatureVerification enforces message signing. If set, unsigned -// messages will be discarded. -// -// This currently defaults to false but, as we transition to signing by default, -// will eventually default to true. +// WithStrictSignatureVerification is an option to enable or disable strict message signing. +// When enabled (which is the default), unsigned messages will be discarded. func WithStrictSignatureVerification(required bool) Option { return func(p *PubSub) error { p.signStrict = required