diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-11-16 09:16:07 +0000 |
---|---|---|
committer | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-11-16 09:16:07 +0000 |
commit | deddf686b9e9be236ca4e3cc265c7cfba38ed4ee (patch) | |
tree | 4cebc452edf49b6769f88a82b6831d700cdb6edc /federationapi/routing | |
parent | 9b8bb55430e658c8752c0b093416eed6d977cb0d (diff) |
Tweak `/key/v2/server`
Diffstat (limited to 'federationapi/routing')
-rw-r--r-- | federationapi/routing/keys.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/federationapi/routing/keys.go b/federationapi/routing/keys.go index 4fd3720f..693f5b9f 100644 --- a/federationapi/routing/keys.go +++ b/federationapi/routing/keys.go @@ -146,10 +146,10 @@ func localKeys(cfg *config.FederationAPI, serverName gomatrixserverlib.ServerNam var keys gomatrixserverlib.ServerKeys var virtualHost *config.VirtualHost for _, v := range cfg.Matrix.VirtualHosts { - if v.ServerName != serverName { - continue + if v.ServerName == serverName { + virtualHost = v + break } - virtualHost = v } if virtualHost == nil { @@ -188,14 +188,15 @@ func localKeys(cfg *config.FederationAPI, serverName gomatrixserverlib.ServerNam return nil, err } - keys.Raw, err = gomatrixserverlib.SignJSON( - string(serverName), cfg.Matrix.KeyID, cfg.Matrix.PrivateKey, toSign, - ) + identity, err := cfg.Matrix.SigningIdentityFor(serverName) if err != nil { return nil, err } - return &keys, nil + keys.Raw, err = gomatrixserverlib.SignJSON( + string(identity.ServerName), identity.KeyID, identity.PrivateKey, toSign, + ) + return &keys, err } func NotaryKeys( |