4 crypto "github.com/tendermint/go-crypto"
5 keys "github.com/tendermint/go-crypto/keys"
8 // encryptedStorage needs passphrase to get private keys
9 type encryptedStorage struct {
14 func (es encryptedStorage) Put(name, pass string, key crypto.PrivKey) error {
15 secret, err := es.coder.Encrypt(key, pass)
21 return es.store.Put(name, secret, ki)
24 func (es encryptedStorage) Get(name, pass string) (crypto.PrivKey, keys.Info, error) {
25 secret, info, err := es.store.Get(name)
27 return crypto.PrivKey{}, info, err
29 key, err := es.coder.Decrypt(secret, pass)
33 func (es encryptedStorage) List() (keys.Infos, error) {
34 return es.store.List()
37 func (es encryptedStorage) Delete(name string) error {
38 return es.store.Delete(name)
41 // info hardcodes the encoding of keys
42 func info(name string, key crypto.PrivKey) keys.Info {
46 Address: pub.Address(),