Trait ye::YePlugin[][src]

pub trait YePlugin {
#[must_use]    fn did_create<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        did_method: &'life1 str,
        options: &'life2 str,
        payload: &'life3 str
    ) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn did_resolve<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        _did: &'life1 str
    ) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn did_update<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        did: &'life1 str,
        options: &'life2 str,
        payload: &'life3 str
    ) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn run_custom_function<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 mut self,
        method: &'life1 str,
        function: &'life2 str,
        options: &'life3 str,
        payload: &'life4 str
    ) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        'life4: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn vc_zkp_create_credential_definition<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        did_method: &'life1 str,
        options: &'life2 str,
        payload: &'life3 str
    ) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn vc_zkp_create_credential_offer<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        method: &'life1 str,
        options: &'life2 str,
        payload: &'life3 str
    ) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn vc_zkp_create_credential_proposal<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        method: &'life1 str,
        options: &'life2 str,
        payload: &'life3 str
    ) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn vc_zkp_create_credential_schema<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        method: &'life1 str,
        options: &'life2 str,
        payload: &'life3 str
    ) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn vc_zkp_create_revocation_registry_definition<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        method: &'life1 str,
        options: &'life2 str,
        payload: &'life3 str
    ) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn vc_zkp_update_revocation_registry<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        method: &'life1 str,
        options: &'life2 str,
        payload: &'life3 str
    ) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn vc_zkp_issue_credential<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        method: &'life1 str,
        options: &'life2 str,
        payload: &'life3 str
    ) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn vc_zkp_present_proof<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        method: &'life1 str,
        options: &'life2 str,
        payload: &'life3 str
    ) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn vc_zkp_request_credential<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        method: &'life1 str,
        options: &'life2 str,
        payload: &'life3 str
    ) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn vc_zkp_request_proof<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        method: &'life1 str,
        options: &'life2 str,
        payload: &'life3 str
    ) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn vc_zkp_revoke_credential<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        method: &'life1 str,
        options: &'life2 str,
        payload: &'life3 str
    ) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn vc_zkp_verify_proof<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        method: &'life1 str,
        options: &'life2 str,
        payload: &'life3 str
    ) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        Self: 'async_trait
, { ... } }

About

The plugins are the bread and butter of the underlying Ye logic. Ye is your single point of contact in your application and all your calls are executed against it. Ye itself manages the plugins, delegates calls to them and filters the results. The actual logic concerning specific DID methods resides in the plugins and they are responsible for implementing argument handling, resolving DIDs, etc.

Call delegation

All functions of the YePlugin trait have a counterpart with the same name but a slightly different signature in Ye that will delegate calls to the plugins’ functions with the same name. While the plugin returns a YePluginResultValue<T>result, Ye will return a Vec<T> result. Ye’s result is the list of all results from all plugins that did implement the called function and did not ignore the request.

For example did_create / did_create:

Ye’s function:

pub async fn did_create(
    &mut self,
    did_method: &str,
    options: &str,
    payload: &str,
    ) -> Result<Vec<Option<String>>, Box<dyn std::error::Error>> {
    // ...
}

Will call all YePlugins’ functions:

pub async fn did_create(
    &mut self,
    did_method: &str,
    options: &str,
    payload: &str,
) -> Result<Vec<Option<String>>, Box<dyn std::error::Error>> {
    // ...
}

Result Values of Plugins

Plugins return results with the type YePluginResultValue, which has 3 Variants:

  • NotImplemented, for functions not implemented in a plugin
  • Ignored, for functions implemented in a plugin but ignore the request (e.g. due to an unknown method)
  • Success, for successful requests’ results

Example

A simple plugin could look like this:

use async_trait::async_trait;
use ye::{YePlugin, YePluginResultValue};

struct ExamplePlugin { }

impl ExamplePlugin { pub fn new() -> Self { ExamplePlugin {} } }

#[async_trait(?Send)]
impl YePlugin for ExamplePlugin {
    async fn did_create(
        &mut self,
        _did_method: &str,
        _options: &str,
        _payload: &str,
    ) -> Result<YePluginResultValue<Option<String>>, Box<dyn std::error::Error>> {
        Ok(YePluginResultValue::Success(Some(
            r#"{ "id": "did:example123:456" }"#.to_string(),
        )))
    }
}

There is no need to implement all YePlugin functions, unimplemented functions will be ignored. Also make sure to return Ignored, your function is not responsible for a given did or method.

Provided methods

#[must_use]fn did_create<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 mut self,
    did_method: &'life1 str,
    options: &'life2 str,
    payload: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 
[src]

Creates a new DID. May also persist a DID document for it, depending on plugin implementation.

Arguments

  • did_method - did method to cater to, usually also used by plugins to decide if a plugins will process the request
  • options - JSON string with additional information supporting the request (e.g. authentication data)
  • payload - JSON string with information for the request (e.g. actual data to write)

Example

use ye::{YePlugin, YePluginResultValue};
// use some_crate:ExamplePlugin;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut ep: ExamplePlugin = ExamplePlugin::new();
    let result = ep.did_create("did:example", "", "").await?;
    if let YePluginResultValue::Success(Some(value)) = result {
        println!("created new did: {}", &value);
    }
    Ok(())
}

#[must_use]fn did_resolve<'life0, 'life1, 'async_trait>(
    &'life0 mut self,
    _did: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 
[src]

Fetch data about a DID. This usually returns a DID document.

Arguments

  • did - did to fetch data for

Example

use ye::{YePlugin, YePluginResultValue};
// use some_crate:ExamplePlugin;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut ep: ExamplePlugin = ExamplePlugin::new();
    let result = ep.did_resolve("did:example:123").await?;
    if let YePluginResultValue::Success(Some(value)) = result {
        println!("got did: {}", &value);
    }
    Ok(())
}

#[must_use]fn did_update<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 mut self,
    did: &'life1 str,
    options: &'life2 str,
    payload: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 
[src]

Updates data related to a DID. May also persist a DID document for it, depending on plugin implementation.

Arguments

  • did - DID to update data for
  • options - JSON string with additional information supporting the request (e.g. authentication data)
  • payload - JSON string with information for the request (e.g. actual data to write)

Example

use ye::{YePlugin, YePluginResultValue};
// use some_crate:ExamplePlugin;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut ep: ExamplePlugin = ExamplePlugin::new();
    let result = ep.did_update("did:example", "", "").await?;
    if let YePluginResultValue::Success(Some(value)) = result {
        println!("updated did: {}", &value);
    }
    Ok(())
}

#[must_use]fn run_custom_function<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
    &'life0 mut self,
    method: &'life1 str,
    function: &'life2 str,
    options: &'life3 str,
    payload: &'life4 str
) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    'life4: 'async_trait,
    Self: 'async_trait, 
[src]

Runs a custom function, this allows to use Yes API for custom calls, that do not belong to Yes core functionality but may be required for a projects use cases.

Arguments

  • method - method to call a function for (e.g. “did:example”)
  • function - function to call (e.g. “test connection”)
  • options - JSON string with additional information supporting the request (e.g. authentication data)
  • payload - JSON string with information for the request (e.g. actual data to write)

Example

use ye::{YePlugin, YePluginResultValue};
// use some_crate:ExamplePlugin;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut ep: ExamplePlugin = ExamplePlugin::new();
    let result = ep.run_custom_function("did:example", "test connection", "", "").await?;
    if let YePluginResultValue::Success(Some(value)) = result {
        println!("connection status: {}", &value);
    }
    Ok(())
}

#[must_use]fn vc_zkp_create_credential_definition<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 mut self,
    did_method: &'life1 str,
    options: &'life2 str,
    payload: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 
[src]

Creates a new zero-knowledge proof credential definition. A credential definition holds cryptographic key material and is needed by an issuer to issue a credential, thus needs to be created before issuance. A credential definition is always bound to one credential schema.

Arguments

  • method - method to create a credential definition for (e.g. “did:example”)
  • options - JSON string with additional information supporting the request (e.g. authentication data)
  • payload - JSON string with information for the request (e.g. actual data to write)

Example

use ye::{YePlugin, YePluginResultValue};
// use some_crate:ExamplePlugin;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut ep: ExamplePlugin = ExamplePlugin::new();
    let result = ep.vc_zkp_create_credential_definition("did:example", "", "").await?;
    if let YePluginResultValue::Success(Some(value)) = result {
        println!("successfully created a credential definition: {}", &value);
    }
    Ok(())
}

#[must_use]fn vc_zkp_create_credential_offer<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 mut self,
    method: &'life1 str,
    options: &'life2 str,
    payload: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 
[src]

Creates a new zero-knowledge proof credential offer. This message is the response to a credential proposal.

Arguments

  • method - method to create a credential offer for (e.g. “did:example”)
  • options - JSON string with additional information supporting the request (e.g. authentication data)
  • payload - JSON string with information for the request (e.g. actual data to write)

Example

use ye::{YePlugin, YePluginResultValue};
// use some_crate:ExamplePlugin;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut ep: ExamplePlugin = ExamplePlugin::new();
    let result = ep.vc_zkp_create_credential_offer("did:example", "", "").await?;
    if let YePluginResultValue::Success(Some(value)) = result {
        println!("created a credential offer: {}", &value);
    }
    Ok(())
}

#[must_use]fn vc_zkp_create_credential_proposal<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 mut self,
    method: &'life1 str,
    options: &'life2 str,
    payload: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 
[src]

Creates a new zero-knowledge proof credential proposal. This message is the first in the credential issuance flow.

Arguments

  • method - method to create a credential proposal for (e.g. “did:example”)
  • options - JSON string with additional information supporting the request (e.g. authentication data)
  • payload - JSON string with information for the request (e.g. actual data to write)

Example

use ye::{YePlugin, YePluginResultValue};
// use some_crate:ExamplePlugin;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut ep: ExamplePlugin = ExamplePlugin::new();
    let result = ep.vc_zkp_create_credential_proposal("did:example", "", "").await?;
    if let YePluginResultValue::Success(Some(value)) = result {
        println!("created a credential proposal: {}", &value);
    }
    Ok(())
}

#[must_use]fn vc_zkp_create_credential_schema<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 mut self,
    method: &'life1 str,
    options: &'life2 str,
    payload: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 
[src]

Creates a new zero-knowledge proof credential schema. The schema specifies properties a credential includes, both optional and mandatory.

Arguments

  • method - method to create a credential schema for (e.g. “did:example”)
  • options - JSON string with additional information supporting the request (e.g. authentication data)
  • payload - JSON string with information for the request (e.g. actual data to write)

Example

use ye::{YePlugin, YePluginResultValue};
// use some_crate:ExamplePlugin;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut ep: ExamplePlugin = ExamplePlugin::new();
    let result = ep.vc_zkp_create_credential_schema("did:example", "", "").await?;
    if let YePluginResultValue::Success(Some(value)) = result {
        println!("created a credential schema: {}", &value);
    }
    Ok(())
}

#[must_use]fn vc_zkp_create_revocation_registry_definition<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 mut self,
    method: &'life1 str,
    options: &'life2 str,
    payload: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 
[src]

Creates a new revocation registry definition. The definition consists of a public and a private part. The public part holds the cryptographic material needed to create non-revocation proofs. The private part needs to reside with the registry owner and is used to revoke credentials.

Arguments

  • method - method to create a revocation registry definition for (e.g. “did:example”)
  • options - JSON string with additional information supporting the request (e.g. authentication data)
  • payload - JSON string with information for the request (e.g. actual data to write)

Example

use ye::{YePlugin, YePluginResultValue};
// use some_crate:ExamplePlugin;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut ep: ExamplePlugin = ExamplePlugin::new();
    let result = ep.vc_zkp_create_revocation_registry_definition("did:example", "", "").await?;
    if let YePluginResultValue::Success(Some(value)) = result {
        println!("created a revocation registry definition: {}", &value);
    }
    Ok(())
}

#[must_use]fn vc_zkp_update_revocation_registry<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 mut self,
    method: &'life1 str,
    options: &'life2 str,
    payload: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 
[src]

Updates a revocation registry for a zero-knowledge proof. This step is necessary after revocation one or more credentials.

Arguments

  • method - method to update a revocation registry for (e.g. “did:example”)
  • options - JSON string with additional information supporting the request (e.g. authentication data)
  • payload - JSON string with information for the request (e.g. actual data to write)

Example

use ye::{YePlugin, YePluginResultValue};
// use some_crate:ExamplePlugin;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut ep: ExamplePlugin = ExamplePlugin::new();
    let result = ep.vc_zkp_update_revocation_registry("did:example", "", "").await?;
    if let YePluginResultValue::Success(Some(value)) = result {
        println!("updated revocation registry: {}", &value);
    }
    Ok(())
}

#[must_use]fn vc_zkp_issue_credential<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 mut self,
    method: &'life1 str,
    options: &'life2 str,
    payload: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 
[src]

Issues a new credential. This requires an issued schema, credential definition, an active revocation registry and a credential request message.

Arguments

  • method - method to issue a credential for (e.g. “did:example”)
  • options - JSON string with additional information supporting the request (e.g. authentication data)
  • payload - JSON string with information for the request (e.g. actual data to write)

Example

use ye::{YePlugin, YePluginResultValue};
// use some_crate:ExamplePlugin;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut ep: ExamplePlugin = ExamplePlugin::new();
    let result = ep.vc_zkp_issue_credential("did:example", "", "").await?;
    if let YePluginResultValue::Success(Some(value)) = result {
        println!("issued credential: {}", &value);
    }
    Ok(())
}

#[must_use]fn vc_zkp_present_proof<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 mut self,
    method: &'life1 str,
    options: &'life2 str,
    payload: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 
[src]

Presents a proof for a zero-knowledge proof credential. A proof presentation is the response to a proof request.

Arguments

  • method - method to presents a proof for (e.g. “did:example”)
  • options - JSON string with additional information supporting the request (e.g. authentication data)
  • payload - JSON string with information for the request (e.g. actual data to write)

Example

use ye::{YePlugin, YePluginResultValue};
// use some_crate:ExamplePlugin;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut ep: ExamplePlugin = ExamplePlugin::new();
    let result = ep.vc_zkp_present_proof("did:example", "", "").await?;
    if let YePluginResultValue::Success(Some(value)) = result {
        println!("created a proof presentation: {}", &value);
    }
    Ok(())
}

#[must_use]fn vc_zkp_request_credential<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 mut self,
    method: &'life1 str,
    options: &'life2 str,
    payload: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 
[src]

Requests a credential. This message is the response to a credential offering.

Arguments

  • method - method to request a credential for (e.g. “did:example”)
  • options - JSON string with additional information supporting the request (e.g. authentication data)
  • payload - JSON string with information for the request (e.g. actual data to write)

Example

use ye::{YePlugin, YePluginResultValue};
// use some_crate:ExamplePlugin;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut ep: ExamplePlugin = ExamplePlugin::new();
    let result = ep.vc_zkp_request_credential("did:example", "", "").await?;
    if let YePluginResultValue::Success(Some(value)) = result {
        println!("created credential request: {}", &value);
    }
    Ok(())
}

#[must_use]fn vc_zkp_request_proof<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 mut self,
    method: &'life1 str,
    options: &'life2 str,
    payload: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 
[src]

Requests a zero-knowledge proof for one or more credentials issued under one or more specific schemas.

Arguments

  • method - method to request a proof for (e.g. “did:example”)
  • options - JSON string with additional information supporting the request (e.g. authentication data)
  • payload - JSON string with information for the request (e.g. actual data to write)

Example

use ye::{YePlugin, YePluginResultValue};
// use some_crate:ExamplePlugin;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut ep: ExamplePlugin = ExamplePlugin::new();
    let result = ep.vc_zkp_request_proof("did:example", "", "").await?;
    if let YePluginResultValue::Success(Some(value)) = result {
        println!("created proof request: {}", &value);
    }
    Ok(())
}

#[must_use]fn vc_zkp_revoke_credential<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 mut self,
    method: &'life1 str,
    options: &'life2 str,
    payload: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 
[src]

Revokes a credential. After revocation the published revocation registry needs to be updated with information returned by this function.

Arguments

  • method - method to revoke a credential for (e.g. “did:example”)
  • options - JSON string with additional information supporting the request (e.g. authentication data)
  • payload - JSON string with information for the request (e.g. actual data to write)

Example

use ye::{YePlugin, YePluginResultValue};
// use some_crate:ExamplePlugin;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut ep: ExamplePlugin = ExamplePlugin::new();
    let result = ep.vc_zkp_revoke_credential("did:example", "", "").await?;
    if let YePluginResultValue::Success(Some(value)) = result {
        println!("revoked credential: {}", &value);
    }
    Ok(())
}

#[must_use]fn vc_zkp_verify_proof<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 mut self,
    method: &'life1 str,
    options: &'life2 str,
    payload: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<YePluginResultValue<Option<String>>, Box<dyn Error>>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 
[src]

Verifies one or multiple proofs sent in a proof presentation.

Arguments

  • method - method to verify a proof for (e.g. “did:example”)
  • options - JSON string with additional information supporting the request (e.g. authentication data)
  • payload - JSON string with information for the request (e.g. actual data to write)

Example

use ye::{YePlugin, YePluginResultValue};
// use some_crate:ExamplePlugin;
async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut ep: ExamplePlugin = ExamplePlugin::new();
    let result = ep.vc_zkp_verify_proof("did:example", "", "").await?;
    if let YePluginResultValue::Success(Some(value)) = result {
        println!("verified proof: {}", &value);
    }
    Ok(())
}
Loading content...

Implementors

Loading content...