pub struct RevocationGuard { /* private fields */ }Expand description
The user’s revocation log, as a verifier of peer chains.
Cheap to clone; every clone shares one cached view.
Implementations§
Source§impl RevocationGuard
impl RevocationGuard
Sourcepub fn open(log: impl Into<PathBuf>, local_user: Fingerprint) -> Result<Self>
pub fn open(log: impl Into<PathBuf>, local_user: Fingerprint) -> Result<Self>
A guard over the log file at log, for the local user local_user.
Reads, verifies and checks the log against the Seen record kept
beside it (<name>.seen.json) before returning, so a missing, invalid
or rolled-back log is refused at startup. The first time a log is
opened there is no Seen yet; it is written then.
§Errors
GuardError::Unavailable if the log is missing,
unreadable, invalid, another user’s, or does not extend what was seen.
Sourcepub fn in_memory(user: &UserKey) -> Self
pub fn in_memory(user: &UserKey) -> Self
A guard over a fresh, empty log owned by user: nothing is revoked and
nothing is persisted. For tests and for callers that keep no log;
production code opens the user’s revocation.json with Self::open.
Sourcepub fn state(&self) -> Result<Arc<RevocationState>>
pub fn state(&self) -> Result<Arc<RevocationState>>
The current verified state, re-reading the log if its file changed.
§Errors
GuardError::Unavailable as for Self::open.
Sourcepub fn check(&self, peer: &CertChain) -> Result<()>
pub fn check(&self, peer: &CertChain) -> Result<()>
Check peer against the current state: its user is ours, no link in
its chain is revoked, and it is valid at the current generation.
§Errors
GuardError::Revoked for a revoked link,
GuardError::BadCertChain for any other chain failure,
GuardError::Unavailable if there is no usable log.