mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-04-10 13:53:40 +00:00
Merge branch 'master' of https://github.com/matrix-org/dendrite into query-key-backup
This commit is contained in:
commit
937f72b250
3 changed files with 50 additions and 20 deletions
16
CHANGES.md
16
CHANGES.md
|
@ -1,5 +1,21 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Dendrite 0.5.0 (2021-08-24)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Support for serverside key backups has been added, allowing your E2EE keys to be backed up and to be restored after logging out or when logging in from a new device
|
||||||
|
* Experimental support for cross-signing has been added, allowing verifying your own device keys and verifying other user's public keys
|
||||||
|
* Dendrite can now send logs to a TCP syslog server by using the `syslog` logger type (contributed by [sambhavsaggi](https://github.com/sambhavsaggi))
|
||||||
|
* Go 1.15 is now the minimum supported version for Dendrite
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Device keys are now cleaned up from the keyserver when the user API removes a device session
|
||||||
|
* The `M_ROOM_IN_USE` error code is now returned when a room alias is already taken (contributed by [nivekuil](https://github.com/nivekuil))
|
||||||
|
* A bug in the state storage migration has been fixed where room create events had incorrect state snapshots
|
||||||
|
* A bug when deactivating accounts caused by only reading the deprecated username field has been fixed
|
||||||
|
|
||||||
## Dendrite 0.4.1 (2021-07-26)
|
## Dendrite 0.4.1 (2021-07-26)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
|
@ -15,11 +15,10 @@
|
||||||
package routing
|
package routing
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/clientapi/auth"
|
"github.com/matrix-org/dendrite/clientapi/auth"
|
||||||
|
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
|
||||||
"github.com/matrix-org/dendrite/clientapi/httputil"
|
"github.com/matrix-org/dendrite/clientapi/httputil"
|
||||||
"github.com/matrix-org/dendrite/clientapi/jsonerror"
|
"github.com/matrix-org/dendrite/clientapi/jsonerror"
|
||||||
"github.com/matrix-org/dendrite/keyserver/api"
|
"github.com/matrix-org/dendrite/keyserver/api"
|
||||||
|
@ -29,37 +28,52 @@ import (
|
||||||
"github.com/matrix-org/util"
|
"github.com/matrix-org/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type crossSigningRequest struct {
|
||||||
|
api.PerformUploadDeviceKeysRequest
|
||||||
|
Auth newPasswordAuth `json:"auth"`
|
||||||
|
}
|
||||||
|
|
||||||
func UploadCrossSigningDeviceKeys(
|
func UploadCrossSigningDeviceKeys(
|
||||||
req *http.Request, userInteractiveAuth *auth.UserInteractive,
|
req *http.Request, userInteractiveAuth *auth.UserInteractive,
|
||||||
keyserverAPI api.KeyInternalAPI, device *userapi.Device,
|
keyserverAPI api.KeyInternalAPI, device *userapi.Device,
|
||||||
accountDB accounts.Database, cfg *config.ClientAPI,
|
accountDB accounts.Database, cfg *config.ClientAPI,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
uploadReq := &api.PerformUploadDeviceKeysRequest{}
|
uploadReq := &crossSigningRequest{}
|
||||||
uploadRes := &api.PerformUploadDeviceKeysResponse{}
|
uploadRes := &api.PerformUploadDeviceKeysResponse{}
|
||||||
|
|
||||||
ctx := req.Context()
|
resErr := httputil.UnmarshalJSONRequest(req, &uploadReq)
|
||||||
defer req.Body.Close() // nolint:errcheck
|
if resErr != nil {
|
||||||
bodyBytes, err := ioutil.ReadAll(req.Body)
|
return *resErr
|
||||||
if err != nil {
|
}
|
||||||
|
sessionID := uploadReq.Auth.Session
|
||||||
|
if sessionID == "" {
|
||||||
|
sessionID = util.RandomString(sessionIDLength)
|
||||||
|
}
|
||||||
|
if uploadReq.Auth.Type != authtypes.LoginTypePassword {
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusUnauthorized,
|
||||||
JSON: jsonerror.BadJSON("The request body could not be read: " + err.Error()),
|
JSON: newUserInteractiveResponse(
|
||||||
|
sessionID,
|
||||||
|
[]authtypes.Flow{
|
||||||
|
{
|
||||||
|
Stages: []authtypes.LoginType{authtypes.LoginTypePassword},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
nil,
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
typePassword := auth.LoginTypePassword{
|
||||||
if _, err := userInteractiveAuth.Verify(ctx, bodyBytes, device); err != nil {
|
GetAccountByPassword: accountDB.GetAccountByPassword,
|
||||||
return *err
|
Config: cfg,
|
||||||
}
|
}
|
||||||
|
if _, authErr := typePassword.Login(req.Context(), &uploadReq.Auth.PasswordRequest); authErr != nil {
|
||||||
if err = json.Unmarshal(bodyBytes, &uploadReq); err != nil {
|
return *authErr
|
||||||
return util.JSONResponse{
|
|
||||||
Code: http.StatusBadRequest,
|
|
||||||
JSON: jsonerror.BadJSON("The request body could not be unmarshalled: " + err.Error()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
AddCompletedSessionStage(sessionID, authtypes.LoginTypePassword)
|
||||||
|
|
||||||
uploadReq.UserID = device.UserID
|
uploadReq.UserID = device.UserID
|
||||||
keyserverAPI.PerformUploadDeviceKeys(req.Context(), uploadReq, uploadRes)
|
keyserverAPI.PerformUploadDeviceKeys(req.Context(), &uploadReq.PerformUploadDeviceKeysRequest, uploadRes)
|
||||||
|
|
||||||
if err := uploadRes.Error; err != nil {
|
if err := uploadRes.Error; err != nil {
|
||||||
switch {
|
switch {
|
||||||
|
|
|
@ -18,7 +18,7 @@ const (
|
||||||
VersionMajor = 0
|
VersionMajor = 0
|
||||||
VersionMinor = 5
|
VersionMinor = 5
|
||||||
VersionPatch = 0
|
VersionPatch = 0
|
||||||
VersionTag = "rc1" // example: "rc1"
|
VersionTag = "" // example: "rc1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func VersionString() string {
|
func VersionString() string {
|
||||||
|
|
Loading…
Reference in a new issue