-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mnemonic sentence support #975
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ module Cardano.CLI.Commands.Key | |
( KeyCmds (..) | ||
, KeyVerificationKeyCmdArgs (..) | ||
, KeyNonExtendedKeyCmdArgs (..) | ||
, KeyExtendedSigningKeyFromMnemonicArgs (..) | ||
, ExtendedSigningType (..) | ||
, KeyConvertByronKeyCmdArgs (..) | ||
, KeyConvertByronGenesisVKeyCmdArgs (..) | ||
, KeyConvertITNKeyCmdArgs (..) | ||
|
@@ -19,12 +21,14 @@ where | |
import Cardano.Api.Shelley | ||
|
||
import Cardano.CLI.Types.Common | ||
import Cardano.Prelude (Word32) | ||
|
||
import Data.Text (Text) | ||
|
||
data KeyCmds | ||
= KeyVerificationKeyCmd !KeyVerificationKeyCmdArgs | ||
| KeyNonExtendedKeyCmd !KeyNonExtendedKeyCmdArgs | ||
| KeyExtendedSigningKeyFromMnemonicCmd !KeyExtendedSigningKeyFromMnemonicArgs | ||
| KeyConvertByronKeyCmd !KeyConvertByronKeyCmdArgs | ||
| KeyConvertByronGenesisVKeyCmd !KeyConvertByronGenesisVKeyCmdArgs | ||
| KeyConvertITNKeyCmd !KeyConvertITNKeyCmdArgs | ||
|
@@ -52,6 +56,24 @@ data KeyNonExtendedKeyCmdArgs = KeyNonExtendedKeyCmdArgs | |
} | ||
deriving Show | ||
|
||
-- | Get a verification key from a mnemonic. This supports all extended key types. | ||
data KeyExtendedSigningKeyFromMnemonicArgs = KeyExtendedSigningKeyFromMnemonicArgs | ||
{ keyOutputFormat :: !KeyOutputFormat | ||
, extendedSigningKeyType :: !ExtendedSigningType | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
, derivationAccountNo :: !Word32 | ||
, mnemonic :: !Text | ||
, signingKeyFileOut :: !(SigningKeyFile Out) | ||
} | ||
deriving Show | ||
|
||
data ExtendedSigningType | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A comment saying something like "This is the key derived from the mnemonic" |
||
= ExtendedSigningPaymentKey !Word32 | ||
| ExtendedSigningStakeKey !Word32 | ||
| ExtendedSigningDRepKey | ||
| ExtendedSigningCCColdKey | ||
| ExtendedSigningCCHotKey | ||
deriving Show | ||
|
||
-- | Convert a Byron payment, genesis or genesis delegate key (signing or | ||
-- verification) to a corresponding Shelley-format key. | ||
data KeyConvertByronKeyCmdArgs = KeyConvertByronKeyCmdArgs | ||
|
@@ -124,6 +146,8 @@ renderKeyCmds = \case | |
"key verification-key" | ||
KeyNonExtendedKeyCmd{} -> | ||
"key non-extended-key" | ||
KeyExtendedSigningKeyFromMnemonicCmd{} -> | ||
"key from-mnemonic" | ||
KeyConvertByronKeyCmd{} -> | ||
"key convert-byron-key" | ||
KeyConvertByronGenesisVKeyCmd{} -> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those new additions are quite large so I'd suggest adding a new module for them. For example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verification key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch