Hopefully get keys from remote query

This commit is contained in:
Neil Alexander 2021-07-30 09:55:05 +01:00
parent a00ea5f1d1
commit d459ef5b16
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -228,8 +228,7 @@ func (a *KeyInternalAPI) QueryKeys(ctx context.Context, req *api.QueryKeysReques
// get cross-signing keys from the database
if err := a.crossSigningKeys(ctx, req, res); err != nil {
// 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 from database")
}
// make a map from domain to device keys
@ -354,6 +353,23 @@ func (a *KeyInternalAPI) queryRemoteKeys(
res.DeviceKeys[userID][deviceID] = keyJSON
}
}
for userID, body := range result.MasterKeys {
switch b := body.CrossSigningBody.(type) {
case *gomatrixserverlib.CrossSigningForKey:
res.MasterKeys[userID] = *b
}
}
for userID, body := range result.SelfSigningKeys {
switch b := body.CrossSigningBody.(type) {
case *gomatrixserverlib.CrossSigningForKey:
res.SelfSigningKeys[userID] = *b
}
}
// TODO: do we want to persist these somewhere now
// that we have fetched them?
}
}