Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidKey = errors.New("provided key is incorrect") ErrInvalidAddress = errors.New("--address option must be specified and valid") ErrInvalidPassword = errors.New("invalid password for the encrypted key") )
Key-related errors.
Functions ¶
func FromNEP2 ¶
func FromNEP2(encryptedWif string) (*ecdsa.PrivateKey, error)
FromNEP2 extracts private key from NEP2-encrypted string.
func FromWallet ¶
FromWallet returns private key of the wallet account.
func Get ¶
func Get(cmd *cobra.Command) *ecdsa.PrivateKey
Get returns private key from the following sources: 1. WIF 2. Raw binary key 3. Wallet file 4. NEP-2 encrypted WIF. Ideally we want to touch file-system on the last step. However, asking for NEP-2 password seems to be confusing if we provide a wallet. This function assumes that all flags were bind to viper in a `PersistentPreRun`.
func GetOrGenerate ¶ added in v0.28.2
func GetOrGenerate(cmd *cobra.Command) *ecdsa.PrivateKey
GetOrGenerate is similar to get but generates a new key if commonflags.GenerateKey is set.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.