[−][src]Struct vade::Vade
A Vade
instance is your single point of contact for interacting with DIDs and VCs.
Fields
plugins: Vec<Box<dyn VadePlugin>>
registered plugins
Implementations
impl Vade
[src]
pub fn new() -> Self
[src]
Creates new Vade instance, vectors are initialized as empty.
pub async fn did_create<'_, '_, '_, '_>(
&'_ mut self,
did_method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
[src]
&'_ mut self,
did_method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
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 requestoptions
- 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 vade::Vade; async fn example() { let mut vade = Vade::new(); // // register example plugin e.g. with // vade.register_plugin(example_plugin); let results = vade.did_create("did:example", "", "").await.unwrap(); if !results.is_empty() { println!("created new did: {}", results[0].as_ref().unwrap()); } }
pub async fn did_resolve<'_, '_>(
&'_ mut self,
did: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
[src]
&'_ mut self,
did: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
Fetch data about a DID. This usually returns a DID document.
Arguments
did
- did to fetch data for
Example
use vade::Vade; async fn example() { let mut vade = Vade::new(); // // register example plugin e.g. with // vade.register_plugin(example_plugin); let results = vade.did_resolve("did:example:123").await.unwrap(); if !results.is_empty() { println!("got did: {}", results[0].as_ref().unwrap()); } }
pub async fn did_update<'_, '_, '_, '_>(
&'_ mut self,
did: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
[src]
&'_ mut self,
did: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
Updates data related to a DID. May also persist a DID document for it, depending on plugin implementation.
Arguments
did
- DID to update data foroptions
- 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 vade::Vade; async fn example() { let mut vade = Vade::new(); // // register example plugin e.g. with // vade.register_plugin(example_plugin); let results = vade.did_update("did:example", "", "").await.unwrap(); if !results.is_empty() { println!("did successfully updated: {}", results[0].as_ref().unwrap()); } }
pub fn register_plugin(&mut self, plugin: Box<dyn VadePlugin>)
[src]
Registers a new plugin. See VadePlugin
for details about how they work.
Arguments
plugin
- plugin to register
Example
use vade::Vade; // use some_crate::ExamplePlugin; async fn did_did_update() { let mut vade = Vade::new(); let mut example_plugin = ExamplePlugin::new(); vade.register_plugin(Box::from(example_plugin)); let results = vade.did_create("did:example", "", "").await.unwrap(); if !results.is_empty() { println!("did successfully updated: {}", results[0].as_ref().unwrap()); } }
pub async fn vc_zkp_create_credential_definition<'_, '_, '_, '_>(
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
[src]
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
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 vade::Vade; async fn example() { let mut vade = Vade::new(); // // register example plugin e.g. with // vade.register_plugin(example_plugin); let results = vade.vc_zkp_create_credential_definition("did:example", "", "").await.unwrap(); if !results.is_empty() { println!("created a credential definition: {}", results[0].as_ref().unwrap()); } }
pub async fn vc_zkp_create_credential_offer<'_, '_, '_, '_>(
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
[src]
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
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 vade::Vade; async fn example() { let mut vade = Vade::new(); // // register example plugin e.g. with // vade.register_plugin(example_plugin); let results = vade.vc_zkp_create_credential_offer("did:example", "", "").await.unwrap(); if !results.is_empty() { println!("created a credential offer: {}", results[0].as_ref().unwrap()); } }
pub async fn vc_zkp_create_credential_proposal<'_, '_, '_, '_>(
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
[src]
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
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 vade::Vade; async fn example() { let mut vade = Vade::new(); // // register example plugin e.g. with // vade.register_plugin(example_plugin); let results = vade.vc_zkp_create_credential_proposal("did:example", "", "").await.unwrap(); if !results.is_empty() { println!("created a credential proposal: {}", results[0].as_ref().unwrap()); } }
pub async fn vc_zkp_create_credential_schema<'_, '_, '_, '_>(
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
[src]
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
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 vade::Vade; async fn example() { let mut vade = Vade::new(); // // register example plugin e.g. with // vade.register_plugin(example_plugin); let results = vade.vc_zkp_create_credential_schema("did:example", "", "").await.unwrap(); if !results.is_empty() { println!("created a credential schema: {}", results[0].as_ref().unwrap()); } }
pub async fn vc_zkp_create_revocation_registry_definition<'_, '_, '_, '_>(
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
[src]
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
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 vade::Vade; async fn example() { let mut vade = Vade::new(); // // register example plugin e.g. with // vade.register_plugin(example_plugin); let results = vade.vc_zkp_create_revocation_registry_definition("did:example", "", "").await.unwrap(); if !results.is_empty() { println!("created a revocation registry definition: {}", results[0].as_ref().unwrap()); } }
pub async fn vc_zkp_update_revocation_registry<'_, '_, '_, '_>(
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
[src]
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
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 vade::Vade; async fn example() { let mut vade = Vade::new(); // // register example plugin e.g. with // vade.register_plugin(example_plugin); let results = vade.vc_zkp_update_revocation_registry("did:example", "", "").await.unwrap(); if !results.is_empty() { println!("updated revocation registry: {}", results[0].as_ref().unwrap()); } }
pub async fn vc_zkp_issue_credential<'_, '_, '_, '_>(
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
[src]
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
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 vade::Vade; async fn example() { let mut vade = Vade::new(); // // register example plugin e.g. with // vade.register_plugin(example_plugin); let results = vade.vc_zkp_issue_credential("did:example", "", "").await.unwrap(); if !results.is_empty() { println!("issued credential: {}", results[0].as_ref().unwrap()); } }
pub async fn vc_zkp_present_proof<'_, '_, '_, '_>(
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
[src]
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
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 vade::Vade; async fn example() { let mut vade = Vade::new(); // // register example plugin e.g. with // vade.register_plugin(example_plugin); let results = vade.vc_zkp_present_proof("did:example", "", "").await.unwrap(); if !results.is_empty() { println!("created a proof presentation: {}", results[0].as_ref().unwrap()); } }
pub async fn vc_zkp_request_credential<'_, '_, '_, '_>(
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
[src]
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
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 vade::Vade; async fn example() { let mut vade = Vade::new(); // // register example plugin e.g. with // vade.register_plugin(example_plugin); let results = vade.vc_zkp_request_credential("did:example", "", "").await.unwrap(); if !results.is_empty() { println!("created credential request: {}", results[0].as_ref().unwrap()); } }
pub async fn vc_zkp_request_proof<'_, '_, '_, '_>(
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
[src]
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
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 vade::Vade; async fn example() { let mut vade = Vade::new(); // // register example plugin e.g. with // vade.register_plugin(example_plugin); let results = vade.vc_zkp_request_proof("did:example", "", "").await.unwrap(); if !results.is_empty() { println!("created proof request: {}", results[0].as_ref().unwrap()); } }
pub async fn vc_zkp_revoke_credential<'_, '_, '_, '_>(
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
[src]
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
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 vade::Vade; async fn example() { let mut vade = Vade::new(); // // register example plugin e.g. with // vade.register_plugin(example_plugin); let results = vade.vc_zkp_revoke_credential("did:example", "", "").await.unwrap(); if !results.is_empty() { println!("revoked credential: {}", results[0].as_ref().unwrap()); } }
pub async fn vc_zkp_verify_proof<'_, '_, '_, '_>(
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
[src]
&'_ mut self,
method: &'_ str,
options: &'_ str,
payload: &'_ str
) -> Result<Vec<Option<String>>, Box<dyn Error>>
Verifies a 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 vade::Vade; async fn example() { let mut vade = Vade::new(); // // register example plugin e.g. with // vade.register_plugin(example_plugin); let results = vade.vc_zkp_verify_proof("did:example", "", "").await.unwrap(); if !results.is_empty() { println!("verified proof: {}", results[0].as_ref().unwrap()); } }
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Vade
impl !Send for Vade
impl !Sync for Vade
impl Unpin for Vade
impl !UnwindSafe for Vade
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,