Interface TotpRecoveryGate


@ThreadSafe public interface TotpRecoveryGate
Application-owned recovery admission barrier. Before granting admission, compare externally durable recovery state and allowed sealing-key lifecycle with the exact requested context. The controller closes admission, drains outstanding operations, fences old transactions and writers, then restores into a fresh never-reused epoch. Encryption cannot detect database rollback.

Implementations are thread-safe; each permit belongs to the acquiring thread. Nested admission on that thread retains the barrier until its outermost permit closes. This allows an application to hold outer admission through its own login/session transaction. Alternatively, that transaction must atomically enforce a recovery epoch fence. A preceding epoch lookup leaves a completion race. Returned proofs cannot revoke themselves; sessions and approvals from earlier epochs must be invalidated by the application. Initialization admission is granted only while provisioning a new epoch, and stops before ordinary traffic opens.

Since:
1.0.0
  • Method Details

    • acquire

      Acquires admission within the positive remaining caller-thread budget. The budget establishes a deadline for the complete permit lifetime, including later currentness checks. Return null when admission is closed or cannot be confirmed. Core holds admission through storage and its final result decision. After a genuinely unknown mutation, loss of admission preserves Indeterminate; a known requested commitment without releasable output requires ReconciliationRequired. A retained charge whose settlement is incomplete remains ATTEMPT_INCOMPLETE. None releases proofs or plaintext. If acquisition returns null or throws, the implementation must first release every partially acquired lock, lease, reference count or other admission claim. Such an outcome must leave no admission held by the calling thread; core cannot release a permit it never received. This also applies when acquisition is interrupted or its budget expires. Preserve interruption and never extend a deadline.
      Parameters:
      context - the exact operation and sealing configuration
      remainingBudget - remaining positive operation budget
      Returns:
      a caller-thread permit, or null when admission is unavailable
      Since:
      1.0.0