mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-29 00:04:52 +09:00
When verifying HTTP sig, make Ed25519 verification failure message clearer
This commit is contained in:
parent
c26289cf42
commit
043022d117
1 changed files with 4 additions and 3 deletions
|
@ -879,7 +879,8 @@ instance YesodHttpSig App where
|
||||||
)
|
)
|
||||||
Nothing -> fetched2vkd luKey <$> fetchUnknownKey manager sigAlgo host mluActorHeader luKey
|
Nothing -> fetched2vkd luKey <$> fetchUnknownKey manager sigAlgo host mluActorHeader luKey
|
||||||
let verify' k = verify k input signature
|
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"
|
errTime = throwE "Key expired"
|
||||||
now <- liftIO getCurrentTime
|
now <- liftIO getCurrentTime
|
||||||
let stillValid Nothing = True
|
let stillValid Nothing = True
|
||||||
|
@ -892,7 +893,7 @@ instance YesodHttpSig App where
|
||||||
else case inboxOrVkid of
|
else case inboxOrVkid of
|
||||||
Left _uinb ->
|
Left _uinb ->
|
||||||
if stillValid $ vkdExpires vkd
|
if stillValid $ vkdExpires vkd
|
||||||
then errSig
|
then errSig1
|
||||||
else errTime
|
else errTime
|
||||||
Right (iid, vkid) -> do
|
Right (iid, vkid) -> do
|
||||||
let ua = vkdActorId vkd
|
let ua = vkdActorId vkd
|
||||||
|
@ -909,7 +910,7 @@ instance YesodHttpSig App where
|
||||||
{ vkdKey = newKey
|
{ vkdKey = newKey
|
||||||
, vkdExpires = newExp
|
, vkdExpires = newExp
|
||||||
}
|
}
|
||||||
else errSig
|
else errSig2
|
||||||
|
|
||||||
return $ l2f host $ vkdActorId vkd
|
return $ l2f host $ vkdActorId vkd
|
||||||
where
|
where
|
||||||
|
|
Loading…
Reference in a new issue