ircd:Ⓜ️:request: Throw more descriptive error for node key failure.

This commit is contained in:
Jason Volk 2022-06-30 14:16:26 -07:00
parent fe199a8ed0
commit 5a3346f973
1 changed files with 12 additions and 2 deletions

View File

@ -261,13 +261,23 @@ const
origin origin
}; };
bool verified{false}; bool attempted{false}, verified{false};
node_keys.get(key, [this, &verified, &sig] node_keys.get(key, [this, &attempted, &verified, &sig]
(const ed25519::pk &pk) (const ed25519::pk &pk)
{ {
attempted = true;
verified = verify(pk, sig); verified = verify(pk, sig);
}); });
if(!verified && !attempted)
throw m::error
{
http::UNAUTHORIZED, "M_UNVERIFIABLE_SIGNATURE",
"The X-Matrix Authorization key '%s' for '%s' could not be obtained.",
key,
origin,
};
return verified; return verified;
} }