mirror of
https://github.com/status-im/status-go.git
synced 2025-01-10 14:47:06 +00:00
baa0767c26
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 :)
18 lines
407 B
Go
18 lines
407 B
Go
package protobuf
|
|
|
|
import (
|
|
"github.com/golang/protobuf/proto"
|
|
)
|
|
|
|
//go:generate protoc --go_out=. ./chat_message.proto ./application_metadata_message.proto ./membership_update_message.proto
|
|
|
|
func Unmarshal(payload []byte) (*ApplicationMetadataMessage, error) {
|
|
var message ApplicationMetadataMessage
|
|
err := proto.Unmarshal(payload, &message)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &message, nil
|
|
}
|