diff options
author | Joey Hess <joey@kitenet.net> | 2014-07-26 12:04:35 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-07-26 12:04:35 -0400 |
commit | abf47bf25aea42a96fffc4cd8ca4e3c9406d4fbd (patch) | |
tree | 46ab77ee730c4aab5618219bf34d07c88e1c74e5 /Remote/Helper/Encryptable.hs | |
parent | c3c63e48dfb3c981786bd3178e5f5689d3c60abf (diff) |
reorg
Diffstat (limited to 'Remote/Helper/Encryptable.hs')
-rw-r--r-- | Remote/Helper/Encryptable.hs | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/Remote/Helper/Encryptable.hs b/Remote/Helper/Encryptable.hs index 41174cf7c..c450a1084 100644 --- a/Remote/Helper/Encryptable.hs +++ b/Remote/Helper/Encryptable.hs @@ -80,28 +80,24 @@ encryptableRemote -> ((Cipher, Key) -> Key -> FilePath -> MeterUpdate -> Annex Bool) -> Remote -> Remote -encryptableRemote c storeKeyEncrypted retrieveKeyFileEncrypted r = - r { - storeKey = store, - retrieveKeyFile = retrieve, - retrieveKeyFileCheap = retrieveCheap, - removeKey = withkey $ removeKey r, - hasKey = withkey $ hasKey r, - cost = maybe - (cost r) - (const $ cost r + encryptedRemoteCostAdj) - (extractCipher c) - } - where - store k f p = cip k >>= maybe +encryptableRemote c storeKeyEncrypted retrieveKeyFileEncrypted r = r + { storeKey = \k f p -> cip k >>= maybe (storeKey r k f p) (\enck -> storeKeyEncrypted enck k p) - retrieve k f d p = cip k >>= maybe + , retrieveKeyFile = \k f d p -> cip k >>= maybe (retrieveKeyFile r k f d p) (\enck -> retrieveKeyFileEncrypted enck k d p) - retrieveCheap k d = cip k >>= maybe + , retrieveKeyFileCheap = \k d -> cip k >>= maybe (retrieveKeyFileCheap r k d) (\_ -> return False) + , removeKey = withkey $ removeKey r + , hasKey = withkey $ hasKey r + , cost = maybe + (cost r) + (const $ cost r + encryptedRemoteCostAdj) + (extractCipher c) + } + where withkey a k = cip k >>= maybe (a k) (a . snd) cip = cipherKey c |