Revert "Set the test config server_name to localhost"

This reverts commit 7fa8ee0d1a.
This commit is contained in:
Brian Meek 2023-02-07 17:14:16 -08:00
parent 7fa8ee0d1a
commit a21b421156
3 changed files with 10 additions and 11 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,7 +117,13 @@ func (pk LoginPublicKeyEthereum) ValidateLoginResponse() (bool, *jsonerror.Matri
return false, jsonerror.InvalidParam("auth.message") return false, jsonerror.InvalidParam("auth.message")
} }
serverName := pk.config.Matrix.ServerName 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)(&serverName), nil, nil) _, err = message.Verify(pk.Signature, (*string)(&serverName), nil, nil)

View file

@ -27,7 +27,6 @@ import (
"github.com/matrix-org/dendrite/setup/config" "github.com/matrix-org/dendrite/setup/config"
testutil "github.com/matrix-org/dendrite/test" testutil "github.com/matrix-org/dendrite/test"
uapi "github.com/matrix-org/dendrite/userapi/api" uapi "github.com/matrix-org/dendrite/userapi/api"
"github.com/matrix-org/gomatrixserverlib"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
@ -38,10 +37,7 @@ type loginContext struct {
func createLoginContext(_ *testing.T) *loginContext { func createLoginContext(_ *testing.T) *loginContext {
cfg := &config.ClientAPI{ cfg := &config.ClientAPI{
Matrix: &config.Global{SigningIdentity: gomatrixserverlib.SigningIdentity{ Matrix: &config.Global{},
ServerName: gomatrixserverlib.ServerName("localhost"),
},
},
Derived: &config.Derived{}, Derived: &config.Derived{},
PasswordAuthenticationDisabled: true, PasswordAuthenticationDisabled: true,
PublicKeyAuthentication: config.PublicKeyAuthentication{ PublicKeyAuthentication: config.PublicKeyAuthentication{

View file

@ -29,7 +29,6 @@ import (
"github.com/matrix-org/dendrite/setup/config" "github.com/matrix-org/dendrite/setup/config"
testutil "github.com/matrix-org/dendrite/test" testutil "github.com/matrix-org/dendrite/test"
uapi "github.com/matrix-org/dendrite/userapi/api" uapi "github.com/matrix-org/dendrite/userapi/api"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/util" "github.com/matrix-org/util"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
@ -43,9 +42,7 @@ type registerContext struct {
func createRegisterContext(_ *testing.T) *registerContext { func createRegisterContext(_ *testing.T) *registerContext {
cfg := &config.ClientAPI{ cfg := &config.ClientAPI{
Matrix: &config.Global{SigningIdentity: gomatrixserverlib.SigningIdentity{ Matrix: &config.Global{},
ServerName: gomatrixserverlib.ServerName("localhost"),
}},
Derived: &config.Derived{}, Derived: &config.Derived{},
PasswordAuthenticationDisabled: true, PasswordAuthenticationDisabled: true,
PublicKeyAuthentication: config.PublicKeyAuthentication{ PublicKeyAuthentication: config.PublicKeyAuthentication{
@ -267,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")
fmt.Println(response.JSON)
registerRes := response.JSON.(registerResponse) registerRes := response.JSON.(registerResponse)
assert.Truef( assert.Truef(
registerRes.UserID == wallet.Eip155UserId, registerRes.UserID == wallet.Eip155UserId,