mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 11:23:11 -06:00
Some progress in E2EE
This commit is contained in:
parent
8a173437f9
commit
5183f48672
|
|
@ -18,6 +18,10 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Shopify/sarama"
|
||||
"github.com/matrix-org/dendrite/clientapi/auth/storage/devices"
|
||||
"github.com/matrix-org/dendrite/clientapi/httputil"
|
||||
|
|
@ -27,9 +31,6 @@ import (
|
|||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/matrix-org/util"
|
||||
"github.com/pkg/errors"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -259,6 +260,17 @@ func ClaimOneTimeKeys(
|
|||
}
|
||||
}
|
||||
|
||||
// ChangesInKeys returns the changes in the keys after last sync
|
||||
func ChangesInKeys(req *http.Request,
|
||||
encryptionDB *storage.Database,
|
||||
) util.JSONResponse {
|
||||
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusOK,
|
||||
JSON: struct{}{},
|
||||
}
|
||||
}
|
||||
|
||||
// todo: check through interface for duplicate and what type of request should it be
|
||||
// whether device or one time or both of them
|
||||
func checkUpload(req *types.UploadEncryptSpecific, typ int) bool {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ func Setup(
|
|||
|
||||
unstablemux.Handle("/keys/query",
|
||||
common.MakeAuthAPI("query keys", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
|
||||
//vars := mux.Vars(req)
|
||||
return QueryPKeys(req, encryptionDB, device.ID, deviceDB)
|
||||
}),
|
||||
).Methods(http.MethodPost, http.MethodOptions)
|
||||
|
|
@ -63,4 +62,10 @@ func Setup(
|
|||
}),
|
||||
).Methods(http.MethodPost, http.MethodOptions)
|
||||
|
||||
unstablemux.Handle("/keys/changes",
|
||||
common.MakeAuthAPI("get changes", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
|
||||
return ChangesInKeys(req, encryptionDB)
|
||||
}),
|
||||
).Methods(http.MethodGet, http.MethodOptions)
|
||||
|
||||
}
|
||||
|
|
|
|||
27
encryptoapi/types/changes.go
Normal file
27
encryptoapi/types/changes.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright Sumukha PK
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package types
|
||||
|
||||
// ChangesRequest structure
|
||||
type ChangesRequest struct {
|
||||
From string `json:"from"`
|
||||
To string `json:"to"`
|
||||
}
|
||||
|
||||
// ChangesResponse structure
|
||||
type ChangesResponse struct {
|
||||
Changed []string `json:"changed"`
|
||||
Left []string `json:"left"`
|
||||
}
|
||||
|
|
@ -46,12 +46,12 @@ type KeyObject struct {
|
|||
Signature map[string]map[string]string `json:"signatures"`
|
||||
}
|
||||
|
||||
// OneTimeKey structure
|
||||
type OneTimeKey struct {
|
||||
//KeyString map[string]string
|
||||
//KeyObject map[string]KeyObject
|
||||
KeySth map[string]interface{}
|
||||
}
|
||||
// // OneTimeKey structure
|
||||
// type OneTimeKey struct {
|
||||
// //KeyString map[string]string
|
||||
// //KeyObject map[string]KeyObject
|
||||
// KeySth map[string]interface{}
|
||||
// }
|
||||
|
||||
// OneTimeKeySpecific structure
|
||||
type OneTimeKeySpecific struct {
|
||||
|
|
|
|||
Loading…
Reference in a new issue