mirror of
https://github.com/matrix-org/dendrite
synced 2024-12-15 17:53:43 +01:00
parent
c02832a3e9
commit
4d62ef650a
1 changed files with 23 additions and 23 deletions
|
@ -521,7 +521,7 @@ func (a *KeyInternalAPI) crossSigningKeysFromDatabase(
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *KeyInternalAPI) QuerySignatures(ctx context.Context, req *api.QuerySignaturesRequest, res *api.QuerySignaturesResponse) {
|
func (a *KeyInternalAPI) QuerySignatures(ctx context.Context, req *api.QuerySignaturesRequest, res *api.QuerySignaturesResponse) {
|
||||||
for targetUserID := range req.TargetIDs {
|
for targetUserID, forTargetUser := range req.TargetIDs {
|
||||||
keyMap, err := a.DB.CrossSigningKeysForUser(ctx, targetUserID)
|
keyMap, err := a.DB.CrossSigningKeysForUser(ctx, targetUserID)
|
||||||
if err != nil && err != sql.ErrNoRows {
|
if err != nil && err != sql.ErrNoRows {
|
||||||
res.Error = &api.KeyError{
|
res.Error = &api.KeyError{
|
||||||
|
@ -552,31 +552,31 @@ func (a *KeyInternalAPI) QuerySignatures(ctx context.Context, req *api.QuerySign
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, targetSection := range []map[string]gomatrixserverlib.CrossSigningKey{
|
for _, targetKeyID := range forTargetUser {
|
||||||
res.MasterKeys,
|
// Get own signatures only.
|
||||||
res.SelfSigningKeys,
|
sigMap, err := a.DB.CrossSigningSigsForTarget(ctx, targetUserID, targetUserID, targetKeyID)
|
||||||
res.UserSigningKeys,
|
if err != nil && err != sql.ErrNoRows {
|
||||||
} {
|
res.Error = &api.KeyError{
|
||||||
for targetKeyID, section := range targetSection {
|
Err: fmt.Sprintf("a.DB.CrossSigningSigsForTarget: %s", err),
|
||||||
// Get own signatures only.
|
|
||||||
sigMap, err := a.DB.CrossSigningSigsForTarget(ctx, targetUserID, targetUserID, gomatrixserverlib.KeyID(targetKeyID))
|
|
||||||
if err != nil && err != sql.ErrNoRows {
|
|
||||||
res.Error = &api.KeyError{
|
|
||||||
Err: fmt.Sprintf("a.DB.CrossSigningSigsForTarget: %s", err),
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
for sourceUserID, forSourceUser := range sigMap {
|
for sourceUserID, forSourceUser := range sigMap {
|
||||||
for sourceKeyID, sourceSig := range forSourceUser {
|
for sourceKeyID, sourceSig := range forSourceUser {
|
||||||
if section.Signatures == nil {
|
if res.Signatures == nil {
|
||||||
section.Signatures = map[string]map[gomatrixserverlib.KeyID]gomatrixserverlib.Base64Bytes{}
|
res.Signatures = map[string]map[gomatrixserverlib.KeyID]types.CrossSigningSigMap{}
|
||||||
}
|
|
||||||
if _, ok := res.Signatures[sourceUserID]; !ok {
|
|
||||||
section.Signatures[sourceUserID] = map[gomatrixserverlib.KeyID]gomatrixserverlib.Base64Bytes{}
|
|
||||||
}
|
|
||||||
section.Signatures[sourceUserID][sourceKeyID] = sourceSig
|
|
||||||
}
|
}
|
||||||
|
if _, ok := res.Signatures[targetUserID]; !ok {
|
||||||
|
res.Signatures[targetUserID] = map[gomatrixserverlib.KeyID]types.CrossSigningSigMap{}
|
||||||
|
}
|
||||||
|
if _, ok := res.Signatures[targetUserID][targetKeyID]; !ok {
|
||||||
|
res.Signatures[targetUserID][targetKeyID] = types.CrossSigningSigMap{}
|
||||||
|
}
|
||||||
|
if _, ok := res.Signatures[targetUserID][targetKeyID][sourceUserID]; !ok {
|
||||||
|
res.Signatures[targetUserID][targetKeyID][sourceUserID] = map[gomatrixserverlib.KeyID]gomatrixserverlib.Base64Bytes{}
|
||||||
|
}
|
||||||
|
res.Signatures[targetUserID][targetKeyID][sourceUserID][sourceKeyID] = sourceSig
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue