Expand description

A client which retrieves and validates certificates from an Aggregator.

In order to do so it defines a CertificateClient exposes the following features:

  • get: get a certificate data from its hash
  • list: get the list of available certificates
  • verify_chain: verify a certificate chain

§Get a certificate

To get a certificate using the ClientBuilder.

use mithril_client::ClientBuilder;

let client = ClientBuilder::aggregator("YOUR_AGGREGATOR_ENDPOINT", "YOUR_GENESIS_VERIFICATION_KEY").build()?;
let certificate = client.certificate().get("CERTIFICATE_HASH").await?.unwrap();

println!("Certificate hash={}, signed_message={}", certificate.hash, certificate.signed_message);

§List available certificates

To list available certificates using the ClientBuilder.

use mithril_client::ClientBuilder;

let client = mithril_client::ClientBuilder::aggregator("YOUR_AGGREGATOR_ENDPOINT", "YOUR_GENESIS_VERIFICATION_KEY").build()?;
let certificates = client.certificate().list().await?;

for certificate in certificates {
    println!("Certificate hash={}, signed_message={}", certificate.hash, certificate.signed_message);
}

§Validate a certificate chain

To validate a certificate using the ClientBuilder.

use mithril_client::ClientBuilder;

let client = ClientBuilder::aggregator("YOUR_AGGREGATOR_ENDPOINT", "YOUR_GENESIS_VERIFICATION_KEY").build()?;
let certificate = client.certificate().verify_chain("CERTIFICATE_HASH").await?;

println!("Chain of Certificate (hash: {}) is valid", certificate.hash);

Structs§

Traits§