Revert "HArdcoding the server_name while debugging while it isn't loading from the config"

This reverts commit d179b9f6f7.
This commit is contained in:
Brian Meek 2023-02-07 17:14:16 -08:00
parent a21b421156
commit a610e6d043
2 changed files with 3 additions and 11 deletions

View file

@ -25,7 +25,6 @@ import (
"github.com/matrix-org/dendrite/clientapi/userutil"
"github.com/matrix-org/dendrite/setup/config"
userapi "github.com/matrix-org/dendrite/userapi/api"
"github.com/matrix-org/gomatrixserverlib"
"github.com/spruceid/siwe-go"
)
@ -117,18 +116,10 @@ func (pk LoginPublicKeyEthereum) ValidateLoginResponse() (bool, *jsonerror.Matri
return false, jsonerror.InvalidParam("auth.message")
}
cfg := &config.Global{
SigningIdentity: gomatrixserverlib.SigningIdentity{
ServerName: gomatrixserverlib.ServerName("localhost"),
},
}
serverName := cfg.ServerName
// Check signature to verify message was not tempered
_, err = message.Verify(pk.Signature, (*string)(&serverName), nil, nil)
_, err = message.Verify(pk.Signature, (*string)(&pk.config.Matrix.ServerName), nil, nil)
if err != nil {
return false, jsonerror.InvalidSignature(err.Error() + " signature:" + pk.Signature + " server_name:" + string(serverName) + " messageDomain:" + message.GetDomain())
return false, jsonerror.InvalidSignature(err.Error() + " signature:" + pk.Signature + " server_name:" + string(pk.config.Matrix.ServerName) + " messageDomain:" + message.GetDomain())
}
// Error if the user ID does not match the signed message.

View file

@ -264,6 +264,7 @@ func TestRegisterEthereum(t *testing.T) {
// Asserts
assert := assert.New(t)
assert.NotNil(response, "response actual: nil, expected: not nil")
assert.Implements((*registerResponse)(nil), response.JSON, "response.JSON received: %v", response.JSON)
registerRes := response.JSON.(registerResponse)
assert.Truef(
registerRes.UserID == wallet.Eip155UserId,