publish: Improve certificate fingerprint output

This commit is contained in:
Thorben Günther 2023-08-27 16:53:19 +02:00
parent 8f28182111
commit 1abacacab4
No known key found for this signature in database
GPG key ID: 415CD778D8C5AFED

View file

@ -350,7 +350,14 @@ func (br *bridge) publish(n *notification) error {
}
hash := sha512.Sum512(rawCerts[0])
return fmt.Errorf("ntfy certificate fingerprint does not match: expected %q, got %q", hex.EncodeToString(hash[:]), configFingerprint)
var expectedFingerprint string
for i, b := range hash {
if i != 0 {
expectedFingerprint += ":"
}
expectedFingerprint += fmt.Sprintf("%02X", b)
}
return fmt.Errorf("ntfy certificate fingerprint does not match: expected %q, got %q", expectedFingerprint, br.cfg.Ntfy.CertFingerprint)
}
tlsCfg.InsecureSkipVerify = true