diff --git a/clientapi/auth/login_publickey_ethereum.go b/clientapi/auth/login_publickey_ethereum.go index 8849388ef..2ec11ed6b 100644 --- a/clientapi/auth/login_publickey_ethereum.go +++ b/clientapi/auth/login_publickey_ethereum.go @@ -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. diff --git a/clientapi/routing/register_publickey_test.go b/clientapi/routing/register_publickey_test.go index 19960ed22..352327b21 100644 --- a/clientapi/routing/register_publickey_test.go +++ b/clientapi/routing/register_publickey_test.go @@ -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,