aboutsummaryrefslogtreecommitdiff
path: root/userapi/inthttp
diff options
context:
space:
mode:
authorkegsay <kegan@matrix.org>2021-07-27 12:47:32 +0100
committerGitHub <noreply@github.com>2021-07-27 12:47:32 +0100
commit32538640db6bfbdb890729e8137151ffbbec9a28 (patch)
treebcd98d8b0d977058492fce03d69f43cc3a41be51 /userapi/inthttp
parente3679799ea6f6387d36fb1a2f938f8ea9711ad2d (diff)
Key backups (1/2) : Add E2E session backup metadata tables (#1943)
* Initial key backup paths and userapi API * Fix unit tests * Add key backup table * Glue REST API to database * Linting * use writer on sqlite
Diffstat (limited to 'userapi/inthttp')
-rw-r--r--userapi/inthttp/client.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/userapi/inthttp/client.go b/userapi/inthttp/client.go
index 1cb5ef0a..a89d1a26 100644
--- a/userapi/inthttp/client.go
+++ b/userapi/inthttp/client.go
@@ -36,7 +36,9 @@ const (
PerformDeviceUpdatePath = "/userapi/performDeviceUpdate"
PerformAccountDeactivationPath = "/userapi/performAccountDeactivation"
PerformOpenIDTokenCreationPath = "/userapi/performOpenIDTokenCreation"
+ PerformKeyBackupPath = "/userapi/performKeyBackup"
+ QueryKeyBackupPath = "/userapi/queryKeyBackup"
QueryProfilePath = "/userapi/queryProfile"
QueryAccessTokenPath = "/userapi/queryAccessToken"
QueryDevicesPath = "/userapi/queryDevices"
@@ -225,3 +227,24 @@ func (h *httpUserInternalAPI) QueryOpenIDToken(ctx context.Context, req *api.Que
apiURL := h.apiURL + QueryOpenIDTokenPath
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, req, res)
}
+
+func (h *httpUserInternalAPI) PerformKeyBackup(ctx context.Context, req *api.PerformKeyBackupRequest, res *api.PerformKeyBackupResponse) {
+ span, ctx := opentracing.StartSpanFromContext(ctx, "PerformKeyBackup")
+ defer span.Finish()
+
+ apiURL := h.apiURL + PerformKeyBackupPath
+ err := httputil.PostJSON(ctx, span, h.httpClient, apiURL, req, res)
+ if err != nil {
+ res.Error = err.Error()
+ }
+}
+func (h *httpUserInternalAPI) QueryKeyBackup(ctx context.Context, req *api.QueryKeyBackupRequest, res *api.QueryKeyBackupResponse) {
+ span, ctx := opentracing.StartSpanFromContext(ctx, "QueryKeyBackup")
+ defer span.Finish()
+
+ apiURL := h.apiURL + QueryKeyBackupPath
+ err := httputil.PostJSON(ctx, span, h.httpClient, apiURL, req, res)
+ if err != nil {
+ res.Error = err.Error()
+ }
+}