From f8d481f25a687d0dc6258da930cd191ce10b0a99 Mon Sep 17 00:00:00 2001 From: Till Faelligen Date: Sun, 22 Aug 2021 18:44:08 +0200 Subject: [PATCH] Add missing performKeyBackup endpoint --- userapi/inthttp/server.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/userapi/inthttp/server.go b/userapi/inthttp/server.go index b5db2928..61f85318 100644 --- a/userapi/inthttp/server.go +++ b/userapi/inthttp/server.go @@ -249,4 +249,18 @@ func AddRoutes(internalAPIMux *mux.Router, s api.UserInternalAPI) { return util.JSONResponse{Code: http.StatusOK, JSON: &response} }), ) + internalAPIMux.Handle(PerformKeyBackupPath, + httputil.MakeInternalAPI("performKeyBackup", func(req *http.Request) util.JSONResponse { + request := api.PerformKeyBackupRequest{} + response := api.PerformKeyBackupResponse{} + if err := json.NewDecoder(req.Body).Decode(&request); err != nil { + return util.MessageResponse(http.StatusBadRequest, err.Error()) + } + s.PerformKeyBackup(req.Context(), &request, &response) + if response.Error != "" { + return util.ErrorResponse(fmt.Errorf("PerformKeyBackup: %s", response.Error)) + } + return util.JSONResponse{Code: http.StatusOK, JSON: &response} + }), + ) }