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§
- Aggregator client for the Certificate
- A in-memory cache for the certificate verifier.
- Implementation of a CertificateVerifier that can send feedbacks using the feedback mechanism.
Traits§
- API that defines how to validate certificates.
- API that defines how to cache certificates validation results.