Documentation ¶
Index ¶
- Constants
- Variables
- func EncryptArmorPrivKey(privKey cryptotypes.PrivKey, passphrase string, header map[string]string) string
- func GenHash(text string) string
- func PrintInfo(w io.Writer, keyInfo ...cosmoskeyring.Info)
- func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
- func VerifyHash(srcHash, srcText string) bool
- type KeyOutput
- type Keyring
- type Keystore
- func (ks Keystore) Export(key string) (armor, pwd string, err error)
- func (ks Keystore) Has(uid string) bool
- func (ks Keystore) HasInit() bool
- func (ks Keystore) Init(algo cosmoskeyring.SignatureAlgo, r *bufio.Reader, w *bufio.Writer) (cosmoskeyring.Info, error)
- func (ks Keystore) Key(uid string) (cosmoskeyring.Info, error)
- func (ks Keystore) KeyByAddress(address sdk.Address) (cosmoskeyring.Info, error)
- func (ks Keystore) List() ([]cosmoskeyring.Info, error)
- func (ks Keystore) NewKey(name string) (cosmoskeyring.Info, error)
- func (ks Keystore) Recover(mnemonic string, algo cosmoskeyring.SignatureAlgo) (cosmoskeyring.Info, error)
- func (ks Keystore) UpdateRoot(mnemonic, newPwd string) error
Constants ¶
const (
RootName = "root"
)
Variables ¶
var BcryptSecurityParameter = 12
BcryptSecurityParameter is security parameter var, and it can be changed within the lcd test. Making the bcrypt security parameter a var shouldn't be a security issue: One can't verify an invalid key by maliciously changing the bcrypt parameter during a runtime vulnerability. The main security threat this then exposes would be something that changes this during runtime before the user creates their key. This vulnerability must succeed to update this to that same value before every subsequent call to the keys command in future startups / or the attacker must get access to the filesystem. However, with a similar threat model (changing variables in runtime), one can cause the user to sign a different tx than what they see, which is a significantly cheaper attack then breaking a bcrypt hash. (Recall that the nonce still exists to break rainbow tables) For further notes on security parameter choice, see README.md
var CryptoCdc *codec.LegacyAmino
CryptoCdc defines the codec required for keys and info
var SigningAlgoList = keyring.SigningAlgoList{ hd.Sm2, hd.Secp256k1, }
Functions ¶
func EncryptArmorPrivKey ¶
func EncryptArmorPrivKey(privKey cryptotypes.PrivKey, passphrase string, header map[string]string) string
Encrypt and armor the private key.
func RegisterLegacyAminoCodec ¶
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
RegisterLegacyAminoCodec registers concrete types and interfaces on the given codec.
func VerifyHash ¶
Types ¶
type KeyOutput ¶
type KeyOutput struct { Name string `json:"name" yaml:"name"` Type string `json:"type" yaml:"type"` Address string `json:"address" yaml:"address"` PubKey string `json:"pub_key" yaml:"pub_key"` AddressIdx uint32 `json:"address_idx" yaml:"address_idx"` }
KeyOutput defines a structure wrapping around an Info object used for output functionality.
type Keyring ¶
type Keystore ¶
type Keystore struct {
// contains filtered or unexported fields
}
func New ¶
New creates a new instance of a keyring. Keyring ptions can be applied when generating the new instance. Available backends are "file".
func (Keystore) Init ¶
func (ks Keystore) Init(algo cosmoskeyring.SignatureAlgo, r *bufio.Reader, w *bufio.Writer) (cosmoskeyring.Info, error)
Init create a wallet instance and produce a mnemonic
func (Keystore) Key ¶
func (ks Keystore) Key(uid string) (cosmoskeyring.Info, error)
Key return a key information by key name
func (Keystore) KeyByAddress ¶
Key return a key information by the address
func (Keystore) List ¶
func (ks Keystore) List() ([]cosmoskeyring.Info, error)
Key return all the key information
func (Keystore) NewKey ¶
func (ks Keystore) NewKey(name string) (cosmoskeyring.Info, error)
NewKey create a new key
func (Keystore) Recover ¶
func (ks Keystore) Recover(mnemonic string, algo cosmoskeyring.SignatureAlgo) (cosmoskeyring.Info, error)
Recover recover a wallet instance by a mnemonic
func (Keystore) UpdateRoot ¶
UpdateRoot update a wallet root password by old password or mnemonic