diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-11-17 09:32:19 +0000 |
---|---|---|
committer | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-11-17 09:32:19 +0000 |
commit | 16325203af267685e2d664524a3e2976ca1a4bbf (patch) | |
tree | e956cbfb3ec5078ae5ed8fcb5c304af2cd363b33 /federationapi/routing/keys.go | |
parent | 607819f42507d6a3b18ef7c44f98ed8f862a7f78 (diff) |
Try that again
Diffstat (limited to 'federationapi/routing/keys.go')
-rw-r--r-- | federationapi/routing/keys.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/federationapi/routing/keys.go b/federationapi/routing/keys.go index b2ef1dba..ee25ffbb 100644 --- a/federationapi/routing/keys.go +++ b/federationapi/routing/keys.go @@ -159,12 +159,12 @@ loop: } } - identity, err := cfg.Matrix.SigningIdentityFor(serverName) - if err != nil { - identity, _ = cfg.Matrix.SigningIdentityFor(cfg.Matrix.ServerName) - } - - if identity.ServerName == serverName { + var identity *gomatrixserverlib.SigningIdentity + var err error + if virtualHost == nil { + if identity, err = cfg.Matrix.SigningIdentityFor(cfg.Matrix.ServerName); err != nil { + return nil, err + } publicKey := cfg.Matrix.PrivateKey.Public().(ed25519.PublicKey) keys.ServerName = cfg.Matrix.ServerName keys.ValidUntilTS = gomatrixserverlib.AsTimestamp(time.Now().Add(cfg.Matrix.KeyValidityPeriod)) @@ -183,6 +183,9 @@ loop: } } } else { + if identity, err = cfg.Matrix.SigningIdentityFor(virtualHost.ServerName); err != nil { + return nil, err + } publicKey := virtualHost.PrivateKey.Public().(ed25519.PublicKey) keys.ServerName = virtualHost.ServerName keys.ValidUntilTS = gomatrixserverlib.AsTimestamp(time.Now().Add(virtualHost.KeyValidityPeriod)) |