From 7eda815adbe417e0218827e700e90d95c947108f Mon Sep 17 00:00:00 2001 From: Matt Gibson Date: Thu, 18 Dec 2025 10:30:43 -0800 Subject: [PATCH] re-export akd_storage vrf configuration --- akd/crates/akd_storage/src/lib.rs | 2 +- akd/crates/common/src/config/mod.rs | 3 +- akd/crates/common/src/config/vrf_config.rs | 34 ---------------------- akd/crates/common/src/lib.rs | 3 -- akd/crates/common/src/vrf_type.rs | 24 --------------- 5 files changed, 2 insertions(+), 64 deletions(-) delete mode 100644 akd/crates/common/src/config/vrf_config.rs delete mode 100644 akd/crates/common/src/vrf_type.rs diff --git a/akd/crates/akd_storage/src/lib.rs b/akd/crates/akd_storage/src/lib.rs index 4de50e8b6c..ce438f6d64 100644 --- a/akd/crates/akd_storage/src/lib.rs +++ b/akd/crates/akd_storage/src/lib.rs @@ -15,7 +15,7 @@ use crate::ms_sql::MsSql; pub mod akd_storage_config; pub mod db_config; pub mod ms_sql; -mod vrf_key_config; +pub mod vrf_key_config; pub mod vrf_key_database; /// Enum to represent different database types supported by the storage layer. diff --git a/akd/crates/common/src/config/mod.rs b/akd/crates/common/src/config/mod.rs index 5845bae535..f0efb0d00f 100644 --- a/akd/crates/common/src/config/mod.rs +++ b/akd/crates/common/src/config/mod.rs @@ -1,10 +1,9 @@ use thiserror::Error; mod storage_manager_config; -mod vrf_config; +pub use akd_storage::vrf_key_config::VrfKeyConfig; pub use storage_manager_config::*; -pub use vrf_config::*; #[derive(Error, Debug)] pub enum ConfigError { diff --git a/akd/crates/common/src/config/vrf_config.rs b/akd/crates/common/src/config/vrf_config.rs deleted file mode 100644 index cdd1bdd708..0000000000 --- a/akd/crates/common/src/config/vrf_config.rs +++ /dev/null @@ -1,34 +0,0 @@ -use serde::{Deserialize, Serialize}; - -use crate::config::ConfigError; -use crate::VrfStorageType; - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(tag = "type")] -pub enum VrfConfig { - HardCodedAkdVRF, - ConstantConfigurableVRF { key_material: String }, -} - -impl TryFrom<&VrfConfig> for VrfStorageType { - type Error = ConfigError; - fn try_from(config: &VrfConfig) -> Result { - match config { - VrfConfig::HardCodedAkdVRF => Ok(VrfStorageType::HardCodedAkdVRF), - VrfConfig::ConstantConfigurableVRF { key_material } => { - let key_material = - hex::decode(key_material).map_err(ConfigError::InvalidVrfKeyMaterialHex)?; - - if key_material.len() != 32 { - return Err(ConfigError::VrfKeyMaterialInvalidLength { - actual: key_material.len(), - }); - } - - Ok(VrfStorageType::ConstantConfigurableVRF { - key_material: key_material.clone(), - }) - } - } - } -} diff --git a/akd/crates/common/src/lib.rs b/akd/crates/common/src/lib.rs index dc7481bb01..ef68c36943 100644 --- a/akd/crates/common/src/lib.rs +++ b/akd/crates/common/src/lib.rs @@ -1,4 +1 @@ pub mod config; -mod vrf_type; - -pub use vrf_type::VrfStorageType; diff --git a/akd/crates/common/src/vrf_type.rs b/akd/crates/common/src/vrf_type.rs deleted file mode 100644 index 4d2c63282b..0000000000 --- a/akd/crates/common/src/vrf_type.rs +++ /dev/null @@ -1,24 +0,0 @@ -use akd::ecvrf::{HardCodedAkdVRF, VRFKeyStorage, VrfError}; -use async_trait::async_trait; - -#[derive(Debug, Clone)] -pub enum VrfStorageType { - /// **WARNING**: Do not use this in production systems. This is only for testing and debugging. - /// This is a version of VRFKeyStorage for testing purposes, which uses the example from the VRF crate. - /// - /// const KEY_MATERIAL: &str = "c9afa9d845ba75166b5c215767b1d6934e50c3db36e89b127b8a622b120f6721"; - HardCodedAkdVRF, - ConstantConfigurableVRF { - key_material: Vec, - }, -} - -#[async_trait] -impl VRFKeyStorage for VrfStorageType { - async fn retrieve(&self) -> Result, VrfError> { - match self { - VrfStorageType::HardCodedAkdVRF => HardCodedAkdVRF.retrieve().await, - VrfStorageType::ConstantConfigurableVRF { key_material } => Ok(key_material.clone()), - } - } -}