aboutsummaryrefslogtreecommitdiff
path: root/userapi/internal/api.go
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-07-22 17:04:57 +0100
committerGitHub <noreply@github.com>2020-07-22 17:04:57 +0100
commit541a23f712a1cff2e8ba0ada41ceff90e86ee42d (patch)
tree1fdacfd2b7479dd6a075bb5680b372f9b7939b59 /userapi/internal/api.go
parent1e71fd645ed9bbac87627434b303659a195512c7 (diff)
Handle inbound federation E2E key queries/claims (#1215)
* Handle inbound /keys/claim and /keys/query requests * Add display names to device key responses * Linting
Diffstat (limited to 'userapi/internal/api.go')
-rw-r--r--userapi/internal/api.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/userapi/internal/api.go b/userapi/internal/api.go
index 1d10d1d8..2de8f960 100644
--- a/userapi/internal/api.go
+++ b/userapi/internal/api.go
@@ -125,6 +125,27 @@ func (a *UserInternalAPI) QueryProfile(ctx context.Context, req *api.QueryProfil
return nil
}
+func (a *UserInternalAPI) QueryDeviceInfos(ctx context.Context, req *api.QueryDeviceInfosRequest, res *api.QueryDeviceInfosResponse) error {
+ devices, err := a.DeviceDB.GetDevicesByID(ctx, req.DeviceIDs)
+ if err != nil {
+ return err
+ }
+ res.DeviceInfo = make(map[string]struct {
+ DisplayName string
+ UserID string
+ })
+ for _, d := range devices {
+ res.DeviceInfo[d.ID] = struct {
+ DisplayName string
+ UserID string
+ }{
+ DisplayName: d.DisplayName,
+ UserID: d.UserID,
+ }
+ }
+ return nil
+}
+
func (a *UserInternalAPI) QueryDevices(ctx context.Context, req *api.QueryDevicesRequest, res *api.QueryDevicesResponse) error {
local, domain, err := gomatrixserverlib.SplitID('@', req.UserID)
if err != nil {