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.
Object Safety§
This trait is not object safe.