API changed to use Pubkey only. Reflected that change in the rest of the api

This commit is contained in:
obscuren 2015-02-05 15:00:59 -08:00
parent 191b2753de
commit 3a64b03e88
3 changed files with 3 additions and 3 deletions

View File

@ -3,7 +3,7 @@ package whisper
import "crypto/ecdsa" import "crypto/ecdsa"
type Filter struct { type Filter struct {
To *ecdsa.PrivateKey To *ecdsa.PublicKey
From *ecdsa.PublicKey From *ecdsa.PublicKey
Topics [][]byte Topics [][]byte
Fn func(*Message) Fn func(*Message)

View File

@ -118,7 +118,7 @@ func (self *Whisper) GetIdentity(key *ecdsa.PublicKey) *ecdsa.PrivateKey {
func (self *Whisper) Watch(opts Filter) int { func (self *Whisper) Watch(opts Filter) int {
return self.filters.Install(filter.Generic{ return self.filters.Install(filter.Generic{
Str1: string(crypto.FromECDSA(opts.To)), Str1: string(crypto.FromECDSAPub(opts.To)),
Str2: string(crypto.FromECDSAPub(opts.From)), Str2: string(crypto.FromECDSAPub(opts.From)),
Data: bytesToMap(opts.Topics), Data: bytesToMap(opts.Topics),
Fn: func(data interface{}) { Fn: func(data interface{}) {

View File

@ -11,7 +11,7 @@ func TestEvent(t *testing.T) {
whisper := New() whisper := New()
id := whisper.NewIdentity() id := whisper.NewIdentity()
whisper.Watch(Filter{ whisper.Watch(Filter{
To: id, To: &id.PublicKey,
Fn: func(msg *Message) { Fn: func(msg *Message) {
res <- msg res <- msg
}, },