Add backing up of contacts

We periodically check whether we should backup contacts through waku.

Currently it's not tied to any event, it will only schedule a backup on
a tick, or through the provided API endpoint.
This commit is contained in:
Andrea Maria Piana 2021-10-11 16:39:52 +01:00
parent 7f4631b829
commit 301325a22e
18 changed files with 640 additions and 100 deletions

View File

@ -50,6 +50,7 @@
// 1630485153_networks.up.sql (394B)
// 1632262444_profile_pictures_show_to.up.sql (81B)
// 1635942153_add_telemetry_server_url_to_settings.up.sql (128B)
// 1635942154_add_backup_setting.up.sql (186B)
// doc.go (74B)
package migrations
@ -1119,6 +1120,26 @@ func _1635942153_add_telemetry_server_url_to_settingsUpSql() (*asset, error) {
return a, nil
}
var __1635942154_add_backup_settingUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\xce\x31\x0a\xc2\x40\x10\x46\xe1\x3e\xa7\xf8\x8f\xa0\xf5\x62\x31\x71\x47\x10\xc6\x59\x89\x33\x75\xd8\xe8\x22\x62\x08\xc2\xae\xf7\xb7\xb0\x11\x2d\x3c\xc0\xfb\x78\x24\xc6\x03\x8c\x7a\x61\xd4\xd2\xda\x6d\xb9\x56\x50\x8c\xd8\x26\xf1\x83\x62\xca\xe7\xfb\xf3\x31\x96\x25\x4f\x73\xb9\xa0\x4f\x49\x98\x14\x9a\x0c\xea\x22\x88\xbc\x23\x17\x83\x0d\xce\xa1\xfb\xa7\xcd\xb9\xb6\xf1\x4d\x62\xaf\xf6\xcb\xac\x42\xe7\xc7\x48\xf6\x91\x9f\xd8\xbe\x2f\x36\x58\x87\xee\x15\x00\x00\xff\xff\x6b\x1d\x44\xa1\xba\x00\x00\x00")
func _1635942154_add_backup_settingUpSqlBytes() ([]byte, error) {
return bindataRead(
__1635942154_add_backup_settingUpSql,
"1635942154_add_backup_setting.up.sql",
)
}
func _1635942154_add_backup_settingUpSql() (*asset, error) {
bytes, err := _1635942154_add_backup_settingUpSqlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "1635942154_add_backup_setting.up.sql", size: 186, mode: os.FileMode(0644), modTime: time.Unix(1636971544, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x42, 0xc3, 0x25, 0xc6, 0xd2, 0x86, 0x53, 0xa3, 0x52, 0x71, 0x1b, 0x54, 0xc9, 0x0, 0xf0, 0xe6, 0x46, 0x3c, 0x64, 0xa0, 0x2b, 0xfb, 0xb2, 0x2e, 0xc6, 0x67, 0x67, 0x6c, 0x6c, 0x40, 0xee, 0x2f}}
return a, nil
}
var _docGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2c\xc9\xb1\x0d\xc4\x20\x0c\x05\xd0\x9e\x29\xfe\x02\xd8\xfd\x6d\xe3\x4b\xac\x2f\x44\x82\x09\x78\x7f\xa5\x49\xfd\xa6\x1d\xdd\xe8\xd8\xcf\x55\x8a\x2a\xe3\x47\x1f\xbe\x2c\x1d\x8c\xfa\x6f\xe3\xb4\x34\xd4\xd9\x89\xbb\x71\x59\xb6\x18\x1b\x35\x20\xa2\x9f\x0a\x03\xa2\xe5\x0d\x00\x00\xff\xff\x60\xcd\x06\xbe\x4a\x00\x00\x00")
func docGoBytes() ([]byte, error) {
@ -1330,6 +1351,8 @@ var _bindata = map[string]func() (*asset, error){
"1635942153_add_telemetry_server_url_to_settings.up.sql": _1635942153_add_telemetry_server_url_to_settingsUpSql,
"1635942154_add_backup_setting.up.sql": _1635942154_add_backup_settingUpSql,
"doc.go": docGo,
}
@ -1424,7 +1447,8 @@ var _bintree = &bintree{nil, map[string]*bintree{
"1630485153_networks.up.sql": &bintree{_1630485153_networksUpSql, map[string]*bintree{}},
"1632262444_profile_pictures_show_to.up.sql": &bintree{_1632262444_profile_pictures_show_toUpSql, map[string]*bintree{}},
"1635942153_add_telemetry_server_url_to_settings.up.sql": &bintree{_1635942153_add_telemetry_server_url_to_settingsUpSql, map[string]*bintree{}},
"doc.go": &bintree{docGo, map[string]*bintree{}},
"1635942154_add_backup_setting.up.sql": &bintree{_1635942154_add_backup_settingUpSql, map[string]*bintree{}},
"doc.go": &bintree{docGo, map[string]*bintree{}},
}}
// RestoreAsset restores an asset under the given directory.

View File

@ -0,0 +1,3 @@
ALTER TABLE settings ADD COLUMN backup_enabled BOOLEAN NOT NULL DEFAULT TRUE;
ALTER TABLE settings ADD COLUMN last_backup INT NOT NULL DEFAULT 0;
UPDATE settings SET backup_enabled = 1;

View File

@ -137,6 +137,8 @@ type Settings struct {
GifFavorites *json.RawMessage `json:"gifs/favorite-gifs"`
OpenseaEnabled bool `json:"opensea-enabled?,omitempty"`
TelemetryServerURL string `json:"telemetry-server-url,omitempty"`
LastBackup uint64 `json:"last-backup,omitempty"`
BackupEnabled bool `json:"backup-enabled?,omitempty"`
}
func NewDB(db *sql.DB) *Database {
@ -430,6 +432,13 @@ func (db *Database) SaveSetting(setting string, value interface{}) error {
update, err = db.db.Prepare("UPDATE settings SET opensea_enabled = ? WHERE synthetic_id = 'id'")
case "telemetry-server-url":
update, err = db.db.Prepare("UPDATE settings SET telemetry_server_url = ? WHERE synthetic_id = 'id'")
case "backup-enabled?":
_, ok := value.(bool)
if !ok {
return ErrInvalidConfig
}
update, err = db.db.Prepare("UPDATE settings SET backup_enabled = ? WHERE synthetic_id = 'id'")
default:
return ErrInvalidConfig
}
@ -446,7 +455,7 @@ func (db *Database) GetNodeConfig(nodecfg interface{}) error {
func (db *Database) GetSettings() (Settings, error) {
var s Settings
err := db.db.QueryRow("SELECT address, anon_metrics_should_send, chaos_mode, currency, current_network, custom_bootnodes, custom_bootnodes_enabled, dapps_address, eip1581_address, fleet, hide_home_tooltip, installation_id, key_uid, keycard_instance_uid, keycard_paired_on, keycard_pairing, last_updated, latest_derived_path, link_preview_request_enabled, link_previews_enabled_sites, log_level, mnemonic, name, networks, notifications_enabled, push_notifications_server_enabled, push_notifications_from_contacts_only, remote_push_notifications_enabled, send_push_notifications, push_notifications_block_mentions, photo_path, pinned_mailservers, preferred_name, preview_privacy, public_key, remember_syncing_choice, signing_phrase, stickers_packs_installed, stickers_packs_pending, stickers_recent_stickers, syncing_on_mobile_network, default_sync_period, use_mailservers, messages_from_contacts_only, usernames, appearance, profile_pictures_show_to, profile_pictures_visibility, wallet_root_address, wallet_set_up_passed, wallet_visible_tokens, waku_bloom_filter_mode, webview_allow_permission_requests, current_user_status, send_status_updates, gif_recents, gif_favorites, opensea_enabled, telemetry_server_url FROM settings WHERE synthetic_id = 'id'").Scan(
err := db.db.QueryRow("SELECT address, anon_metrics_should_send, chaos_mode, currency, current_network, custom_bootnodes, custom_bootnodes_enabled, dapps_address, eip1581_address, fleet, hide_home_tooltip, installation_id, key_uid, keycard_instance_uid, keycard_paired_on, keycard_pairing, last_updated, latest_derived_path, link_preview_request_enabled, link_previews_enabled_sites, log_level, mnemonic, name, networks, notifications_enabled, push_notifications_server_enabled, push_notifications_from_contacts_only, remote_push_notifications_enabled, send_push_notifications, push_notifications_block_mentions, photo_path, pinned_mailservers, preferred_name, preview_privacy, public_key, remember_syncing_choice, signing_phrase, stickers_packs_installed, stickers_packs_pending, stickers_recent_stickers, syncing_on_mobile_network, default_sync_period, use_mailservers, messages_from_contacts_only, usernames, appearance, profile_pictures_show_to, profile_pictures_visibility, wallet_root_address, wallet_set_up_passed, wallet_visible_tokens, waku_bloom_filter_mode, webview_allow_permission_requests, current_user_status, send_status_updates, gif_recents, gif_favorites, opensea_enabled, last_backup, backup_enabled,telemetry_server_url FROM settings WHERE synthetic_id = 'id'").Scan(
&s.Address,
&s.AnonMetricsShouldSend,
&s.ChaosMode,
@ -505,6 +514,8 @@ func (db *Database) GetSettings() (Settings, error) {
&sqlite.JSONBlob{Data: &s.GifRecents},
&sqlite.JSONBlob{Data: &s.GifFavorites},
&s.OpenseaEnabled,
&s.LastBackup,
&s.BackupEnabled,
&s.TelemetryServerURL,
)
return s, err
@ -730,3 +741,26 @@ func (db *Database) ShouldBroadcastUserStatus() (bool, error) {
}
return result, err
}
func (db *Database) BackupEnabled() (bool, error) {
var result bool
err := db.db.QueryRow("SELECT backup_enabled FROM settings WHERE synthetic_id = 'id'").Scan(&result)
if err == sql.ErrNoRows {
return true, nil
}
return result, err
}
func (db *Database) LastBackup() (uint64, error) {
var result uint64
err := db.db.QueryRow("SELECT last_backup FROM settings WHERE synthetic_id = 'id'").Scan(&result)
if err == sql.ErrNoRows {
return 0, nil
}
return result, err
}
func (db *Database) SetLastBackup(time uint64) error {
_, err := db.db.Exec("UPDATE settings SET last_backup = ?", time)
return err
}

View File

@ -421,7 +421,7 @@ func _1636536507_add_index_bundlesUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1636536507_add_index_bundles.up.sql", size: 347, mode: os.FileMode(0644), modTime: time.Unix(1636546585, 0)}
info := bindataFileInfo{name: "1636536507_add_index_bundles.up.sql", size: 347, mode: os.FileMode(0644), modTime: time.Unix(1636971544, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf1, 0xb9, 0x3c, 0x16, 0xfc, 0xfb, 0xb2, 0xb4, 0x3b, 0xfe, 0xdc, 0xf5, 0x9c, 0x42, 0xa0, 0xa0, 0xd4, 0xd, 0x5b, 0x97, 0x10, 0x80, 0x95, 0xe, 0x13, 0xc1, 0x18, 0x8, 0xee, 0xf, 0x99, 0xee}}
return a, nil
}

View File

@ -526,6 +526,7 @@ func (m *Messenger) Start() (*MessengerResponse, error) {
m.watchExpiredEmojis()
m.watchIdentityImageChanges()
m.broadcastLatestUserStatus()
m.startBackupLoop()
if err := m.cleanTopics(); err != nil {
return nil, err
@ -1997,7 +1998,7 @@ func (m *Messenger) dispatchMessage(ctx context.Context, spec common.RawMessage)
//SendPrivate will alter message identity and possibly datasyncid, so we save an unchanged
//message for sending to paired devices later
specCopyForPairedDevices := spec
if !common.IsPubKeyEqual(publicKey, &m.identity.PublicKey) {
if !common.IsPubKeyEqual(publicKey, &m.identity.PublicKey) || spec.SkipEncryption {
id, err = m.sender.SendPrivate(ctx, publicKey, &spec)
if err != nil {
@ -2871,6 +2872,21 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte
continue
}
case protobuf.Backup:
if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) {
logger.Warn("not coming from us, ignoring")
continue
}
p := msg.ParsedMessage.Interface().(protobuf.Backup)
logger.Debug("Handling Backup", zap.Any("message", p))
err = m.HandleBackup(messageState, p)
if err != nil {
logger.Warn("failed to handle Backup", zap.Error(err))
allMessagesProcessed = false
continue
}
case protobuf.SyncInstallationPublicChat:
if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) {
logger.Warn("not coming from us, ignoring")

View File

@ -0,0 +1,161 @@
package protocol
import (
"context"
"time"
"github.com/golang/protobuf/proto"
"go.uber.org/zap"
"github.com/status-im/status-go/protocol/common"
"github.com/status-im/status-go/protocol/protobuf"
)
const (
BackupContactsPerBatch = 20
)
// backupTickerInterval is how often we should check for backups
var backupTickerInterval = 120 * time.Second
// backupIntervalSeconds is the amount of seconds we should allow between
// backups
var backupIntervalSeconds uint64 = 28800
func (m *Messenger) backupEnabled() (bool, error) {
return m.settings.BackupEnabled()
}
func (m *Messenger) lastBackup() (uint64, error) {
return m.settings.LastBackup()
}
func (m *Messenger) startBackupLoop() {
ticker := time.NewTicker(backupTickerInterval)
go func() {
for {
select {
case <-ticker.C:
if !m.online() {
continue
}
enabled, err := m.backupEnabled()
if err != nil {
m.logger.Error("failed to fetch backup enabled")
continue
}
if !enabled {
m.logger.Debug("backup not enabled, skipping")
continue
}
lastBackup, err := m.lastBackup()
if err != nil {
m.logger.Error("failed to fetch last backup time")
}
now := time.Now().Unix()
if uint64(now) <= backupIntervalSeconds+lastBackup {
m.logger.Debug("not backing up")
continue
}
m.logger.Debug("backing up data")
_, err = m.BackupData(context.Background())
if err != nil {
m.logger.Error("failed to backup data", zap.Error(err))
}
case <-m.quit:
return
}
}
}()
}
func (m *Messenger) BackupData(ctx context.Context) (uint64, error) {
var contacts []*protobuf.SyncInstallationContactV2
m.allContacts.Range(func(contactID string, contact *Contact) (shouldContinue bool) {
syncContact := m.syncBackupContact(ctx, contact)
if syncContact != nil {
contacts = append(contacts, syncContact)
}
return true
})
clock, chat := m.getLastClockWithRelatedChat()
for i := 0; i < len(contacts); i += BackupContactsPerBatch {
j := i + BackupContactsPerBatch
if j > len(contacts) {
j = len(contacts)
}
contactsToAdd := contacts[i:j]
backupMessage := &protobuf.Backup{
Contacts: contactsToAdd,
}
encodedMessage, err := proto.Marshal(backupMessage)
if err != nil {
return 0, err
}
_, err = m.dispatchMessage(ctx, common.RawMessage{
LocalChatID: chat.ID,
Payload: encodedMessage,
SkipEncryption: true,
MessageType: protobuf.ApplicationMetadataMessage_BACKUP,
})
if err != nil {
return 0, err
}
}
chat.LastClockValue = clock
err := m.saveChat(chat)
if err != nil {
return 0, err
}
err = m.settings.SetLastBackup(clock)
if err != nil {
return 0, err
}
if m.config.messengerSignalsHandler != nil {
m.config.messengerSignalsHandler.BackupPerformed(clock)
}
return clock, nil
}
// syncContact sync as contact with paired devices
func (m *Messenger) syncBackupContact(ctx context.Context, contact *Contact) *protobuf.SyncInstallationContactV2 {
if contact.IsSyncing {
return nil
}
clock, _ := m.getLastClockWithRelatedChat()
var ensName string
if contact.ENSVerified {
ensName = contact.Name
}
oneToOneChat, ok := m.allChats.Load(contact.ID)
muted := false
if ok {
muted = oneToOneChat.Muted
}
return &protobuf.SyncInstallationContactV2{
Clock: clock,
Id: contact.ID,
EnsName: ensName,
LocalNickname: contact.LocalNickname,
Added: contact.Added,
Blocked: contact.Blocked,
Muted: muted,
Removed: contact.Removed,
}
}

View File

@ -0,0 +1,188 @@
package protocol
import (
"context"
"crypto/ecdsa"
"testing"
"github.com/stretchr/testify/suite"
"go.uber.org/zap"
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
"github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/waku"
)
func TestMessengerBackupSuite(t *testing.T) {
suite.Run(t, new(MessengerBackupSuite))
}
type MessengerBackupSuite struct {
suite.Suite
m *Messenger // main instance of Messenger
privateKey *ecdsa.PrivateKey // private key for the main instance of Messenger
// If one wants to send messages between different instances of Messenger,
// a single waku service should be shared.
shh types.Waku
logger *zap.Logger
}
func (s *MessengerBackupSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger()
config := waku.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := waku.New(&config, s.logger)
s.shh = gethbridge.NewGethWakuWrapper(shh)
s.Require().NoError(shh.Start())
s.m = s.newMessenger()
s.privateKey = s.m.identity
_, err := s.m.Start()
s.Require().NoError(err)
}
func (s *MessengerBackupSuite) TearDownTest() {
s.Require().NoError(s.m.Shutdown())
}
func (s *MessengerBackupSuite) newMessenger() *Messenger {
privateKey, err := crypto.GenerateKey()
s.Require().NoError(err)
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil)
s.Require().NoError(err)
return messenger
}
func (s *MessengerBackupSuite) TestBackupContacts() {
bob1 := s.m
// Create bob2
bob2, err := newMessengerWithKey(s.shh, bob1.identity, s.logger, nil)
s.Require().NoError(err)
_, err = bob2.Start()
s.Require().NoError(err)
// Create 2 contacts
contact1Key, err := crypto.GenerateKey()
s.Require().NoError(err)
contactID1 := types.EncodeHex(crypto.FromECDSAPub(&contact1Key.PublicKey))
_, err = bob1.AddContact(context.Background(), contactID1)
s.Require().NoError(err)
contact2Key, err := crypto.GenerateKey()
s.Require().NoError(err)
contactID2 := types.EncodeHex(crypto.FromECDSAPub(&contact2Key.PublicKey))
_, err = bob1.AddContact(context.Background(), contactID2)
s.Require().NoError(err)
s.Require().Len(bob1.Contacts(), 2)
actualContacts := bob1.Contacts()
if actualContacts[0].ID == contactID1 {
s.Require().Equal(actualContacts[0].ID, contactID1)
s.Require().Equal(actualContacts[1].ID, contactID2)
} else {
s.Require().Equal(actualContacts[0].ID, contactID2)
s.Require().Equal(actualContacts[1].ID, contactID1)
}
// Backup
clock, err := bob1.BackupData(context.Background())
s.Require().NoError(err)
// Safety check
s.Require().Len(bob2.Contacts(), 0)
// Wait for the message to reach its destination
_, err = WaitOnMessengerResponse(
bob2,
func(r *MessengerResponse) bool {
_, err := s.m.RetrieveAll()
if err != nil {
s.logger.Info("Failed")
return false
}
if len(bob2.Contacts()) < 2 {
return false
}
return true
},
"contacts not backed up",
)
s.Require().NoError(err)
s.Require().Len(bob2.AddedContacts(), 2)
actualContacts = bob2.AddedContacts()
if actualContacts[0].ID == contactID1 {
s.Require().Equal(actualContacts[0].ID, contactID1)
s.Require().Equal(actualContacts[1].ID, contactID2)
} else {
s.Require().Equal(actualContacts[0].ID, contactID2)
s.Require().Equal(actualContacts[1].ID, contactID1)
}
lastBackup, err := bob1.lastBackup()
s.Require().NoError(err)
s.Require().NotEmpty(lastBackup)
s.Require().Equal(clock, lastBackup)
}
func (s *MessengerBackupSuite) TestBackupContactsGreaterThanBatch() {
bob1 := s.m
// Create bob2
bob2, err := newMessengerWithKey(s.shh, bob1.identity, s.logger, nil)
s.Require().NoError(err)
_, err = bob2.Start()
s.Require().NoError(err)
// Create 2 contacts
for i := 0; i < BackupContactsPerBatch*2; i++ {
contactKey, err := crypto.GenerateKey()
s.Require().NoError(err)
contactID := types.EncodeHex(crypto.FromECDSAPub(&contactKey.PublicKey))
_, err = bob1.AddContact(context.Background(), contactID)
s.Require().NoError(err)
}
// Backup
_, err = bob1.BackupData(context.Background())
s.Require().NoError(err)
// Safety check
s.Require().Len(bob2.Contacts(), 0)
// Wait for the message to reach its destination
_, err = WaitOnMessengerResponse(
bob2,
func(r *MessengerResponse) bool {
_, err := s.m.RetrieveAll()
if err != nil {
s.logger.Info("Failed")
return false
}
if len(bob2.Contacts()) < BackupContactsPerBatch*2 {
return false
}
return true
},
"contacts not backed up",
)
s.Require().NoError(err)
s.Require().Len(bob2.AddedContacts(), BackupContactsPerBatch*2)
}

View File

@ -30,6 +30,7 @@ type MessengerSignalsHandler interface {
HistoryRequestBatchProcessed(requestID string, batchIndex int, batchNum int)
HistoryRequestCompleted(requestID string)
HistoryRequestFailed(requestID string, err error)
BackupPerformed(uint64)
}
type config struct {

View File

@ -164,6 +164,17 @@ func (m *Messenger) Contacts() []*Contact {
return contacts
}
func (m *Messenger) AddedContacts() []*Contact {
var contacts []*Contact
m.allContacts.Range(func(contactID string, contact *Contact) (shouldContinue bool) {
if contact.Added {
contacts = append(contacts, contact)
}
return true
})
return contacts
}
// GetContactByID assumes pubKey includes 0x prefix
func (m *Messenger) GetContactByID(pubKey string) *Contact {
contact, _ := m.allContacts.Load(pubKey)

View File

@ -274,6 +274,16 @@ func (m *Messenger) handleCommandMessage(state *ReceivedMessageState, message *c
return nil
}
func (m *Messenger) HandleBackup(state *ReceivedMessageState, message protobuf.Backup) error {
for _, contact := range message.Contacts {
err := m.HandleSyncInstallationContact(state, *contact)
if err != nil {
return err
}
}
return nil
}
func (m *Messenger) HandleSyncInstallationContact(state *ReceivedMessageState, message protobuf.SyncInstallationContactV2) error {
removedOrBlcoked := message.Removed || message.Blocked
chat, ok := state.AllChats.Load(message.Id)

View File

@ -59,6 +59,7 @@ const (
ApplicationMetadataMessage_ANONYMOUS_METRIC_BATCH ApplicationMetadataMessage_Type = 33
ApplicationMetadataMessage_SYNC_CHAT_REMOVED ApplicationMetadataMessage_Type = 34
ApplicationMetadataMessage_SYNC_CHAT_MESSAGES_READ ApplicationMetadataMessage_Type = 35
ApplicationMetadataMessage_BACKUP ApplicationMetadataMessage_Type = 36
)
var ApplicationMetadataMessage_Type_name = map[int32]string{
@ -98,6 +99,7 @@ var ApplicationMetadataMessage_Type_name = map[int32]string{
33: "ANONYMOUS_METRIC_BATCH",
34: "SYNC_CHAT_REMOVED",
35: "SYNC_CHAT_MESSAGES_READ",
36: "BACKUP",
}
var ApplicationMetadataMessage_Type_value = map[string]int32{
@ -137,6 +139,7 @@ var ApplicationMetadataMessage_Type_value = map[string]int32{
"ANONYMOUS_METRIC_BATCH": 33,
"SYNC_CHAT_REMOVED": 34,
"SYNC_CHAT_MESSAGES_READ": 35,
"BACKUP": 36,
}
func (x ApplicationMetadataMessage_Type) String() string {
@ -215,45 +218,46 @@ func init() {
}
var fileDescriptor_ad09a6406fcf24c7 = []byte{
// 632 bytes of a gzipped FileDescriptorProto
// 642 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x5b, 0x4f, 0x1b, 0x3d,
0x10, 0xfd, 0x02, 0x7c, 0x04, 0x26, 0x5c, 0x8c, 0xb9, 0x85, 0x70, 0x0b, 0xa1, 0x6a, 0x69, 0x2b,
0xa5, 0x52, 0xfb, 0x58, 0xf5, 0xc1, 0xf1, 0x0e, 0xc4, 0x34, 0x6b, 0x2f, 0xb6, 0x97, 0x2a, 0x7d,
0xb1, 0x96, 0x92, 0x22, 0x24, 0x20, 0x11, 0x84, 0x07, 0x7e, 0x45, 0x7f, 0x6f, 0xdf, 0x2a, 0x6f,
0x2e, 0x1b, 0x4a, 0x28, 0x4f, 0xc9, 0x9e, 0x73, 0x66, 0x66, 0xe7, 0xcc, 0xcc, 0x42, 0x25, 0xe9,
0x74, 0xae, 0x2e, 0x7f, 0x24, 0xdd, 0xcb, 0xf6, 0x8d, 0xbb, 0x6e, 0x75, 0x93, 0xf3, 0xa4, 0x9b,
0xb8, 0xeb, 0xd6, 0xdd, 0x5d, 0x72, 0xd1, 0xaa, 0x76, 0x6e, 0xdb, 0xdd, 0x36, 0x9d, 0x49, 0x7f,
0xce, 0xee, 0x7f, 0x56, 0x7e, 0xcd, 0x42, 0x89, 0x65, 0x01, 0x61, 0x5f, 0x1f, 0xf6, 0xe4, 0x74,
0x0b, 0x66, 0xef, 0x2e, 0x2f, 0x6e, 0x92, 0xee, 0xfd, 0x6d, 0xab, 0x98, 0x2b, 0xe7, 0x0e, 0xe6,
0x74, 0x06, 0xd0, 0x22, 0xe4, 0x3b, 0xc9, 0xc3, 0x55, 0x3b, 0x39, 0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message ApplicationMetadataMessage {
ANONYMOUS_METRIC_BATCH = 33;
SYNC_CHAT_REMOVED = 34;
SYNC_CHAT_MESSAGES_READ = 35;
BACKUP = 36;
}
}

View File

@ -20,6 +20,61 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type Backup struct {
Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"`
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
Contacts []*SyncInstallationContactV2 `protobuf:"bytes,3,rep,name=contacts,proto3" json:"contacts,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Backup) Reset() { *m = Backup{} }
func (m *Backup) String() string { return proto.CompactTextString(m) }
func (*Backup) ProtoMessage() {}
func (*Backup) Descriptor() ([]byte, []int) {
return fileDescriptor_d61ab7221f0b5518, []int{0}
}
func (m *Backup) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Backup.Unmarshal(m, b)
}
func (m *Backup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Backup.Marshal(b, m, deterministic)
}
func (m *Backup) XXX_Merge(src proto.Message) {
xxx_messageInfo_Backup.Merge(m, src)
}
func (m *Backup) XXX_Size() int {
return xxx_messageInfo_Backup.Size(m)
}
func (m *Backup) XXX_DiscardUnknown() {
xxx_messageInfo_Backup.DiscardUnknown(m)
}
var xxx_messageInfo_Backup proto.InternalMessageInfo
func (m *Backup) GetClock() uint64 {
if m != nil {
return m.Clock
}
return 0
}
func (m *Backup) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *Backup) GetContacts() []*SyncInstallationContactV2 {
if m != nil {
return m.Contacts
}
return nil
}
type PairInstallation struct {
Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"`
InstallationId string `protobuf:"bytes,2,opt,name=installation_id,json=installationId,proto3" json:"installation_id,omitempty"`
@ -34,7 +89,7 @@ func (m *PairInstallation) Reset() { *m = PairInstallation{} }
func (m *PairInstallation) String() string { return proto.CompactTextString(m) }
func (*PairInstallation) ProtoMessage() {}
func (*PairInstallation) Descriptor() ([]byte, []int) {
return fileDescriptor_d61ab7221f0b5518, []int{0}
return fileDescriptor_d61ab7221f0b5518, []int{1}
}
func (m *PairInstallation) XXX_Unmarshal(b []byte) error {
@ -100,7 +155,7 @@ func (m *SyncInstallationContact) Reset() { *m = SyncInstallationContact
func (m *SyncInstallationContact) String() string { return proto.CompactTextString(m) }
func (*SyncInstallationContact) ProtoMessage() {}
func (*SyncInstallationContact) Descriptor() ([]byte, []int) {
return fileDescriptor_d61ab7221f0b5518, []int{1}
return fileDescriptor_d61ab7221f0b5518, []int{2}
}
func (m *SyncInstallationContact) XXX_Unmarshal(b []byte) error {
@ -191,7 +246,7 @@ func (m *SyncInstallationContactV2) Reset() { *m = SyncInstallationConta
func (m *SyncInstallationContactV2) String() string { return proto.CompactTextString(m) }
func (*SyncInstallationContactV2) ProtoMessage() {}
func (*SyncInstallationContactV2) Descriptor() ([]byte, []int) {
return fileDescriptor_d61ab7221f0b5518, []int{2}
return fileDescriptor_d61ab7221f0b5518, []int{3}
}
func (m *SyncInstallationContactV2) XXX_Unmarshal(b []byte) error {
@ -302,7 +357,7 @@ func (m *SyncInstallationAccount) Reset() { *m = SyncInstallationAccount
func (m *SyncInstallationAccount) String() string { return proto.CompactTextString(m) }
func (*SyncInstallationAccount) ProtoMessage() {}
func (*SyncInstallationAccount) Descriptor() ([]byte, []int) {
return fileDescriptor_d61ab7221f0b5518, []int{3}
return fileDescriptor_d61ab7221f0b5518, []int{4}
}
func (m *SyncInstallationAccount) XXX_Unmarshal(b []byte) error {
@ -356,7 +411,7 @@ func (m *SyncInstallationPublicChat) Reset() { *m = SyncInstallationPubl
func (m *SyncInstallationPublicChat) String() string { return proto.CompactTextString(m) }
func (*SyncInstallationPublicChat) ProtoMessage() {}
func (*SyncInstallationPublicChat) Descriptor() ([]byte, []int) {
return fileDescriptor_d61ab7221f0b5518, []int{4}
return fileDescriptor_d61ab7221f0b5518, []int{5}
}
func (m *SyncInstallationPublicChat) XXX_Unmarshal(b []byte) error {
@ -409,7 +464,7 @@ func (m *SyncCommunity) Reset() { *m = SyncCommunity{} }
func (m *SyncCommunity) String() string { return proto.CompactTextString(m) }
func (*SyncCommunity) ProtoMessage() {}
func (*SyncCommunity) Descriptor() ([]byte, []int) {
return fileDescriptor_d61ab7221f0b5518, []int{5}
return fileDescriptor_d61ab7221f0b5518, []int{6}
}
func (m *SyncCommunity) XXX_Unmarshal(b []byte) error {
@ -503,7 +558,7 @@ func (m *SyncCommunityRequestsToJoin) Reset() { *m = SyncCommunityReques
func (m *SyncCommunityRequestsToJoin) String() string { return proto.CompactTextString(m) }
func (*SyncCommunityRequestsToJoin) ProtoMessage() {}
func (*SyncCommunityRequestsToJoin) Descriptor() ([]byte, []int) {
return fileDescriptor_d61ab7221f0b5518, []int{6}
return fileDescriptor_d61ab7221f0b5518, []int{7}
}
func (m *SyncCommunityRequestsToJoin) XXX_Unmarshal(b []byte) error {
@ -587,7 +642,7 @@ func (m *SyncInstallation) Reset() { *m = SyncInstallation{} }
func (m *SyncInstallation) String() string { return proto.CompactTextString(m) }
func (*SyncInstallation) ProtoMessage() {}
func (*SyncInstallation) Descriptor() ([]byte, []int) {
return fileDescriptor_d61ab7221f0b5518, []int{7}
return fileDescriptor_d61ab7221f0b5518, []int{8}
}
func (m *SyncInstallation) XXX_Unmarshal(b []byte) error {
@ -648,7 +703,7 @@ func (m *SyncChatRemoved) Reset() { *m = SyncChatRemoved{} }
func (m *SyncChatRemoved) String() string { return proto.CompactTextString(m) }
func (*SyncChatRemoved) ProtoMessage() {}
func (*SyncChatRemoved) Descriptor() ([]byte, []int) {
return fileDescriptor_d61ab7221f0b5518, []int{8}
return fileDescriptor_d61ab7221f0b5518, []int{9}
}
func (m *SyncChatRemoved) XXX_Unmarshal(b []byte) error {
@ -695,7 +750,7 @@ func (m *SyncChatMessagesRead) Reset() { *m = SyncChatMessagesRead{} }
func (m *SyncChatMessagesRead) String() string { return proto.CompactTextString(m) }
func (*SyncChatMessagesRead) ProtoMessage() {}
func (*SyncChatMessagesRead) Descriptor() ([]byte, []int) {
return fileDescriptor_d61ab7221f0b5518, []int{9}
return fileDescriptor_d61ab7221f0b5518, []int{10}
}
func (m *SyncChatMessagesRead) XXX_Unmarshal(b []byte) error {
@ -731,6 +786,7 @@ func (m *SyncChatMessagesRead) GetId() string {
}
func init() {
proto.RegisterType((*Backup)(nil), "protobuf.Backup")
proto.RegisterType((*PairInstallation)(nil), "protobuf.PairInstallation")
proto.RegisterType((*SyncInstallationContact)(nil), "protobuf.SyncInstallationContact")
proto.RegisterType((*SyncInstallationContactV2)(nil), "protobuf.SyncInstallationContactV2")
@ -748,49 +804,51 @@ func init() {
}
var fileDescriptor_d61ab7221f0b5518 = []byte{
// 702 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x54, 0xdd, 0x6e, 0xd3, 0x4a,
0x10, 0x96, 0x9d, 0x34, 0x49, 0x27, 0x3f, 0xad, 0x56, 0xd5, 0xe9, 0xb6, 0x47, 0x47, 0x4d, 0x7d,
0xa8, 0xc8, 0x55, 0x90, 0xca, 0x05, 0x42, 0x85, 0x0b, 0xda, 0x0b, 0x14, 0x10, 0xa5, 0x32, 0x85,
0x0b, 0x6e, 0xac, 0xcd, 0x7a, 0x9b, 0x2e, 0xb5, 0xbd, 0xc6, 0xbb, 0x09, 0xf2, 0x0b, 0xf0, 0x00,
0xf0, 0x5a, 0x48, 0xbc, 0x07, 0x4f, 0x81, 0x76, 0xd7, 0x76, 0xdd, 0x9f, 0x94, 0x5e, 0x73, 0x65,
0xcf, 0xb7, 0x33, 0x3b, 0xdf, 0x7c, 0x33, 0xb3, 0xd0, 0x4f, 0x09, 0xcf, 0x78, 0x32, 0x1b, 0xa7,
0x99, 0x50, 0x02, 0x75, 0xcc, 0x67, 0x3a, 0x3f, 0xf3, 0xbe, 0x3a, 0xb0, 0x7e, 0x42, 0x78, 0x36,
0x49, 0xa4, 0x22, 0x51, 0x44, 0x14, 0x17, 0x09, 0xda, 0x80, 0x15, 0x1a, 0x09, 0x7a, 0x81, 0x9d,
0xa1, 0x33, 0x6a, 0xfa, 0xd6, 0x40, 0x0f, 0x61, 0x8d, 0xd7, 0xbc, 0x02, 0x1e, 0x62, 0x77, 0xe8,
0x8c, 0x56, 0xfd, 0x41, 0x1d, 0x9e, 0x84, 0x68, 0x07, 0xba, 0x21, 0x5b, 0x70, 0xca, 0x02, 0x95,
0xa7, 0x0c, 0x37, 0x8c, 0x13, 0x58, 0xe8, 0x34, 0x4f, 0x19, 0x42, 0xd0, 0x4c, 0x48, 0xcc, 0x70,
0xd3, 0x9c, 0x98, 0x7f, 0xef, 0x97, 0x03, 0x9b, 0xef, 0xf2, 0x84, 0xd6, 0x89, 0x1c, 0x89, 0x44,
0x11, 0xaa, 0x96, 0xf0, 0x19, 0x80, 0x5b, 0x51, 0x70, 0x79, 0x88, 0xfe, 0x87, 0x7e, 0x9a, 0x89,
0x33, 0x1e, 0xb1, 0x80, 0xc7, 0x64, 0x56, 0x26, 0xee, 0x15, 0xe0, 0x44, 0x63, 0x68, 0x0b, 0x3a,
0x2c, 0x91, 0x41, 0x2d, 0x7d, 0x9b, 0x25, 0xf2, 0x98, 0xc4, 0x0c, 0xed, 0x42, 0x2f, 0x22, 0x52,
0x05, 0xf3, 0x34, 0x24, 0x8a, 0x85, 0x78, 0xc5, 0x24, 0xeb, 0x6a, 0xec, 0xbd, 0x85, 0x74, 0x65,
0x32, 0x97, 0x8a, 0xc5, 0x81, 0x22, 0x33, 0x89, 0x5b, 0xc3, 0x86, 0xae, 0xcc, 0x42, 0xa7, 0x64,
0x26, 0xd1, 0x1e, 0x0c, 0x22, 0x41, 0x49, 0x14, 0x24, 0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d, 0xee, 0xeb, 0x3d, 0x81, 0x35, 0x73, 0xaa, 0x09, 0xd9,
0x65, 0xbe, 0xe7, 0xd6, 0x3c, 0x83, 0x8d, 0x32, 0xf0, 0x0d, 0x93, 0x92, 0xcc, 0x98, 0xf4, 0x19,
0xb9, 0x67, 0xf4, 0x61, 0xff, 0x63, 0x77, 0xfc, 0xe8, 0xa0, 0x24, 0x38, 0x6d, 0x99, 0xbf, 0xc7,
0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xb9, 0x98, 0x3d, 0x42, 0x26, 0x07, 0x00, 0x00,
// 725 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x54, 0xcd, 0x6e, 0xdb, 0x38,
0x10, 0x86, 0x64, 0xc7, 0x76, 0xc6, 0x3f, 0x09, 0x88, 0x60, 0xc3, 0x64, 0xb1, 0x88, 0xa3, 0x6c,
0xb0, 0x3e, 0x79, 0x81, 0xec, 0x61, 0x51, 0xa4, 0x45, 0xd1, 0xe4, 0x50, 0xb8, 0x45, 0xd3, 0x40,
0x4d, 0x7b, 0xe8, 0x45, 0xa0, 0x29, 0xc6, 0x61, 0x2d, 0x89, 0xaa, 0x48, 0xb9, 0xf0, 0x0b, 0xf4,
0x01, 0xda, 0xd7, 0x2a, 0xd0, 0xf7, 0xe8, 0x53, 0x14, 0x24, 0x65, 0x45, 0x49, 0xea, 0xc4, 0xe7,
0x9e, 0xa4, 0xf9, 0x38, 0xe4, 0x7c, 0xf3, 0xcd, 0x0f, 0x74, 0x53, 0xc2, 0x33, 0x9e, 0x4c, 0x86,
0x69, 0x26, 0x94, 0x40, 0x2d, 0xf3, 0x19, 0xe7, 0x97, 0x9e, 0x80, 0xc6, 0x09, 0xa1, 0xd3, 0x3c,
0x45, 0x5b, 0xb0, 0x46, 0x23, 0x41, 0xa7, 0xd8, 0xe9, 0x3b, 0x83, 0xba, 0x6f, 0x0d, 0xd4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c, 0x2b, 0x4e, 0xcd, 0x63, 0xd8, 0x5a, 0x5c, 0x7c,
0xc5, 0xa4, 0x24, 0x13, 0x26, 0x7d, 0x46, 0x56, 0xbc, 0x7d, 0xd2, 0x7d, 0xdf, 0x1e, 0xfe, 0x7b,
0xbc, 0x20, 0x38, 0x6e, 0x98, 0xbf, 0xff, 0x7e, 0x06, 0x00, 0x00, 0xff, 0xff, 0x54, 0x79, 0x7f,
0x98, 0x97, 0x07, 0x00, 0x00,
}

View File

@ -3,6 +3,13 @@ syntax = "proto3";
option go_package = "./;protobuf";
package protobuf;
message Backup {
uint64 clock = 1;
string id = 2;
repeated SyncInstallationContactV2 contacts = 3;
}
message PairInstallation {
uint64 clock = 1;
string installation_id = 2;
@ -81,4 +88,4 @@ message SyncChatRemoved {
message SyncChatMessagesRead {
uint64 clock = 1;
string id = 2;
}
}

View File

@ -255,6 +255,8 @@ func (m *StatusMessage) HandleApplication() error {
return m.unmarshalProtobufData(new(protobuf.SyncChatRemoved))
case protobuf.ApplicationMetadataMessage_SYNC_CHAT_MESSAGES_READ:
return m.unmarshalProtobufData(new(protobuf.SyncChatMessagesRead))
case protobuf.ApplicationMetadataMessage_BACKUP:
return m.unmarshalProtobufData(new(protobuf.Backup))
}
return nil
}

View File

@ -946,6 +946,10 @@ func (api *PublicAPI) ChangeIdentityImageShowTo(showTo accounts.ProfilePicturesS
return api.service.messenger.PublishIdentityImage()
}
func (api *PublicAPI) BackupData() (uint64, error) {
return api.service.messenger.BackupData(context.Background())
}
// -----
// HELPER
// -----

View File

@ -57,6 +57,11 @@ func (m MessengerSignalsHandler) MessageDelivered(chatID string, messageID strin
signal.SendMessageDelivered(chatID, messageID)
}
// BackupPerformed passes information that a backup was performed
func (m MessengerSignalsHandler) BackupPerformed(lastBackup uint64) {
signal.SendBackupPerformed(lastBackup)
}
// MessageDelivered passes info about community that was requested before
func (m MessengerSignalsHandler) CommunityInfoFound(community *communities.Community) {
signal.SendCommunityInfoFound(community)

View File

@ -46,6 +46,9 @@ const (
// EventHistoryRequestFailed is triggered when requesting history messages fails
EventHistoryRequestFailed = "history.request.failed"
// EventBackupPerformed is triggered when a backup has been performed
EventBackupPerformed = "backup.performed"
)
// EnvelopeSignal includes hash of the envelope.
@ -164,6 +167,11 @@ type EnodeDiscoveredSignal struct {
Topic string `json:"topic"`
}
// BackupPerformedSignal signals that a backup has been performed
type BackupPerformedSignal struct {
LastBackup uint64 `json:"lastBackup"`
}
// SendEnodeDiscovered tiggered when an enode is discovered.
// finds a new enode.
func SendEnodeDiscovered(enode, topic string) {
@ -173,6 +181,9 @@ func SendEnodeDiscovered(enode, topic string) {
})
}
func SendBackupPerformed(lastBackup uint64) {
send(EventBackupPerformed, BackupPerformedSignal{lastBackup})
}
func SendDecryptMessageFailed(sender string) {
send(EventDecryptMessageFailed, DecryptMessageFailedSignal{sender})
}