dat 2.2.0

DAT - Distributed Access Token
Documentation
use crate::error::DatError;
use std::str::FromStr;
use strum_macros::Display;

#[repr(u8)]
#[derive(Debug, Display, Clone, Copy, Eq, PartialEq)]
pub enum DatSignatureAlgorithm {
    P256,
    P384,
    P521,
}

impl FromStr for DatSignatureAlgorithm {
    type Err = DatError;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s {
            "P256" => Ok(DatSignatureAlgorithm::P256),
            "P384" => Ok(DatSignatureAlgorithm::P384),
            "P521" => Ok(DatSignatureAlgorithm::P521),
            _ => Err(DatError::UnknownDatSignatureAlgorithm),
        }
    }
}