summaryrefslogtreecommitdiff
path: root/Remote/Helper/Encryptable.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-05-11 16:09:39 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-05-11 16:09:39 -0400
commit1b030931d6ac9dd34a9a67483adb6037c23b5ff2 (patch)
tree34d32d58a101de865ea771081ae36c0ea651b5e1 /Remote/Helper/Encryptable.hs
parent716e10dce7aa55b01dbeb14b34bb0b00bce6eb18 (diff)
Change git annex info remote encryption description to use wording closer to what's used in initremote.
Diffstat (limited to 'Remote/Helper/Encryptable.hs')
-rw-r--r--Remote/Helper/Encryptable.hs30
1 files changed, 13 insertions, 17 deletions
diff --git a/Remote/Helper/Encryptable.hs b/Remote/Helper/Encryptable.hs
index 46ce57dc1..5ea4f1090 100644
--- a/Remote/Helper/Encryptable.hs
+++ b/Remote/Helper/Encryptable.hs
@@ -87,7 +87,7 @@ encryptionSetup c = do
use m a = do
showNote m
cipher <- liftIO a
- mapM_ showNote (describeCipher cipher)
+ showNote (describeCipher cipher)
return (storeCipher cipher c', EncryptionIsSetup)
highRandomQuality =
(&&) (maybe True ( /= "false") $ M.lookup "highRandomQuality" c)
@@ -169,24 +169,20 @@ extractCipher c = case (M.lookup "cipher" c,
describeEncryption :: RemoteConfig -> String
describeEncryption c = case extractCipher c of
- Nothing -> "not encrypted"
- Just cip -> "encrypted " ++ unwords (map paren (describeCipher cip))
- where
- paren s = "(" ++ s ++ ")"
+ Nothing -> "none"
+ Just cip -> nameCipher cip ++ " (" ++ describeCipher cip ++ ")"
+
+nameCipher :: StorableCipher -> String
+nameCipher (SharedCipher _) = "shared"
+nameCipher (EncryptedCipher _ PubKey _) = "pubkey"
+nameCipher (EncryptedCipher _ Hybrid _) = "hybrid"
+nameCipher (SharedPubKeyCipher _ _) = "sharedpubkey"
-describeCipher :: StorableCipher -> [String]
+describeCipher :: StorableCipher -> String
describeCipher c = case c of
- (SharedCipher _) -> ["encryption key stored in git repository"]
- (EncryptedCipher _ v ks) -> catMaybes
- [ Just $ showkeys ks
- , case v of
- PubKey -> Nothing
- Hybrid -> Just "hybrid mode"
- ]
- (SharedPubKeyCipher _ ks) ->
- [ showkeys ks
- , "shared cipher"
- ]
+ (SharedCipher _) -> "encryption key stored in git repository"
+ (EncryptedCipher _ _ ks) -> showkeys ks
+ (SharedPubKeyCipher _ ks) -> showkeys ks
where
showkeys (KeyIds { keyIds = ks }) = "to gpg keys: " ++ unwords ks