Skip to main content

require_allowed

Function require_allowed 

Source
pub fn require_allowed(service: Service) -> Result<(), Error>
Expand description

Guard used at the entry point of every approved service, after require_operational, to enforce the active algorithm profile.

Returns Ok(()) if the service is permitted under the profile selected at initialization, or Err(Error::AlgorithmRestricted { .. }) otherwise.

This gate does not check State — callers must call require_operational first. The two-gate pattern is:

ⓘ
require_operational()?;
require_allowed(Service::Sha256)?;
// ... perform the operation