diff options
Diffstat (limited to 'Remote/Helper')
-rw-r--r-- | Remote/Helper/Chunked.hs | 5 | ||||
-rw-r--r-- | Remote/Helper/Encryptable.hs | 7 |
2 files changed, 5 insertions, 7 deletions
diff --git a/Remote/Helper/Chunked.hs b/Remote/Helper/Chunked.hs index 4f04a1c38..04bde4c29 100644 --- a/Remote/Helper/Chunked.hs +++ b/Remote/Helper/Chunked.hs @@ -20,9 +20,8 @@ import qualified Control.Exception as E type ChunkSize = Maybe Int64 {- Gets a remote's configured chunk size. -} -chunkSize :: Maybe RemoteConfig -> ChunkSize -chunkSize Nothing = Nothing -chunkSize (Just m) = +chunkSize :: RemoteConfig -> ChunkSize +chunkSize m = case M.lookup "chunksize" m of Nothing -> Nothing Just v -> case readSize dataUnits v of diff --git a/Remote/Helper/Encryptable.hs b/Remote/Helper/Encryptable.hs index 05aca9a41..d322a5cf8 100644 --- a/Remote/Helper/Encryptable.hs +++ b/Remote/Helper/Encryptable.hs @@ -44,7 +44,7 @@ encryptionSetup c = case (M.lookup "encryption" c, extractCipher c) of - Two additional functions must be provided by the remote, - to support storing and retrieving encrypted content. -} encryptableRemote - :: Maybe RemoteConfig + :: RemoteConfig -> ((Cipher, Key) -> Key -> MeterUpdate -> Annex Bool) -> ((Cipher, Key) -> Key -> FilePath -> Annex Bool) -> Remote @@ -103,9 +103,8 @@ embedCreds c | otherwise = False {- Gets encryption Cipher, and encrypted version of Key. -} -cipherKey :: Maybe RemoteConfig -> Key -> Annex (Maybe (Cipher, Key)) -cipherKey Nothing _ = return Nothing -cipherKey (Just c) k = maybe Nothing make <$> remoteCipher c +cipherKey :: RemoteConfig -> Key -> Annex (Maybe (Cipher, Key)) +cipherKey c k = maybe Nothing make <$> remoteCipher c where make ciphertext = Just (ciphertext, encryptKey ciphertext k) |