Skip to content

Commit f4eebb1

Browse files
authored
Use a different key ID for each complement server (#486)
Some tests may choose to re-use the same homeserver deployment across multiple test cases, each spinning up different complement servers. However, when a complement server happens to have the same hostname and port as a previous one, the homeserver under test may retain cached keys for the old complement server and reject events from the new one. Give each complement server a unique key ID to stop that from happening.
1 parent 9cbfa08 commit f4eebb1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/federation/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ type Server struct {
5757
// NewServer creates a new federation server with configured options.
5858
func NewServer(t *testing.T, deployment *docker.Deployment, opts ...func(*Server)) *Server {
5959
// generate signing key
60-
_, priv, err := ed25519.GenerateKey(nil)
60+
pub, priv, err := ed25519.GenerateKey(nil)
6161
if err != nil {
6262
t.Fatalf("federation.NewServer failed to generate ed25519 key: %s", err)
6363
}
6464

6565
srv := &Server{
6666
t: t,
6767
Priv: priv,
68-
KeyID: "ed25519:complement",
68+
KeyID: gomatrixserverlib.KeyID(fmt.Sprintf("ed25519:complement_%x", pub)),
6969
mux: mux.NewRouter(),
7070
// The server name will be updated when the caller calls Listen() to include the port number
7171
// of the HTTP server e.g "host.docker.internal:56353"

0 commit comments

Comments
 (0)