use super::AuthApi;
use crate::{
dto::{
auth::{
RoleAttestationGetRequest, RoleAttestationPrepareResponse, RoleAttestationRequest,
SignedRoleAttestation,
},
error::Error,
},
workflow::runtime::auth::RuntimeAuthWorkflow,
};
impl AuthApi {
pub fn prepare_component_role_attestation_root(
request: RoleAttestationRequest,
component: &crate::ids::ComponentBinding,
) -> Result<RoleAttestationPrepareResponse, Error> {
RuntimeAuthWorkflow::prepare_component_role_attestation_root(request, component)
.map_err(Self::map_auth_error)
}
pub fn get_role_attestation_root(
request: RoleAttestationGetRequest,
) -> Result<SignedRoleAttestation, Error> {
RuntimeAuthWorkflow::get_role_attestation_root(request).map_err(Self::map_auth_error)
}
pub async fn verify_role_attestation(
attestation: &SignedRoleAttestation,
min_accepted_epoch: u64,
) -> Result<(), Error> {
RuntimeAuthWorkflow::verify_role_attestation(attestation, min_accepted_epoch)
.await
.map_err(Self::map_auth_error)
}
}