Fix precedence

This commit is contained in:
Neil Alexander 2022-10-06 11:39:06 +01:00
parent 223408c9eb
commit 22ca7695d0
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -253,15 +253,15 @@ func loadConfig(
key.PrivateKey = privateKey
key.PublicKey = gomatrixserverlib.Base64Bytes(privateKey.Public().(ed25519.PublicKey))
case key.KeyID == "":
return nil, fmt.Errorf("'key_id' must be specified if 'public_key' is specified")
case len(key.PublicKey) == ed25519.PublicKeySize:
continue
case len(key.PublicKey) > 0:
return nil, fmt.Errorf("the supplied 'public_key' is the wrong length")
case key.KeyID == "":
return nil, fmt.Errorf("'key_id' must be specified if 'public_key' is specified")
default:
return nil, fmt.Errorf("either specify a 'private_key' path or supply both 'public_key' and 'key_id'")
}