aboutsummaryrefslogtreecommitdiffstats
path: root/whisper
diff options
context:
space:
mode:
Diffstat (limited to 'whisper')
-rw-r--r--whisper/whisper.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/whisper/whisper.go b/whisper/whisper.go
index 59a1a63c4..61999f07a 100644
--- a/whisper/whisper.go
+++ b/whisper/whisper.go
@@ -260,9 +260,11 @@ func (self *Whisper) open(envelope *Envelope) *Message {
// Iterate over the keys and try to decrypt the message
for _, key := range self.keys {
message, err := envelope.Open(key)
- if err == nil || err == ecies.ErrInvalidPublicKey {
+ if err == nil {
message.To = &key.PublicKey
return message
+ } else if err == ecies.ErrInvalidPublicKey {
+ return message
}
}
// Failed to decrypt, don't return anything