Documentation ¶
Index ¶
- Constants
- Variables
- func AddTestAccounts(t *testing.T, db *sql.DB, accounts []*Account)
- func SameAccounts(expected, real *Account) bool
- func SameAccountsWithDifferentOperable(expected, real *Account, expectedOperableValue AccountOperable) bool
- func SameKeycards(expected, real *Keycard) bool
- func SameKeypairs(expected, real *Keypair) bool
- func SameKeypairsWithDifferentSyncedFrom(expected, real *Keypair, ignoreSyncedFrom bool, expectedSyncedFromValue string, ...) bool
- type Account
- type AccountOperable
- type AccountType
- type Database
- func (db *Database) AddressExists(address types.Address) (exists bool, err error)
- func (db *Database) Close() error
- func (db *Database) DB() *sql.DB
- func (db *Database) DeleteAccount(address types.Address) error
- func (db *Database) DeleteKeypair(keyUID string) error
- func (db *Database) GetAccountByAddress(address types.Address) (*Account, error)
- func (db *Database) GetAccounts() ([]*Account, error)
- func (db *Database) GetAddresses() (rst []types.Address, err error)
- func (db *Database) GetChatAddress() (rst types.Address, err error)
- func (db *Database) GetKeypairByKeyUID(keyUID string) (*Keypair, error)
- func (db *Database) GetKeypairs() ([]*Keypair, error)
- func (db *Database) GetNodeConfig() (*params.NodeConfig, error)
- func (db *Database) GetPath(address types.Address) (path string, err error)
- func (db *Database) GetWalletAddress() (rst types.Address, err error)
- func (db *Database) GetWalletAddresses() (rst []types.Address, err error)
- func (db *Database) GetWatchOnlyAccounts() (res []*Account, err error)
- func (db *Database) IsAnyAccountPartalyOrFullyOperableForKeyUID(keyUID string) (bool, error)
- func (db *Database) SaveOrUpdateAccounts(accounts []*Account) error
- func (db *Database) SaveOrUpdateKeypair(keypair *Keypair) error
- func (db *Database) UpdateAccountToFullyOperable(keyUID string, address types.Address) (err error)
- func (db *Database) UpdateKeypairName(keyUID string, name string, clock uint64) error
- type Keycard
- type KeycardAction
- type Keycards
- func (kp *Keycards) AddKeycardOrAddAccountsIfKeycardIsAdded(keycard Keycard) (addedKc bool, addedAccs bool, err error)
- func (kp *Keycards) ApplyKeycardsForKeypairWithKeyUID(keyUID string, keycardsToSync []*Keycard) (err error)
- func (kp *Keycards) DeleteAllKeycardsWithKeyUID(keyUID string) (err error)
- func (kp *Keycards) DeleteKeycard(kcUID string, clock uint64) (err error)
- func (kp *Keycards) GetAllKnownKeycards() ([]*Keycard, error)
- func (kp *Keycards) GetAllKnownKeycardsGroupedByKeyUID() ([]*Keycard, error)
- func (kp *Keycards) GetKeycardByKeyUID(keyUID string) ([]*Keycard, error)
- func (kp *Keycards) KeycardLocked(kcUID string, clock uint64) (err error)
- func (kp *Keycards) KeycardUnlocked(kcUID string, clock uint64) (err error)
- func (kp *Keycards) RemoveMigratedAccountsForKeycard(kcUID string, accountAddresses []types.Address, clock uint64) (err error)
- func (kp *Keycards) SetKeycardName(kcUID string, kpName string, clock uint64) (err error)
- func (kp *Keycards) UpdateKeycardUID(oldKcUID string, newKcUID string, clock uint64) (err error)
- type Keypair
- type KeypairType
Constants ¶
View Source
const ( SyncedFromBackup = "backup" // means a account is coming from backed up data SyncedFromLocalPairing = "local-pairing" // means a account is coming from another device when user is reocovering Status account )
View Source
const (
// NodeConfigTag tag for a node configuration.
NodeConfigTag = "node_config"
)
Variables ¶
View Source
var ( ErrDbKeypairNotFound = errors.New("accounts: keypair is not found") ErrDbAccountNotFound = errors.New("accounts: account is not found") ErrKeypairDifferentAccountsKeyUID = errors.New("cannot store keypair with different accounts' key uid than keypair's key uid") ErrKeypairWithoutAccounts = errors.New("cannot store keypair without accounts") )
Functions ¶
func AddTestAccounts ¶ added in v0.152.2
func SameAccounts ¶ added in v0.152.2
func SameAccountsWithDifferentOperable ¶ added in v0.152.2
func SameAccountsWithDifferentOperable(expected, real *Account, expectedOperableValue AccountOperable) bool
func SameKeycards ¶ added in v0.152.2
func SameKeypairs ¶ added in v0.152.2
func SameKeypairsWithDifferentSyncedFrom ¶ added in v0.152.2
func SameKeypairsWithDifferentSyncedFrom(expected, real *Keypair, ignoreSyncedFrom bool, expectedSyncedFromValue string, expectedOperableValue AccountOperable) bool
Types ¶
type Account ¶
type Account struct { Address types.Address `json:"address"` KeyUID string `json:"key-uid"` Wallet bool `json:"wallet"` Chat bool `json:"chat"` Type AccountType `json:"type,omitempty"` Path string `json:"path,omitempty"` PublicKey types.HexBytes `json:"public-key,omitempty"` Name string `json:"name"` Emoji string `json:"emoji"` ColorID common.CustomizationColor `json:"colorId,omitempty"` Hidden bool `json:"hidden"` Clock uint64 `json:"clock,omitempty"` Removed bool `json:"removed,omitempty"` Operable AccountOperable `json:"operable"` // describes an account's operability (read an explanation at the top of this file) CreatedAt int64 `json:"createdAt"` }
func GetWatchOnlyAccountsForTest ¶ added in v0.152.2
func GetWatchOnlyAccountsForTest() []*Account
func (*Account) IsOwnAccount ¶ added in v0.64.6
IsOwnAccount returns true if this is an account we have the private key for NOTE: Wallet flag can't be used as it actually indicates that it's the default Wallet
func (*Account) MarshalJSON ¶ added in v0.100.0
type AccountOperable ¶ added in v0.152.2
type AccountOperable string
const ( AccountNonOperable AccountOperable = "no" // an account is non operable it is not a keycard account and there is no keystore file for it and no keystore file for the address it is derived from AccountPartiallyOperable AccountOperable = "partially" // an account is partially operable if it is not a keycard account and there is created keystore file for the address it is derived from AccountFullyOperable AccountOperable = "fully" // an account is fully operable if it is not a keycard account and there is a keystore file for it )
func (AccountOperable) String ¶ added in v0.152.2
func (a AccountOperable) String() string
type AccountType ¶ added in v0.106.3
type AccountType string
const ( AccountTypeGenerated AccountType = "generated" AccountTypeKey AccountType = "key" AccountTypeSeed AccountType = "seed" AccountTypeWatch AccountType = "watch" )
func (AccountType) String ¶ added in v0.106.3
func (a AccountType) String() string
type Database ¶
type Database struct { *settings.Database *notificationssettings.NotificationsSettings *sociallinkssettings.SocialLinksSettings *Keycards // contains filtered or unexported fields }
Database sql wrapper for operations with browser objects.
func (*Database) AddressExists ¶
AddressExists returns true if given address is stored in database.
func (*Database) DeleteAccount ¶ added in v0.38.1
func (*Database) DeleteKeypair ¶ added in v0.152.2
func (*Database) GetAccountByAddress ¶ added in v0.62.16
func (*Database) GetAccounts ¶
func (*Database) GetChatAddress ¶
func (*Database) GetKeypairByKeyUID ¶ added in v0.152.2
func (*Database) GetKeypairs ¶ added in v0.152.2
func (*Database) GetNodeConfig ¶ added in v0.38.4
func (db *Database) GetNodeConfig() (*params.NodeConfig, error)
func (*Database) GetPath ¶ added in v0.102.6
GetPath returns true if account with given address was recently key and doesn't have a key yet
func (*Database) GetWalletAddress ¶
func (*Database) GetWalletAddresses ¶ added in v0.40.0
func (*Database) GetWatchOnlyAccounts ¶ added in v0.152.2
func (*Database) IsAnyAccountPartalyOrFullyOperableForKeyUID ¶ added in v0.152.2
func (*Database) SaveOrUpdateAccounts ¶ added in v0.152.2
func (*Database) SaveOrUpdateKeypair ¶ added in v0.152.2
func (*Database) UpdateAccountToFullyOperable ¶ added in v0.152.2
this doesn't update clock
type Keycard ¶ added in v0.152.2
type Keycard struct { KeycardUID string `json:"keycard-uid"` KeycardName string `json:"keycard-name"` KeycardLocked bool `json:"keycard-locked"` AccountsAddresses []types.Address `json:"accounts-addresses"` KeyUID string `json:"key-uid"` LastUpdateClock uint64 }
func GetKeycardForSeedImportedKeypair1ForTest ¶ added in v0.152.2
func GetKeycardForSeedImportedKeypair1ForTest() *Keycard
func GetKeycardForSeedImportedKeypair2ForTest ¶ added in v0.152.2
func GetKeycardForSeedImportedKeypair2ForTest() *Keycard
func GetProfileKeycardForTest ¶ added in v0.152.2
func GetProfileKeycardForTest() *Keycard
func (*Keycard) FromSyncKeycard ¶ added in v0.152.2
func (kp *Keycard) FromSyncKeycard(kc *protobuf.SyncKeycard)
func (*Keycard) ToSyncKeycard ¶ added in v0.152.2
func (kp *Keycard) ToSyncKeycard() *protobuf.SyncKeycard
type KeycardAction ¶ added in v0.152.2
type Keycards ¶ added in v0.152.2
type Keycards struct {
// contains filtered or unexported fields
}
func NewKeycards ¶ added in v0.152.2
func (*Keycards) AddKeycardOrAddAccountsIfKeycardIsAdded ¶ added in v0.152.2
func (*Keycards) ApplyKeycardsForKeypairWithKeyUID ¶ added in v0.152.2
func (*Keycards) DeleteAllKeycardsWithKeyUID ¶ added in v0.152.2
func (*Keycards) DeleteKeycard ¶ added in v0.152.2
func (*Keycards) GetAllKnownKeycards ¶ added in v0.152.2
func (*Keycards) GetAllKnownKeycardsGroupedByKeyUID ¶ added in v0.152.2
func (*Keycards) GetKeycardByKeyUID ¶ added in v0.152.2
func (*Keycards) KeycardLocked ¶ added in v0.152.2
func (*Keycards) KeycardUnlocked ¶ added in v0.152.2
func (*Keycards) RemoveMigratedAccountsForKeycard ¶ added in v0.152.2
func (*Keycards) SetKeycardName ¶ added in v0.152.2
type Keypair ¶ added in v0.152.2
type Keypair struct { KeyUID string `json:"key-uid"` Name string `json:"name"` Type KeypairType `json:"type"` DerivedFrom string `json:"derived-from"` LastUsedDerivationIndex uint64 `json:"last-used-derivation-index,omitempty"` SyncedFrom string `json:"synced-from,omitempty"` // keeps an info which device this keypair is added from can be one of two values defined in constants or device name (custom) Clock uint64 `json:"clock,omitempty"` Accounts []*Account `json:"accounts"` }
func GetPrivKeyImportedKeypairForTest ¶ added in v0.152.2
func GetPrivKeyImportedKeypairForTest() *Keypair
func GetProfileKeypairForTest ¶ added in v0.152.2
func GetSeedImportedKeypair1ForTest ¶ added in v0.152.2
func GetSeedImportedKeypair1ForTest() *Keypair
func GetSeedImportedKeypair2ForTest ¶ added in v0.152.2
func GetSeedImportedKeypair2ForTest() *Keypair
func (*Keypair) CopyKeypair ¶ added in v0.152.2
func (*Keypair) GetChatPublicKey ¶ added in v0.154.2
func (*Keypair) MarshalJSON ¶ added in v0.152.2
type KeypairType ¶ added in v0.152.2
type KeypairType string
const ( KeypairTypeProfile KeypairType = "profile" KeypairTypeKey KeypairType = "key" KeypairTypeSeed KeypairType = "seed" )
func (KeypairType) String ¶ added in v0.152.2
func (a KeypairType) String() string
Click to show internal directories.
Click to hide internal directories.