Commit Graph

48 Commits

Author SHA1 Message Date
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
Alexander Bezobchuk d5049413ef
Merge PR #6525: x/bank: Refactor CLI & Tests 2020-06-30 16:59:21 -04:00
Aaron Craelius 81d647e505
Move codec.RegisterCrypto and codec.Cdc to new packages (#6330)
* Move codec.Cdc to legacy_global.Cdc

* Update CHANGELOG.md

* Updates

* nit

* Fix imports

* Updates

* Use cosmos multisig instead of tendermint multisig everywhere

* Fix tests

* Rename legacy_global -> legacy

* Add doc.go

* Linting, move all RegisterCrypto calls to crypto/codec

* Update crypto/codec/amino.go

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-06-04 10:38:24 +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 db76afe840
crypto/keyring: change addrKey to store chain-agnostic addresses (#5858)
Keyrings store keys by name and hexbytes representation
of address. This turns keyring internal storage more
chain-agnostic and types.Config independent.

Obsolete Keybase internal state representation is not affected.
2020-03-30 16:54:01 +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 9bd603ae88
crypto: cleanup, more testing
crypto.LedgerShowAddress() is a ledger specific function
and should takes acc address prefix instead of depending
on a sdk.Config singleton.

crypto/keys/mintkey:
- decryptPrivKey() return error instead of os.Exit()ing.
- encryptPrivKey() should panic instead of os.Exit() when
  bcrypt.GenerateFromPassword() call fails so that the
  caller is given a chance to recover().

crypto/keys:
- SignWithLedger() does not need to be method of
  baseKeybase. Method receiver is unused.
- ledgerInfo objecta may be pointers, type switch
  should handle both to avoid panics.
- keyringKeybase should not provide Update() at all.

More test cases are added to increase package crypto
and subpackages overall coverage.
2020-03-02 11:09:52 +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
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
Alessio Treglia e9810ac25c Merge PR #4433: Adopt YAML as human-readable text output 2019-05-31 09:14:34 -04: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 1306a25e42 Adding support for Ledger Cosmos App v1.5 (#4227)
This PR adds support for the latest version of the Cosmos App (v.1.5).
The app is not been released yet by Ledger but the PR is backwards compatible.
We can later remove backwards compatibility and enforce v1.5 only.

When creating a new account, `gaiacli` now shows the account/index and address in the device and requires user confirmation.

Related PRs:
https://github.com/cosmos/ledger-cosmos-go/pull/3
https://github.com/cosmos/ledger-cosmos-go/pull/4
https://github.com/cosmos/ledger-cosmos-go/pull/5
https://github.com/cosmos/ledger-cosmos-go/pull/6

Changes in the app can be found here:
https://github.com/LedgerHQ/ledger-app-cosmos/pull/5
2019-04-30 09:58:21 +01:00
Alessio Treglia 85021d4ca9
No packages must depend on cmd/gaia/ (#4048)
Preparation work for moving gaia out of the SDK.
2019-04-04 15:36:39 +01:00
Frank Yang 54ac1d2fe8 Merge PR #3841: Add indent to JSON of `gaiacli key [add|show|list]`
* Add indent to JSON of `gaiacli key list`

* Add `-o json --indent` to `keys [add|show|list]`

* Add change log.

* Move entry from CHANGELOG.md to PENDING.md

* Update PENDING.md

Add indent to JSON of `gaiacli key [add|show|list]`

Co-Authored-By: yangyanqing <yangyanqing.cn@gmail.com>
2019-03-13 10:36:52 -07:00
Alexander Bezobchuk 47a44fb580 Merge PR #3748: Multisig Display UX Improvements 2019-03-01 13:29:33 -08:00
Juan Leni 3eb0acda88 Merge PR #3670: CLI support for showing bech32 addresses in Ledger devices 2019-02-25 12:34:39 +01:00
Alexander Bezobchuk e39debd359 Merge PR #3674: Remove password/keybase from REST Client 2019-02-19 10:15:39 -08:00
Juan Leni 6967de1073 Merge PR #3676: Refactored prefixes as constants
* Refactored prefixes as constants
* Fixing test
2019-02-18 22:35:08 +01:00
Alessio Treglia 1aa6c197ff Merge PR #3580: Code cleanup of client types 2019-02-14 08:53:36 -08:00
Juan Leni b5fdb83830 Merge PR #3517: Increasing test coverage in keys/client package 2019-02-08 12:45:23 -08:00
Juan Leni ba63eb1801 Merge PR #3557: Removing pkg/errors when not necessary 2019-02-08 11:37:46 -08:00
Alessio Treglia 24a1670cf0 Run make format 2018-12-10 14:27:25 +00:00
Jack Zampolin 07b0ad3c9e Merge PR #2987: Add shorthand flag to address output on gaiacli keys show and update docs
* Add shorthand flag to address output on gaiacli keys show

* Update docs and add PENDING

* Update client/keys/show.go

Co-Authored-By: jackzampolin <jack.zampolin@gmail.com>

* pk -> p
2018-12-04 17:38:43 +01:00
Christopher Goes 234262160e 'make format' 2018-10-24 15:37:06 +02:00
Christopher Goes c577831261
Merge PR #2554: Make `gaiacli keys show` multisig-ready 2018-10-24 15:24:12 +02:00
HaoyangLiu 9ee9e28439 Merge PR #2462: Add swagger-ui for gov, stake and slashing 2018-10-24 15:19:48 +02:00
Alessio Treglia 6664cd5afd
Fix stupid mistake 2018-10-23 12:43:36 -07:00
Alessio Treglia cd49e978f9
Make "multi" const 2018-10-23 11:46:43 -07:00
Alessio Treglia 6ace08b505
Remove shorthand 2018-10-23 11:44:47 -07:00
Alessio Treglia 230c69b438
Validate threshold rather than letting it panic 2018-10-22 17:13:36 -07:00
Alessio Treglia 8d24465845
Run make format 2018-10-22 13:37:28 -07:00
Alessio Treglia 322a029ab5
Make gaiacli keys show multisig-ready 2018-10-22 12:00:57 -07:00
HaoyangLiu 8e1bfee6ca Add swagger-ui for key management 2018-10-04 20:36:24 +08:00
Alessio Treglia a65c6eba00 Merge PR #2389: Remove dependency on tendermint/tmlibs 2018-09-24 23:06:38 +08:00
Jia Chenhui 55b7c6adf1 Merge PR #2304: client/keys: remove excess code and uniform code style 2018-09-12 15:14:29 +08:00
Alexander Bezobchuk 2d92803b9f Merge PR #2040: Refactor Validator Account Types/Bech32 Prefixing
* Add new account bech32 prefixes with godocs

* Restructure spacing of existing account code

* Update account godocs

* More account godoc updates + new tm pub/addr helpers

* Update validator type to use new account types/bech32 prefixes

* Fix account documentation errors

* Update Bech32 prefix for consensus nodes

* Update Bech32 spec doc

* Fix account type tests

* Add missing account consensus functions, clear up godocs, and fix tests

* Add to TestRandBech32PubkeyConsistency check

* Update initialization of validator public keys

* Update query signing info command

* Implement new ConsAddress type with associated unit tests

* [WIP] Update stake and slashing parameters

* Update all calls to MustBech32ifyValPub

* [WIP] Validator operator API updates

* [WIP] Fix and update unit tests

* Fix gov logs (helping to debug failing tests)

* Fix gov tally

* Fix all broken x/ unit tests

* Update gaia app genesis address logic

* Fix linting errors

* Fix broken LCD tests

* Fix broken CLI tests

* Implement command to get validator address and pubkey from key name

* Add support for getting validator key information via REST endpoint

* Update PENDING log

* Update docs

* Revert GaiaGenTx.PubKey bech32 prefix

* Fix broken docs and cli tests

* Update genesis to use correct Bech32 (cons) prefix for pubkeys

* Update docs and unit tests to reflect new cosmos account bech32 prefix

* minor formatting
2018-08-31 00:06:44 -04:00
Christopher Goes 879f78cfc0 Rename revoke(d) to jail(ed) 2018-08-22 17:56:13 +02:00
Matthew Slipper 0c0d282a0c Add plaintext flags to show keys; default print response to true; helptext updates
Closes #1970
Closes #1971
Closes #1967
Closes #1969
2018-08-21 15:36:53 -07:00
Christopher Goes 59aadf42aa
Ledger integration (#931)
Merges the keybase and Ledger code from go-crypto (which is no more) into the SDK
Adds support for Ledger into gaiacli
Cherry-picks updated error handling from #1158
2018-06-29 02:54:47 +02:00
Fabian 5f409ce832 Merge PR #1086: Bech32Cosmos output/input for the LCD
* refactored bech32ization
* updated keys endpoints for bech32
* bech32 for sending and querying
* trying to change output of validator addresses
* fixed validator output
* linted
* fixed merge conflict
* added bech32 to staking endpoints
* removed some logging statements
* added GetAccPubKeyBech32Cosmos
* fixed cli tests
* updated swagger
* merged standard bech32 change
* renamed bech32cosmos to bech32
* bech32ify json output for key add
* readded changelog
* fixed changelog merge issue
* Update CHANGELOG.md
2018-06-06 06:53:04 +02:00
Zaki Manian f33f49a840 Almost from scratch reimplementation of bech32cosmos integration. 2018-05-27 13:47:23 +02:00
rigelrozanski 54a5869efd added used of cobra arg constraints 2018-04-26 17:32:20 -04:00
rigelrozanski d28efaac27 many renames / golint compliance 2018-04-19 00:49:24 -04:00
Ethan Buchman ad705fdea1 bump version
added rest server and status endpoint

added get block endpoint

added latest block endpoint

add 404 if height is out of bounds

add version endpoint

add validators endpoint

export GetBlockHeight

add keys endpoints

add txs endpoints

added verb limiters to ednpoints

only output node info + json structure improvement

fixed wrong body parsing

github PR template

crypto.Address -> sdk.Address

revert to old go-wire

update glide

remove print statement and update glide

fix #554

add .DS_Store to .gitignore

Massive consolidation: queue, data storage struct, store, logic, ...

Small fixes
2018-03-17 22:14:19 +01:00
Ethan Frey bb74e84b29 Clean up keys/keybase and comments 2018-03-01 02:36:57 +00:00
Ethan Frey b0c65f8045 All keys logic works with new basecli 2018-03-01 02:36:57 +00:00