mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-29 08:18:27 +00:00
Allocate the maps first
This commit is contained in:
parent
06de424b2b
commit
b638b06ec1
1 changed files with 6 additions and 5 deletions
|
@ -220,17 +220,18 @@ func (a *KeyInternalAPI) QueryDeviceMessages(ctx context.Context, req *api.Query
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *KeyInternalAPI) QueryKeys(ctx context.Context, req *api.QueryKeysRequest, res *api.QueryKeysResponse) {
|
func (a *KeyInternalAPI) QueryKeys(ctx context.Context, req *api.QueryKeysRequest, res *api.QueryKeysResponse) {
|
||||||
|
res.DeviceKeys = make(map[string]map[string]json.RawMessage)
|
||||||
|
res.MasterKeys = make(map[string]gomatrixserverlib.CrossSigningKey)
|
||||||
|
res.SelfSigningKeys = make(map[string]gomatrixserverlib.CrossSigningKey)
|
||||||
|
res.UserSigningKeys = make(map[string]gomatrixserverlib.CrossSigningKey)
|
||||||
|
res.Failures = make(map[string]interface{})
|
||||||
|
|
||||||
// get cross-signing keys from the database
|
// get cross-signing keys from the database
|
||||||
if err := a.crossSigningKeys(ctx, req, res); err != nil {
|
if err := a.crossSigningKeys(ctx, req, res); err != nil {
|
||||||
// TODO: handle this
|
// TODO: handle this
|
||||||
util.GetLogger(ctx).WithError(err).Error("Failed to retrieve cross-signing keys")
|
util.GetLogger(ctx).WithError(err).Error("Failed to retrieve cross-signing keys")
|
||||||
}
|
}
|
||||||
|
|
||||||
res.DeviceKeys = make(map[string]map[string]json.RawMessage)
|
|
||||||
res.MasterKeys = make(map[string]gomatrixserverlib.CrossSigningKey)
|
|
||||||
res.SelfSigningKeys = make(map[string]gomatrixserverlib.CrossSigningKey)
|
|
||||||
res.UserSigningKeys = make(map[string]gomatrixserverlib.CrossSigningKey)
|
|
||||||
res.Failures = make(map[string]interface{})
|
|
||||||
// make a map from domain to device keys
|
// make a map from domain to device keys
|
||||||
domainToDeviceKeys := make(map[string]map[string][]string)
|
domainToDeviceKeys := make(map[string]map[string][]string)
|
||||||
for userID, deviceIDs := range req.UserToDevices {
|
for userID, deviceIDs := range req.UserToDevices {
|
||||||
|
|
Loading…
Reference in a new issue