diff --git a/VERSION b/VERSION index 1c2bbb1c7..5f8cbfdb7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.94.13 +0.95.0 diff --git a/appdatabase/migrations/bindata.go b/appdatabase/migrations/bindata.go index b702ff310..2bdc07341 100644 --- a/appdatabase/migrations/bindata.go +++ b/appdatabase/migrations/bindata.go @@ -1,19 +1,20 @@ -// Code generated by go-bindata. DO NOT EDIT. +// Code generated by go-bindata. // sources: -// 1640111208_dummy.up.sql (258B) -// 1642666031_add_removed_clock_to_bookmarks.up.sql (117B) -// 1643644541_gif_api_key_setting.up.sql (108B) -// 1644188994_recent_stickers.up.sql (79B) -// 1646659233_add_address_to_dapp_permisssion.up.sql (700B) -// 1646841105_add_emoji_account.up.sql (96B) -// doc.go (74B) +// 1640111208_dummy.up.sql +// 1642666031_add_removed_clock_to_bookmarks.up.sql +// 1643644541_gif_api_key_setting.up.sql +// 1644188994_recent_stickers.up.sql +// 1646659233_add_address_to_dapp_permisssion.up.sql +// 1646841105_add_emoji_account.up.sql +// 1647278782_display_name.up.sql +// doc.go +// DO NOT EDIT! package migrations import ( "bytes" "compress/gzip" - "crypto/sha256" "fmt" "io" "io/ioutil" @@ -26,7 +27,7 @@ import ( func bindataRead(data []byte, name string) ([]byte, error) { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err != nil { - return nil, fmt.Errorf("read %q: %w", name, err) + return nil, fmt.Errorf("Read %q: %v", name, err) } var buf bytes.Buffer @@ -34,7 +35,7 @@ func bindataRead(data []byte, name string) ([]byte, error) { clErr := gz.Close() if err != nil { - return nil, fmt.Errorf("read %q: %w", name, err) + return nil, fmt.Errorf("Read %q: %v", name, err) } if clErr != nil { return nil, err @@ -44,9 +45,8 @@ func bindataRead(data []byte, name string) ([]byte, error) { } type asset struct { - bytes []byte - info os.FileInfo - digest [sha256.Size]byte + bytes []byte + info os.FileInfo } type bindataFileInfo struct { @@ -90,8 +90,8 @@ func _1640111208_dummyUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1640111208_dummy.up.sql", size: 258, mode: os.FileMode(0664), modTime: time.Unix(1647246959, 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}} + info := bindataFileInfo{name: "1640111208_dummy.up.sql", size: 258, mode: os.FileMode(436), modTime: time.Unix(1645543084, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -110,8 +110,8 @@ 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(0664), modTime: time.Unix(1647246959, 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}} + info := bindataFileInfo{name: "1642666031_add_removed_clock_to_bookmarks.up.sql", size: 117, mode: os.FileMode(436), modTime: time.Unix(1646418868, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -130,8 +130,8 @@ 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(0664), modTime: time.Unix(1647246959, 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}} + info := bindataFileInfo{name: "1643644541_gif_api_key_setting.up.sql", size: 108, mode: os.FileMode(436), modTime: time.Unix(1645543084, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -150,8 +150,8 @@ func _1644188994_recent_stickersUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1644188994_recent_stickers.up.sql", size: 79, mode: os.FileMode(0664), modTime: time.Unix(1647246959, 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}} + info := bindataFileInfo{name: "1644188994_recent_stickers.up.sql", size: 79, mode: os.FileMode(436), modTime: time.Unix(1646853782, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -170,8 +170,8 @@ 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(0664), modTime: time.Unix(1647247370, 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}} + info := bindataFileInfo{name: "1646659233_add_address_to_dapp_permisssion.up.sql", size: 700, mode: os.FileMode(436), modTime: time.Unix(1647278692, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -190,8 +190,28 @@ func _1646841105_add_emoji_accountUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1646841105_add_emoji_account.up.sql", size: 96, mode: os.FileMode(0664), modTime: time.Unix(1647247370, 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}} + info := bindataFileInfo{name: "1646841105_add_emoji_account.up.sql", size: 96, mode: os.FileMode(436), modTime: time.Unix(1647278692, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __1647278782_display_nameUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\xf4\x09\x71\x0d\x52\x08\x71\x74\xf2\x71\x55\x28\x4e\x2d\x29\xc9\xcc\x4b\x2f\x56\x70\x74\x71\x51\x70\xf6\xf7\x09\xf5\xf5\x53\x48\xc9\x2c\x2e\xc8\x49\xac\x8c\xcf\x4b\xcc\x4d\x55\x08\x71\x8d\x08\x51\xf0\xf3\x0f\x51\xf0\x0b\xf5\xf1\x51\x70\x71\x75\x73\x0c\xf5\x09\x51\x50\x52\xb2\xe6\x0a\x0d\x70\x71\x0c\x41\x32\x21\xd8\x35\x04\x55\xab\x2d\x58\x19\x20\x00\x00\xff\xff\xc7\x11\xdd\x01\x6e\x00\x00\x00") + +func _1647278782_display_nameUpSqlBytes() ([]byte, error) { + return bindataRead( + __1647278782_display_nameUpSql, + "1647278782_display_name.up.sql", + ) +} + +func _1647278782_display_nameUpSql() (*asset, error) { + bytes, err := _1647278782_display_nameUpSqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "1647278782_display_name.up.sql", size: 110, mode: os.FileMode(436), modTime: time.Unix(1647278807, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -210,8 +230,8 @@ func docGo() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0664), modTime: time.Unix(1647246959, 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}} + info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -219,8 +239,8 @@ func docGo() (*asset, error) { // It returns an error if the asset could not be found or // could not be loaded. func Asset(name string) ([]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) @@ -230,12 +250,6 @@ func Asset(name string) ([]byte, error) { return nil, fmt.Errorf("Asset %s not found", name) } -// AssetString returns the asset contents as a string (instead of a []byte). -func AssetString(name string) (string, error) { - data, err := Asset(name) - return string(data), err -} - // MustAsset is like Asset but panics when Asset would return an error. // It simplifies safe initialization of global variables. func MustAsset(name string) []byte { @@ -247,18 +261,12 @@ func MustAsset(name string) []byte { return a } -// MustAssetString is like AssetString but panics when Asset would return an -// error. It simplifies safe initialization of global variables. -func MustAssetString(name string) string { - return string(MustAsset(name)) -} - // AssetInfo loads and returns the asset info for the given name. // It returns an error if the asset could not be found or // could not be loaded. func AssetInfo(name string) (os.FileInfo, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) @@ -268,33 +276,6 @@ func AssetInfo(name string) (os.FileInfo, error) { return nil, fmt.Errorf("AssetInfo %s not found", name) } -// AssetDigest returns the digest of the file with the given name. It returns an -// error if the asset could not be found or the digest could not be loaded. -func AssetDigest(name string) ([sha256.Size]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) - } - return a.digest, nil - } - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) -} - -// Digests returns a map of all known files and their checksums. -func Digests() (map[string][sha256.Size]byte, error) { - mp := make(map[string][sha256.Size]byte, len(_bindata)) - for name := range _bindata { - a, err := _bindata[name]() - if err != nil { - return nil, err - } - mp[name] = a.digest - } - return mp, nil -} - // AssetNames returns the names of the assets. func AssetNames() []string { names := make([]string, 0, len(_bindata)) @@ -306,18 +287,16 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ - "1640111208_dummy.up.sql": _1640111208_dummyUpSql, - "1642666031_add_removed_clock_to_bookmarks.up.sql": _1642666031_add_removed_clock_to_bookmarksUpSql, - "1643644541_gif_api_key_setting.up.sql": _1643644541_gif_api_key_settingUpSql, - "1644188994_recent_stickers.up.sql": _1644188994_recent_stickersUpSql, + "1640111208_dummy.up.sql": _1640111208_dummyUpSql, + "1642666031_add_removed_clock_to_bookmarks.up.sql": _1642666031_add_removed_clock_to_bookmarksUpSql, + "1643644541_gif_api_key_setting.up.sql": _1643644541_gif_api_key_settingUpSql, + "1644188994_recent_stickers.up.sql": _1644188994_recent_stickersUpSql, "1646659233_add_address_to_dapp_permisssion.up.sql": _1646659233_add_address_to_dapp_permisssionUpSql, - "1646841105_add_emoji_account.up.sql": _1646841105_add_emoji_accountUpSql, - "doc.go": docGo, + "1646841105_add_emoji_account.up.sql": _1646841105_add_emoji_accountUpSql, + "1647278782_display_name.up.sql": _1647278782_display_nameUpSql, + "doc.go": docGo, } -// AssetDebug is true if the assets were built with the debug flag enabled. -const AssetDebug = false - // AssetDir returns the file names below a certain // directory embedded in the file by go-bindata. // For example if you run go-bindata on data/... and data contains the @@ -327,15 +306,15 @@ const AssetDebug = false // img/ // a.png // b.png -// then AssetDir("data") would return []string{"foo.txt", "img"}, -// AssetDir("data/img") would return []string{"a.png", "b.png"}, -// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and +// then AssetDir("data") would return []string{"foo.txt", "img"} +// AssetDir("data/img") would return []string{"a.png", "b.png"} +// AssetDir("foo.txt") and AssetDir("notexist") would return an error // AssetDir("") will return []string{"data"}. func AssetDir(name string) ([]string, error) { node := _bintree if len(name) != 0 { - canonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(canonicalName, "/") + cannonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(cannonicalName, "/") for _, p := range pathList { node = node.Children[p] if node == nil { @@ -357,18 +336,18 @@ type bintree struct { Func func() (*asset, error) Children map[string]*bintree } - var _bintree = &bintree{nil, map[string]*bintree{ - "1640111208_dummy.up.sql": {_1640111208_dummyUpSql, map[string]*bintree{}}, - "1642666031_add_removed_clock_to_bookmarks.up.sql": {_1642666031_add_removed_clock_to_bookmarksUpSql, map[string]*bintree{}}, - "1643644541_gif_api_key_setting.up.sql": {_1643644541_gif_api_key_settingUpSql, map[string]*bintree{}}, - "1644188994_recent_stickers.up.sql": {_1644188994_recent_stickersUpSql, map[string]*bintree{}}, - "1646659233_add_address_to_dapp_permisssion.up.sql": {_1646659233_add_address_to_dapp_permisssionUpSql, map[string]*bintree{}}, - "1646841105_add_emoji_account.up.sql": {_1646841105_add_emoji_accountUpSql, map[string]*bintree{}}, - "doc.go": {docGo, map[string]*bintree{}}, + "1640111208_dummy.up.sql": &bintree{_1640111208_dummyUpSql, map[string]*bintree{}}, + "1642666031_add_removed_clock_to_bookmarks.up.sql": &bintree{_1642666031_add_removed_clock_to_bookmarksUpSql, map[string]*bintree{}}, + "1643644541_gif_api_key_setting.up.sql": &bintree{_1643644541_gif_api_key_settingUpSql, map[string]*bintree{}}, + "1644188994_recent_stickers.up.sql": &bintree{_1644188994_recent_stickersUpSql, map[string]*bintree{}}, + "1646659233_add_address_to_dapp_permisssion.up.sql": &bintree{_1646659233_add_address_to_dapp_permisssionUpSql, map[string]*bintree{}}, + "1646841105_add_emoji_account.up.sql": &bintree{_1646841105_add_emoji_accountUpSql, map[string]*bintree{}}, + "1647278782_display_name.up.sql": &bintree{_1647278782_display_nameUpSql, map[string]*bintree{}}, + "doc.go": &bintree{docGo, map[string]*bintree{}}, }} -// RestoreAsset restores an asset under the given directory. +// RestoreAsset restores an asset under the given directory func RestoreAsset(dir, name string) error { data, err := Asset(name) if err != nil { @@ -386,10 +365,14 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + if err != nil { + return err + } + return nil } -// RestoreAssets restores an asset under the given directory recursively. +// RestoreAssets restores an asset under the given directory recursively func RestoreAssets(dir, name string) error { children, err := AssetDir(name) // File @@ -407,6 +390,7 @@ func RestoreAssets(dir, name string) error { } func _filePath(dir, name string) string { - canonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) + cannonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) } + diff --git a/appdatabase/migrations/sql/1647278782_display_name.up.sql b/appdatabase/migrations/sql/1647278782_display_name.up.sql new file mode 100644 index 000000000..47ff901b4 --- /dev/null +++ b/appdatabase/migrations/sql/1647278782_display_name.up.sql @@ -0,0 +1,2 @@ +ALTER TABLE settings ADD COLUMN display_name TEXT NOT NULL DEFAULT ""; +UPDATE settings SET display_name = ""; diff --git a/mobile/status.go b/mobile/status.go index de951ebaa..e760d30ff 100644 --- a/mobile/status.go +++ b/mobile/status.go @@ -23,6 +23,7 @@ import ( "github.com/status-im/status-go/params" "github.com/status-im/status-go/profiling" protocol "github.com/status-im/status-go/protocol" + "github.com/status-im/status-go/protocol/identity/alias" "github.com/status-im/status-go/server" "github.com/status-im/status-go/services/personal" "github.com/status-im/status-go/services/typeddata" @@ -639,6 +640,10 @@ func GenerateAlias(pk string) string { return name } +func IsAlias(value string) string { + return prepareJSONResponse(alias.IsAlias(value), nil) +} + func Identicon(pk string) string { // We ignore any error, empty string is considered an error identicon, _ := protocol.Identicon(pk) diff --git a/multiaccounts/accounts/database.go b/multiaccounts/accounts/database.go index 3cef74aac..9c8739aff 100644 --- a/multiaccounts/accounts/database.go +++ b/multiaccounts/accounts/database.go @@ -80,6 +80,7 @@ type Settings struct { CustomBootnodes *json.RawMessage `json:"custom-bootnodes,omitempty"` CustomBootnodesEnabled *json.RawMessage `json:"custom-bootnodes-enabled?,omitempty"` DappsAddress types.Address `json:"dapps-address"` + DisplayName string `json:"display-name"` EIP1581Address types.Address `json:"eip1581-address"` Fleet *string `json:"fleet,omitempty"` HideHomeTooltip bool `json:"hide-home-tooltip?,omitempty"` @@ -187,6 +188,7 @@ INSERT INTO settings ( currency, current_network, dapps_address, + display_name, eip1581_address, installation_id, key_uid, @@ -204,12 +206,13 @@ INSERT INTO settings ( wallet_root_address, synthetic_id ) VALUES ( -?,?,?,?,?,?,?,?,?,?, +?,?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,'id')`, s.Address, s.Currency, s.CurrentNetwork, s.DappsAddress, + s.DisplayName, s.EIP1581Address, s.InstallationID, s.KeyUID, @@ -262,6 +265,8 @@ func (db *Database) SaveSetting(setting string, value interface{}) error { return ErrInvalidConfig } update, err = db.db.Prepare("UPDATE settings SET dapps_address = ? WHERE synthetic_id = 'id'") + case "display-name": + update, err = db.db.Prepare("UPDATE settings SET display_name = ? WHERE synthetic_id = 'id'") case "eip1581-address": str, ok := value.(string) if ok { @@ -501,7 +506,7 @@ func (db *Database) SaveSetting(setting string, value interface{}) error { func (db *Database) GetSettings() (Settings, error) { var s Settings - err := db.db.QueryRow("SELECT address, anon_metrics_should_send, chaos_mode, currency, current_network, custom_bootnodes, custom_bootnodes_enabled, dapps_address, eip1581_address, fleet, hide_home_tooltip, installation_id, key_uid, keycard_instance_uid, keycard_paired_on, keycard_pairing, last_updated, latest_derived_path, link_preview_request_enabled, link_previews_enabled_sites, log_level, mnemonic, name, networks, notifications_enabled, push_notifications_server_enabled, push_notifications_from_contacts_only, remote_push_notifications_enabled, send_push_notifications, push_notifications_block_mentions, photo_path, pinned_mailservers, preferred_name, preview_privacy, public_key, remember_syncing_choice, signing_phrase, stickers_packs_installed, stickers_packs_pending, stickers_recent_stickers, syncing_on_mobile_network, default_sync_period, use_mailservers, messages_from_contacts_only, usernames, appearance, profile_pictures_show_to, profile_pictures_visibility, wallet_root_address, wallet_set_up_passed, wallet_visible_tokens, waku_bloom_filter_mode, webview_allow_permission_requests, current_user_status, send_status_updates, gif_recents, gif_favorites, opensea_enabled, last_backup, backup_enabled, telemetry_server_url, auto_message_enabled, gif_api_key FROM settings WHERE synthetic_id = 'id'").Scan( + err := db.db.QueryRow("SELECT address, anon_metrics_should_send, chaos_mode, currency, current_network, custom_bootnodes, custom_bootnodes_enabled, dapps_address, display_name, eip1581_address, fleet, hide_home_tooltip, installation_id, key_uid, keycard_instance_uid, keycard_paired_on, keycard_pairing, last_updated, latest_derived_path, link_preview_request_enabled, link_previews_enabled_sites, log_level, mnemonic, name, networks, notifications_enabled, push_notifications_server_enabled, push_notifications_from_contacts_only, remote_push_notifications_enabled, send_push_notifications, push_notifications_block_mentions, photo_path, pinned_mailservers, preferred_name, preview_privacy, public_key, remember_syncing_choice, signing_phrase, stickers_packs_installed, stickers_packs_pending, stickers_recent_stickers, syncing_on_mobile_network, default_sync_period, use_mailservers, messages_from_contacts_only, usernames, appearance, profile_pictures_show_to, profile_pictures_visibility, wallet_root_address, wallet_set_up_passed, wallet_visible_tokens, waku_bloom_filter_mode, webview_allow_permission_requests, current_user_status, send_status_updates, gif_recents, gif_favorites, opensea_enabled, last_backup, backup_enabled, telemetry_server_url, auto_message_enabled, gif_api_key FROM settings WHERE synthetic_id = 'id'").Scan( &s.Address, &s.AnonMetricsShouldSend, &s.ChaosMode, @@ -510,6 +515,7 @@ func (db *Database) GetSettings() (Settings, error) { &s.CustomBootnodes, &s.CustomBootnodesEnabled, &s.DappsAddress, + &s.DisplayName, &s.EIP1581Address, &s.Fleet, &s.HideHomeTooltip, @@ -917,6 +923,18 @@ func (db *Database) ENSName() (string, error) { return "", err } +func (db *Database) DisplayName() (string, error) { + var result sql.NullString + err := db.db.QueryRow("SELECT display_name FROM settings WHERE synthetic_id = 'id'").Scan(&result) + if err == sql.ErrNoRows { + return "", nil + } + if result.Valid { + return result.String, nil + } + return "", err +} + func (db *Database) GifAPIKey() (string, error) { var result sql.NullString err := db.db.QueryRow("SELECT gif_api_key FROM settings WHERE synthetic_id = 'id'").Scan(&result) diff --git a/protocol/common/message.go b/protocol/common/message.go index d625433bf..1bb25a3b6 100644 --- a/protocol/common/message.go +++ b/protocol/common/message.go @@ -193,6 +193,7 @@ func (m *Message) MarshalJSON() ([]byte, error) { ResponseTo string `json:"responseTo"` New bool `json:"new,omitempty"` EnsName string `json:"ensName"` + DisplayName string `json:"displayName"` Image string `json:"image,omitempty"` Audio string `json:"audio,omitempty"` AudioDurationMs uint64 `json:"audioDurationMs,omitempty"` @@ -228,6 +229,7 @@ func (m *Message) MarshalJSON() ([]byte, error) { ResponseTo: m.ResponseTo, New: m.New, EnsName: m.EnsName, + DisplayName: m.DisplayName, Image: m.ImageLocalURL, Audio: m.AudioLocalURL, CommunityID: m.CommunityID, @@ -262,6 +264,7 @@ func (m *Message) UnmarshalJSON(data []byte) error { *Alias ResponseTo string `json:"responseTo"` EnsName string `json:"ensName"` + DisplayName string `json:"displayName"` ChatID string `json:"chatId"` Sticker *protobuf.StickerMessage `json:"sticker"` AudioDurationMs uint64 `json:"audioDurationMs"` @@ -283,6 +286,7 @@ func (m *Message) UnmarshalJSON(data []byte) error { } m.ResponseTo = aux.ResponseTo m.EnsName = aux.EnsName + m.DisplayName = aux.DisplayName m.ChatId = aux.ChatID m.ContentType = aux.ContentType m.ParsedText = aux.ParsedText diff --git a/protocol/contact.go b/protocol/contact.go index c1ea43896..060e077b4 100644 --- a/protocol/contact.go +++ b/protocol/contact.go @@ -27,7 +27,7 @@ func (c *Contact) CanonicalName() string { } if c.ENSVerified { - return c.Name + return c.EnsName } return c.Alias @@ -62,7 +62,7 @@ type Contact struct { // Ethereum address of the contact Address string `json:"address,omitempty"` // ENS name of contact - Name string `json:"name,omitempty"` + EnsName string `json:"ensName,omitempty"` // EnsVerified whether we verified the name of the contact ENSVerified bool `json:"ensVerified"` // Generated username name of the contact @@ -78,6 +78,9 @@ type Contact struct { LocalNickname string `json:"localNickname,omitempty"` + // Display name of the contact + DisplayName string `json:"displayName"` + Images map[string]images.IdentityImage `json:"images"` Added bool `json:"added"` diff --git a/protocol/encryption/github.com/protocol/encryption/protocol_message.pb.go b/protocol/encryption/github.com/protocol/encryption/protocol_message.pb.go new file mode 100644 index 000000000..5270ed926 --- /dev/null +++ b/protocol/encryption/github.com/protocol/encryption/protocol_message.pb.go @@ -0,0 +1,613 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: protocol_message.proto + +package encryption + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type SignedPreKey struct { + SignedPreKey []byte `protobuf:"bytes,1,opt,name=signed_pre_key,json=signedPreKey,proto3" json:"signed_pre_key,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + ProtocolVersion uint32 `protobuf:"varint,3,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SignedPreKey) Reset() { *m = SignedPreKey{} } +func (m *SignedPreKey) String() string { return proto.CompactTextString(m) } +func (*SignedPreKey) ProtoMessage() {} +func (*SignedPreKey) Descriptor() ([]byte, []int) { + return fileDescriptor_4e37b52004a72e16, []int{0} +} + +func (m *SignedPreKey) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SignedPreKey.Unmarshal(m, b) +} +func (m *SignedPreKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SignedPreKey.Marshal(b, m, deterministic) +} +func (m *SignedPreKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_SignedPreKey.Merge(m, src) +} +func (m *SignedPreKey) XXX_Size() int { + return xxx_messageInfo_SignedPreKey.Size(m) +} +func (m *SignedPreKey) XXX_DiscardUnknown() { + xxx_messageInfo_SignedPreKey.DiscardUnknown(m) +} + +var xxx_messageInfo_SignedPreKey proto.InternalMessageInfo + +func (m *SignedPreKey) GetSignedPreKey() []byte { + if m != nil { + return m.SignedPreKey + } + return nil +} + +func (m *SignedPreKey) GetVersion() uint32 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *SignedPreKey) GetProtocolVersion() uint32 { + if m != nil { + return m.ProtocolVersion + } + return 0 +} + +// X3DH prekey bundle +type Bundle struct { + // Identity key + Identity []byte `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` + // Installation id + SignedPreKeys map[string]*SignedPreKey `protobuf:"bytes,2,rep,name=signed_pre_keys,json=signedPreKeys,proto3" json:"signed_pre_keys,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Prekey signature + Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` + // When the bundle was created locally + Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Bundle) Reset() { *m = Bundle{} } +func (m *Bundle) String() string { return proto.CompactTextString(m) } +func (*Bundle) ProtoMessage() {} +func (*Bundle) Descriptor() ([]byte, []int) { + return fileDescriptor_4e37b52004a72e16, []int{1} +} + +func (m *Bundle) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Bundle.Unmarshal(m, b) +} +func (m *Bundle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Bundle.Marshal(b, m, deterministic) +} +func (m *Bundle) XXX_Merge(src proto.Message) { + xxx_messageInfo_Bundle.Merge(m, src) +} +func (m *Bundle) XXX_Size() int { + return xxx_messageInfo_Bundle.Size(m) +} +func (m *Bundle) XXX_DiscardUnknown() { + xxx_messageInfo_Bundle.DiscardUnknown(m) +} + +var xxx_messageInfo_Bundle proto.InternalMessageInfo + +func (m *Bundle) GetIdentity() []byte { + if m != nil { + return m.Identity + } + return nil +} + +func (m *Bundle) GetSignedPreKeys() map[string]*SignedPreKey { + if m != nil { + return m.SignedPreKeys + } + return nil +} + +func (m *Bundle) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +func (m *Bundle) GetTimestamp() int64 { + if m != nil { + return m.Timestamp + } + return 0 +} + +type BundleContainer struct { + // X3DH prekey bundle + Bundle *Bundle `protobuf:"bytes,1,opt,name=bundle,proto3" json:"bundle,omitempty"` + // Private signed prekey + PrivateSignedPreKey []byte `protobuf:"bytes,2,opt,name=private_signed_pre_key,json=privateSignedPreKey,proto3" json:"private_signed_pre_key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BundleContainer) Reset() { *m = BundleContainer{} } +func (m *BundleContainer) String() string { return proto.CompactTextString(m) } +func (*BundleContainer) ProtoMessage() {} +func (*BundleContainer) Descriptor() ([]byte, []int) { + return fileDescriptor_4e37b52004a72e16, []int{2} +} + +func (m *BundleContainer) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BundleContainer.Unmarshal(m, b) +} +func (m *BundleContainer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BundleContainer.Marshal(b, m, deterministic) +} +func (m *BundleContainer) XXX_Merge(src proto.Message) { + xxx_messageInfo_BundleContainer.Merge(m, src) +} +func (m *BundleContainer) XXX_Size() int { + return xxx_messageInfo_BundleContainer.Size(m) +} +func (m *BundleContainer) XXX_DiscardUnknown() { + xxx_messageInfo_BundleContainer.DiscardUnknown(m) +} + +var xxx_messageInfo_BundleContainer proto.InternalMessageInfo + +func (m *BundleContainer) GetBundle() *Bundle { + if m != nil { + return m.Bundle + } + return nil +} + +func (m *BundleContainer) GetPrivateSignedPreKey() []byte { + if m != nil { + return m.PrivateSignedPreKey + } + return nil +} + +type DRHeader struct { + // Current ratchet public key + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Number of the message in the sending chain + N uint32 `protobuf:"varint,2,opt,name=n,proto3" json:"n,omitempty"` + // Length of the previous sending chain + Pn uint32 `protobuf:"varint,3,opt,name=pn,proto3" json:"pn,omitempty"` + // Bundle ID + Id []byte `protobuf:"bytes,4,opt,name=id,proto3" json:"id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DRHeader) Reset() { *m = DRHeader{} } +func (m *DRHeader) String() string { return proto.CompactTextString(m) } +func (*DRHeader) ProtoMessage() {} +func (*DRHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_4e37b52004a72e16, []int{3} +} + +func (m *DRHeader) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DRHeader.Unmarshal(m, b) +} +func (m *DRHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DRHeader.Marshal(b, m, deterministic) +} +func (m *DRHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_DRHeader.Merge(m, src) +} +func (m *DRHeader) XXX_Size() int { + return xxx_messageInfo_DRHeader.Size(m) +} +func (m *DRHeader) XXX_DiscardUnknown() { + xxx_messageInfo_DRHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_DRHeader proto.InternalMessageInfo + +func (m *DRHeader) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *DRHeader) GetN() uint32 { + if m != nil { + return m.N + } + return 0 +} + +func (m *DRHeader) GetPn() uint32 { + if m != nil { + return m.Pn + } + return 0 +} + +func (m *DRHeader) GetId() []byte { + if m != nil { + return m.Id + } + return nil +} + +type DHHeader struct { + // Compressed ephemeral public key + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DHHeader) Reset() { *m = DHHeader{} } +func (m *DHHeader) String() string { return proto.CompactTextString(m) } +func (*DHHeader) ProtoMessage() {} +func (*DHHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_4e37b52004a72e16, []int{4} +} + +func (m *DHHeader) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DHHeader.Unmarshal(m, b) +} +func (m *DHHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DHHeader.Marshal(b, m, deterministic) +} +func (m *DHHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_DHHeader.Merge(m, src) +} +func (m *DHHeader) XXX_Size() int { + return xxx_messageInfo_DHHeader.Size(m) +} +func (m *DHHeader) XXX_DiscardUnknown() { + xxx_messageInfo_DHHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_DHHeader proto.InternalMessageInfo + +func (m *DHHeader) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +type X3DHHeader struct { + // Ephemeral key used + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Used bundle's signed prekey + Id []byte `protobuf:"bytes,4,opt,name=id,proto3" json:"id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *X3DHHeader) Reset() { *m = X3DHHeader{} } +func (m *X3DHHeader) String() string { return proto.CompactTextString(m) } +func (*X3DHHeader) ProtoMessage() {} +func (*X3DHHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_4e37b52004a72e16, []int{5} +} + +func (m *X3DHHeader) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_X3DHHeader.Unmarshal(m, b) +} +func (m *X3DHHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_X3DHHeader.Marshal(b, m, deterministic) +} +func (m *X3DHHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_X3DHHeader.Merge(m, src) +} +func (m *X3DHHeader) XXX_Size() int { + return xxx_messageInfo_X3DHHeader.Size(m) +} +func (m *X3DHHeader) XXX_DiscardUnknown() { + xxx_messageInfo_X3DHHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_X3DHHeader proto.InternalMessageInfo + +func (m *X3DHHeader) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *X3DHHeader) GetId() []byte { + if m != nil { + return m.Id + } + return nil +} + +// Hash Ratchet Header +type HRHeader struct { + // community key ID + KeyId uint32 `protobuf:"varint,1,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"` + // Community message number for this key_id + SeqNo uint32 `protobuf:"varint,2,opt,name=seq_no,json=seqNo,proto3" json:"seq_no,omitempty"` + // Community ID + GroupId string `protobuf:"bytes,3,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HRHeader) Reset() { *m = HRHeader{} } +func (m *HRHeader) String() string { return proto.CompactTextString(m) } +func (*HRHeader) ProtoMessage() {} +func (*HRHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_4e37b52004a72e16, []int{6} +} + +func (m *HRHeader) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HRHeader.Unmarshal(m, b) +} +func (m *HRHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HRHeader.Marshal(b, m, deterministic) +} +func (m *HRHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_HRHeader.Merge(m, src) +} +func (m *HRHeader) XXX_Size() int { + return xxx_messageInfo_HRHeader.Size(m) +} +func (m *HRHeader) XXX_DiscardUnknown() { + xxx_messageInfo_HRHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_HRHeader proto.InternalMessageInfo + +func (m *HRHeader) GetKeyId() uint32 { + if m != nil { + return m.KeyId + } + return 0 +} + +func (m *HRHeader) GetSeqNo() uint32 { + if m != nil { + return m.SeqNo + } + return 0 +} + +func (m *HRHeader) GetGroupId() string { + if m != nil { + return m.GroupId + } + return "" +} + +// Direct message value +type EncryptedMessageProtocol struct { + X3DHHeader *X3DHHeader `protobuf:"bytes,1,opt,name=X3DH_header,json=X3DHHeader,proto3" json:"X3DH_header,omitempty"` + DRHeader *DRHeader `protobuf:"bytes,2,opt,name=DR_header,json=DRHeader,proto3" json:"DR_header,omitempty"` + DHHeader *DHHeader `protobuf:"bytes,101,opt,name=DH_header,json=DHHeader,proto3" json:"DH_header,omitempty"` + HRHeader *HRHeader `protobuf:"bytes,102,opt,name=HR_header,json=HRHeader,proto3" json:"HR_header,omitempty"` + // Encrypted payload + Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EncryptedMessageProtocol) Reset() { *m = EncryptedMessageProtocol{} } +func (m *EncryptedMessageProtocol) String() string { return proto.CompactTextString(m) } +func (*EncryptedMessageProtocol) ProtoMessage() {} +func (*EncryptedMessageProtocol) Descriptor() ([]byte, []int) { + return fileDescriptor_4e37b52004a72e16, []int{7} +} + +func (m *EncryptedMessageProtocol) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EncryptedMessageProtocol.Unmarshal(m, b) +} +func (m *EncryptedMessageProtocol) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EncryptedMessageProtocol.Marshal(b, m, deterministic) +} +func (m *EncryptedMessageProtocol) XXX_Merge(src proto.Message) { + xxx_messageInfo_EncryptedMessageProtocol.Merge(m, src) +} +func (m *EncryptedMessageProtocol) XXX_Size() int { + return xxx_messageInfo_EncryptedMessageProtocol.Size(m) +} +func (m *EncryptedMessageProtocol) XXX_DiscardUnknown() { + xxx_messageInfo_EncryptedMessageProtocol.DiscardUnknown(m) +} + +var xxx_messageInfo_EncryptedMessageProtocol proto.InternalMessageInfo + +func (m *EncryptedMessageProtocol) GetX3DHHeader() *X3DHHeader { + if m != nil { + return m.X3DHHeader + } + return nil +} + +func (m *EncryptedMessageProtocol) GetDRHeader() *DRHeader { + if m != nil { + return m.DRHeader + } + return nil +} + +func (m *EncryptedMessageProtocol) GetDHHeader() *DHHeader { + if m != nil { + return m.DHHeader + } + return nil +} + +func (m *EncryptedMessageProtocol) GetHRHeader() *HRHeader { + if m != nil { + return m.HRHeader + } + return nil +} + +func (m *EncryptedMessageProtocol) GetPayload() []byte { + if m != nil { + return m.Payload + } + return nil +} + +// Top-level protocol message +type ProtocolMessage struct { + // The device id of the sender + InstallationId string `protobuf:"bytes,2,opt,name=installation_id,json=installationId,proto3" json:"installation_id,omitempty"` + // List of bundles + Bundles []*Bundle `protobuf:"bytes,3,rep,name=bundles,proto3" json:"bundles,omitempty"` + // One to one message, encrypted, indexed by installation_id + // TODO map here is redundant in case of community messages + EncryptedMessage map[string]*EncryptedMessageProtocol `protobuf:"bytes,101,rep,name=encrypted_message,json=encryptedMessage,proto3" json:"encrypted_message,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Public chats, not encrypted + PublicMessage []byte `protobuf:"bytes,102,opt,name=public_message,json=publicMessage,proto3" json:"public_message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ProtocolMessage) Reset() { *m = ProtocolMessage{} } +func (m *ProtocolMessage) String() string { return proto.CompactTextString(m) } +func (*ProtocolMessage) ProtoMessage() {} +func (*ProtocolMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_4e37b52004a72e16, []int{8} +} + +func (m *ProtocolMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ProtocolMessage.Unmarshal(m, b) +} +func (m *ProtocolMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ProtocolMessage.Marshal(b, m, deterministic) +} +func (m *ProtocolMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProtocolMessage.Merge(m, src) +} +func (m *ProtocolMessage) XXX_Size() int { + return xxx_messageInfo_ProtocolMessage.Size(m) +} +func (m *ProtocolMessage) XXX_DiscardUnknown() { + xxx_messageInfo_ProtocolMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_ProtocolMessage proto.InternalMessageInfo + +func (m *ProtocolMessage) GetInstallationId() string { + if m != nil { + return m.InstallationId + } + return "" +} + +func (m *ProtocolMessage) GetBundles() []*Bundle { + if m != nil { + return m.Bundles + } + return nil +} + +func (m *ProtocolMessage) GetEncryptedMessage() map[string]*EncryptedMessageProtocol { + if m != nil { + return m.EncryptedMessage + } + return nil +} + +func (m *ProtocolMessage) GetPublicMessage() []byte { + if m != nil { + return m.PublicMessage + } + return nil +} + +func init() { + proto.RegisterType((*SignedPreKey)(nil), "encryption.SignedPreKey") + proto.RegisterType((*Bundle)(nil), "encryption.Bundle") + proto.RegisterMapType((map[string]*SignedPreKey)(nil), "encryption.Bundle.SignedPreKeysEntry") + proto.RegisterType((*BundleContainer)(nil), "encryption.BundleContainer") + proto.RegisterType((*DRHeader)(nil), "encryption.DRHeader") + proto.RegisterType((*DHHeader)(nil), "encryption.DHHeader") + proto.RegisterType((*X3DHHeader)(nil), "encryption.X3DHHeader") + proto.RegisterType((*HRHeader)(nil), "encryption.HRHeader") + proto.RegisterType((*EncryptedMessageProtocol)(nil), "encryption.EncryptedMessageProtocol") + proto.RegisterType((*ProtocolMessage)(nil), "encryption.ProtocolMessage") + proto.RegisterMapType((map[string]*EncryptedMessageProtocol)(nil), "encryption.ProtocolMessage.EncryptedMessageEntry") +} + +func init() { + proto.RegisterFile("protocol_message.proto", fileDescriptor_4e37b52004a72e16) +} + +var fileDescriptor_4e37b52004a72e16 = []byte{ + // 642 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x54, 0xdd, 0x4e, 0xdb, 0x4c, + 0x10, 0x95, 0x6d, 0xf2, 0xc3, 0xe4, 0xf7, 0xdb, 0xaf, 0x20, 0x17, 0xa1, 0x2a, 0xb2, 0x40, 0x4d, + 0xab, 0xca, 0x08, 0xa8, 0xd4, 0x8a, 0x4b, 0x0a, 0x52, 0xa0, 0xa2, 0x42, 0x8b, 0x54, 0x55, 0x5c, + 0xd4, 0x72, 0xe2, 0x21, 0xac, 0x70, 0x6c, 0xe3, 0x75, 0x50, 0xfd, 0x02, 0xbd, 0xe9, 0x1b, 0xf6, + 0x69, 0x2a, 0xef, 0x7a, 0x9d, 0x25, 0x24, 0x77, 0x99, 0xe3, 0x99, 0x39, 0x73, 0xce, 0xec, 0x04, + 0xb6, 0x93, 0x34, 0xce, 0xe2, 0x49, 0x1c, 0x7a, 0x33, 0xe4, 0xdc, 0x9f, 0xa2, 0x2b, 0x00, 0x02, + 0x18, 0x4d, 0xd2, 0x3c, 0xc9, 0x58, 0x1c, 0x39, 0x39, 0xb4, 0x6f, 0xd8, 0x34, 0xc2, 0xe0, 0x3a, + 0xc5, 0xaf, 0x98, 0x93, 0x3d, 0xe8, 0x72, 0x11, 0x7b, 0x49, 0x8a, 0xde, 0x03, 0xe6, 0xb6, 0x31, + 0x30, 0x86, 0x6d, 0xda, 0xe6, 0x7a, 0x96, 0x0d, 0x8d, 0x27, 0x4c, 0x39, 0x8b, 0x23, 0xdb, 0x1c, + 0x18, 0xc3, 0x0e, 0x55, 0x21, 0x79, 0x07, 0xfd, 0x8a, 0x55, 0xa5, 0x58, 0x22, 0xa5, 0xa7, 0xf0, + 0xef, 0x12, 0x76, 0xfe, 0x98, 0x50, 0x3f, 0x9d, 0x47, 0x41, 0x88, 0x64, 0x07, 0x9a, 0x2c, 0xc0, + 0x28, 0x63, 0x99, 0xe2, 0xab, 0x62, 0x72, 0x05, 0xbd, 0xe7, 0x13, 0x71, 0xdb, 0x1c, 0x58, 0xc3, + 0xd6, 0xd1, 0xbe, 0xbb, 0xd0, 0xe1, 0xca, 0x46, 0xae, 0xae, 0x85, 0x9f, 0x47, 0x59, 0x9a, 0xd3, + 0x8e, 0x3e, 0x39, 0x27, 0xbb, 0xb0, 0x59, 0x00, 0x7e, 0x36, 0x4f, 0xd1, 0xde, 0x10, 0x5c, 0x0b, + 0xa0, 0xf8, 0x9a, 0xb1, 0x19, 0xf2, 0xcc, 0x9f, 0x25, 0x76, 0x6d, 0x60, 0x0c, 0x2d, 0xba, 0x00, + 0x76, 0x6e, 0x81, 0xbc, 0x24, 0x20, 0x7d, 0xb0, 0x94, 0x4f, 0x9b, 0xb4, 0xf8, 0x49, 0x5c, 0xa8, + 0x3d, 0xf9, 0xe1, 0x1c, 0x85, 0x39, 0xad, 0x23, 0x5b, 0x1f, 0x54, 0x6f, 0x40, 0x65, 0xda, 0x89, + 0xf9, 0xd9, 0x70, 0x7e, 0x41, 0x4f, 0x6a, 0xf8, 0x12, 0x47, 0x99, 0xcf, 0x22, 0x4c, 0xc9, 0x7b, + 0xa8, 0x8f, 0x05, 0x24, 0x7a, 0xb7, 0x8e, 0xc8, 0x4b, 0xc1, 0xb4, 0xcc, 0x20, 0xc7, 0xc5, 0xb6, + 0xd9, 0x93, 0x9f, 0xa1, 0xb7, 0xb4, 0x3f, 0x53, 0x68, 0xfc, 0xbf, 0xfc, 0xaa, 0xd3, 0x5f, 0x6e, + 0x34, 0xad, 0xfe, 0x86, 0x73, 0x09, 0xcd, 0x33, 0x3a, 0x42, 0x3f, 0xc0, 0x54, 0xd7, 0xd2, 0x96, + 0x5a, 0xda, 0x60, 0xa8, 0x25, 0x1b, 0x11, 0xe9, 0x82, 0x99, 0xa8, 0x85, 0x9a, 0x89, 0x88, 0x59, + 0x50, 0xda, 0x68, 0xb2, 0xc0, 0xd9, 0x85, 0xe6, 0xd9, 0x68, 0x5d, 0x2f, 0xe7, 0x23, 0xc0, 0x8f, + 0xe3, 0xf5, 0xdf, 0x97, 0xbb, 0x95, 0xf3, 0xdd, 0x40, 0x73, 0xa4, 0xe6, 0xdb, 0x82, 0xfa, 0x03, + 0xe6, 0x1e, 0x0b, 0x44, 0x59, 0x87, 0xd6, 0x1e, 0x30, 0xbf, 0x08, 0x0a, 0x98, 0xe3, 0xa3, 0x17, + 0xc5, 0xe5, 0xa4, 0x35, 0x8e, 0x8f, 0xdf, 0x62, 0xf2, 0x1a, 0x9a, 0xd3, 0x34, 0x9e, 0x27, 0x45, + 0xbe, 0x25, 0xd6, 0xd3, 0x10, 0xf1, 0x45, 0xe0, 0xfc, 0x36, 0xc1, 0x3e, 0x97, 0x6e, 0x62, 0x70, + 0x25, 0xcf, 0xe3, 0xba, 0x7c, 0xa0, 0xe4, 0x13, 0xb4, 0x8a, 0x39, 0xbd, 0x7b, 0x41, 0x5a, 0xba, + 0xbf, 0xad, 0xbb, 0xbf, 0x90, 0x41, 0x75, 0x49, 0x87, 0xb0, 0x79, 0x46, 0x55, 0x99, 0x5c, 0xfe, + 0x2b, 0xbd, 0x4c, 0xf9, 0x4c, 0x17, 0x8e, 0x17, 0x25, 0x15, 0x13, 0xae, 0x28, 0x19, 0x55, 0x25, + 0x1a, 0xcb, 0xa8, 0x62, 0xb9, 0x7b, 0x59, 0x32, 0xaa, 0x58, 0x2a, 0xdf, 0x6c, 0x68, 0x24, 0x7e, + 0x1e, 0xc6, 0xbe, 0x34, 0xa2, 0x4d, 0x55, 0xe8, 0xfc, 0x35, 0xa1, 0xa7, 0x84, 0x97, 0x3e, 0x90, + 0xb7, 0xd0, 0x63, 0x11, 0xcf, 0xfc, 0x30, 0xf4, 0x8b, 0x86, 0x85, 0x7d, 0xa6, 0xb0, 0xaf, 0xab, + 0xc3, 0x17, 0x01, 0xf9, 0x00, 0x0d, 0xf9, 0xfe, 0xb8, 0x6d, 0x89, 0x9b, 0x5c, 0xf5, 0x44, 0x55, + 0x0a, 0xf9, 0x09, 0xff, 0xa1, 0xb2, 0x5c, 0xfd, 0x25, 0xd9, 0x28, 0xea, 0x0e, 0xf5, 0xba, 0xa5, + 0x71, 0xdc, 0xe5, 0x3d, 0xc9, 0xbb, 0xee, 0xe3, 0x12, 0x4c, 0xf6, 0xa1, 0x9b, 0xcc, 0xc7, 0x21, + 0x9b, 0x54, 0xcd, 0xef, 0x84, 0xd6, 0x8e, 0x44, 0xcb, 0xb4, 0x1d, 0x06, 0x5b, 0x2b, 0x3b, 0xae, + 0x38, 0xe4, 0x93, 0xe7, 0x87, 0xbc, 0xa7, 0x4f, 0xb9, 0xee, 0xf5, 0x68, 0x47, 0x7d, 0x3a, 0xb8, + 0x7d, 0x33, 0x65, 0xd9, 0xfd, 0x7c, 0xec, 0x4e, 0xe2, 0xd9, 0x81, 0xfa, 0x03, 0x3c, 0x58, 0x74, + 0x19, 0xd7, 0x05, 0x78, 0xfc, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x20, 0x4c, 0xc2, 0xbb, 0xac, 0x05, + 0x00, 0x00, +} diff --git a/protocol/identity/alias/ops.go b/protocol/identity/alias/ops.go new file mode 100644 index 000000000..724f686bf --- /dev/null +++ b/protocol/identity/alias/ops.go @@ -0,0 +1,33 @@ +package alias + +import ( + "strings" +) + +func IsAdjective(val string) bool { + for _, v := range adjectives { + if v == val { + return true + } + } + return false +} + +func IsAnimal(val string) bool { + for _, v := range animals { + if v == val { + return true + } + } + return false +} + +func IsAlias(alias string) bool { + aliasParts := strings.Fields(alias) + if len(aliasParts) == 3 { + if IsAdjective(strings.Title(aliasParts[0])) && IsAdjective(strings.Title(aliasParts[1])) && IsAnimal(strings.Title(aliasParts[2])) { + return true + } + } + return false +} diff --git a/protocol/message_validator.go b/protocol/message_validator.go index 486c8af2a..1d28f7dc3 100644 --- a/protocol/message_validator.go +++ b/protocol/message_validator.go @@ -289,6 +289,10 @@ func ValidateReceivedChatMessage(message *protobuf.ChatMessage, whisperTimestamp } } + if err := ValidateDisplayName(&message.DisplayName); err != nil { + return err + } + return nil } diff --git a/protocol/messenger.go b/protocol/messenger.go index f423f8b27..a6722744c 100644 --- a/protocol/messenger.go +++ b/protocol/messenger.go @@ -780,10 +780,12 @@ func (m *Messenger) publishContactCode() error { } ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() + _, err = m.sender.SendPublic(ctx, contactCodeTopic, rawMessage) if err != nil { m.logger.Warn("failed to send a contact code", zap.Error(err)) } + m.logger.Debug("contact code sent") return err } @@ -792,9 +794,7 @@ func (m *Messenger) publishContactCode() error { // if the `shouldPublish` conditions are met func (m *Messenger) attachChatIdentity(cca *protobuf.ContactCodeAdvertisement) error { contactCodeTopic := transport.ContactCodeTopic(&m.identity.PublicKey) - shouldPublish, err := m.shouldPublishChatIdentity(contactCodeTopic) - if err != nil { return err } @@ -812,11 +812,13 @@ func (m *Messenger) attachChatIdentity(cca *protobuf.ContactCodeAdvertisement) e if err != nil { return err } - if img == nil { - return errors.New("could not find image") + + displayName, err := m.settings.DisplayName() + if err != nil { + return err } - err = m.persistence.SaveWhenChatIdentityLastPublished(contactCodeTopic, img.Hash()) + err = m.persistence.SaveWhenChatIdentityLastPublished(contactCodeTopic, m.getIdentityHash(displayName, img)) if err != nil { return err } @@ -875,11 +877,13 @@ func (m *Messenger) handleStandaloneChatIdentity(chat *Chat) error { if err != nil { return err } - if img == nil { - return errors.New("could not find image") + + displayName, err := m.settings.DisplayName() + if err != nil { + return err } - err = m.persistence.SaveWhenChatIdentityLastPublished(chat.ID, img.Hash()) + err = m.persistence.SaveWhenChatIdentityLastPublished(chat.ID, m.getIdentityHash(displayName, img)) if err != nil { return err } @@ -887,19 +891,31 @@ func (m *Messenger) handleStandaloneChatIdentity(chat *Chat) error { return nil } +func (m *Messenger) getIdentityHash(displayName string, img *userimage.IdentityImage) []byte { + if img == nil { + return crypto.Keccak256([]byte(displayName)) + } + return crypto.Keccak256(img.Payload, []byte(displayName)) +} + // shouldPublishChatIdentity returns true if the last time the ChatIdentity was attached was more than 24 hours ago func (m *Messenger) shouldPublishChatIdentity(chatID string) (bool, error) { if m.account == nil { return false, nil } - // Check we have at least one image + // Check we have at least one image or a display name img, err := m.multiAccounts.GetIdentityImage(m.account.KeyUID, userimage.SmallDimName) if err != nil { return false, err } - if img == nil { + displayName, err := m.settings.DisplayName() + if err != nil { + return false, err + } + + if img == nil && displayName == "" { return false, nil } @@ -908,7 +924,7 @@ func (m *Messenger) shouldPublishChatIdentity(chatID string) (bool, error) { return false, err } - if !bytes.Equal(hash, img.Hash()) { + if !bytes.Equal(hash, m.getIdentityHash(displayName, img)) { return true, nil } @@ -923,11 +939,18 @@ func (m *Messenger) createChatIdentity(context chatContext) (*protobuf.ChatIdent m.logger.Info(fmt.Sprintf("account keyUID '%s'", m.account.KeyUID)) m.logger.Info(fmt.Sprintf("context '%s'", context)) - ci := &protobuf.ChatIdentity{ - Clock: m.transport.GetCurrentTime(), - EnsName: "", // TODO add ENS name handling to dedicate PR + displayName, err := m.settings.DisplayName() + if err != nil { + return nil, err } - err := m.attachIdentityImagesToChatIdentity(context, ci) + + ci := &protobuf.ChatIdentity{ + Clock: m.transport.GetCurrentTime(), + EnsName: "", // TODO add ENS name handling to dedicate PR + DisplayName: displayName, + } + + err = m.attachIdentityImagesToChatIdentity(context, ci) if err != nil { return nil, err } @@ -966,6 +989,10 @@ func (m *Messenger) attachIdentityImagesToChatIdentity(context chatContext, ci * return err } + if img == nil { + return nil + } + m.logger.Debug(fmt.Sprintf("%s images.IdentityImage '%s'", context, spew.Sdump(img))) ciis[userimage.SmallDimName] = m.adaptIdentityImageToProtobuf(img) @@ -1062,7 +1089,7 @@ func (m *Messenger) handleENSVerified(records []*ens.VerificationRecord) { } contact.ENSVerified = record.Verified - contact.Name = record.Name + contact.EnsName = record.Name contacts = append(contacts, contact) } @@ -2299,6 +2326,12 @@ func (m *Messenger) SendChatMessages(ctx context.Context, messages []*common.Mes // SendChatMessage takes a minimal message and sends it based on the corresponding chat func (m *Messenger) sendChatMessage(ctx context.Context, message *common.Message) (*MessengerResponse, error) { + displayName, err := m.settings.DisplayName() + if err != nil { + return nil, err + } + + message.DisplayName = displayName if len(message.ImagePath) != 0 { file, err := os.Open(message.ImagePath) if err != nil { @@ -2368,7 +2401,7 @@ func (m *Messenger) sendChatMessage(ctx context.Context, message *common.Message return nil, errors.New("Chat not found") } - err := m.handleStandaloneChatIdentity(chat) + err = m.handleStandaloneChatIdentity(chat) if err != nil { return nil, err } @@ -2475,7 +2508,12 @@ func (m *Messenger) ShareImageMessage(request *requests.ShareImageMessage) (*Mes func (m *Messenger) SyncDevices(ctx context.Context, ensName, photoPath string) (err error) { myID := contactIDFromPublicKey(&m.identity.PublicKey) - if _, err = m.sendContactUpdate(ctx, myID, ensName, photoPath); err != nil { + displayName, err := m.settings.DisplayName() + if err != nil { + return err + } + + if _, err = m.sendContactUpdate(ctx, myID, displayName, ensName, photoPath); err != nil { return err } @@ -2722,7 +2760,7 @@ func (m *Messenger) syncContact(ctx context.Context, contact *Contact) error { var ensName string if contact.ENSVerified { - ensName = contact.Name + ensName = contact.EnsName } oneToOneChat, ok := m.allChats.Load(contact.ID) diff --git a/protocol/messenger_backup.go b/protocol/messenger_backup.go index 9fa186d32..c4137a282 100644 --- a/protocol/messenger_backup.go +++ b/protocol/messenger_backup.go @@ -142,7 +142,7 @@ func (m *Messenger) syncBackupContact(ctx context.Context, contact *Contact) *pr var ensName string if contact.ENSVerified { - ensName = contact.Name + ensName = contact.EnsName } oneToOneChat, ok := m.allChats.Load(contact.ID) diff --git a/protocol/messenger_chats.go b/protocol/messenger_chats.go index 821d23e1f..28fe205eb 100644 --- a/protocol/messenger_chats.go +++ b/protocol/messenger_chats.go @@ -274,7 +274,7 @@ func (m *Messenger) CreateOneToOneChat(request *requests.CreateOneToOneChat) (*M return nil, err } } - contact.Name = ensName + contact.EnsName = ensName contact.ENSVerified = true err = m.persistence.SaveContact(contact, nil) if err != nil { diff --git a/protocol/messenger_contact_update_test.go b/protocol/messenger_contact_update_test.go index debb66580..ff1018416 100644 --- a/protocol/messenger_contact_update_test.go +++ b/protocol/messenger_contact_update_test.go @@ -100,13 +100,13 @@ func (s *MessengerContactUpdateSuite) TestReceiveContactUpdate() { s.Require().NoError(err) receivedContact := response.Contacts[0] - s.Require().Equal(theirName, receivedContact.Name) + s.Require().Equal(theirName, receivedContact.EnsName) s.Require().False(receivedContact.ENSVerified) s.Require().NotEmpty(receivedContact.LastUpdated) s.Require().True(receivedContact.HasAddedUs) newPicture := "new-picture" - err = theirMessenger.SendContactUpdates(context.Background(), newName, newPicture) + err = theirMessenger.SendContactUpdates(context.Background(), newEnsName, newPicture) s.Require().NoError(err) // Wait for the message to reach its destination @@ -122,7 +122,7 @@ func (s *MessengerContactUpdateSuite) TestReceiveContactUpdate() { receivedContact = response.Contacts[0] s.Require().Equal(theirContactID, receivedContact.ID) - s.Require().Equal(newName, receivedContact.Name) + s.Require().Equal(newEnsName, receivedContact.EnsName) s.Require().False(receivedContact.ENSVerified) s.Require().NotEmpty(receivedContact.LastUpdated) s.Require().NoError(theirMessenger.Shutdown()) @@ -174,7 +174,7 @@ func (s *MessengerContactUpdateSuite) TestAddContactWithENS() { s.Require().NoError(err) s.Require().NotNil(response) s.Require().Len(response.Contacts, 1) - s.Require().Equal(ensName, response.Contacts[0].Name) + s.Require().Equal(ensName, response.Contacts[0].EnsName) s.Require().True(response.Contacts[0].ENSVerified) s.Require().Len(response.Contacts, 1) diff --git a/protocol/messenger_contacts.go b/protocol/messenger_contacts.go index 266adcd17..e3c0f7894 100644 --- a/protocol/messenger_contacts.go +++ b/protocol/messenger_contacts.go @@ -79,6 +79,10 @@ func (m *Messenger) AddContact(ctx context.Context, request *requests.AddContact contact.LocalNickname = request.Nickname } + if len(request.DisplayName) != 0 { + contact.DisplayName = request.DisplayName + } + if !contact.Added { contact.Added = true } @@ -137,8 +141,13 @@ func (m *Messenger) AddContact(ctx context.Context, request *requests.AddContact return nil, err } + displayName, err := m.settings.DisplayName() + if err != nil { + return nil, err + } + // Finally we send a contact update so they are notified we added them - response, err := m.sendContactUpdate(context.Background(), pubKey, ensName, "") + response, err := m.sendContactUpdate(context.Background(), pubKey, displayName, ensName, "") if err != nil { return nil, err } @@ -414,14 +423,19 @@ func (m *Messenger) UnblockContact(contactID string) error { func (m *Messenger) SendContactUpdates(ctx context.Context, ensName, profileImage string) (err error) { myID := contactIDFromPublicKey(&m.identity.PublicKey) - if _, err = m.sendContactUpdate(ctx, myID, ensName, profileImage); err != nil { + displayName, err := m.settings.DisplayName() + if err != nil { + return err + } + + if _, err = m.sendContactUpdate(ctx, myID, displayName, ensName, profileImage); err != nil { return err } // TODO: This should not be sending paired messages, as we do it above m.allContacts.Range(func(contactID string, contact *Contact) (shouldContinue bool) { if contact.Added { - if _, err = m.sendContactUpdate(ctx, contact.ID, ensName, profileImage); err != nil { + if _, err = m.sendContactUpdate(ctx, contact.ID, displayName, ensName, profileImage); err != nil { return false } } @@ -438,10 +452,15 @@ func (m *Messenger) SendContactUpdates(ctx context.Context, ensName, profileImag // SendContactUpdate sends a contact update to a user and adds the user to contacts func (m *Messenger) SendContactUpdate(ctx context.Context, chatID, ensName, profileImage string) (*MessengerResponse, error) { - return m.sendContactUpdate(ctx, chatID, ensName, profileImage) + displayName, err := m.settings.DisplayName() + if err != nil { + return nil, err + } + + return m.sendContactUpdate(ctx, chatID, displayName, ensName, profileImage) } -func (m *Messenger) sendContactUpdate(ctx context.Context, chatID, ensName, profileImage string) (*MessengerResponse, error) { +func (m *Messenger) sendContactUpdate(ctx context.Context, chatID, displayName, ensName, profileImage string) (*MessengerResponse, error) { var response MessengerResponse contact, ok := m.allContacts.Load(chatID) @@ -466,8 +485,10 @@ func (m *Messenger) sendContactUpdate(ctx context.Context, chatID, ensName, prof contactUpdate := &protobuf.ContactUpdate{ Clock: clock, + DisplayName: displayName, EnsName: ensName, - ProfileImage: profileImage} + ProfileImage: profileImage, + } encodedMessage, err := proto.Marshal(contactUpdate) if err != nil { return nil, err @@ -505,7 +526,7 @@ func (m *Messenger) addENSNameToContact(contact *Contact) error { return nil } - contact.Name = ensRecord.Name + contact.EnsName = ensRecord.Name contact.ENSVerified = true return nil diff --git a/protocol/messenger_display_name.go b/protocol/messenger_display_name.go new file mode 100644 index 000000000..f12dc096f --- /dev/null +++ b/protocol/messenger_display_name.go @@ -0,0 +1,71 @@ +package protocol + +import ( + "errors" + "regexp" + "strings" + + "github.com/status-im/status-go/protocol/identity/alias" +) + +var ErrInvalidDisplayNameRegExp = errors.New("only letters, numbers, underscores and hyphens allowed") +var ErrInvalidDisplayNameEthSuffix = errors.New(`usernames ending with "eth" are not allowed`) +var ErrInvalidDisplayNameNotAllowed = errors.New("name is not allowed") + +func ValidateDisplayName(displayName *string) error { + name := strings.TrimSpace(*displayName) + *displayName = name + + if name == "" { + return nil + } + + // ^[\\w-\\s]{5,24}$ to allow spaces + if match, _ := regexp.MatchString("^[\\w-\\s]{5,24}$", name); !match { + return ErrInvalidDisplayNameRegExp + } + + // .eth should not happen due to the regexp above, but let's keep it here in case the regexp is changed in the future + if strings.HasSuffix(name, "_eth") || strings.HasSuffix(name, ".eth") || strings.HasSuffix(name, "-eth") { + return ErrInvalidDisplayNameEthSuffix + } + + if alias.IsAlias(name) { + return ErrInvalidDisplayNameNotAllowed + } + + return nil +} + +func (m *Messenger) SetDisplayName(displayName string) error { + currDisplayName, err := m.settings.DisplayName() + if err != nil { + return err + } + + if currDisplayName == displayName { + return nil // Do nothing + } + + if err = ValidateDisplayName(&displayName); err != nil { + return err + } + + m.account.Name = displayName // We might need to do the same when syncing settings? + err = m.multiAccounts.SaveAccount(*m.account) + if err != nil { + return err + } + + err = m.settings.SaveSetting("display-name", displayName) + if err != nil { + return err + } + + err = m.resetLastPublishedTimeForChatIdentity() + if err != nil { + return err + } + + return m.publishContactCode() +} diff --git a/protocol/messenger_handler.go b/protocol/messenger_handler.go index de3cd5f90..18907b127 100644 --- a/protocol/messenger_handler.go +++ b/protocol/messenger_handler.go @@ -346,8 +346,8 @@ func (m *Messenger) HandleSyncInstallationContact(state *ReceivedMessageState, m if message.Added { contact.Added = true } - if message.EnsName != "" && contact.Name != message.EnsName { - contact.Name = message.EnsName + if message.EnsName != "" && contact.EnsName != message.EnsName { + contact.EnsName = message.EnsName publicKey, err := contact.PublicKey() if err != nil { return err @@ -543,6 +543,10 @@ func (m *Messenger) HandleContactUpdate(state *ReceivedMessageState, message pro return ErrMessageNotAllowed } + if err = ValidateDisplayName(&message.DisplayName); err != nil { + return err + } + if !ok { chat = OneToOneFromPublicKey(state.CurrentMessageState.PublicKey, state.Timesource) // We don't want to show the chat to the user @@ -553,10 +557,15 @@ func (m *Messenger) HandleContactUpdate(state *ReceivedMessageState, message pro if contact.LastUpdated < message.Clock { logger.Info("Updating contact") - if contact.Name != message.EnsName { - contact.Name = message.EnsName + if contact.EnsName != message.EnsName { + contact.EnsName = message.EnsName contact.ENSVerified = false } + + if len(message.DisplayName) != 0 { + contact.DisplayName = message.DisplayName + } + contact.HasAddedUs = true contact.LastUpdated = message.Clock state.ModifiedContacts.Store(contact.ID, true) @@ -934,6 +943,11 @@ func (m *Messenger) HandleChatMessage(state *ReceivedMessageState) error { } } + if contact.DisplayName != receivedMessage.DisplayName && len(receivedMessage.DisplayName) != 0 { + contact.DisplayName = receivedMessage.DisplayName + state.ModifiedContacts.Store(contact.ID, true) + } + if receivedMessage.ContentType == protobuf.ChatMessage_COMMUNITY { m.logger.Debug("Handling community content type") @@ -1420,6 +1434,18 @@ func (m *Messenger) HandleChatIdentity(state *ReceivedMessageState, ci protobuf. return err } + contact := state.CurrentMessageState.Contact + + if err = ValidateDisplayName(&ci.DisplayName); err != nil { + return err + } + + if contact.DisplayName != ci.DisplayName && len(ci.DisplayName) != 0 { + contact.DisplayName = ci.DisplayName + state.ModifiedContacts.Store(contact.ID, true) + state.AllContacts.Store(contact.ID, contact) + } + viewFromContacts := s.ProfilePicturesVisibility == accounts.ProfilePicturesVisibilityContactsOnly viewFromNoOne := s.ProfilePicturesVisibility == accounts.ProfilePicturesVisibilityNone @@ -1450,7 +1476,6 @@ func (m *Messenger) HandleChatIdentity(state *ReceivedMessageState, ci protobuf. return ErrMessageNotAllowed } } - contact := state.CurrentMessageState.Contact err = DecryptIdentityImagesWithIdentityPrivateKey(ci.Images, m.identity, state.CurrentMessageState.PublicKey) if err != nil { diff --git a/protocol/messenger_test.go b/protocol/messenger_test.go index e2e2996c6..dd1de7201 100644 --- a/protocol/messenger_test.go +++ b/protocol/messenger_test.go @@ -40,7 +40,7 @@ const ( testContract = "0x314159265dd8dbb310642f98f50c066173c1259b" testValue = "2000" testTransactionHash = "0x412a851ac2ae51cad34a56c8a9cfee55d577ac5e1ac71cf488a2f2093a373799" - newName = "new-name" + newEnsName = "new-name" ) func TestMessengerSuite(t *testing.T) { @@ -708,7 +708,7 @@ func (s *MessengerSuite) TestRetrieveBlockedContact() { publicKeyHex := "0x" + hex.EncodeToString(crypto.FromECDSAPub(&theirMessenger.identity.PublicKey)) blockedContact := Contact{ ID: publicKeyHex, - Name: "contact-name", + EnsName: "contact-name", LastUpdated: 20, Blocked: true, } @@ -995,7 +995,7 @@ func (s *MessengerSuite) TestChangeNameGroupChat() { ) s.Require().NoError(err) - _, err = s.m.ChangeGroupChatName(context.Background(), ourChat.ID, newName) + _, err = s.m.ChangeGroupChatName(context.Background(), ourChat.ID, newEnsName) s.NoError(err) // Retrieve their messages so that the chat is created @@ -1008,7 +1008,7 @@ func (s *MessengerSuite) TestChangeNameGroupChat() { s.Require().Len(response.Chats(), 1) actualChat := response.Chats()[0] - s.Require().Equal(newName, actualChat.Name) + s.Require().Equal(newEnsName, actualChat.Name) s.Require().NoError(theirMessenger.Shutdown()) } @@ -1297,7 +1297,7 @@ func (s *MessengerSuite) TestChatPersistencePrivateGroupChat() { func (s *MessengerSuite) TestBlockContact() { contact := Contact{ ID: testPK, - Name: "contact-name", + EnsName: "contact-name", LastUpdated: 20, Added: true, } diff --git a/protocol/migrations/migrations.go b/protocol/migrations/migrations.go index 3ac31d231..426226c66 100644 --- a/protocol/migrations/migrations.go +++ b/protocol/migrations/migrations.go @@ -1,63 +1,64 @@ -// Code generated by go-bindata. DO NOT EDIT. +// Code generated by go-bindata. // sources: -// 000001_init.down.db.sql (65B) -// 000001_init.up.db.sql (2.719kB) -// 000002_add_last_ens_clock_value.up.sql (77B) -// 1586358095_add_replace.up.sql (224B) -// 1588665364_add_image_data.up.sql (186B) -// 1589365189_add_pow_target.up.sql (66B) -// 1591277220_add_index_messages.up.sql (240B) -// 1593087212_add_mute_chat_and_raw_message_fields.up.sql (215B) -// 1595862781_add_audio_data.up.sql (246B) -// 1595865249_create_emoji_reactions_table.up.sql (300B) -// 1596805115_create_group_chat_invitations_table.up.sql (231B) -// 1597322655_add_invitation_admin_chat_field.up.sql (54B) -// 1597757544_add_nickname.up.sql (52B) -// 1598955122_add_mentions.up.sql (52B) -// 1599641390_add_emoji_reactions_index.up.sql (126B) -// 1599720851_add_seen_index_remove_long_messages.up.sql (150B) -// 1603198582_add_profile_chat_field.up.sql (45B) -// 1603816533_add_links.up.sql (48B) -// 1603888149_create_chat_identity_last_published_table.up.sql (407B) -// 1605075346_add_communities.up.sql (6.971kB) -// 1610117927_add_message_cache.up.sql (142B) -// 1610959908_add_dont_wrap_to_raw_messages.up.sql (83B) -// 1610960912_add_send_on_personal_topic.up.sql (82B) -// 1612870480_add_datasync_id.up.sql (111B) -// 1614152139_add_communities_request_to_join.up.sql (831B) -// 1615374373_add_confirmations.up.sql (227B) -// 1617694931_add_notification_center.up.sql (572B) -// 1618923660_create_pin_messages.up.sql (265B) -// 1619094007_add_joined_chat_field.up.sql (101B) -// 1619099821_add_last_synced_field.up.sql (226B) -// 1621933219_add_mentioned.up.sql (70B) -// 1622010048_add_unviewed_mentions_count.up.sql (114B) -// 1622061278_add_message_activity_center_notification_field.up.sql (80B) -// 1622464518_set_synced_to_from.up.sql (105B) -// 1622464519_add_chat_description.up.sql (93B) -// 1622622253_add_pinned_by_to_pin_messages.up.sql (52B) -// 1623938329_add_author_activity_center_notification_field.up.sql (66B) -// 1623938330_add_edit_messages.up.sql (369B) -// 1624978434_add_muted_community.up.sql (82B) -// 1625018910_add_repply_message_activity_center_notification_field.up.sql (86B) -// 1625762506_add_deleted_messages.up.sql (357B) -// 1627388946_add_communities_synced_at.up.sql (87B) -// 1628280060_create-usermessages-index.sql (80B) -// 1632303896_modify_contacts_table.up.sql (1.574kB) -// 1633349838_add_emoji_column_in_chats.up.sql (52B) -// 1634831235_add_highlight_column_in_chats.up.sql (62B) -// 1634896007_add_last_updated_locally_and_removed.up.sql (131B) -// 1635840039_add_clock_read_at_column_in_chats.up.sql (245B) -// 1637852321_add_received_invitation_admin_column_in_chats.up.sql (72B) -// README.md (554B) -// doc.go (850B) +// 000001_init.down.db.sql +// 000001_init.up.db.sql +// 000002_add_last_ens_clock_value.up.sql +// 1586358095_add_replace.up.sql +// 1588665364_add_image_data.up.sql +// 1589365189_add_pow_target.up.sql +// 1591277220_add_index_messages.up.sql +// 1593087212_add_mute_chat_and_raw_message_fields.up.sql +// 1595862781_add_audio_data.up.sql +// 1595865249_create_emoji_reactions_table.up.sql +// 1596805115_create_group_chat_invitations_table.up.sql +// 1597322655_add_invitation_admin_chat_field.up.sql +// 1597757544_add_nickname.up.sql +// 1598955122_add_mentions.up.sql +// 1599641390_add_emoji_reactions_index.up.sql +// 1599720851_add_seen_index_remove_long_messages.up.sql +// 1603198582_add_profile_chat_field.up.sql +// 1603816533_add_links.up.sql +// 1603888149_create_chat_identity_last_published_table.up.sql +// 1605075346_add_communities.up.sql +// 1610117927_add_message_cache.up.sql +// 1610959908_add_dont_wrap_to_raw_messages.up.sql +// 1610960912_add_send_on_personal_topic.up.sql +// 1612870480_add_datasync_id.up.sql +// 1614152139_add_communities_request_to_join.up.sql +// 1615374373_add_confirmations.up.sql +// 1617694931_add_notification_center.up.sql +// 1618923660_create_pin_messages.up.sql +// 1619094007_add_joined_chat_field.up.sql +// 1619099821_add_last_synced_field.up.sql +// 1621933219_add_mentioned.up.sql +// 1622010048_add_unviewed_mentions_count.up.sql +// 1622061278_add_message_activity_center_notification_field.up.sql +// 1622464518_set_synced_to_from.up.sql +// 1622464519_add_chat_description.up.sql +// 1622622253_add_pinned_by_to_pin_messages.up.sql +// 1623938329_add_author_activity_center_notification_field.up.sql +// 1623938330_add_edit_messages.up.sql +// 1624978434_add_muted_community.up.sql +// 1625018910_add_repply_message_activity_center_notification_field.up.sql +// 1625762506_add_deleted_messages.up.sql +// 1627388946_add_communities_synced_at.up.sql +// 1628280060_create-usermessages-index.sql +// 1632303896_modify_contacts_table.up.sql +// 1633349838_add_emoji_column_in_chats.up.sql +// 1634831235_add_highlight_column_in_chats.up.sql +// 1634896007_add_last_updated_locally_and_removed.up.sql +// 1635840039_add_clock_read_at_column_in_chats.up.sql +// 1637852321_add_received_invitation_admin_column_in_chats.up.sql +// 1645034601_display_name.up.sql +// README.md +// doc.go +// DO NOT EDIT! package migrations import ( "bytes" "compress/gzip" - "crypto/sha256" "fmt" "io" "io/ioutil" @@ -70,7 +71,7 @@ import ( func bindataRead(data []byte, name string) ([]byte, error) { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) + return nil, fmt.Errorf("Read %q: %v", name, err) } var buf bytes.Buffer @@ -78,7 +79,7 @@ func bindataRead(data []byte, name string) ([]byte, error) { clErr := gz.Close() if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) + return nil, fmt.Errorf("Read %q: %v", name, err) } if clErr != nil { return nil, err @@ -88,9 +89,8 @@ func bindataRead(data []byte, name string) ([]byte, error) { } type asset struct { - bytes []byte - info os.FileInfo - digest [sha256.Size]byte + bytes []byte + info os.FileInfo } type bindataFileInfo struct { @@ -134,8 +134,8 @@ func _000001_initDownDbSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "000001_init.down.db.sql", size: 65, mode: os.FileMode(0644), modTime: time.Unix(1585751575, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x5e, 0xbb, 0x3f, 0x1, 0x75, 0x19, 0x70, 0x86, 0xa7, 0x34, 0x40, 0x17, 0x34, 0x3e, 0x18, 0x51, 0x79, 0xd4, 0x22, 0xad, 0x8f, 0x80, 0xcc, 0xa6, 0xcc, 0x6, 0x2b, 0x62, 0x2, 0x47, 0xba, 0xf9}} + info := bindataFileInfo{name: "000001_init.down.db.sql", size: 65, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -154,8 +154,8 @@ func _000001_initUpDbSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "000001_init.up.db.sql", size: 2719, mode: os.FileMode(0644), modTime: time.Unix(1585751575, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x60, 0xdc, 0xeb, 0xe, 0xc2, 0x4f, 0x75, 0xa, 0xf6, 0x3e, 0xc7, 0xc4, 0x4, 0xe2, 0xe1, 0xa4, 0x73, 0x2f, 0x4a, 0xad, 0x1a, 0x0, 0xc3, 0x93, 0x9d, 0x77, 0x3e, 0x31, 0x91, 0x77, 0x2e, 0xc8}} + info := bindataFileInfo{name: "000001_init.up.db.sql", size: 2719, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -174,8 +174,8 @@ func _000002_add_last_ens_clock_valueUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "000002_add_last_ens_clock_value.up.sql", size: 77, mode: os.FileMode(0644), modTime: time.Unix(1589413297, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4d, 0x3, 0x8f, 0xd5, 0x85, 0x83, 0x47, 0xbe, 0xf9, 0x82, 0x7e, 0x81, 0xa4, 0xbd, 0xaa, 0xd5, 0x98, 0x18, 0x5, 0x2d, 0x82, 0x42, 0x3b, 0x3, 0x50, 0xc3, 0x1e, 0x84, 0x35, 0xf, 0xb6, 0x2b}} + info := bindataFileInfo{name: "000002_add_last_ens_clock_value.up.sql", size: 77, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -194,8 +194,8 @@ func _1586358095_add_replaceUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1586358095_add_replace.up.sql", size: 224, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd2, 0xb3, 0xa9, 0xc7, 0x7f, 0x9d, 0x8f, 0x43, 0x8c, 0x9e, 0x58, 0x8d, 0x44, 0xbc, 0xfa, 0x6b, 0x5f, 0x3f, 0x5a, 0xbe, 0xe8, 0xb1, 0x16, 0xf, 0x91, 0x2a, 0xa0, 0x71, 0xbb, 0x8d, 0x6b, 0xcb}} + info := bindataFileInfo{name: "1586358095_add_replace.up.sql", size: 224, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -214,8 +214,8 @@ func _1588665364_add_image_dataUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1588665364_add_image_data.up.sql", size: 186, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd6, 0xc6, 0x35, 0xb4, 0x4c, 0x39, 0x96, 0x29, 0x30, 0xda, 0xf4, 0x8f, 0xcb, 0xf1, 0x9f, 0x84, 0xdc, 0x88, 0xd4, 0xd5, 0xbc, 0xb6, 0x5b, 0x46, 0x78, 0x67, 0x76, 0x1a, 0x5, 0x36, 0xdc, 0xe5}} + info := bindataFileInfo{name: "1588665364_add_image_data.up.sql", size: 186, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -234,8 +234,8 @@ func _1589365189_add_pow_targetUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1589365189_add_pow_target.up.sql", size: 66, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4e, 0x3a, 0xe2, 0x2e, 0x7d, 0xaf, 0xbb, 0xcc, 0x21, 0xa1, 0x7a, 0x41, 0x9a, 0xd0, 0xbb, 0xa9, 0xc8, 0x35, 0xf9, 0x32, 0x34, 0x46, 0x44, 0x9a, 0x86, 0x40, 0x7c, 0xb9, 0x23, 0xc7, 0x3, 0x3f}} + info := bindataFileInfo{name: "1589365189_add_pow_target.up.sql", size: 66, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -254,8 +254,8 @@ func _1591277220_add_index_messagesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1591277220_add_index_messages.up.sql", size: 240, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9c, 0xfe, 0xbe, 0xd5, 0xb8, 0x8f, 0xdd, 0xef, 0xbb, 0xa8, 0xad, 0x7f, 0xed, 0x5b, 0x5b, 0x2f, 0xe6, 0x82, 0x27, 0x78, 0x1f, 0xb9, 0x57, 0xdc, 0x8, 0xc2, 0xb2, 0xa9, 0x9a, 0x4, 0xe1, 0x7a}} + info := bindataFileInfo{name: "1591277220_add_index_messages.up.sql", size: 240, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -274,8 +274,8 @@ func _1593087212_add_mute_chat_and_raw_message_fieldsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1593087212_add_mute_chat_and_raw_message_fields.up.sql", size: 215, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x73, 0x99, 0x61, 0xd1, 0xaa, 0xb4, 0xbf, 0xaf, 0xd7, 0x20, 0x17, 0x40, 0xf9, 0x2, 0xfb, 0xcc, 0x40, 0x2a, 0xd, 0x86, 0x36, 0x30, 0x88, 0x89, 0x25, 0x80, 0x42, 0xb0, 0x5b, 0xe9, 0x73, 0x78}} + info := bindataFileInfo{name: "1593087212_add_mute_chat_and_raw_message_fields.up.sql", size: 215, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -294,8 +294,8 @@ func _1595862781_add_audio_dataUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1595862781_add_audio_data.up.sql", size: 246, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xae, 0xd2, 0xee, 0x55, 0xfb, 0x36, 0xa4, 0x92, 0x66, 0xe, 0x81, 0x62, 0x1e, 0x7a, 0x69, 0xa, 0xd5, 0x4b, 0xa5, 0x6a, 0x8d, 0x1d, 0xce, 0xf3, 0x3e, 0xc0, 0x5f, 0x9c, 0x66, 0x1b, 0xb4, 0xed}} + info := bindataFileInfo{name: "1595862781_add_audio_data.up.sql", size: 246, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -314,8 +314,8 @@ func _1595865249_create_emoji_reactions_tableUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1595865249_create_emoji_reactions_table.up.sql", size: 300, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3e, 0xc5, 0x43, 0x5c, 0x3d, 0x53, 0x43, 0x2c, 0x1a, 0xa5, 0xb6, 0xbf, 0x7, 0x4, 0x5a, 0x3e, 0x40, 0x8b, 0xa4, 0x57, 0x12, 0x58, 0xbc, 0x42, 0xe2, 0xc3, 0xde, 0x76, 0x98, 0x80, 0xe2, 0xbe}} + info := bindataFileInfo{name: "1595865249_create_emoji_reactions_table.up.sql", size: 300, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -334,8 +334,8 @@ func _1596805115_create_group_chat_invitations_tableUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1596805115_create_group_chat_invitations_table.up.sql", size: 231, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6d, 0xb1, 0x14, 0x6d, 0x54, 0x28, 0x67, 0xc3, 0x23, 0x6a, 0xfc, 0x80, 0xdf, 0x9e, 0x4c, 0x35, 0x36, 0xf, 0xf8, 0xf3, 0x5f, 0xae, 0xad, 0xb, 0xc1, 0x51, 0x8e, 0x17, 0x7, 0xe5, 0x7f, 0x91}} + info := bindataFileInfo{name: "1596805115_create_group_chat_invitations_table.up.sql", size: 231, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -354,8 +354,8 @@ func _1597322655_add_invitation_admin_chat_fieldUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1597322655_add_invitation_admin_chat_field.up.sql", size: 54, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa9, 0x7a, 0xa0, 0xf2, 0xdb, 0x13, 0x91, 0x91, 0xa8, 0x34, 0x1a, 0xa1, 0x49, 0x68, 0xd5, 0xae, 0x2c, 0xd8, 0xd5, 0xea, 0x8f, 0x8c, 0xc7, 0x2, 0x4e, 0x58, 0x2c, 0x3a, 0x14, 0xd4, 0x4f, 0x2c}} + info := bindataFileInfo{name: "1597322655_add_invitation_admin_chat_field.up.sql", size: 54, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -374,8 +374,8 @@ func _1597757544_add_nicknameUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1597757544_add_nickname.up.sql", size: 52, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf4, 0xa2, 0x64, 0x50, 0xc5, 0x4, 0xb9, 0x8b, 0xd1, 0x18, 0x9b, 0xc3, 0x91, 0x36, 0x2a, 0x1f, 0xc3, 0x6c, 0x2d, 0x92, 0xf8, 0x5e, 0xff, 0xb1, 0x59, 0x61, 0x2, 0x1c, 0xe1, 0x85, 0x90, 0xa4}} + info := bindataFileInfo{name: "1597757544_add_nickname.up.sql", size: 52, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -394,8 +394,8 @@ func _1598955122_add_mentionsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1598955122_add_mentions.up.sql", size: 52, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x8d, 0x22, 0x17, 0x92, 0xd2, 0x11, 0x4e, 0x7, 0x93, 0x9a, 0x55, 0xfd, 0xb, 0x97, 0xc4, 0x63, 0x6a, 0x81, 0x97, 0xcd, 0xb2, 0xf8, 0x4b, 0x5f, 0x3c, 0xfa, 0x3a, 0x38, 0x53, 0x10, 0xed, 0x9d}} + info := bindataFileInfo{name: "1598955122_add_mentions.up.sql", size: 52, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -414,8 +414,8 @@ func _1599641390_add_emoji_reactions_indexUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1599641390_add_emoji_reactions_index.up.sql", size: 126, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf9, 0xd8, 0xdc, 0xa7, 0xb, 0x92, 0x7a, 0x61, 0x37, 0x24, 0x1c, 0x77, 0x5e, 0xe, 0x7e, 0xfc, 0x9f, 0x98, 0x7b, 0x65, 0xe7, 0xf9, 0x71, 0x57, 0x89, 0x2d, 0x90, 0x1b, 0xf6, 0x5e, 0x37, 0xe8}} + info := bindataFileInfo{name: "1599641390_add_emoji_reactions_index.up.sql", size: 126, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -434,8 +434,8 @@ func _1599720851_add_seen_index_remove_long_messagesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1599720851_add_seen_index_remove_long_messages.up.sql", size: 150, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x24, 0x1c, 0xc4, 0x78, 0x91, 0xc7, 0xeb, 0xfe, 0xc8, 0xa0, 0xd8, 0x13, 0x27, 0x97, 0xc8, 0x96, 0x56, 0x97, 0x33, 0x2c, 0x1e, 0x16, 0x8a, 0xd3, 0x49, 0x99, 0x3, 0xe9, 0xbb, 0xc4, 0x5, 0x3c}} + info := bindataFileInfo{name: "1599720851_add_seen_index_remove_long_messages.up.sql", size: 150, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -454,8 +454,8 @@ func _1603198582_add_profile_chat_fieldUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1603198582_add_profile_chat_field.up.sql", size: 45, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xaa, 0xca, 0xe, 0x46, 0xa0, 0x9, 0x9d, 0x47, 0x57, 0xe9, 0xfb, 0x17, 0xeb, 0x9c, 0xf6, 0xb8, 0x1d, 0xe9, 0xd, 0x0, 0xd5, 0xe5, 0xd8, 0x9e, 0x60, 0xa, 0xbf, 0x32, 0x2c, 0x52, 0x7f, 0x6a}} + info := bindataFileInfo{name: "1603198582_add_profile_chat_field.up.sql", size: 45, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -474,8 +474,8 @@ func _1603816533_add_linksUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1603816533_add_links.up.sql", size: 48, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc9, 0x24, 0xd6, 0x1d, 0xa, 0x83, 0x1e, 0x4d, 0xf, 0xae, 0x4d, 0x8c, 0x51, 0x32, 0xa8, 0x37, 0xb0, 0x14, 0xfb, 0x32, 0x34, 0xc8, 0xc, 0x4e, 0x5b, 0xc5, 0x15, 0x65, 0x73, 0x0, 0x0, 0x1d}} + info := bindataFileInfo{name: "1603816533_add_links.up.sql", size: 48, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -494,8 +494,8 @@ func _1603888149_create_chat_identity_last_published_tableUpSql() (*asset, error return nil, err } - info := bindataFileInfo{name: "1603888149_create_chat_identity_last_published_table.up.sql", size: 407, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x7f, 0x9, 0xf, 0xfb, 0xdb, 0x3c, 0x86, 0x70, 0x82, 0xda, 0x10, 0x25, 0xe2, 0x4e, 0x40, 0x45, 0xab, 0x8b, 0x1c, 0x91, 0x7c, 0xf1, 0x70, 0x2e, 0x81, 0xf3, 0x71, 0x45, 0xda, 0xe2, 0xa4, 0x57}} + info := bindataFileInfo{name: "1603888149_create_chat_identity_last_published_table.up.sql", size: 407, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -514,8 +514,8 @@ func _1605075346_add_communitiesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1605075346_add_communities.up.sql", size: 6971, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1f, 0x64, 0xea, 0xb4, 0xae, 0x9e, 0xdb, 0x9, 0x58, 0xb6, 0x5c, 0x7a, 0x50, 0xc5, 0xfe, 0x93, 0x5d, 0x36, 0x85, 0x5d, 0x6a, 0xba, 0xc9, 0x7e, 0x84, 0xd7, 0xbf, 0x2a, 0x53, 0xf3, 0x97, 0xf1}} + info := bindataFileInfo{name: "1605075346_add_communities.up.sql", size: 6971, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -534,8 +534,8 @@ func _1610117927_add_message_cacheUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1610117927_add_message_cache.up.sql", size: 142, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x34, 0xf1, 0xf0, 0x82, 0x79, 0x28, 0x19, 0xc2, 0x39, 0x6a, 0xa5, 0x96, 0x59, 0x23, 0xa0, 0xed, 0x60, 0x58, 0x86, 0x9, 0xb9, 0xad, 0xfb, 0xa, 0xe3, 0x47, 0x6e, 0xa1, 0x18, 0xe8, 0x39, 0x2c}} + info := bindataFileInfo{name: "1610117927_add_message_cache.up.sql", size: 142, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -554,8 +554,8 @@ func _1610959908_add_dont_wrap_to_raw_messagesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1610959908_add_dont_wrap_to_raw_messages.up.sql", size: 83, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x71, 0x2, 0x9a, 0xca, 0xd4, 0x38, 0x44, 0x30, 0x2b, 0xa8, 0x27, 0x32, 0x63, 0x53, 0x22, 0x60, 0x59, 0x84, 0x23, 0x96, 0x77, 0xf0, 0x56, 0xd7, 0x94, 0xe0, 0x95, 0x28, 0x6, 0x1d, 0x4e, 0xb1}} + info := bindataFileInfo{name: "1610959908_add_dont_wrap_to_raw_messages.up.sql", size: 83, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -574,8 +574,8 @@ func _1610960912_add_send_on_personal_topicUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1610960912_add_send_on_personal_topic.up.sql", size: 82, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x77, 0xac, 0x2f, 0xc4, 0xd, 0xa7, 0x1b, 0x37, 0x30, 0xc2, 0x68, 0xee, 0xde, 0x54, 0x5e, 0xbf, 0x3f, 0xa0, 0xd6, 0xc6, 0x9f, 0xd4, 0x34, 0x12, 0x76, 0x1e, 0x66, 0x4a, 0xfc, 0xf, 0xee, 0xc9}} + info := bindataFileInfo{name: "1610960912_add_send_on_personal_topic.up.sql", size: 82, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -594,8 +594,8 @@ func _1612870480_add_datasync_idUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1612870480_add_datasync_id.up.sql", size: 111, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x34, 0x9a, 0xbc, 0xfa, 0xaa, 0x8c, 0x9c, 0x37, 0x67, 0x15, 0x9c, 0x7e, 0x78, 0x75, 0x66, 0x82, 0x18, 0x72, 0x10, 0xbc, 0xd4, 0xab, 0x44, 0xfe, 0x57, 0x85, 0x6d, 0x19, 0xf5, 0x96, 0x8a, 0xbe}} + info := bindataFileInfo{name: "1612870480_add_datasync_id.up.sql", size: 111, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -614,8 +614,8 @@ func _1614152139_add_communities_request_to_joinUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1614152139_add_communities_request_to_join.up.sql", size: 831, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x11, 0x3, 0x26, 0xf9, 0x29, 0x50, 0x4f, 0xcd, 0x46, 0xe5, 0xb1, 0x6b, 0xb9, 0x2, 0x40, 0xb1, 0xdf, 0x4a, 0x4c, 0x7a, 0xda, 0x3, 0x35, 0xcd, 0x2d, 0xcc, 0x80, 0x7d, 0x57, 0x5f, 0x3, 0x5c}} + info := bindataFileInfo{name: "1614152139_add_communities_request_to_join.up.sql", size: 831, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -634,8 +634,8 @@ func _1615374373_add_confirmationsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1615374373_add_confirmations.up.sql", size: 227, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xdd, 0xa6, 0x65, 0xc5, 0x1d, 0xb2, 0x77, 0x36, 0xe3, 0x79, 0xda, 0xe8, 0x7a, 0xa4, 0xdf, 0x45, 0xae, 0xd8, 0xb4, 0xba, 0x90, 0xfd, 0x74, 0x71, 0x14, 0x75, 0x73, 0x72, 0xb9, 0x9e, 0x1, 0x81}} + info := bindataFileInfo{name: "1615374373_add_confirmations.up.sql", size: 227, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -654,8 +654,8 @@ func _1617694931_add_notification_centerUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1617694931_add_notification_center.up.sql", size: 572, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x10, 0x45, 0xc6, 0xc9, 0x73, 0xbb, 0x1f, 0xda, 0xa3, 0x4d, 0x19, 0x98, 0x85, 0x2d, 0xca, 0xda, 0xcc, 0x3b, 0x32, 0xff, 0xc7, 0x7b, 0xe3, 0x9f, 0x9b, 0x2a, 0x93, 0xf5, 0xdf, 0x65, 0x38, 0x91}} + info := bindataFileInfo{name: "1617694931_add_notification_center.up.sql", size: 572, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -674,8 +674,8 @@ func _1618923660_create_pin_messagesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1618923660_create_pin_messages.up.sql", size: 265, mode: os.FileMode(0644), modTime: time.Unix(1623074824, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x61, 0x44, 0x3a, 0xbe, 0x30, 0xd2, 0x7e, 0xc0, 0xe2, 0x8e, 0x65, 0x53, 0x54, 0xbb, 0x7a, 0x1c, 0xb3, 0x5d, 0xd2, 0xa6, 0xa9, 0x28, 0xb7, 0xa4, 0x5f, 0x8b, 0x9, 0x5f, 0x17, 0xc1, 0x85, 0x21}} + info := bindataFileInfo{name: "1618923660_create_pin_messages.up.sql", size: 265, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -694,8 +694,8 @@ func _1619094007_add_joined_chat_fieldUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1619094007_add_joined_chat_field.up.sql", size: 101, mode: os.FileMode(0644), modTime: time.Unix(1623331301, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfa, 0x30, 0x81, 0x3a, 0x2f, 0x9f, 0xb3, 0x0, 0x55, 0x8e, 0x1d, 0xa8, 0xb0, 0x68, 0xf0, 0x40, 0x1a, 0x6c, 0xaa, 0xfc, 0x33, 0xd1, 0xd1, 0x55, 0x3f, 0xf2, 0xbd, 0x54, 0xa1, 0x2b, 0x40, 0x95}} + info := bindataFileInfo{name: "1619094007_add_joined_chat_field.up.sql", size: 101, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -714,8 +714,8 @@ func _1619099821_add_last_synced_fieldUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1619099821_add_last_synced_field.up.sql", size: 226, mode: os.FileMode(0644), modTime: time.Unix(1623331301, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf, 0x52, 0x22, 0xe, 0x2f, 0xd7, 0x93, 0x5f, 0x42, 0xc2, 0x93, 0x4, 0x35, 0x6f, 0xc9, 0x19, 0xed, 0x6b, 0x52, 0x6f, 0xae, 0x99, 0xe2, 0x68, 0x3d, 0x4f, 0x40, 0xe, 0xe1, 0xa, 0x47, 0x21}} + info := bindataFileInfo{name: "1619099821_add_last_synced_field.up.sql", size: 226, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -734,8 +734,8 @@ func _1621933219_add_mentionedUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1621933219_add_mentioned.up.sql", size: 70, mode: os.FileMode(0644), modTime: time.Unix(1623331301, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x36, 0x76, 0x8a, 0xc9, 0x7, 0x8f, 0xa5, 0xcb, 0x12, 0x21, 0x4e, 0xfe, 0x96, 0x77, 0xcf, 0x7f, 0x76, 0x75, 0x36, 0x2c, 0xf8, 0x1d, 0x13, 0xcb, 0xcd, 0x6e, 0x70, 0xbf, 0xf5, 0x93, 0x67, 0xd1}} + info := bindataFileInfo{name: "1621933219_add_mentioned.up.sql", size: 70, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -754,8 +754,8 @@ func _1622010048_add_unviewed_mentions_countUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1622010048_add_unviewed_mentions_count.up.sql", size: 114, mode: os.FileMode(0644), modTime: time.Unix(1623331301, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x7c, 0x16, 0x85, 0xa6, 0x5b, 0xe1, 0x66, 0xb9, 0x84, 0xbe, 0x7f, 0xa, 0x77, 0x23, 0xb9, 0xef, 0x8e, 0x2, 0x8, 0xfc, 0x61, 0xb2, 0x43, 0xa9, 0x63, 0xae, 0xb4, 0xdf, 0x30, 0xb1, 0x61, 0x4b}} + info := bindataFileInfo{name: "1622010048_add_unviewed_mentions_count.up.sql", size: 114, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -774,8 +774,8 @@ func _1622061278_add_message_activity_center_notification_fieldUpSql() (*asset, return nil, err } - info := bindataFileInfo{name: "1622061278_add_message_activity_center_notification_field.up.sql", size: 80, mode: os.FileMode(0644), modTime: time.Unix(1623331301, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x8, 0xc, 0xa6, 0x1f, 0xa5, 0xc6, 0x7c, 0x6f, 0xab, 0x2c, 0x2d, 0xb5, 0xa4, 0xdd, 0xc1, 0xd6, 0x44, 0x83, 0xf9, 0xb1, 0xa5, 0xce, 0x34, 0x3d, 0x2, 0xa9, 0x35, 0xcf, 0xc6, 0xb2, 0x43, 0x37}} + info := bindataFileInfo{name: "1622061278_add_message_activity_center_notification_field.up.sql", size: 80, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -794,8 +794,8 @@ func _1622464518_set_synced_to_fromUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1622464518_set_synced_to_from.up.sql", size: 105, mode: os.FileMode(0644), modTime: time.Unix(1623331301, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x33, 0x3e, 0x2b, 0xa, 0x1e, 0xc7, 0x6d, 0x6f, 0xd1, 0x1d, 0xe8, 0x4b, 0xdd, 0x92, 0x76, 0xea, 0xf2, 0x3e, 0x15, 0x85, 0xc4, 0xc3, 0x31, 0xf1, 0xc0, 0xa2, 0xd7, 0x47, 0xde, 0x4e, 0xfd, 0xc6}} + info := bindataFileInfo{name: "1622464518_set_synced_to_from.up.sql", size: 105, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -814,8 +814,8 @@ func _1622464519_add_chat_descriptionUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1622464519_add_chat_description.up.sql", size: 93, mode: os.FileMode(0644), modTime: time.Unix(1623331301, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x36, 0x2e, 0x89, 0x31, 0xec, 0xef, 0xeb, 0x43, 0xf5, 0x96, 0x6d, 0xce, 0x91, 0x8a, 0x37, 0x2a, 0x11, 0x7a, 0x3f, 0xd9, 0x10, 0xbb, 0xa1, 0xbc, 0x7, 0xe0, 0x3b, 0xa5, 0xf4, 0xa6, 0xf4, 0xa1}} + info := bindataFileInfo{name: "1622464519_add_chat_description.up.sql", size: 93, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -834,8 +834,8 @@ func _1622622253_add_pinned_by_to_pin_messagesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1622622253_add_pinned_by_to_pin_messages.up.sql", size: 52, mode: os.FileMode(0644), modTime: time.Unix(1628512368, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9b, 0x94, 0xa3, 0x45, 0x91, 0x1e, 0x66, 0xd1, 0x96, 0x5a, 0xaf, 0xfa, 0x29, 0x39, 0xa8, 0x3a, 0x97, 0x4c, 0x65, 0x6, 0x96, 0x90, 0x4c, 0xfe, 0xce, 0x7d, 0x5d, 0xd4, 0xb3, 0x8, 0x6d, 0x5f}} + info := bindataFileInfo{name: "1622622253_add_pinned_by_to_pin_messages.up.sql", size: 52, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -854,8 +854,8 @@ func _1623938329_add_author_activity_center_notification_fieldUpSql() (*asset, e return nil, err } - info := bindataFileInfo{name: "1623938329_add_author_activity_center_notification_field.up.sql", size: 66, mode: os.FileMode(0644), modTime: time.Unix(1628714143, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x36, 0xe6, 0xa7, 0xd5, 0x26, 0xff, 0xab, 0x92, 0x88, 0xf0, 0xd3, 0x34, 0xd9, 0x2f, 0xe7, 0x18, 0x1a, 0x40, 0xf9, 0xbe, 0x8e, 0xfc, 0xd0, 0x4f, 0x1f, 0x4a, 0xb9, 0x83, 0x3f, 0xa9, 0xde, 0xb}} + info := bindataFileInfo{name: "1623938329_add_author_activity_center_notification_field.up.sql", size: 66, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -874,8 +874,8 @@ func _1623938330_add_edit_messagesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1623938330_add_edit_messages.up.sql", size: 369, mode: os.FileMode(0644), modTime: time.Unix(1628714143, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x7e, 0xd2, 0xce, 0xe, 0x5c, 0x19, 0xbe, 0x5e, 0x29, 0xbe, 0x9b, 0x31, 0x53, 0x76, 0xb2, 0xc8, 0x56, 0xf0, 0x82, 0xfe, 0x7d, 0x6c, 0xe8, 0x5c, 0xe9, 0x7a, 0x5d, 0x5, 0xc4, 0x92, 0x38, 0xe3}} + info := bindataFileInfo{name: "1623938330_add_edit_messages.up.sql", size: 369, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -894,8 +894,8 @@ func _1624978434_add_muted_communityUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1624978434_add_muted_community.up.sql", size: 82, mode: os.FileMode(0644), modTime: time.Unix(1628714143, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6, 0xdc, 0x6e, 0x6f, 0x97, 0xc7, 0x3d, 0x50, 0xab, 0x80, 0x87, 0x44, 0x43, 0x38, 0xe6, 0xc5, 0xc1, 0x91, 0x26, 0xf, 0x16, 0xe, 0xd9, 0x32, 0x37, 0x25, 0x96, 0x25, 0x6, 0xc8, 0xb5, 0x4a}} + info := bindataFileInfo{name: "1624978434_add_muted_community.up.sql", size: 82, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -914,8 +914,8 @@ func _1625018910_add_repply_message_activity_center_notification_fieldUpSql() (* return nil, err } - info := bindataFileInfo{name: "1625018910_add_repply_message_activity_center_notification_field.up.sql", size: 86, mode: os.FileMode(0644), modTime: time.Unix(1628714143, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf2, 0x52, 0x12, 0x40, 0xd8, 0x6f, 0x71, 0x97, 0x46, 0x39, 0xaa, 0x74, 0x41, 0xcd, 0x45, 0x4c, 0xe8, 0xd9, 0xe2, 0x56, 0x8e, 0x78, 0x18, 0x62, 0xf6, 0xa8, 0x36, 0xe9, 0x9a, 0x1f, 0xc, 0xb1}} + info := bindataFileInfo{name: "1625018910_add_repply_message_activity_center_notification_field.up.sql", size: 86, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -934,8 +934,8 @@ func _1625762506_add_deleted_messagesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1625762506_add_deleted_messages.up.sql", size: 357, mode: os.FileMode(0644), modTime: time.Unix(1628714143, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd5, 0x61, 0x42, 0xb6, 0x8c, 0x7f, 0x2d, 0xec, 0xa9, 0x6d, 0x3d, 0x0, 0xa3, 0x32, 0xd8, 0x4a, 0x38, 0x5c, 0x97, 0xfc, 0x68, 0xde, 0xa9, 0xb7, 0xd8, 0xde, 0xb, 0x29, 0x93, 0xdc, 0x81, 0xf8}} + info := bindataFileInfo{name: "1625762506_add_deleted_messages.up.sql", size: 357, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -954,8 +954,8 @@ func _1627388946_add_communities_synced_atUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1627388946_add_communities_synced_at.up.sql", size: 87, mode: os.FileMode(0644), modTime: time.Unix(1628714143, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc1, 0xbd, 0x9b, 0x6a, 0xc9, 0x1a, 0x7a, 0x34, 0xcf, 0x5f, 0x80, 0x9e, 0x8c, 0x1c, 0xc0, 0xec, 0x4e, 0x78, 0xb0, 0x2d, 0x15, 0x77, 0x38, 0x4a, 0x6a, 0x5, 0x84, 0xf5, 0x8d, 0x8b, 0xbe, 0x9}} + info := bindataFileInfo{name: "1627388946_add_communities_synced_at.up.sql", size: 87, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -974,8 +974,8 @@ func _1628280060_createUsermessagesIndexSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1628280060_create-usermessages-index.sql", size: 80, mode: os.FileMode(0644), modTime: time.Unix(1633078507, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x10, 0x6f, 0x70, 0x47, 0x40, 0xab, 0xa8, 0x60, 0xe0, 0xf9, 0x8, 0x7e, 0x19, 0x9d, 0xba, 0x33, 0x16, 0xfc, 0x3c, 0xdc, 0xa8, 0xa6, 0x53, 0x61, 0x39, 0x82, 0x91, 0xcf, 0x69, 0xd8, 0xf2, 0xcf}} + info := bindataFileInfo{name: "1628280060_create-usermessages-index.sql", size: 80, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -994,8 +994,8 @@ func _1632303896_modify_contacts_tableUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1632303896_modify_contacts_table.up.sql", size: 1574, mode: os.FileMode(0644), modTime: time.Unix(1635152717, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x81, 0x1e, 0x6c, 0x3c, 0xd, 0xd7, 0x7d, 0xbb, 0x19, 0xbc, 0xe4, 0x7, 0xfd, 0xf8, 0x66, 0x6d, 0x78, 0xf6, 0x4, 0xe6, 0x51, 0xe4, 0xe6, 0xdc, 0xe, 0x5a, 0x2e, 0xac, 0xe6, 0xe7, 0x24, 0x69}} + info := bindataFileInfo{name: "1632303896_modify_contacts_table.up.sql", size: 1574, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -1014,8 +1014,8 @@ func _1633349838_add_emoji_column_in_chatsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1633349838_add_emoji_column_in_chats.up.sql", size: 52, mode: os.FileMode(0644), modTime: time.Unix(1635152717, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xcb, 0x33, 0xcb, 0x3b, 0xa9, 0x99, 0x77, 0x6a, 0xea, 0xc4, 0x39, 0xd7, 0xa1, 0x49, 0xa7, 0xdf, 0xff, 0x72, 0xda, 0x34, 0x21, 0x67, 0x66, 0xca, 0x65, 0x46, 0x1, 0xa6, 0x4e, 0xf9, 0x38, 0x86}} + info := bindataFileInfo{name: "1633349838_add_emoji_column_in_chats.up.sql", size: 52, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -1034,8 +1034,8 @@ func _1634831235_add_highlight_column_in_chatsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1634831235_add_highlight_column_in_chats.up.sql", size: 62, mode: os.FileMode(0644), modTime: time.Unix(1635152717, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xaa, 0x63, 0x5c, 0x73, 0x19, 0x83, 0xbd, 0x35, 0x80, 0x9f, 0x66, 0xec, 0x4c, 0xbc, 0x9d, 0x2d, 0x52, 0x91, 0x6d, 0xb3, 0x2b, 0x87, 0xde, 0x24, 0x46, 0x5c, 0xd, 0xfd, 0x78, 0xf5, 0xe3, 0xe9}} + info := bindataFileInfo{name: "1634831235_add_highlight_column_in_chats.up.sql", size: 62, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -1054,8 +1054,8 @@ func _1634896007_add_last_updated_locally_and_removedUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1634896007_add_last_updated_locally_and_removed.up.sql", size: 131, mode: os.FileMode(0644), modTime: time.Unix(1637232499, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x2e, 0xa8, 0x34, 0xe2, 0xc0, 0x62, 0xc8, 0xd6, 0x5a, 0x87, 0xe3, 0x70, 0xe1, 0xc4, 0x16, 0x9c, 0x60, 0x2e, 0x98, 0xf0, 0x91, 0x84, 0xbe, 0xe0, 0xdf, 0x3e, 0x4d, 0x24, 0xc4, 0x6c, 0x40, 0x17}} + info := bindataFileInfo{name: "1634896007_add_last_updated_locally_and_removed.up.sql", size: 131, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -1074,8 +1074,8 @@ func _1635840039_add_clock_read_at_column_in_chatsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1635840039_add_clock_read_at_column_in_chats.up.sql", size: 245, mode: os.FileMode(0644), modTime: time.Unix(1635982167, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6c, 0xba, 0x3f, 0xba, 0x1a, 0x71, 0xa8, 0x9, 0x19, 0xbe, 0x1e, 0x38, 0x50, 0x30, 0x3a, 0x52, 0x15, 0x29, 0xee, 0x49, 0x19, 0x6f, 0x53, 0xc2, 0xc6, 0x6c, 0xd9, 0x80, 0x7e, 0xb9, 0x58, 0x7a}} + info := bindataFileInfo{name: "1635840039_add_clock_read_at_column_in_chats.up.sql", size: 245, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -1094,8 +1094,28 @@ func _1637852321_add_received_invitation_admin_column_in_chatsUpSql() (*asset, e return nil, err } - info := bindataFileInfo{name: "1637852321_add_received_invitation_admin_column_in_chats.up.sql", size: 72, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x70, 0x8b, 0x92, 0x56, 0x83, 0x70, 0x7f, 0x6, 0xb2, 0xd, 0x1c, 0x2f, 0xcc, 0x93, 0xc3, 0x85, 0x8c, 0xc2, 0x38, 0x94, 0x7e, 0x88, 0x3f, 0x39, 0x34, 0xf8, 0x90, 0xcf, 0x83, 0x68, 0x3d, 0xe5}} + info := bindataFileInfo{name: "1637852321_add_received_invitation_admin_column_in_chats.up.sql", size: 72, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __1645034601_display_nameUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\xf4\x09\x71\x0d\x52\x08\x71\x74\xf2\x71\x55\x48\xce\xcf\x2b\x49\x4c\x2e\x29\x56\x70\x74\x71\x51\x70\xf6\xf7\x09\xf5\xf5\x53\x48\xc9\x2c\x2e\xc8\x49\xac\x8c\xcf\x4b\xcc\x4d\x55\x08\x71\x8d\x08\x51\xf0\xf3\x0f\x51\xf0\x0b\xf5\xf1\x51\x70\x71\x75\x73\x0c\xf5\x09\x51\x50\x52\xb2\xe6\x0a\x0d\x70\x71\x0c\x41\x32\x21\xd8\x35\x04\x55\xab\x2d\x58\x19\x20\x00\x00\xff\xff\xb1\x9a\x55\xd1\x6e\x00\x00\x00") + +func _1645034601_display_nameUpSqlBytes() ([]byte, error) { + return bindataRead( + __1645034601_display_nameUpSql, + "1645034601_display_name.up.sql", + ) +} + +func _1645034601_display_nameUpSql() (*asset, error) { + bytes, err := _1645034601_display_nameUpSqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "1645034601_display_name.up.sql", size: 110, mode: os.FileMode(436), modTime: time.Unix(1645133998, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -1114,8 +1134,8 @@ func readmeMd() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "README.md", size: 554, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1c, 0x6e, 0xfb, 0xcc, 0x81, 0x94, 0x4d, 0x8c, 0xa0, 0x3b, 0x5, 0xb0, 0x18, 0xd6, 0xbb, 0xb3, 0x79, 0xc8, 0x8f, 0xff, 0xc1, 0x10, 0xf9, 0xf, 0x20, 0x1b, 0x4a, 0x74, 0x96, 0x42, 0xd7, 0xa8}} + info := bindataFileInfo{name: "README.md", size: 554, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -1134,8 +1154,8 @@ func docGo() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "doc.go", size: 850, mode: os.FileMode(0644), modTime: time.Unix(1621263711, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa0, 0xcc, 0x41, 0xe1, 0x61, 0x12, 0x97, 0xe, 0x36, 0x8c, 0xa7, 0x9e, 0xe0, 0x6e, 0x59, 0x9e, 0xee, 0xd5, 0x4a, 0xcf, 0x1e, 0x60, 0xd6, 0xc3, 0x3a, 0xc9, 0x6c, 0xf2, 0x86, 0x5a, 0xb4, 0x1e}} + info := bindataFileInfo{name: "doc.go", size: 850, mode: os.FileMode(436), modTime: time.Unix(1643209233, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -1143,8 +1163,8 @@ func docGo() (*asset, error) { // It returns an error if the asset could not be found or // could not be loaded. func Asset(name string) ([]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) @@ -1154,12 +1174,6 @@ func Asset(name string) ([]byte, error) { return nil, fmt.Errorf("Asset %s not found", name) } -// AssetString returns the asset contents as a string (instead of a []byte). -func AssetString(name string) (string, error) { - data, err := Asset(name) - return string(data), err -} - // MustAsset is like Asset but panics when Asset would return an error. // It simplifies safe initialization of global variables. func MustAsset(name string) []byte { @@ -1171,18 +1185,12 @@ func MustAsset(name string) []byte { return a } -// MustAssetString is like AssetString but panics when Asset would return an -// error. It simplifies safe initialization of global variables. -func MustAssetString(name string) string { - return string(MustAsset(name)) -} - // AssetInfo loads and returns the asset info for the given name. // It returns an error if the asset could not be found or // could not be loaded. func AssetInfo(name string) (os.FileInfo, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) @@ -1192,33 +1200,6 @@ func AssetInfo(name string) (os.FileInfo, error) { return nil, fmt.Errorf("AssetInfo %s not found", name) } -// AssetDigest returns the digest of the file with the given name. It returns an -// error if the asset could not be found or the digest could not be loaded. -func AssetDigest(name string) ([sha256.Size]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) - } - return a.digest, nil - } - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) -} - -// Digests returns a map of all known files and their checksums. -func Digests() (map[string][sha256.Size]byte, error) { - mp := make(map[string][sha256.Size]byte, len(_bindata)) - for name := range _bindata { - a, err := _bindata[name]() - if err != nil { - return nil, err - } - mp[name] = a.digest - } - return mp, nil -} - // AssetNames returns the names of the assets. func AssetNames() []string { names := make([]string, 0, len(_bindata)) @@ -1231,105 +1212,56 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ "000001_init.down.db.sql": _000001_initDownDbSql, - "000001_init.up.db.sql": _000001_initUpDbSql, - "000002_add_last_ens_clock_value.up.sql": _000002_add_last_ens_clock_valueUpSql, - "1586358095_add_replace.up.sql": _1586358095_add_replaceUpSql, - "1588665364_add_image_data.up.sql": _1588665364_add_image_dataUpSql, - "1589365189_add_pow_target.up.sql": _1589365189_add_pow_targetUpSql, - "1591277220_add_index_messages.up.sql": _1591277220_add_index_messagesUpSql, - "1593087212_add_mute_chat_and_raw_message_fields.up.sql": _1593087212_add_mute_chat_and_raw_message_fieldsUpSql, - "1595862781_add_audio_data.up.sql": _1595862781_add_audio_dataUpSql, - "1595865249_create_emoji_reactions_table.up.sql": _1595865249_create_emoji_reactions_tableUpSql, - "1596805115_create_group_chat_invitations_table.up.sql": _1596805115_create_group_chat_invitations_tableUpSql, - "1597322655_add_invitation_admin_chat_field.up.sql": _1597322655_add_invitation_admin_chat_fieldUpSql, - "1597757544_add_nickname.up.sql": _1597757544_add_nicknameUpSql, - "1598955122_add_mentions.up.sql": _1598955122_add_mentionsUpSql, - "1599641390_add_emoji_reactions_index.up.sql": _1599641390_add_emoji_reactions_indexUpSql, - "1599720851_add_seen_index_remove_long_messages.up.sql": _1599720851_add_seen_index_remove_long_messagesUpSql, - "1603198582_add_profile_chat_field.up.sql": _1603198582_add_profile_chat_fieldUpSql, - "1603816533_add_links.up.sql": _1603816533_add_linksUpSql, - "1603888149_create_chat_identity_last_published_table.up.sql": _1603888149_create_chat_identity_last_published_tableUpSql, - "1605075346_add_communities.up.sql": _1605075346_add_communitiesUpSql, - "1610117927_add_message_cache.up.sql": _1610117927_add_message_cacheUpSql, - "1610959908_add_dont_wrap_to_raw_messages.up.sql": _1610959908_add_dont_wrap_to_raw_messagesUpSql, - "1610960912_add_send_on_personal_topic.up.sql": _1610960912_add_send_on_personal_topicUpSql, - "1612870480_add_datasync_id.up.sql": _1612870480_add_datasync_idUpSql, - "1614152139_add_communities_request_to_join.up.sql": _1614152139_add_communities_request_to_joinUpSql, - "1615374373_add_confirmations.up.sql": _1615374373_add_confirmationsUpSql, - "1617694931_add_notification_center.up.sql": _1617694931_add_notification_centerUpSql, - "1618923660_create_pin_messages.up.sql": _1618923660_create_pin_messagesUpSql, - "1619094007_add_joined_chat_field.up.sql": _1619094007_add_joined_chat_fieldUpSql, - "1619099821_add_last_synced_field.up.sql": _1619099821_add_last_synced_fieldUpSql, - "1621933219_add_mentioned.up.sql": _1621933219_add_mentionedUpSql, - "1622010048_add_unviewed_mentions_count.up.sql": _1622010048_add_unviewed_mentions_countUpSql, - "1622061278_add_message_activity_center_notification_field.up.sql": _1622061278_add_message_activity_center_notification_fieldUpSql, - "1622464518_set_synced_to_from.up.sql": _1622464518_set_synced_to_fromUpSql, - "1622464519_add_chat_description.up.sql": _1622464519_add_chat_descriptionUpSql, - "1622622253_add_pinned_by_to_pin_messages.up.sql": _1622622253_add_pinned_by_to_pin_messagesUpSql, - "1623938329_add_author_activity_center_notification_field.up.sql": _1623938329_add_author_activity_center_notification_fieldUpSql, - "1623938330_add_edit_messages.up.sql": _1623938330_add_edit_messagesUpSql, - "1624978434_add_muted_community.up.sql": _1624978434_add_muted_communityUpSql, - "1625018910_add_repply_message_activity_center_notification_field.up.sql": _1625018910_add_repply_message_activity_center_notification_fieldUpSql, - "1625762506_add_deleted_messages.up.sql": _1625762506_add_deleted_messagesUpSql, - "1627388946_add_communities_synced_at.up.sql": _1627388946_add_communities_synced_atUpSql, - "1628280060_create-usermessages-index.sql": _1628280060_createUsermessagesIndexSql, - "1632303896_modify_contacts_table.up.sql": _1632303896_modify_contacts_tableUpSql, - "1633349838_add_emoji_column_in_chats.up.sql": _1633349838_add_emoji_column_in_chatsUpSql, - "1634831235_add_highlight_column_in_chats.up.sql": _1634831235_add_highlight_column_in_chatsUpSql, - "1634896007_add_last_updated_locally_and_removed.up.sql": _1634896007_add_last_updated_locally_and_removedUpSql, - "1635840039_add_clock_read_at_column_in_chats.up.sql": _1635840039_add_clock_read_at_column_in_chatsUpSql, - "1637852321_add_received_invitation_admin_column_in_chats.up.sql": _1637852321_add_received_invitation_admin_column_in_chatsUpSql, - + "1645034601_display_name.up.sql": _1645034601_display_nameUpSql, "README.md": readmeMd, - "doc.go": docGo, } @@ -1342,15 +1274,15 @@ var _bindata = map[string]func() (*asset, error){ // img/ // a.png // b.png -// then AssetDir("data") would return []string{"foo.txt", "img"}, -// AssetDir("data/img") would return []string{"a.png", "b.png"}, -// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and +// then AssetDir("data") would return []string{"foo.txt", "img"} +// AssetDir("data/img") would return []string{"a.png", "b.png"} +// AssetDir("foo.txt") and AssetDir("notexist") would return an error // AssetDir("") will return []string{"data"}. func AssetDir(name string) ([]string, error) { node := _bintree if len(name) != 0 { - canonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(canonicalName, "/") + cannonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(cannonicalName, "/") for _, p := range pathList { node = node.Children[p] if node == nil { @@ -1372,62 +1304,62 @@ type bintree struct { Func func() (*asset, error) Children map[string]*bintree } - var _bintree = &bintree{nil, map[string]*bintree{ - "000001_init.down.db.sql": &bintree{_000001_initDownDbSql, map[string]*bintree{}}, - "000001_init.up.db.sql": &bintree{_000001_initUpDbSql, map[string]*bintree{}}, - "000002_add_last_ens_clock_value.up.sql": &bintree{_000002_add_last_ens_clock_valueUpSql, map[string]*bintree{}}, - "1586358095_add_replace.up.sql": &bintree{_1586358095_add_replaceUpSql, map[string]*bintree{}}, - "1588665364_add_image_data.up.sql": &bintree{_1588665364_add_image_dataUpSql, map[string]*bintree{}}, - "1589365189_add_pow_target.up.sql": &bintree{_1589365189_add_pow_targetUpSql, map[string]*bintree{}}, - "1591277220_add_index_messages.up.sql": &bintree{_1591277220_add_index_messagesUpSql, map[string]*bintree{}}, - "1593087212_add_mute_chat_and_raw_message_fields.up.sql": &bintree{_1593087212_add_mute_chat_and_raw_message_fieldsUpSql, map[string]*bintree{}}, - "1595862781_add_audio_data.up.sql": &bintree{_1595862781_add_audio_dataUpSql, map[string]*bintree{}}, - "1595865249_create_emoji_reactions_table.up.sql": &bintree{_1595865249_create_emoji_reactions_tableUpSql, map[string]*bintree{}}, - "1596805115_create_group_chat_invitations_table.up.sql": &bintree{_1596805115_create_group_chat_invitations_tableUpSql, map[string]*bintree{}}, - "1597322655_add_invitation_admin_chat_field.up.sql": &bintree{_1597322655_add_invitation_admin_chat_fieldUpSql, map[string]*bintree{}}, - "1597757544_add_nickname.up.sql": &bintree{_1597757544_add_nicknameUpSql, map[string]*bintree{}}, - "1598955122_add_mentions.up.sql": &bintree{_1598955122_add_mentionsUpSql, map[string]*bintree{}}, - "1599641390_add_emoji_reactions_index.up.sql": &bintree{_1599641390_add_emoji_reactions_indexUpSql, map[string]*bintree{}}, - "1599720851_add_seen_index_remove_long_messages.up.sql": &bintree{_1599720851_add_seen_index_remove_long_messagesUpSql, map[string]*bintree{}}, - "1603198582_add_profile_chat_field.up.sql": &bintree{_1603198582_add_profile_chat_fieldUpSql, map[string]*bintree{}}, - "1603816533_add_links.up.sql": &bintree{_1603816533_add_linksUpSql, map[string]*bintree{}}, - "1603888149_create_chat_identity_last_published_table.up.sql": &bintree{_1603888149_create_chat_identity_last_published_tableUpSql, map[string]*bintree{}}, - "1605075346_add_communities.up.sql": &bintree{_1605075346_add_communitiesUpSql, map[string]*bintree{}}, - "1610117927_add_message_cache.up.sql": &bintree{_1610117927_add_message_cacheUpSql, map[string]*bintree{}}, - "1610959908_add_dont_wrap_to_raw_messages.up.sql": &bintree{_1610959908_add_dont_wrap_to_raw_messagesUpSql, map[string]*bintree{}}, - "1610960912_add_send_on_personal_topic.up.sql": &bintree{_1610960912_add_send_on_personal_topicUpSql, map[string]*bintree{}}, - "1612870480_add_datasync_id.up.sql": &bintree{_1612870480_add_datasync_idUpSql, map[string]*bintree{}}, - "1614152139_add_communities_request_to_join.up.sql": &bintree{_1614152139_add_communities_request_to_joinUpSql, map[string]*bintree{}}, - "1615374373_add_confirmations.up.sql": &bintree{_1615374373_add_confirmationsUpSql, map[string]*bintree{}}, - "1617694931_add_notification_center.up.sql": &bintree{_1617694931_add_notification_centerUpSql, map[string]*bintree{}}, - "1618923660_create_pin_messages.up.sql": &bintree{_1618923660_create_pin_messagesUpSql, map[string]*bintree{}}, - "1619094007_add_joined_chat_field.up.sql": &bintree{_1619094007_add_joined_chat_fieldUpSql, map[string]*bintree{}}, - "1619099821_add_last_synced_field.up.sql": &bintree{_1619099821_add_last_synced_fieldUpSql, map[string]*bintree{}}, - "1621933219_add_mentioned.up.sql": &bintree{_1621933219_add_mentionedUpSql, map[string]*bintree{}}, - "1622010048_add_unviewed_mentions_count.up.sql": &bintree{_1622010048_add_unviewed_mentions_countUpSql, map[string]*bintree{}}, - "1622061278_add_message_activity_center_notification_field.up.sql": &bintree{_1622061278_add_message_activity_center_notification_fieldUpSql, map[string]*bintree{}}, - "1622464518_set_synced_to_from.up.sql": &bintree{_1622464518_set_synced_to_fromUpSql, map[string]*bintree{}}, - "1622464519_add_chat_description.up.sql": &bintree{_1622464519_add_chat_descriptionUpSql, map[string]*bintree{}}, - "1622622253_add_pinned_by_to_pin_messages.up.sql": &bintree{_1622622253_add_pinned_by_to_pin_messagesUpSql, map[string]*bintree{}}, - "1623938329_add_author_activity_center_notification_field.up.sql": &bintree{_1623938329_add_author_activity_center_notification_fieldUpSql, map[string]*bintree{}}, - "1623938330_add_edit_messages.up.sql": &bintree{_1623938330_add_edit_messagesUpSql, map[string]*bintree{}}, - "1624978434_add_muted_community.up.sql": &bintree{_1624978434_add_muted_communityUpSql, map[string]*bintree{}}, + "000001_init.down.db.sql": &bintree{_000001_initDownDbSql, map[string]*bintree{}}, + "000001_init.up.db.sql": &bintree{_000001_initUpDbSql, map[string]*bintree{}}, + "000002_add_last_ens_clock_value.up.sql": &bintree{_000002_add_last_ens_clock_valueUpSql, map[string]*bintree{}}, + "1586358095_add_replace.up.sql": &bintree{_1586358095_add_replaceUpSql, map[string]*bintree{}}, + "1588665364_add_image_data.up.sql": &bintree{_1588665364_add_image_dataUpSql, map[string]*bintree{}}, + "1589365189_add_pow_target.up.sql": &bintree{_1589365189_add_pow_targetUpSql, map[string]*bintree{}}, + "1591277220_add_index_messages.up.sql": &bintree{_1591277220_add_index_messagesUpSql, map[string]*bintree{}}, + "1593087212_add_mute_chat_and_raw_message_fields.up.sql": &bintree{_1593087212_add_mute_chat_and_raw_message_fieldsUpSql, map[string]*bintree{}}, + "1595862781_add_audio_data.up.sql": &bintree{_1595862781_add_audio_dataUpSql, map[string]*bintree{}}, + "1595865249_create_emoji_reactions_table.up.sql": &bintree{_1595865249_create_emoji_reactions_tableUpSql, map[string]*bintree{}}, + "1596805115_create_group_chat_invitations_table.up.sql": &bintree{_1596805115_create_group_chat_invitations_tableUpSql, map[string]*bintree{}}, + "1597322655_add_invitation_admin_chat_field.up.sql": &bintree{_1597322655_add_invitation_admin_chat_fieldUpSql, map[string]*bintree{}}, + "1597757544_add_nickname.up.sql": &bintree{_1597757544_add_nicknameUpSql, map[string]*bintree{}}, + "1598955122_add_mentions.up.sql": &bintree{_1598955122_add_mentionsUpSql, map[string]*bintree{}}, + "1599641390_add_emoji_reactions_index.up.sql": &bintree{_1599641390_add_emoji_reactions_indexUpSql, map[string]*bintree{}}, + "1599720851_add_seen_index_remove_long_messages.up.sql": &bintree{_1599720851_add_seen_index_remove_long_messagesUpSql, map[string]*bintree{}}, + "1603198582_add_profile_chat_field.up.sql": &bintree{_1603198582_add_profile_chat_fieldUpSql, map[string]*bintree{}}, + "1603816533_add_links.up.sql": &bintree{_1603816533_add_linksUpSql, map[string]*bintree{}}, + "1603888149_create_chat_identity_last_published_table.up.sql": &bintree{_1603888149_create_chat_identity_last_published_tableUpSql, map[string]*bintree{}}, + "1605075346_add_communities.up.sql": &bintree{_1605075346_add_communitiesUpSql, map[string]*bintree{}}, + "1610117927_add_message_cache.up.sql": &bintree{_1610117927_add_message_cacheUpSql, map[string]*bintree{}}, + "1610959908_add_dont_wrap_to_raw_messages.up.sql": &bintree{_1610959908_add_dont_wrap_to_raw_messagesUpSql, map[string]*bintree{}}, + "1610960912_add_send_on_personal_topic.up.sql": &bintree{_1610960912_add_send_on_personal_topicUpSql, map[string]*bintree{}}, + "1612870480_add_datasync_id.up.sql": &bintree{_1612870480_add_datasync_idUpSql, map[string]*bintree{}}, + "1614152139_add_communities_request_to_join.up.sql": &bintree{_1614152139_add_communities_request_to_joinUpSql, map[string]*bintree{}}, + "1615374373_add_confirmations.up.sql": &bintree{_1615374373_add_confirmationsUpSql, map[string]*bintree{}}, + "1617694931_add_notification_center.up.sql": &bintree{_1617694931_add_notification_centerUpSql, map[string]*bintree{}}, + "1618923660_create_pin_messages.up.sql": &bintree{_1618923660_create_pin_messagesUpSql, map[string]*bintree{}}, + "1619094007_add_joined_chat_field.up.sql": &bintree{_1619094007_add_joined_chat_fieldUpSql, map[string]*bintree{}}, + "1619099821_add_last_synced_field.up.sql": &bintree{_1619099821_add_last_synced_fieldUpSql, map[string]*bintree{}}, + "1621933219_add_mentioned.up.sql": &bintree{_1621933219_add_mentionedUpSql, map[string]*bintree{}}, + "1622010048_add_unviewed_mentions_count.up.sql": &bintree{_1622010048_add_unviewed_mentions_countUpSql, map[string]*bintree{}}, + "1622061278_add_message_activity_center_notification_field.up.sql": &bintree{_1622061278_add_message_activity_center_notification_fieldUpSql, map[string]*bintree{}}, + "1622464518_set_synced_to_from.up.sql": &bintree{_1622464518_set_synced_to_fromUpSql, map[string]*bintree{}}, + "1622464519_add_chat_description.up.sql": &bintree{_1622464519_add_chat_descriptionUpSql, map[string]*bintree{}}, + "1622622253_add_pinned_by_to_pin_messages.up.sql": &bintree{_1622622253_add_pinned_by_to_pin_messagesUpSql, map[string]*bintree{}}, + "1623938329_add_author_activity_center_notification_field.up.sql": &bintree{_1623938329_add_author_activity_center_notification_fieldUpSql, map[string]*bintree{}}, + "1623938330_add_edit_messages.up.sql": &bintree{_1623938330_add_edit_messagesUpSql, map[string]*bintree{}}, + "1624978434_add_muted_community.up.sql": &bintree{_1624978434_add_muted_communityUpSql, map[string]*bintree{}}, "1625018910_add_repply_message_activity_center_notification_field.up.sql": &bintree{_1625018910_add_repply_message_activity_center_notification_fieldUpSql, map[string]*bintree{}}, - "1625762506_add_deleted_messages.up.sql": &bintree{_1625762506_add_deleted_messagesUpSql, map[string]*bintree{}}, - "1627388946_add_communities_synced_at.up.sql": &bintree{_1627388946_add_communities_synced_atUpSql, map[string]*bintree{}}, - "1628280060_create-usermessages-index.sql": &bintree{_1628280060_createUsermessagesIndexSql, map[string]*bintree{}}, - "1632303896_modify_contacts_table.up.sql": &bintree{_1632303896_modify_contacts_tableUpSql, map[string]*bintree{}}, - "1633349838_add_emoji_column_in_chats.up.sql": &bintree{_1633349838_add_emoji_column_in_chatsUpSql, map[string]*bintree{}}, - "1634831235_add_highlight_column_in_chats.up.sql": &bintree{_1634831235_add_highlight_column_in_chatsUpSql, map[string]*bintree{}}, - "1634896007_add_last_updated_locally_and_removed.up.sql": &bintree{_1634896007_add_last_updated_locally_and_removedUpSql, map[string]*bintree{}}, - "1635840039_add_clock_read_at_column_in_chats.up.sql": &bintree{_1635840039_add_clock_read_at_column_in_chatsUpSql, map[string]*bintree{}}, - "1637852321_add_received_invitation_admin_column_in_chats.up.sql": &bintree{_1637852321_add_received_invitation_admin_column_in_chatsUpSql, map[string]*bintree{}}, + "1625762506_add_deleted_messages.up.sql": &bintree{_1625762506_add_deleted_messagesUpSql, map[string]*bintree{}}, + "1627388946_add_communities_synced_at.up.sql": &bintree{_1627388946_add_communities_synced_atUpSql, map[string]*bintree{}}, + "1628280060_create-usermessages-index.sql": &bintree{_1628280060_createUsermessagesIndexSql, map[string]*bintree{}}, + "1632303896_modify_contacts_table.up.sql": &bintree{_1632303896_modify_contacts_tableUpSql, map[string]*bintree{}}, + "1633349838_add_emoji_column_in_chats.up.sql": &bintree{_1633349838_add_emoji_column_in_chatsUpSql, map[string]*bintree{}}, + "1634831235_add_highlight_column_in_chats.up.sql": &bintree{_1634831235_add_highlight_column_in_chatsUpSql, map[string]*bintree{}}, + "1634896007_add_last_updated_locally_and_removed.up.sql": &bintree{_1634896007_add_last_updated_locally_and_removedUpSql, map[string]*bintree{}}, + "1635840039_add_clock_read_at_column_in_chats.up.sql": &bintree{_1635840039_add_clock_read_at_column_in_chatsUpSql, map[string]*bintree{}}, + "1637852321_add_received_invitation_admin_column_in_chats.up.sql": &bintree{_1637852321_add_received_invitation_admin_column_in_chatsUpSql, map[string]*bintree{}}, + "1645034601_display_name.up.sql": &bintree{_1645034601_display_nameUpSql, map[string]*bintree{}}, "README.md": &bintree{readmeMd, map[string]*bintree{}}, - "doc.go": &bintree{docGo, map[string]*bintree{}}, + "doc.go": &bintree{docGo, map[string]*bintree{}}, }} -// RestoreAsset restores an asset under the given directory. +// RestoreAsset restores an asset under the given directory func RestoreAsset(dir, name string) error { data, err := Asset(name) if err != nil { @@ -1445,10 +1377,14 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + if err != nil { + return err + } + return nil } -// RestoreAssets restores an asset under the given directory recursively. +// RestoreAssets restores an asset under the given directory recursively func RestoreAssets(dir, name string) error { children, err := AssetDir(name) // File @@ -1466,6 +1402,7 @@ func RestoreAssets(dir, name string) error { } func _filePath(dir, name string) string { - canonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) + cannonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) } + diff --git a/protocol/migrations/sqlite/1645034601_display_name.up.sql b/protocol/migrations/sqlite/1645034601_display_name.up.sql new file mode 100644 index 000000000..0ebf397aa --- /dev/null +++ b/protocol/migrations/sqlite/1645034601_display_name.up.sql @@ -0,0 +1,2 @@ +ALTER TABLE contacts ADD COLUMN display_name TEXT NOT NULL DEFAULT ""; +UPDATE contacts SET display_name = ""; diff --git a/protocol/persistence.go b/protocol/persistence.go index 57dab1290..fa6ad4382 100644 --- a/protocol/persistence.go +++ b/protocol/persistence.go @@ -482,6 +482,7 @@ func (db sqlitePersistence) Contacts() ([]*Contact, error) { v.name, v.verified, c.alias, + c.display_name, c.identicon, c.last_updated, c.last_updated_locally, @@ -506,6 +507,7 @@ func (db sqlitePersistence) Contacts() ([]*Contact, error) { var ( contact Contact nickname sql.NullString + displayName sql.NullString imageType sql.NullString ensName sql.NullString ensVerified sql.NullBool @@ -525,6 +527,7 @@ func (db sqlitePersistence) Contacts() ([]*Contact, error) { &ensName, &ensVerified, &contact.Alias, + &displayName, &contact.Identicon, &contact.LastUpdated, &lastUpdatedLocally, @@ -544,8 +547,12 @@ func (db sqlitePersistence) Contacts() ([]*Contact, error) { contact.LocalNickname = nickname.String } + if displayName.Valid { + contact.DisplayName = displayName.String + } + if ensName.Valid { - contact.Name = ensName.String + contact.EnsName = ensName.String } if ensVerified.Valid { @@ -710,6 +717,7 @@ func (db sqlitePersistence) SaveContact(contact *Contact, tx *sql.Tx) (err error id, address, alias, + display_name, identicon, last_updated, last_updated_locally, @@ -721,7 +729,7 @@ func (db sqlitePersistence) SaveContact(contact *Contact, tx *sql.Tx) (err error name, photo, tribute_to_talk - ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `) if err != nil { return @@ -732,6 +740,7 @@ func (db sqlitePersistence) SaveContact(contact *Contact, tx *sql.Tx) (err error contact.ID, contact.Address, contact.Alias, + contact.DisplayName, contact.Identicon, contact.LastUpdated, contact.LastUpdatedLocally, diff --git a/protocol/protobuf/chat_identity.pb.go b/protocol/protobuf/chat_identity.pb.go index 9eec33970..e6594b810 100644 --- a/protocol/protobuf/chat_identity.pb.go +++ b/protocol/protobuf/chat_identity.pb.go @@ -62,7 +62,7 @@ type ChatIdentity struct { EnsName string `protobuf:"bytes,2,opt,name=ens_name,json=ensName,proto3" json:"ens_name,omitempty"` // images is a string indexed mapping of images associated with an identity Images map[string]*IdentityImage `protobuf:"bytes,3,rep,name=images,proto3" json:"images,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // display name is the user set identity, valid only for organisations + // display name is the user set identity DisplayName string `protobuf:"bytes,4,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` // description is the user set description, valid only for organisations Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` diff --git a/protocol/protobuf/chat_identity.proto b/protocol/protobuf/chat_identity.proto index 4291abdc7..45c40ec49 100644 --- a/protocol/protobuf/chat_identity.proto +++ b/protocol/protobuf/chat_identity.proto @@ -16,7 +16,7 @@ message ChatIdentity { // images is a string indexed mapping of images associated with an identity map images = 3; - // display name is the user set identity, valid only for organisations + // display name is the user set identity string display_name = 4; // description is the user set description, valid only for organisations diff --git a/protocol/protobuf/chat_message.pb.go b/protocol/protobuf/chat_message.pb.go index b62d80f76..5d9b22cb6 100644 --- a/protocol/protobuf/chat_message.pb.go +++ b/protocol/protobuf/chat_message.pb.go @@ -434,7 +434,9 @@ type ChatMessage struct { // *ChatMessage_Community Payload isChatMessage_Payload `protobuf_oneof:"payload"` // Grant for community chat messages - Grant []byte `protobuf:"bytes,13,opt,name=grant,proto3" json:"grant,omitempty"` + Grant []byte `protobuf:"bytes,13,opt,name=grant,proto3" json:"grant,omitempty"` + // Message author's display name, introduced in version 1 + DisplayName string `protobuf:"bytes,14,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -591,6 +593,13 @@ func (m *ChatMessage) GetGrant() []byte { return nil } +func (m *ChatMessage) GetDisplayName() string { + if m != nil { + return m.DisplayName + } + return "" +} + // XXX_OneofWrappers is for the internal use of the proto package. func (*ChatMessage) XXX_OneofWrappers() []interface{} { return []interface{}{ @@ -617,50 +626,51 @@ func init() { } var fileDescriptor_263952f55fd35689 = []byte{ - // 719 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x41, 0x6f, 0x9b, 0x48, - 0x14, 0x0e, 0x36, 0x18, 0xf3, 0xb0, 0x23, 0x34, 0xc9, 0x26, 0xec, 0x6a, 0x77, 0xe3, 0xb5, 0x56, - 0x5a, 0x9f, 0xbc, 0x52, 0x9a, 0x4a, 0x91, 0x7a, 0x22, 0x36, 0x72, 0x68, 0x0a, 0x76, 0x07, 0xdc, - 0x36, 0xbd, 0x20, 0x82, 0xa7, 0x31, 0x4a, 0x00, 0xcb, 0x8c, 0xa5, 0xfa, 0x47, 0xf5, 0xda, 0x6b, - 0x7f, 0x48, 0x0f, 0xfd, 0x2b, 0xd5, 0x0c, 0xc6, 0x10, 0x4b, 0x4d, 0x72, 0xe2, 0xbd, 0xc7, 0xfb, - 0xbe, 0xf9, 0xe6, 0x9b, 0x79, 0x03, 0x28, 0x9c, 0x07, 0xd4, 0x8f, 0x49, 0x96, 0x05, 0xb7, 0xa4, - 0xbf, 0x58, 0xa6, 0x34, 0x45, 0x4d, 0xfe, 0xb9, 0x59, 0x7d, 0xfa, 0x43, 0x25, 0xc9, 0x2a, 0xce, - 0xf2, 0x72, 0xf7, 0x1c, 0xf6, 0x5d, 0x1a, 0x85, 0x77, 0x64, 0x69, 0xe7, 0xed, 0x08, 0x81, 0x38, - 0x0f, 0xb2, 0xb9, 0x2e, 0x74, 0x84, 0x9e, 0x82, 0x79, 0xcc, 0x6a, 0x8b, 0x20, 0xbc, 0xd3, 0x6b, - 0x1d, 0xa1, 0x27, 0x61, 0x1e, 0x77, 0xdf, 0x42, 0xcb, 0x8a, 0x83, 0x5b, 0x52, 0xe0, 0x74, 0x90, - 0x17, 0xc1, 0xfa, 0x3e, 0x0d, 0x66, 0x1c, 0xda, 0xc2, 0x45, 0x8a, 0xfe, 0x03, 0x91, 0xae, 0x17, - 0x84, 0xa3, 0xf7, 0x4f, 0x0f, 0xfa, 0x85, 0x92, 0x3e, 0xc7, 0x7b, 0xeb, 0x05, 0xc1, 0xbc, 0xa1, - 0xfb, 0x55, 0x80, 0x96, 0xb1, 0x9a, 0x45, 0xe9, 0xd3, 0x9c, 0x67, 0x0f, 0x38, 0x3b, 0x25, 0x67, - 0x15, 0x9f, 0x27, 0xe5, 0x02, 0xe8, 0x04, 0xd4, 0xd9, 0x6a, 0x19, 0xd0, 0x28, 0x4d, 0xfc, 0x38, - 0xd3, 0xeb, 0x1d, 0xa1, 0x27, 0x62, 0x28, 0x4a, 0x76, 0xd6, 0x7d, 0x09, 0xca, 0x16, 0x83, 0x8e, - 0x00, 0x4d, 0x9d, 0x2b, 0x67, 0xfc, 0xde, 0xf1, 0x8d, 0xe9, 0xd0, 0x1a, 0xfb, 0xde, 0xf5, 0xc4, - 0xd4, 0xf6, 0x90, 0x0c, 0x75, 0xc3, 0x18, 0x68, 0x02, 0x0f, 0x6c, 0xac, 0xd5, 0xba, 0xdf, 0x04, - 0x50, 0xcd, 0x59, 0x44, 0x0b, 0xdd, 0x87, 0x20, 0x85, 0xf7, 0x69, 0x78, 0xc7, 0x55, 0x8b, 0x38, - 0x4f, 0x98, 0x8b, 0x94, 0x7c, 0xa6, 0x5c, 0xb3, 0x82, 0x79, 0x8c, 0x8e, 0x41, 0xe6, 0x87, 0x15, - 0xcd, 0xb8, 0x1a, 0x05, 0x37, 0x58, 0x6a, 0xcd, 0xd0, 0x5f, 0x00, 0x9b, 0x03, 0x64, 0xff, 0x44, - 0xfe, 0x4f, 0xd9, 0x54, 0xac, 0x19, 0x5b, 0xe1, 0x76, 0x19, 0x24, 0x54, 0x97, 0xb8, 0x2f, 0x79, - 0x82, 0xce, 0xa1, 0x55, 0x80, 0xb8, 0x3b, 0x0d, 0xee, 0xce, 0x6f, 0xa5, 0x3b, 0x1b, 0x81, 0xdc, - 0x12, 0x35, 0x2e, 0x93, 0xee, 0x17, 0x01, 0xda, 0x43, 0x72, 0x4f, 0x28, 0x79, 0x7c, 0x0f, 0x15, - 0xbd, 0xb5, 0x47, 0xf4, 0xd6, 0x7f, 0xa9, 0x57, 0x7c, 0x4c, 0xaf, 0xf4, 0x6c, 0xbd, 0x3f, 0x24, - 0x50, 0x07, 0xf3, 0xe0, 0x09, 0xc7, 0xff, 0x04, 0x85, 0x46, 0x31, 0xc9, 0x68, 0x10, 0x2f, 0xb8, - 0x5e, 0x11, 0x97, 0x85, 0xed, 0x79, 0xd4, 0x2b, 0xe7, 0x71, 0x02, 0xea, 0x92, 0x64, 0x8b, 0x34, - 0xc9, 0x88, 0x4f, 0xd3, 0x8d, 0xef, 0x50, 0x94, 0xbc, 0x14, 0xfd, 0x0e, 0x4d, 0x92, 0x64, 0x7e, - 0x12, 0xc4, 0xb9, 0x5c, 0x05, 0xcb, 0x24, 0xc9, 0x9c, 0x20, 0x26, 0x55, 0x6f, 0x1a, 0x0f, 0xbc, - 0xd9, 0xdd, 0xa6, 0xfc, 0xdc, 0x6d, 0xa2, 0x21, 0xb4, 0xc2, 0x34, 0xa1, 0x24, 0xa1, 0x39, 0xb2, - 0xc9, 0x91, 0xff, 0x94, 0xc8, 0x8a, 0x07, 0xfd, 0x41, 0xde, 0x99, 0xb3, 0x84, 0x65, 0x82, 0xce, - 0x40, 0xce, 0xf2, 0x21, 0xd7, 0x95, 0x8e, 0xd0, 0x53, 0x4f, 0xf5, 0x92, 0xe0, 0xe1, 0xf4, 0x5f, - 0xee, 0xe1, 0xa2, 0x15, 0xf5, 0x41, 0x8a, 0xd8, 0x80, 0xea, 0xc0, 0x31, 0x47, 0x3b, 0x73, 0x5b, - 0x22, 0xf2, 0x36, 0xd6, 0x1f, 0xb0, 0xd9, 0xd1, 0xd5, 0xdd, 0xfe, 0xea, 0x4c, 0xb2, 0x7e, 0xde, - 0x86, 0xfe, 0x06, 0x25, 0x4c, 0xe3, 0x78, 0x95, 0x44, 0x74, 0xad, 0xb7, 0xd8, 0xb5, 0xb8, 0xdc, - 0xc3, 0x65, 0xa9, 0xbc, 0x32, 0xed, 0xca, 0x95, 0xe9, 0x7e, 0x17, 0x40, 0xad, 0x6c, 0x14, 0xe9, - 0x70, 0x58, 0x0c, 0xe9, 0x60, 0xec, 0x78, 0xa6, 0xe3, 0x15, 0x63, 0xba, 0x0f, 0xe0, 0x99, 0x1f, - 0x3c, 0x7f, 0xf2, 0xc6, 0xb0, 0x1c, 0x4d, 0x40, 0x2a, 0xc8, 0xae, 0x67, 0x0d, 0xae, 0x4c, 0xac, - 0xd5, 0x10, 0x40, 0xc3, 0xf5, 0x0c, 0x6f, 0xea, 0x6a, 0x75, 0xa4, 0x80, 0x64, 0xda, 0xe3, 0xd7, - 0x96, 0x26, 0xa2, 0x63, 0x38, 0xf0, 0xb0, 0xe1, 0xb8, 0xc6, 0xc0, 0xb3, 0xc6, 0x8c, 0xd1, 0xb6, - 0x0d, 0x67, 0xa8, 0x49, 0xa8, 0x07, 0xff, 0xba, 0xd7, 0xae, 0x67, 0xda, 0xbe, 0x6d, 0xba, 0xae, - 0x31, 0x32, 0xb7, 0xab, 0x4d, 0xb0, 0xf5, 0xce, 0xf0, 0x4c, 0x7f, 0x84, 0xc7, 0xd3, 0x89, 0xd6, - 0x60, 0x6c, 0x96, 0x6d, 0x8c, 0x4c, 0x4d, 0x66, 0x21, 0x7f, 0x38, 0xb4, 0x26, 0x6a, 0x83, 0xc2, - 0xc8, 0xa6, 0x8e, 0xe5, 0x5d, 0x6b, 0x0a, 0x7b, 0x5a, 0x76, 0xe8, 0x46, 0xc6, 0x44, 0x83, 0x0b, - 0x65, 0xfb, 0xe0, 0x5d, 0xb4, 0x3f, 0xaa, 0xfd, 0xff, 0x5f, 0x15, 0x1e, 0xde, 0x34, 0x78, 0xf4, - 0xe2, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1a, 0xb9, 0xa5, 0x8e, 0xdc, 0x05, 0x00, 0x00, + // 734 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4d, 0x6f, 0xc3, 0x44, + 0x10, 0xad, 0x13, 0x27, 0x8e, 0xc7, 0x49, 0x64, 0x6d, 0x4b, 0x6b, 0x10, 0xd0, 0x34, 0x42, 0x22, + 0xa7, 0x20, 0x95, 0x22, 0x55, 0xe2, 0xe4, 0x26, 0x56, 0x6a, 0x8a, 0x9d, 0xb0, 0x76, 0x80, 0x72, + 0xb1, 0x5c, 0x7b, 0x69, 0xac, 0xc6, 0x1f, 0x8a, 0x37, 0x12, 0xb9, 0xf2, 0x7f, 0xb8, 0x72, 0xe5, + 0x87, 0xf0, 0x67, 0xd0, 0xae, 0xe3, 0xd8, 0x8d, 0x44, 0xdb, 0x53, 0x66, 0x26, 0xf3, 0x9e, 0xdf, + 0xbe, 0xd9, 0x59, 0x40, 0xc1, 0xca, 0xa7, 0x5e, 0x4c, 0xf2, 0xdc, 0x7f, 0x26, 0xe3, 0x6c, 0x93, + 0xd2, 0x14, 0x75, 0xf8, 0xcf, 0xd3, 0xf6, 0xf7, 0xcf, 0x14, 0x92, 0x6c, 0xe3, 0xbc, 0x28, 0x0f, + 0x6f, 0xa1, 0xef, 0xd0, 0x28, 0x78, 0x21, 0x1b, 0xab, 0x68, 0x47, 0x08, 0xc4, 0x95, 0x9f, 0xaf, + 0x34, 0x61, 0x20, 0x8c, 0x64, 0xcc, 0x63, 0x56, 0xcb, 0xfc, 0xe0, 0x45, 0x6b, 0x0c, 0x84, 0x51, + 0x0b, 0xf3, 0x78, 0xf8, 0x13, 0x74, 0xcd, 0xd8, 0x7f, 0x26, 0x25, 0x4e, 0x03, 0x29, 0xf3, 0x77, + 0xeb, 0xd4, 0x0f, 0x39, 0xb4, 0x8b, 0xcb, 0x14, 0x7d, 0x0d, 0x22, 0xdd, 0x65, 0x84, 0xa3, 0xfb, + 0xd7, 0xa7, 0xe3, 0x52, 0xc9, 0x98, 0xe3, 0xdd, 0x5d, 0x46, 0x30, 0x6f, 0x18, 0xfe, 0x2d, 0x40, + 0x57, 0xdf, 0x86, 0x51, 0xfa, 0x3e, 0xe7, 0xcd, 0x2b, 0xce, 0x41, 0xc5, 0x59, 0xc7, 0x17, 0x49, + 0xf5, 0x01, 0x74, 0x09, 0x4a, 0xb8, 0xdd, 0xf8, 0x34, 0x4a, 0x13, 0x2f, 0xce, 0xb5, 0xe6, 0x40, + 0x18, 0x89, 0x18, 0xca, 0x92, 0x95, 0x0f, 0xbf, 0x03, 0xf9, 0x80, 0x41, 0xe7, 0x80, 0x96, 0xf6, + 0x83, 0x3d, 0xff, 0xc5, 0xf6, 0xf4, 0xe5, 0xd4, 0x9c, 0x7b, 0xee, 0xe3, 0xc2, 0x50, 0x4f, 0x90, + 0x04, 0x4d, 0x5d, 0x9f, 0xa8, 0x02, 0x0f, 0x2c, 0xac, 0x36, 0x86, 0xff, 0x08, 0xa0, 0x18, 0x61, + 0x44, 0x4b, 0xdd, 0x67, 0xd0, 0x0a, 0xd6, 0x69, 0xf0, 0xc2, 0x55, 0x8b, 0xb8, 0x48, 0x98, 0x8b, + 0x94, 0xfc, 0x41, 0xb9, 0x66, 0x19, 0xf3, 0x18, 0x5d, 0x80, 0xc4, 0x87, 0x15, 0x85, 0x5c, 0x8d, + 0x8c, 0xdb, 0x2c, 0x35, 0x43, 0xf4, 0x05, 0xc0, 0x7e, 0x80, 0xec, 0x3f, 0x91, 0xff, 0x27, 0xef, + 0x2b, 0x66, 0xc8, 0xbe, 0xf0, 0xbc, 0xf1, 0x13, 0xaa, 0xb5, 0xb8, 0x2f, 0x45, 0x82, 0x6e, 0xa1, + 0x5b, 0x82, 0xb8, 0x3b, 0x6d, 0xee, 0xce, 0x27, 0x95, 0x3b, 0x7b, 0x81, 0xdc, 0x12, 0x25, 0xae, + 0x92, 0xe1, 0x5f, 0x02, 0xf4, 0xa6, 0x64, 0x4d, 0x28, 0x79, 0xfb, 0x0c, 0x35, 0xbd, 0x8d, 0x37, + 0xf4, 0x36, 0xff, 0x57, 0xaf, 0xf8, 0x96, 0xde, 0xd6, 0x87, 0xf5, 0xfe, 0xd9, 0x06, 0x65, 0xb2, + 0xf2, 0xdf, 0x71, 0xfc, 0x73, 0x90, 0x69, 0x14, 0x93, 0x9c, 0xfa, 0x71, 0xc6, 0xf5, 0x8a, 0xb8, + 0x2a, 0x1c, 0xe6, 0xd1, 0xac, 0xcd, 0xe3, 0x12, 0x94, 0x0d, 0xc9, 0xb3, 0x34, 0xc9, 0x89, 0x47, + 0xd3, 0xbd, 0xef, 0x50, 0x96, 0xdc, 0x14, 0x7d, 0x0a, 0x1d, 0x92, 0xe4, 0x5e, 0xe2, 0xc7, 0x85, + 0x5c, 0x19, 0x4b, 0x24, 0xc9, 0x6d, 0x3f, 0x26, 0x75, 0x6f, 0xda, 0xaf, 0xbc, 0x39, 0x3e, 0xa6, + 0xf4, 0xd1, 0x63, 0xa2, 0x29, 0x74, 0x83, 0x34, 0xa1, 0x24, 0xa1, 0x05, 0xb2, 0xc3, 0x91, 0x57, + 0x15, 0xb2, 0xe6, 0xc1, 0x78, 0x52, 0x74, 0x16, 0x2c, 0x41, 0x95, 0xa0, 0x1b, 0x90, 0xf2, 0x62, + 0xc9, 0x35, 0x79, 0x20, 0x8c, 0x94, 0x6b, 0xad, 0x22, 0x78, 0xbd, 0xfd, 0xf7, 0x27, 0xb8, 0x6c, + 0x45, 0x63, 0x68, 0x45, 0x6c, 0x41, 0x35, 0xe0, 0x98, 0xf3, 0xa3, 0xbd, 0xad, 0x10, 0x45, 0x1b, + 0xeb, 0xf7, 0xd9, 0xee, 0x68, 0xca, 0x71, 0x7f, 0x7d, 0x27, 0x59, 0x3f, 0x6f, 0x43, 0x5f, 0x82, + 0x1c, 0xa4, 0x71, 0xbc, 0x4d, 0x22, 0xba, 0xd3, 0xba, 0xec, 0x5a, 0xdc, 0x9f, 0xe0, 0xaa, 0x54, + 0x5d, 0x99, 0x5e, 0xfd, 0xca, 0x5c, 0x41, 0x37, 0x8c, 0xf2, 0x6c, 0xed, 0xef, 0x8a, 0x19, 0xf4, + 0xb9, 0xd3, 0xca, 0xbe, 0xc6, 0xe6, 0x30, 0xfc, 0x57, 0x00, 0xa5, 0xe6, 0x05, 0xd2, 0xe0, 0xac, + 0xdc, 0xe3, 0xc9, 0xdc, 0x76, 0x0d, 0xdb, 0x2d, 0x37, 0xb9, 0x0f, 0xe0, 0x1a, 0xbf, 0xba, 0xde, + 0xe2, 0x47, 0xdd, 0xb4, 0x55, 0x01, 0x29, 0x20, 0x39, 0xae, 0x39, 0x79, 0x30, 0xb0, 0xda, 0x40, + 0x00, 0x6d, 0xc7, 0xd5, 0xdd, 0xa5, 0xa3, 0x36, 0x91, 0x0c, 0x2d, 0xc3, 0x9a, 0xff, 0x60, 0xaa, + 0x22, 0xba, 0x80, 0x53, 0x17, 0xeb, 0xb6, 0xa3, 0x4f, 0x5c, 0x73, 0xce, 0x18, 0x2d, 0x4b, 0xb7, + 0xa7, 0x6a, 0x0b, 0x8d, 0xe0, 0x2b, 0xe7, 0xd1, 0x71, 0x0d, 0xcb, 0xb3, 0x0c, 0xc7, 0xd1, 0x67, + 0xc6, 0xe1, 0x6b, 0x0b, 0x6c, 0xfe, 0xac, 0xbb, 0x86, 0x37, 0xc3, 0xf3, 0xe5, 0x42, 0x6d, 0x33, + 0x36, 0xd3, 0xd2, 0x67, 0x86, 0x2a, 0xb1, 0x90, 0xbf, 0x2d, 0x6a, 0x07, 0xf5, 0x40, 0x66, 0x64, + 0x4b, 0xdb, 0x74, 0x1f, 0x55, 0x99, 0xbd, 0x3e, 0x47, 0x74, 0x33, 0x7d, 0xa1, 0xc2, 0x9d, 0x7c, + 0x78, 0x13, 0xef, 0x7a, 0xbf, 0x29, 0xe3, 0x6f, 0xbe, 0x2f, 0x6d, 0x7e, 0x6a, 0xf3, 0xe8, 0xdb, + 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x91, 0x87, 0x42, 0xf9, 0xff, 0x05, 0x00, 0x00, } diff --git a/protocol/protobuf/chat_message.proto b/protocol/protobuf/chat_message.proto index abac01147..ddd3d0423 100644 --- a/protocol/protobuf/chat_message.proto +++ b/protocol/protobuf/chat_message.proto @@ -88,6 +88,9 @@ message ChatMessage { // Grant for community chat messages bytes grant = 13; + // Message author's display name, introduced in version 1 + string display_name = 14; + enum ContentType { UNKNOWN_CONTENT_TYPE = 0; TEXT_PLAIN = 1; @@ -103,4 +106,6 @@ message ChatMessage { // Only local SYSTEM_MESSAGE_GAP = 10; } + + } diff --git a/protocol/protobuf/contact.pb.go b/protocol/protobuf/contact.pb.go index e57741d74..3c3abb426 100644 --- a/protocol/protobuf/contact.pb.go +++ b/protocol/protobuf/contact.pb.go @@ -24,6 +24,7 @@ type ContactUpdate struct { Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` EnsName string `protobuf:"bytes,2,opt,name=ens_name,json=ensName,proto3" json:"ens_name,omitempty"` ProfileImage string `protobuf:"bytes,3,opt,name=profile_image,json=profileImage,proto3" json:"profile_image,omitempty"` + DisplayName string `protobuf:"bytes,4,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -75,6 +76,13 @@ func (m *ContactUpdate) GetProfileImage() string { return "" } +func (m *ContactUpdate) GetDisplayName() string { + if m != nil { + return m.DisplayName + } + return "" +} + func init() { proto.RegisterType((*ContactUpdate)(nil), "protobuf.ContactUpdate") } @@ -84,14 +92,16 @@ func init() { } var fileDescriptor_a5036fff2565fb15 = []byte{ - // 144 bytes of a gzipped FileDescriptorProto + // 166 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4d, 0xce, 0xcf, 0x2b, 0x49, 0x4c, 0x2e, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x00, 0x53, 0x49, 0xa5, 0x69, - 0x4a, 0xa9, 0x5c, 0xbc, 0xce, 0x10, 0xa9, 0xd0, 0x82, 0x94, 0xc4, 0x92, 0x54, 0x21, 0x11, 0x2e, - 0xd6, 0xe4, 0x9c, 0xfc, 0xe4, 0x6c, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x96, 0x20, 0x08, 0x47, 0x48, - 0x92, 0x8b, 0x23, 0x35, 0xaf, 0x38, 0x3e, 0x2f, 0x31, 0x37, 0x55, 0x82, 0x49, 0x81, 0x51, 0x83, - 0x33, 0x88, 0x3d, 0x35, 0xaf, 0xd8, 0x2f, 0x31, 0x37, 0x55, 0x48, 0x99, 0x8b, 0xb7, 0xa0, 0x28, - 0x3f, 0x2d, 0x33, 0x27, 0x35, 0x3e, 0x33, 0x37, 0x31, 0x3d, 0x55, 0x82, 0x19, 0x2c, 0xcf, 0x03, - 0x15, 0xf4, 0x04, 0x89, 0x39, 0xf1, 0x46, 0x71, 0xeb, 0xe9, 0x5b, 0xc3, 0x6c, 0x4d, 0x62, 0x03, - 0xb3, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x78, 0x67, 0xeb, 0x60, 0x97, 0x00, 0x00, 0x00, + 0x4a, 0x1d, 0x8c, 0x5c, 0xbc, 0xce, 0x10, 0xb9, 0xd0, 0x82, 0x94, 0xc4, 0x92, 0x54, 0x21, 0x11, + 0x2e, 0xd6, 0xe4, 0x9c, 0xfc, 0xe4, 0x6c, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x96, 0x20, 0x08, 0x47, + 0x48, 0x92, 0x8b, 0x23, 0x35, 0xaf, 0x38, 0x3e, 0x2f, 0x31, 0x37, 0x55, 0x82, 0x49, 0x81, 0x51, + 0x83, 0x33, 0x88, 0x3d, 0x35, 0xaf, 0xd8, 0x2f, 0x31, 0x37, 0x55, 0x48, 0x99, 0x8b, 0xb7, 0xa0, + 0x28, 0x3f, 0x2d, 0x33, 0x27, 0x35, 0x3e, 0x33, 0x37, 0x31, 0x3d, 0x55, 0x82, 0x19, 0x2c, 0xcf, + 0x03, 0x15, 0xf4, 0x04, 0x89, 0x09, 0x29, 0x72, 0xf1, 0xa4, 0x64, 0x16, 0x17, 0xe4, 0x24, 0x56, + 0x42, 0xcc, 0x60, 0x01, 0xab, 0xe1, 0x86, 0x8a, 0x81, 0xcc, 0x71, 0xe2, 0x8d, 0xe2, 0xd6, 0xd3, + 0xb7, 0x86, 0xb9, 0x2c, 0x89, 0x0d, 0xcc, 0x32, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xfa, + 0xcb, 0x28, 0xbb, 0x00, 0x00, 0x00, } diff --git a/protocol/protobuf/contact.proto b/protocol/protobuf/contact.proto index e33bb7db8..4d6b64077 100644 --- a/protocol/protobuf/contact.proto +++ b/protocol/protobuf/contact.proto @@ -7,4 +7,5 @@ message ContactUpdate { uint64 clock = 1; string ens_name = 2; string profile_image = 3; + string display_name = 4; } diff --git a/protocol/push_notification_test.go b/protocol/push_notification_test.go index 643059b1d..10b8e29a0 100644 --- a/protocol/push_notification_test.go +++ b/protocol/push_notification_test.go @@ -295,9 +295,9 @@ func (s *MessengerPushNotificationSuite) TestReceivePushNotificationFromContactO // Add alice has a contact aliceContact := &Contact{ - ID: types.EncodeHex(crypto.FromECDSAPub(&alice.identity.PublicKey)), - Name: "Some Contact", - Added: true, + ID: types.EncodeHex(crypto.FromECDSAPub(&alice.identity.PublicKey)), + EnsName: "Some Contact", + Added: true, } _, err = bob.AddContact(context.Background(), &requests.AddContact{ID: types.Hex2Bytes(aliceContact.ID)}) @@ -441,9 +441,9 @@ func (s *MessengerPushNotificationSuite) TestReceivePushNotificationRetries() { // Add alice has a contact aliceContact := &Contact{ - ID: types.EncodeHex(crypto.FromECDSAPub(&alice.identity.PublicKey)), - Name: "Some Contact", - Added: true, + ID: types.EncodeHex(crypto.FromECDSAPub(&alice.identity.PublicKey)), + EnsName: "Some Contact", + Added: true, } _, err = bob.AddContact(context.Background(), &requests.AddContact{ID: types.Hex2Bytes(aliceContact.ID)}) @@ -451,9 +451,9 @@ func (s *MessengerPushNotificationSuite) TestReceivePushNotificationRetries() { // Add frank has a contact frankContact := &Contact{ - ID: types.EncodeHex(crypto.FromECDSAPub(&frank.identity.PublicKey)), - Name: "Some Contact", - Added: true, + ID: types.EncodeHex(crypto.FromECDSAPub(&frank.identity.PublicKey)), + EnsName: "Some Contact", + Added: true, } _, err = bob.AddContact(context.Background(), &requests.AddContact{ID: types.Hex2Bytes(frankContact.ID)}) @@ -539,8 +539,8 @@ func (s *MessengerPushNotificationSuite) TestReceivePushNotificationRetries() { // The message has been sent, but not received, now we remove a contact so that the token is invalidated frankContact = &Contact{ - ID: types.EncodeHex(crypto.FromECDSAPub(&frank.identity.PublicKey)), - Name: "Some Contact", + ID: types.EncodeHex(crypto.FromECDSAPub(&frank.identity.PublicKey)), + EnsName: "Some Contact", } _, err = bob.RemoveContact(context.Background(), frankContact.ID) s.Require().NoError(err) diff --git a/protocol/requests/add_contact.go b/protocol/requests/add_contact.go index 927f8b1b7..7c794e0e2 100644 --- a/protocol/requests/add_contact.go +++ b/protocol/requests/add_contact.go @@ -9,9 +9,10 @@ import ( var ErrAddContactInvalidID = errors.New("add-contact: invalid id") type AddContact struct { - ID types.HexBytes `json:"id"` - Nickname string `json:"nickname"` - ENSName string `json:"ensName"` + ID types.HexBytes `json:"id"` + Nickname string `json:"nickname"` + DisplayName string `json:"displayName"` + ENSName string `json:"ensName"` } func (a *AddContact) Validate() error { diff --git a/services/ext/api.go b/services/ext/api.go index 4369b7b7c..423d85dd2 100644 --- a/services/ext/api.go +++ b/services/ext/api.go @@ -683,6 +683,10 @@ func (api *PublicAPI) SendContactUpdate(ctx context.Context, contactID, name, pi return api.service.messenger.SendContactUpdate(ctx, contactID, name, picture) } +func (api *PublicAPI) SetDisplayName(ctx context.Context, displayName string) error { + return api.service.messenger.SetDisplayName(displayName) +} + func (api *PublicAPI) SendPairInstallation(ctx context.Context) (*protocol.MessengerResponse, error) { return api.service.messenger.SendPairInstallation(ctx) }