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

Signed-off-by: Brian Meek <brian@hntlabs.com>
This commit is contained in:
Brian Meek 2023-02-07 16:28:29 -08:00
parent c8f8e90446
commit d179b9f6f7
2 changed files with 11 additions and 3 deletions

View file

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

View file

@ -264,7 +264,6 @@ func TestRegisterEthereum(t *testing.T) {
// Asserts // Asserts
assert := assert.New(t) assert := assert.New(t)
assert.NotNil(response, "response actual: nil, expected: not nil") 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) registerRes := response.JSON.(registerResponse)
assert.Truef( assert.Truef(
registerRes.UserID == wallet.Eip155UserId, registerRes.UserID == wallet.Eip155UserId,