cmd/geth: standardize the action of importing bls account #2020
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
cmd/geth: standardize the action of importing bls account
Rationale
there are 3 issues when using
geth bls account
no trim '\r\n' when read password from file.
when use vim or
echo
command to write password into a file, a '\r' or '\n' will be added automaticlythis PR will do the trim by following
geth account
some related flags have not set field
Category
, so they will not be displayed in help infothis PR fix it
putting a bls private key into wallet viewed as a
new
actiononly putting a keystore file into wallet will be viewed as a
import
actionbut
geth account
can put a private key into wallet by aimport
actionand others, in metamask, the import action both accept a file including a private key or a keystore file
so in this PR, putting a bls private key into wallet will be viewed as a
import
action instead of anew
action.when new a bls account, use the bls wallet password to encrypt it into a keystore file
so no need a
blsaccountpassword
any more, bring much convenientwhen import a bls account with a keystore file, rename
blsaccountpassword
toimportedaccountpassword
,to reduce ambiguity.
to demostrate the usage of
geth bls account
, a shell is provided,and using it to test these above features is easily
Example
run
bash bls-account-usage-demo.sh
in bsc/cmd/geth/testdataChanges
Notable changes: