aboutsummaryrefslogtreecommitdiff
path: root/federationapi
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-09-25 10:58:53 +0100
committerGitHub <noreply@github.com>2020-09-25 10:58:53 +0100
commit145db37d8998a2e17c4c5afb2512243ac3bd6c9a (patch)
treea5e872a43b15f938bcba0f0a261b500e5ed105fb /federationapi
parent6fbf89a166057d657b3fb742efdfccbedbfc8436 (diff)
Allow configuring old verify keys (#1443)
* Allow configuring old verify keys * Update sample config * Update sample config * Fix config population * Key ID formatting validity of old_verify_keys * Update comment
Diffstat (limited to 'federationapi')
-rw-r--r--federationapi/routing/keys.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/federationapi/routing/keys.go b/federationapi/routing/keys.go
index 785be090..17762b03 100644
--- a/federationapi/routing/keys.go
+++ b/federationapi/routing/keys.go
@@ -136,6 +136,8 @@ func localKeys(cfg *config.FederationAPI, validUntil time.Time) (*gomatrixserver
var keys gomatrixserverlib.ServerKeys
keys.ServerName = cfg.Matrix.ServerName
+ keys.TLSFingerprints = cfg.TLSFingerPrints
+ keys.ValidUntilTS = gomatrixserverlib.AsTimestamp(validUntil)
publicKey := cfg.Matrix.PrivateKey.Public().(ed25519.PublicKey)
@@ -145,9 +147,15 @@ func localKeys(cfg *config.FederationAPI, validUntil time.Time) (*gomatrixserver
},
}
- keys.TLSFingerprints = cfg.TLSFingerPrints
keys.OldVerifyKeys = map[gomatrixserverlib.KeyID]gomatrixserverlib.OldVerifyKey{}
- keys.ValidUntilTS = gomatrixserverlib.AsTimestamp(validUntil)
+ for _, oldVerifyKey := range cfg.Matrix.OldVerifyKeys {
+ keys.OldVerifyKeys[oldVerifyKey.KeyID] = gomatrixserverlib.OldVerifyKey{
+ VerifyKey: gomatrixserverlib.VerifyKey{
+ Key: gomatrixserverlib.Base64Bytes(oldVerifyKey.PrivateKey),
+ },
+ ExpiredTS: oldVerifyKey.ExpiredAt,
+ }
+ }
toSign, err := json.Marshal(keys.ServerKeyFields)
if err != nil {