Check EAB key exists before deleting it

This commit is contained in:
Herman Slatman 2021-08-27 14:47:10 +02:00
parent 9d09f5e575
commit a1afbce50c
No known key found for this signature in database
GPG key ID: F4D8A44EA0A75A4F

View file

@ -222,9 +222,13 @@ func (db *DB) GetExternalAccountKey(ctx context.Context, provisionerName string,
}
func (db *DB) DeleteExternalAccountKey(ctx context.Context, keyID string) error {
err := db.db.Del(externalAccountKeyTable, []byte(keyID))
_, err := db.db.Get(externalAccountKeyTable, []byte(keyID))
if err != nil {
return errors.Wrapf(err, "error deleting ACME EAB Key with Key ID: %s", keyID)
return errors.Wrapf(err, "error loading ACME EAB Key with Key ID %s", keyID)
}
err = db.db.Del(externalAccountKeyTable, []byte(keyID))
if err != nil {
return errors.Wrapf(err, "error deleting ACME EAB Key with Key ID %s", keyID)
}
return nil
}