revoke

suspend fun revoke(subject: DidKey, notBefore: Long)

Revokes every grant issued to subject before notBefore, in epoch milliseconds.

notBefore must be later than every grant you mean to stop, because a grant issued exactly at the cutoff stays good. The host's clock now is not enough: a grant issued in this same millisecond has issuedAt == now and survives, which under virtual time is the common case. Use now + 1. When you know the latest issuedAt you gave subject, use the later of that plus one and now + 1: that also catches a grant issued while the clock ran ahead and was then set back. With only the clock, that case is not handled: a cutoff read after the clock stepped backwards can fall before a grant issued ahead of it, and that grant stays good. GrantTrust refuses it as GrantVerdict.NotYetValid while it is dated more than GrantTrust.CLOCK_SKEW_ALLOWANCE_MILLIS ahead, but not once the clock nears its date.

A grant issued at or after the cutoff works, so a pass handed out from the cutoff on lets the device back.

Monotone: a cutoff earlier than the one already held changes nothing.

A list from open returns only once the whole list, this cutoff included, is written to its store. The cutoff holds in this process before its write starts, so a write that fails or never returns does not let the device in here. If the write throws, so does revoke, and what the store holds is unknown; calling revoke again writes the whole list again, so a retry makes it good.

Concurrent calls write one at a time, in the order they merged, and each waits for its write to return before the next starts, even when it is cancelled. That keeps an older list from landing on top of a newer one, with one exception the store's contract leaves open: a write that throws may still commit later, and if it does, it can land on top of a list written after it. Only a later revoke whose write commits after that repairs it.

The cost of waiting through cancellation: on a list from open, revoke is not cancellable while its write runs. A store whose write never returns makes revoke never return, cancelled or not, and holds up every later revoke on the list. A host shutting down gets its last revocation written rather than abandoned.