pub trait ControllerProvider {
type Controller<'a>: Controller
where Self: 'a;
// Required method
async fn get_controller<'a>(
&'a self,
id: &'a Iri,
) -> Result<Option<Self::Controller<'a>>, ControllerError>;
// Provided methods
async fn require_controller<'a>(
&'a self,
id: &'a Iri,
) -> Result<Self::Controller<'a>, ControllerError> { ... }
async fn allows_verification_method<'a>(
&'a self,
controller_id: &'a Iri,
method_id: &'a Iri,
proof_purposes: ProofPurposes,
) -> Result<bool, ControllerError> { ... }
async fn ensure_allows_verification_method<'a>(
&'a self,
controller_id: &'a Iri,
method_id: &'a Iri,
proof_purpose: ProofPurpose,
) -> Result<(), ProofValidationError> { ... }
}
Expand description
Controller provider.
A provider is in charge of retrieving the verification method controllers from their identifiers.
Required Associated Types§
Sourcetype Controller<'a>: Controller
where
Self: 'a
type Controller<'a>: Controller where Self: 'a
Controller reference type.
Required Methods§
Sourceasync fn get_controller<'a>(
&'a self,
id: &'a Iri,
) -> Result<Option<Self::Controller<'a>>, ControllerError>
async fn get_controller<'a>( &'a self, id: &'a Iri, ) -> Result<Option<Self::Controller<'a>>, ControllerError>
Returns the controller with the given identifier, if it can be found.
Provided Methods§
Sourceasync fn require_controller<'a>(
&'a self,
id: &'a Iri,
) -> Result<Self::Controller<'a>, ControllerError>
async fn require_controller<'a>( &'a self, id: &'a Iri, ) -> Result<Self::Controller<'a>, ControllerError>
Returns the controller with the given identifier, or fails if it cannot be found.
Sourceasync fn allows_verification_method<'a>(
&'a self,
controller_id: &'a Iri,
method_id: &'a Iri,
proof_purposes: ProofPurposes,
) -> Result<bool, ControllerError>
async fn allows_verification_method<'a>( &'a self, controller_id: &'a Iri, method_id: &'a Iri, proof_purposes: ProofPurposes, ) -> Result<bool, ControllerError>
Checks that the controller identified by controller_id
allows the use
of the verification method method_id
with the given proof purposes.
Sourceasync fn ensure_allows_verification_method<'a>(
&'a self,
controller_id: &'a Iri,
method_id: &'a Iri,
proof_purpose: ProofPurpose,
) -> Result<(), ProofValidationError>
async fn ensure_allows_verification_method<'a>( &'a self, controller_id: &'a Iri, method_id: &'a Iri, proof_purpose: ProofPurpose, ) -> Result<(), ProofValidationError>
Ensures that the controller identified by controller_id
allows the use
of the verification method method_id
with the given proof purposes.
Contrarily to the allows_verification_method
function, this function
returns an error if one of the input proof purposes is not allowed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.