whisper: polish the messages, fix some bugs, tests

Bugs fixed:
  - Use randomly generated flags as the spec required.
  - During envelope opening check the first bit only for signature.
This commit is contained in:
Péter Szilágyi
2015-04-10 15:53:21 +03:00
parent 7e54a9c07f
commit 7d8ce53eca
6 changed files with 213 additions and 92 deletions

View File

@ -69,10 +69,10 @@ func selfSend(shh *whisper.Whisper, payload []byte) error {
})
// Wrap the payload and encrypt it
msg := whisper.NewMessage(payload)
envelope, err := msg.Seal(whisper.DefaultPow, whisper.Opts{
Ttl: whisper.DefaultTtl,
envelope, err := msg.Wrap(whisper.DefaultPow, whisper.Options{
From: id,
To: &id.PublicKey,
TTL: whisper.DefaultTimeToLive,
})
if err != nil {
return fmt.Errorf("failed to seal message: %v", err)