statusgo

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: MPL-2.0 Imports: 50 Imported by: 1

README

Mobile

Package mobile implements gomobile bindings for status-go. Current implementation servers as a drop-in replacement for lib package.

Individual bindings and their descriptions are available in status.go.

The primary consumer of this package is status-mobile project.

The framework name is generated from the package name, hence these things are done intentionally: (1) this package's name isn't equal to the directory name (statusgo vs mobile respectively); (2) this package name is statusgo and not status which produces the right framework name.

Usage

For properly using this package, please refer to Makefile in the root of status-go directory.

To manually build library, run following commands:

iOS
gomobile bind -v -target=ios -ldflags="-s -w" github.com/status-im/status-go/mobile

This will produce Statusgo.framework file in the current directory, which can be used in iOS project.

Android
gomobile bind -v -target=android -ldflags="-s -w" github.com/status-im/status-go/mobile

This will generate Statusgo.aar file in the current dir.

Notes

See https://github.com/golang/go/wiki/Mobile for more information on gomobile usage.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCentralizedMetric added in v0.181.35

func AddCentralizedMetric(requestJSON string) string

func AddPeer

func AddPeer(enode string) string

func AppStateChange

func AppStateChange(state string)

func CallPrivateRPC

func CallPrivateRPC(inputJSON string) string

func CallRPC

func CallRPC(inputJSON string) string

func CentralizedMetricsInfo added in v0.182.36

func CentralizedMetricsInfo() string

func ChangeDatabasePassword added in v0.80.2

func ChangeDatabasePassword(KeyUID, password, newPassword string) string

func CheckAddressChecksum added in v0.111.5

func CheckAddressChecksum(address string) string

func ColorHash added in v0.96.0

func ColorHash(pk string) string

func ColorID added in v0.98.3

func ColorID(pk string) string

func CompressPublicKey added in v0.114.3

func CompressPublicKey(key string) string

func ConnectionChange

func ConnectionChange(typ string, expensive int)

func ConvertToKeycardAccount added in v0.83.0

func ConvertToKeycardAccount(accountData, settingsJSON, keycardUID, password, newPassword string) string

func ConvertToRegularAccount added in v0.125.4

func ConvertToRegularAccount(mnemonic, currPassword, newPassword string) string

func CreateAccountAndLogin added in v0.138.8

func CreateAccountAndLogin(requestJSON string) string

func CreateAccountFromMnemonicAndDeriveAccountsForPaths added in v0.114.2

func CreateAccountFromMnemonicAndDeriveAccountsForPaths(paramsJSON string) string

CreateAccountFromMnemonicAndDeriveAccountsForPaths returns an account derived from the mnemonic phrase and the Bip39Passphrase and generate derived accounts for the list of paths without storing it

func CreateAccountFromPrivateKey added in v0.142.1

func CreateAccountFromPrivateKey(paramsJSON string) string

CreateAccountFromPrivateKey returns an account derived from the private key without storing it

func DecodeParameters added in v0.109.4

func DecodeParameters(decodeParamJSON string) string

func DecompressPublicKey added in v0.114.3

func DecompressPublicKey(key string) string

func DeleteImportedKey added in v0.83.12

func DeleteImportedKey(address, password, keyStoreDir string) string

func DeleteMultiaccount added in v0.55.2

func DeleteMultiaccount(keyUID, keyStoreDir string) string

func DeserializeAndCompressKey added in v0.117.3

func DeserializeAndCompressKey(DesktopKey string) string

func EmojiHash added in v0.96.0

func EmojiHash(pk string) string

func EncodeFunctionCall added in v0.109.4

func EncodeFunctionCall(method string, paramsJSON string) string

func EncodeTransfer added in v0.109.4

func EncodeTransfer(to string, value string) string

func ExportNodeLogs

func ExportNodeLogs() string

ExportNodeLogs reads current node log and returns content to a caller.

func ExportUnencryptedDatabase added in v0.69.0

func ExportUnencryptedDatabase(accountData, password, databasePath string) string

func ExtractGroupMembershipSignatures

func ExtractGroupMembershipSignatures(signaturePairsStr string) string

func Fleets added in v0.171.37

func Fleets() string

func GenerateAlias

func GenerateAlias(pk string) string

func GenerateImages added in v0.98.3

func GenerateImages(filepath string, aX, aY, bX, bY int) string

func GetConnectionStringForBeingBootstrapped added in v0.109.1

func GetConnectionStringForBeingBootstrapped(configJSON string) string

func GetConnectionStringForBootstrappingAnotherDevice added in v0.109.1

func GetConnectionStringForBootstrappingAnotherDevice(configJSON string) string

func GetConnectionStringForExportingKeypairsKeystores added in v0.163.14

func GetConnectionStringForExportingKeypairsKeystores(configJSON string) string

func GetNodeConfig added in v0.77.1

func GetNodeConfig() string

func GetPasswordStrength added in v0.96.0

func GetPasswordStrength(paramsJSON string) string

GetPasswordStrength uses zxcvbn module and generates a JSON containing information about the quality of the given password (Entropy, CrackTime, CrackTimeDisplay, Score, MatchSequence and CalcTime). userInputs argument can be whatever list of strings like user's personal info or site-specific vocabulary that zxcvbn will make use to determine the result. For more details on usage see https://github.com/status-im/zxcvbn-go

func GetPasswordStrengthScore added in v0.96.4

func GetPasswordStrengthScore(paramsJSON string) string

GetPasswordStrengthScore uses zxcvbn module and gets the score information about the given password. userInputs argument can be whatever list of strings like user's personal info or site-specific vocabulary that zxcvbn will make use to determine the result. For more details on usage see https://github.com/status-im/zxcvbn-go

func GetRandomMnemonic added in v0.175.1

func GetRandomMnemonic() string

func HashMessage

func HashMessage(message string) string

func HashTransaction

func HashTransaction(txArgsJSON string) string

func HashTypedData

func HashTypedData(data string) string

HashTypedData unmarshalls data into TypedData, validates it and hashes it.

func HashTypedDataV4 added in v0.76.4

func HashTypedDataV4(data string) string

HashTypedDataV4 unmarshalls data into TypedData, validates it and hashes it.

func HexToNumber added in v0.109.4

func HexToNumber(hex string) string

func HexToUtf8 added in v0.111.5

func HexToUtf8(hexString string) string

func Identicon

func Identicon(pk string) string

func ImageServerTLSCert added in v0.94.0

func ImageServerTLSCert() string

func ImportUnencryptedDatabase added in v0.69.0

func ImportUnencryptedDatabase(accountData, password, databasePath string) string

func InitKeystore

func InitKeystore(keydir string) string

func InitLogging added in v0.159.3

func InitLogging(logSettingsJSON string) string

InitLogging The InitLogging function should be called when the application starts. This ensures that we can capture logs before the user login. Subsequent calls will update the logger settings. Before this, we can only capture logs after user login since we will only configure the logging after the login process.

func InitializeApplication added in v0.181.35

func InitializeApplication(requestJSON string) string

func InputConnectionStringForBootstrapping added in v0.109.1

func InputConnectionStringForBootstrapping(cs, configJSON string) string

func InputConnectionStringForBootstrappingAnotherDevice added in v0.140.0

func InputConnectionStringForBootstrappingAnotherDevice(cs, configJSON string) string

func InputConnectionStringForImportingKeypairsKeystores added in v0.163.14

func InputConnectionStringForImportingKeypairsKeystores(cs, configJSON string) string

func IsAddress added in v0.111.5

func IsAddress(address string) string

func IsAlias added in v0.94.12

func IsAlias(value string) string

func LocalPairingPreflightOutboundCheck added in v0.154.4

func LocalPairingPreflightOutboundCheck() string

func Login deprecated

func Login(accountData, password string) string

Login loads a key file (for a given address), tries to decrypt it using the password, to verify ownership if verified, purges all the previous identities from Whisper, and injects verified key as shh identity.

Deprecated: Use LoginAccount instead.

func LoginAccount added in v0.154.2

func LoginAccount(requestJSON string) string

func LoginWithConfig deprecated added in v0.92.6

func LoginWithConfig(accountData, password, configJSON string) string

LoginWithConfig loads a key file (for a given address), tries to decrypt it using the password, to verify ownership if verified, purges all the previous identities from Whisper, and injects verified key as shh identity. It then updates the accounts node db configuration mergin the values received in the configJSON parameter

Deprecated: Use LoginAccount instead.

func LoginWithKeycard

func LoginWithKeycard(accountData, password, keyHex string, configJSON string) string

LoginWithKeycard initializes an account with a chat key and encryption key used for PFS. It purges all the previous identities from Whisper, and injects the key as shh identity. Deprecated: Use LoginAccount instead.

func Logout

func Logout() string

func MigrateKeyStoreDir added in v0.55.1

func MigrateKeyStoreDir(accountData, password, oldDir, newDir string) string

func MultiAccountDeriveAddresses

func MultiAccountDeriveAddresses(paramsJSON string) string

MultiAccountDeriveAddresses derive addresses from an account selected by ID, without storing them.

func MultiAccountGenerate

func MultiAccountGenerate(paramsJSON string) string

MultiAccountGenerate generates account in memory without storing them.

func MultiAccountGenerateAndDeriveAddresses

func MultiAccountGenerateAndDeriveAddresses(paramsJSON string) string

MultiAccountGenerateAndDeriveAddresses combines Generate and DeriveAddresses in one call.

func MultiAccountImportMnemonic

func MultiAccountImportMnemonic(paramsJSON string) string

MultiAccountImportMnemonic imports an account derived from the mnemonic phrase and the Bip39Passphrase storing it.

func MultiAccountImportPrivateKey

func MultiAccountImportPrivateKey(paramsJSON string) string

MultiAccountImportPrivateKey imports a raw private key without storing it.

func MultiAccountLoadAccount

func MultiAccountLoadAccount(paramsJSON string) string

MultiAccountLoadAccount loads in memory the account specified by address unlocking it with password.

func MultiAccountReset

func MultiAccountReset() string

MultiAccountReset remove all the multi-account keys from memory.

func MultiAccountStoreAccount

func MultiAccountStoreAccount(paramsJSON string) string

MultiAccountStoreAccount stores the select account.

func MultiAccountStoreDerivedAccounts

func MultiAccountStoreDerivedAccounts(paramsJSON string) string

MultiAccountStoreDerivedAccounts derive accounts from the specified key and store them encrypted with the specified password.

func MultiformatDeserializePublicKey added in v0.55.1

func MultiformatDeserializePublicKey(key, outBase string) string

func MultiformatSerializePublicKey added in v0.55.1

func MultiformatSerializePublicKey(key, outBase string) string

func NumberToHex added in v0.109.4

func NumberToHex(numString string) string

func OpenAccounts

func OpenAccounts(datadir string) string

func Recover

func Recover(rpcParams string) string

func ResetChainData

func ResetChainData() string

func RestoreAccountAndLogin added in v0.139.1

func RestoreAccountAndLogin(requestJSON string) string

func SaveAccountAndLogin

func SaveAccountAndLogin(accountData, password, settingsJSON, configJSON, subaccountData string) string

SaveAccountAndLogin saves account in status-go database. Deprecated: Use CreateAccountAndLogin instead.

func SaveAccountAndLoginWithKeycard

func SaveAccountAndLoginWithKeycard(accountData, password, settingsJSON, configJSON, subaccountData string, keyHex string) string

SaveAccountAndLoginWithKeycard saves account in status-go database. Deprecated: Use CreateAndAccountAndLogin with required keycard properties.

func SendTransaction

func SendTransaction(txArgsJSON, password string) string

func SendTransactionWithChainID added in v0.101.1

func SendTransactionWithChainID(chainID int, txArgsJSON, password string) string

func SendTransactionWithSignature

func SendTransactionWithSignature(txArgsJSON, sigString string) string

func SerializeLegacyKey added in v0.125.4

func SerializeLegacyKey(key string) string

func SetMobileSignalHandler

func SetMobileSignalHandler(handler SignalHandler)

func SetSignalEventCallback

func SetSignalEventCallback(cb unsafe.Pointer)

func Sha3 added in v0.111.5

func Sha3(str string) string

func SignGroupMembership

func SignGroupMembership(content string) string

func SignHash

func SignHash(hexEncodedHash string) string

func SignMessage

func SignMessage(rpcParams string) string

func SignTypedData

func SignTypedData(data, address, password string) string

SignTypedData unmarshall data into TypedData, validate it and signs with selected account, if password matches selected account.

func SignTypedDataV4 added in v0.76.4

func SignTypedDataV4(data, address, password string) string

SignTypedDataV4 unmarshall data into TypedData, validate it and signs with selected account, if password matches selected account.

func StartCPUProfile

func StartCPUProfile(dataDir string) string

func StartLocalNotifications added in v0.62.16

func StartLocalNotifications() string

func StartSearchForLocalPairingPeers added in v0.146.3

func StartSearchForLocalPairingPeers() string

func StopCPUProfiling

func StopCPUProfiling() string

func StopLocalNotifications added in v0.62.16

func StopLocalNotifications() string

func SwitchFleet added in v0.96.4

func SwitchFleet(fleet string, configJSON string) string

func ToChecksumAddress added in v0.111.5

func ToChecksumAddress(address string) string

func ToggleCentralizedMetrics added in v0.181.35

func ToggleCentralizedMetrics(requestJSON string) string

func Utf8ToHex added in v0.111.5

func Utf8ToHex(str string) string

func ValidateConnectionString added in v0.131.7

func ValidateConnectionString(cs string) string

func ValidateMnemonic added in v0.38.1

func ValidateMnemonic(mnemonic string) string

func ValidateNodeConfig

func ValidateNodeConfig(configJSON string) string

func VerifyAccountPassword

func VerifyAccountPassword(keyStoreDir, address, password string) string

func VerifyDatabasePassword added in v0.83.0

func VerifyDatabasePassword(keyUID, password string) string

func WriteHeapProfile

func WriteHeapProfile(dataDir string) string

Types

type APIDetailedResponse

type APIDetailedResponse struct {
	Status      bool            `json:"status"`
	Message     string          `json:"message,omitempty"`
	FieldErrors []APIFieldError `json:"field_errors,omitempty"`
}

APIDetailedResponse represents a generic response with possible errors.

func (APIDetailedResponse) Error

func (r APIDetailedResponse) Error() string

Error string representation of APIDetailedResponse.

type APIError

type APIError struct {
	Message string `json:"message"`
}

APIError represents a single error.

func (APIError) Error

func (e APIError) Error() string

Error string representation of APIError.

type APIFieldError

type APIFieldError struct {
	Parameter string     `json:"parameter,omitempty"`
	Errors    []APIError `json:"errors"`
}

APIFieldError represents a set of errors related to a parameter.

func (APIFieldError) Error

func (e APIFieldError) Error() string

Error string representation of APIFieldError.

type APIKeyUIDResponse added in v0.141.2

type APIKeyUIDResponse struct {
	KeyUID string `json:"keyUID"`
}

APIKeyUIDResponse

type APIResponse

type APIResponse struct {
	Error string `json:"error"`
}

APIResponse generic response from API.

type AccountInfo

type AccountInfo struct {
	Address       string `json:"address"` // DEPRECATED
	PubKey        string `json:"pubkey"`  // DEPRECATED
	WalletAddress string `json:"walletAddress"`
	WalletPubKey  string `json:"walletPubKey"`
	ChatAddress   string `json:"chatAddress"`
	ChatPubKey    string `json:"chatPubKey"`
	Mnemonic      string `json:"mnemonic"`
	Error         string `json:"error"`
}

AccountInfo represents account's info.

type FleetDescription added in v0.171.37

type FleetDescription struct {
	DefaultFleet string                         `json:"defaultFleet"`
	Fleets       map[string]map[string][]string `json:"fleets"`
}

type GetPasswordStrengthRequest added in v0.96.4

type GetPasswordStrengthRequest struct {
	Password   string   `json:"password"`
	UserInputs []string `json:"userInputs"`
}

type InitLoggingRequest added in v1.0.0

type InitLoggingRequest struct {
	logutils.LogSettings
	LogRequestGo   bool   `json:"LogRequestGo"`
	LogRequestFile string `json:"LogRequestFile"`
}

type InitializeApplicationResponse added in v0.181.35

type InitializeApplicationResponse struct {
	Accounts               []multiaccounts.Account         `json:"accounts"`
	CentralizedMetricsInfo *centralizedmetrics.MetricsInfo `json:"centralizedMetricsInfo"`
}

type MultiAccountDeriveAddressesParams

type MultiAccountDeriveAddressesParams struct {
	AccountID string   `json:"accountID"`
	Paths     []string `json:"paths"`
}

MultiAccountDeriveAddressesParams are the params sent to MultiAccountDeriveAddresses.

type MultiAccountGenerateAndDeriveAddressesParams

type MultiAccountGenerateAndDeriveAddressesParams struct {
	MultiAccountGenerateParams
	Paths []string `json:"paths"`
}

MultiAccountGenerateAndDeriveAddressesParams are the params sent to MultiAccountGenerateAndDeriveAddresses.

type MultiAccountGenerateParams

type MultiAccountGenerateParams struct {
	N                    int    `json:"n"`
	MnemonicPhraseLength int    `json:"mnemonicPhraseLength"`
	Bip39Passphrase      string `json:"bip39Passphrase"`
}

MultiAccountGenerateParams are the params sent to MultiAccountGenerate.

type MultiAccountImportMnemonicParams

type MultiAccountImportMnemonicParams struct {
	MnemonicPhrase  string   `json:"mnemonicPhrase"`
	Bip39Passphrase string   `json:"Bip39Passphrase"`
	Paths           []string `json:"paths"`
}

MultiAccountImportMnemonicParams are the params sent to MultiAccountImportMnemonic.

type MultiAccountImportPrivateKeyParams

type MultiAccountImportPrivateKeyParams struct {
	PrivateKey string `json:"privateKey"`
}

MultiAccountImportPrivateKeyParams are the params sent to MultiAccountImportPrivateKey.

type MultiAccountLoadAccountParams

type MultiAccountLoadAccountParams struct {
	Address  string `json:"address"`
	Password string `json:"password"`
}

MultiAccountLoadAccountParams are the params sent to MultiAccountLoadAccount.

type MultiAccountStoreAccountParams

type MultiAccountStoreAccountParams struct {
	AccountID string `json:"accountID"`
	Password  string `json:"password"`
}

MultiAccountStoreAccountParams are the params sent to MultiAccountStoreAccount.

type MultiAccountStoreDerivedAccountsParams

type MultiAccountStoreDerivedAccountsParams struct {
	MultiAccountDeriveAddressesParams
	Password string `json:"password"`
}

MultiAccountStoreDerivedAccountsParams are the params sent to MultiAccountStoreDerivedAccounts.

type NotifyResult

type NotifyResult struct {
	Status bool   `json:"status"`
	Error  string `json:"error,omitempty"`
}

NotifyResult is a JSON returned from notify message.

type OnboardingAccount

type OnboardingAccount struct {
	ID            string `json:"id"`
	Address       string `json:"address"` // DEPRECATED
	PubKey        string `json:"pubkey"`  // DEPRECATED
	WalletAddress string `json:"walletAddress"`
	WalletPubKey  string `json:"walletPubKey"`
	ChatAddress   string `json:"chatAddress"`
	ChatPubKey    string `json:"chatPubKey"`
}

OnboardingAccount represents accounts info generated for the onboarding.

type PasswordScoreResponse added in v0.96.4

type PasswordScoreResponse struct {
	Score int `json:"score"`
}

type SignalHandler

type SignalHandler interface {
	HandleSignal(string)
}

SignalHandler defines a minimal interface a signal handler needs to implement.

Jump to

Keyboard shortcuts

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