diff --git a/clientapi/routing/routing.go b/clientapi/routing/routing.go index 47b8cb163..cfc6c47fb 100644 --- a/clientapi/routing/routing.go +++ b/clientapi/routing/routing.go @@ -896,7 +896,8 @@ func Setup( }), ).Methods(http.MethodGet, http.MethodOptions) - // Key Backup Versions + // Key Backup Versions (Metadata) + r0mux.Handle("/room_keys/version/{version}", httputil.MakeAuthAPI("get_backup_keys_version", userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse { vars, err := httputil.URLDecodeMapValues(mux.Vars(req)) @@ -935,7 +936,8 @@ func Setup( }), ).Methods(http.MethodPost, http.MethodOptions) - // E2E Backup Keys + // Inserting E2E Backup Keys + // Bulk room and session r0mux.Handle("/room_keys/keys", httputil.MakeAuthAPI("put_backup_keys", userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse { @@ -1022,6 +1024,8 @@ func Setup( }), ).Methods(http.MethodPut) + // Querying E2E Backup Keys + r0mux.Handle("/room_keys/keys", httputil.MakeAuthAPI("get_backup_keys", userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse { return GetBackupKeys(req, userAPI, device, req.URL.Query().Get("version"), "", "") @@ -1046,6 +1050,8 @@ func Setup( }), ).Methods(http.MethodGet, http.MethodOptions) + // Deleting E2E Backup Keys + // Supplying a device ID is deprecated. r0mux.Handle("/keys/upload/{deviceID}", httputil.MakeAuthAPI("keys_upload", userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse { diff --git a/userapi/internal/api.go b/userapi/internal/api.go index cd760e41c..a2bc8ecf5 100644 --- a/userapi/internal/api.go +++ b/userapi/internal/api.go @@ -539,8 +539,10 @@ func (a *UserInternalAPI) QueryKeyBackup(ctx context.Context, req *api.QueryKeyB res.Exists = !deleted if !req.ReturnKeys { - // TODO return the counts res.Count, err = a.AccountDB.CountBackupKeys(ctx, version, req.UserID) + if err != nil { + res.Error = fmt.Sprintf("failed to count keys: %s", err) + } return }