status-go/protocol/v1/message_test.go
Andrea Maria Piana baa0767c26
Handle membership update message
This commit does a few things:

1) Handle membership updates using protobuf and adds the relevant
endpoints.
2) Store in memory a map of chats + contacts for faster lookups, which
are then flushed to disk on each update
3) Validate incoming messages

Sorry for the large pr, but you know, v1 :)
2019-12-10 15:20:28 +01:00

21 lines
489 B
Go

package protocol
import (
"testing"
"github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/eth-node/types"
"github.com/stretchr/testify/require"
)
func TestMessageID(t *testing.T) {
key, err := crypto.GenerateKey()
require.NoError(t, err)
keyBytes := crypto.FromECDSAPub(&key.PublicKey)
data := []byte("test")
expectedID := types.HexBytes(crypto.Keccak256(append(keyBytes, data...)))
require.Equal(t, expectedID, MessageID(&key.PublicKey, data))
}