Sign the invite properly

This commit is contained in:
Neil Alexander 2022-11-14 14:41:45 +00:00
parent ef960f6982
commit b8d1f58f21
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -147,7 +147,8 @@ func processInvite(
}
}
if _, domain, err := cfg.Matrix.SplitLocalID('@', *event.StateKey()); err != nil {
_, domain, err := cfg.Matrix.SplitLocalID('@', *event.StateKey())
if err != nil {
return util.JSONResponse{
Code: http.StatusBadRequest,
JSON: jsonerror.InvalidArgumentValue(fmt.Sprintf("The user ID is invalid or domain %q does not belong to this server", domain)),
@ -189,7 +190,7 @@ func processInvite(
// Sign the event so that other servers will know that we have received the invite.
signedEvent := event.Sign(
string(cfg.Matrix.ServerName), cfg.Matrix.KeyID, cfg.Matrix.PrivateKey,
string(domain), cfg.Matrix.KeyID, cfg.Matrix.PrivateKey,
)
// Add the invite event to the roomserver.