Documentation
¶
Index ¶
Constants ¶
View Source
const ( // AlgorithmEd25519Adr8 is the Ed25519 algorithm using the ADR-8 derivation path. AlgorithmEd25519Adr8 = "ed25519-adr8" // AlgorithmEd25519Raw is the Ed25519 algorithm using raw private keys. AlgorithmEd25519Raw = "ed25519-raw" // AlgorithmEd25519Legacy is the Ed25519 algorithm using the Legacy derivation (ROSE coin type). AlgorithmEd25519Legacy = "ed25519-legacy" // AlgorithmSecp256k1Bip44 is the Secp256k1 algorithm using BIP-44 derivation with ETH coin type. AlgorithmSecp256k1Bip44 = "secp256k1-bip44" // AlgorithmSecp256k1Raw is the Secp256k1 algorithm using raw private keys. AlgorithmSecp256k1Raw = "secp256k1-raw" // AlgorithmSr25519Adr8 is the Sr25519 algorithm using the Ledger-compatible derivation path defined in ADR-8. AlgorithmSr25519Adr8 = "sr25519-adr8" // AlgorithmSr25519Raw is the Sr25519 algorithm using raw private keys. AlgorithmSr25519Raw = "sr25519-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 returns the account's private key and mnemonic.
UnsafeExport() (string, string)
}
Account is an interface of a single account in the wallet.
type AccountConfig ¶ added in v0.8.0
type AccountConfig struct {
Algorithm string `mapstructure:"algorithm"`
Number uint32 `mapstructure:"number,omitempty"`
}
AccountConfig is an in-memory version of the account config stored in Oasis CLI config file.
func (*AccountConfig) UnmarshalMap ¶ added in v0.8.0
func (af *AccountConfig) UnmarshalMap(raw map[string]interface{}) error
UnmarshalMap imports the config map to AccountConfig.
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, opts ...survey.AskOpt) (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)
// Migrate migrates the given wallet config entry to the latest version and returns true, if any changes were needed.
Migrate(rawCfg map[string]interface{}) bool
// 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(oldName, newName 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.