Skip to content

TestInboundFederationKeys fails if empty old_verify_keys is omitted #946

Open

Description

@timedoutuk

This field in /_matrix/key/v2/server is optional, and in Mautrix omitted when empty, but Complement returns an error if it is not present at all:

  ❌ TestInboundFederationKeys (FAIL; 4.75s)
2026/11/03 01:08:53 WARNING: complement_fed_3_fed.1_servers.hs1_1 has a named VOLUME /var/lib/postgresql/data - volumes can lead to unpredictable behaviour due to test pollution. Remove the VOLUME in the Dockerfile to suppress this message.
    federation_keys_test.go:30: Deploy times: 9.103914ms blueprints, 3.450035018s containers
    federation_keys_test.go:45: MatchResponse JSONMapEach: missing key 'old_verify_keys' - https://127.0.0.1:32789/_matrix/key/v2/server => {"server_name":"hs1","signatures":{"hs1":{"ed25519:307d59fc32ee2771e7292fa1c4519e77ce6d6069d0bb78400d1208e48c278abd":"EBzKuwvrcSo2RzONAKAeN76zwdf4OTJxrLFQDeFmOKLq5MFQXFXKwU3cwFH2h19uANQu5wDbxpvy0YNfUUBlCg"}},"valid_until_ts":1793754536056,"verify_keys":{"ed25519:307d59fc32ee2771e7292fa1c4519e77ce6d6069d0bb78400d1208e48c278abd":{"key":"eN5abljPWdwVk+w5MIrl7Ld/KqWVH5+Ms6vnKWxcKBM"}}}  

match.JSONMapEach("old_verify_keys", func(k, v gjson.Result) error {
// Check for ed25519 prefix
if !strings.HasPrefix(k.Str, "ed25519:") {
return fmt.Errorf("old_verify_keys: Key '%s' has no 'ed25519:' prefix", k.Str)
}
must.MatchGJSON(t, v,
match.JSONKeyPresent("expired_ts"),
match.JSONKeyTypeEqual("expired_ts", gjson.Number),
)
must.MatchGJSON(t, v,
match.JSONKeyPresent("key"),
match.JSONKeyTypeEqual("key", gjson.String),
)
key := v.Get("key")
var keyBytes []byte
keyBytes, err = base64.RawStdEncoding.DecodeString(key.Str)
if err != nil {
return fmt.Errorf("old_verify_keys: Key '%s' failed to decode as ed25519 base64: %s", k.Str, err)
}
oldKeys[k.Str] = keyBytes
return nil
}),

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions