Remove PushNotificationRegister as we can use ApplicationMessage as a wrapper

This commit is contained in:
Andrea Maria Piana 2020-06-30 15:14:25 +02:00
parent 4ded7bf74c
commit e19c799be2
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
6 changed files with 162 additions and 165 deletions

View File

@ -79,7 +79,7 @@ func (x PushNotificationRegistrationResponse_ErrorType) String() string {
} }
func (PushNotificationRegistrationResponse_ErrorType) EnumDescriptor() ([]byte, []int) { func (PushNotificationRegistrationResponse_ErrorType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_200acd86044eaa5d, []int{4, 0} return fileDescriptor_200acd86044eaa5d, []int{3, 0}
} }
type PushNotificationTokenPair struct { type PushNotificationTokenPair struct {
@ -271,53 +271,6 @@ func (m *PushNotificationPreferences) GetAccessToken() string {
return "" return ""
} }
type PushNotificationRegister struct {
Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *PushNotificationRegister) Reset() { *m = PushNotificationRegister{} }
func (m *PushNotificationRegister) String() string { return proto.CompactTextString(m) }
func (*PushNotificationRegister) ProtoMessage() {}
func (*PushNotificationRegister) Descriptor() ([]byte, []int) {
return fileDescriptor_200acd86044eaa5d, []int{3}
}
func (m *PushNotificationRegister) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PushNotificationRegister.Unmarshal(m, b)
}
func (m *PushNotificationRegister) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PushNotificationRegister.Marshal(b, m, deterministic)
}
func (m *PushNotificationRegister) XXX_Merge(src proto.Message) {
xxx_messageInfo_PushNotificationRegister.Merge(m, src)
}
func (m *PushNotificationRegister) XXX_Size() int {
return xxx_messageInfo_PushNotificationRegister.Size(m)
}
func (m *PushNotificationRegister) XXX_DiscardUnknown() {
xxx_messageInfo_PushNotificationRegister.DiscardUnknown(m)
}
var xxx_messageInfo_PushNotificationRegister proto.InternalMessageInfo
func (m *PushNotificationRegister) GetPayload() []byte {
if m != nil {
return m.Payload
}
return nil
}
func (m *PushNotificationRegister) GetSignature() []byte {
if m != nil {
return m.Signature
}
return nil
}
type PushNotificationRegistrationResponse struct { type PushNotificationRegistrationResponse struct {
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
Error PushNotificationRegistrationResponse_ErrorType `protobuf:"varint,2,opt,name=error,proto3,enum=protobuf.PushNotificationRegistrationResponse_ErrorType" json:"error,omitempty"` Error PushNotificationRegistrationResponse_ErrorType `protobuf:"varint,2,opt,name=error,proto3,enum=protobuf.PushNotificationRegistrationResponse_ErrorType" json:"error,omitempty"`
@ -332,7 +285,7 @@ func (m *PushNotificationRegistrationResponse) Reset() { *m = PushNotifi
func (m *PushNotificationRegistrationResponse) String() string { return proto.CompactTextString(m) } func (m *PushNotificationRegistrationResponse) String() string { return proto.CompactTextString(m) }
func (*PushNotificationRegistrationResponse) ProtoMessage() {} func (*PushNotificationRegistrationResponse) ProtoMessage() {}
func (*PushNotificationRegistrationResponse) Descriptor() ([]byte, []int) { func (*PushNotificationRegistrationResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_200acd86044eaa5d, []int{4} return fileDescriptor_200acd86044eaa5d, []int{3}
} }
func (m *PushNotificationRegistrationResponse) XXX_Unmarshal(b []byte) error { func (m *PushNotificationRegistrationResponse) XXX_Unmarshal(b []byte) error {
@ -394,7 +347,7 @@ func (m *PushNotificationAdvertisementInfo) Reset() { *m = PushNotificat
func (m *PushNotificationAdvertisementInfo) String() string { return proto.CompactTextString(m) } func (m *PushNotificationAdvertisementInfo) String() string { return proto.CompactTextString(m) }
func (*PushNotificationAdvertisementInfo) ProtoMessage() {} func (*PushNotificationAdvertisementInfo) ProtoMessage() {}
func (*PushNotificationAdvertisementInfo) Descriptor() ([]byte, []int) { func (*PushNotificationAdvertisementInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_200acd86044eaa5d, []int{5} return fileDescriptor_200acd86044eaa5d, []int{4}
} }
func (m *PushNotificationAdvertisementInfo) XXX_Unmarshal(b []byte) error { func (m *PushNotificationAdvertisementInfo) XXX_Unmarshal(b []byte) error {
@ -447,7 +400,7 @@ func (m *ContactCodeAdvertisement) Reset() { *m = ContactCodeAdvertiseme
func (m *ContactCodeAdvertisement) String() string { return proto.CompactTextString(m) } func (m *ContactCodeAdvertisement) String() string { return proto.CompactTextString(m) }
func (*ContactCodeAdvertisement) ProtoMessage() {} func (*ContactCodeAdvertisement) ProtoMessage() {}
func (*ContactCodeAdvertisement) Descriptor() ([]byte, []int) { func (*ContactCodeAdvertisement) Descriptor() ([]byte, []int) {
return fileDescriptor_200acd86044eaa5d, []int{6} return fileDescriptor_200acd86044eaa5d, []int{5}
} }
func (m *ContactCodeAdvertisement) XXX_Unmarshal(b []byte) error { func (m *ContactCodeAdvertisement) XXX_Unmarshal(b []byte) error {
@ -486,7 +439,7 @@ func (m *PushNotificationQuery) Reset() { *m = PushNotificationQuery{} }
func (m *PushNotificationQuery) String() string { return proto.CompactTextString(m) } func (m *PushNotificationQuery) String() string { return proto.CompactTextString(m) }
func (*PushNotificationQuery) ProtoMessage() {} func (*PushNotificationQuery) ProtoMessage() {}
func (*PushNotificationQuery) Descriptor() ([]byte, []int) { func (*PushNotificationQuery) Descriptor() ([]byte, []int) {
return fileDescriptor_200acd86044eaa5d, []int{7} return fileDescriptor_200acd86044eaa5d, []int{6}
} }
func (m *PushNotificationQuery) XXX_Unmarshal(b []byte) error { func (m *PushNotificationQuery) XXX_Unmarshal(b []byte) error {
@ -528,7 +481,7 @@ func (m *PushNotificationQueryInfo) Reset() { *m = PushNotificationQuery
func (m *PushNotificationQueryInfo) String() string { return proto.CompactTextString(m) } func (m *PushNotificationQueryInfo) String() string { return proto.CompactTextString(m) }
func (*PushNotificationQueryInfo) ProtoMessage() {} func (*PushNotificationQueryInfo) ProtoMessage() {}
func (*PushNotificationQueryInfo) Descriptor() ([]byte, []int) { func (*PushNotificationQueryInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_200acd86044eaa5d, []int{8} return fileDescriptor_200acd86044eaa5d, []int{7}
} }
func (m *PushNotificationQueryInfo) XXX_Unmarshal(b []byte) error { func (m *PushNotificationQueryInfo) XXX_Unmarshal(b []byte) error {
@ -588,7 +541,7 @@ func (m *PushNotificationQueryResponse) Reset() { *m = PushNotificationQ
func (m *PushNotificationQueryResponse) String() string { return proto.CompactTextString(m) } func (m *PushNotificationQueryResponse) String() string { return proto.CompactTextString(m) }
func (*PushNotificationQueryResponse) ProtoMessage() {} func (*PushNotificationQueryResponse) ProtoMessage() {}
func (*PushNotificationQueryResponse) Descriptor() ([]byte, []int) { func (*PushNotificationQueryResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_200acd86044eaa5d, []int{9} return fileDescriptor_200acd86044eaa5d, []int{8}
} }
func (m *PushNotificationQueryResponse) XXX_Unmarshal(b []byte) error { func (m *PushNotificationQueryResponse) XXX_Unmarshal(b []byte) error {
@ -628,7 +581,7 @@ func (m *PushNotification) Reset() { *m = PushNotification{} }
func (m *PushNotification) String() string { return proto.CompactTextString(m) } func (m *PushNotification) String() string { return proto.CompactTextString(m) }
func (*PushNotification) ProtoMessage() {} func (*PushNotification) ProtoMessage() {}
func (*PushNotification) Descriptor() ([]byte, []int) { func (*PushNotification) Descriptor() ([]byte, []int) {
return fileDescriptor_200acd86044eaa5d, []int{10} return fileDescriptor_200acd86044eaa5d, []int{9}
} }
func (m *PushNotification) XXX_Unmarshal(b []byte) error { func (m *PushNotification) XXX_Unmarshal(b []byte) error {
@ -677,7 +630,7 @@ func (m *PushNotificationRequest) Reset() { *m = PushNotificationRequest
func (m *PushNotificationRequest) String() string { return proto.CompactTextString(m) } func (m *PushNotificationRequest) String() string { return proto.CompactTextString(m) }
func (*PushNotificationRequest) ProtoMessage() {} func (*PushNotificationRequest) ProtoMessage() {}
func (*PushNotificationRequest) Descriptor() ([]byte, []int) { func (*PushNotificationRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_200acd86044eaa5d, []int{11} return fileDescriptor_200acd86044eaa5d, []int{10}
} }
func (m *PushNotificationRequest) XXX_Unmarshal(b []byte) error { func (m *PushNotificationRequest) XXX_Unmarshal(b []byte) error {
@ -737,7 +690,7 @@ func (m *PushNotificationAcknowledgement) Reset() { *m = PushNotificatio
func (m *PushNotificationAcknowledgement) String() string { return proto.CompactTextString(m) } func (m *PushNotificationAcknowledgement) String() string { return proto.CompactTextString(m) }
func (*PushNotificationAcknowledgement) ProtoMessage() {} func (*PushNotificationAcknowledgement) ProtoMessage() {}
func (*PushNotificationAcknowledgement) Descriptor() ([]byte, []int) { func (*PushNotificationAcknowledgement) Descriptor() ([]byte, []int) {
return fileDescriptor_200acd86044eaa5d, []int{12} return fileDescriptor_200acd86044eaa5d, []int{11}
} }
func (m *PushNotificationAcknowledgement) XXX_Unmarshal(b []byte) error { func (m *PushNotificationAcknowledgement) XXX_Unmarshal(b []byte) error {
@ -771,7 +724,6 @@ func init() {
proto.RegisterType((*PushNotificationTokenPair)(nil), "protobuf.PushNotificationTokenPair") proto.RegisterType((*PushNotificationTokenPair)(nil), "protobuf.PushNotificationTokenPair")
proto.RegisterType((*PushNotificationOptions)(nil), "protobuf.PushNotificationOptions") proto.RegisterType((*PushNotificationOptions)(nil), "protobuf.PushNotificationOptions")
proto.RegisterType((*PushNotificationPreferences)(nil), "protobuf.PushNotificationPreferences") proto.RegisterType((*PushNotificationPreferences)(nil), "protobuf.PushNotificationPreferences")
proto.RegisterType((*PushNotificationRegister)(nil), "protobuf.PushNotificationRegister")
proto.RegisterType((*PushNotificationRegistrationResponse)(nil), "protobuf.PushNotificationRegistrationResponse") proto.RegisterType((*PushNotificationRegistrationResponse)(nil), "protobuf.PushNotificationRegistrationResponse")
proto.RegisterType((*PushNotificationAdvertisementInfo)(nil), "protobuf.PushNotificationAdvertisementInfo") proto.RegisterType((*PushNotificationAdvertisementInfo)(nil), "protobuf.PushNotificationAdvertisementInfo")
proto.RegisterType((*ContactCodeAdvertisement)(nil), "protobuf.ContactCodeAdvertisement") proto.RegisterType((*ContactCodeAdvertisement)(nil), "protobuf.ContactCodeAdvertisement")
@ -786,60 +738,58 @@ func init() {
func init() { proto.RegisterFile("push_notifications.proto", fileDescriptor_200acd86044eaa5d) } func init() { proto.RegisterFile("push_notifications.proto", fileDescriptor_200acd86044eaa5d) }
var fileDescriptor_200acd86044eaa5d = []byte{ var fileDescriptor_200acd86044eaa5d = []byte{
// 876 bytes of a gzipped FileDescriptorProto // 846 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xdf, 0x6f, 0xe3, 0x44, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xdf, 0x6f, 0xe3, 0x44,
0x10, 0xc6, 0x49, 0xda, 0xc6, 0x93, 0x90, 0xa6, 0xab, 0x5e, 0xcf, 0x1c, 0x1c, 0xd7, 0x1a, 0x10, 0x10, 0xc6, 0x49, 0xda, 0x26, 0x93, 0x90, 0xa6, 0xab, 0x5e, 0xcf, 0x1c, 0x3a, 0xae, 0x35, 0x20,
0xd5, 0x21, 0x45, 0xa2, 0x48, 0x70, 0x12, 0x4f, 0xa1, 0xe7, 0x1e, 0xa6, 0x8d, 0x13, 0x36, 0x29, 0xaa, 0x43, 0x8a, 0x44, 0x91, 0xe0, 0x24, 0x9e, 0x42, 0xcf, 0x3d, 0x4c, 0x1b, 0xdb, 0x6c, 0x52,
0x3f, 0x9e, 0x2c, 0xc7, 0xde, 0xb4, 0xab, 0xf8, 0xbc, 0x66, 0x77, 0x7d, 0xa7, 0x3c, 0x20, 0x21, 0x7e, 0x3c, 0x59, 0x8e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6, 0x0a, 0x8f, 0x15, 0xe6, 0x8d, 0xac, 0xbc, 0xac, 0x10, 0xe5, 0xc5, 0x1f, 0x45, 0x35,
0x79, 0x4d, 0x84, 0xf0, 0xae, 0x0a, 0x59, 0x2a, 0xcc, 0x14, 0xe2, 0xfc, 0xf3, 0x86, 0xa9, 0x7a, 0xb2, 0xc2, 0x85, 0xcb, 0xf8, 0x02, 0x9e, 0x6d, 0xec, 0x60, 0xb0, 0x8a, 0xd9, 0xdb, 0x88, 0x84,
0xee, 0xb1, 0x83, 0xac, 0x91, 0xa5, 0x9b, 0x26, 0xa2, 0x3c, 0xff, 0x97, 0x52, 0x8d, 0x2c, 0x71, 0x57, 0xf9, 0x3a, 0x0f, 0xa1, 0x45, 0xc3, 0x82, 0x84, 0x16, 0x0d, 0x17, 0xdb, 0x0a, 0xf3, 0x97,
0xee, 0x32, 0xbf, 0x84, 0x67, 0x6b, 0x1c, 0xf4, 0x97, 0x11, 0x7b, 0x1b, 0x92, 0xe0, 0x2a, 0xa3, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xd1, 0xea, 0x9e, 0xf4, 0xc8, 0x07, 0x00, 0x00,
0x73, 0x0f, 0x1a, 0x34, 0xc8, 0x41, 0x68, 0xd0, 0x60, 0xbe, 0xad, 0x6a, 0xfe, 0xea, 0xff, 0x00,
0x00, 0x00, 0xff, 0xff, 0xc3, 0x71, 0xe1, 0x4f, 0x1c, 0x08, 0x00, 0x00,
} }

View File

@ -28,12 +28,6 @@ message PushNotificationPreferences {
string access_token = 4; string access_token = 4;
} }
message PushNotificationRegister {
bytes payload = 1;
bytes signature = 2;
}
message PushNotificationRegistrationResponse { message PushNotificationRegistrationResponse {
bool success = 1; bool success = 1;
ErrorType error = 2; ErrorType error = 2;

View File

@ -9,8 +9,6 @@ import (
"golang.org/x/crypto/sha3" "golang.org/x/crypto/sha3"
"github.com/golang/protobuf/proto"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/status-im/status-go/eth-node/crypto" "github.com/status-im/status-go/eth-node/crypto"
@ -51,8 +49,8 @@ type Client struct {
persistence *Persistence persistence *Persistence
config *Config config *Config
// lastPushNotificationRegister is the latest known push notification register message // lastPushNotificationPreferences is the latest known push notification preferences message
lastPushNotificationRegister *protobuf.PushNotificationRegister lastPushNotificationPreferences *protobuf.PushNotificationPreferences
// AccessToken is the access token that is currently being used // AccessToken is the access token that is currently being used
AccessToken string AccessToken string
@ -171,13 +169,11 @@ func (p *Client) buildPushNotificationOptionsMessage(token string) (*protobuf.Pu
return options, nil return options, nil
} }
func (p *Client) buildPushNotificationRegisterMessage() (*protobuf.PushNotificationRegister, error) { func (p *Client) buildPushNotificationPreferencesMessage() (*protobuf.PushNotificationPreferences, error) {
pushNotificationPreferences := &protobuf.PushNotificationPreferences{} pushNotificationPreferences := &protobuf.PushNotificationPreferences{}
if p.lastPushNotificationRegister != nil { if p.lastPushNotificationPreferences != nil {
if err := proto.Unmarshal(p.lastPushNotificationRegister.Payload, pushNotificationPreferences); err != nil { pushNotificationPreferences = p.lastPushNotificationPreferences
return nil, err
}
} }
// Increment version // Increment version
@ -209,14 +205,7 @@ func (p *Client) buildPushNotificationRegisterMessage() (*protobuf.PushNotificat
pushNotificationPreferences.Options = options pushNotificationPreferences.Options = options
// Marshal return pushNotificationPreferences, nil
payload, err := proto.Marshal(pushNotificationPreferences)
if err != nil {
return nil, err
}
message := &protobuf.PushNotificationRegister{Payload: payload}
return message, nil
} }
func (p *Client) Register(deviceToken string) error { func (p *Client) Register(deviceToken string) error {

View File

@ -7,7 +7,6 @@ import (
"testing" "testing"
"github.com/golang/protobuf/proto"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/status-im/status-go/eth-node/crypto" "github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/eth-node/crypto/ecies" "github.com/status-im/status-go/eth-node/crypto/ecies"
@ -87,15 +86,10 @@ func TestBuildPushNotificationRegisterMessage(t *testing.T) {
AccessToken: expectedUUID, AccessToken: expectedUUID,
} }
// Marshal message actualMessage, err := client.buildPushNotificationPreferencesMessage()
marshaledPreferences, err := proto.Marshal(preferences)
require.NoError(t, err) require.NoError(t, err)
expectedMessage := &protobuf.PushNotificationRegister{Payload: marshaledPreferences} require.Equal(t, preferences, actualMessage)
actualMessage, err := client.buildPushNotificationRegisterMessage()
require.NoError(t, err)
require.Equal(t, expectedMessage, actualMessage)
} }
func TestBuildPushNotificationRegisterMessageWithPrevious(t *testing.T) { func TestBuildPushNotificationRegisterMessageWithPrevious(t *testing.T) {
@ -124,12 +118,6 @@ func TestBuildPushNotificationRegisterMessageWithPrevious(t *testing.T) {
AccessToken: "some-token", AccessToken: "some-token",
} }
// Marshal message
marshaledPreferences2, err := proto.Marshal(preferences2)
require.NoError(t, err)
lastPushNotificationRegister := &protobuf.PushNotificationRegister{Payload: marshaledPreferences2}
mutedChatList := []string{"a", "b"} mutedChatList := []string{"a", "b"}
// build chat lish hashes // build chat lish hashes
@ -188,7 +176,7 @@ func TestBuildPushNotificationRegisterMessageWithPrevious(t *testing.T) {
client := &Client{} client := &Client{}
client.config = config client.config = config
client.DeviceToken = deviceToken1 client.DeviceToken = deviceToken1
client.lastPushNotificationRegister = lastPushNotificationRegister client.lastPushNotificationPreferences = preferences2
// Set reader // Set reader
client.reader = bytes.NewReader([]byte(expectedUUID)) client.reader = bytes.NewReader([]byte(expectedUUID))
@ -207,13 +195,8 @@ func TestBuildPushNotificationRegisterMessageWithPrevious(t *testing.T) {
AccessToken: expectedUUID, AccessToken: expectedUUID,
} }
// Marshal message actualMessage, err := client.buildPushNotificationPreferencesMessage()
marshaledPreferences, err := proto.Marshal(preferences)
require.NoError(t, err) require.NoError(t, err)
expectedMessage := &protobuf.PushNotificationRegister{Payload: marshaledPreferences} require.Equal(t, preferences, actualMessage)
actualMessage, err := client.buildPushNotificationRegisterMessage()
require.NoError(t, err)
require.Equal(t, expectedMessage, actualMessage)
} }

View File

@ -1,12 +1,23 @@
package protocol package protocol
import ( import (
"crypto/ecdsa"
"errors" "errors"
"fmt"
"crypto/aes"
"crypto/cipher"
"crypto/ecdsa"
"github.com/status-im/status-go/eth-node/crypto/ecies"
"github.com/status-im/status-go/protocol/protobuf" "github.com/status-im/status-go/protocol/protobuf"
) )
var ErrEmptyPushNotificationRegisterMessage = errors.New("empty PushNotificationRegisterMessage") const encryptedPayloadKeyLength = 16
const nonceLength = 12
var ErrInvalidPushNotificationRegisterVersion = errors.New("invalid version")
var ErrEmptyPushNotificationRegisterPayload = errors.New("empty payload")
var ErrEmptyPushNotificationRegisterPublicKey = errors.New("no public key")
type Config struct { type Config struct {
// Identity is our identity key // Identity is our identity key
@ -24,9 +35,52 @@ func New(persistence *Persistence) *Server {
return &Server{persistence: persistence} return &Server{persistence: persistence}
} }
func (p *Server) ValidateRegistration(previousRegistration *protobuf.PushNotificationRegister, newRegistration *protobuf.PushNotificationRegister) error { func (p *Server) ValidateRegistration(previousPreferences *protobuf.PushNotificationPreferences, publicKey *ecdsa.PublicKey, payload []byte) error {
if newRegistration == nil { if payload == nil {
return ErrEmptyPushNotificationRegisterMessage return ErrEmptyPushNotificationRegisterPayload
} }
if publicKey == nil {
return ErrEmptyPushNotificationRegisterPublicKey
}
sharedKey, err := ecies.ImportECDSA(p.config.Identity).GenerateShared(
ecies.ImportECDSAPublic(publicKey),
encryptedPayloadKeyLength,
encryptedPayloadKeyLength,
)
if err != nil {
return err
}
decryptedPayload, err := decrypt(payload, sharedKey)
if err != nil {
return err
}
fmt.Println(decryptedPayload)
/*if newRegistration.Version < 1 {
return ErrInvalidPushNotificationRegisterVersion
}*/
return nil return nil
} }
func decrypt(cyphertext []byte, key []byte) ([]byte, error) {
if len(cyphertext) < nonceLength {
return nil, errors.New("invalid cyphertext length")
}
c, err := aes.NewCipher(key)
if err != nil {
return nil, err
}
gcm, err := cipher.NewGCM(c)
if err != nil {
return nil, err
}
nonce := cyphertext[:nonceLength]
return gcm.Open(nil, nonce, cyphertext, nil)
}

View File

@ -3,11 +3,38 @@ package protocol
import ( import (
"testing" "testing"
"github.com/ethereum/go-ethereum/crypto"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
//nodecrypto "github.com/status-im/status-go/eth-node/crypto"
//"github.com/status-im/status-go/protocol/protobuf"
) )
func TestPushNotificationServerValidateRegistration(t *testing.T) { func TestPushNotificationServerValidateRegistration(t *testing.T) {
server := Server{} identity, err := crypto.GenerateKey()
require.Equal(t, ErrEmptyPushNotificationRegisterMessage, server.ValidateRegistration(nil, nil)) require.NoError(t, err)
key, err := crypto.GenerateKey()
require.NoError(t, err)
config := &Config{
Identity: identity,
}
server := Server{config: config}
// Empty payload
require.Equal(t, ErrEmptyPushNotificationRegisterPayload, server.ValidateRegistration(nil, &key.PublicKey, nil))
// Empty key
require.Equal(t, ErrEmptyPushNotificationRegisterPublicKey, server.ValidateRegistration(nil, nil, []byte("payload")))
/*
// Invalid signature
signature, err := nodecrypto.SignBytes([]byte("a"), key)
require.Equal(t, ErrInvalidPushNotificationRegisterVersion, server.ValidateRegistration(nil, &protobuf.PushNotificationRegister{
Payload: []byte("btahtasht"),
Signature: signature,
}))*/
} }