accounts

package
v0.171.31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2023 License: MPL-2.0 Imports: 22 Imported by: 0

README

Settings service

Settings service provides private API for storing all configuration for a selected account.

To enable:

  1. Client must ensure that settings db is initialized in the api.Backend.
  2. Add settings to APIModules in config.

API

settings_saveConfig
Parameters
  • type: string - configuratin type. if not unique error is raised.
  • conf: bytes - raw json.
settings_getConfig
Parameters
  • type: string
Returns
  • conf raw json
settings_saveNodeConfig

Special case of the settings_saveConfig. In status-go we are using constant node-config as a type for node configuration. Application depends on this value and will try to load it when node is started. This method is provided in order to remove syncing mentioned constant between status-go and users.

Parameters
  • conf: params.NodeConfig

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUpdatingWrongAccount raised if caller tries to update any other account except one used for login.
	ErrUpdatingWrongAccount = errors.New("failed to update wrong account. Please login with that account first")
)

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API is class with methods available over RPC.

func NewAccountsAPI

func NewAccountsAPI(manager *account.GethManager, config *params.NodeConfig, db *accounts.Database, feed *event.Feed, messenger **protocol.Messenger) *API

func (*API) AddAccount added in v0.142.1

func (api *API) AddAccount(ctx context.Context, password string, account *accounts.Account) error

func (*API) AddKeypair added in v0.152.2

func (api *API) AddKeypair(ctx context.Context, password string, keypair *accounts.Keypair) error

func (*API) AddressWasShown added in v0.171.26

func (api *API) AddressWasShown(address types.Address) error

func (*API) DeleteAccount added in v0.38.1

func (api *API) DeleteAccount(ctx context.Context, address types.Address) error

func (*API) DeleteAllKeycardsWithKeyUID added in v0.151.1

func (api *API) DeleteAllKeycardsWithKeyUID(ctx context.Context, keyUID string) error

func (*API) DeleteKeycard added in v0.109.1

func (api *API) DeleteKeycard(ctx context.Context, keycardUID string) error

func (*API) DeleteKeycardAccounts added in v0.161.6

func (api *API) DeleteKeycardAccounts(ctx context.Context, keycardUID string, accountAddresses []types.Address) error

func (*API) DeleteKeypair added in v0.125.4

func (api *API) DeleteKeypair(ctx context.Context, keyUID string) error

func (*API) GetAccountByAddress added in v0.152.2

func (api *API) GetAccountByAddress(ctx context.Context, address types.Address) (*accounts.Account, error)

func (*API) GetAccounts

func (api *API) GetAccounts(ctx context.Context) ([]*accounts.Account, error)

func (*API) GetAllKnownKeycards added in v0.117.1

func (api *API) GetAllKnownKeycards(ctx context.Context) ([]*accounts.Keycard, error)

func (*API) GetKeycardByKeycardUID added in v0.161.6

func (api *API) GetKeycardByKeycardUID(ctx context.Context, keycardUID string) (*accounts.Keycard, error)

func (*API) GetKeycardsWithSameKeyUID added in v0.161.6

func (api *API) GetKeycardsWithSameKeyUID(ctx context.Context, keyUID string) ([]*accounts.Keycard, error)

func (*API) GetKeypairByKeyUID added in v0.152.2

func (api *API) GetKeypairByKeyUID(ctx context.Context, keyUID string) (*accounts.Keypair, error)

func (*API) GetKeypairs added in v0.152.2

func (api *API) GetKeypairs(ctx context.Context) ([]*accounts.Keypair, error)

func (*API) GetRandomMnemonic added in v0.142.1

func (api *API) GetRandomMnemonic(ctx context.Context) (string, error)

Creates a random new mnemonic.

func (*API) GetTokenPreferences added in v0.171.27

func (api *API) GetTokenPreferences(ctx context.Context) ([]walletsettings.TokenPreferences, error)

func (*API) GetWatchOnlyAccounts added in v0.152.2

func (api *API) GetWatchOnlyAccounts(ctx context.Context) ([]*accounts.Account, error)

func (*API) HasPairedDevices added in v0.163.4

func (api *API) HasPairedDevices(ctx context.Context) bool

func (*API) ImportMnemonic added in v0.142.1

func (api *API) ImportMnemonic(ctx context.Context, mnemonic string, password string) error

Imports a new mnemonic and creates local keystore file.

func (*API) ImportPrivateKey added in v0.142.1

func (api *API) ImportPrivateKey(ctx context.Context, privateKey string, password string) error

Imports a new private key and creates local keystore file.

func (*API) KeycardLocked added in v0.109.1

func (api *API) KeycardLocked(ctx context.Context, keycardUID string) error

func (*API) KeycardUnlocked added in v0.109.1

func (api *API) KeycardUnlocked(ctx context.Context, keycardUID string) error

func (*API) MakePartiallyOperableAccoutsFullyOperable added in v0.166.1

func (api *API) MakePartiallyOperableAccoutsFullyOperable(ctx context.Context, password string) (addresses []types.Address, err error)

func (*API) MakePrivateKeyKeypairFullyOperable added in v0.163.4

func (api *API) MakePrivateKeyKeypairFullyOperable(ctx context.Context, privateKey string, password string) error

Creates all keystore files for a keypair and mark it in db as fully operable.

func (*API) MakeSeedPhraseKeypairFullyOperable added in v0.163.4

func (api *API) MakeSeedPhraseKeypairFullyOperable(ctx context.Context, mnemonic string, password string) error

Creates all keystore files for a keypair and mark it in db as fully operable.

func (*API) MigrateNonProfileKeycardKeypairToApp added in v0.166.3

func (api *API) MigrateNonProfileKeycardKeypairToApp(ctx context.Context, mnemonic string, password string) error

func (*API) MoveWalletAccount added in v0.162.9

func (api *API) MoveWalletAccount(ctx context.Context, fromPosition int64, toPosition int64) error

func (*API) SaveAccount added in v0.147.0

func (api *API) SaveAccount(ctx context.Context, account *accounts.Account) error

func (*API) SaveKeypair added in v0.152.2

func (api *API) SaveKeypair(ctx context.Context, keypair *accounts.Keypair) error

Setting `Keypair` without `Accounts` will update keypair only, `Keycards` won't be saved/updated this way.

func (*API) SaveOrUpdateKeycard added in v0.161.6

func (api *API) SaveOrUpdateKeycard(ctx context.Context, keycard *accounts.Keycard, accountsComingFromKeycard bool) error

If keypair is migrated from keycard to app, then `accountsComingFromKeycard` should be set to true, otherwise false. If keycard is new `Position` will be determined and set by the backend and `KeycardLocked` will be set to false. If keycard is already added, `Position` and `KeycardLocked` will be unchanged.

func (*API) SetKeycardName added in v0.109.1

func (api *API) SetKeycardName(ctx context.Context, keycardUID string, kpName string) error

func (*API) UpdateKeycardUID added in v0.110.2

func (api *API) UpdateKeycardUID(ctx context.Context, oldKeycardUID string, newKeycardUID string) error

func (*API) UpdateKeypairName added in v0.152.2

func (api *API) UpdateKeypairName(ctx context.Context, keyUID string, name string) error

Setting `Keypair` without `Accounts` will update keypair only.

func (*API) UpdateTokenPreferences added in v0.171.27

func (api *API) UpdateTokenPreferences(ctx context.Context, preferences []walletsettings.TokenPreferences) error

func (*API) VerifyKeystoreFileForAccount added in v0.147.0

func (api *API) VerifyKeystoreFileForAccount(address types.Address, password string) bool

func (*API) VerifyPassword added in v0.107.1

func (api *API) VerifyPassword(password string) bool

type DerivedAddress added in v0.98.3

type DerivedAddress struct {
	Address        common.Address `json:"address"`
	Path           string         `json:"path"`
	HasActivity    bool           `json:"hasActivity"`
	AlreadyCreated bool           `json:"alreadyCreated"`
}

type MultiAccountsAPI

type MultiAccountsAPI struct {
	// contains filtered or unexported fields
}

MultiAccountsAPI is class with methods available over RPC.

func NewMultiAccountsAPI

func NewMultiAccountsAPI(db *multiaccounts.Database, mediaServer *server.MediaServer) *MultiAccountsAPI

func (*MultiAccountsAPI) DeleteIdentityImage added in v0.65.0

func (api *MultiAccountsAPI) DeleteIdentityImage(keyUID string) error

DeleteIdentityImage deletes an IdentityImage from the db with the given name

func (*MultiAccountsAPI) GetIdentityImage added in v0.65.0

func (api *MultiAccountsAPI) GetIdentityImage(keyUID, name string) (*images.IdentityImage, error)

GetIdentityImage returns a json object representing the image with the given name

func (*MultiAccountsAPI) GetIdentityImages added in v0.65.0

func (api *MultiAccountsAPI) GetIdentityImages(keyUID string) ([]*images.IdentityImage, error)

GetIdentityImages returns an array of json marshalled IdentityImages assigned to the user's identity

func (*MultiAccountsAPI) StoreIdentityImage added in v0.65.0

func (api *MultiAccountsAPI) StoreIdentityImage(keyUID, filepath string, aX, aY, bX, bY int) ([]images.IdentityImage, error)

StoreIdentityImage takes the filepath of an image, crops it as per the rect coords and finally resizes the image. The resulting image(s) will be stored in the DB along with other user account information. aX and aY represent the pixel coordinates of the upper left corner of the image's cropping area bX and bY represent the pixel coordinates of the lower right corner of the image's cropping area

func (*MultiAccountsAPI) StoreIdentityImageFromURL added in v0.87.2

func (api *MultiAccountsAPI) StoreIdentityImageFromURL(keyUID, url string) ([]images.IdentityImage, error)

func (*MultiAccountsAPI) UpdateAccount

func (api *MultiAccountsAPI) UpdateAccount(account multiaccounts.Account) error

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is a browsers service.

func NewService

func NewService(db *accounts.Database, mdb *multiaccounts.Database, manager *account.GethManager, config *params.NodeConfig, feed *event.Feed, mediaServer *server.MediaServer) *Service

NewService initializes service instance.

func (*Service) APIs

func (s *Service) APIs() []rpc.API

APIs returns list of available RPC APIs.

func (*Service) AccountsAPI added in v0.171.5

func (s *Service) AccountsAPI() *API

func (*Service) GetKeypairByKeyUID added in v0.152.2

func (s *Service) GetKeypairByKeyUID(keyUID string) (*accounts.Keypair, error)

func (*Service) GetMessenger added in v0.122.1

func (s *Service) GetMessenger() *protocol.Messenger

func (*Service) GetSettings added in v0.118.0

func (s *Service) GetSettings() (settings.Settings, error)

func (*Service) Init added in v0.102.6

func (s *Service) Init(messenger *protocol.Messenger)

func (*Service) Protocols

func (s *Service) Protocols() []p2p.Protocol

Protocols returns list of p2p protocols.

func (*Service) Start

func (s *Service) Start() error

Start a service.

func (*Service) Stop

func (s *Service) Stop() error

Stop a service.

func (*Service) VerifyPassword added in v0.163.14

func (s *Service) VerifyPassword(password string) bool

type SettingsAPI

type SettingsAPI struct {
	// contains filtered or unexported fields
}

SettingsAPI is class with methods available over RPC.

func NewSettingsAPI

func NewSettingsAPI(messenger **protocol.Messenger, db *accounts.Database, config *params.NodeConfig) *SettingsAPI
func (api *SettingsAPI) AddOrReplaceSocialLinks(links identity.SocialLinks) error

func (*SettingsAPI) DeleteExemptions added in v0.100.0

func (api *SettingsAPI) DeleteExemptions(id string) error

func (*SettingsAPI) GetSettings added in v0.38.4

func (api *SettingsAPI) GetSettings(ctx context.Context) (settings.Settings, error)
func (api *SettingsAPI) GetSocialLinks() (identity.SocialLinks, error)

func (*SettingsAPI) MnemonicWasShown added in v0.171.26

func (api *SettingsAPI) MnemonicWasShown() error

func (*SettingsAPI) NodeConfig added in v0.93.2

func (api *SettingsAPI) NodeConfig(ctx context.Context) (*params.NodeConfig, error)

NodeConfig returns the currently used node configuration

func (*SettingsAPI) NotificationsGetAllMessages added in v0.100.0

func (api *SettingsAPI) NotificationsGetAllMessages() (string, error)

func (*SettingsAPI) NotificationsGetAllowNotifications added in v0.100.0

func (api *SettingsAPI) NotificationsGetAllowNotifications() (bool, error)

Notifications Settings

func (*SettingsAPI) NotificationsGetContactRequests added in v0.100.0

func (api *SettingsAPI) NotificationsGetContactRequests() (string, error)

func (*SettingsAPI) NotificationsGetExGlobalMentions added in v0.100.0

func (api *SettingsAPI) NotificationsGetExGlobalMentions(id string) (string, error)

func (*SettingsAPI) NotificationsGetExMuteAllMessages added in v0.100.0

func (api *SettingsAPI) NotificationsGetExMuteAllMessages(id string) (bool, error)

Notifications Settings - Exemption settings

func (*SettingsAPI) NotificationsGetExOtherMessages added in v0.100.0

func (api *SettingsAPI) NotificationsGetExOtherMessages(id string) (string, error)

func (*SettingsAPI) NotificationsGetExPersonalMentions added in v0.100.0

func (api *SettingsAPI) NotificationsGetExPersonalMentions(id string) (string, error)

func (*SettingsAPI) NotificationsGetGlobalMentions added in v0.100.0

func (api *SettingsAPI) NotificationsGetGlobalMentions() (string, error)

func (*SettingsAPI) NotificationsGetGroupChats added in v0.100.0

func (api *SettingsAPI) NotificationsGetGroupChats() (string, error)

func (*SettingsAPI) NotificationsGetIdentityVerificationRequests added in v0.100.0

func (api *SettingsAPI) NotificationsGetIdentityVerificationRequests() (string, error)

func (*SettingsAPI) NotificationsGetMessagePreview added in v0.100.0

func (api *SettingsAPI) NotificationsGetMessagePreview() (int, error)

func (*SettingsAPI) NotificationsGetOneToOneChats added in v0.100.0

func (api *SettingsAPI) NotificationsGetOneToOneChats() (string, error)

func (*SettingsAPI) NotificationsGetPersonalMentions added in v0.100.0

func (api *SettingsAPI) NotificationsGetPersonalMentions() (string, error)

func (*SettingsAPI) NotificationsGetSoundEnabled added in v0.100.0

func (api *SettingsAPI) NotificationsGetSoundEnabled() (bool, error)

func (*SettingsAPI) NotificationsGetVolume added in v0.100.0

func (api *SettingsAPI) NotificationsGetVolume() (int, error)

func (*SettingsAPI) NotificationsSetAllMessages added in v0.100.0

func (api *SettingsAPI) NotificationsSetAllMessages(value string) error

func (*SettingsAPI) NotificationsSetAllowNotifications added in v0.100.0

func (api *SettingsAPI) NotificationsSetAllowNotifications(value bool) error

func (*SettingsAPI) NotificationsSetContactRequests added in v0.100.0

func (api *SettingsAPI) NotificationsSetContactRequests(value string) error

func (*SettingsAPI) NotificationsSetExemptions added in v0.100.0

func (api *SettingsAPI) NotificationsSetExemptions(id string, muteAllMessages bool, personalMentions string,
	globalMentions string, otherMessages string) error

func (*SettingsAPI) NotificationsSetGlobalMentions added in v0.100.0

func (api *SettingsAPI) NotificationsSetGlobalMentions(value string) error

func (*SettingsAPI) NotificationsSetGroupChats added in v0.100.0

func (api *SettingsAPI) NotificationsSetGroupChats(value string) error

func (*SettingsAPI) NotificationsSetIdentityVerificationRequests added in v0.100.0

func (api *SettingsAPI) NotificationsSetIdentityVerificationRequests(value string) error

func (*SettingsAPI) NotificationsSetMessagePreview added in v0.100.0

func (api *SettingsAPI) NotificationsSetMessagePreview(value int) error

func (*SettingsAPI) NotificationsSetOneToOneChats added in v0.100.0

func (api *SettingsAPI) NotificationsSetOneToOneChats(value string) error

func (*SettingsAPI) NotificationsSetPersonalMentions added in v0.100.0

func (api *SettingsAPI) NotificationsSetPersonalMentions(value string) error

func (*SettingsAPI) NotificationsSetSoundEnabled added in v0.100.0

func (api *SettingsAPI) NotificationsSetSoundEnabled(value bool) error

func (*SettingsAPI) NotificationsSetVolume added in v0.100.0

func (api *SettingsAPI) NotificationsSetVolume(value int) error

func (*SettingsAPI) SaveNodeConfig

func (api *SettingsAPI) SaveNodeConfig(ctx context.Context, n *params.NodeConfig) error

Saves the nodeconfig in the database. The node must be restarted for the changes to be applied

func (*SettingsAPI) SaveSetting added in v0.38.4

func (api *SettingsAPI) SaveSetting(ctx context.Context, typ string, val interface{}) error

func (*SettingsAPI) SetBio added in v0.105.1

func (api *SettingsAPI) SetBio(bio string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL