aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisper.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-10 21:17:32 +0800
committerobscuren <geffobscura@gmail.com>2014-12-10 21:17:32 +0800
commitdda778eda7ad9b94acf14c3c91c1c29e711e170f (patch)
treedfbb71a45399455fd2c2bb77ce72c8ce9d79ba45 /whisper/whisper.go
parent0f5c6c5e2daa9fbf3a0bb753debd8989a872823c (diff)
downloadgo-tangerine-dda778eda7ad9b94acf14c3c91c1c29e711e170f.tar
go-tangerine-dda778eda7ad9b94acf14c3c91c1c29e711e170f.tar.gz
go-tangerine-dda778eda7ad9b94acf14c3c91c1c29e711e170f.tar.bz2
go-tangerine-dda778eda7ad9b94acf14c3c91c1c29e711e170f.tar.lz
go-tangerine-dda778eda7ad9b94acf14c3c91c1c29e711e170f.tar.xz
go-tangerine-dda778eda7ad9b94acf14c3c91c1c29e711e170f.tar.zst
go-tangerine-dda778eda7ad9b94acf14c3c91c1c29e711e170f.zip
Updated whisper messages to new crypto api + added tests
Diffstat (limited to 'whisper/whisper.go')
-rw-r--r--whisper/whisper.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/whisper/whisper.go b/whisper/whisper.go
index b4e37b959..4d7a2a23e 100644
--- a/whisper/whisper.go
+++ b/whisper/whisper.go
@@ -2,11 +2,13 @@ package whisper
import (
"bytes"
+ "crypto/ecdsa"
"errors"
"fmt"
"sync"
"time"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/p2p"
"gopkg.in/fatih/set.v0"
)
@@ -39,7 +41,7 @@ const (
const DefaultTtl = 50 * time.Second
type Whisper struct {
- pub, sec []byte
+ key *ecdsa.PrivateKey
protocol p2p.Protocol
mmu sync.RWMutex
@@ -49,10 +51,9 @@ type Whisper struct {
quit chan struct{}
}
-func New(pub, sec []byte) *Whisper {
+func New(sec []byte) *Whisper {
whisper := &Whisper{
- pub: pub,
- sec: sec,
+ key: crypto.ToECDSA(sec),
messages: make(map[Hash]*Envelope),
expiry: make(map[uint32]*set.SetNonTS),
quit: make(chan struct{}),