accounts

package
v0.131.4 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: MPL-2.0 Imports: 21 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) AddAccountWatch added in v0.93.3

func (api *API) AddAccountWatch(ctx context.Context, address string, name string, color string, emoji string) error

func (*API) AddAccountWithMnemonic added in v0.93.3

func (api *API) AddAccountWithMnemonic(
	ctx context.Context,
	mnemonic string,
	password string,
	name string,
	color string,
	emoji string,
) error

func (*API) AddAccountWithMnemonicAndPath added in v0.98.3

func (api *API) AddAccountWithMnemonicAndPath(
	ctx context.Context,
	mnemonic string,
	password string,
	name string,
	color string,
	emoji string,
	path string,
) error

func (*API) AddAccountWithMnemonicAndPathPasswordVerified added in v0.114.1

func (api *API) AddAccountWithMnemonicAndPathPasswordVerified(
	ctx context.Context,
	mnemonic string,
	password string,
	name string,
	color string,
	emoji string,
	path string,
) error

func (*API) AddAccountWithMnemonicPasswordVerified added in v0.114.1

func (api *API) AddAccountWithMnemonicPasswordVerified(
	ctx context.Context,
	mnemonic string,
	password string,
	name string,
	color string,
	emoji string,
) error

func (*API) AddAccountWithPrivateKey added in v0.93.3

func (api *API) AddAccountWithPrivateKey(
	ctx context.Context,
	privateKey string,
	password string,
	name string,
	color string,
	emoji string,
) error

func (*API) AddAccountWithPrivateKeyPasswordVerified added in v0.114.1

func (api *API) AddAccountWithPrivateKeyPasswordVerified(
	ctx context.Context,
	privateKey string,
	password string,
	name string,
	color string,
	emoji string,
) error

AddAccountWithPrivateKeyPasswordVerified adds an accounts.Account created from the given private key assuming that client has already authenticated logged in use, this function doesn't verify a password.

func (*API) AddMigratedKeyPair added in v0.109.1

func (api *API) AddMigratedKeyPair(ctx context.Context, kcUID string, kpName string, keyUID string, accountAddresses []string, password string) error

func (*API) DeleteAccount added in v0.38.1

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

func (*API) DeleteKeycard added in v0.109.1

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

func (*API) DeleteKeypair added in v0.125.4

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

func (*API) GenerateAccount added in v0.93.3

func (api *API) GenerateAccount(
	ctx context.Context,
	password string,
	name string,
	color string,
	emoji string,
) error

func (*API) GenerateAccountPasswordVerified added in v0.114.1

func (api *API) GenerateAccountPasswordVerified(
	ctx context.Context,
	password string,
	name string,
	color string,
	emoji string,
) error

func (*API) GenerateAccountWithDerivedPath added in v0.98.3

func (api *API) GenerateAccountWithDerivedPath(
	ctx context.Context,
	password string,
	name string,
	color string,
	emoji string,
	path string,
	derivedFrom string,
) error

func (*API) GenerateAccountWithDerivedPathPasswordVerified added in v0.114.1

func (api *API) GenerateAccountWithDerivedPathPasswordVerified(
	ctx context.Context,
	password string,
	name string,
	color string,
	emoji string,
	path string,
	derivedFrom string,
) 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) ([]*keypairs.KeyPair, error)

func (*API) GetAllMigratedKeyPairs added in v0.109.1

func (api *API) GetAllMigratedKeyPairs(ctx context.Context) ([]*keypairs.KeyPair, error)

func (*API) GetMigratedKeyPairByKeyUID added in v0.109.1

func (api *API) GetMigratedKeyPairByKeyUID(ctx context.Context, keyUID string) ([]*keypairs.KeyPair, error)

func (*API) KeycardLocked added in v0.109.1

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

func (*API) KeycardUnlocked added in v0.109.1

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

func (*API) RemoveMigratedAccountsForKeycard added in v0.125.0

func (api *API) RemoveMigratedAccountsForKeycard(ctx context.Context, kcUID string, accountAddresses []string) error

func (*API) SaveAccounts

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

func (*API) SetKeycardName added in v0.109.1

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

func (*API) UpdateKeycardUID added in v0.110.2

func (api *API) UpdateKeycardUID(ctx context.Context, oldKcUID string, newKcUID string) error

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) GetAccountsByKeyUID added in v0.118.0

func (s *Service) GetAccountsByKeyUID(keyUID string) ([]*accounts.Account, 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.

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 (*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) 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
func (api *SettingsAPI) SetSocialLinks(socialLinks identity.SocialLinks) error

Jump to

Keyboard shortcuts

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