Documentation ¶
Index ¶
Constants ¶
View Source
const ( // AlgorithmEd25519Adr8 is the Ed25519 algorithm using the ADR-0008 derivation. AlgorithmEd25519Adr8 = "ed25519-adr8" // AlgorithmEd25519Raw is the Ed25519 algorithm using raw private keys. AlgorithmEd25519Raw = "ed25519-raw" // AlgorithmSecp256k1Bip44 is the Secp256k1 algorithm using BIP-44 derivation. AlgorithmSecp256k1Bip44 = "secp256k1-bip44" // AlgorithmSecp256k1Raw is the Secp256k1 algorithm using raw private keys. AlgorithmSecp256k1Raw = "secp256k1-raw" )
Variables ¶
This section is empty.
Functions ¶
func ImportKinds ¶
func ImportKinds() []string
ImportKinds returns all of the available account import kinds.
Types ¶
type Account ¶
type Account interface { // ConsensusSigner returns the consensus layer signer associated with the account. // // It may return nil in case this account cannot be used with the consensus layer. ConsensusSigner() coreSignature.Signer // Signer returns the signer associated with the account. Signer() signature.Signer // Address returns the address associated with the account. Address() types.Address // EthAddress returns the Ethereum address associated with the account, if any. EthAddress() *ethCommon.Address // SignatureAddressSpec returns the signature address specification associated with the account. SignatureAddressSpec() types.SignatureAddressSpec // UnsafeExport exports the account's secret state. UnsafeExport() string }
Account is an interface of a single account in the wallet.
type Factory ¶
type Factory interface { // Kind returns the kind of accounts this factory will produce. Kind() string // PrettyKind returns human-friendly kind of accounts this factory will produce. PrettyKind(cfg map[string]interface{}) string // Flags returns the CLI flags that can be used for configuring this account factory. Flags() *flag.FlagSet // GetConfigFromFlags generates account configuration from flags. GetConfigFromFlags() (map[string]interface{}, error) // GetConfigFromSurvey generates account configuration from survey answers. GetConfigFromSurvey(kind *ImportKind) (map[string]interface{}, error) // DataPrompt returns a survey prompt for entering data when importing the account. DataPrompt(kind ImportKind, cfg map[string]interface{}) survey.Prompt // DataValidator returns a survey data input validator used when importing the account. DataValidator(kind ImportKind, cfg map[string]interface{}) survey.Validator // RequiresPassphrase returns true if the account requires a passphrase. RequiresPassphrase() bool // SupportedImportKinds returns the import kinds supported by this account. SupportedImportKinds() []ImportKind // HasConsensusSigner returns true, iff there is a consensus layer signer associated with this account. HasConsensusSigner(cfg map[string]interface{}) bool // Create creates a new account. Create(name string, passphrase string, cfg map[string]interface{}) (Account, error) // Load loads an existing account. Load(name string, passphrase string, cfg map[string]interface{}) (Account, error) // Remove removes an existing account. Remove(name string, cfg map[string]interface{}) error // Rename renames an existing account. Rename(old, new string, cfg map[string]interface{}) error // Import creates a new account from imported key material. Import(name string, passphrase string, cfg map[string]interface{}, src *ImportSource) (Account, error) }
Factory is a factory that supports accounts of a specific kind.
func AvailableKinds ¶
func AvailableKinds() []Factory
AvailableKinds returns all of the available account factories.
type ImportKind ¶
type ImportKind string
ImportKind is an account import kind.
const ( ImportKindMnemonic ImportKind = "mnemonic" ImportKindPrivateKey ImportKind = "private key" )
Supported import kinds.
func (*ImportKind) UnmarshalText ¶
func (k *ImportKind) UnmarshalText(text []byte) error
UnmarshalText decodes a text marshalled import kind.
type ImportSource ¶
type ImportSource struct { Kind ImportKind Data string }
ImportSource is a source of imported account key material.
Click to show internal directories.
Click to hide internal directories.