api

package
v0.62.14 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: MPL-2.0 Imports: 42 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")
	// ErrWakuClearIdentitiesFailure clearing whisper identities has failed.
	ErrWakuClearIdentitiesFailure = errors.New("failed to clear waku identities")
	// 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")
)

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) ConnectionChange added in v0.36.0

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

ConnectionChange handles network state changes logic.

func (*GethStatusBackend) DeleteMulticcount added in v0.55.2

func (b *GethStatusBackend) DeleteMulticcount(keyUID string, keyStoreDir 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) GetNodesFromContract added in v0.36.0

func (b *GethStatusBackend) GetNodesFromContract(rpcEndpoint string, contractAddress string) ([]string, error)

GetNodesFromContract returns a list of nodes from the contract

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) InjectChatAccount added in v0.36.0

func (b *GethStatusBackend) InjectChatAccount(chatKeyHex, _ string) error

InjectChatAccount selects the current chat account using chatKeyHex and injects the key into whisper. TODO: change the interface and omit the last argument.

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) 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) 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 accounts.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) 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) 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) error

func (*GethStatusBackend) StartNodeWithAccountAndConfig added in v0.36.0

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

StartNodeWithAccountAndConfig 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) StartWallet added in v0.56.7

func (b *GethStatusBackend) StartWallet() error

func (*GethStatusBackend) StatusNode added in v0.36.0

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

StatusNode returns reference to node manager

func (*GethStatusBackend) StopNode added in v0.36.0

func (b *GethStatusBackend) StopNode() error

StopNode stop Status node. Stopped node cannot be resumed.

func (*GethStatusBackend) StopWallet added in v0.56.7

func (b *GethStatusBackend) StopWallet() 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)

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) error
	StartNodeWithAccountAndConfig(account multiaccounts.Account, password string, settings accounts.Settings, conf *params.NodeConfig, subaccs []accounts.Account) error
	StopNode() 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 accounts.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)
	GetNodesFromContract(rpcEndpoint string, contractAddress string) ([]string, error)
	HashTransaction(sendArgs transactions.SendTxArgs) (transactions.SendTxArgs, types.Hash, error)
	HashTypedData(typed typeddata.TypedData) (types.Hash, error)
	ResetChainData() error
	SendTransaction(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)

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

	InjectChatAccount(chatKeyHex, encryptionKeyHex string) error // NOTE: Only used in lib and in tests
	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