feat: accounts improvements applied

- old `accounts` table is moved/mapped to `keypairs` and `keypairs_accounts`
- `keycards` table has foreign key which refers to `keypairs.key_uid`
- `Keypair` introduced as a new type
- api endpoints updated according to this change
This commit is contained in:
Sale Djenic 2023-05-16 12:48:00 +02:00 committed by saledjenic
parent 1c17fbeacc
commit eeaaf0ce3f
30 changed files with 2323 additions and 1378 deletions

View File

@ -1 +1 @@
0.152.0
0.152.1

View File

@ -29,7 +29,6 @@ import (
"github.com/status-im/status-go/logutils"
"github.com/status-im/status-go/multiaccounts"
"github.com/status-im/status-go/multiaccounts/accounts"
"github.com/status-im/status-go/multiaccounts/keycards"
"github.com/status-im/status-go/multiaccounts/settings"
"github.com/status-im/status-go/node"
"github.com/status-im/status-go/nodecfg"
@ -619,6 +618,15 @@ func (b *GethStatusBackend) ConvertToKeycardAccount(account multiaccounts.Accoun
if err != nil {
return err
}
keypair, err := accountDB.GetKeypairByKeyUID(account.KeyUID)
if err != nil {
if err == accounts.ErrDbKeypairNotFound {
return errors.New("cannot convert an unknown keypair")
}
return err
}
err = accountDB.SaveSettingField(settings.KeycardInstanceUID, s.KeycardInstanceUID)
if err != nil {
return err
@ -639,11 +647,6 @@ func (b *GethStatusBackend) ConvertToKeycardAccount(account multiaccounts.Accoun
return err
}
relatedAccounts, err := accountDB.GetAccountsByKeyUID(account.KeyUID)
if err != nil {
return err
}
// This check is added due to mobile app cause it doesn't support a Keycard features as desktop app.
// We should remove the following line once mobile and desktop app align.
if len(keycardUID) > 0 {
@ -652,7 +655,7 @@ func (b *GethStatusBackend) ConvertToKeycardAccount(account multiaccounts.Accoun
return err
}
kc := keycards.Keycard{
kc := accounts.Keycard{
KeycardUID: keycardUID,
KeycardName: displayName,
KeycardLocked: false,
@ -660,7 +663,7 @@ func (b *GethStatusBackend) ConvertToKeycardAccount(account multiaccounts.Accoun
LastUpdateClock: uint64(time.Now().Unix()),
}
for _, acc := range relatedAccounts {
for _, acc := range keypair.Accounts {
kc.AccountsAddresses = append(kc.AccountsAddresses, acc.Address)
}
addedKc, _, err := accountDB.AddKeycardOrAddAccountsIfKeycardIsAdded(kc)
@ -698,7 +701,7 @@ func (b *GethStatusBackend) ConvertToKeycardAccount(account multiaccounts.Accoun
}
// We need to delete all accounts for the Keycard which is being added
for _, acc := range relatedAccounts {
for _, acc := range keypair.Accounts {
err = b.accountManager.DeleteAccount(acc.Address)
if err != nil {
return err
@ -1058,6 +1061,7 @@ func (b *GethStatusBackend) StartNodeWithAccountAndInitialConfig(
return b.StartNodeWithAccount(account, password, nodecfg)
}
// TODO: change in `saveAccountsAndSettings` function param `subaccs []*accounts.Account` parameter to `profileKeypair *accounts.Keypair` parameter
func (b *GethStatusBackend) saveAccountsAndSettings(settings settings.Settings, nodecfg *params.NodeConfig, subaccs []*accounts.Account) error {
b.mu.Lock()
defer b.mu.Unlock()
@ -1079,7 +1083,20 @@ func (b *GethStatusBackend) saveAccountsAndSettings(settings settings.Settings,
return err
}
return accdb.SaveAccounts(subaccs)
keypair := &accounts.Keypair{
KeyUID: settings.KeyUID,
Name: settings.DisplayName,
Type: accounts.KeypairTypeProfile,
DerivedFrom: settings.Address.String(),
LastUsedDerivationIndex: 0,
}
for _, acc := range subaccs {
acc.Operable = accounts.AccountFullyOperable
keypair.Accounts = append(keypair.Accounts, acc)
}
return accdb.SaveOrUpdateKeypair(keypair)
}
func (b *GethStatusBackend) loadNodeConfig(inputNodeCfg *params.NodeConfig) error {

View File

@ -61,6 +61,7 @@
// 1682146075_add_created_at_to_saved_addresses.up.sql (107B)
// 1682393575_sync_ens_name.up.sql (713B)
// 1683457503_add_blocks_ranges_sequential_table.up.sql (263B)
// 1683627613_accounts_and_keycards_improvements.up.sql (3.64kB)
// doc.go (74B)
package migrations
@ -145,7 +146,7 @@ func _1640111208_dummyUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1640111208_dummy.up.sql", size: 258, mode: os.FileMode(0644), modTime: time.Unix(1650884918, 0)}
info := bindataFileInfo{name: "1640111208_dummy.up.sql", size: 258, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3e, 0xf0, 0xae, 0x20, 0x6e, 0x75, 0xd1, 0x36, 0x14, 0xf2, 0x40, 0xe5, 0xd6, 0x7a, 0xc4, 0xa5, 0x72, 0xaa, 0xb5, 0x4d, 0x71, 0x97, 0xb8, 0xe8, 0x95, 0x22, 0x95, 0xa2, 0xac, 0xaf, 0x48, 0x58}}
return a, nil
}
@ -165,7 +166,7 @@ func _1642666031_add_removed_clock_to_bookmarksUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1642666031_add_removed_clock_to_bookmarks.up.sql", size: 117, mode: os.FileMode(0644), modTime: time.Unix(1650884918, 0)}
info := bindataFileInfo{name: "1642666031_add_removed_clock_to_bookmarks.up.sql", size: 117, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x84, 0x4e, 0x38, 0x99, 0x7a, 0xc, 0x90, 0x13, 0xec, 0xfe, 0x2f, 0x55, 0xff, 0xb7, 0xb6, 0xaa, 0x96, 0xc6, 0x92, 0x79, 0xcc, 0xee, 0x4e, 0x99, 0x53, 0xfe, 0x1c, 0xbb, 0x32, 0x2, 0xa4, 0x27}}
return a, nil
}
@ -185,7 +186,7 @@ func _1643644541_gif_api_key_settingUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1643644541_gif_api_key_setting.up.sql", size: 108, mode: os.FileMode(0644), modTime: time.Unix(1650884918, 0)}
info := bindataFileInfo{name: "1643644541_gif_api_key_setting.up.sql", size: 108, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1b, 0x94, 0x28, 0xfb, 0x66, 0xd1, 0x7c, 0xb8, 0x89, 0xe2, 0xb4, 0x71, 0x65, 0x24, 0x57, 0x22, 0x95, 0x38, 0x97, 0x3, 0x9b, 0xc6, 0xa4, 0x41, 0x7b, 0xba, 0xf7, 0xdb, 0x70, 0xf7, 0x20, 0x3a}}
return a, nil
}
@ -205,7 +206,7 @@ func _1644188994_recent_stickersUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1644188994_recent_stickers.up.sql", size: 79, mode: os.FileMode(0644), modTime: time.Unix(1650884918, 0)}
info := bindataFileInfo{name: "1644188994_recent_stickers.up.sql", size: 79, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1e, 0xad, 0xaa, 0x30, 0xbf, 0x4, 0x7, 0xf8, 0xc3, 0x3, 0xb8, 0x97, 0x23, 0x2b, 0xbd, 0x1c, 0x60, 0x69, 0xb0, 0x42, 0x5e, 0x6b, 0xd, 0xa7, 0xa3, 0x6b, 0x2e, 0xdc, 0x70, 0x13, 0x72, 0x7}}
return a, nil
}
@ -225,7 +226,7 @@ func _1646659233_add_address_to_dapp_permisssionUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1646659233_add_address_to_dapp_permisssion.up.sql", size: 700, mode: os.FileMode(0644), modTime: time.Unix(1650884918, 0)}
info := bindataFileInfo{name: "1646659233_add_address_to_dapp_permisssion.up.sql", size: 700, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xed, 0xb0, 0x35, 0xcc, 0x2e, 0x16, 0xe6, 0x15, 0x86, 0x2c, 0x37, 0x80, 0xae, 0xa3, 0xc5, 0x31, 0x78, 0x5, 0x9d, 0xcd, 0x7b, 0xeb, 0x5f, 0xf2, 0xb3, 0x74, 0x72, 0xdf, 0xcf, 0x88, 0xb, 0x40}}
return a, nil
}
@ -245,7 +246,7 @@ func _1646841105_add_emoji_accountUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1646841105_add_emoji_account.up.sql", size: 96, mode: os.FileMode(0644), modTime: time.Unix(1650884918, 0)}
info := bindataFileInfo{name: "1646841105_add_emoji_account.up.sql", size: 96, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe6, 0x77, 0x29, 0x95, 0x18, 0x64, 0x82, 0x63, 0xe7, 0xaf, 0x6c, 0xa9, 0x15, 0x7d, 0x46, 0xa6, 0xbc, 0xdf, 0xa7, 0xd, 0x2b, 0xd2, 0x2d, 0x97, 0x4d, 0xa, 0x6b, 0xd, 0x6e, 0x90, 0x42, 0x5c}}
return a, nil
}
@ -265,7 +266,7 @@ func _1647278782_display_nameUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1647278782_display_name.up.sql", size: 110, mode: os.FileMode(0644), modTime: time.Unix(1650884918, 0)}
info := bindataFileInfo{name: "1647278782_display_name.up.sql", size: 110, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf4, 0xa1, 0x1f, 0x3e, 0x61, 0x65, 0x8d, 0xff, 0xee, 0xde, 0xc5, 0x91, 0xd9, 0x5c, 0xb5, 0xe2, 0xf0, 0xb7, 0xe7, 0x5c, 0x5c, 0x16, 0x25, 0x89, 0xee, 0x78, 0x12, 0xea, 0x3e, 0x48, 0x41, 0xa6}}
return a, nil
}
@ -285,7 +286,7 @@ func _1647862838_reset_last_backupUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1647862838_reset_last_backup.up.sql", size: 37, mode: os.FileMode(0644), modTime: time.Unix(1650884918, 0)}
info := bindataFileInfo{name: "1647862838_reset_last_backup.up.sql", size: 37, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x21, 0xe3, 0xd5, 0xf6, 0x5f, 0xfe, 0x65, 0xfa, 0x1d, 0x88, 0xf8, 0x5f, 0x24, 0x71, 0x34, 0x68, 0x96, 0x2a, 0x60, 0x87, 0x15, 0x82, 0x4d, 0x8a, 0x59, 0x3d, 0x1f, 0xd8, 0x56, 0xd4, 0xfb, 0xda}}
return a, nil
}
@ -305,7 +306,7 @@ func _1647871652_add_settings_sync_clock_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1647871652_add_settings_sync_clock_table.up.sql", size: 1044, mode: os.FileMode(0644), modTime: time.Unix(1650884918, 0)}
info := bindataFileInfo{name: "1647871652_add_settings_sync_clock_table.up.sql", size: 1044, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd8, 0x58, 0xec, 0x85, 0x90, 0xfa, 0x30, 0x98, 0x98, 0x9a, 0xa6, 0xa8, 0x96, 0x2b, 0x38, 0x93, 0xf3, 0xae, 0x46, 0x74, 0xa4, 0x41, 0x62, 0x9b, 0x2, 0x86, 0xbf, 0xe5, 0x2a, 0xce, 0xe2, 0xc0}}
return a, nil
}
@ -325,7 +326,7 @@ func _1647880168_add_torrent_configUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1647880168_add_torrent_config.up.sql", size: 211, mode: os.FileMode(0644), modTime: time.Unix(1650884918, 0)}
info := bindataFileInfo{name: "1647880168_add_torrent_config.up.sql", size: 211, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1, 0x92, 0x22, 0x37, 0x96, 0xf3, 0xb5, 0x5b, 0x27, 0xd0, 0x7d, 0x43, 0x5, 0x4e, 0x9d, 0xe2, 0x49, 0xbe, 0x86, 0x31, 0xa1, 0x89, 0xff, 0xd6, 0x51, 0xe0, 0x9c, 0xb, 0xda, 0xfc, 0xf2, 0x93}}
return a, nil
}
@ -345,7 +346,7 @@ func _1647882837_add_communities_settings_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1647882837_add_communities_settings_table.up.sql", size: 206, mode: os.FileMode(0644), modTime: time.Unix(1650884918, 0)}
info := bindataFileInfo{name: "1647882837_add_communities_settings_table.up.sql", size: 206, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xbd, 0x87, 0x78, 0x99, 0xd9, 0x5d, 0xbd, 0xf7, 0x57, 0x9c, 0xca, 0x97, 0xbd, 0xb3, 0xe9, 0xb5, 0x89, 0x31, 0x3f, 0xf6, 0x5c, 0x13, 0xb, 0xc3, 0x54, 0x93, 0x18, 0x40, 0x7, 0x82, 0xfe, 0x7e}}
return a, nil
}
@ -365,7 +366,7 @@ func _1647956635_add_waku_messages_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1647956635_add_waku_messages_table.up.sql", size: 266, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1647956635_add_waku_messages_table.up.sql", size: 266, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd1, 0xe, 0xe1, 0xdc, 0xda, 0x2e, 0x89, 0x8d, 0xdc, 0x2a, 0x1c, 0x13, 0xa1, 0xfc, 0xfe, 0xf, 0xb2, 0xb9, 0x85, 0xc8, 0x45, 0xd6, 0xd1, 0x7, 0x5c, 0xa3, 0x8, 0x47, 0x44, 0x6d, 0x96, 0xe0}}
return a, nil
}
@ -385,7 +386,7 @@ func _1648554928_network_testUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1648554928_network_test.up.sql", size: 132, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1648554928_network_test.up.sql", size: 132, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9a, 0xc5, 0x7f, 0x87, 0xf3, 0x2c, 0xf7, 0xbb, 0xd3, 0x3a, 0x4e, 0x76, 0x88, 0xca, 0xaf, 0x73, 0xce, 0x8f, 0xa1, 0xf6, 0x3d, 0x4d, 0xed, 0x6f, 0x49, 0xf2, 0xfe, 0x56, 0x2a, 0x60, 0x68, 0xca}}
return a, nil
}
@ -405,7 +406,7 @@ func _1649174829_add_visitble_tokenUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1649174829_add_visitble_token.up.sql", size: 84, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1649174829_add_visitble_token.up.sql", size: 84, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa3, 0x22, 0xc0, 0x2b, 0x3f, 0x4f, 0x3d, 0x5e, 0x4c, 0x68, 0x7c, 0xd0, 0x15, 0x36, 0x9f, 0xec, 0xa1, 0x2a, 0x7b, 0xb4, 0xe3, 0xc6, 0xc9, 0xb4, 0x81, 0x50, 0x4a, 0x11, 0x3b, 0x35, 0x7, 0xcf}}
return a, nil
}
@ -425,7 +426,7 @@ func _1649882262_add_derived_from_accountsUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1649882262_add_derived_from_accounts.up.sql", size: 110, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1649882262_add_derived_from_accounts.up.sql", size: 110, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x11, 0xb9, 0x44, 0x4d, 0x85, 0x8d, 0x7f, 0xb4, 0xae, 0x4f, 0x5c, 0x66, 0x64, 0xb6, 0xe2, 0xe, 0x3d, 0xad, 0x9d, 0x8, 0x4f, 0xab, 0x6e, 0xa8, 0x7d, 0x76, 0x3, 0xad, 0x96, 0x1, 0xee, 0x5c}}
return a, nil
}
@ -445,7 +446,7 @@ func _1650612625_add_community_message_archive_hashes_tableUpSql() (*asset, erro
return nil, err
}
info := bindataFileInfo{name: "1650612625_add_community_message_archive_hashes_table.up.sql", size: 130, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1650612625_add_community_message_archive_hashes_table.up.sql", size: 130, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x48, 0x31, 0xb3, 0x75, 0x23, 0xe2, 0x45, 0xe, 0x47, 0x1b, 0x35, 0xa5, 0x6e, 0x83, 0x4e, 0x64, 0x7d, 0xd7, 0xa2, 0xda, 0xe9, 0x53, 0xf1, 0x16, 0x86, 0x2c, 0x57, 0xad, 0xfa, 0xca, 0x39, 0xde}}
return a, nil
}
@ -465,7 +466,7 @@ func _1650616788_add_communities_archives_info_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1650616788_add_communities_archives_info_table.up.sql", size: 208, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1650616788_add_communities_archives_info_table.up.sql", size: 208, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd1, 0x4f, 0x80, 0x45, 0xb9, 0xd9, 0x15, 0xe2, 0x78, 0xd0, 0xcb, 0x71, 0xc1, 0x1b, 0xb7, 0x1b, 0x1b, 0x97, 0xfe, 0x47, 0x53, 0x3c, 0x62, 0xbc, 0xdd, 0x3a, 0x94, 0x1a, 0xc, 0x48, 0x76, 0xe}}
return a, nil
}
@ -485,7 +486,7 @@ func _1652715604_add_clock_accountsUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1652715604_add_clock_accounts.up.sql", size: 62, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1652715604_add_clock_accounts.up.sql", size: 62, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb6, 0xd9, 0x8d, 0x73, 0xc9, 0xef, 0xfa, 0xb1, 0x4b, 0xa5, 0xf3, 0x5, 0x19, 0x26, 0x46, 0xf8, 0x47, 0x93, 0xdb, 0xac, 0x2, 0xef, 0xf9, 0x71, 0x56, 0x83, 0xe6, 0x2d, 0xb0, 0xd7, 0x83, 0x5c}}
return a, nil
}
@ -505,7 +506,7 @@ func _1653037334_add_notifications_settings_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1653037334_add_notifications_settings_table.up.sql", size: 1276, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1653037334_add_notifications_settings_table.up.sql", size: 1276, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4b, 0xc4, 0x65, 0xac, 0xa, 0xf2, 0xef, 0xb6, 0x39, 0x3c, 0xc5, 0xb1, 0xb2, 0x9c, 0x86, 0x58, 0xe0, 0x38, 0xcb, 0x57, 0x3c, 0x76, 0x73, 0x87, 0x79, 0x4e, 0xf6, 0xed, 0xb0, 0x8e, 0x9e, 0xa}}
return a, nil
}
@ -525,7 +526,7 @@ func _1654702119_add_mutual_contact_settingsUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1654702119_add_mutual_contact_settings.up.sql", size: 78, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1654702119_add_mutual_contact_settings.up.sql", size: 78, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x26, 0x66, 0x67, 0x50, 0xfe, 0xd7, 0xe3, 0x29, 0x8b, 0xff, 0x9d, 0x5a, 0x87, 0xa7, 0x99, 0x6e, 0xd6, 0xcd, 0x2e, 0xbb, 0x17, 0xdf, 0x7f, 0xf7, 0xa3, 0xfa, 0x32, 0x7c, 0x2d, 0x92, 0xc8, 0x74}}
return a, nil
}
@ -545,7 +546,7 @@ func _1655375270_add_clock_field_to_communities_settings_tableUpSql() (*asset, e
return nil, err
}
info := bindataFileInfo{name: "1655375270_add_clock_field_to_communities_settings_table.up.sql", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1655375270_add_clock_field_to_communities_settings_table.up.sql", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x19, 0xc5, 0xc0, 0xf9, 0x84, 0x53, 0xdf, 0x83, 0xcf, 0xb6, 0x40, 0x6d, 0xf5, 0xdc, 0x77, 0x37, 0xb7, 0xe3, 0xa, 0x75, 0xe7, 0x6, 0x11, 0xca, 0x2b, 0x51, 0x92, 0xdd, 0x7d, 0xdb, 0xc3, 0xf5}}
return a, nil
}
@ -565,7 +566,7 @@ func _1655385721_drop_networks_configUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1655385721_drop_networks_config.up.sql", size: 27, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1655385721_drop_networks_config.up.sql", size: 27, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfc, 0xa7, 0x20, 0xbb, 0x67, 0x21, 0xe, 0xc6, 0xc8, 0x21, 0x74, 0xe0, 0xce, 0xc8, 0xe2, 0x2, 0xb4, 0xea, 0xf0, 0xe5, 0xc4, 0x4d, 0xdd, 0xd4, 0x52, 0x31, 0xa9, 0x3d, 0xcd, 0xd8, 0x9b, 0xab}}
return a, nil
}
@ -585,7 +586,7 @@ func _1655385724_networks_chaincolor_shortnameUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1655385724_networks_chainColor_shortName.up.sql", size: 220, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1655385724_networks_chainColor_shortName.up.sql", size: 220, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd9, 0xe7, 0x84, 0xbb, 0x5f, 0xd2, 0x2c, 0x42, 0x88, 0x62, 0x52, 0xb6, 0x58, 0x31, 0xac, 0xc, 0x96, 0x2b, 0x1b, 0xe5, 0x4e, 0x9a, 0x3a, 0xf6, 0xf6, 0xfc, 0xa9, 0x1a, 0x35, 0x62, 0x28, 0x88}}
return a, nil
}
@ -605,7 +606,7 @@ func _1655456688_add_deleted_at_field_to_bookmarks_tableUpSql() (*asset, error)
return nil, err
}
info := bindataFileInfo{name: "1655456688_add_deleted_at_field_to_bookmarks_table.up.sql", size: 69, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1655456688_add_deleted_at_field_to_bookmarks_table.up.sql", size: 69, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe7, 0x9a, 0xbd, 0x9a, 0xc9, 0xf, 0xdf, 0x90, 0x0, 0x5d, 0xea, 0x6e, 0x7d, 0x51, 0x95, 0xcd, 0x90, 0xd3, 0x1a, 0x36, 0x6c, 0xf4, 0xbd, 0xa7, 0x6b, 0xbf, 0xe5, 0xdb, 0xa3, 0x88, 0xe3, 0x50}}
return a, nil
}
@ -625,7 +626,7 @@ func _1655462032_create_bookmarks_deleted_at_indexUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1655462032_create_bookmarks_deleted_at_index.up.sql", size: 81, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1655462032_create_bookmarks_deleted_at_index.up.sql", size: 81, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf, 0x8e, 0x20, 0x6b, 0x14, 0x9e, 0xcd, 0x97, 0xd3, 0xfe, 0x62, 0x3, 0x26, 0x59, 0x1, 0x6c, 0x99, 0xef, 0x6d, 0x21, 0xd4, 0xb5, 0xa3, 0xf4, 0x39, 0x40, 0x54, 0x6, 0xd, 0x60, 0x13, 0x38}}
return a, nil
}
@ -645,7 +646,7 @@ func _1657617291_add_multi_transactions_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1657617291_add_multi_transactions_table.up.sql", size: 412, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1657617291_add_multi_transactions_table.up.sql", size: 412, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x86, 0xb0, 0x4e, 0x8c, 0x4, 0x82, 0xb4, 0x43, 0xaa, 0xd0, 0x16, 0xdd, 0xcb, 0x88, 0x81, 0xac, 0x4, 0x34, 0x1a, 0x8f, 0x2e, 0xc5, 0x69, 0xb, 0xf0, 0x17, 0xf7, 0xe3, 0x9, 0xe, 0x54, 0xe0}}
return a, nil
}
@ -665,7 +666,7 @@ func _1660134042_add_social_links_settings_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1660134042_add_social_links_settings_table.up.sql", size: 334, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1660134042_add_social_links_settings_table.up.sql", size: 334, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x84, 0x73, 0xb6, 0xe7, 0x3f, 0xaa, 0x39, 0x9a, 0x56, 0x56, 0x31, 0xf1, 0x8e, 0x26, 0x23, 0x1, 0xe4, 0xfa, 0x98, 0xfe, 0x78, 0x87, 0x20, 0xcb, 0x52, 0xf4, 0x38, 0x7f, 0xc4, 0x1c, 0x4, 0x22}}
return a, nil
}
@ -685,7 +686,7 @@ func _1660134060_settings_bioUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1660134060_settings_bio.up.sql", size: 91, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1660134060_settings_bio.up.sql", size: 91, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x46, 0x25, 0xa0, 0xa6, 0x47, 0xff, 0xbc, 0x2a, 0x0, 0xff, 0x59, 0x4b, 0xb0, 0xc9, 0x4e, 0x15, 0xe4, 0xd9, 0xda, 0xeb, 0xfe, 0x55, 0x98, 0xc3, 0x9d, 0x96, 0xe7, 0xf, 0xd1, 0x5c, 0x93, 0x73}}
return a, nil
}
@ -705,7 +706,7 @@ func _1660134070_add_wakuv2_storeUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1660134070_add_wakuv2_store.up.sql", size: 269, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1660134070_add_wakuv2_store.up.sql", size: 269, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1d, 0xe6, 0xc3, 0x9, 0xef, 0xdc, 0xae, 0x49, 0x30, 0x78, 0x54, 0xd6, 0xdb, 0xbf, 0xc0, 0x8e, 0x25, 0x8f, 0xfc, 0x67, 0x80, 0x39, 0x37, 0xd4, 0x86, 0xc1, 0x85, 0xc8, 0x99, 0xc4, 0x59, 0xd4}}
return a, nil
}
@ -725,7 +726,7 @@ func _1660134072_waku2_store_messagesUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1660134072_waku2_store_messages.up.sql", size: 497, mode: os.FileMode(0644), modTime: time.Unix(1664364467, 0)}
info := bindataFileInfo{name: "1660134072_waku2_store_messages.up.sql", size: 497, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3e, 0xeb, 0xb4, 0xa0, 0xa1, 0x2b, 0xcb, 0x4c, 0x3c, 0xc6, 0xd0, 0xe8, 0x96, 0xe3, 0x96, 0xf1, 0x4f, 0x1f, 0xe0, 0xe7, 0x1f, 0x85, 0xa3, 0xe, 0xf7, 0x52, 0x56, 0x63, 0x2b, 0xb0, 0x87, 0x7b}}
return a, nil
}
@ -745,7 +746,7 @@ func _1662365868_add_key_uid_accountsUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1662365868_add_key_uid_accounts.up.sql", size: 68, mode: os.FileMode(0644), modTime: time.Unix(1668711465, 0)}
info := bindataFileInfo{name: "1662365868_add_key_uid_accounts.up.sql", size: 68, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc6, 0xd8, 0x2f, 0x2f, 0x3b, 0xa8, 0xbd, 0x6d, 0xf6, 0x87, 0x7e, 0xd2, 0xf1, 0xa2, 0xf7, 0x81, 0x6a, 0x23, 0x10, 0xbc, 0xbf, 0x5b, 0xe7, 0x2b, 0x9c, 0xa9, 0x8a, 0x18, 0xbb, 0xd0, 0x86, 0x91}}
return a, nil
}
@ -765,7 +766,7 @@ func _1662447680_add_keypairs_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1662447680_add_keypairs_table.up.sql", size: 218, mode: os.FileMode(0644), modTime: time.Unix(1668711465, 0)}
info := bindataFileInfo{name: "1662447680_add_keypairs_table.up.sql", size: 218, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xdc, 0x25, 0xa9, 0xc7, 0x63, 0x27, 0x97, 0x35, 0x5f, 0x6b, 0xab, 0x26, 0xcb, 0xf9, 0xbd, 0x5e, 0xac, 0x3, 0xa0, 0x5e, 0xb9, 0x71, 0xa3, 0x1f, 0xb3, 0x4f, 0x7f, 0x79, 0x28, 0x48, 0xbe, 0xc}}
return a, nil
}
@ -785,7 +786,7 @@ func _1662460056_move_favourites_to_saved_addressesUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1662460056_move_favourites_to_saved_addresses.up.sql", size: 233, mode: os.FileMode(0644), modTime: time.Unix(1668711465, 0)}
info := bindataFileInfo{name: "1662460056_move_favourites_to_saved_addresses.up.sql", size: 233, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x10, 0xa2, 0x8c, 0xa3, 0xec, 0xad, 0xdf, 0xc3, 0x48, 0x5, 0x9b, 0x50, 0x25, 0x59, 0xae, 0x7d, 0xee, 0x58, 0xd2, 0x41, 0x27, 0xf2, 0x22, 0x2e, 0x9a, 0xb9, 0x4a, 0xcc, 0x38, 0x6e, 0x3a, 0xb2}}
return a, nil
}
@ -805,7 +806,7 @@ func _1662738097_add_base_fee_transactionUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1662738097_add_base_fee_transaction.up.sql", size: 112, mode: os.FileMode(0644), modTime: time.Unix(1668711465, 0)}
info := bindataFileInfo{name: "1662738097_add_base_fee_transaction.up.sql", size: 112, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6b, 0xfb, 0x10, 0xae, 0xfc, 0x77, 0x70, 0x98, 0x6f, 0xec, 0xaa, 0xcd, 0x7, 0xc7, 0x74, 0x23, 0xc, 0xd5, 0x1e, 0x82, 0xdd, 0xfe, 0xff, 0x3b, 0xd2, 0x49, 0x10, 0x5b, 0x30, 0xc, 0x2d, 0xb0}}
return a, nil
}
@ -825,7 +826,7 @@ func _1662972194_add_keypairs_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1662972194_add_keypairs_table.up.sql", size: 345, mode: os.FileMode(0644), modTime: time.Unix(1668711465, 0)}
info := bindataFileInfo{name: "1662972194_add_keypairs_table.up.sql", size: 345, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xab, 0x76, 0xf2, 0x86, 0xe1, 0x7e, 0xe9, 0x47, 0x32, 0x48, 0xd5, 0x6b, 0xe5, 0xd, 0xab, 0xb7, 0xf1, 0xd4, 0xf1, 0xad, 0x38, 0xa6, 0x11, 0xe7, 0xce, 0x5c, 0x11, 0x11, 0xf, 0x47, 0xb2, 0x4}}
return a, nil
}
@ -845,7 +846,7 @@ func _1664392661_add_third_party_id_to_waku_messagesUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1664392661_add_third_party_id_to_waku_messages.up.sql", size: 70, mode: os.FileMode(0644), modTime: time.Unix(1668711465, 0)}
info := bindataFileInfo{name: "1664392661_add_third_party_id_to_waku_messages.up.sql", size: 70, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfd, 0x67, 0x66, 0x9e, 0x66, 0x74, 0xce, 0x1c, 0xb, 0x1b, 0x9d, 0xd5, 0xfc, 0x65, 0xe, 0x83, 0x90, 0x4c, 0x61, 0x4e, 0x6b, 0xe7, 0x86, 0xbe, 0x36, 0x4f, 0x91, 0x36, 0x4, 0x47, 0x7b, 0x82}}
return a, nil
}
@ -865,7 +866,7 @@ func _1664783660_add_sync_info_to_saved_addressesUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1664783660_add_sync_info_to_saved_addresses.up.sql", size: 388, mode: os.FileMode(0644), modTime: time.Unix(1668711465, 0)}
info := bindataFileInfo{name: "1664783660_add_sync_info_to_saved_addresses.up.sql", size: 388, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x67, 0x7c, 0x3a, 0x95, 0x4e, 0x55, 0xb2, 0xbd, 0xb4, 0x18, 0x93, 0xc1, 0xcf, 0x9f, 0x12, 0xbb, 0x49, 0x8a, 0x2a, 0x6a, 0x2a, 0x7f, 0xad, 0x44, 0xc3, 0xf, 0x3a, 0x79, 0x18, 0xb9, 0x4c, 0x64}}
return a, nil
}
@ -885,7 +886,7 @@ func _1668109917_wakunodesUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1668109917_wakunodes.up.sql", size: 99, mode: os.FileMode(0644), modTime: time.Unix(1669031482, 0)}
info := bindataFileInfo{name: "1668109917_wakunodes.up.sql", size: 99, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x29, 0xaa, 0x9e, 0x2, 0x66, 0x85, 0x69, 0xa8, 0xd9, 0xe2, 0x4b, 0x8d, 0x2a, 0x9c, 0xdf, 0xd2, 0xef, 0x64, 0x58, 0xe3, 0xa6, 0xe7, 0xc1, 0xd1, 0xc8, 0x9c, 0xc0, 0x2c, 0x1, 0xa8, 0x7b, 0x81}}
return a, nil
}
@ -905,7 +906,7 @@ func _1670249678_display_name_to_settings_sync_clock_tableUpSql() (*asset, error
return nil, err
}
info := bindataFileInfo{name: "1670249678_display_name_to_settings_sync_clock_table.up.sql", size: 83, mode: os.FileMode(0644), modTime: time.Unix(1678711803, 0)}
info := bindataFileInfo{name: "1670249678_display_name_to_settings_sync_clock_table.up.sql", size: 83, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x39, 0x18, 0xdc, 0xc4, 0x1f, 0x79, 0x22, 0x16, 0x4d, 0xdf, 0x6c, 0x66, 0xd5, 0xa4, 0x88, 0x5d, 0x5, 0x37, 0xa7, 0x41, 0x5, 0x50, 0xae, 0x12, 0xfa, 0x7e, 0x89, 0x24, 0x5c, 0xae, 0x30, 0xfc}}
return a, nil
}
@ -925,7 +926,7 @@ func _1670836810_add_imported_flag_to_community_archive_hashesUpSql() (*asset, e
return nil, err
}
info := bindataFileInfo{name: "1670836810_add_imported_flag_to_community_archive_hashes.up.sql", size: 144, mode: os.FileMode(0644), modTime: time.Unix(1676035037, 0)}
info := bindataFileInfo{name: "1670836810_add_imported_flag_to_community_archive_hashes.up.sql", size: 144, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6f, 0xf, 0xf0, 0xbd, 0xfe, 0x63, 0x25, 0x8f, 0x5e, 0x46, 0x4b, 0x45, 0x31, 0x8b, 0x3e, 0xd8, 0x6b, 0x5d, 0x9d, 0x6d, 0x10, 0x9a, 0x87, 0x4b, 0x18, 0xc6, 0x39, 0x81, 0x6e, 0xe4, 0x75, 0xfb}}
return a, nil
}
@ -945,7 +946,7 @@ func _1671438731_add_magnetlink_uri_to_communities_archive_infoUpSql() (*asset,
return nil, err
}
info := bindataFileInfo{name: "1671438731_add_magnetlink_uri_to_communities_archive_info.up.sql", size: 86, mode: os.FileMode(0644), modTime: time.Unix(1678711803, 0)}
info := bindataFileInfo{name: "1671438731_add_magnetlink_uri_to_communities_archive_info.up.sql", size: 86, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xda, 0x8b, 0x4b, 0xd6, 0xd8, 0xe2, 0x3d, 0xf7, 0x6b, 0xcd, 0x1e, 0x70, 0x9, 0x2e, 0x35, 0x4, 0x61, 0xc3, 0xb5, 0x9d, 0xc5, 0x27, 0x21, 0xa, 0x5a, 0xd6, 0x3e, 0xa6, 0x24, 0xa2, 0x12, 0xdf}}
return a, nil
}
@ -965,7 +966,7 @@ func _1672933930_switcher_cardUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1672933930_switcher_card.up.sql", size: 162, mode: os.FileMode(0644), modTime: time.Unix(1678711803, 0)}
info := bindataFileInfo{name: "1672933930_switcher_card.up.sql", size: 162, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x39, 0xba, 0xdc, 0xbb, 0x40, 0x4, 0xf2, 0x10, 0xdf, 0xb4, 0xd2, 0x80, 0x8a, 0x74, 0x4d, 0xf6, 0xbc, 0x50, 0x7, 0xd, 0x22, 0x7f, 0xc4, 0xaf, 0xaa, 0xde, 0xdc, 0x71, 0xe9, 0x42, 0x98, 0x36}}
return a, nil
}
@ -985,7 +986,7 @@ func _1674056187_add_price_cacheUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1674056187_add_price_cache.up.sql", size: 255, mode: os.FileMode(0644), modTime: time.Unix(1678711803, 0)}
info := bindataFileInfo{name: "1674056187_add_price_cache.up.sql", size: 255, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb7, 0x79, 0x6a, 0x9b, 0x28, 0xd1, 0x22, 0xf0, 0x84, 0x76, 0x40, 0x39, 0x49, 0x15, 0x5d, 0xaa, 0xfd, 0x11, 0xff, 0x13, 0x27, 0x42, 0x12, 0xfa, 0x82, 0xe6, 0x7a, 0xf0, 0x5e, 0x1f, 0xe3, 0xba}}
return a, nil
}
@ -1005,7 +1006,7 @@ func _1674136690_ens_usernamesUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1674136690_ens_usernames.up.sql", size: 98, mode: os.FileMode(0644), modTime: time.Unix(1678711803, 0)}
info := bindataFileInfo{name: "1674136690_ens_usernames.up.sql", size: 98, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x81, 0x7a, 0xf3, 0xa8, 0x88, 0x99, 0xd6, 0x9c, 0x69, 0x48, 0x3c, 0x10, 0xda, 0x72, 0xdc, 0x14, 0xd, 0x6e, 0x8c, 0x82, 0x92, 0x2d, 0x2c, 0xee, 0x4c, 0x70, 0xa4, 0xdc, 0x5c, 0x5, 0x2, 0xc3}}
return a, nil
}
@ -1025,7 +1026,7 @@ func _1674232431_add_balance_historyUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1674232431_add_balance_history.up.sql", size: 698, mode: os.FileMode(0644), modTime: time.Unix(1678711803, 0)}
info := bindataFileInfo{name: "1674232431_add_balance_history.up.sql", size: 698, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf7, 0xb5, 0x18, 0xca, 0x4a, 0x93, 0xbb, 0x6f, 0xa4, 0xee, 0xe4, 0x3e, 0xff, 0x6a, 0x4b, 0xe2, 0xe1, 0x61, 0x28, 0xee, 0xc5, 0x26, 0x57, 0x61, 0x5e, 0x6d, 0x44, 0x1e, 0x85, 0x43, 0x70, 0xa2}}
return a, nil
}
@ -1045,7 +1046,7 @@ func _1676368933_keypairs_to_keycardsUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1676368933_keypairs_to_keycards.up.sql", size: 639, mode: os.FileMode(0644), modTime: time.Unix(1681203908, 0)}
info := bindataFileInfo{name: "1676368933_keypairs_to_keycards.up.sql", size: 639, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x81, 0x93, 0x27, 0x2, 0xf0, 0x37, 0x81, 0x65, 0xa4, 0xb3, 0x5b, 0x60, 0x36, 0x95, 0xfc, 0x81, 0xf0, 0x3b, 0x7c, 0xc3, 0x2c, 0x85, 0xbd, 0x38, 0x46, 0xa4, 0x95, 0x4a, 0x6, 0x3e, 0x74, 0xd5}}
return a, nil
}
@ -1065,7 +1066,7 @@ func _1676951398_add_currency_format_cacheUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1676951398_add_currency_format_cache.up.sql", size: 291, mode: os.FileMode(0644), modTime: time.Unix(1681203908, 0)}
info := bindataFileInfo{name: "1676951398_add_currency_format_cache.up.sql", size: 291, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf9, 0xa3, 0x76, 0x35, 0xca, 0xf, 0xe8, 0xdf, 0xd9, 0x61, 0xf9, 0xed, 0xfc, 0x6d, 0xf5, 0xe, 0x11, 0x88, 0xbd, 0x14, 0x92, 0xc6, 0x57, 0x53, 0xe, 0xcd, 0x52, 0xf4, 0xa9, 0xb1, 0xdd, 0xfd}}
return a, nil
}
@ -1085,7 +1086,7 @@ func _1676968196_keycards_add_clock_columnUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1676968196_keycards_add_clock_column.up.sql", size: 73, mode: os.FileMode(0644), modTime: time.Unix(1681203908, 0)}
info := bindataFileInfo{name: "1676968196_keycards_add_clock_column.up.sql", size: 73, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4c, 0xf, 0x1c, 0x28, 0x41, 0x57, 0x57, 0x6c, 0xe, 0x75, 0x6b, 0x75, 0x12, 0x0, 0x18, 0x1e, 0x88, 0x1e, 0x45, 0xe0, 0x32, 0xb9, 0xd4, 0xd9, 0x2e, 0xc8, 0xb, 0x80, 0x6, 0x51, 0x3d, 0x28}}
return a, nil
}
@ -1105,7 +1106,7 @@ func _1676968197_add_fallback_rpc_to_networksUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1676968197_add_fallback_rpc_to_networks.up.sql", size: 112, mode: os.FileMode(0644), modTime: time.Unix(1681203908, 0)}
info := bindataFileInfo{name: "1676968197_add_fallback_rpc_to_networks.up.sql", size: 112, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x77, 0x6a, 0xc6, 0x45, 0xfa, 0x62, 0x84, 0x74, 0x6d, 0x7c, 0xd7, 0x1d, 0x79, 0xb6, 0x38, 0x43, 0xa8, 0x8, 0x6b, 0x75, 0x3d, 0x9, 0x2, 0xc5, 0x9f, 0xbb, 0x45, 0x56, 0x4c, 0x4e, 0x17, 0x89}}
return a, nil
}
@ -1125,7 +1126,7 @@ func _1677674090_add_chains_ens_istest_to_saved_addressesUpSql() (*asset, error)
return nil, err
}
info := bindataFileInfo{name: "1677674090_add_chains_ens_istest_to_saved_addresses.up.sql", size: 638, mode: os.FileMode(0644), modTime: time.Unix(1681203908, 0)}
info := bindataFileInfo{name: "1677674090_add_chains_ens_istest_to_saved_addresses.up.sql", size: 638, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa8, 0x2d, 0xa4, 0x1b, 0xf6, 0x6a, 0x13, 0x7b, 0xe, 0x59, 0xcd, 0xe2, 0x4e, 0x81, 0x99, 0xc4, 0x33, 0x84, 0xde, 0x66, 0xca, 0xac, 0x2f, 0x5, 0x90, 0xac, 0xfd, 0x4e, 0xfc, 0x55, 0x44, 0xe5}}
return a, nil
}
@ -1145,7 +1146,7 @@ func _1677681143_accounts_table_type_column_updateUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1677681143_accounts_table_type_column_update.up.sql", size: 135, mode: os.FileMode(0644), modTime: time.Unix(1681203908, 0)}
info := bindataFileInfo{name: "1677681143_accounts_table_type_column_update.up.sql", size: 135, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd2, 0xc4, 0x6, 0x42, 0x50, 0x1d, 0xf4, 0x48, 0x55, 0xbc, 0xa2, 0x19, 0xdd, 0xad, 0xc8, 0xc, 0xa7, 0x30, 0xb6, 0xaf, 0xe, 0x2b, 0xaa, 0x2a, 0xa4, 0xe1, 0xb9, 0x41, 0x23, 0x66, 0xd3, 0x3}}
return a, nil
}
@ -1165,7 +1166,7 @@ func _1678264207_accounts_table_new_columns_addedUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1678264207_accounts_table_new_columns_added.up.sql", size: 130, mode: os.FileMode(0644), modTime: time.Unix(1682525187, 0)}
info := bindataFileInfo{name: "1678264207_accounts_table_new_columns_added.up.sql", size: 130, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf4, 0xd4, 0xf3, 0x35, 0xef, 0x5c, 0x19, 0x3c, 0x15, 0x90, 0x60, 0xbd, 0x1f, 0x81, 0xf0, 0x86, 0x73, 0x89, 0xa0, 0x70, 0xf2, 0x46, 0xae, 0xea, 0xd0, 0xc6, 0x9e, 0x55, 0x4a, 0x54, 0x62, 0xbb}}
return a, nil
}
@ -1185,7 +1186,7 @@ func _1680770368_add_bio_to_settings_sync_clock_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1680770368_add_bio_to_settings_sync_clock_table.up.sql", size: 75, mode: os.FileMode(0644), modTime: time.Unix(1682525187, 0)}
info := bindataFileInfo{name: "1680770368_add_bio_to_settings_sync_clock_table.up.sql", size: 75, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4a, 0x52, 0xf6, 0x3f, 0xaa, 0xd, 0xa0, 0xee, 0xe8, 0xe6, 0x16, 0x21, 0x80, 0x61, 0xe4, 0x7a, 0x4e, 0x37, 0x8d, 0x30, 0x51, 0x20, 0x4d, 0x15, 0x47, 0xfb, 0x6, 0xa1, 0xce, 0xc8, 0x27, 0x5a}}
return a, nil
}
@ -1205,7 +1206,7 @@ func _1681110436_add_mnemonic_to_settings_sync_clock_tableUpSql() (*asset, error
return nil, err
}
info := bindataFileInfo{name: "1681110436_add_mnemonic_to_settings_sync_clock_table.up.sql", size: 311, mode: os.FileMode(0644), modTime: time.Unix(1682525187, 0)}
info := bindataFileInfo{name: "1681110436_add_mnemonic_to_settings_sync_clock_table.up.sql", size: 311, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3d, 0x74, 0x81, 0x7d, 0x9e, 0x77, 0xb6, 0xfe, 0xe3, 0xcb, 0x48, 0xe5, 0x5f, 0x39, 0x23, 0xa1, 0x7d, 0x53, 0x22, 0xe8, 0x96, 0x15, 0x8a, 0x1e, 0x8e, 0xbc, 0xe2, 0x1d, 0xc4, 0xc2, 0x56, 0x34}}
return a, nil
}
@ -1225,7 +1226,7 @@ func _1681392602_9d_sync_periodUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1681392602_9d_sync_period.up.sql", size: 60, mode: os.FileMode(0644), modTime: time.Unix(1682525187, 0)}
info := bindataFileInfo{name: "1681392602_9d_sync_period.up.sql", size: 60, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc9, 0xa, 0x90, 0x29, 0x7f, 0x76, 0x98, 0xa7, 0x71, 0x80, 0x5a, 0x2f, 0xbe, 0x23, 0x9a, 0xd4, 0xf4, 0x39, 0x19, 0xd3, 0xa5, 0x34, 0x6e, 0x67, 0x6a, 0xbe, 0x8a, 0xad, 0x21, 0xc7, 0xba, 0x88}}
return a, nil
}
@ -1245,7 +1246,7 @@ func _1681762078_default_sync_period_9dUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1681762078_default_sync_period_9d.up.sql", size: 3002, mode: os.FileMode(0644), modTime: time.Unix(1682525187, 0)}
info := bindataFileInfo{name: "1681762078_default_sync_period_9d.up.sql", size: 3002, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3e, 0xd9, 0x26, 0xfc, 0xa9, 0x45, 0xc1, 0x81, 0xa8, 0xe2, 0x2c, 0xe9, 0x3c, 0xea, 0x1d, 0x37, 0x11, 0x45, 0x8c, 0x6c, 0xbc, 0xc2, 0x6, 0x69, 0x2, 0x75, 0x29, 0x40, 0x9f, 0xc5, 0xbb, 0x36}}
return a, nil
}
@ -1265,7 +1266,7 @@ func _1681780680_add_clock_to_social_links_settingsUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1681780680_add_clock_to_social_links_settings.up.sql", size: 137, mode: os.FileMode(0644), modTime: time.Unix(1682525187, 0)}
info := bindataFileInfo{name: "1681780680_add_clock_to_social_links_settings.up.sql", size: 137, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x63, 0x11, 0xf5, 0x41, 0xe5, 0x5a, 0xf4, 0xe3, 0xf3, 0x14, 0x87, 0x28, 0xd8, 0xf0, 0x52, 0x31, 0x8, 0xd5, 0xbb, 0xf4, 0xff, 0x55, 0x5f, 0x42, 0x90, 0xcb, 0xf7, 0x46, 0x2, 0x6, 0xbe, 0x42}}
return a, nil
}
@ -1285,7 +1286,7 @@ func _1682073779_settings_table_remove_latest_derived_path_columnUpSql() (*asset
return nil, err
}
info := bindataFileInfo{name: "1682073779_settings_table_remove_latest_derived_path_column.up.sql", size: 4470, mode: os.FileMode(0644), modTime: time.Unix(1682525187, 0)}
info := bindataFileInfo{name: "1682073779_settings_table_remove_latest_derived_path_column.up.sql", size: 4470, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x7a, 0x36, 0x2, 0x41, 0xd, 0x5c, 0xd1, 0x92, 0x85, 0x6d, 0x84, 0xff, 0x67, 0xa7, 0x4c, 0x67, 0xa4, 0xef, 0x52, 0x69, 0x1f, 0x22, 0x25, 0x92, 0xc, 0xb3, 0x89, 0x50, 0x91, 0xc, 0x49, 0xf9}}
return a, nil
}
@ -1305,7 +1306,7 @@ func _1682146075_add_created_at_to_saved_addressesUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1682146075_add_created_at_to_saved_addresses.up.sql", size: 107, mode: os.FileMode(0644), modTime: time.Unix(1682525187, 0)}
info := bindataFileInfo{name: "1682146075_add_created_at_to_saved_addresses.up.sql", size: 107, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x88, 0xfe, 0x35, 0x9c, 0x6b, 0xdf, 0x67, 0x18, 0x16, 0xe4, 0xc9, 0xd4, 0x77, 0x7c, 0x4, 0xe2, 0x6c, 0x41, 0xd9, 0x53, 0x97, 0xfe, 0x5, 0xa3, 0x23, 0xce, 0x82, 0xad, 0x92, 0x5e, 0xd7, 0x7d}}
return a, nil
}
@ -1325,7 +1326,7 @@ func _1682393575_sync_ens_nameUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1682393575_sync_ens_name.up.sql", size: 713, mode: os.FileMode(0644), modTime: time.Unix(1683194402, 0)}
info := bindataFileInfo{name: "1682393575_sync_ens_name.up.sql", size: 713, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfb, 0xea, 0xcb, 0x4d, 0x71, 0x5a, 0x49, 0x19, 0x8b, 0xef, 0x66, 0x27, 0x33, 0x89, 0xb0, 0xe, 0x37, 0x1b, 0x41, 0x8, 0x12, 0xcc, 0x56, 0xd8, 0x1b, 0xf, 0xf8, 0x50, 0x4b, 0x93, 0xf1, 0x29}}
return a, nil
}
@ -1345,11 +1346,31 @@ func _1683457503_add_blocks_ranges_sequential_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1683457503_add_blocks_ranges_sequential_table.up.sql", size: 263, mode: os.FileMode(0644), modTime: time.Unix(1684503588, 0)}
info := bindataFileInfo{name: "1683457503_add_blocks_ranges_sequential_table.up.sql", size: 263, mode: os.FileMode(0644), modTime: time.Unix(1684513633, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfe, 0x57, 0x2e, 0x0, 0x6a, 0x6e, 0xd7, 0xeb, 0xe6, 0x66, 0x79, 0x32, 0x22, 0x82, 0x92, 0xf4, 0xc9, 0xf1, 0x58, 0x1a, 0x45, 0x60, 0x77, 0x50, 0xe7, 0x54, 0x4a, 0xc0, 0x42, 0x3a, 0x4f, 0x35}}
return a, nil
}
var __1683627613_accounts_and_keycards_improvementsUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x56\xcd\x72\xea\x36\x14\xde\xfb\x29\x4e\xd9\x94\xcc\x60\xee\x5d\x37\x93\xce\x38\x20\x6e\xe8\x25\x76\xc6\x38\x6d\xb3\x32\x8a\x75\x88\x55\x8c\xe4\xb1\x45\x12\xde\xbe\x23\xc9\x36\xc6\x38\x81\x66\x51\x36\xd8\x3a\x3f\xfa\xce\xdf\x77\xec\xba\xf0\x20\xcb\x92\x3f\x67\x08\x2b\x99\x63\x41\x9f\x33\x5c\x41\x22\xb3\xdd\x56\xc0\x2b\xcd\x76\x58\xfe\xe6\xb8\x2e\x0c\x84\x1c\x40\xf5\xfb\xf6\x0d\xa8\x00\x9a\x24\x72\x27\x14\xf0\x12\x84\x14\x50\x1b\x03\xaf\x8e\x14\x50\xd8\xe0\x3e\xa1\x05\x6b\x74\xa9\x60\xa0\x52\x2c\xd0\xaa\x68\x79\xa9\x64\x81\xb0\xe6\x19\xc2\x5a\x16\xda\x5a\x2b\xf5\xca\x54\x8a\x40\x19\x2b\xb0\x2c\xab\x5b\x18\x16\xfc\x15\x19\xac\x0b\xb9\x35\x28\x73\x5a\x28\x4e\xb3\x6c\x3f\x38\x45\xd9\xc8\x5a\x58\xd7\x97\xc3\x4d\x0a\xa4\x0a\xd9\xd7\x70\xad\x77\x06\x53\x6f\xf6\x8c\xec\x6b\x98\x68\x6f\x06\x1d\x7d\xa5\xc7\x18\x17\x2f\x20\xf0\x0d\x94\xf6\x5b\xc2\x6a\x83\xfb\x9c\xf2\xa2\x5c\x19\x27\xcd\x6b\x5c\xb9\x2e\x57\xce\x24\x24\x5e\x44\x20\xf2\x6e\x17\x04\xe6\x33\xf0\x83\x08\xc8\xdf\xf3\x65\xb4\x84\x5a\x1b\x86\x0e\xe8\x97\x78\xc7\x19\xfc\xe9\x85\x93\x3b\x2f\x84\x87\x70\x7e\xef\x85\x4f\xf0\x93\x3c\x19\x1b\xff\x71\xb1\x80\xc9\x1d\x99\xfc\x84\x61\x86\xe2\x45\xa5\x43\x55\xf0\xed\xb0\xb2\xbb\xba\x82\xdf\xe1\xfb\xd5\xc8\x01\x10\x74\x8b\x8d\x9b\xc6\x74\x4a\x66\xde\xe3\x22\x82\xc1\x40\xeb\xa8\x7d\x7e\x56\xa7\xca\x78\xac\x33\x7e\x4e\x37\xa3\xa5\x8a\x77\x25\xb2\xd8\x58\x51\xc5\xa5\x88\xb9\x60\xf8\x0e\x73\x3f\x3a\xb5\xfa\xae\x8d\xca\xbd\x48\x2e\xf1\x0f\xae\x0b\x1b\xc4\xbc\xd4\x55\xe6\x62\x2d\xe1\x2d\xe5\x49\x0a\x0c\x5f\x79\x82\xa0\x52\x5e\xd6\xb9\x34\x15\x64\xac\xee\x13\x80\x24\x93\xc9\xe6\x03\x0c\xce\xd5\xb5\x73\x49\x7d\x9a\x6a\x9a\x42\xd5\x6d\xd9\x53\xa8\xd1\x69\x1d\xf5\x51\xbe\x7b\xde\xe0\xfe\xe8\x84\xaa\xf4\x5c\x4a\x2f\x29\x63\x22\x33\x59\x9c\x53\xc2\xad\xfc\x87\x9f\x53\x7a\xa3\x59\x86\x0a\x6e\x83\x60\x71\xaa\x32\xf3\x16\x4b\x62\xee\x4b\xe9\x59\x9d\x94\x33\x86\xe2\x9c\x56\x33\x9b\x1f\xe3\x12\xd2\x96\x9e\x61\x99\x14\xfc\x19\xcb\xd6\x90\xff\x5a\x56\x1e\x78\xc6\xd5\x1e\x86\x05\x52\xa6\xc5\xf8\x9e\x67\x54\x98\xf6\x03\xaa\x0c\x8d\x28\x99\x83\x5c\xdb\x2e\xd1\x13\x7d\xa5\xe3\xb0\xc4\x13\x53\x05\x53\x2f\x22\xd1\xfc\x9e\x34\x00\x34\xba\x5d\xce\x3e\x95\x7f\xd6\x55\x5a\x3e\x0b\x42\x32\xff\xe1\xeb\x9e\x68\x06\x14\x42\x32\x23\x21\xf1\x27\xe4\xd0\x59\x07\xa1\xa3\x79\x2c\xf0\x61\x4a\x16\x24\x22\x30\xf1\x96\x13\x6f\x4a\x4c\x87\xba\x2e\xcc\x76\xd9\x9a\x67\x99\x66\x1f\x13\x92\x61\x1f\x67\xee\x2f\x49\x18\x69\x18\xc1\x81\x4b\x1c\x80\x25\x59\x90\x49\x54\x77\xe2\xa8\x96\xc5\xba\xa3\x46\x30\xc8\x0b\xa9\xf3\x30\x18\x1d\x4d\xf8\xe8\x93\x19\x1e\x99\x29\xb4\x41\xeb\xe8\xc2\xe0\x1e\x9a\x99\x70\x00\xfe\xba\x23\x21\xb1\x9c\xf2\xcb\x0d\x0c\xde\xa8\x4a\xd2\x01\x78\xfe\xf4\x70\x56\x22\xb2\xce\xd1\x06\xf7\x03\x07\xe0\x47\x18\x3c\x3e\xc0\xed\x53\x8d\xf7\xda\xf9\x62\x60\xda\xf1\xff\x1a\x53\xe7\xf5\x05\x05\x16\xba\x6d\xfe\x43\x54\x71\xfb\xca\x2a\x3c\x3a\xae\x28\x66\x04\x9b\x7c\xdc\x04\x4b\xc7\x96\x47\xcc\x13\x55\xa9\xfe\xb7\x81\xd3\xb1\xe1\x01\xfd\x60\x66\x5d\x3f\xd8\x79\x36\xb2\x94\x9a\x7f\x3b\x97\xa3\x7a\x71\x1a\x51\x33\x06\xfa\xed\xd0\xf4\x46\xd6\x9f\x19\xaa\x8f\x16\x64\x16\xc1\x1f\xc1\xdc\x3f\x54\x67\x93\x6b\x41\xe0\x03\xad\x11\xc3\x4d\x0b\xbe\x6d\xe3\x10\xb7\xf2\x55\x37\xb1\xcc\x18\xac\x9a\x1d\x69\xfb\xd9\x99\x86\xc1\x43\xc5\xc3\xb5\xe8\xba\xde\xbb\x7a\x0d\x23\x7f\x11\xfa\x42\x50\xd2\x6c\x5a\xbd\xc3\x1b\x63\xd7\x85\xa8\xf5\x15\x24\xf5\x3e\x87\x37\x6a\x94\xe9\x79\x7b\xc0\xf7\x04\x73\xa5\x45\x05\xba\x36\x2f\xd5\x98\x8d\x1d\x6f\x11\x91\xb0\x42\x56\xdb\x41\x48\x7c\xef\x9e\x80\xad\xa5\x39\x8a\x65\xc6\xae\x7b\x95\x0f\x55\xee\xb1\xaa\x65\xd6\xfc\xcc\x3e\xb2\x77\x0f\x0d\x5b\x54\xaf\x47\x5f\x0d\x0d\x1d\x75\xb6\xd2\x41\xbb\x77\xad\x1c\xab\xe8\xca\x23\x33\x0c\x4e\x3c\xff\x94\xbb\x4f\x3f\x56\x8e\xfd\xd8\xa1\x33\xdd\x14\x9f\x63\xca\x2f\x73\xe5\x47\x6c\x79\x41\xfe\x8e\xf7\xf9\xe7\x89\xb4\x18\x2b\x83\xb8\xbb\xfb\x8f\xb5\x3a\x91\xd4\x3e\xbb\xd1\x18\x0c\xc7\x0a\x87\x88\x1e\x1f\xf4\xc2\x69\x22\xfa\x2c\xd2\x0e\x9f\xd8\xd6\x68\xb1\x64\xa2\x3b\x6a\xdc\xba\x67\xd4\x3d\xb3\xf4\xd1\x39\xb4\xd5\x3f\xe6\x9e\x4a\xe5\xb4\xb0\x35\x3f\xb4\x67\xa0\xd2\x76\xe0\x23\x8a\x38\x5c\xd8\xc7\x13\x7d\x61\xf5\xd1\xe4\x26\x39\x89\x8d\x26\xd6\x73\xb7\x5c\x27\x28\xdb\x33\xd7\x32\x6c\x41\xb6\xd9\xdc\x24\x0d\xe2\xda\x77\xbb\x59\x6e\x3a\x20\xae\x9d\x36\x89\x7d\x30\xe1\x7d\x1a\x5a\xf0\x6f\x00\x00\x00\xff\xff\x42\x84\x7a\x0a\x38\x0e\x00\x00")
func _1683627613_accounts_and_keycards_improvementsUpSqlBytes() ([]byte, error) {
return bindataRead(
__1683627613_accounts_and_keycards_improvementsUpSql,
"1683627613_accounts_and_keycards_improvements.up.sql",
)
}
func _1683627613_accounts_and_keycards_improvementsUpSql() (*asset, error) {
bytes, err := _1683627613_accounts_and_keycards_improvementsUpSqlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "1683627613_accounts_and_keycards_improvements.up.sql", size: 3640, mode: os.FileMode(0644), modTime: time.Unix(1684748654, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x8e, 0xbe, 0x62, 0xf5, 0x9, 0x42, 0x8c, 0x8f, 0xa8, 0x45, 0xe7, 0x36, 0xc9, 0xde, 0xf4, 0xe2, 0xfd, 0xc4, 0x8, 0xd0, 0xa3, 0x8, 0x64, 0xe2, 0x56, 0xcc, 0xa7, 0x6d, 0xc5, 0xcc, 0x82, 0x2c}}
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) {
@ -1365,7 +1386,7 @@ func docGo() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1648117578, 0)}
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1683916611, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xde, 0x7c, 0x28, 0xcd, 0x47, 0xf2, 0xfa, 0x7c, 0x51, 0x2d, 0xd8, 0x38, 0xb, 0xb0, 0x34, 0x9d, 0x4c, 0x62, 0xa, 0x9e, 0x28, 0xc3, 0x31, 0x23, 0xd9, 0xbb, 0x89, 0x9f, 0xa0, 0x89, 0x1f, 0xe8}}
return a, nil
}
@ -1583,6 +1604,8 @@ var _bindata = map[string]func() (*asset, error){
"1683457503_add_blocks_ranges_sequential_table.up.sql": _1683457503_add_blocks_ranges_sequential_tableUpSql,
"1683627613_accounts_and_keycards_improvements.up.sql": _1683627613_accounts_and_keycards_improvementsUpSql,
"doc.go": docGo,
}
@ -1688,6 +1711,7 @@ var _bintree = &bintree{nil, map[string]*bintree{
"1682146075_add_created_at_to_saved_addresses.up.sql": &bintree{_1682146075_add_created_at_to_saved_addressesUpSql, map[string]*bintree{}},
"1682393575_sync_ens_name.up.sql": &bintree{_1682393575_sync_ens_nameUpSql, map[string]*bintree{}},
"1683457503_add_blocks_ranges_sequential_table.up.sql": &bintree{_1683457503_add_blocks_ranges_sequential_tableUpSql, map[string]*bintree{}},
"1683627613_accounts_and_keycards_improvements.up.sql": &bintree{_1683627613_accounts_and_keycards_improvementsUpSql, map[string]*bintree{}},
"doc.go": &bintree{docGo, map[string]*bintree{}},
}}

View File

@ -0,0 +1,94 @@
-- Possible `operable` column values:
-- "no" // an account is non operable it is not a keycard account and there is no keystore file for it and no keystore file for the address it is derived from
-- "partially" // an account is partially operable if it is not a keycard account and there is created keystore file for the address it is derived from
-- "fully" // an account is fully operable if it is not a keycard account and there is a keystore file for it
-- Adding new tables `keypairs` and `keypairs_accounts`
CREATE TABLE IF NOT EXISTS keypairs (
key_uid VARCHAR PRIMARY KEY NOT NULL CHECK (length(trim(key_uid)) > 0),
name VARCHAR NOT NULL DEFAULT "",
type VARCHAR NOT NULL DEFAULT "",
derived_from VARCHAR NOT NULL DEFAULT "",
last_used_derivation_index INT NOT NULL DEFAULT 0,
synced_from VARCHAR NOT NULL DEFAULT "", -- keeps an info which device this keypair is added from
clock INT NOT NULL DEFAULT 0
);
CREATE TABLE IF NOT EXISTS keypairs_accounts (
address VARCHAR PRIMARY KEY,
key_uid VARCHAR,
pubkey VARCHAR,
path VARCHAR NOT NULL DEFAULT "",
name VARCHAR NOT NULL DEFAULT "",
color VARCHAR NOT NULL DEFAULT "",
emoji VARCHAR NOT NULL DEFAULT "",
wallet BOOL NOT NULL DEFAULT FALSE,
chat BOOL NOT NULL DEFAULT FALSE,
hidden BOOL NOT NULL DEFAULT FALSE,
operable VARCHAR NOT NULL DEFAULT "no", -- describes an account's operability (read an explanation at the top of this file)
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
clock INT NOT NULL DEFAULT 0,
FOREIGN KEY(key_uid) REFERENCES keypairs(key_uid)
ON DELETE CASCADE
);
-- Fulfilling the tables
INSERT INTO keypairs
SELECT key_uid, keypair_name, "profile", derived_from, last_used_derivation_index, "", clock
FROM accounts
WHERE type != "watch" AND type != "seed" AND type != "key"
GROUP BY key_uid;
INSERT INTO keypairs
SELECT key_uid, keypair_name, type, derived_from, last_used_derivation_index, "", clock
FROM accounts
WHERE type != "watch" AND type != "" AND type != "generated"
GROUP BY key_uid;
INSERT INTO keypairs_accounts
SELECT a.address, kp.key_uid, a.pubkey, a.path, a.name, a.color, a.emoji, a.wallet, a.chat, a.hidden, "fully", a.created_at, a.updated_at, a.clock
FROM accounts a
LEFT JOIN keypairs kp
ON a.key_uid = kp.key_uid;
-- Removing old `accounts` table
DROP TABLE accounts;
-- Add foreign key to `keycards` table
-- There is no other way to add foreign key to `keycards` table except to re-create tables.
ALTER TABLE keycards RENAME TO keycards_old;
ALTER TABLE keycards_accounts RENAME TO keycards_accounts_old;
CREATE TABLE IF NOT EXISTS keycards (
keycard_uid VARCHAR NOT NULL PRIMARY KEY,
keycard_name VARCHAR NOT NULL,
keycard_locked BOOLEAN DEFAULT FALSE,
key_uid VARCHAR NOT NULL,
last_update_clock INT NOT NULL DEFAULT 0,
FOREIGN KEY(key_uid) REFERENCES keypairs(key_uid)
ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS keycards_accounts (
keycard_uid VARCHAR NOT NULL,
account_address VARCHAR NOT NULL,
FOREIGN KEY(keycard_uid) REFERENCES keycards(keycard_uid)
ON UPDATE CASCADE
ON DELETE CASCADE
);
INSERT INTO keycards
SELECT kc_old.keycard_uid, kc_old.keycard_name, kc_old.keycard_locked, kp.key_uid, kc_old.last_update_clock
FROM keycards_old kc_old
JOIN keypairs kp
ON kc_old.key_uid = kp.key_uid;
INSERT INTO keycards_accounts
SELECT kc.keycard_uid, kc_acc_old.account_address
FROM keycards_accounts_old kc_acc_old
JOIN keycards kc
ON kc_acc_old.keycard_uid = kc.keycard_uid;
DROP TABLE keycards_accounts_old;
DROP TABLE keycards_old;

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
package keycards
package accounts
import (
"database/sql"
@ -10,7 +10,7 @@ import (
"github.com/status-im/status-go/protocol/protobuf"
)
var errDbTransactionIsNil = errors.New("keycard: database transaction is nil")
var errKeycardDbTransactionIsNil = errors.New("keycard: database transaction is nil")
type Keycard struct {
KeycardUID string `json:"keycard-uid"`
@ -175,6 +175,9 @@ func (kp *Keycards) GetKeycardByKeyUID(keyUID string) ([]*Keycard, error) {
k.keycard_uid
`, keyUID)
if err != nil {
if err == sql.ErrNoRows {
return []*Keycard{}, nil
}
return nil, err
}
@ -198,7 +201,7 @@ func (kp *Keycards) startTransactionAndCheckIfNeedToProceed(kcUID string, clock
func (kp *Keycards) setLastUpdateClock(tx *sql.Tx, kcUID string, clock uint64) (err error) {
if tx == nil {
return errDbTransactionIsNil
return errKeycardDbTransactionIsNil
}
_, err = tx.Exec(`
@ -216,7 +219,7 @@ func (kp *Keycards) setLastUpdateClock(tx *sql.Tx, kcUID string, clock uint64) (
func (kp *Keycards) getAccountsForKeycard(tx *sql.Tx, kcUID string) ([]types.Address, error) {
var accountAddresses []types.Address
if tx == nil {
return accountAddresses, errDbTransactionIsNil
return accountAddresses, errKeycardDbTransactionIsNil
}
rows, err := tx.Query(`SELECT account_address FROM keycards_accounts WHERE keycard_uid = ?`, kcUID)
@ -239,7 +242,7 @@ func (kp *Keycards) getAccountsForKeycard(tx *sql.Tx, kcUID string) ([]types.Add
func (kp *Keycards) addAccounts(tx *sql.Tx, kcUID string, accountsAddresses []types.Address) (err error) {
if tx == nil {
return errDbTransactionIsNil
return errKeycardDbTransactionIsNil
}
insertKcAcc, err := tx.Prepare(`
@ -272,7 +275,7 @@ func (kp *Keycards) addAccounts(tx *sql.Tx, kcUID string, accountsAddresses []ty
func (kp *Keycards) deleteKeycard(tx *sql.Tx, kcUID string) (err error) {
if tx == nil {
return errDbTransactionIsNil
return errKeycardDbTransactionIsNil
}
delete, err := tx.Prepare(`
@ -339,7 +342,7 @@ func (kp *Keycards) AddKeycardOrAddAccountsIfKeycardIsAdded(keycard Keycard) (ad
return false, false, err
}
func (kp *Keycards) SyncKeycards(syncingClock uint64, keycardsToSync []*Keycard) (err error) {
func (kp *Keycards) ApplyKeycardsForKeypairWithKeyUID(keyUID string, keycardsToSync []*Keycard) (err error) {
tx, err := kp.db.Begin()
if err != nil {
return
@ -352,7 +355,7 @@ func (kp *Keycards) SyncKeycards(syncingClock uint64, keycardsToSync []*Keycard)
_ = tx.Rollback()
}()
rows, err := tx.Query(`SELECT * FROM keycards`)
rows, err := tx.Query(`SELECT * FROM keycards WHERE key_uid = ?`, keyUID)
if err != nil && err != sql.ErrNoRows {
return err
}
@ -371,24 +374,28 @@ func (kp *Keycards) SyncKeycards(syncingClock uint64, keycardsToSync []*Keycard)
}
// apply those from `keycardsToSync` which are newer
for _, syncKp := range keycardsToSync {
for _, syncKc := range keycardsToSync {
foundAtIndex := -1
for i := range dbKeycards {
if dbKeycards[i].KeycardUID == syncKp.KeycardUID {
if dbKeycards[i].KeycardUID == syncKc.KeycardUID {
foundAtIndex = i
break
}
}
doInsertOrReplace := true
if foundAtIndex > -1 {
if dbKeycards[foundAtIndex].LastUpdateClock > syncKp.LastUpdateClock {
doInsertOrReplace = false
}
dbClock := dbKeycards[foundAtIndex].LastUpdateClock
dbKeycards = removeElementAtIndex(dbKeycards, foundAtIndex)
if dbClock > syncKc.LastUpdateClock {
continue
}
err = kp.deleteKeycard(tx, syncKc.KeycardUID)
if err != nil {
return err
}
}
if doInsertOrReplace {
_, err = tx.Exec(`
INSERT OR REPLACE INTO
keycards
@ -401,25 +408,20 @@ func (kp *Keycards) SyncKeycards(syncingClock uint64, keycardsToSync []*Keycard)
)
VALUES
(?, ?, ?, ?, ?);`,
syncKp.KeycardUID, syncKp.KeycardName, syncKp.KeycardLocked, syncKp.KeyUID, syncKp.LastUpdateClock)
syncKc.KeycardUID, syncKc.KeycardName, syncKc.KeycardLocked, syncKc.KeyUID, syncKc.LastUpdateClock)
if err != nil {
return err
}
err = kp.addAccounts(tx, syncKp.KeycardUID, syncKp.AccountsAddresses)
err = kp.addAccounts(tx, syncKc.KeycardUID, syncKc.AccountsAddresses)
if err != nil {
return err
}
}
}
// remove those from the db if they are not in `keycardsToSync` and if they are older than the moment `keycardsToSync` was created at
// remove those from the db if they are not in `keycardsToSync`
for _, dbKp := range dbKeycards {
if dbKp.LastUpdateClock > syncingClock {
continue
}
err = kp.deleteKeycard(tx, dbKp.KeycardUID)
if err != nil {
return err

View File

@ -2330,6 +2330,7 @@ func (m *Messenger) syncProfilePictures(rawMessageHandler RawMessageHandler) err
// SyncDevices sends all public chats and contacts to paired devices
// TODO remove use of photoPath in contacts
func (m *Messenger) SyncDevices(ctx context.Context, ensName, photoPath string, rawMessageHandler RawMessageHandler) (err error) {
syncedFromLocalPairing := rawMessageHandler != nil
if rawMessageHandler == nil {
rawMessageHandler = m.dispatchMessage
}
@ -2448,11 +2449,6 @@ func (m *Messenger) SyncDevices(ctx context.Context, ensName, photoPath string,
return err
}
accounts, err := m.settings.GetAccounts()
if err != nil {
return err
}
ids, err := m.persistence.LatestContactRequestIDs()
if err != nil {
@ -2469,11 +2465,33 @@ func (m *Messenger) SyncDevices(ctx context.Context, ensName, photoPath string,
}
}
err = m.syncWallets(accounts, rawMessageHandler)
keypairs, err := m.settings.GetKeypairs()
if err != nil {
return err
}
for _, kp := range keypairs {
if syncedFromLocalPairing {
kp.SyncedFrom = accounts.SyncedFromLocalPairing
}
err = m.syncKeypair(kp, true, rawMessageHandler)
if err != nil {
return err
}
}
woAccounts, err := m.settings.GetWatchOnlyAccounts()
if err != nil {
return err
}
for _, woAcc := range woAccounts {
err = m.syncWalletAccount(woAcc, rawMessageHandler)
if err != nil {
return err
}
}
savedAddresses, err := m.savedAddressesManager.GetRawSavedAddresses()
if err != nil {
return err
@ -2488,11 +2506,6 @@ func (m *Messenger) SyncDevices(ctx context.Context, ensName, photoPath string,
}
}
err = m.syncAllKeycards(ctx, rawMessageHandler)
if err != nil {
return err
}
if err = m.syncEnsUsernameDetails(ctx, rawMessageHandler); err != nil {
return err
}
@ -4198,18 +4211,48 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte
}
messageState.Response.AnonymousMetrics = append(messageState.Response.AnonymousMetrics, ams...)
case protobuf.SyncWalletAccounts:
case protobuf.SyncKeypair:
if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) {
logger.Warn("not coming from us, ignoring")
continue
}
p := msg.ParsedMessage.Interface().(protobuf.SyncWalletAccounts)
p := msg.ParsedMessage.Interface().(protobuf.SyncKeypair)
m.outputToCSV(msg.TransportMessage.Timestamp, msg.ID, senderID, filter.Topic, filter.ChatID, msg.Type, p)
logger.Debug("Handling SyncWalletAccount", zap.Any("message", p))
err = m.HandleSyncWalletAccount(messageState, p)
logger.Debug("Handling SyncKeypair", zap.Any("message", p))
err = m.HandleSyncKeypair(messageState, p)
if err != nil {
logger.Warn("failed to handle SyncWalletAccount", zap.Error(err))
logger.Warn("failed to handle SyncKeypair", zap.Error(err))
allMessagesProcessed = false
continue
}
case protobuf.SyncKeypairFull:
if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) {
logger.Warn("not coming from us, ignoring")
continue
}
p := msg.ParsedMessage.Interface().(protobuf.SyncKeypairFull)
m.outputToCSV(msg.TransportMessage.Timestamp, msg.ID, senderID, filter.Topic, filter.ChatID, msg.Type, p)
logger.Debug("Handling SyncKeypairFull", zap.Any("message", p))
err = m.HandleSyncKeypairFull(messageState, p)
if err != nil {
logger.Warn("failed to handle SyncKeypairFull", zap.Error(err))
allMessagesProcessed = false
continue
}
case protobuf.SyncAccount:
if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) {
logger.Warn("not coming from us, ignoring")
continue
}
p := msg.ParsedMessage.Interface().(protobuf.SyncAccount)
m.outputToCSV(msg.TransportMessage.Timestamp, msg.ID, senderID, filter.Topic, filter.ChatID, msg.Type, p)
logger.Debug("Handling SyncAccount", zap.Any("message", p))
err = m.HandleSyncWalletAccount(messageState, p, "")
if err != nil {
logger.Warn("failed to handle SyncAccount", zap.Error(err))
allMessagesProcessed = false
continue
}
@ -4235,20 +4278,6 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte
allMessagesProcessed = false
continue
}
case protobuf.SyncAllKeycards:
if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) {
logger.Warn("not coming from us, ignoring")
continue
}
p := msg.ParsedMessage.Interface().(protobuf.SyncAllKeycards)
m.outputToCSV(msg.TransportMessage.Timestamp, msg.ID, senderID, filter.Topic, filter.ChatID, msg.Type, p)
err = m.handleSyncKeycards(messageState, p)
if err != nil {
logger.Warn("failed to handle SyncAllKeycards", zap.Error(err))
allMessagesProcessed = false
continue
}
case protobuf.SyncKeycardAction:
if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) {
logger.Warn("not coming from us, ignoring")

View File

@ -7,6 +7,7 @@ import (
"github.com/golang/protobuf/proto"
"go.uber.org/zap"
"github.com/status-im/status-go/multiaccounts/accounts"
"github.com/status-im/status-go/multiaccounts/settings"
"github.com/status-im/status-go/protocol/common"
"github.com/status-im/status-go/protocol/protobuf"
@ -95,12 +96,12 @@ func (m *Messenger) BackupData(ctx context.Context) (uint64, error) {
return 0, errors[0]
}
syncWalletAccounts, err := m.backupWalletAccounts()
fullKeypairsToBackup, err := m.backupKeypairs()
if err != nil {
return 0, err
}
keycardsToBackup, err := m.prepareSyncAllKeycardsMessage(clock)
woAccountsToBackup, err := m.backupWatchOnlyAccounts()
if err != nil {
return 0, err
}
@ -124,13 +125,13 @@ func (m *Messenger) BackupData(ctx context.Context) (uint64, error) {
DataNumber: uint32(0),
TotalNumber: uint32(len(settings)),
},
WalletAccountsDetails: &protobuf.FetchingBackedUpDataDetails{
FullKeypairDetails: &protobuf.FetchingBackedUpDataDetails{
DataNumber: uint32(0),
TotalNumber: uint32(len(syncWalletAccounts.Accounts)),
TotalNumber: uint32(len(fullKeypairsToBackup)),
},
KeycardsDetails: &protobuf.FetchingBackedUpDataDetails{
WatchOnlyAccountDetails: &protobuf.FetchingBackedUpDataDetails{
DataNumber: uint32(0),
TotalNumber: uint32(1),
TotalNumber: uint32(len(woAccountsToBackup)),
},
}
}
@ -179,25 +180,27 @@ func (m *Messenger) BackupData(ctx context.Context) (uint64, error) {
}
}
// Update wallet accounts messages encode and dispatch
for i, d := range syncWalletAccounts.Accounts {
// Update keypairs messages encode and dispatch
for i, d := range fullKeypairsToBackup {
pb := backupDetailsOnly()
pb.WalletAccountsDetails.DataNumber = uint32(i + 1)
pb.WalletAccount = d
pb.FullKeypairDetails.DataNumber = uint32(i + 1)
pb.FullKeypair = d.FullKeypair
err = m.encodeAndDispatchBackupMessage(ctx, pb, chat.ID)
if err != nil {
return 0, err
}
}
// Update keycards message encode and dispatch
// Update watch only messages encode and dispatch
for i, d := range woAccountsToBackup {
pb := backupDetailsOnly()
pb.KeycardsDetails.DataNumber = 1
pb.Keycards = &keycardsToBackup
pb.WatchOnlyAccountDetails.DataNumber = uint32(i + 1)
pb.WatchOnlyAccount = d.WatchOnlyAccount
err = m.encodeAndDispatchBackupMessage(ctx, pb, chat.ID)
if err != nil {
return 0, err
}
}
chat.LastClockValue = clock
err = m.saveChat(chat)
@ -415,11 +418,45 @@ func (m *Messenger) backupProfile(ctx context.Context, clock uint64) ([]*protobu
return backupMessages, nil
}
func (m *Messenger) backupWalletAccounts() (*protobuf.SyncWalletAccounts, error) {
accounts, err := m.settings.GetAccounts()
func (m *Messenger) backupKeypairs() ([]*protobuf.Backup, error) {
keypairs, err := m.settings.GetKeypairs()
if err != nil {
return nil, err
}
return m.prepareSyncWalletAccountsMessage(accounts), nil
var backupMessages []*protobuf.Backup
for _, kp := range keypairs {
kp.SyncedFrom = accounts.SyncedFromBackup
fullKeypair, err := m.prepareSyncKeypairFullMessage(kp)
if err != nil {
return nil, err
}
backupMessage := &protobuf.Backup{
FullKeypair: fullKeypair,
}
backupMessages = append(backupMessages, backupMessage)
}
return backupMessages, nil
}
func (m *Messenger) backupWatchOnlyAccounts() ([]*protobuf.Backup, error) {
accounts, err := m.settings.GetWatchOnlyAccounts()
if err != nil {
return nil, err
}
var backupMessages []*protobuf.Backup
for _, acc := range accounts {
backupMessage := &protobuf.Backup{}
backupMessage.WatchOnlyAccount = m.prepareSyncAccountMessage(acc)
backupMessages = append(backupMessages, backupMessage)
}
return backupMessages, nil
}

View File

@ -3,6 +3,7 @@ package protocol
import (
"database/sql"
"github.com/status-im/status-go/multiaccounts/accounts"
ensservice "github.com/status-im/status-go/services/ens"
"github.com/status-im/status-go/protocol/identity"
@ -19,7 +20,8 @@ const (
SyncWakuSectionKeyContacts = "contacts"
SyncWakuSectionKeyCommunities = "communities"
SyncWakuSectionKeySettings = "settings"
SyncWakuSectionKeyKeycards = "keycards"
SyncWakuSectionKeyKeypairs = "keypairs"
SyncWakuSectionKeyWatchOnlyAccounts = "watchOnlyAccounts"
)
func (m *Messenger) HandleBackup(state *ReceivedMessageState, message protobuf.Backup) []error {
@ -48,25 +50,28 @@ func (m *Messenger) HandleBackup(state *ReceivedMessageState, message protobuf.B
errors = append(errors, err)
}
err = m.handleBackedUpWalletAccount(message.WalletAccount)
err = m.handleFullKeypair(message.FullKeypair)
if err != nil {
errors = append(errors, err)
}
err = m.handleBackedUpKeycards(message.Keycards)
err = m.handleWatchOnlyAccount(message.WatchOnlyAccount)
if err != nil {
errors = append(errors, err)
}
// Send signal about applied backup progress
if m.config.messengerSignalsHandler != nil {
response := wakusync.WakuBackedUpDataResponse{}
response := wakusync.WakuBackedUpDataResponse{
Clock: message.Clock,
}
response.AddFetchingBackedUpDataDetails(SyncWakuSectionKeyProfile, message.ProfileDetails)
response.AddFetchingBackedUpDataDetails(SyncWakuSectionKeyContacts, message.ContactsDetails)
response.AddFetchingBackedUpDataDetails(SyncWakuSectionKeyCommunities, message.CommunitiesDetails)
response.AddFetchingBackedUpDataDetails(SyncWakuSectionKeySettings, message.SettingsDetails)
response.AddFetchingBackedUpDataDetails(SyncWakuSectionKeyKeycards, message.KeycardsDetails)
response.AddFetchingBackedUpDataDetails(SyncWakuSectionKeyKeypairs, message.FullKeypairDetails)
response.AddFetchingBackedUpDataDetails(SyncWakuSectionKeyWatchOnlyAccounts, message.WatchOnlyAccountDetails)
m.config.messengerSignalsHandler.SendWakuFetchingBackupProgress(&response)
}
@ -196,43 +201,49 @@ func (m *Messenger) handleBackedUpSettings(message *protobuf.SyncSetting) error
return nil
}
func (m *Messenger) handleBackedUpKeycards(message *protobuf.SyncAllKeycards) error {
func (m *Messenger) handleFullKeypair(message *protobuf.SyncKeypairFull) error {
if message == nil {
return nil
}
allKeycards, err := m.syncReceivedKeycards(*message)
keypair, keycards, err := m.handleSyncKeypairFull(message)
if err != nil {
return err
}
if m.config.messengerSignalsHandler != nil {
kpResponse := wakusync.WakuBackedUpDataResponse{
Keypair: keypair.CopyKeypair(),
}
m.config.messengerSignalsHandler.SendWakuBackedUpKeypair(&kpResponse)
kcResponse := wakusync.WakuBackedUpDataResponse{
Keycards: keycards,
}
m.config.messengerSignalsHandler.SendWakuBackedUpKeycards(&kcResponse)
}
return nil
}
func (m *Messenger) handleWatchOnlyAccount(message *protobuf.SyncAccount) error {
if message == nil {
return nil
}
acc, err := m.handleSyncWalletAccount(message, accounts.SyncedFromBackup)
if err != nil {
return err
}
if m.config.messengerSignalsHandler != nil {
response := wakusync.WakuBackedUpDataResponse{
Keycards: allKeycards,
WatchOnlyAccount: acc,
}
m.config.messengerSignalsHandler.SendWakuBackedUpKeycards(&response)
}
return nil
}
func (m *Messenger) handleBackedUpWalletAccount(message *protobuf.SyncWalletAccount) error {
if message == nil {
return nil
}
acc, err := m.handleSyncWalletAccount(message)
if err != nil {
return err
}
if m.config.messengerSignalsHandler != nil {
response := wakusync.WakuBackedUpDataResponse{
WalletAccount: acc,
}
m.config.messengerSignalsHandler.SendWakuBackedUpWalletAccount(&response)
m.config.messengerSignalsHandler.SendWakuBackedUpWatchOnlyAccount(&response)
}
return nil

View File

@ -57,8 +57,9 @@ type MessengerSignalsHandler interface {
SendWakuFetchingBackupProgress(response *wakusync.WakuBackedUpDataResponse)
SendWakuBackedUpProfile(response *wakusync.WakuBackedUpDataResponse)
SendWakuBackedUpSettings(response *wakusync.WakuBackedUpDataResponse)
SendWakuBackedUpWalletAccount(response *wakusync.WakuBackedUpDataResponse)
SendWakuBackedUpKeypair(response *wakusync.WakuBackedUpDataResponse)
SendWakuBackedUpKeycards(response *wakusync.WakuBackedUpDataResponse)
SendWakuBackedUpWatchOnlyAccount(response *wakusync.WakuBackedUpDataResponse)
}
type config struct {

View File

@ -43,6 +43,8 @@ var (
ErrWalletAccountNotSupportedForMobileApp = errors.New("handling account is not supported for mobile app")
ErrTryingToStoreOldWalletAccount = errors.New("trying to store an old wallet account")
ErrSomeFieldsMissingForWalletAccount = errors.New("some fields are missing for wallet account")
ErrTryingToRemoveUnexistingWalletAccount = errors.New("trying to remove an unexisting wallet account")
ErrUnknownKeypairForWalletAccount = errors.New("keypair is not known for the wallet account")
)
// HandleMembershipUpdate updates a Chat instance according to the membership updates.
@ -2871,49 +2873,101 @@ func (m *Messenger) updateUnviewedCounts(chat *Chat, mentionedOrReplied bool) {
chat.UnviewedMentionsCount++
}
}
func mapSyncAccountToAccount(message *protobuf.SyncAccount, accountOperability accounts.AccountOperable) *accounts.Account {
return &accounts.Account{
Address: types.BytesToAddress(message.Address),
KeyUID: message.KeyUid,
PublicKey: types.HexBytes(message.PublicKey),
Path: message.Path,
Name: message.Name,
Color: message.Color,
Emoji: message.Emoji,
Wallet: message.Wallet,
Chat: message.Chat,
Hidden: message.Hidden,
Clock: message.Clock,
Operable: accountOperability,
}
}
func (m *Messenger) handleSyncWalletAccount(message *protobuf.SyncWalletAccount) (*accounts.Account, error) {
func (m *Messenger) resolveAccountOperability(keyUID string, defaultWalletAccount bool, accountReceivedFromRecovering bool) (accounts.AccountOperable, error) {
knownKeycardsForKeyUID, err := m.settings.GetKeycardByKeyUID(keyUID)
if err != nil {
if err == accounts.ErrDbKeypairNotFound {
return accounts.AccountNonOperable, nil
}
return accounts.AccountNonOperable, err
}
keypairMigratedToKeycard := len(knownKeycardsForKeyUID) > 0
accountsOperability := accounts.AccountNonOperable
if keypairMigratedToKeycard || accountReceivedFromRecovering || defaultWalletAccount {
accountsOperability = accounts.AccountFullyOperable
} else {
partiallyOrFullyOperable, err := m.settings.IsAnyAccountPartalyOrFullyOperableForKeyUID(keyUID)
if err != nil {
if err == accounts.ErrDbKeypairNotFound {
return accounts.AccountNonOperable, nil
}
return accounts.AccountNonOperable, err
}
if partiallyOrFullyOperable {
accountsOperability = accounts.AccountPartiallyOperable
}
}
return accountsOperability, nil
}
func (m *Messenger) handleSyncWalletAccount(message *protobuf.SyncAccount, syncedFrom string) (*accounts.Account, error) {
if message.Chat {
return nil, ErrNotWalletAccount
}
accAddress := types.BytesToAddress(message.Address)
dbAccount, err := m.settings.GetAccountByAddress(accAddress)
if err != nil && err != sql.ErrNoRows {
accountOperability := accounts.AccountFullyOperable
// The only account without `KeyUid` is watch only account and it doesn't belong to any keypair.
if message.KeyUid != "" {
_, err := m.settings.GetKeypairByKeyUID(message.KeyUid)
if err != nil {
if err == accounts.ErrDbKeypairNotFound {
return nil, ErrUnknownKeypairForWalletAccount
}
return nil, err
}
if dbAccount != nil && message.Clock <= dbAccount.Clock {
accountReceivedFromRecovering := syncedFrom == accounts.SyncedFromLocalPairing
accountOperability, err = m.resolveAccountOperability(message.KeyUid, message.Wallet, accountReceivedFromRecovering)
if err != nil {
return nil, err
}
}
accAddress := types.BytesToAddress(message.Address)
dbAccount, err := m.settings.GetAccountByAddress(accAddress)
if err != nil && err != accounts.ErrDbAccountNotFound {
return nil, err
}
if dbAccount != nil {
if message.Clock <= dbAccount.Clock {
return nil, ErrTryingToStoreOldWalletAccount
}
var acc *accounts.Account
if dbAccount != nil && message.Removed {
acc = &accounts.Account{
Address: types.BytesToAddress(message.Address),
Removed: true,
if message.Removed {
err = m.settings.DeleteAccount(accAddress)
dbAccount.Removed = true
return dbAccount, err
}
} else if !message.Removed {
acc = &accounts.Account{
Address: types.BytesToAddress(message.Address),
Wallet: message.Wallet,
Chat: message.Chat,
Type: accounts.AccountType(message.Type),
Storage: message.Storage,
PublicKey: types.HexBytes(message.PublicKey),
Path: message.Path,
Color: message.Color,
Hidden: message.Hidden,
Name: message.Name,
Clock: message.Clock,
KeyUID: message.KeyUid,
Emoji: message.Emoji,
DerivedFrom: message.DerivedFrom,
KeypairName: message.KeypairName,
LastUsedDerivationIndex: message.LastUsedDerivationIndex,
} else {
if message.Removed {
return nil, ErrTryingToRemoveUnexistingWalletAccount
}
}
err = m.settings.SaveAccounts([]*accounts.Account{acc})
acc := mapSyncAccountToAccount(message, accountOperability)
err = m.settings.SaveOrUpdateAccounts([]*accounts.Account{acc})
if err != nil {
return nil, err
}
@ -2921,24 +2975,132 @@ func (m *Messenger) handleSyncWalletAccount(message *protobuf.SyncWalletAccount)
return acc, nil
}
func (m *Messenger) HandleSyncWalletAccount(state *ReceivedMessageState, message protobuf.SyncWalletAccounts) error {
var accs []*accounts.Account
for _, accMsg := range message.Accounts {
acc, err := m.handleSyncWalletAccount(accMsg)
func (m *Messenger) handleSyncKeypair(message *protobuf.SyncKeypair) (*accounts.Keypair, error) {
dbKeypair, err := m.settings.GetKeypairByKeyUID(message.KeyUid)
if err != nil && err != accounts.ErrDbKeypairNotFound {
return nil, err
}
kp := &accounts.Keypair{
KeyUID: message.KeyUid,
Name: message.Name,
Type: accounts.KeypairType(message.Type),
DerivedFrom: message.DerivedFrom,
LastUsedDerivationIndex: message.LastUsedDerivationIndex,
SyncedFrom: message.SyncedFrom,
Clock: message.Clock,
}
saveOrUpdate := dbKeypair == nil
if dbKeypair != nil {
saveOrUpdate = dbKeypair.Clock < kp.Clock
// in case of keypair update, we need to keep `synced_from` field as it was when keypair was introduced to this device for the first time
kp.SyncedFrom = dbKeypair.SyncedFrom
}
if saveOrUpdate {
accountReceivedFromRecovering := message.SyncedFrom == accounts.SyncedFromLocalPairing
if dbKeypair != nil && message.SyncedFrom == accounts.SyncedFromBackup {
// in case of recovering from backed up messages we need to delete messages which are already in db (eg. stored py previously received backed up message)
for _, dbAcc := range dbKeypair.Accounts {
found := false
for _, sAcc := range message.Accounts {
sAccAddress := types.BytesToAddress(sAcc.Address)
if dbAcc.Address == sAccAddress {
found = true
break
}
}
if found {
err = m.settings.DeleteAccount(dbAcc.Address)
if err != nil {
return nil, err
}
}
}
}
for _, sAcc := range message.Accounts {
accountOperability, err := m.resolveAccountOperability(sAcc.KeyUid, sAcc.Wallet, accountReceivedFromRecovering)
if err != nil {
return nil, err
}
acc := mapSyncAccountToAccount(sAcc, accountOperability)
kp.Accounts = append(kp.Accounts, acc)
}
err = m.settings.SaveOrUpdateKeypair(kp)
if err != nil {
return nil, err
}
}
for _, sAcc := range message.Accounts {
acc, err := m.handleSyncWalletAccount(sAcc, message.SyncedFrom)
if err != nil {
if err == ErrNotWalletAccount ||
err == ErrWalletAccountNotSupportedForMobileApp ||
err == ErrTryingToStoreOldWalletAccount ||
err == ErrSomeFieldsMissingForWalletAccount {
err == ErrTryingToRemoveUnexistingWalletAccount {
continue
}
return nil, err
}
kp.Accounts = append(kp.Accounts, acc)
}
return kp, nil
}
func (m *Messenger) handleSyncKeypairFull(message *protobuf.SyncKeypairFull) (kp *accounts.Keypair, keycards []*accounts.Keycard, err error) {
kp, err = m.handleSyncKeypair(message.Keypair)
if err != nil {
return nil, nil, err
}
for _, sKc := range message.Keycards {
kc := accounts.Keycard{}
kc.FromSyncKeycard(sKc)
keycards = append(keycards, &kc)
}
err = m.settings.ApplyKeycardsForKeypairWithKeyUID(kp.KeyUID, keycards)
if err != nil {
return kp, keycards, err
}
return
}
func (m *Messenger) HandleSyncWalletAccount(state *ReceivedMessageState, message protobuf.SyncAccount, syncedFrom string) error {
acc, err := m.handleSyncWalletAccount(&message, syncedFrom)
if err != nil {
return err
}
accs = append(accs, acc)
state.Response.Accounts = append(state.Response.Accounts, acc)
return nil
}
func (m *Messenger) HandleSyncKeypair(state *ReceivedMessageState, message protobuf.SyncKeypair) error {
kp, err := m.handleSyncKeypair(&message)
if err != nil {
return err
}
state.Response.Accounts = accs
state.Response.Keypairs = append(state.Response.Keypairs, kp)
return nil
}
func (m *Messenger) HandleSyncKeypairFull(state *ReceivedMessageState, message protobuf.SyncKeypairFull) error {
keypair, keycards, err := m.handleSyncKeypairFull(&message)
if err != nil {
return err
}
state.Response.Keypairs = append(state.Response.Keypairs, keypair)
state.Response.Keycards = append(state.Response.Keycards, keycards...)
return nil
}

View File

@ -6,101 +6,28 @@ import (
"github.com/golang/protobuf/proto"
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/multiaccounts/keycards"
"github.com/status-im/status-go/multiaccounts/accounts"
"github.com/status-im/status-go/protocol/common"
"github.com/status-im/status-go/protocol/protobuf"
)
func (m *Messenger) dispatchSyncKeycard(ctx context.Context, chatID string, syncKeycard protobuf.SyncAllKeycards,
rawMessageHandler RawMessageHandler) error {
if !m.hasPairedDevices() {
return nil
}
encodedMessage, err := proto.Marshal(&syncKeycard)
if err != nil {
return err
}
rawMessage := common.RawMessage{
LocalChatID: chatID,
Payload: encodedMessage,
MessageType: protobuf.ApplicationMetadataMessage_SYNC_ALL_KEYCARDS,
ResendAutomatically: true,
}
_, err = rawMessageHandler(ctx, rawMessage)
return err
}
func (m *Messenger) prepareSyncAllKeycardsMessage(clock uint64) (message protobuf.SyncAllKeycards, err error) {
func (m *Messenger) prepareSyncKeycardsMessage(keyUID string) (message []*protobuf.SyncKeycard, err error) {
allKeycards, err := m.settings.GetAllKnownKeycards()
if err != nil {
return message, err
}
message.Clock = clock
for _, kc := range allKeycards {
syncKeycard := kc.ToSyncKeycard()
if syncKeycard.Clock == 0 {
syncKeycard.Clock = clock
if kc.KeyUID != keyUID {
continue
}
message.Keycards = append(message.Keycards, syncKeycard)
syncKeycard := kc.ToSyncKeycard()
message = append(message, syncKeycard)
}
return
}
func (m *Messenger) syncAllKeycards(ctx context.Context, rawMessageHandler RawMessageHandler) (err error) {
clock, chat := m.getLastClockWithRelatedChat()
message, err := m.prepareSyncAllKeycardsMessage(clock)
if err != nil {
return err
}
err = m.dispatchSyncKeycard(ctx, chat.ID, message, rawMessageHandler)
if err != nil {
return err
}
chat.LastClockValue = clock
return m.saveChat(chat)
}
func (m *Messenger) syncReceivedKeycards(syncMessage protobuf.SyncAllKeycards) ([]*keycards.Keycard, error) {
var keycardsToSync []*keycards.Keycard
for _, syncKc := range syncMessage.Keycards {
var kp = &keycards.Keycard{}
kp.FromSyncKeycard(syncKc)
keycardsToSync = append(keycardsToSync, kp)
}
err := m.settings.SyncKeycards(syncMessage.Clock, keycardsToSync)
if err != nil {
return nil, err
}
allKeycards, err := m.settings.GetAllKnownKeycards()
if err != nil {
return nil, err
}
return allKeycards, nil
}
func (m *Messenger) handleSyncKeycards(state *ReceivedMessageState, syncMessage protobuf.SyncAllKeycards) (err error) {
allKeycards, err := m.syncReceivedKeycards(syncMessage)
if err != nil {
return err
}
state.Response.AddAllKnownKeycards(allKeycards)
return nil
}
func (m *Messenger) dispatchKeycardActivity(ctx context.Context, syncMessage protobuf.SyncKeycardAction) error {
if !m.hasPairedDevices() {
return nil
@ -131,10 +58,10 @@ func (m *Messenger) dispatchKeycardActivity(ctx context.Context, syncMessage pro
func (m *Messenger) handleSyncKeycardActivity(state *ReceivedMessageState, syncMessage protobuf.SyncKeycardAction) (err error) {
var kcAction = &keycards.KeycardAction{
var kcAction = &accounts.KeycardAction{
Action: protobuf.SyncKeycardAction_Action_name[int32(syncMessage.Action)],
OldKeycardUID: syncMessage.OldKeycardUid,
Keycard: &keycards.Keycard{},
Keycard: &accounts.Keycard{},
}
kcAction.Keycard.FromSyncKeycard(syncMessage.Keycard)
@ -170,7 +97,7 @@ func (m *Messenger) handleSyncKeycardActivity(state *ReceivedMessageState, syncM
return nil
}
func (m *Messenger) AddKeycardOrAddAccountsIfKeycardIsAdded(ctx context.Context, kp *keycards.Keycard) (added bool, err error) {
func (m *Messenger) AddKeycardOrAddAccountsIfKeycardIsAdded(ctx context.Context, kp *accounts.Keycard) (added bool, err error) {
addedKc, addedAccs, err := m.settings.AddKeycardOrAddAccountsIfKeycardIsAdded(*kp)
if err != nil {
return addedKc || addedAccs, err

View File

@ -13,7 +13,6 @@ import (
"github.com/status-im/status-go/appmetrics"
"github.com/status-im/status-go/images"
"github.com/status-im/status-go/multiaccounts/accounts"
"github.com/status-im/status-go/multiaccounts/keycards"
"github.com/status-im/status-go/multiaccounts/settings"
"github.com/status-im/status-go/protocol/common"
"github.com/status-im/status-go/protocol/communities"
@ -48,6 +47,7 @@ type MessengerResponse struct {
Settings []*settings.SyncSettingField
IdentityImages []images.IdentityImage
Accounts []*accounts.Account
Keypairs []*accounts.Keypair
DiscordCategories []*discord.Category
DiscordChannels []*discord.Channel
DiscordOldestMessageTimestamp int
@ -75,8 +75,8 @@ type MessengerResponse struct {
trustStatus map[string]verification.TrustStatus
emojiReactions map[string]*EmojiReaction
savedAddresses map[string]*wallet.SavedAddress
keycards []*keycards.Keycard
keycardActions []*keycards.KeycardAction
Keycards []*accounts.Keycard
keycardActions []*accounts.KeycardAction
socialLinkSettings []*identity.SocialLink
ensUsernameDetails []*ensservice.UsernameDetail
}
@ -111,14 +111,15 @@ func (r *MessengerResponse) MarshalJSON() ([]byte, error) {
Settings []*settings.SyncSettingField `json:"settings,omitempty"`
IdentityImages []images.IdentityImage `json:"identityImages,omitempty"`
Accounts []*accounts.Account `json:"accounts,omitempty"`
Keypairs []*accounts.Keypair `json:"keypairs,omitempty"`
DiscordCategories []*discord.Category `json:"discordCategories,omitempty"`
DiscordChannels []*discord.Channel `json:"discordChannels,omitempty"`
DiscordOldestMessageTimestamp int `json:"discordOldestMessageTimestamp"`
DiscordMessages []*protobuf.DiscordMessage `json:"discordMessages,omitempty"`
DiscordMessageAttachments []*protobuf.DiscordMessageAttachment `json:"discordMessageAtachments,omitempty"`
SavedAddresses []*wallet.SavedAddress `json:"savedAddresses,omitempty"`
Keycards []*keycards.Keycard `json:"keycards,omitempty"`
KeycardActions []*keycards.KeycardAction `json:"keycardActions,omitempty"`
Keycards []*accounts.Keycard `json:"keycards,omitempty"`
KeycardActions []*accounts.KeycardAction `json:"keycardActions,omitempty"`
SocialLinkSettings []*identity.SocialLink `json:"socialLinkSettings,omitempty"`
EnsUsernameDetails []*ensservice.UsernameDetail `json:"ensUsernameDetails,omitempty"`
}{
@ -133,6 +134,7 @@ func (r *MessengerResponse) MarshalJSON() ([]byte, error) {
Settings: r.Settings,
IdentityImages: r.IdentityImages,
Accounts: r.Accounts,
Keypairs: r.Keypairs,
Messages: r.Messages(),
VerificationRequests: r.VerificationRequests(),
@ -152,7 +154,7 @@ func (r *MessengerResponse) MarshalJSON() ([]byte, error) {
DiscordCategories: r.DiscordCategories,
DiscordChannels: r.DiscordChannels,
DiscordOldestMessageTimestamp: r.DiscordOldestMessageTimestamp,
Keycards: r.AllKnownKeycards(),
Keycards: r.Keycards,
KeycardActions: r.KeycardActions(),
SocialLinkSettings: r.SocialLinkSettings(),
EnsUsernameDetails: r.EnsUsernameDetails(),
@ -273,6 +275,7 @@ func (r *MessengerResponse) IsEmpty() bool {
len(r.Mailservers)+
len(r.IdentityImages)+
len(r.Accounts)+
len(r.Keypairs)+
len(r.notifications)+
len(r.statusUpdates)+
len(r.activityCenterNotifications)+
@ -280,7 +283,7 @@ func (r *MessengerResponse) IsEmpty() bool {
len(r.verificationRequests)+
len(r.RequestsToJoinCommunity)+
len(r.savedAddresses)+
len(r.keycards)+
len(r.Keycards)+
len(r.keycardActions) == 0 &&
len(r.socialLinkSettings) == 0 &&
len(r.ensUsernameDetails) == 0 &&
@ -315,13 +318,15 @@ func (r *MessengerResponse) Merge(response *MessengerResponse) error {
r.AddEmojiReactions(response.EmojiReactions())
r.AddInstallations(response.Installations)
r.AddSavedAddresses(response.SavedAddresses())
r.AddAllKnownKeycards(response.AllKnownKeycards())
r.AddKeycardActions(response.KeycardActions())
r.AddSocialLinkSettings(response.SocialLinkSettings())
r.AddEnsUsernameDetails(response.EnsUsernameDetails())
r.AddBookmarks(response.GetBookmarks())
r.CommunityChanges = append(r.CommunityChanges, response.CommunityChanges...)
r.BackupHandled = response.BackupHandled
r.Accounts = append(r.Accounts, response.Accounts...)
r.Keypairs = append(r.Keypairs, response.Keypairs...)
r.Keycards = append(r.Keycards, response.Keycards...)
return nil
}
@ -460,23 +465,15 @@ func (r *MessengerResponse) SavedAddresses() []*wallet.SavedAddress {
return ers
}
func (r *MessengerResponse) AddAllKnownKeycards(keycards []*keycards.Keycard) {
r.keycards = append(r.keycards, keycards...)
}
func (r *MessengerResponse) AllKnownKeycards() []*keycards.Keycard {
return r.keycards
}
func (r *MessengerResponse) AddKeycardAction(keycardAction *keycards.KeycardAction) {
func (r *MessengerResponse) AddKeycardAction(keycardAction *accounts.KeycardAction) {
r.keycardActions = append(r.keycardActions, keycardAction)
}
func (r *MessengerResponse) AddKeycardActions(keycardActions []*keycards.KeycardAction) {
func (r *MessengerResponse) AddKeycardActions(keycardActions []*accounts.KeycardAction) {
r.keycardActions = append(r.keycardActions, keycardActions...)
}
func (r *MessengerResponse) KeycardActions() []*keycards.KeycardAction {
func (r *MessengerResponse) KeycardActions() []*accounts.KeycardAction {
return r.keycardActions
}

View File

@ -7,6 +7,7 @@ import (
"github.com/golang/protobuf/proto"
"go.uber.org/zap"
"github.com/status-im/status-go/multiaccounts/accounts"
"github.com/status-im/status-go/protocol/common"
"github.com/status-im/status-go/protocol/encryption/multidevice"
"github.com/status-im/status-go/protocol/protobuf"
@ -192,17 +193,28 @@ func (m *Messenger) HandleSyncRawMessages(rawMessages []*protobuf.RawMessage) er
m.logger.Error("failed to HandleSyncContactRequestDecision when HandleSyncRawMessages", zap.Error(err))
continue
}
case protobuf.ApplicationMetadataMessage_SYNC_WALLET_ACCOUNT:
var message protobuf.SyncWalletAccounts
case protobuf.ApplicationMetadataMessage_SYNC_ACCOUNT:
var message protobuf.SyncAccount
err := proto.Unmarshal(rawMessage.GetPayload(), &message)
if err != nil {
return err
}
err = m.HandleSyncWalletAccount(state, message)
err = m.HandleSyncWalletAccount(state, message, accounts.SyncedFromLocalPairing)
if err != nil {
m.logger.Error("failed to HandleSyncWalletAccount when HandleSyncRawMessages", zap.Error(err))
continue
}
case protobuf.ApplicationMetadataMessage_SYNC_FULL_KEYPAIR:
var message protobuf.SyncKeypairFull
err := proto.Unmarshal(rawMessage.GetPayload(), &message)
if err != nil {
return err
}
err = m.HandleSyncKeypairFull(state, message)
if err != nil {
m.logger.Error("failed to HandleSyncKeypairFull when HandleSyncRawMessages", zap.Error(err))
continue
}
case protobuf.ApplicationMetadataMessage_SYNC_SAVED_ADDRESS:
var message protobuf.SyncSavedAddress
err := proto.Unmarshal(rawMessage.GetPayload(), &message)
@ -214,17 +226,6 @@ func (m *Messenger) HandleSyncRawMessages(rawMessages []*protobuf.RawMessage) er
m.logger.Error("failed to handleSyncSavedAddress when HandleSyncRawMessages", zap.Error(err))
continue
}
case protobuf.ApplicationMetadataMessage_SYNC_ALL_KEYCARDS:
var message protobuf.SyncAllKeycards
err := proto.Unmarshal(rawMessage.GetPayload(), &message)
if err != nil {
return err
}
err = m.handleSyncKeycards(state, message)
if err != nil {
m.logger.Error("failed to handleSyncKeycards when HandleSyncRawMessages", zap.Error(err))
continue
}
case protobuf.ApplicationMetadataMessage_SYNC_SOCIAL_LINK_SETTING:
var message protobuf.SyncSocialLinkSetting
err := proto.Unmarshal(rawMessage.GetPayload(), &message)

View File

@ -2,6 +2,7 @@ package protocol
import (
"context"
"errors"
"time"
"github.com/golang/protobuf/proto"
@ -11,6 +12,7 @@ import (
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/multiaccounts/accounts"
"github.com/status-im/status-go/protocol/common"
"github.com/status-im/status-go/protocol/encryption/multidevice"
"github.com/status-im/status-go/protocol/protobuf"
)
@ -71,15 +73,30 @@ func (m *Messenger) watchWalletBalances() {
}()
}
func (m *Messenger) SaveAccount(acc *accounts.Account) error {
func (m *Messenger) SaveOrUpdateKeypair(keypair *accounts.Keypair) error {
clock, _ := m.getLastClockWithRelatedChat()
acc.Clock = clock
keypair.Clock = clock
err := m.settings.SaveAccounts([]*accounts.Account{acc})
for _, acc := range keypair.Accounts {
acc.Clock = clock
}
err := m.settings.SaveOrUpdateKeypair(keypair)
if err != nil {
return err
}
return m.syncWallets([]*accounts.Account{acc}, m.dispatchMessage)
return m.syncKeypair(keypair, false, m.dispatchMessage)
}
func (m *Messenger) SaveOrUpdateAccount(acc *accounts.Account) error {
clock, _ := m.getLastClockWithRelatedChat()
acc.Clock = clock
err := m.settings.SaveOrUpdateAccounts([]*accounts.Account{acc})
if err != nil {
return err
}
return m.syncWalletAccount(acc, m.dispatchMessage)
}
func (m *Messenger) DeleteAccount(address types.Address) error {
@ -98,8 +115,7 @@ func (m *Messenger) DeleteAccount(address types.Address) error {
acc.Clock = clock
acc.Removed = true
accs := []*accounts.Account{acc}
err = m.syncWallets(accs, m.dispatchMessage)
err = m.syncWalletAccount(acc, m.dispatchMessage)
if err != nil {
return err
}
@ -108,43 +124,89 @@ func (m *Messenger) DeleteAccount(address types.Address) error {
return m.saveChat(chat)
}
func (m *Messenger) prepareSyncWalletAccountsMessage(accs []*accounts.Account) *protobuf.SyncWalletAccounts {
accountMessages := make([]*protobuf.SyncWalletAccount, 0)
for _, acc := range accs {
func (m *Messenger) prepareSyncAccountMessage(acc *accounts.Account) *protobuf.SyncAccount {
if acc.Chat {
continue
return nil
}
syncMessage := &protobuf.SyncWalletAccount{
return &protobuf.SyncAccount{
Clock: acc.Clock,
Address: acc.Address.Bytes(),
Wallet: acc.Wallet,
Chat: acc.Chat,
Type: acc.Type.String(),
Storage: acc.Storage,
Path: acc.Path,
KeyUid: acc.KeyUID,
PublicKey: acc.PublicKey,
Path: acc.Path,
Name: acc.Name,
Color: acc.Color,
Emoji: acc.Emoji,
Wallet: acc.Wallet,
Chat: acc.Chat,
Hidden: acc.Hidden,
Removed: acc.Removed,
Emoji: acc.Emoji,
DerivedFrom: acc.DerivedFrom,
KeyUid: acc.KeyUID,
KeypairName: acc.KeypairName,
LastUsedDerivationIndex: acc.LastUsedDerivationIndex,
}
accountMessages = append(accountMessages, syncMessage)
}
return &protobuf.SyncWalletAccounts{
Accounts: accountMessages,
}
}
// syncWallets syncs all wallets with paired devices
func (m *Messenger) syncWallets(accs []*accounts.Account, rawMessageHandler RawMessageHandler) error {
func (m *Messenger) getMyInstallationMetadata() (*multidevice.InstallationMetadata, error) {
installation, ok := m.allInstallations.Load(m.installationID)
if !ok {
return nil, errors.New("no installation found")
}
if installation.InstallationMetadata == nil {
return nil, errors.New("no installation metadata")
}
return installation.InstallationMetadata, nil
}
func (m *Messenger) prepareSyncKeypairMessage(kp *accounts.Keypair) (*protobuf.SyncKeypair, error) {
message := &protobuf.SyncKeypair{
Clock: kp.Clock,
KeyUid: kp.KeyUID,
Name: kp.Name,
Type: kp.Type.String(),
DerivedFrom: kp.DerivedFrom,
LastUsedDerivationIndex: kp.LastUsedDerivationIndex,
SyncedFrom: kp.SyncedFrom,
}
if kp.SyncedFrom == "" {
installationMetadata, err := m.getMyInstallationMetadata()
if err != nil {
return nil, err
}
message.SyncedFrom = installationMetadata.Name
}
for _, acc := range kp.Accounts {
sAcc := m.prepareSyncAccountMessage(acc)
if sAcc == nil {
continue
}
message.Accounts = append(message.Accounts, sAcc)
}
return message, nil
}
func (m *Messenger) prepareSyncKeypairFullMessage(kp *accounts.Keypair) (*protobuf.SyncKeypairFull, error) {
syncKpMsg, err := m.prepareSyncKeypairMessage(kp)
if err != nil {
return nil, err
}
syncKcMsgs, err := m.prepareSyncKeycardsMessage(kp.KeyUID)
if err != nil {
return nil, err
}
return &protobuf.SyncKeypairFull{
Keypair: syncKpMsg,
Keycards: syncKcMsgs,
}, nil
}
func (m *Messenger) syncWalletAccount(acc *accounts.Account, rawMessageHandler RawMessageHandler) error {
if !m.hasPairedDevices() {
return nil
}
@ -154,7 +216,7 @@ func (m *Messenger) syncWallets(accs []*accounts.Account, rawMessageHandler RawM
_, chat := m.getLastClockWithRelatedChat()
message := m.prepareSyncWalletAccountsMessage(accs)
message := m.prepareSyncAccountMessage(acc)
encodedMessage, err := proto.Marshal(message)
if err != nil {
@ -164,10 +226,52 @@ func (m *Messenger) syncWallets(accs []*accounts.Account, rawMessageHandler RawM
rawMessage := common.RawMessage{
LocalChatID: chat.ID,
Payload: encodedMessage,
MessageType: protobuf.ApplicationMetadataMessage_SYNC_WALLET_ACCOUNT,
MessageType: protobuf.ApplicationMetadataMessage_SYNC_ACCOUNT,
ResendAutomatically: true,
}
_, err = rawMessageHandler(ctx, rawMessage)
return err
}
func (m *Messenger) syncKeypair(keypair *accounts.Keypair, fullKeypairSync bool, rawMessageHandler RawMessageHandler) (err error) {
if !m.hasPairedDevices() {
return nil
}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
_, chat := m.getLastClockWithRelatedChat()
rawMessage := common.RawMessage{
LocalChatID: chat.ID,
ResendAutomatically: true,
}
if fullKeypairSync {
message, err := m.prepareSyncKeypairFullMessage(keypair)
if err != nil {
return err
}
rawMessage.MessageType = protobuf.ApplicationMetadataMessage_SYNC_FULL_KEYPAIR
rawMessage.Payload, err = proto.Marshal(message)
if err != nil {
return err
}
} else {
message, err := m.prepareSyncKeypairMessage(keypair)
if err != nil {
return err
}
rawMessage.MessageType = protobuf.ApplicationMetadataMessage_SYNC_KEYPAIR
rawMessage.Payload, err = proto.Marshal(message)
if err != nil {
return err
}
}
_, err = rawMessageHandler(ctx, rawMessage)
return err
}

View File

@ -68,7 +68,7 @@ const (
ApplicationMetadataMessage_SYNC_SETTING ApplicationMetadataMessage_Type = 42
ApplicationMetadataMessage_COMMUNITY_ARCHIVE_MAGNETLINK ApplicationMetadataMessage_Type = 43
ApplicationMetadataMessage_SYNC_PROFILE_PICTURE ApplicationMetadataMessage_Type = 44
ApplicationMetadataMessage_SYNC_WALLET_ACCOUNT ApplicationMetadataMessage_Type = 45
ApplicationMetadataMessage_SYNC_ACCOUNT ApplicationMetadataMessage_Type = 45
ApplicationMetadataMessage_ACCEPT_CONTACT_REQUEST ApplicationMetadataMessage_Type = 46
ApplicationMetadataMessage_RETRACT_CONTACT_REQUEST ApplicationMetadataMessage_Type = 47
ApplicationMetadataMessage_COMMUNITY_REQUEST_TO_JOIN_RESPONSE ApplicationMetadataMessage_Type = 48
@ -84,10 +84,11 @@ const (
ApplicationMetadataMessage_SYNC_SAVED_ADDRESS ApplicationMetadataMessage_Type = 59
ApplicationMetadataMessage_COMMUNITY_CANCEL_REQUEST_TO_JOIN ApplicationMetadataMessage_Type = 60
ApplicationMetadataMessage_CANCEL_CONTACT_VERIFICATION ApplicationMetadataMessage_Type = 61
ApplicationMetadataMessage_SYNC_ALL_KEYCARDS ApplicationMetadataMessage_Type = 62
ApplicationMetadataMessage_SYNC_KEYPAIR ApplicationMetadataMessage_Type = 62
ApplicationMetadataMessage_SYNC_KEYCARD_ACTION ApplicationMetadataMessage_Type = 63
ApplicationMetadataMessage_SYNC_SOCIAL_LINK_SETTING ApplicationMetadataMessage_Type = 64
ApplicationMetadataMessage_SYNC_ENS_USERNAME_DETAIL ApplicationMetadataMessage_Type = 65
ApplicationMetadataMessage_SYNC_FULL_KEYPAIR ApplicationMetadataMessage_Type = 66
)
var ApplicationMetadataMessage_Type_name = map[int32]string{
@ -136,7 +137,7 @@ var ApplicationMetadataMessage_Type_name = map[int32]string{
42: "SYNC_SETTING",
43: "COMMUNITY_ARCHIVE_MAGNETLINK",
44: "SYNC_PROFILE_PICTURE",
45: "SYNC_WALLET_ACCOUNT",
45: "SYNC_ACCOUNT",
46: "ACCEPT_CONTACT_REQUEST",
47: "RETRACT_CONTACT_REQUEST",
48: "COMMUNITY_REQUEST_TO_JOIN_RESPONSE",
@ -152,10 +153,11 @@ var ApplicationMetadataMessage_Type_name = map[int32]string{
59: "SYNC_SAVED_ADDRESS",
60: "COMMUNITY_CANCEL_REQUEST_TO_JOIN",
61: "CANCEL_CONTACT_VERIFICATION",
62: "SYNC_ALL_KEYCARDS",
62: "SYNC_KEYPAIR",
63: "SYNC_KEYCARD_ACTION",
64: "SYNC_SOCIAL_LINK_SETTING",
65: "SYNC_ENS_USERNAME_DETAIL",
66: "SYNC_FULL_KEYPAIR",
}
var ApplicationMetadataMessage_Type_value = map[string]int32{
@ -204,7 +206,7 @@ var ApplicationMetadataMessage_Type_value = map[string]int32{
"SYNC_SETTING": 42,
"COMMUNITY_ARCHIVE_MAGNETLINK": 43,
"SYNC_PROFILE_PICTURE": 44,
"SYNC_WALLET_ACCOUNT": 45,
"SYNC_ACCOUNT": 45,
"ACCEPT_CONTACT_REQUEST": 46,
"RETRACT_CONTACT_REQUEST": 47,
"COMMUNITY_REQUEST_TO_JOIN_RESPONSE": 48,
@ -220,10 +222,11 @@ var ApplicationMetadataMessage_Type_value = map[string]int32{
"SYNC_SAVED_ADDRESS": 59,
"COMMUNITY_CANCEL_REQUEST_TO_JOIN": 60,
"CANCEL_CONTACT_VERIFICATION": 61,
"SYNC_ALL_KEYCARDS": 62,
"SYNC_KEYPAIR": 62,
"SYNC_KEYCARD_ACTION": 63,
"SYNC_SOCIAL_LINK_SETTING": 64,
"SYNC_ENS_USERNAME_DETAIL": 65,
"SYNC_FULL_KEYPAIR": 66,
}
func (x ApplicationMetadataMessage_Type) String() string {
@ -302,65 +305,65 @@ func init() {
}
var fileDescriptor_ad09a6406fcf24c7 = []byte{
// 957 bytes of a gzipped FileDescriptorProto
// 959 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0x6b, 0x73, 0x13, 0x37,
0x14, 0x6d, 0x80, 0x26, 0xa0, 0xbc, 0x14, 0x91, 0x87, 0xf3, 0x36, 0x86, 0x86, 0x00, 0xad, 0x69,
0xa1, 0xed, 0xb4, 0xa5, 0xb4, 0x95, 0xa5, 0x1b, 0x5b, 0x78, 0x57, 0x5a, 0x24, 0xad, 0x19,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 0x00, 0x00, 0xff, 0xff, 0xef, 0xbf, 0x60, 0xd4, 0x2d, 0x08, 0x00, 0x00,
}

View File

@ -58,7 +58,7 @@ message ApplicationMetadataMessage {
SYNC_SETTING = 42;
COMMUNITY_ARCHIVE_MAGNETLINK = 43;
SYNC_PROFILE_PICTURE = 44;
SYNC_WALLET_ACCOUNT = 45;
SYNC_ACCOUNT = 45;
ACCEPT_CONTACT_REQUEST = 46;
RETRACT_CONTACT_REQUEST = 47;
COMMUNITY_REQUEST_TO_JOIN_RESPONSE = 48;
@ -74,9 +74,10 @@ message ApplicationMetadataMessage {
SYNC_SAVED_ADDRESS = 59;
COMMUNITY_CANCEL_REQUEST_TO_JOIN = 60;
CANCEL_CONTACT_VERIFICATION = 61;
SYNC_ALL_KEYCARDS = 62;
SYNC_KEYPAIR = 62;
SYNC_KEYCARD_ACTION = 63;
SYNC_SOCIAL_LINK_SETTING = 64;
SYNC_ENS_USERNAME_DETAIL = 65;
SYNC_FULL_KEYPAIR = 66;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -26,10 +26,10 @@ message Backup {
FetchingBackedUpDataDetails profileDetails = 8;
SyncSetting setting = 9;
FetchingBackedUpDataDetails settingsDetails = 10;
SyncAllKeycards keycards = 11;
FetchingBackedUpDataDetails keycardsDetails = 12;
SyncWalletAccount walletAccount = 13;
FetchingBackedUpDataDetails walletAccountsDetails = 14;
SyncKeypairFull fullKeypair = 11;
FetchingBackedUpDataDetails fullKeypairDetails = 12;
SyncAccount watchOnlyAccount = 13;
FetchingBackedUpDataDetails watchOnlyAccountDetails = 14;
}
message MultiAccount {
@ -224,28 +224,35 @@ message SyncProfilePictures {
repeated SyncProfilePicture pictures = 2;
}
message SyncWalletAccount {
message SyncAccount {
uint64 clock = 1;
bytes address = 2;
bool wallet = 3;
bool chat = 4;
string type = 5;
string storage = 6;
string path = 7;
bytes publicKey = 8;
string name = 9;
string color = 10;
string key_uid = 3;
bytes public_key = 4;
string path = 5;
string name = 6;
string color = 7;
string emoji = 8;
bool wallet = 9;
bool chat = 10;
bool hidden = 11;
bool removed = 12;
string emoji = 13;
string derived_from = 14;
string key_uid = 15;
string keypair_name = 16;
uint64 last_used_derivation_index = 17;
}
message SyncWalletAccounts {
repeated SyncWalletAccount accounts = 1;
message SyncKeypair {
uint64 clock = 1;
string key_uid = 2;
string name = 3;
string type = 4;
string derived_from = 5;
uint64 last_used_derivation_index = 6;
string synced_from = 7;
repeated SyncAccount accounts = 8;
}
message SyncKeypairFull {
SyncKeypair keypair = 1;
repeated SyncKeycard keycards = 2;
}
message SyncSavedAddress {
@ -358,11 +365,6 @@ message SyncKeycardAction {
}
}
message SyncAllKeycards {
repeated SyncKeycard keycards = 1;
uint64 clock = 2;
}
message SyncSocialLinkSetting {
string text = 1;
string url = 2;

View File

@ -294,8 +294,8 @@ func (m *StatusMessage) HandleApplication() error {
return m.unmarshalProtobufData(new(protobuf.SyncSetting))
case protobuf.ApplicationMetadataMessage_COMMUNITY_ARCHIVE_MAGNETLINK:
return m.unmarshalProtobufData(new(protobuf.CommunityMessageArchiveMagnetlink))
case protobuf.ApplicationMetadataMessage_SYNC_WALLET_ACCOUNT:
return m.unmarshalProtobufData(new(protobuf.SyncWalletAccounts))
case protobuf.ApplicationMetadataMessage_SYNC_ACCOUNT:
return m.unmarshalProtobufData(new(protobuf.SyncAccount))
case protobuf.ApplicationMetadataMessage_ACCEPT_CONTACT_REQUEST:
return m.unmarshalProtobufData(new(protobuf.AcceptContactRequest))
case protobuf.ApplicationMetadataMessage_RETRACT_CONTACT_REQUEST:
@ -318,14 +318,16 @@ func (m *StatusMessage) HandleApplication() error {
return m.unmarshalProtobufData((new(protobuf.SyncContactRequestDecision)))
case protobuf.ApplicationMetadataMessage_SYNC_SAVED_ADDRESS:
return m.unmarshalProtobufData(new(protobuf.SyncSavedAddress))
case protobuf.ApplicationMetadataMessage_SYNC_ALL_KEYCARDS:
return m.unmarshalProtobufData(new(protobuf.SyncAllKeycards))
case protobuf.ApplicationMetadataMessage_SYNC_KEYCARD_ACTION:
return m.unmarshalProtobufData(new(protobuf.SyncKeycardAction))
case protobuf.ApplicationMetadataMessage_SYNC_SOCIAL_LINK_SETTING:
return m.unmarshalProtobufData(new(protobuf.SyncSocialLinkSetting))
case protobuf.ApplicationMetadataMessage_SYNC_ENS_USERNAME_DETAIL:
return m.unmarshalProtobufData(new(protobuf.SyncEnsUsernameDetail))
case protobuf.ApplicationMetadataMessage_SYNC_KEYPAIR:
return m.unmarshalProtobufData(new(protobuf.SyncKeypair))
case protobuf.ApplicationMetadataMessage_SYNC_FULL_KEYPAIR:
return m.unmarshalProtobufData(new(protobuf.SyncKeypairFull))
}
return nil
}

View File

@ -4,31 +4,36 @@ import (
"encoding/json"
"github.com/status-im/status-go/multiaccounts/accounts"
"github.com/status-im/status-go/multiaccounts/keycards"
"github.com/status-im/status-go/multiaccounts/settings"
"github.com/status-im/status-go/protocol/protobuf"
)
type WakuBackedUpDataResponse struct {
Clock uint64
FetchingDataProgress map[string]protobuf.FetchingBackedUpDataDetails // key represents the data/section backup details refer to
Profile *BackedUpProfile
Setting *settings.SyncSettingField
Keycards []*keycards.Keycard
WalletAccount *accounts.Account
Keycards []*accounts.Keycard
Keypair *accounts.Keypair
WatchOnlyAccount *accounts.Account
}
func (sfwr *WakuBackedUpDataResponse) MarshalJSON() ([]byte, error) {
responseItem := struct {
Clock uint64 `json:"clock,omitempty"`
FetchingDataProgress map[string]FetchingBackupedDataDetails `json:"fetchingBackedUpDataProgress,omitempty"`
Profile *BackedUpProfile `json:"backedUpProfile,omitempty"`
Setting *settings.SyncSettingField `json:"backedUpSettings,omitempty"`
Keycards []*keycards.Keycard `json:"backedUpKeycards,omitempty"`
WalletAccount *accounts.Account `json:"backedUpWalletAccount,omitempty"`
Keycards []*accounts.Keycard `json:"backedUpKeycards,omitempty"`
Keypair *accounts.Keypair `json:"backedUpKeypair,omitempty"`
WatchOnlyAccount *accounts.Account `json:"backedUpWatchOnlyAccount,omitempty"`
}{
Clock: sfwr.Clock,
Profile: sfwr.Profile,
Setting: sfwr.Setting,
Keycards: sfwr.Keycards,
WalletAccount: sfwr.WalletAccount,
Keypair: sfwr.Keypair,
WatchOnlyAccount: sfwr.WatchOnlyAccount,
}
responseItem.FetchingDataProgress = sfwr.FetchingBackedUpDataDetails()

View File

@ -105,7 +105,7 @@ func (ppm *AccountPayloadMarshaller) multiaccountFromProtobuf(pbMultiAccount *pr
type RawMessagesPayload struct {
rawMessages []*protobuf.RawMessage
subAccounts []*accounts.Account
profileKeypair *accounts.Keypair
setting *settings.Settings
}
@ -130,8 +130,8 @@ func (rmm *RawMessagePayloadMarshaller) MarshalProtobuf() (data []byte, err erro
syncRawMessage := new(protobuf.SyncRawMessage)
syncRawMessage.RawMessages = rmm.payload.rawMessages
if len(rmm.payload.subAccounts) > 0 {
syncRawMessage.SubAccountsJsonBytes, err = json.Marshal(rmm.payload.subAccounts)
if rmm.payload.profileKeypair != nil && len(rmm.payload.profileKeypair.KeyUID) > 0 {
syncRawMessage.SubAccountsJsonBytes, err = json.Marshal(rmm.payload.profileKeypair)
if err != nil {
return nil, err
}
@ -153,7 +153,7 @@ func (rmm *RawMessagePayloadMarshaller) UnmarshalProtobuf(data []byte) error {
return err
}
if syncRawMessage.SubAccountsJsonBytes != nil {
err = json.Unmarshal(syncRawMessage.SubAccountsJsonBytes, &rmm.payload.subAccounts)
err = json.Unmarshal(syncRawMessage.SubAccountsJsonBytes, &rmm.payload.profileKeypair)
if err != nil {
return err
}

View File

@ -170,7 +170,7 @@ func NewRawMessageLoader(backend *api.GethStatusBackend, payload *RawMessagesPay
}
func (r *RawMessageLoader) Load() (err error) {
r.payload.rawMessages, r.payload.subAccounts, r.payload.setting, err = r.syncRawMessageHandler.PrepareRawMessage(r.keyUID, r.deviceType)
r.payload.rawMessages, r.payload.profileKeypair, r.payload.setting, err = r.syncRawMessageHandler.PrepareRawMessage(r.keyUID, r.deviceType)
return err
}

View File

@ -37,7 +37,7 @@ func (s *SyncRawMessageHandler) CollectInstallationData(rawMessageCollector *Raw
return err
}
func (s *SyncRawMessageHandler) PrepareRawMessage(keyUID, deviceType string) (rm []*protobuf.RawMessage, as []*accounts.Account, syncSettings *settings.Settings, err error) {
func (s *SyncRawMessageHandler) PrepareRawMessage(keyUID, deviceType string) (rm []*protobuf.RawMessage, kp *accounts.Keypair, syncSettings *settings.Settings, err error) {
syncSettings = new(settings.Settings)
messenger := s.backend.Messenger()
if messenger == nil {
@ -72,7 +72,7 @@ func (s *SyncRawMessageHandler) PrepareRawMessage(keyUID, deviceType string) (rm
accountService := s.backend.StatusNode().AccountService()
as, err = accountService.GetAccountsByKeyUID(keyUID)
kp, err = accountService.GetKeypairByKeyUID(keyUID)
if err != nil {
return
}
@ -104,7 +104,7 @@ func (s *SyncRawMessageHandler) HandleRawMessage(accountPayload *AccountPayload,
rmp.setting.InstallationID = nodeConfig.ShhextConfig.InstallationID
rmp.setting.CurrentNetwork = settingCurrentNetwork
err = s.backend.StartNodeWithAccountAndInitialConfig(*account, accountPayload.password, *rmp.setting, nodeConfig, rmp.subAccounts)
err = s.backend.StartNodeWithAccountAndInitialConfig(*account, accountPayload.password, *rmp.setting, nodeConfig, rmp.profileKeypair.Accounts)
}
if err != nil {
return err

View File

@ -13,7 +13,6 @@ import (
"github.com/status-im/status-go/account"
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/multiaccounts/accounts"
"github.com/status-im/status-go/multiaccounts/keycards"
"github.com/status-im/status-go/params"
"github.com/status-im/status-go/protocol"
)
@ -40,7 +39,7 @@ type DerivedAddress struct {
func (api *API) SaveAccount(ctx context.Context, account *accounts.Account) error {
log.Info("[AccountsAPI::SaveAccount]")
err := (*api.messenger).SaveAccount(account)
err := (*api.messenger).SaveOrUpdateAccount(account)
if err != nil {
return err
}
@ -48,36 +47,37 @@ func (api *API) SaveAccount(ctx context.Context, account *accounts.Account) erro
return nil
}
func (api *API) checkDerivedFromField(accounts []*accounts.Account) ([]*accounts.Account, error) {
for i := range accounts {
account := accounts[i]
if account.Wallet && account.DerivedFrom == "" {
address, err := api.db.GetWalletRootAddress()
// Setting `Keypair` without `Accounts` will update keypair only.
func (api *API) SaveKeypair(ctx context.Context, keypair *accounts.Keypair) error {
log.Info("[AccountsAPI::SaveKeypair]")
err := (*api.messenger).SaveOrUpdateKeypair(keypair)
if err != nil {
return nil, err
return err
}
account.DerivedFrom = address.Hex()
for _, acc := range keypair.Accounts {
api.feed.Send([]*accounts.Account{acc})
}
}
return accounts, nil
return nil
}
func (api *API) GetAccounts(ctx context.Context) ([]*accounts.Account, error) {
accounts, err := api.db.GetAccounts()
if err != nil {
return nil, err
}
return api.checkDerivedFromField(accounts)
return api.db.GetAccounts()
}
func (api *API) GetAccountsByKeyUID(ctx context.Context, keyUID string) ([]*accounts.Account, error) {
accounts, err := api.db.GetAccountsByKeyUID(keyUID)
if err != nil {
return nil, err
}
func (api *API) GetWatchOnlyAccounts(ctx context.Context) ([]*accounts.Account, error) {
return api.db.GetWatchOnlyAccounts()
}
return api.checkDerivedFromField(accounts)
func (api *API) GetKeypairs(ctx context.Context) ([]*accounts.Keypair, error) {
return api.db.GetKeypairs()
}
func (api *API) GetAccountByAddress(ctx context.Context, address types.Address) (*accounts.Account, error) {
return api.db.GetAccountByAddress(address)
}
func (api *API) GetKeypairByKeyUID(ctx context.Context, keyUID string) (*accounts.Keypair, error) {
return api.db.GetKeypairByKeyUID(keyUID)
}
func (api *API) DeleteAccount(ctx context.Context, address types.Address) error {
@ -86,13 +86,14 @@ func (api *API) DeleteAccount(ctx context.Context, address types.Address) error
return err
}
allAccountsOfKeypairWithKeyUID, err := api.db.GetAccountsByKeyUID(acc.KeyUID)
if acc.Type != accounts.AccountTypeWatch {
kp, err := api.db.GetKeypairByKeyUID(acc.KeyUID)
if err != nil {
return err
}
lastAcccountOfKeypairWithTheSameKey := len(allAccountsOfKeypairWithKeyUID) == 1
if acc.Type != accounts.AccountTypeWatch {
lastAcccountOfKeypairWithTheSameKey := len(kp.Accounts) == 1
knownKeycardsForKeyUID, err := api.db.GetKeycardByKeyUID(acc.KeyUID)
if err != nil {
return err
@ -107,7 +108,7 @@ func (api *API) DeleteAccount(ctx context.Context, address types.Address) error
if acc.Type != accounts.AccountTypeKey {
if lastAcccountOfKeypairWithTheSameKey {
err = api.manager.DeleteAccount(types.Address(common.HexToAddress(acc.DerivedFrom)))
err = api.manager.DeleteAccount(types.Address(common.HexToAddress(kp.DerivedFrom)))
var e *account.ErrCannotLocateKeyFile
if err != nil && !errors.As(err, &e) {
return err
@ -137,9 +138,62 @@ func (api *API) DeleteAccount(ctx context.Context, address types.Address) error
return (*api.messenger).DeleteAccount(address)
}
func (api *API) AddAccount(ctx context.Context, password string, account *accounts.Account) error {
func (api *API) AddKeypair(ctx context.Context, password string, keypair *accounts.Keypair) error {
if len(keypair.KeyUID) == 0 {
return errors.New("`KeyUID` field of a keypair must be set")
}
if len(keypair.Name) == 0 {
return errors.New("`Name` field of a keypair must be set")
}
if len(keypair.Type) == 0 {
return errors.New("`Type` field of a keypair must be set")
}
if keypair.Type != accounts.KeypairTypeKey {
if len(keypair.DerivedFrom) == 0 {
return errors.New("`DerivedFrom` field of a keypair must be set")
}
}
for _, acc := range keypair.Accounts {
if acc.KeyUID != keypair.KeyUID {
return errors.New("all accounts of a keypair must have the same `KeyUID` as keypair key uid")
}
err := api.checkAccountValidity(acc)
if err != nil {
return err
}
}
err := api.SaveKeypair(ctx, keypair)
if err != nil {
return err
}
if len(password) > 0 {
for _, acc := range keypair.Accounts {
if acc.Type == accounts.AccountTypeGenerated || acc.Type == accounts.AccountTypeSeed {
err = api.createKeystoreFileForAccount(keypair.DerivedFrom, password, acc)
if err != nil {
return err
}
}
}
}
return nil
}
func (api *API) checkAccountValidity(account *accounts.Account) error {
if len(account.Address) == 0 {
return errors.New("`Address` field must be set")
return errors.New("`Address` field of an account must be set")
}
if len(account.Type) == 0 {
return errors.New("`Type` field of an account must be set")
}
if account.Wallet || account.Chat {
@ -147,38 +201,30 @@ func (api *API) AddAccount(ctx context.Context, password string, account *accoun
}
if len(account.Name) == 0 {
return errors.New("`Name` field must be set")
return errors.New("`Name` field of an account must be set")
}
if len(account.Emoji) == 0 {
return errors.New("`Emoji` field must be set")
return errors.New("`Emoji` field of an account must be set")
}
if len(account.Color) == 0 {
return errors.New("`Color` field must be set")
return errors.New("`Color` field of an account must be set")
}
if account.Type != accounts.AccountTypeWatch {
if len(account.KeyUID) == 0 {
return errors.New("`KeyUID` field must be set")
return errors.New("`KeyUID` field of an account must be set")
}
if len(account.PublicKey) == 0 {
return errors.New("`PublicKey` field must be set")
}
if len(account.KeypairName) == 0 {
return errors.New("`KeypairName` field must be set")
return errors.New("`PublicKey` field of an account must be set")
}
if account.Type != accounts.AccountTypeKey {
if len(account.DerivedFrom) == 0 {
return errors.New("`DerivedFrom` field must be set")
}
if len(account.Path) == 0 {
return errors.New("`Path` field must be set")
return errors.New("`Path` field of an account must be set")
}
}
}
@ -192,18 +238,52 @@ func (api *API) AddAccount(ctx context.Context, password string, account *accoun
return errors.New("account already exists")
}
// we need to create local keystore file only if password is provided and the account is being added is of
// "generated" or "seed" type.
if (account.Type == accounts.AccountTypeGenerated || account.Type == accounts.AccountTypeSeed) && len(password) > 0 {
info, err := api.manager.AccountsGenerator().LoadAccount(account.DerivedFrom, password)
return nil
}
func (api *API) createKeystoreFileForAccount(masterAddress string, password string, account *accounts.Account) error {
if account.Type != accounts.AccountTypeGenerated && account.Type != accounts.AccountTypeSeed {
return errors.New("cannot create keystore file if account is not of `generated` or `seed` type")
}
if masterAddress == "" {
return errors.New("cannot create keystore file if master address is empty")
}
if password == "" {
return errors.New("cannot create keystore file if password is empty")
}
info, err := api.manager.AccountsGenerator().LoadAccount(masterAddress, password)
if err != nil {
return err
}
_, err = api.manager.AccountsGenerator().StoreDerivedAccounts(info.ID, password, []string{account.Path})
return err
}
func (api *API) AddAccount(ctx context.Context, password string, account *accounts.Account) error {
err := api.checkAccountValidity(account)
if err != nil {
return err
}
if account.Type != accounts.AccountTypeWatch {
kp, err := api.db.GetKeypairByKeyUID(account.KeyUID)
if err != nil {
if err == accounts.ErrDbKeypairNotFound {
return errors.New("cannot add an account for an unknown keypair")
}
return err
}
// we need to create local keystore file only if password is provided and the account is being added is of
// "generated" or "seed" type.
if (account.Type == accounts.AccountTypeGenerated || account.Type == accounts.AccountTypeSeed) && len(password) > 0 {
err = api.createKeystoreFileForAccount(kp.DerivedFrom, password, account)
if err != nil {
return err
}
}
}
return api.SaveAccount(ctx, account)
@ -216,12 +296,12 @@ func (api *API) ImportPrivateKey(ctx context.Context, privateKey string, passwor
return err
}
accs, err := api.db.GetAccountsByKeyUID(info.KeyUID)
if err != nil {
kp, err := api.db.GetKeypairByKeyUID(info.KeyUID)
if err != nil && err != accounts.ErrDbKeypairNotFound {
return err
}
if len(accs) > 0 {
if kp != nil {
return errors.New("provided private key was already imported")
}
@ -238,12 +318,12 @@ func (api *API) ImportMnemonic(ctx context.Context, mnemonic string, password st
return err
}
accs, err := api.db.GetAccountsByKeyUID(generatedAccountInfo.KeyUID)
if err != nil {
kp, err := api.db.GetKeypairByKeyUID(generatedAccountInfo.KeyUID)
if err != nil && err != accounts.ErrDbKeypairNotFound {
return err
}
if len(accs) > 0 {
if kp != nil {
return errors.New("provided mnemonic was already imported, to add new account use `AddAccount` endpoint")
}
@ -269,21 +349,22 @@ func (api *API) VerifyPassword(password string) bool {
return api.VerifyKeystoreFileForAccount(address, password)
}
func (api *API) AddKeycardOrAddAccountsIfKeycardIsAdded(ctx context.Context, kcUID string, kpName string, keyUID string, accountAddresses []string) error {
// If keypair is migrated from keycard to app, then `accountsComingFromKeycard` should be set to true, otherwise false.
func (api *API) AddKeycardOrAddAccountsIfKeycardIsAdded(ctx context.Context, kcUID string, kpName string, keyUID string,
accountAddresses []string, accountsComingFromKeycard bool) error {
if len(accountAddresses) == 0 {
return errors.New("cannot migrate a keypair without any address")
return errors.New("cannot migrate a keypair without accounts")
}
acc, err := api.db.GetAccountByAddress(types.Address(common.HexToAddress(accountAddresses[0])))
kpDb, err := api.db.GetKeypairByKeyUID(keyUID)
if err != nil {
if err == accounts.ErrDbKeypairNotFound {
return errors.New("cannot migrate an unknown keypair")
}
return err
}
if len(acc.DerivedFrom) == 0 {
return errors.New("an account being migrated doesn't contain `derived_from` field set")
}
kp := keycards.Keycard{
kp := accounts.Keycard{
KeycardUID: kcUID,
KeycardName: kpName,
KeycardLocked: false,
@ -304,9 +385,10 @@ func (api *API) AddKeycardOrAddAccountsIfKeycardIsAdded(ctx context.Context, kcU
return err
}
if !accountsComingFromKeycard {
// Once we migrate a keypair, corresponding keystore files need to be deleted
// if the keypair being migrated is not already migrated (in case user is creating a copy of an existing Keycard)
if added && len(knownKeycardsForKeyUID) == 0 && acc.Type != accounts.AccountTypeWatch {
if added && len(knownKeycardsForKeyUID) == 0 {
for _, addr := range kp.AccountsAddresses {
err = api.manager.DeleteAccount(addr)
if err != nil {
@ -314,11 +396,12 @@ func (api *API) AddKeycardOrAddAccountsIfKeycardIsAdded(ctx context.Context, kcU
}
}
err = api.manager.DeleteAccount(types.Address(common.HexToAddress(acc.DerivedFrom)))
err = api.manager.DeleteAccount(types.Address(common.HexToAddress(kpDb.DerivedFrom)))
if err != nil {
return err
}
}
}
return nil
}
@ -332,15 +415,15 @@ func (api *API) RemoveMigratedAccountsForKeycard(ctx context.Context, kcUID stri
return (*api.messenger).RemoveMigratedAccountsForKeycard(ctx, kcUID, addresses, clock)
}
func (api *API) GetAllKnownKeycards(ctx context.Context) ([]*keycards.Keycard, error) {
func (api *API) GetAllKnownKeycards(ctx context.Context) ([]*accounts.Keycard, error) {
return api.db.GetAllKnownKeycards()
}
func (api *API) GetAllKnownKeycardsGroupedByKeyUID(ctx context.Context) ([]*keycards.Keycard, error) {
func (api *API) GetAllKnownKeycardsGroupedByKeyUID(ctx context.Context) ([]*accounts.Keycard, error) {
return api.db.GetAllKnownKeycardsGroupedByKeyUID()
}
func (api *API) GetKeycardByKeyUID(ctx context.Context, keyUID string) ([]*keycards.Keycard, error) {
func (api *API) GetKeycardByKeyUID(ctx context.Context, keyUID string) ([]*accounts.Keycard, error) {
return api.db.GetKeycardByKeyUID(keyUID)
}

View File

@ -70,9 +70,9 @@ func (s *Service) Protocols() []p2p.Protocol {
return nil
}
func (s *Service) GetAccountsByKeyUID(keyUID string) ([]*accounts.Account, error) {
func (s *Service) GetKeypairByKeyUID(keyUID string) (*accounts.Keypair, error) {
return s.db.GetAccountsByKeyUID(keyUID)
return s.db.GetKeypairByKeyUID(keyUID)
}
func (s *Service) GetSettings() (settings.Settings, error) {

View File

@ -157,10 +157,14 @@ func (m *MessengerSignalsHandler) SendWakuBackedUpSettings(response *wakusync.Wa
signal.SendWakuBackedUpSettings(response)
}
func (m *MessengerSignalsHandler) SendWakuBackedUpWalletAccount(response *wakusync.WakuBackedUpDataResponse) {
signal.SendWakuBackedUpWalletAccount(response)
func (m *MessengerSignalsHandler) SendWakuBackedUpKeypair(response *wakusync.WakuBackedUpDataResponse) {
signal.SendWakuBackedUpKeypair(response)
}
func (m *MessengerSignalsHandler) SendWakuBackedUpKeycards(response *wakusync.WakuBackedUpDataResponse) {
signal.SendWakuBackedUpKeycards(response)
}
func (m *MessengerSignalsHandler) SendWakuBackedUpWatchOnlyAccount(response *wakusync.WakuBackedUpDataResponse) {
signal.SendWakuBackedUpWatchOnlyAccount(response)
}

View File

@ -53,6 +53,7 @@ func (api *API) GetCachedWalletTokensWithoutMarketData(ctx context.Context) (map
type DerivedAddress struct {
Address common.Address `json:"address"`
PublicKey types.HexBytes `json:"public-key,omitempty"`
Path string `json:"path"`
HasActivity bool `json:"hasActivity"`
AlreadyCreated bool `json:"alreadyCreated"`
@ -459,6 +460,7 @@ func (api *API) getDerivedAddresses(id string, paths []string) ([]*DerivedAddres
derivedAddress := &DerivedAddress{
Address: common.HexToAddress(acc.Address),
PublicKey: types.Hex2Bytes(acc.PublicKey),
Path: accPath,
}

View File

@ -79,7 +79,7 @@ func setupTestAPI(t *testing.T) (*API, func()) {
accounts := []*accounts.Account{
{Address: types.HexToAddress(utils.TestConfig.Account1.WalletAddress), Chat: true, Wallet: true},
}
require.NoError(t, service.accountsDB.SaveAccounts(accounts))
require.NoError(t, service.accountsDB.SaveOrUpdateAccounts(accounts))
require.NoError(t, service.accountsDB.CreateSettings(settings, *nodeConfig))

View File

@ -12,11 +12,14 @@ const (
// EventWakuBackedUpSettings is emitted while applying fetched settings from waku
EventWakuBackedUpSettings = "waku.backedup.settings"
// EventWakuBackedUpWalletAccount is emitted while applying fetched wallet account data from waku
EventWakuBackedUpWalletAccount = "waku.backedup.wallet-account" // #nosec G101
// EventWakuBackedUpKeypair is emitted while applying fetched keypair data from waku
EventWakuBackedUpKeypair = "waku.backedup.keypair"
// EventWakuBackedUpKeycards is emitted while applying fetched keycard data from waku
EventWakuBackedUpKeycards = "waku.backedup.keycards"
// EventWakuBackedUpWatchOnlyAccount is emitted while applying fetched watch only account data from waku
EventWakuBackedUpWatchOnlyAccount = "waku.backedup.watch-only-account" // #nosec G101
)
func SendWakuFetchingBackupProgress(obj json.Marshaler) {
@ -31,10 +34,14 @@ func SendWakuBackedUpSettings(obj json.Marshaler) {
send(EventWakuBackedUpSettings, obj)
}
func SendWakuBackedUpWalletAccount(obj json.Marshaler) {
send(EventWakuBackedUpWalletAccount, obj)
func SendWakuBackedUpKeypair(obj json.Marshaler) {
send(EventWakuBackedUpKeypair, obj)
}
func SendWakuBackedUpKeycards(obj json.Marshaler) {
send(EventWakuBackedUpKeycards, obj)
}
func SendWakuBackedUpWatchOnlyAccount(obj json.Marshaler) {
send(EventWakuBackedUpWatchOnlyAccount, obj)
}