aboutsummaryrefslogtreecommitdiff
path: root/keyserver
diff options
context:
space:
mode:
authorS7evinK <2353100+S7evinK@users.noreply.github.com>2022-02-09 13:11:43 +0100
committerGitHub <noreply@github.com>2022-02-09 13:11:43 +0100
commitac25065a54149117761e7a1b471a9b742f920ebc (patch)
tree40a523aa914fc3c51cc47a62c32c4c18468be48f /keyserver
parentcf447dd52a0015c2c5b10813ed11e59a3712607e (diff)
Fix sytest `uploading signed devices gets propagated over federation` (#2162)
* Remove unneeded logging * Add MasterKey & SelfSigningKey to update Avoid panic if signatures are not present * Add passing test * Revert "Add MasterKey & SelfSigningKey to update" This reverts commit 2c81b34884be8b5b875a33420c0f985b578d3fb8. * Send MasterKey & SelfSigningKey with update * Debugging * Remove delete() so we also query signingkeys
Diffstat (limited to 'keyserver')
-rw-r--r--keyserver/internal/cross_signing.go6
-rw-r--r--keyserver/internal/internal.go7
2 files changed, 11 insertions, 2 deletions
diff --git a/keyserver/internal/cross_signing.go b/keyserver/internal/cross_signing.go
index 527990cf..bfb2037f 100644
--- a/keyserver/internal/cross_signing.go
+++ b/keyserver/internal/cross_signing.go
@@ -308,8 +308,12 @@ func (a *KeyInternalAPI) PerformUploadDeviceSignatures(ctx context.Context, req
// Finally, generate a notification that we updated the signatures.
for userID := range req.Signatures {
+ masterKey := queryRes.MasterKeys[userID]
+ selfSigningKey := queryRes.SelfSigningKeys[userID]
update := eduserverAPI.CrossSigningKeyUpdate{
- UserID: userID,
+ UserID: userID,
+ MasterKey: &masterKey,
+ SelfSigningKey: &selfSigningKey,
}
if err := a.Producer.ProduceSigningKeyUpdate(update); err != nil {
res.Error = &api.KeyError{
diff --git a/keyserver/internal/internal.go b/keyserver/internal/internal.go
index 25924921..2536c1f7 100644
--- a/keyserver/internal/internal.go
+++ b/keyserver/internal/internal.go
@@ -326,8 +326,14 @@ func (a *KeyInternalAPI) QueryKeys(ctx context.Context, req *api.QueryKeysReques
if err = json.Unmarshal(key, &deviceKey); err != nil {
continue
}
+ if deviceKey.Signatures == nil {
+ deviceKey.Signatures = map[string]map[gomatrixserverlib.KeyID]gomatrixserverlib.Base64Bytes{}
+ }
for sourceUserID, forSourceUser := range sigMap {
for sourceKeyID, sourceSig := range forSourceUser {
+ if _, ok := deviceKey.Signatures[sourceUserID]; !ok {
+ deviceKey.Signatures[sourceUserID] = map[gomatrixserverlib.KeyID]gomatrixserverlib.Base64Bytes{}
+ }
deviceKey.Signatures[sourceUserID][sourceKeyID] = sourceSig
}
}
@@ -447,7 +453,6 @@ func (a *KeyInternalAPI) queryRemoteKeysOnServer(
for userID, deviceIDs := range devKeys {
if len(deviceIDs) == 0 {
userIDsForAllDevices[userID] = struct{}{}
- delete(devKeys, userID)
}
}
// for cross-signing keys, it's probably easier just to hit /keys/query if we aren't already doing