dax_core 0.1.0

Common data types for dax-rs
Documentation
// SPDX-FileCopyrightText: 2024 Yarmo Mackenbach
//
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

use std::io;

use serde_json::Value;
use thiserror::Error;

/// Identity profile containing claims
pub trait ProofFetcher {
    fn fetch(&self) -> Result<String, ProofFetchError>;
}

/// Error from fetching proofs
#[derive(Error, Debug)]
pub enum ProofFetchError {
    #[error("io error")]
    Io(#[from] io::Error),
    #[error("transport error")]
    Transport,
    #[error("http status error")]
    HttpStatus(u16),
    #[error("unknown proof fetching error")]
    Unknown,
}

/// Data fetched from service and that could contain an identity proof
#[derive(Debug)]
pub enum FetchedData {
    String(String),
    ArrayOfStrings(Vec<String>),
    Json(Value),
}