use async_trait::async_trait;
pub enum YePluginResultValue<T> {
NotImplemented,
Ignored,
Success(T),
}
impl<T> YePluginResultValue<T> {
pub fn unwrap(self) -> T {
match self {
YePluginResultValue::Success(val) => val,
YePluginResultValue::NotImplemented => {
panic!("called `YePluginResultValue::unwrap()` on a `NotImplemented` value")
}
YePluginResultValue::Ignored => {
panic!("called `YePluginResultValue::unwrap()` on a `Ignored` value")
}
}
}
}
#[async_trait(?Send)]
#[allow(unused_variables)] pub trait YePlugin {
async fn did_create(
&mut self,
did_method: &str,
options: &str,
payload: &str,
) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
Ok(YePluginResultValue::NotImplemented)
}
async fn did_resolve(
&mut self,
_did: &str,
) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
Ok(YePluginResultValue::NotImplemented)
}
async fn did_update(
&mut self,
did: &str,
options: &str,
payload: &str,
) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
Ok(YePluginResultValue::NotImplemented)
}
async fn run_custom_function(
&mut self,
method: &str,
function: &str,
options: &str,
payload: &str,
) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
Ok(YePluginResultValue::NotImplemented)
}
async fn vc_zkp_create_credential_definition(
&mut self,
did_method: &str,
options: &str,
payload: &str,
) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
Ok(YePluginResultValue::NotImplemented)
}
async fn vc_zkp_create_credential_offer(
&mut self,
method: &str,
options: &str,
payload: &str,
) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
Ok(YePluginResultValue::NotImplemented)
}
async fn vc_zkp_create_credential_proposal(
&mut self,
method: &str,
options: &str,
payload: &str,
) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
Ok(YePluginResultValue::NotImplemented)
}
async fn vc_zkp_create_credential_schema(
&mut self,
method: &str,
options: &str,
payload: &str,
) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
Ok(YePluginResultValue::NotImplemented)
}
async fn vc_zkp_create_revocation_registry_definition(
&mut self,
method: &str,
options: &str,
payload: &str,
) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
Ok(YePluginResultValue::NotImplemented)
}
async fn vc_zkp_update_revocation_registry(
&mut self,
method: &str,
options: &str,
payload: &str,
) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
Ok(YePluginResultValue::NotImplemented)
}
async fn vc_zkp_issue_credential(
&mut self,
method: &str,
options: &str,
payload: &str,
) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
Ok(YePluginResultValue::NotImplemented)
}
async fn vc_zkp_present_proof(
&mut self,
method: &str,
options: &str,
payload: &str,
) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
Ok(YePluginResultValue::NotImplemented)
}
async fn vc_zkp_request_credential(
&mut self,
method: &str,
options: &str,
payload: &str,
) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
Ok(YePluginResultValue::NotImplemented)
}
async fn vc_zkp_request_proof(
&mut self,
method: &str,
options: &str,
payload: &str,
) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
Ok(YePluginResultValue::NotImplemented)
}
async fn vc_zkp_revoke_credential(
&mut self,
method: &str,
options: &str,
payload: &str,
) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
Ok(YePluginResultValue::NotImplemented)
}
async fn vc_zkp_verify_proof(
&mut self,
method: &str,
options: &str,
payload: &str,
) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
Ok(YePluginResultValue::NotImplemented)
}
}