[][src]Struct vade::Vade

pub struct Vade {
    pub did_resolvers: Vec<Box<dyn DidResolver>>,
    pub loggers: Vec<Box<dyn Logger>>,
    pub vc_resolvers: Vec<Box<dyn VcResolver>>,
}

Vade library, that holds plugins and delegates calls to them.

Fields

did_resolvers: Vec<Box<dyn DidResolver>>

Vector of supported DID resolvers.

loggers: Vec<Box<dyn Logger>>

Vector of supported loggers. Logging will iterate through it and try to use every logger.

vc_resolvers: Vec<Box<dyn VcResolver>>

Vector of supported VC resolvers.

Methods

impl Vade[src]

pub fn new() -> Vade[src]

Creates new Vade instance, vectors are initialized as empty.

pub async fn check_did<'_, '_, '_>(
    &'_ mut self,
    did_name: &'_ str,
    value: &'_ str
) -> Result<(), Box<dyn Error>>
[src]

Checks given DID document against registered resolvers. A DID document is considered as valid if at least one did resolver confirms its validity. Resolvers may throw to indicate

  • that they are not responsible for this DID
  • that they consider this DID as invalid

Arguments

  • did_name - did_name to check document for
  • value - value to check

pub async fn check_vc<'_, '_, '_>(
    &'_ mut self,
    vc_id: &'_ str,
    value: &'_ str
) -> Result<(), Box<dyn Error>>
[src]

Checks given VC document against registered resolvers. A VC document is considered as valid if at least one vc resolver confirms its validity. Resolvers may throw to indicate

  • that they are not responsible for this VC
  • that they consider this VC as invalid

Arguments

  • vc_id - vc_id to check document for
  • value - value to check

pub async fn get_did_document<'_, '_>(
    &'_ self,
    did_name: &'_ str
) -> Result<String, Box<dyn Error>>
[src]

Gets document for given did name. If multiple plugins are registered, first successful response will be used. Request will fail if all plugins failed.

Arguments

  • did_name - did_name to fetch

pub async fn get_vc_document<'_, '_>(
    &'_ self,
    vc_name: &'_ str
) -> Result<String, Box<dyn Error>>
[src]

Gets document for given vc name. If multiple plugins are registered, first successful response will be used. Request will fail if all plugins failed.

Arguments

  • vc_name - vc_name to fetch

pub fn log(&self, message: &str, level: Option<&str>)[src]

Log given message. Logging will iterate through it and try to use every logger.

Note: This functionality is currently semi-obsoleted. It has been used for testing purposes and it is currently unclear wheter it will stay as it is or undergo further changes to allow to to fulfill its original role.

Arguments

  • message - message to log

pub fn register_did_resolver(&mut self, did_resolver: Box<dyn DidResolver>)[src]

Registers new DidResolver instance. Note, that did_resolver is given as Box to support dynamic avadegnment.

Arguments

  • did_resolver - an instance of a struct that implements DidResolver trait

pub fn register_logger(&mut self, logger: Box<dyn Logger>)[src]

Registers new Logger instance. Note, that logger is given as Box to support dynamic avadegnment.

Arguments

  • logger - an instance of a struct that implements Logger trait

pub fn register_vc_resolver(&mut self, vc_resolver: Box<dyn VcResolver>)[src]

Registers new VcdResolver instance. Note, that vc_resolver is given as Box to support dynamic avadegnment.

Arguments

  • vc_resolver - an instance of a struct that implements VcResolver trait

pub async fn set_did_document<'_, '_, '_>(
    &'_ mut self,
    did_name: &'_ str,
    value: &'_ str
) -> Result<(), Box<dyn Error>>
[src]

Sets document for given did name. If multiple plugins are registered, awaits completion of all actions. First plugin, that fails lets this request fail.

Arguments

  • did_name - did_name to set value for
  • value - value to set

pub async fn set_vc_document<'_, '_, '_>(
    &'_ mut self,
    vc_name: &'_ str,
    value: &'_ str
) -> Result<(), Box<dyn Error>>
[src]

Sets document for given vc name. If multiple plugins are registered, awaits completion of all actions. First plugin, that fails lets this request fail.

Arguments

  • vc_name - vc_name to set value for
  • value - value to set

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.