#!/bin/bash
set -e -u
# shellcheck source=common.sh
. "${0%/*}/common.sh"

name="*.${R2}.${R2}"
init
gencert "${name}" "${name}"
list_cert_names | grep -F -e "${name}"
[ 01 = "$(has_valid_cert "${name}")" ]

has_cert "$name"

renew_cert "${name}"
list_cert_names | grep -F -e "${name}"
[ 02 = "$(has_valid_cert "${name}")" ]

revoke_cert "${name}"
FAIL has_valid_cert "${name}"
list_cert_names | FAIL grep -F -e "${name}"

:
