summaryrefslogtreecommitdiffhomepage
path: root/keysafe.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-08-17 18:56:05 -0400
committerJoey Hess <joeyh@joeyh.name>2016-08-17 18:56:05 -0400
commit14ca9ca78ff2ec55b5f353fe101562830a8dd9d7 (patch)
tree303aa7b4308037fbcc8854474bdd5fd3463338cc /keysafe.hs
parentc394b41a2ffb7e987864fa64fd583017c717703b (diff)
downloadkeysafe-14ca9ca78ff2ec55b5f353fe101562830a8dd9d7.tar.gz
obscure name
Diffstat (limited to 'keysafe.hs')
-rw-r--r--keysafe.hs64
1 files changed, 49 insertions, 15 deletions
diff --git a/keysafe.hs b/keysafe.hs
index bb6d766..2ac765f 100644
--- a/keysafe.hs
+++ b/keysafe.hs
@@ -66,9 +66,13 @@ dispatch cmdline ui tunables possibletunables = do
backup :: Storage -> UI -> Tunables -> SecretKeySource -> SecretKey -> IO ()
backup storage ui tunables secretkeysource secretkey = do
username <- userName
- name <- fromMaybe (error "Aborting on no name")
- <$> promptName ui "Enter name"
- namedesc username validateName
+ Name theirname <- fromMaybe (error "Aborting on no username")
+ <$> promptName ui "Enter your name"
+ usernamedesc (Just username) validateName
+ Name othername <- fromMaybe (error "aborting on no othername")
+ <$> promptName ui "Enter other name"
+ othernamedesc Nothing validateName
+ let name = Name (theirname <> " " <> othername)
kek <- promptkek name
let sis = shardIdents tunables name secretkeysource
let cost = getCreationCost kek <> getCreationCost sis
@@ -115,14 +119,26 @@ backup storage ui tunables secretkeysource secretkey = do
then return kek
else promptkek name
namewords (Name nb) = words (BU8.toString nb)
- namedesc = unlines
- [ "To back up your secret key, you will need to enter a name and a password."
+ keydesc = case secretkeysource of
+ GpgKey _ -> "gpg secret key"
+ KeyFile _ -> "secret key"
+ usernamedesc = unlines
+ [ "Keysafe is going to backup your " ++ keydesc ++ " securely."
+ , ""
+ , "You will be prompted for some information. To restore your " ++ keydesc
+ , "at a later date, you will need to remember and enter the same information."
+ , ""
+ , "To get started, what is your name?"
+ ]
+ othernamedesc = unlines
+ [ "Now think of another name, which not many people know."
+ , "This will be used to make it hard for anyone else to find"
+ , "the backup of your " ++ keydesc ++ "."
, ""
- , "Make sure to pick a name you will remember at some point in the future,"
- , "perhaps years from now, when you will need to enter it with the same"
- , "spelling and capitalization in order to restore your secret key."
+ , "Some suggestions:"
+ , otherNameSuggestions
, ""
- , "(Your own full name is a pretty good choice for the name to enter here.)"
+ , "Make sure to pick a name you will remember later."
]
passworddesc = unlines
[ "Pick a password that will be used to protect your secret key."
@@ -144,12 +160,24 @@ backup storage ui tunables secretkeysource secretkey = do
, "Please wait..."
]
+otherNameSuggestions :: String
+otherNameSuggestions = unlines $ map (" * " ++)
+ [ "Your high-school sweetheart."
+ , "Your first pet."
+ , "Your favorite teacher."
+ , "Your college roomate."
+ ]
+
restore :: Storage -> UI -> [Tunables] -> SecretKeySource -> IO ()
restore storage ui possibletunables secretkeydest = do
username <- userName
- name <- fromMaybe (error "Aborting on no name")
- <$> promptName ui "Enter name"
- namedesc username validateName
+ Name theirname <- fromMaybe (error "Aborting on no username")
+ <$> promptName ui "Enter your name"
+ namedesc (Just username) validateName
+ Name othername <- fromMaybe (error "aborting on no othername")
+ <$> promptName ui "Enter other name"
+ othernamedesc Nothing validateName
+ let name = Name (theirname <> " " <> othername)
password <- fromMaybe (error "Aborting on no password")
<$> promptPassword ui True "Enter password" passworddesc
@@ -171,10 +199,16 @@ restore storage ui possibletunables secretkeydest = do
showInfo ui "Success" "Your secret key successfully restored!"
where
namedesc = unlines
- [ "When you backed up your secret key, you entered a name and a password."
- , "Now it's time to remember what you entered back then."
+ [ "When you backed up your secret key, you entered some information."
+ , "To restore it, you'll need to remember what you entered back then."
+ , ""
+ , "To get started, what is your name?"
+ ]
+ othernamedesc = unlines
+ [ "What other name did you enter when you backed up your secret key?"
, ""
- , "(If you can't remember the name you used, your own full name is the best guess.)"
+ , "Back then, you were given some suggestions, like these:"
+ , otherNameSuggestions
]
passworddesc = unlines
[ "Enter the password to unlock your secret key."