diff --git a/aries_vcx/src/handlers/issuance/issuer.rs b/aries_vcx/src/handlers/issuance/issuer.rs index f13732e81d..3bb5c47d9f 100644 --- a/aries_vcx/src/handlers/issuance/issuer.rs +++ b/aries_vcx/src/handlers/issuance/issuer.rs @@ -176,36 +176,6 @@ impl Issuer { Ok(()) } - pub async fn send_revocation_notification( - &mut self, - ack_on: Vec, - comment: Option, - send_message: SendClosure, - ) -> VcxResult<()> { - // TODO: Check if actually revoked - if self.issuer_sm.is_revokable() { - // TODO: Store to allow checking not. status (sent, acked) - let config = SenderConfigBuilder::default() - .rev_reg_id(self.get_rev_reg_id()?) - .cred_rev_id(self.get_rev_id()?) - .comment(comment) - .ack_on(ack_on) - .build()?; - RevocationNotificationSender::build() - .send_revocation_notification(config, send_message) - .await?; - Ok(()) - } else { - Err(AriesVcxError::from_msg( - AriesVcxErrorKind::InvalidState, - format!( - "Can't send revocation notification in state {:?}, credential is not revokable", - self.issuer_sm.get_state() - ), - )) - } - } - pub fn get_state(&self) -> IssuerState { self.issuer_sm.get_state() } diff --git a/aries_vcx/src/handlers/revocation_notification/mod.rs b/aries_vcx/src/handlers/revocation_notification/mod.rs index 19e5c09918..3ade2da98c 100644 --- a/aries_vcx/src/handlers/revocation_notification/mod.rs +++ b/aries_vcx/src/handlers/revocation_notification/mod.rs @@ -1,6 +1,43 @@ +use crate::errors::error::{AriesVcxError, AriesVcxErrorKind, VcxResult}; +use crate::handlers::issuance::issuer::Issuer; +use crate::handlers::revocation_notification::sender::RevocationNotificationSender; +use crate::protocols::revocation_notification::sender::state_machine::SenderConfigBuilder; +use crate::protocols::SendClosure; +use messages::decorators::please_ack::AckOn; + pub mod receiver; pub mod sender; +pub async fn send_revocation_notification( + issuer: &Issuer, + ack_on: Vec, + comment: Option, + send_message: SendClosure, +) -> VcxResult<()> { + // TODO: Check if actually revoked + if issuer.is_revokable() { + // TODO: Store to allow checking not. status (sent, acked) + let config = SenderConfigBuilder::default() + .rev_reg_id(issuer.get_rev_reg_id()?) + .cred_rev_id(issuer.get_rev_id()?) + .comment(comment) + .ack_on(ack_on) + .build()?; + RevocationNotificationSender::build() + .send_revocation_notification(config, send_message) + .await?; + Ok(()) + } else { + Err(AriesVcxError::from_msg( + AriesVcxErrorKind::InvalidState, + format!( + "Can't send revocation notification in state {:?}, credential is not revokable", + issuer.get_state() + ), + )) + } +} + pub mod test_utils { use agency_client::agency_client::AgencyClient; use messages::msg_fields::protocols::revocation::ack::AckRevoke;