refactoring

This commit is contained in:
Joey Hess 2025-02-27 14:54:03 -04:00
parent 9c2c3002a6
commit 1704b5e327
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 25 additions and 14 deletions

View file

@ -30,7 +30,7 @@ import Annex.SpecialRemote.Config
import Logs.Remote
import Logs.EquivilantKeys
import Backend
import Backend.VURL.Utilities (generateEquivilantKey)
import Backend.VURL.Utilities (recordVurlKey)
import qualified Data.Map as M
@ -169,18 +169,11 @@ downloadKey urlincludeexclude key _af dest p vc =
| otherwise = return (Just v)
recordvurlkey eks = do
-- Make sure to pick a backend that is cryptographically
-- secure.
db <- defaultBackend
let b = if isCryptographicallySecure db
then db
else defaultHashBackend
generateEquivilantKey b dest >>= \case
Nothing -> return Nothing
Just ek -> do
unless (ek `elem` eks) $
setEquivilantKey key ek
return (Just Verified)
b <- hashBackend
ifM (recordVurlKey b dest key eks)
( return (Just Verified)
, return Nothing
)
uploadKey :: Key -> AssociatedFile -> Maybe OsPath -> MeterUpdate -> Annex ()
uploadKey _ _ _ _ = giveup "upload to web not supported"