Add ACME renewal gate mutation

This commit is contained in:
2026-09-18 23:53:34 -04:00
parent 0809cc740a
commit 66e75a7c58
+40 -1
View File
@@ -4,9 +4,48 @@ Let's Encrypt certificate renewal gate.
from __future__ import annotations
from functions.common import log
from functions.common import replace_exactly_once
RENEW_FUNCTION_ANCHOR = '''\trenew: async (access, data) => {
'''
RENEW_GATE_FRAGMENT = '''\trenew: async (access, data) => {
\t\trequireAcmeAuthority();
'''
RENEW_GATE_CALL = "\t\trequireAcmeAuthority();"
def apply(source: str) -> str:
"""
Gate internalCertificate.renew() before renewal dispatch.
"""
raise NotImplementedError("renew gate not implemented yet")
if RENEW_GATE_FRAGMENT in source:
log("renew_gate=already-present")
return source
source = replace_exactly_once(
source,
RENEW_FUNCTION_ANCHOR,
RENEW_GATE_FRAGMENT,
description="renew gate",
)
log("renew_gate=added")
return source
def verify(source: str) -> None:
"""
Verify that renew() contains the authority gate.
"""
if RENEW_GATE_FRAGMENT not in source:
raise RuntimeError(
"renew gate verification: authority check not found in renew()"
)
log("renew_gate_verification=passed")