aboutsummaryrefslogtreecommitdiff
path: root/keyserver/internal
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-07-28 18:25:16 +0100
committerGitHub <noreply@github.com>2020-07-28 18:25:16 +0100
commit9a5fb489c5f80148a8512e61c95c8df7bb46d314 (patch)
treee41adb86906181ca1946caa0c250af0ac00b842d /keyserver/internal
parentadf7b5929401f56bedba92ef778b5e56feefc479 (diff)
Add QueryKeyChanges (#1228)
Hook some things up to call it as well.
Diffstat (limited to 'keyserver/internal')
-rw-r--r--keyserver/internal/internal.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/keyserver/internal/internal.go b/keyserver/internal/internal.go
index d3a6d4ba..240a5640 100644
--- a/keyserver/internal/internal.go
+++ b/keyserver/internal/internal.go
@@ -40,6 +40,17 @@ type KeyInternalAPI struct {
Producer *producers.KeyChange
}
+func (a *KeyInternalAPI) QueryKeyChanges(ctx context.Context, req *api.QueryKeyChangesRequest, res *api.QueryKeyChangesResponse) {
+ userIDs, latest, err := a.DB.KeyChanges(ctx, req.Partition, req.Offset)
+ if err != nil {
+ res.Error = &api.KeyError{
+ Err: err.Error(),
+ }
+ }
+ res.Offset = latest
+ res.UserIDs = userIDs
+}
+
func (a *KeyInternalAPI) PerformUploadKeys(ctx context.Context, req *api.PerformUploadKeysRequest, res *api.PerformUploadKeysResponse) {
res.KeyErrors = make(map[string]map[string]*api.KeyError)
a.uploadDeviceKeys(ctx, req, res)