use pot_o_core::TribeResult;
use pot_o_mining::Challenge;
use crate::peer_network::PeerInfo;
pub trait ProofAuthority: Send + Sync {
fn verify_miner_identity(&self, pubkey: &str, signature: &[u8]) -> TribeResult<bool>;
fn sign_challenge(&self, challenge: &Challenge) -> TribeResult<Vec<u8>>;
fn validate_node_connection(&self, peer: &PeerInfo) -> TribeResult<bool>;
}
pub struct Ed25519Authority;
impl ProofAuthority for Ed25519Authority {
fn verify_miner_identity(&self, _pubkey: &str, _signature: &[u8]) -> TribeResult<bool> {
Ok(true)
}
fn sign_challenge(&self, _challenge: &Challenge) -> TribeResult<Vec<u8>> {
Ok(vec![0u8; 64])
}
fn validate_node_connection(&self, _peer: &PeerInfo) -> TribeResult<bool> {
Ok(true)
}
}
#[derive(Debug, Clone)]
pub struct MtlsConfig {
pub ca_cert_path: String,
pub node_cert_path: String,
pub node_key_path: String,
}
pub struct MtlsAuthority {
pub config: MtlsConfig,
}
impl ProofAuthority for MtlsAuthority {
fn verify_miner_identity(&self, _pubkey: &str, _signature: &[u8]) -> TribeResult<bool> {
todo!("mTLS miner identity verification not yet implemented")
}
fn sign_challenge(&self, _challenge: &Challenge) -> TribeResult<Vec<u8>> {
todo!("mTLS challenge signing not yet implemented")
}
fn validate_node_connection(&self, _peer: &PeerInfo) -> TribeResult<bool> {
todo!("mTLS node connection validation not yet implemented")
}
}
pub struct HmacDeviceAuth {
pub shared_secret: Vec<u8>,
}
impl ProofAuthority for HmacDeviceAuth {
fn verify_miner_identity(&self, _pubkey: &str, _signature: &[u8]) -> TribeResult<bool> {
todo!("HMAC device identity verification not yet implemented")
}
fn sign_challenge(&self, _challenge: &Challenge) -> TribeResult<Vec<u8>> {
todo!("HMAC challenge signing not yet implemented")
}
fn validate_node_connection(&self, _peer: &PeerInfo) -> TribeResult<bool> {
todo!("HMAC node connection validation not yet implemented")
}
}