api

package
v0.138.2 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: MPL-2.0 Imports: 40 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrWhisperClearIdentitiesFailure clearing whisper identities has failed.
	ErrWhisperClearIdentitiesFailure = errors.New("failed to clear whisper identities")
	// ErrWhisperIdentityInjectionFailure injecting whisper identities has failed.
	ErrWhisperIdentityInjectionFailure = errors.New("failed to inject identity into Whisper")
	// ErrWakuIdentityInjectionFailure injecting whisper identities has failed.
	ErrWakuIdentityInjectionFailure = errors.New("failed to inject identity into waku")
	// ErrUnsupportedRPCMethod is for methods not supported by the RPC interface
	ErrUnsupportedRPCMethod = errors.New("method is unsupported by RPC interface")
	// ErrRPCClientUnavailable is returned if an RPC client can't be retrieved.
	// This is a normal situation when a node is stopped.
	ErrRPCClientUnavailable = errors.New("JSON-RPC client is unavailable")
	// ErrDBNotAvailable is returned if a method is called before the DB is available for usage
	ErrDBNotAvailable = errors.New("DB is unavailable")
	// ErrConfigNotAvailable is returned if a method is called before the nodeconfig is set
	ErrConfigNotAvailable = errors.New("NodeConfig is not available")
)

Functions

func HashMessage added in v0.35.0

func HashMessage(message string) ([]byte, error)

HashMessage calculates the hash of a message to be safely signed by the keycard The hash is calulcated as

keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).

This gives context to the signed message and prevents signing of transactions.

func RunAsync

func RunAsync(f func() error) <-chan error

RunAsync runs the specified function asynchronously.

Types

type GethStatusBackend added in v0.36.0

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

GethStatusBackend implements the Status.im service over go-ethereum

func NewGethStatusBackend added in v0.36.0

func NewGethStatusBackend() *GethStatusBackend

NewGethStatusBackend create a new GethStatusBackend instance

func (*GethStatusBackend) AccountManager added in v0.36.0

func (b *GethStatusBackend) AccountManager() *account.GethManager

AccountManager returns reference to account manager

func (*GethStatusBackend) AppStateChange added in v0.36.0

func (b *GethStatusBackend) AppStateChange(state string)

AppStateChange handles app state changes (background/foreground). state values: see https://facebook.github.io/react-native/docs/appstate.html

func (*GethStatusBackend) CallPrivateRPC added in v0.36.0

func (b *GethStatusBackend) CallPrivateRPC(inputJSON string) (string, error)

CallPrivateRPC executes public and private RPC requests on node's in-proc RPC server.

func (*GethStatusBackend) CallRPC added in v0.36.0

func (b *GethStatusBackend) CallRPC(inputJSON string) (string, error)

CallRPC executes public RPC requests on node's in-proc RPC server.

func (*GethStatusBackend) ChangeDatabasePassword added in v0.80.2

func (b *GethStatusBackend) ChangeDatabasePassword(keyUID string, password string, newPassword string) error

func (*GethStatusBackend) ConnectionChange added in v0.36.0

func (b *GethStatusBackend) ConnectionChange(typ string, expensive bool)

ConnectionChange handles network state changes logic.

func (*GethStatusBackend) ConvertToKeycardAccount added in v0.83.0

func (b *GethStatusBackend) ConvertToKeycardAccount(account multiaccounts.Account, s settings.Settings, password string, newPassword string) error

func (*GethStatusBackend) ConvertToRegularAccount added in v0.125.4

func (b *GethStatusBackend) ConvertToRegularAccount(mnemonic string, currPassword string, newPassword string) error

func (*GethStatusBackend) DeleteImportedKey added in v0.83.12

func (b *GethStatusBackend) DeleteImportedKey(address, password, keyStoreDir string) error

func (*GethStatusBackend) DeleteMultiaccount added in v0.102.6

func (b *GethStatusBackend) DeleteMultiaccount(keyUID string, keyStoreDir string) error

func (*GethStatusBackend) ExportUnencryptedDatabase added in v0.69.0

func (b *GethStatusBackend) ExportUnencryptedDatabase(acc multiaccounts.Account, password, directory string) error

func (*GethStatusBackend) ExtractGroupMembershipSignatures added in v0.36.0

func (b *GethStatusBackend) ExtractGroupMembershipSignatures(signaturePairs [][2]string) ([]string, error)

ExtractGroupMembershipSignatures extract signatures from tuples of content/signature

func (*GethStatusBackend) GetAccounts added in v0.36.0

func (b *GethStatusBackend) GetAccounts() ([]multiaccounts.Account, error)

func (*GethStatusBackend) GetActiveAccount added in v0.65.0

func (b *GethStatusBackend) GetActiveAccount() (*multiaccounts.Account, error)

func (*GethStatusBackend) GetMultiaccountDB added in v0.109.1

func (b *GethStatusBackend) GetMultiaccountDB() *multiaccounts.Database

func (*GethStatusBackend) GetNodeConfig added in v0.77.1

func (b *GethStatusBackend) GetNodeConfig() (*params.NodeConfig, error)

func (*GethStatusBackend) HashTransaction added in v0.36.0

HashTransaction validate the transaction and returns new sendArgs and the transaction hash.

func (*GethStatusBackend) HashTypedData added in v0.36.0

func (b *GethStatusBackend) HashTypedData(typed typeddata.TypedData) (types.Hash, error)

HashTypedData generates the hash of TypedData.

func (*GethStatusBackend) HashTypedDataV4 added in v0.76.4

func (b *GethStatusBackend) HashTypedDataV4(typed signercore.TypedData) (types.Hash, error)

HashTypedDataV4 generates the hash of TypedData.

func (*GethStatusBackend) ImportUnencryptedDatabase added in v0.69.0

func (b *GethStatusBackend) ImportUnencryptedDatabase(acc multiaccounts.Account, password, databasePath string) error

func (*GethStatusBackend) IsNodeRunning added in v0.36.0

func (b *GethStatusBackend) IsNodeRunning() bool

IsNodeRunning confirm that node is running

func (*GethStatusBackend) Logout added in v0.36.0

func (b *GethStatusBackend) Logout() error

Logout clears whisper identities.

func (*GethStatusBackend) Messenger added in v0.118.0

func (b *GethStatusBackend) Messenger() *protocol.Messenger

func (*GethStatusBackend) MigrateKeyStoreDir added in v0.55.1

func (b *GethStatusBackend) MigrateKeyStoreDir(acc multiaccounts.Account, password, oldDir, newDir string) error

func (*GethStatusBackend) OpenAccounts added in v0.36.0

func (b *GethStatusBackend) OpenAccounts() error

func (*GethStatusBackend) OverwriteNodeConfigValues added in v0.98.5

func (b *GethStatusBackend) OverwriteNodeConfigValues(conf *params.NodeConfig, n *params.NodeConfig) (*params.NodeConfig, error)

func (*GethStatusBackend) Recover added in v0.36.0

func (b *GethStatusBackend) Recover(rpcParams personal.RecoverParams) (types.Address, error)

Recover calls the personalAPI to return address associated with the private key that was used to calculate the signature in the message

func (*GethStatusBackend) ResetChainData added in v0.36.0

func (b *GethStatusBackend) ResetChainData() error

ResetChainData remove chain data from data directory. Node is stopped, and new node is started, with clean data directory.

func (*GethStatusBackend) RestartNode added in v0.36.0

func (b *GethStatusBackend) RestartNode() error

RestartNode restart running Status node, fails if node is not running

func (*GethStatusBackend) SaveAccount added in v0.36.0

func (b *GethStatusBackend) SaveAccount(account multiaccounts.Account) error

func (*GethStatusBackend) SaveAccountAndStartNodeWithKey added in v0.36.0

func (b *GethStatusBackend) SaveAccountAndStartNodeWithKey(acc multiaccounts.Account, password string, settings settings.Settings, nodecfg *params.NodeConfig, subaccs []*accounts.Account, keyHex string) error

func (*GethStatusBackend) SelectAccount added in v0.36.0

func (b *GethStatusBackend) SelectAccount(loginParams account.LoginParams) error

SelectAccount selects current wallet and chat accounts, by verifying that each address has corresponding account which can be decrypted using provided password. Once verification is done, the decrypted chat key is injected into Whisper (as a single identity, all previous identities are removed).

func (*GethStatusBackend) SelectedAccountKeyID added in v0.45.1

func (b *GethStatusBackend) SelectedAccountKeyID() string

SelectedAccountKeyID returns a Whisper key ID of the selected chat key pair.

func (*GethStatusBackend) SendTransaction added in v0.36.0

func (b *GethStatusBackend) SendTransaction(sendArgs transactions.SendTxArgs, password string) (hash types.Hash, err error)

SendTransaction creates a new transaction and waits until it's complete.

func (*GethStatusBackend) SendTransactionWithChainID added in v0.101.1

func (b *GethStatusBackend) SendTransactionWithChainID(chainID uint64, sendArgs transactions.SendTxArgs, password string) (hash types.Hash, err error)

func (*GethStatusBackend) SendTransactionWithSignature added in v0.36.0

func (b *GethStatusBackend) SendTransactionWithSignature(sendArgs transactions.SendTxArgs, sig []byte) (hash types.Hash, err error)

func (*GethStatusBackend) SignGroupMembership added in v0.36.0

func (b *GethStatusBackend) SignGroupMembership(content string) (string, error)

SignGroupMembership signs a piece of data containing membership information

func (*GethStatusBackend) SignHash added in v0.36.0

func (b *GethStatusBackend) SignHash(hexEncodedHash string) (string, error)

SignHash exposes vanilla ECDSA signing for signing a message for Swarm

func (*GethStatusBackend) SignMessage added in v0.36.0

func (b *GethStatusBackend) SignMessage(rpcParams personal.SignParams) (types.HexBytes, error)

SignMessage checks the pwd vs the selected account and passes on the signParams to personalAPI for message signature

func (*GethStatusBackend) SignTypedData added in v0.36.0

func (b *GethStatusBackend) SignTypedData(typed typeddata.TypedData, address string, password string) (types.HexBytes, error)

SignTypedData accepts data and password. Gets verified account and signs typed data.

func (*GethStatusBackend) SignTypedDataV4 added in v0.76.4

func (b *GethStatusBackend) SignTypedDataV4(typed signercore.TypedData, address string, password string) (types.HexBytes, error)

SignTypedDataV4 accepts data and password. Gets verified account and signs typed data.

func (*GethStatusBackend) StartLocalNotifications added in v0.62.16

func (b *GethStatusBackend) StartLocalNotifications() error

func (*GethStatusBackend) StartNode added in v0.36.0

func (b *GethStatusBackend) StartNode(config *params.NodeConfig) error

StartNode start Status node, fails if node is already started

func (*GethStatusBackend) StartNodeWithAccount added in v0.36.0

func (b *GethStatusBackend) StartNodeWithAccount(acc multiaccounts.Account, password string, nodecfg *params.NodeConfig) error

func (*GethStatusBackend) StartNodeWithAccountAndInitialConfig added in v0.92.6

func (b *GethStatusBackend) StartNodeWithAccountAndInitialConfig(
	account multiaccounts.Account,
	password string,
	settings settings.Settings,
	nodecfg *params.NodeConfig,
	subaccs []*accounts.Account,
) error

StartNodeWithAccountAndInitialConfig is used after account and config was generated. In current setup account name and config is generated on the client side. Once/if it will be generated on status-go side this flow can be simplified.

func (*GethStatusBackend) StartNodeWithKey added in v0.36.0

func (b *GethStatusBackend) StartNodeWithKey(acc multiaccounts.Account, password string, keyHex string) error

func (*GethStatusBackend) StatusNode added in v0.36.0

func (b *GethStatusBackend) StatusNode() *node.StatusNode

StatusNode returns reference to node manager

func (*GethStatusBackend) StopLocalNotifications added in v0.62.16

func (b *GethStatusBackend) StopLocalNotifications() error

func (*GethStatusBackend) StopNode added in v0.36.0

func (b *GethStatusBackend) StopNode() error

StopNode stop Status node. Stopped node cannot be resumed.

func (*GethStatusBackend) SwitchFleet added in v0.96.4

func (b *GethStatusBackend) SwitchFleet(fleet string, conf *params.NodeConfig) error

func (*GethStatusBackend) Transactor added in v0.36.0

func (b *GethStatusBackend) Transactor() *transactions.Transactor

Transactor returns reference to a status transactor

func (*GethStatusBackend) UpdateRootDataDir added in v0.36.0

func (b *GethStatusBackend) UpdateRootDataDir(datadir string)

func (*GethStatusBackend) VerifyDatabasePassword added in v0.83.0

func (b *GethStatusBackend) VerifyDatabasePassword(keyUID string, password string) error

type StatusBackend

type StatusBackend interface {
	// IsNodeRunning() bool                       // NOTE: Only used in tests
	StartNode(config *params.NodeConfig) error // NOTE: Only used in canary
	StartNodeWithKey(acc multiaccounts.Account, password string, keyHex string) error
	StartNodeWithAccount(acc multiaccounts.Account, password string, conf *params.NodeConfig) error
	StartNodeWithAccountAndInitialConfig(account multiaccounts.Account, password string, settings settings.Settings, conf *params.NodeConfig, subaccs []*accounts.Account) error
	StopNode() error

	GetNodeConfig() (*params.NodeConfig, error)
	UpdateRootDataDir(datadir string)

	// SelectAccount(loginParams account.LoginParams) error
	OpenAccounts() error
	GetAccounts() ([]multiaccounts.Account, error)
	// SaveAccount(account multiaccounts.Account) error
	SaveAccountAndStartNodeWithKey(acc multiaccounts.Account, password string, settings settings.Settings, conf *params.NodeConfig, subaccs []*accounts.Account, keyHex string) error
	Recover(rpcParams personal.RecoverParams) (types.Address, error)
	Logout() error

	CallPrivateRPC(inputJSON string) (string, error)
	CallRPC(inputJSON string) (string, error)
	HashTransaction(sendArgs transactions.SendTxArgs) (transactions.SendTxArgs, types.Hash, error)
	HashTypedData(typed typeddata.TypedData) (types.Hash, error)
	HashTypedDataV4(typed signercore.TypedData) (types.Hash, error)
	ResetChainData() error
	SendTransaction(sendArgs transactions.SendTxArgs, password string) (hash types.Hash, err error)
	SendTransactionWithChainID(chainID uint64, sendArgs transactions.SendTxArgs, password string) (hash types.Hash, err error)
	SendTransactionWithSignature(sendArgs transactions.SendTxArgs, sig []byte) (hash types.Hash, err error)
	SignHash(hexEncodedHash string) (string, error)
	SignMessage(rpcParams personal.SignParams) (types.HexBytes, error)
	SignTypedData(typed typeddata.TypedData, address string, password string) (types.HexBytes, error)
	SignTypedDataV4(typed signercore.TypedData, address string, password string) (types.HexBytes, error)

	ConnectionChange(typ string, expensive bool)
	AppStateChange(state string)

	ExtractGroupMembershipSignatures(signaturePairs [][2]string) ([]string, error)
	SignGroupMembership(content string) (string, error)
}

StatusBackend defines the contract for the Status.im service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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