From 043022d117f8672b2dd198796f5e7124bbada7b7 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Wed, 6 Mar 2019 01:31:30 +0000 Subject: [PATCH] When verifying HTTP sig, make Ed25519 verification failure message clearer --- src/Vervis/Foundation.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Vervis/Foundation.hs b/src/Vervis/Foundation.hs index 290b655..7b30f25 100644 --- a/src/Vervis/Foundation.hs +++ b/src/Vervis/Foundation.hs @@ -879,7 +879,8 @@ instance YesodHttpSig App where ) Nothing -> fetched2vkd luKey <$> fetchUnknownKey manager sigAlgo host mluActorHeader luKey let verify' k = verify k input signature - errSig = throwE "Ed25519 sig verification says not valid" + errSig1 = throwE "Fetched fresh key; Ed25519 sig verification says not valid" + errSig2 = throwE "Used key from DB; Ed25519 sig verification says not valid; fetched fresh key; still not valid" errTime = throwE "Key expired" now <- liftIO getCurrentTime let stillValid Nothing = True @@ -892,7 +893,7 @@ instance YesodHttpSig App where else case inboxOrVkid of Left _uinb -> if stillValid $ vkdExpires vkd - then errSig + then errSig1 else errTime Right (iid, vkid) -> do let ua = vkdActorId vkd @@ -909,7 +910,7 @@ instance YesodHttpSig App where { vkdKey = newKey , vkdExpires = newExp } - else errSig + else errSig2 return $ l2f host $ vkdActorId vkd where