diff --git a/cabal.project b/cabal.project index 9eb1804dcc..b4fc92178e 100644 --- a/cabal.project +++ b/cabal.project @@ -19,6 +19,20 @@ index-state: packages: cardano-cli +source-repository-package + type: git + location: https://github.com/intersectmbo/cardano-addresses.git + tag: b170724d92549a69fc3074b5f9b3f1871701aaab + subdir: core + --sha256: sha256-ldr7lEdME4XUjtgARPDBMMzeg3i2UojlW03ab3Pv0T0= + +source-repository-package + type: git + location: https://github.com/intersectmbo/cardano-api.git + tag: 29ca290f33c8df3d54e68cd566a762fa4aad2693 + subdir: cardano-api + --sha256: sha256-LuCEwN4nAiAfDelb7slBTkvfvUqQFQK0mMwaOF1kcHo= + program-options ghc-options: -Werror diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index 012438b1cb..8724c7081a 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -147,6 +147,7 @@ library Cardano.CLI.Run.Debug.TransactionView Cardano.CLI.Run.Hash Cardano.CLI.Run.Key + Cardano.CLI.Run.Mnemonic Cardano.CLI.Run.Node Cardano.CLI.Run.Ping Cardano.CLI.TopHandler @@ -222,6 +223,7 @@ library exceptions, filepath, formatting, + haskeline, http-client, http-client-tls, http-types, diff --git a/cardano-cli/src/Cardano/CLI/Commands/Key.hs b/cardano-cli/src/Cardano/CLI/Commands/Key.hs index 413cc24ab5..8a27c6f9ed 100644 --- a/cardano-cli/src/Cardano/CLI/Commands/Key.hs +++ b/cardano-cli/src/Cardano/CLI/Commands/Key.hs @@ -6,6 +6,10 @@ module Cardano.CLI.Commands.Key ( KeyCmds (..) , KeyVerificationKeyCmdArgs (..) , KeyNonExtendedKeyCmdArgs (..) + , KeyGenerateMnemonicCmdArgs (..) + , KeyExtendedSigningKeyFromMnemonicArgs (..) + , ExtendedSigningType (..) + , MnemonicSource (..) , KeyConvertByronKeyCmdArgs (..) , KeyConvertByronGenesisVKeyCmdArgs (..) , KeyConvertITNKeyCmdArgs (..) @@ -19,12 +23,15 @@ where import Cardano.Api.Shelley import Cardano.CLI.Types.Common +import Cardano.Prelude (Word32) import Data.Text (Text) data KeyCmds = KeyVerificationKeyCmd !KeyVerificationKeyCmdArgs | KeyNonExtendedKeyCmd !KeyNonExtendedKeyCmdArgs + | KeyGenerateMnemonicCmd !KeyGenerateMnemonicCmdArgs + | KeyExtendedSigningKeyFromMnemonicCmd !KeyExtendedSigningKeyFromMnemonicArgs | KeyConvertByronKeyCmd !KeyConvertByronKeyCmdArgs | KeyConvertByronGenesisVKeyCmd !KeyConvertByronGenesisVKeyCmdArgs | KeyConvertITNKeyCmd !KeyConvertITNKeyCmdArgs @@ -52,6 +59,41 @@ data KeyNonExtendedKeyCmdArgs = KeyNonExtendedKeyCmdArgs } deriving Show +-- | Generate a mnemonic phrase that can be used to derive signing keys. +data KeyGenerateMnemonicCmdArgs = KeyGenerateMnemonicCmdArgs + { mnemonicOutputFormat :: !(Maybe (File () Out)) + -- ^ Output format for the mnemonic phrase + , mnemonicWords :: !MnemonicSize + -- ^ Number of mnemonic words to generate it must be one of: 12, 15, 18, 21, or 24. + } + deriving Show + +-- | Get an extended signing key from a mnemonic. +data KeyExtendedSigningKeyFromMnemonicArgs = KeyExtendedSigningKeyFromMnemonicArgs + { keyOutputFormat :: !KeyOutputFormat + , derivedExtendedSigningKeyType :: !ExtendedSigningType + , derivationAccountNo :: !Word32 + , mnemonicSource :: !MnemonicSource + , signingKeyFileOut :: !(SigningKeyFile Out) + } + deriving Show + +data MnemonicSource + = MnemonicFromFile !(File () In) + | MnemonicFromInteractivePrompt + deriving Show + +-- | Type of the key derived from a mnemonic +-- together with the payment key number in the derivation path +-- for cases where it is applicable. +data ExtendedSigningType + = 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 +166,10 @@ renderKeyCmds = \case "key verification-key" KeyNonExtendedKeyCmd{} -> "key non-extended-key" + KeyGenerateMnemonicCmd{} -> + "key generate-mnemonic" + KeyExtendedSigningKeyFromMnemonicCmd{} -> + "key from-mnemonic" KeyConvertByronKeyCmd{} -> "key convert-byron-key" KeyConvertByronGenesisVKeyCmd{} -> diff --git a/cardano-cli/src/Cardano/CLI/Options/Key.hs b/cardano-cli/src/Cardano/CLI/Options/Key.hs index 33d2a0477c..4e70b0a5a0 100644 --- a/cardano-cli/src/Cardano/CLI/Options/Key.hs +++ b/cardano-cli/src/Cardano/CLI/Options/Key.hs @@ -1,6 +1,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} +{-# LANGUAGE LambdaCase #-} {-# LANGUAGE ScopedTypeVariables #-} module Cardano.CLI.Options.Key @@ -17,8 +18,10 @@ import Cardano.CLI.Types.Common import Data.Foldable import Data.Text (Text) +import GHC.Word (Word32) import Options.Applicative hiding (help, str) import qualified Options.Applicative as Opt +import Options.Applicative.Types (readerAsk) {- HLINT ignore "Use <$>" -} {- HLINT ignore "Move brackets to avoid $" -} @@ -42,6 +45,23 @@ pKeyCmds = , "extended verification key. This supports all " , "extended key types." ] + , subParser "generate-mnemonic" $ + Opt.info pKeyGenerateMnemonicCmd $ + Opt.progDesc $ + mconcat + [ "Generate a mnemonic sentence that can be used " + , "for key derivation." + ] + , subParser "derive-from-mnemonic" $ + Opt.info pKeyExtendedSigningKeyFromMnemonicCmd $ + Opt.progDesc $ + mconcat + [ "Derive an extended signing key from a mnemonic " + , "sentence. " + , "To ensure the safety of the mnemonic phrase, " + , "we recommend that key derivation is performed " + , "in an air-gapped environment." + ] , subParser "convert-byron-key" $ Opt.info pKeyConvertByronKeyCmd $ Opt.progDesc $ @@ -114,6 +134,107 @@ pKeyNonExtendedKeyCmd = <$> pExtendedVerificationKeyFileIn <*> pVerificationKeyFileOut +pKeyGenerateMnemonicCmd :: Parser KeyCmds +pKeyGenerateMnemonicCmd = + fmap KeyGenerateMnemonicCmd $ + KeyGenerateMnemonicCmdArgs + <$> optional pOutputFile + <*> pMnemonicSize + +pMnemonicSize :: Parser MnemonicSize +pMnemonicSize = do + option + parseSize + ( long "size" + <> metavar "WORD32" + <> Opt.help + ( mconcat + [ "Specify the desired number of words for the output" + , "mnemonic sentence (valid options are: 12, 15, 18, 21, and 24)" + ] + ) + ) + where + parseSize :: ReadM MnemonicSize + parseSize = + readerAsk + >>= \case + "12" -> return MS12 + "15" -> return MS15 + "18" -> return MS18 + "21" -> return MS21 + "24" -> return MS24 + invalidSize -> + readerError $ + "Invalid mnemonic size " <> show invalidSize <> "! It must be one of: 12, 15, 18, 21, or 24." + +pKeyExtendedSigningKeyFromMnemonicCmd :: Parser KeyCmds +pKeyExtendedSigningKeyFromMnemonicCmd = + fmap KeyExtendedSigningKeyFromMnemonicCmd $ + KeyExtendedSigningKeyFromMnemonicArgs + <$> pKeyOutputFormat + <*> pDerivedExtendedSigningKeyType + <*> pAccountNumber + <*> pMnemonicSource + <*> pSigningKeyFileOut + +pDerivedExtendedSigningKeyType :: Parser ExtendedSigningType +pDerivedExtendedSigningKeyType = + asum + [ Opt.option (ExtendedSigningPaymentKey <$> integralReader) $ + mconcat + [ Opt.long "payment-key-with-number" + , Opt.metavar "WORD32" + , Opt.help + "Derive an extended payment key with the given payment address number from the derivation path." + ] + , Opt.option (ExtendedSigningStakeKey <$> integralReader) $ + mconcat + [ Opt.long "stake-key-with-number" + , Opt.metavar "WORD32" + , Opt.help + "Derive an extended stake key with the given stake address number from the derivation path." + ] + , Opt.flag' ExtendedSigningDRepKey $ + mconcat + [ Opt.long "drep-key" + , Opt.help "Derive an extended DRep key." + ] + , Opt.flag' ExtendedSigningCCColdKey $ + mconcat + [ Opt.long "cc-cold-key" + , Opt.help "Derive an extended committee cold key." + ] + , Opt.flag' ExtendedSigningCCHotKey $ + mconcat + [ Opt.long "cc-hot-key" + , Opt.help "Derive an extended committee hot key." + ] + ] + +pMnemonicSource :: Parser MnemonicSource +pMnemonicSource = + asum + [ MnemonicFromFile . File <$> parseFilePath "mnemonic-from-file" "Input text file with the mnemonic." + , Opt.flag' MnemonicFromInteractivePrompt $ + mconcat + [ Opt.long "mnemonic-from-interactive-prompt" + , Opt.help $ + "Input the mnemonic through an interactive prompt. " + <> "This mode also accepts receiving the mnemonic through " + <> "standard input directly, for example, by using a pipe." + ] + ] + +pAccountNumber :: Parser Word32 +pAccountNumber = + Opt.option integralReader $ + mconcat + [ Opt.long "account-number" + , Opt.metavar "WORD32" + , Opt.help "Account number in the derivation path." + ] + pKeyConvertByronKeyCmd :: Parser KeyCmds pKeyConvertByronKeyCmd = fmap KeyConvertByronKeyCmd $ diff --git a/cardano-cli/src/Cardano/CLI/Run/Key.hs b/cardano-cli/src/Cardano/CLI/Run/Key.hs index 5fe8336002..93aa0218a0 100644 --- a/cardano-cli/src/Cardano/CLI/Run/Key.hs +++ b/cardano-cli/src/Cardano/CLI/Run/Key.hs @@ -1,9 +1,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE DuplicateRecordFields #-} -{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} module Cardano.CLI.Run.Key @@ -39,6 +37,7 @@ import qualified Cardano.Api.Ledger as L import qualified Cardano.CLI.Byron.Key as Byron import qualified Cardano.CLI.Commands.Key as Cmd +import Cardano.CLI.Run.Mnemonic (extendedSigningKeyFromMnemonicImpl, generateMnemonicImpl) import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.CardanoAddressSigningKeyConversionError import Cardano.CLI.Types.Errors.ItnKeyConversionError @@ -112,6 +111,10 @@ runKeyCmds = \case runVerificationKeyCmd cmd Cmd.KeyNonExtendedKeyCmd cmd -> runNonExtendedKeyCmd cmd + Cmd.KeyGenerateMnemonicCmd cmd -> + runGenerateMnemonicCmd cmd + Cmd.KeyExtendedSigningKeyFromMnemonicCmd cmd -> + runExtendedSigningKeyFromMnemonicCmd cmd Cmd.KeyConvertByronKeyCmd cmd -> runConvertByronKeyCmd cmd Cmd.KeyConvertByronGenesisVKeyCmd cmd -> @@ -202,6 +205,13 @@ runNonExtendedKeyCmd writeLazyByteStringFile vkf' $ textEnvelopeToJSON descr vk +runGenerateMnemonicCmd :: Cmd.KeyGenerateMnemonicCmdArgs -> ExceptT KeyCmdError IO () +runGenerateMnemonicCmd + Cmd.KeyGenerateMnemonicCmdArgs + { mnemonicOutputFormat + , mnemonicWords + } = generateMnemonicImpl mnemonicWords mnemonicOutputFormat + readExtendedVerificationKeyFile :: VerificationKeyFile In -> ExceptT KeyCmdError IO SomeAddressVerificationKey @@ -232,6 +242,24 @@ readExtendedVerificationKeyFile evkfile = do where goFail k = left $ KeyCmdExpectedExtendedVerificationKey k +runExtendedSigningKeyFromMnemonicCmd + :: Cmd.KeyExtendedSigningKeyFromMnemonicArgs + -> ExceptT KeyCmdError IO () +runExtendedSigningKeyFromMnemonicCmd + Cmd.KeyExtendedSigningKeyFromMnemonicArgs + { keyOutputFormat + , derivedExtendedSigningKeyType + , derivationAccountNo + , mnemonicSource + , signingKeyFileOut + } = + extendedSigningKeyFromMnemonicImpl + keyOutputFormat + derivedExtendedSigningKeyType + derivationAccountNo + mnemonicSource + signingKeyFileOut + runConvertByronKeyCmd :: Cmd.KeyConvertByronKeyCmdArgs -> ExceptT KeyCmdError IO () diff --git a/cardano-cli/src/Cardano/CLI/Run/Mnemonic.hs b/cardano-cli/src/Cardano/CLI/Run/Mnemonic.hs new file mode 100644 index 0000000000..50b2ec086e --- /dev/null +++ b/cardano-cli/src/Cardano/CLI/Run/Mnemonic.hs @@ -0,0 +1,184 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} + +module Cardano.CLI.Run.Mnemonic (generateMnemonicImpl, extendedSigningKeyFromMnemonicImpl) where + +import Cardano.Api + (AsType (AsCommitteeColdExtendedKey, AsCommitteeHotExtendedKey, AsDRepExtendedKey, AsPaymentExtendedKey, AsStakeExtendedKey), + ExceptT, File, FileDirection (Out), HasTextEnvelope, Key (SigningKey), + MnemonicSize (..), MnemonicToSigningKeyError, MonadIO (..), SerialiseAsBech32, + except, findMnemonicWordsWithPrefix, firstExceptT, generateMnemonic, left, + newExceptT, readTextFile, serialiseToBech32, signingKeyFromMnemonic, + signingKeyFromMnemonicWithPaymentKeyIndex, textEnvelopeToJSON, + writeLazyByteStringFile, writeTextFile) + +import qualified Cardano.CLI.Commands.Key as Cmd +import Cardano.CLI.Types.Common (KeyOutputFormat (..), SigningKeyFile) +import Cardano.CLI.Types.Errors.KeyCmdError + (KeyCmdError (KeyCmdMnemonicError, KeyCmdReadMnemonicFileError, KeyCmdWriteFileError, KeyCmdWrongNumOfMnemonics)) +import Cardano.Prelude (isSpace) + +import Control.Monad (when) +import Data.Bifunctor (Bifunctor (..)) +import Data.Text (Text) +import qualified Data.Text as T +import Data.Word (Word32) +import System.Console.Haskeline (Completion, InputT, Settings (..), completeWord', + defaultBehavior, defaultPrefs, getInputLineWithInitial, + runInputTBehaviorWithPrefs, simpleCompletion) +import System.Console.Haskeline.Completion (CompletionFunc) + +-- | Generate a mnemonic and write it to a file or stdout. +generateMnemonicImpl + :: MonadIO m + => MnemonicSize + -- ^ The number of words in the mnemonic. + -> Maybe (File () Out) + -- ^ The file to write the mnemonic to. If 'Nothing', write to stdout. + -> ExceptT KeyCmdError m () +generateMnemonicImpl mnemonicWords mnemonicOutputFormat = do + mnemonic <- firstExceptT KeyCmdMnemonicError $ generateMnemonic mnemonicWords + let expectedNumOfMnemonicWords = mnemonicSizeToInt mnemonicWords + obtainedNumOfMnemonicWords = length mnemonic + when (obtainedNumOfMnemonicWords /= expectedNumOfMnemonicWords) $ + left $ + KeyCmdWrongNumOfMnemonics expectedNumOfMnemonicWords obtainedNumOfMnemonicWords + case mnemonicOutputFormat of + Just outFile -> + firstExceptT KeyCmdWriteFileError . newExceptT $ + writeTextFile outFile (T.unwords mnemonic) + Nothing -> liftIO $ putStrLn $ T.unpack (T.unwords mnemonic) + where + mnemonicSizeToInt :: MnemonicSize -> Int + mnemonicSizeToInt MS12 = 12 + mnemonicSizeToInt MS15 = 15 + mnemonicSizeToInt MS18 = 18 + mnemonicSizeToInt MS21 = 21 + mnemonicSizeToInt MS24 = 24 + +-- | Derive an extended signing key from a mnemonic and write it to a file. +extendedSigningKeyFromMnemonicImpl + :: KeyOutputFormat + -- ^ The format in which to write the signing key. + -> Cmd.ExtendedSigningType + -- ^ The type of the extended signing key to derive with an optional payment key index. + -> Word32 + -- ^ The account index. + -> Cmd.MnemonicSource + -- ^ The source of the mnemonic (either file or stdin). + -> SigningKeyFile Out + -- ^ The file to write the signing key to. + -> ExceptT KeyCmdError IO () +extendedSigningKeyFromMnemonicImpl keyOutputFormat derivedExtendedSigningKeyType derivationAccountNo mnemonicSource signingKeyFileOut = + do + let writeKeyToFile + :: (HasTextEnvelope (SigningKey a), SerialiseAsBech32 (SigningKey a)) + => SigningKey a -> ExceptT KeyCmdError IO () + writeKeyToFile = writeSigningKeyFile keyOutputFormat signingKeyFileOut + + wrapException :: Either MnemonicToSigningKeyError a -> ExceptT KeyCmdError IO a + wrapException = except . first KeyCmdMnemonicError + + mnemonicWords <- readMnemonic mnemonicSource + + case derivedExtendedSigningKeyType of + Cmd.ExtendedSigningPaymentKey paymentKeyNo -> + writeKeyToFile + =<< wrapException + ( signingKeyFromMnemonicWithPaymentKeyIndex + AsPaymentExtendedKey + mnemonicWords + derivationAccountNo + paymentKeyNo + ) + Cmd.ExtendedSigningStakeKey paymentKeyNo -> + writeKeyToFile + =<< wrapException + ( signingKeyFromMnemonicWithPaymentKeyIndex + AsStakeExtendedKey + mnemonicWords + derivationAccountNo + paymentKeyNo + ) + Cmd.ExtendedSigningDRepKey -> + writeKeyToFile + =<< wrapException (signingKeyFromMnemonic AsDRepExtendedKey mnemonicWords derivationAccountNo) + Cmd.ExtendedSigningCCColdKey -> + writeKeyToFile + =<< wrapException + (signingKeyFromMnemonic AsCommitteeColdExtendedKey mnemonicWords derivationAccountNo) + Cmd.ExtendedSigningCCHotKey -> + writeKeyToFile + =<< wrapException + (signingKeyFromMnemonic AsCommitteeHotExtendedKey mnemonicWords derivationAccountNo) + where + writeSigningKeyFile + :: (HasTextEnvelope (SigningKey a), SerialiseAsBech32 (SigningKey a)) + => KeyOutputFormat -> SigningKeyFile Out -> SigningKey a -> ExceptT KeyCmdError IO () + writeSigningKeyFile fmt sKeyPath skey = + firstExceptT KeyCmdWriteFileError $ + case fmt of + KeyOutputFormatTextEnvelope -> + newExceptT $ + writeLazyByteStringFile sKeyPath $ + textEnvelopeToJSON Nothing skey + KeyOutputFormatBech32 -> + newExceptT $ + writeTextFile sKeyPath $ + serialiseToBech32 skey + + readMnemonic :: Cmd.MnemonicSource -> ExceptT KeyCmdError IO [Text] + readMnemonic (Cmd.MnemonicFromFile filePath) = do + fileText <- firstExceptT KeyCmdReadMnemonicFileError $ except =<< readTextFile filePath + return $ map T.pack $ words $ T.unpack fileText + readMnemonic Cmd.MnemonicFromInteractivePrompt = + liftIO $ do + putStrLn $ + unlines + [ "" + , "Please enter your mnemonic sentence." + , "" + , " - It should consist of either: 12, 15, 18, 21, or 24 words." + , " - To terminate, press enter on an empty line." + , " - To abort you can press CTRL+C." + , "" + , "(If your terminal supports it, you can use the TAB key for word completion.)" + , "" + ] + runInputTBehaviorWithPrefs defaultBehavior defaultPrefs settings (inputT ("", "") []) + where + settings :: Monad m => Settings m + settings = + Settings + { complete = completionFunc + , historyFile = Nothing + , autoAddHistory = False + } + + completionFunc :: Monad m => CompletionFunc m + completionFunc = completeWord' Nothing isSpace completeMnemonicWord + + completeMnemonicWord :: Monad m => String -> m [Completion] + completeMnemonicWord prefix = return $ map (simpleCompletion . T.unpack . fst) $ findMnemonicWordsWithPrefix (T.pack prefix) + + inputT :: (String, String) -> [Text] -> InputT IO [Text] + inputT prefill mnemonic = do + minput <- getInputLineWithInitial (show (length mnemonic + 1) <> ". ") prefill + case minput of + Nothing -> return $ reverse mnemonic + Just "" -> return $ reverse mnemonic + Just input -> + let newWords = map (T.toLower . T.pack) $ filter (not . null) $ words input + in case span isValidMnemonicWord newWords of + (allWords, []) -> inputT ("", "") (reverse allWords ++ mnemonic) + (validWords, invalidWord : notValidatedWords) -> do + liftIO $ putStrLn $ "The word \"" <> T.unpack invalidWord <> "\" is not in the memonic dictionary" + let textBeforeCursor = unwords (map T.unpack validWords <> [T.unpack invalidWord]) + textAfterCursor = + if null notValidatedWords + then "" + else ' ' : unwords (map T.unpack notValidatedWords) + inputT (textBeforeCursor, textAfterCursor) mnemonic + + isValidMnemonicWord :: Text -> Bool + isValidMnemonicWord word = word `elem` map fst (findMnemonicWordsWithPrefix word) diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/KeyCmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/KeyCmdError.hs index a1ac6de59e..1a41af1356 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/KeyCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/KeyCmdError.hs @@ -21,7 +21,14 @@ import Data.Text (Text) data KeyCmdError = KeyCmdReadFileError !(FileError TextEnvelopeError) | KeyCmdReadKeyFileError !(FileError InputDecodeError) + | KeyCmdReadMnemonicFileError !(FileError ()) | KeyCmdWriteFileError !(FileError ()) + | KeyCmdMnemonicError MnemonicToSigningKeyError + | KeyCmdWrongNumOfMnemonics + !Int + -- ^ Expected number of mnemonics + !Int + -- ^ Actual number of mnemonics | KeyCmdByronKeyFailure !Byron.ByronKeyFailure | -- | Text representation of the parse error. Unfortunately, the actual -- error type isn't exported. @@ -43,8 +50,14 @@ renderKeyCmdError err = prettyError fileErr KeyCmdReadKeyFileError fileErr -> prettyError fileErr + KeyCmdReadMnemonicFileError fileErr -> + "Error reading mnemonic file: " <> prettyError fileErr KeyCmdWriteFileError fileErr -> prettyError fileErr + KeyCmdMnemonicError mnemonicErr -> + "Error converting the mnemonic into a key: " <> prettyError mnemonicErr + KeyCmdWrongNumOfMnemonics expected actual -> + "Internal error: expected " <> pretty expected <> " mnemonics, but got " <> pretty actual KeyCmdByronKeyFailure e -> Byron.renderByronKeyFailure e KeyCmdByronKeyParseError errTxt -> diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli index 43b3c0f35a..e1591159be 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -64,6 +64,8 @@ Usage: cardano-cli address info --address ADDRESS [--out-file FILEPATH] Usage: cardano-cli key ( verification-key | non-extended-key + | generate-mnemonic + | derive-from-mnemonic | convert-byron-key | convert-byron-genesis-vkey | convert-itn-key @@ -85,6 +87,27 @@ Usage: cardano-cli key non-extended-key --extended-verification-key-file FILEPAT Get a non-extended verification key from an extended verification key. This supports all extended key types. +Usage: cardano-cli key generate-mnemonic [--out-file FILEPATH] --size WORD32 + + Generate a mnemonic sentence that can be used for key derivation. + +Usage: cardano-cli key derive-from-mnemonic [--key-output-format STRING] + ( --payment-key-with-number WORD32 + | --stake-key-with-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + Usage: cardano-cli key convert-byron-key [--password TEXT] ( --byron-payment-key-type | --legacy-byron-payment-key-type @@ -1004,6 +1027,8 @@ Usage: cardano-cli shelley address info --address ADDRESS [--out-file FILEPATH] Usage: cardano-cli shelley key ( verification-key | non-extended-key + | generate-mnemonic + | derive-from-mnemonic | convert-byron-key | convert-byron-genesis-vkey | convert-itn-key @@ -1025,6 +1050,28 @@ Usage: cardano-cli shelley key non-extended-key --extended-verification-key-file Get a non-extended verification key from an extended verification key. This supports all extended key types. +Usage: cardano-cli shelley key generate-mnemonic [--out-file FILEPATH] + --size WORD32 + + Generate a mnemonic sentence that can be used for key derivation. + +Usage: cardano-cli shelley key derive-from-mnemonic [--key-output-format STRING] + ( --payment-key-with-number WORD32 + | --stake-key-with-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + Usage: cardano-cli shelley key convert-byron-key [--password TEXT] ( --byron-payment-key-type | --legacy-byron-payment-key-type @@ -2076,6 +2123,8 @@ Usage: cardano-cli allegra address info --address ADDRESS [--out-file FILEPATH] Usage: cardano-cli allegra key ( verification-key | non-extended-key + | generate-mnemonic + | derive-from-mnemonic | convert-byron-key | convert-byron-genesis-vkey | convert-itn-key @@ -2097,6 +2146,28 @@ Usage: cardano-cli allegra key non-extended-key --extended-verification-key-file Get a non-extended verification key from an extended verification key. This supports all extended key types. +Usage: cardano-cli allegra key generate-mnemonic [--out-file FILEPATH] + --size WORD32 + + Generate a mnemonic sentence that can be used for key derivation. + +Usage: cardano-cli allegra key derive-from-mnemonic [--key-output-format STRING] + ( --payment-key-with-number WORD32 + | --stake-key-with-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + Usage: cardano-cli allegra key convert-byron-key [--password TEXT] ( --byron-payment-key-type | --legacy-byron-payment-key-type @@ -3148,6 +3219,8 @@ Usage: cardano-cli mary address info --address ADDRESS [--out-file FILEPATH] Usage: cardano-cli mary key ( verification-key | non-extended-key + | generate-mnemonic + | derive-from-mnemonic | convert-byron-key | convert-byron-genesis-vkey | convert-itn-key @@ -3169,6 +3242,28 @@ Usage: cardano-cli mary key non-extended-key --extended-verification-key-file FI Get a non-extended verification key from an extended verification key. This supports all extended key types. +Usage: cardano-cli mary key generate-mnemonic [--out-file FILEPATH] + --size WORD32 + + Generate a mnemonic sentence that can be used for key derivation. + +Usage: cardano-cli mary key derive-from-mnemonic [--key-output-format STRING] + ( --payment-key-with-number WORD32 + | --stake-key-with-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + Usage: cardano-cli mary key convert-byron-key [--password TEXT] ( --byron-payment-key-type | --legacy-byron-payment-key-type @@ -4210,6 +4305,8 @@ Usage: cardano-cli alonzo address info --address ADDRESS [--out-file FILEPATH] Usage: cardano-cli alonzo key ( verification-key | non-extended-key + | generate-mnemonic + | derive-from-mnemonic | convert-byron-key | convert-byron-genesis-vkey | convert-itn-key @@ -4231,6 +4328,28 @@ Usage: cardano-cli alonzo key non-extended-key --extended-verification-key-file Get a non-extended verification key from an extended verification key. This supports all extended key types. +Usage: cardano-cli alonzo key generate-mnemonic [--out-file FILEPATH] + --size WORD32 + + Generate a mnemonic sentence that can be used for key derivation. + +Usage: cardano-cli alonzo key derive-from-mnemonic [--key-output-format STRING] + ( --payment-key-with-number WORD32 + | --stake-key-with-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + Usage: cardano-cli alonzo key convert-byron-key [--password TEXT] ( --byron-payment-key-type | --legacy-byron-payment-key-type @@ -5287,6 +5406,8 @@ Usage: cardano-cli babbage address info --address ADDRESS [--out-file FILEPATH] Usage: cardano-cli babbage key ( verification-key | non-extended-key + | generate-mnemonic + | derive-from-mnemonic | convert-byron-key | convert-byron-genesis-vkey | convert-itn-key @@ -5308,6 +5429,28 @@ Usage: cardano-cli babbage key non-extended-key --extended-verification-key-file Get a non-extended verification key from an extended verification key. This supports all extended key types. +Usage: cardano-cli babbage key generate-mnemonic [--out-file FILEPATH] + --size WORD32 + + Generate a mnemonic sentence that can be used for key derivation. + +Usage: cardano-cli babbage key derive-from-mnemonic [--key-output-format STRING] + ( --payment-key-with-number WORD32 + | --stake-key-with-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + Usage: cardano-cli babbage key convert-byron-key [--password TEXT] ( --byron-payment-key-type | --legacy-byron-payment-key-type @@ -6644,6 +6787,8 @@ Usage: cardano-cli conway address info --address ADDRESS [--out-file FILEPATH] Usage: cardano-cli conway key ( verification-key | non-extended-key + | generate-mnemonic + | derive-from-mnemonic | convert-byron-key | convert-byron-genesis-vkey | convert-itn-key @@ -6665,6 +6810,28 @@ Usage: cardano-cli conway key non-extended-key --extended-verification-key-file Get a non-extended verification key from an extended verification key. This supports all extended key types. +Usage: cardano-cli conway key generate-mnemonic [--out-file FILEPATH] + --size WORD32 + + Generate a mnemonic sentence that can be used for key derivation. + +Usage: cardano-cli conway key derive-from-mnemonic [--key-output-format STRING] + ( --payment-key-with-number WORD32 + | --stake-key-with-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + Usage: cardano-cli conway key convert-byron-key [--password TEXT] ( --byron-payment-key-type | --legacy-byron-payment-key-type @@ -8643,6 +8810,8 @@ Usage: cardano-cli latest address info --address ADDRESS [--out-file FILEPATH] Usage: cardano-cli latest key ( verification-key | non-extended-key + | generate-mnemonic + | derive-from-mnemonic | convert-byron-key | convert-byron-genesis-vkey | convert-itn-key @@ -8664,6 +8833,28 @@ Usage: cardano-cli latest key non-extended-key --extended-verification-key-file Get a non-extended verification key from an extended verification key. This supports all extended key types. +Usage: cardano-cli latest key generate-mnemonic [--out-file FILEPATH] + --size WORD32 + + Generate a mnemonic sentence that can be used for key derivation. + +Usage: cardano-cli latest key derive-from-mnemonic [--key-output-format STRING] + ( --payment-key-with-number WORD32 + | --stake-key-with-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + Usage: cardano-cli latest key convert-byron-key [--password TEXT] ( --byron-payment-key-type | --legacy-byron-payment-key-type diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_key.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_key.cli index 8b423751c7..8f6f7d3178 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_key.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_key.cli @@ -1,6 +1,8 @@ Usage: cardano-cli allegra key ( verification-key | non-extended-key + | generate-mnemonic + | derive-from-mnemonic | convert-byron-key | convert-byron-genesis-vkey | convert-itn-key @@ -20,6 +22,12 @@ Available commands: non-extended-key Get a non-extended verification key from an extended verification key. This supports all extended key types. + generate-mnemonic Generate a mnemonic sentence that can be used for key + derivation. + derive-from-mnemonic Derive an extended signing key from a mnemonic + sentence. To ensure the safety of the mnemonic + phrase, we recommend that key derivation is performed + in an air-gapped environment. convert-byron-key Convert a Byron payment, genesis or genesis delegate key (signing or verification) to a corresponding Shelley-format key. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_key_derive-from-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_key_derive-from-mnemonic.cli new file mode 100644 index 0000000000..600bb6e4c6 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_key_derive-from-mnemonic.cli @@ -0,0 +1,42 @@ +Usage: cardano-cli allegra key derive-from-mnemonic [--key-output-format STRING] + ( --payment-key-with-number WORD32 + | --stake-key-with-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + +Available options: + --key-output-format STRING + Optional key output format. Accepted output formats + are "text-envelope" and "bech32" (default is + "text-envelope"). + --payment-key-with-number WORD32 + Derive an extended payment key with the given payment + address number from the derivation path. + --stake-key-with-number WORD32 + Derive an extended stake key with the given stake + address number from the derivation path. + --drep-key Derive an extended DRep key. + --cc-cold-key Derive an extended committee cold key. + --cc-hot-key Derive an extended committee hot key. + --account-number WORD32 Account number in the derivation path. + --mnemonic-from-file FILEPATH + Input text file with the mnemonic. + --mnemonic-from-interactive-prompt + Input the mnemonic through an interactive prompt. + This mode also accepts receiving the mnemonic through + standard input directly, for example, by using a + pipe. + --signing-key-file FILEPATH + Output filepath of the signing key. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_key_generate-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_key_generate-mnemonic.cli new file mode 100644 index 0000000000..daa7e923c2 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_key_generate-mnemonic.cli @@ -0,0 +1,11 @@ +Usage: cardano-cli allegra key generate-mnemonic [--out-file FILEPATH] + --size WORD32 + + Generate a mnemonic sentence that can be used for key derivation. + +Available options: + --out-file FILEPATH The output file. + --size WORD32 Specify the desired number of words for the + outputmnemonic sentence (valid options are: 12, 15, + 18, 21, and 24) + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_key_key-from-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_key_key-from-mnemonic.cli new file mode 100644 index 0000000000..132ec45ca5 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_key_key-from-mnemonic.cli @@ -0,0 +1,41 @@ +Usage: cardano-cli allegra key key-from-mnemonic [--key-output-format STRING] + ( --payment-key + --payment-address-number WORD32 + | --stake-key + --payment-address-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + +Available options: + --key-output-format STRING + Optional key output format. Accepted output formats + are "text-envelope" and "bech32" (default is + "text-envelope"). + --payment-key Derive an extended payment key. + --payment-address-number WORD32 + Payment address number in the derivation path. + --stake-key Derive an extended stake key. + --payment-address-number WORD32 + Payment address number in the derivation path. + --drep-key Derive an extended DRep key. + --cc-cold-key Derive an extended committee cold key. + --cc-hot-key Derive an extended committee hot key. + --account-number WORD32 Account number in the derivation path. + --mnemonic-from-file FILEPATH + Input text file with the mnemonic. + --mnemonic-from-interactive-prompt + Input the mnemonic through an interactive prompt. + --signing-key-file FILEPATH + Output filepath of the signing key. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_key.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_key.cli index 92dcd0d399..a6bb622a42 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_key.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_key.cli @@ -1,6 +1,8 @@ Usage: cardano-cli alonzo key ( verification-key | non-extended-key + | generate-mnemonic + | derive-from-mnemonic | convert-byron-key | convert-byron-genesis-vkey | convert-itn-key @@ -20,6 +22,12 @@ Available commands: non-extended-key Get a non-extended verification key from an extended verification key. This supports all extended key types. + generate-mnemonic Generate a mnemonic sentence that can be used for key + derivation. + derive-from-mnemonic Derive an extended signing key from a mnemonic + sentence. To ensure the safety of the mnemonic + phrase, we recommend that key derivation is performed + in an air-gapped environment. convert-byron-key Convert a Byron payment, genesis or genesis delegate key (signing or verification) to a corresponding Shelley-format key. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_key_derive-from-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_key_derive-from-mnemonic.cli new file mode 100644 index 0000000000..6756126574 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_key_derive-from-mnemonic.cli @@ -0,0 +1,42 @@ +Usage: cardano-cli alonzo key derive-from-mnemonic [--key-output-format STRING] + ( --payment-key-with-number WORD32 + | --stake-key-with-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + +Available options: + --key-output-format STRING + Optional key output format. Accepted output formats + are "text-envelope" and "bech32" (default is + "text-envelope"). + --payment-key-with-number WORD32 + Derive an extended payment key with the given payment + address number from the derivation path. + --stake-key-with-number WORD32 + Derive an extended stake key with the given stake + address number from the derivation path. + --drep-key Derive an extended DRep key. + --cc-cold-key Derive an extended committee cold key. + --cc-hot-key Derive an extended committee hot key. + --account-number WORD32 Account number in the derivation path. + --mnemonic-from-file FILEPATH + Input text file with the mnemonic. + --mnemonic-from-interactive-prompt + Input the mnemonic through an interactive prompt. + This mode also accepts receiving the mnemonic through + standard input directly, for example, by using a + pipe. + --signing-key-file FILEPATH + Output filepath of the signing key. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_key_generate-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_key_generate-mnemonic.cli new file mode 100644 index 0000000000..81533e197d --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_key_generate-mnemonic.cli @@ -0,0 +1,11 @@ +Usage: cardano-cli alonzo key generate-mnemonic [--out-file FILEPATH] + --size WORD32 + + Generate a mnemonic sentence that can be used for key derivation. + +Available options: + --out-file FILEPATH The output file. + --size WORD32 Specify the desired number of words for the + outputmnemonic sentence (valid options are: 12, 15, + 18, 21, and 24) + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_key_key-from-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_key_key-from-mnemonic.cli new file mode 100644 index 0000000000..77d5217ea3 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_key_key-from-mnemonic.cli @@ -0,0 +1,41 @@ +Usage: cardano-cli alonzo key key-from-mnemonic [--key-output-format STRING] + ( --payment-key + --payment-address-number WORD32 + | --stake-key + --payment-address-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + +Available options: + --key-output-format STRING + Optional key output format. Accepted output formats + are "text-envelope" and "bech32" (default is + "text-envelope"). + --payment-key Derive an extended payment key. + --payment-address-number WORD32 + Payment address number in the derivation path. + --stake-key Derive an extended stake key. + --payment-address-number WORD32 + Payment address number in the derivation path. + --drep-key Derive an extended DRep key. + --cc-cold-key Derive an extended committee cold key. + --cc-hot-key Derive an extended committee hot key. + --account-number WORD32 Account number in the derivation path. + --mnemonic-from-file FILEPATH + Input text file with the mnemonic. + --mnemonic-from-interactive-prompt + Input the mnemonic through an interactive prompt. + --signing-key-file FILEPATH + Output filepath of the signing key. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_key.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_key.cli index 05984ddb8b..ae22fc3ce9 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_key.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_key.cli @@ -1,6 +1,8 @@ Usage: cardano-cli babbage key ( verification-key | non-extended-key + | generate-mnemonic + | derive-from-mnemonic | convert-byron-key | convert-byron-genesis-vkey | convert-itn-key @@ -20,6 +22,12 @@ Available commands: non-extended-key Get a non-extended verification key from an extended verification key. This supports all extended key types. + generate-mnemonic Generate a mnemonic sentence that can be used for key + derivation. + derive-from-mnemonic Derive an extended signing key from a mnemonic + sentence. To ensure the safety of the mnemonic + phrase, we recommend that key derivation is performed + in an air-gapped environment. convert-byron-key Convert a Byron payment, genesis or genesis delegate key (signing or verification) to a corresponding Shelley-format key. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_key_derive-from-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_key_derive-from-mnemonic.cli new file mode 100644 index 0000000000..b57921d6c7 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_key_derive-from-mnemonic.cli @@ -0,0 +1,42 @@ +Usage: cardano-cli babbage key derive-from-mnemonic [--key-output-format STRING] + ( --payment-key-with-number WORD32 + | --stake-key-with-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + +Available options: + --key-output-format STRING + Optional key output format. Accepted output formats + are "text-envelope" and "bech32" (default is + "text-envelope"). + --payment-key-with-number WORD32 + Derive an extended payment key with the given payment + address number from the derivation path. + --stake-key-with-number WORD32 + Derive an extended stake key with the given stake + address number from the derivation path. + --drep-key Derive an extended DRep key. + --cc-cold-key Derive an extended committee cold key. + --cc-hot-key Derive an extended committee hot key. + --account-number WORD32 Account number in the derivation path. + --mnemonic-from-file FILEPATH + Input text file with the mnemonic. + --mnemonic-from-interactive-prompt + Input the mnemonic through an interactive prompt. + This mode also accepts receiving the mnemonic through + standard input directly, for example, by using a + pipe. + --signing-key-file FILEPATH + Output filepath of the signing key. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_key_generate-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_key_generate-mnemonic.cli new file mode 100644 index 0000000000..b250a3ae9e --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_key_generate-mnemonic.cli @@ -0,0 +1,11 @@ +Usage: cardano-cli babbage key generate-mnemonic [--out-file FILEPATH] + --size WORD32 + + Generate a mnemonic sentence that can be used for key derivation. + +Available options: + --out-file FILEPATH The output file. + --size WORD32 Specify the desired number of words for the + outputmnemonic sentence (valid options are: 12, 15, + 18, 21, and 24) + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_key_key-from-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_key_key-from-mnemonic.cli new file mode 100644 index 0000000000..aeb281b5c1 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_key_key-from-mnemonic.cli @@ -0,0 +1,41 @@ +Usage: cardano-cli babbage key key-from-mnemonic [--key-output-format STRING] + ( --payment-key + --payment-address-number WORD32 + | --stake-key + --payment-address-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + +Available options: + --key-output-format STRING + Optional key output format. Accepted output formats + are "text-envelope" and "bech32" (default is + "text-envelope"). + --payment-key Derive an extended payment key. + --payment-address-number WORD32 + Payment address number in the derivation path. + --stake-key Derive an extended stake key. + --payment-address-number WORD32 + Payment address number in the derivation path. + --drep-key Derive an extended DRep key. + --cc-cold-key Derive an extended committee cold key. + --cc-hot-key Derive an extended committee hot key. + --account-number WORD32 Account number in the derivation path. + --mnemonic-from-file FILEPATH + Input text file with the mnemonic. + --mnemonic-from-interactive-prompt + Input the mnemonic through an interactive prompt. + --signing-key-file FILEPATH + Output filepath of the signing key. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_key.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_key.cli index 4f277404ee..68f46d0494 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_key.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_key.cli @@ -1,6 +1,8 @@ Usage: cardano-cli conway key ( verification-key | non-extended-key + | generate-mnemonic + | derive-from-mnemonic | convert-byron-key | convert-byron-genesis-vkey | convert-itn-key @@ -20,6 +22,12 @@ Available commands: non-extended-key Get a non-extended verification key from an extended verification key. This supports all extended key types. + generate-mnemonic Generate a mnemonic sentence that can be used for key + derivation. + derive-from-mnemonic Derive an extended signing key from a mnemonic + sentence. To ensure the safety of the mnemonic + phrase, we recommend that key derivation is performed + in an air-gapped environment. convert-byron-key Convert a Byron payment, genesis or genesis delegate key (signing or verification) to a corresponding Shelley-format key. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_key_derive-from-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_key_derive-from-mnemonic.cli new file mode 100644 index 0000000000..324390e473 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_key_derive-from-mnemonic.cli @@ -0,0 +1,42 @@ +Usage: cardano-cli conway key derive-from-mnemonic [--key-output-format STRING] + ( --payment-key-with-number WORD32 + | --stake-key-with-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + +Available options: + --key-output-format STRING + Optional key output format. Accepted output formats + are "text-envelope" and "bech32" (default is + "text-envelope"). + --payment-key-with-number WORD32 + Derive an extended payment key with the given payment + address number from the derivation path. + --stake-key-with-number WORD32 + Derive an extended stake key with the given stake + address number from the derivation path. + --drep-key Derive an extended DRep key. + --cc-cold-key Derive an extended committee cold key. + --cc-hot-key Derive an extended committee hot key. + --account-number WORD32 Account number in the derivation path. + --mnemonic-from-file FILEPATH + Input text file with the mnemonic. + --mnemonic-from-interactive-prompt + Input the mnemonic through an interactive prompt. + This mode also accepts receiving the mnemonic through + standard input directly, for example, by using a + pipe. + --signing-key-file FILEPATH + Output filepath of the signing key. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_key_generate-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_key_generate-mnemonic.cli new file mode 100644 index 0000000000..99b9291670 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_key_generate-mnemonic.cli @@ -0,0 +1,11 @@ +Usage: cardano-cli conway key generate-mnemonic [--out-file FILEPATH] + --size WORD32 + + Generate a mnemonic sentence that can be used for key derivation. + +Available options: + --out-file FILEPATH The output file. + --size WORD32 Specify the desired number of words for the + outputmnemonic sentence (valid options are: 12, 15, + 18, 21, and 24) + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_key_key-from-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_key_key-from-mnemonic.cli new file mode 100644 index 0000000000..8fdb1f8209 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_key_key-from-mnemonic.cli @@ -0,0 +1,41 @@ +Usage: cardano-cli conway key key-from-mnemonic [--key-output-format STRING] + ( --payment-key + --payment-address-number WORD32 + | --stake-key + --payment-address-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + +Available options: + --key-output-format STRING + Optional key output format. Accepted output formats + are "text-envelope" and "bech32" (default is + "text-envelope"). + --payment-key Derive an extended payment key. + --payment-address-number WORD32 + Payment address number in the derivation path. + --stake-key Derive an extended stake key. + --payment-address-number WORD32 + Payment address number in the derivation path. + --drep-key Derive an extended DRep key. + --cc-cold-key Derive an extended committee cold key. + --cc-hot-key Derive an extended committee hot key. + --account-number WORD32 Account number in the derivation path. + --mnemonic-from-file FILEPATH + Input text file with the mnemonic. + --mnemonic-from-interactive-prompt + Input the mnemonic through an interactive prompt. + --signing-key-file FILEPATH + Output filepath of the signing key. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/key.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/key.cli index c47902f063..7d110f4c62 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/key.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/key.cli @@ -1,6 +1,8 @@ Usage: cardano-cli key ( verification-key | non-extended-key + | generate-mnemonic + | derive-from-mnemonic | convert-byron-key | convert-byron-genesis-vkey | convert-itn-key @@ -20,6 +22,12 @@ Available commands: non-extended-key Get a non-extended verification key from an extended verification key. This supports all extended key types. + generate-mnemonic Generate a mnemonic sentence that can be used for key + derivation. + derive-from-mnemonic Derive an extended signing key from a mnemonic + sentence. To ensure the safety of the mnemonic + phrase, we recommend that key derivation is performed + in an air-gapped environment. convert-byron-key Convert a Byron payment, genesis or genesis delegate key (signing or verification) to a corresponding Shelley-format key. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/key_derive-from-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/key_derive-from-mnemonic.cli new file mode 100644 index 0000000000..674a8de6c7 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/key_derive-from-mnemonic.cli @@ -0,0 +1,42 @@ +Usage: cardano-cli key derive-from-mnemonic [--key-output-format STRING] + ( --payment-key-with-number WORD32 + | --stake-key-with-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + +Available options: + --key-output-format STRING + Optional key output format. Accepted output formats + are "text-envelope" and "bech32" (default is + "text-envelope"). + --payment-key-with-number WORD32 + Derive an extended payment key with the given payment + address number from the derivation path. + --stake-key-with-number WORD32 + Derive an extended stake key with the given stake + address number from the derivation path. + --drep-key Derive an extended DRep key. + --cc-cold-key Derive an extended committee cold key. + --cc-hot-key Derive an extended committee hot key. + --account-number WORD32 Account number in the derivation path. + --mnemonic-from-file FILEPATH + Input text file with the mnemonic. + --mnemonic-from-interactive-prompt + Input the mnemonic through an interactive prompt. + This mode also accepts receiving the mnemonic through + standard input directly, for example, by using a + pipe. + --signing-key-file FILEPATH + Output filepath of the signing key. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/key_generate-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/key_generate-mnemonic.cli new file mode 100644 index 0000000000..b4c6babe43 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/key_generate-mnemonic.cli @@ -0,0 +1,10 @@ +Usage: cardano-cli key generate-mnemonic [--out-file FILEPATH] --size WORD32 + + Generate a mnemonic sentence that can be used for key derivation. + +Available options: + --out-file FILEPATH The output file. + --size WORD32 Specify the desired number of words for the + outputmnemonic sentence (valid options are: 12, 15, + 18, 21, and 24) + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/key_key-from-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/key_key-from-mnemonic.cli new file mode 100644 index 0000000000..1d3a5dad08 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/key_key-from-mnemonic.cli @@ -0,0 +1,41 @@ +Usage: cardano-cli key key-from-mnemonic [--key-output-format STRING] + ( --payment-key + --payment-address-number WORD32 + | --stake-key + --payment-address-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + +Available options: + --key-output-format STRING + Optional key output format. Accepted output formats + are "text-envelope" and "bech32" (default is + "text-envelope"). + --payment-key Derive an extended payment key. + --payment-address-number WORD32 + Payment address number in the derivation path. + --stake-key Derive an extended stake key. + --payment-address-number WORD32 + Payment address number in the derivation path. + --drep-key Derive an extended DRep key. + --cc-cold-key Derive an extended committee cold key. + --cc-hot-key Derive an extended committee hot key. + --account-number WORD32 Account number in the derivation path. + --mnemonic-from-file FILEPATH + Input text file with the mnemonic. + --mnemonic-from-interactive-prompt + Input the mnemonic through an interactive prompt. + --signing-key-file FILEPATH + Output filepath of the signing key. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_key.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_key.cli index aae3d2309b..8d035e6029 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_key.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_key.cli @@ -1,6 +1,8 @@ Usage: cardano-cli latest key ( verification-key | non-extended-key + | generate-mnemonic + | derive-from-mnemonic | convert-byron-key | convert-byron-genesis-vkey | convert-itn-key @@ -20,6 +22,12 @@ Available commands: non-extended-key Get a non-extended verification key from an extended verification key. This supports all extended key types. + generate-mnemonic Generate a mnemonic sentence that can be used for key + derivation. + derive-from-mnemonic Derive an extended signing key from a mnemonic + sentence. To ensure the safety of the mnemonic + phrase, we recommend that key derivation is performed + in an air-gapped environment. convert-byron-key Convert a Byron payment, genesis or genesis delegate key (signing or verification) to a corresponding Shelley-format key. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_key_derive-from-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_key_derive-from-mnemonic.cli new file mode 100644 index 0000000000..7f52f6005c --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_key_derive-from-mnemonic.cli @@ -0,0 +1,42 @@ +Usage: cardano-cli latest key derive-from-mnemonic [--key-output-format STRING] + ( --payment-key-with-number WORD32 + | --stake-key-with-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + +Available options: + --key-output-format STRING + Optional key output format. Accepted output formats + are "text-envelope" and "bech32" (default is + "text-envelope"). + --payment-key-with-number WORD32 + Derive an extended payment key with the given payment + address number from the derivation path. + --stake-key-with-number WORD32 + Derive an extended stake key with the given stake + address number from the derivation path. + --drep-key Derive an extended DRep key. + --cc-cold-key Derive an extended committee cold key. + --cc-hot-key Derive an extended committee hot key. + --account-number WORD32 Account number in the derivation path. + --mnemonic-from-file FILEPATH + Input text file with the mnemonic. + --mnemonic-from-interactive-prompt + Input the mnemonic through an interactive prompt. + This mode also accepts receiving the mnemonic through + standard input directly, for example, by using a + pipe. + --signing-key-file FILEPATH + Output filepath of the signing key. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_key_generate-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_key_generate-mnemonic.cli new file mode 100644 index 0000000000..cfc5c02f03 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_key_generate-mnemonic.cli @@ -0,0 +1,11 @@ +Usage: cardano-cli latest key generate-mnemonic [--out-file FILEPATH] + --size WORD32 + + Generate a mnemonic sentence that can be used for key derivation. + +Available options: + --out-file FILEPATH The output file. + --size WORD32 Specify the desired number of words for the + outputmnemonic sentence (valid options are: 12, 15, + 18, 21, and 24) + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_key_key-from-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_key_key-from-mnemonic.cli new file mode 100644 index 0000000000..5446e5a5f5 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_key_key-from-mnemonic.cli @@ -0,0 +1,41 @@ +Usage: cardano-cli latest key key-from-mnemonic [--key-output-format STRING] + ( --payment-key + --payment-address-number WORD32 + | --stake-key + --payment-address-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + +Available options: + --key-output-format STRING + Optional key output format. Accepted output formats + are "text-envelope" and "bech32" (default is + "text-envelope"). + --payment-key Derive an extended payment key. + --payment-address-number WORD32 + Payment address number in the derivation path. + --stake-key Derive an extended stake key. + --payment-address-number WORD32 + Payment address number in the derivation path. + --drep-key Derive an extended DRep key. + --cc-cold-key Derive an extended committee cold key. + --cc-hot-key Derive an extended committee hot key. + --account-number WORD32 Account number in the derivation path. + --mnemonic-from-file FILEPATH + Input text file with the mnemonic. + --mnemonic-from-interactive-prompt + Input the mnemonic through an interactive prompt. + --signing-key-file FILEPATH + Output filepath of the signing key. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_key.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_key.cli index 8dc24ca138..88ef5a27c9 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_key.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_key.cli @@ -1,6 +1,8 @@ Usage: cardano-cli mary key ( verification-key | non-extended-key + | generate-mnemonic + | derive-from-mnemonic | convert-byron-key | convert-byron-genesis-vkey | convert-itn-key @@ -20,6 +22,12 @@ Available commands: non-extended-key Get a non-extended verification key from an extended verification key. This supports all extended key types. + generate-mnemonic Generate a mnemonic sentence that can be used for key + derivation. + derive-from-mnemonic Derive an extended signing key from a mnemonic + sentence. To ensure the safety of the mnemonic + phrase, we recommend that key derivation is performed + in an air-gapped environment. convert-byron-key Convert a Byron payment, genesis or genesis delegate key (signing or verification) to a corresponding Shelley-format key. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_key_derive-from-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_key_derive-from-mnemonic.cli new file mode 100644 index 0000000000..733f74d363 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_key_derive-from-mnemonic.cli @@ -0,0 +1,42 @@ +Usage: cardano-cli mary key derive-from-mnemonic [--key-output-format STRING] + ( --payment-key-with-number WORD32 + | --stake-key-with-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + +Available options: + --key-output-format STRING + Optional key output format. Accepted output formats + are "text-envelope" and "bech32" (default is + "text-envelope"). + --payment-key-with-number WORD32 + Derive an extended payment key with the given payment + address number from the derivation path. + --stake-key-with-number WORD32 + Derive an extended stake key with the given stake + address number from the derivation path. + --drep-key Derive an extended DRep key. + --cc-cold-key Derive an extended committee cold key. + --cc-hot-key Derive an extended committee hot key. + --account-number WORD32 Account number in the derivation path. + --mnemonic-from-file FILEPATH + Input text file with the mnemonic. + --mnemonic-from-interactive-prompt + Input the mnemonic through an interactive prompt. + This mode also accepts receiving the mnemonic through + standard input directly, for example, by using a + pipe. + --signing-key-file FILEPATH + Output filepath of the signing key. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_key_generate-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_key_generate-mnemonic.cli new file mode 100644 index 0000000000..c0032281cb --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_key_generate-mnemonic.cli @@ -0,0 +1,11 @@ +Usage: cardano-cli mary key generate-mnemonic [--out-file FILEPATH] + --size WORD32 + + Generate a mnemonic sentence that can be used for key derivation. + +Available options: + --out-file FILEPATH The output file. + --size WORD32 Specify the desired number of words for the + outputmnemonic sentence (valid options are: 12, 15, + 18, 21, and 24) + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_key_key-from-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_key_key-from-mnemonic.cli new file mode 100644 index 0000000000..a52bc70385 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_key_key-from-mnemonic.cli @@ -0,0 +1,41 @@ +Usage: cardano-cli mary key key-from-mnemonic [--key-output-format STRING] + ( --payment-key + --payment-address-number WORD32 + | --stake-key + --payment-address-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + +Available options: + --key-output-format STRING + Optional key output format. Accepted output formats + are "text-envelope" and "bech32" (default is + "text-envelope"). + --payment-key Derive an extended payment key. + --payment-address-number WORD32 + Payment address number in the derivation path. + --stake-key Derive an extended stake key. + --payment-address-number WORD32 + Payment address number in the derivation path. + --drep-key Derive an extended DRep key. + --cc-cold-key Derive an extended committee cold key. + --cc-hot-key Derive an extended committee hot key. + --account-number WORD32 Account number in the derivation path. + --mnemonic-from-file FILEPATH + Input text file with the mnemonic. + --mnemonic-from-interactive-prompt + Input the mnemonic through an interactive prompt. + --signing-key-file FILEPATH + Output filepath of the signing key. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_key.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_key.cli index 1f6999a624..ba4b71e50b 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_key.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_key.cli @@ -1,6 +1,8 @@ Usage: cardano-cli shelley key ( verification-key | non-extended-key + | generate-mnemonic + | derive-from-mnemonic | convert-byron-key | convert-byron-genesis-vkey | convert-itn-key @@ -20,6 +22,12 @@ Available commands: non-extended-key Get a non-extended verification key from an extended verification key. This supports all extended key types. + generate-mnemonic Generate a mnemonic sentence that can be used for key + derivation. + derive-from-mnemonic Derive an extended signing key from a mnemonic + sentence. To ensure the safety of the mnemonic + phrase, we recommend that key derivation is performed + in an air-gapped environment. convert-byron-key Convert a Byron payment, genesis or genesis delegate key (signing or verification) to a corresponding Shelley-format key. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_key_derive-from-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_key_derive-from-mnemonic.cli new file mode 100644 index 0000000000..66b3583eeb --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_key_derive-from-mnemonic.cli @@ -0,0 +1,42 @@ +Usage: cardano-cli shelley key derive-from-mnemonic [--key-output-format STRING] + ( --payment-key-with-number WORD32 + | --stake-key-with-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + +Available options: + --key-output-format STRING + Optional key output format. Accepted output formats + are "text-envelope" and "bech32" (default is + "text-envelope"). + --payment-key-with-number WORD32 + Derive an extended payment key with the given payment + address number from the derivation path. + --stake-key-with-number WORD32 + Derive an extended stake key with the given stake + address number from the derivation path. + --drep-key Derive an extended DRep key. + --cc-cold-key Derive an extended committee cold key. + --cc-hot-key Derive an extended committee hot key. + --account-number WORD32 Account number in the derivation path. + --mnemonic-from-file FILEPATH + Input text file with the mnemonic. + --mnemonic-from-interactive-prompt + Input the mnemonic through an interactive prompt. + This mode also accepts receiving the mnemonic through + standard input directly, for example, by using a + pipe. + --signing-key-file FILEPATH + Output filepath of the signing key. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_key_generate-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_key_generate-mnemonic.cli new file mode 100644 index 0000000000..66169a4494 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_key_generate-mnemonic.cli @@ -0,0 +1,11 @@ +Usage: cardano-cli shelley key generate-mnemonic [--out-file FILEPATH] + --size WORD32 + + Generate a mnemonic sentence that can be used for key derivation. + +Available options: + --out-file FILEPATH The output file. + --size WORD32 Specify the desired number of words for the + outputmnemonic sentence (valid options are: 12, 15, + 18, 21, and 24) + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_key_key-from-mnemonic.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_key_key-from-mnemonic.cli new file mode 100644 index 0000000000..a5c0996a62 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_key_key-from-mnemonic.cli @@ -0,0 +1,41 @@ +Usage: cardano-cli shelley key key-from-mnemonic [--key-output-format STRING] + ( --payment-key + --payment-address-number WORD32 + | --stake-key + --payment-address-number WORD32 + | --drep-key + | --cc-cold-key + | --cc-hot-key + ) + --account-number WORD32 + ( --mnemonic-from-file FILEPATH + | --mnemonic-from-interactive-prompt + ) + --signing-key-file FILEPATH + + Derive an extended signing key from a mnemonic sentence. To ensure the safety + of the mnemonic phrase, we recommend that key derivation is performed in an + air-gapped environment. + +Available options: + --key-output-format STRING + Optional key output format. Accepted output formats + are "text-envelope" and "bech32" (default is + "text-envelope"). + --payment-key Derive an extended payment key. + --payment-address-number WORD32 + Payment address number in the derivation path. + --stake-key Derive an extended stake key. + --payment-address-number WORD32 + Payment address number in the derivation path. + --drep-key Derive an extended DRep key. + --cc-cold-key Derive an extended committee cold key. + --cc-hot-key Derive an extended committee hot key. + --account-number WORD32 Account number in the derivation path. + --mnemonic-from-file FILEPATH + Input text file with the mnemonic. + --mnemonic-from-interactive-prompt + Input the mnemonic through an interactive prompt. + --signing-key-file FILEPATH + Output filepath of the signing key. + -h,--help Show this help text