Commit Graph

16 Commits

Author SHA1 Message Date
Alessio Treglia a940214a49
testutil cleanup and reorg (#6658)
Prepare migrating testing auxiliary functions from tests
to testutil.

Remove local duplicates on testutil.WriteToNewTempFile().

Always favor testutil.NewTestCaseDir() over ioutil.TempDir().

Add test cases for the testing auxiliary functions.
2020-07-09 14:21:20 +02:00
Alexander Bezobchuk de7885a594
keys: CLI Remove Viper (#6613)
* init commit

* Update ListKeysCmd

* updates

* updates

* test updates

* fix tests

* keys: Fix Test_runAddCmdLedgerWithCustomCoinType

* keys: Fix Test_runAddCmdLedger

* keys: Fix Test_runAddCmdBasic

* keys: Fix root tests

* keys: Fix Test_runMigrateCmd

* keys: Fix Test_runListCmd

* keys: Fix remaining tests
2020-07-06 19:50:09 +00:00
Federico Kunze 0215b5c6cd
client: fix signing algorithm (#6405)
* crypto/keyring: fix signing algorithm

* client: tests

* minor fixes

* changelog

* address @alexanderbez comments

* Update crypto/keyring/keyring.go

* Update crypto/keyring/signing_algorithms.go

* Update crypto/keyring/keyring.go

* Update crypto/keyring/signing_algorithms.go

Co-authored-by: Alessio Treglia <alessio@tendermint.com>

* fix test

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-06-11 14:30:42 +00:00
Alessio Treglia a1feca39c2
Enter the new keyring interface (#5904)
crypto/keyring:

`Keybase` interface gives way to its successor: `Keyring`. `LegacyKeybase`
interface is added in order to guarantee limited backward compatibility with
the old `Keybase` interface for the sole purpose of migrating keys across
the new keyring backends.

The package no longer depends on the `github.com/types.Config`
singleton.

`SupportedAlgos` and `SupportedLedgerAlgos` methods have been removed.
The keyring just fails when trying to perform an action with an unsupported
algorithm.

crypto/ subdirs reorganization:

`crypto/keys/hd` was moved to `crypto/hd`, which now groups together
all HD wallets related types and utilities.

client/input:

* Removal of unnecessary `GetCheckPassword`, `PrintPrefixed` functions.
* `GetConfirmation`'s signature changed to take in a io.Writer for better integration
  with `cobra.Command` types.

client/context:

* In-memory keyring is allocated in the context when `--gen-only` flag is passed
  in. `GetFromFields` does no longer silently allocate a keyring, it takes one as
  argument.

Co-authored with @jgimeno

Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
2020-04-08 11:38:28 +02:00
Alessio Treglia 2a7a408d35
crypto/keyring: deprecate old keybase (#5889)
Remove the Update method from the Keybase interface.

Remove redundant lazy keybase implementation altogether.

Created LegacyKeybase interface to restrict capabilities to
only those required by keys commands that deal with
legacy keybase such as update and migrate.

Rename keyring.New() -> keyring.NewLegacy().

Rename client/keys.NewKeyBaseFromDir -> NewLegacyKeyBaseFromDir.

crypto/keyiring.NewInMemory() now returns a in-memory keyring.
BackendMemory is added yet not exposed via command line
--keyring-backend flag. keys add uses it when --dry-run flag
is on.
2020-03-30 20:30:50 +02:00
Federico Kunze 9cce836c08
crypto/keys: move keybase and keyring to crypto/keyring/ dir (#5866)
* crypto/keys: move keybase and keyring to crypto/keyring/ dir

* Update client/keys/root.go

* Update crypto/keyring/errors.go

* Update crypto/keyring/keybase.go

* Update crypto/keyring/options.go

* format

* changelog

* fix build

* format

* lint
2020-03-25 15:20:36 +00:00
Alessio Treglia d7fd5b6a42
Replace defer with testing.T.Cleanup() (#5732) 2020-03-02 00:16:23 +00:00
Alessio Treglia d0ff973386 Merge PR #5562: Remove KeyringServiceName from the sdk.Config struct 2020-01-23 13:47:11 -05:00
Alessio Treglia 415eab7a56
Create new generic keyring constructor: NewKeyring (#5547)
Remove other convenience constructors:
 * Remove NewKeyBaseFromHomeFlag
 * Remove NewKeyringFromDir
 * Remove NewKeyringFromHomeFlag
2020-01-22 17:54:56 +00:00
Alexander Bezobchuk 869531ca92
Merge PR #5495: Replace Redundant Bech32 PubKey Functions 2020-01-09 09:04:28 -05:00
Austin Abell 0e28da23e7 Interchangable PrivKey implementations in keybase (#5278)
Allow for the keybase to be configured to override the implementation
of the key that is saved to the keybase.

Closes: #4941
2019-12-12 21:52:24 +00:00
Alessio Treglia d4c831e63a Drop on-disk keybase in favor of keyring (#5180)
* Switch keys commands to keyring

* Replace NewKeybase with NewKeyring

* Fix delete test

* Purge dead code

* Override COSMOS_SDK_TEST_KEYRING envvar to switch to a test keyring

* s/unningOnServer/unningUnattended/

C'ing @tnachen

* Add deprecated warning, output looks like the following:

```
$ gaiacli keys update --help
Command "update" is deprecated, it takes no effect with the new keyring
based backend and is provided only for backward compatibility with the
legacy LevelDB based backend.
Refer to your operating system's manual to learn how to change your
keyring's password.

Change the password used to protect private key

Usage:
  gaiacli keys update <name> [flags]

Flags:
  -h, --help   help for update

Global Flags:
      --chain-id string   Chain ID of tendermint node
  -e, --encoding string   Binary encoding (hex|b64|btc) (default "hex")
      --home string       directory for config and data (default "/home/alessio/.gaiacli")
  -o, --output string     Output format (text|json) (default "text")
      --trace             print out full stack trace on errors
```

* Update multisign command

* Modify server.GenerateSaveCoinKey()

* GenerateSaveCoinKey more modifications

* Update docs

* Update upgrade module
2019-11-14 15:17:21 +01:00
yys adf6ddd4a8 Merge PR #4716: Fix ledger custom coin type support bug 2019-07-29 11:01:53 -07:00
Alessio Treglia 7b5e6cee07
Remove client/input.{Buffer,Override}Stdin() functions (#4602)
Cobra's new release made them redundant.

Thanks: Juan Leni <juan.leni@zondax.ch> for the original patch.
2019-06-22 11:24:59 +02:00
frog power 4000 73e5ef7c13 reduce module interdependancy, /client refactor (#4415)
* abstract staking BuildCreateValidatorMsg, genutil defines its own flags

* client/ refactor

* staking move keys from keeper to types
2019-05-28 09:44:04 +01:00
Juan Leni 94dccf3842 Merge PR #3586: Fix keybase storage of ledger accounts 2019-02-11 09:02:47 -08:00