add descriptions for all remote config fields

not yet used
This commit is contained in:
Joey Hess 2020-01-20 15:20:04 -04:00
parent 201049cf93
commit 7038acf96c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
20 changed files with 141 additions and 48 deletions

View file

@ -15,6 +15,7 @@ module Types.Crypto (
Mac(..),
readMac,
showMac,
macMap,
defaultMac,
calcMac,
) where
@ -23,6 +24,7 @@ import Utility.Hash
import Utility.Gpg (KeyIds(..))
import Data.Typeable
import qualified Data.Map as M
data EncryptionMethod
= NoneEncryption
@ -61,9 +63,13 @@ showMac HmacSha512 = "HMACSHA512"
-- Read the MAC algorithm from the remote config.
readMac :: String -> Maybe Mac
readMac "HMACSHA1" = Just HmacSha1
readMac "HMACSHA224" = Just HmacSha224
readMac "HMACSHA256" = Just HmacSha256
readMac "HMACSHA384" = Just HmacSha384
readMac "HMACSHA512" = Just HmacSha512
readMac _ = Nothing
readMac n = M.lookup n macMap
macMap :: M.Map String Mac
macMap = M.fromList
[ ("HMACSHA1", HmacSha1)
, ("HMACSHA224", HmacSha224)
, ("HMACSHA256", HmacSha256)
, ("HMACSHA384", HmacSha384)
, ("HMACSHA512", HmacSha512)
]