Add public registration cancellation
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s

This commit is contained in:
tegwick 2026-08-10 19:27:41 +02:00
parent 8170373148
commit d5a5fed69a
7 changed files with 174 additions and 8 deletions

View file

@ -45,12 +45,24 @@ class HTTPRegistrationVerificationAdapter:
)
def consume(self, opaque_handle: str) -> VerifiedRegistrationApplicant:
return self._resolve(
opaque_handle, "/v1/registration-verifications/consume",
"public-registration",
)
def cancel(self, opaque_handle: str) -> VerifiedRegistrationApplicant:
return self._resolve(
opaque_handle, "/v1/registration-verifications/cancel",
"public-registration-cancel",
)
def _resolve(
self, opaque_handle: str, path: str, expected_purpose: str
) -> VerifiedRegistrationApplicant:
if len(opaque_handle) < 32:
raise ValueError("verification handle is invalid")
result = self._post(
"/v1/registration-verifications/consume", {"handle": opaque_handle}
)
if result.get("purpose") != "public-registration":
result = self._post(path, {"handle": opaque_handle})
if result.get("purpose") != expected_purpose:
raise RuntimeError("verification evidence has the wrong purpose")
return VerifiedRegistrationApplicant(
verification_id=str(result["verification_id"]),