Fixed "to" field

This commit is contained in:
obscuren
2015-02-10 13:20:06 +01:00
parent 58ba290a9f
commit ddccea75e8
3 changed files with 7 additions and 1 deletions

View File

@ -12,6 +12,8 @@ type Message struct {
Signature []byte
Payload []byte
Sent int64
To *ecdsa.PublicKey
}
func NewMessage(payload []byte) *Message {

View File

@ -256,6 +256,8 @@ func (self *Whisper) postEvent(envelope *Envelope) {
func (self *Whisper) open(envelope *Envelope) (*Message, *ecdsa.PrivateKey) {
for _, key := range self.keys {
if message, err := envelope.Open(key); err == nil || (err != nil && err == ecies.ErrInvalidPublicKey) {
message.To = &key.PublicKey
return message, key
}
}