func WithMessageAuthor(author peer.ID) Option {
	return func(p *PubSub) error {
		if author == "" {
			author = p.host.ID()
		}
		if p.signKey != nil {
			newSignKey := p.host.Peerstore().PrivKey(author)
			if newSignKey == nil {
				return fmt.Errorf("can't sign for peer %s: no private key", p.signID)
			}
			p.signKey = newSignKey
		}
		p.signID = author
		return nil
	}
}
func WithMessageAuthor(author peer.ID) Option {
	return func(p *PubSub) error {
		if author == "" {
			author = p.host.ID()
		}
		if p.signKey != nil {
			newSignKey := p.host.Peerstore().PrivKey(author)
			if newSignKey == nil {
				return fmt.Errorf("can't sign for peer %s: no private key", p.signID)
			}
			p.signKey = newSignKey
		}
		p.signID = author
		return nil
	}
}
func WithMessageAuthor ( author peer . ID ) Option { return func ( p * PubSub ) error { if author == " " { author = p . host . ID ( ) } if p . signKey != nil { newSignKey := p . host . Peerstore ( ) . PrivKey ( author ) if newSignKey == nil { return fmt . Errorf ( " " , p . signID ) } p . signKey = newSignKey } p . signID = author return nil } }
// WithMessageAuthor sets the author for outbound messages to the given peer ID
// (defaults to the host's ID). If message signing is enabled, the private key
// must be available in the host's peerstore.
WithMessageAuthor sets the author for outbound messages to the given peer ID ( defaults to the host s ID ) . If message signing is enabled the private key must be available in the host s peerstore .