Skip to main content

require_disclosure

Function require_disclosure 

Source
pub fn require_disclosure(open: bool, route: &str) -> Result<(), ApiError>
Expand description

Resolves a Credential::Disclosure route: open unless this deployment’s configuration has closed it, in which case it is closed to everyone.

open is the one field of Disclosure this route’s toggle lives at, and it is the whole of the decision — this function reads no header at all. true — the default — is public, full stop, the same as Credential::Public. false is disclosure_disabled for every caller alike: there is no operator credential that could reach past the toggle (see the module doc), so a deployment that closes a disclosure route closes it to itself over HTTP too, and an operator who wants the data back turns the toggle back on rather than presenting something.

One refusal rather than the usual authentication_required versus invalid_token split, which was already true when a credential could reach past this and is more plainly true now: the caller only needs to learn one thing here, that this route is closed by configuration and not merely guarded by a login it forgot.