diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2020-09-22 14:40:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-22 14:40:54 +0100 |
commit | a14b29b52617c06a548145a18b4d7cee6e529b79 (patch) | |
tree | 813e96e05884248ac97959d64b0458eba69e0665 /federationsender/internal/api.go | |
parent | a7563ede3d61efa626095b8b9069af9f16e7dd3d (diff) |
Initial notary support (#1436)
* Initial work on notary support
* Somewhat working (but not properly filtered) notary support, other tweaks
* Update gomatrixserverlib
Diffstat (limited to 'federationsender/internal/api.go')
-rw-r--r-- | federationsender/internal/api.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/federationsender/internal/api.go b/federationsender/internal/api.go index 49c53755..f9d35357 100644 --- a/federationsender/internal/api.go +++ b/federationsender/internal/api.go @@ -189,3 +189,27 @@ func (a *FederationSenderInternalAPI) GetEvent( } return ires.(gomatrixserverlib.Transaction), nil } + +func (a *FederationSenderInternalAPI) GetServerKeys( + ctx context.Context, s gomatrixserverlib.ServerName, +) (gomatrixserverlib.ServerKeys, error) { + ires, err := a.doRequest(s, func() (interface{}, error) { + return a.federation.GetServerKeys(ctx, s) + }) + if err != nil { + return gomatrixserverlib.ServerKeys{}, err + } + return ires.(gomatrixserverlib.ServerKeys), nil +} + +func (a *FederationSenderInternalAPI) LookupServerKeys( + ctx context.Context, s gomatrixserverlib.ServerName, keyRequests map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.Timestamp, +) ([]gomatrixserverlib.ServerKeys, error) { + ires, err := a.doRequest(s, func() (interface{}, error) { + return a.federation.LookupServerKeys(ctx, s, keyRequests) + }) + if err != nil { + return []gomatrixserverlib.ServerKeys{}, err + } + return ires.([]gomatrixserverlib.ServerKeys), nil +} |