mirror of
https://github.com/status-im/whisper.git
synced 2025-02-23 07:58:14 +00:00
API changed to use Pubkey only. Reflected that change in the rest of the api
This commit is contained in:
parent
191b2753de
commit
3a64b03e88
@ -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)
|
||||||
|
@ -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{}) {
|
||||||
|
@ -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
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user