From c5f9bb685caf562875aac9691be7fd981d5bc145 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 10 Jun 2020 10:36:53 +0100 Subject: [PATCH] Use ServerKeyAPI as keyring --- serverkeyapi/internal/api.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/serverkeyapi/internal/api.go b/serverkeyapi/internal/api.go index 176983c86..d40f58ba9 100644 --- a/serverkeyapi/internal/api.go +++ b/serverkeyapi/internal/api.go @@ -17,9 +17,13 @@ type ServerKeyAPI struct { } func (s *ServerKeyAPI) KeyRing() *gomatrixserverlib.KeyRing { - // Return a real keyring - one that has the real database and real - // fetchers. - return &s.OurKeyRing + // Return a keyring that forces requests to be proxied through the + // below functions. That way we can enforce things like validity + // and keeping the cache up-to-date. + return &gomatrixserverlib.KeyRing{ + KeyDatabase: s, + KeyFetchers: []gomatrixserverlib.KeyFetcher{s}, + } } func (s *ServerKeyAPI) StoreKeys(