27 lines
963 B
Python
27 lines
963 B
Python
"""Helpers around RegistryManager issuance queues (Python API drains on take)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import zkac
|
|
|
|
|
|
def peek_pending_requests(
|
|
mgr: zkac.RegistryManager, registry_id: bytes
|
|
) -> list[tuple[bytes, bytes, bytes, bytes]]:
|
|
"""Return pending (request_id, role_id, eph_pk, ciphertext) and re-queue them."""
|
|
items = mgr.take_pending_requests(registry_id)
|
|
out: list[tuple[bytes, bytes, bytes, bytes]] = []
|
|
for tup in items:
|
|
req_id, role_id, eph_pk, enc = tup
|
|
out.append((req_id, role_id, eph_pk, enc))
|
|
mgr.queue_issuance_request(registry_id, req_id, role_id, eph_pk, enc)
|
|
return out
|
|
|
|
|
|
def take_pending_requests(
|
|
mgr: zkac.RegistryManager, registry_id: bytes
|
|
) -> list[tuple[bytes, bytes, bytes, bytes]]:
|
|
"""Drain pending queue (admin processes and must grant or lose requests)."""
|
|
items = mgr.take_pending_requests(registry_id)
|
|
return [(a, b, c, d) for a, b, c, d in items]
|