pub struct ConsensusKey { /* private fields */ }Expand description
Consensus Key - reconstructed from BFT Council shards
Implementations§
Source§impl ConsensusKey
impl ConsensusKey
Sourcepub fn new(threshold: usize, total_shards: usize) -> Self
pub fn new(threshold: usize, total_shards: usize) -> Self
Create new consensus key manager
§Arguments
threshold- Minimum shards needed (k)total_shards- Total shards distributed (n)
Sourcepub fn generate_shards(key: &[u8; 32], n: usize) -> Vec<KeyShard>
pub fn generate_shards(key: &[u8; 32], n: usize) -> Vec<KeyShard>
Generate shards from a key
Simplified Shamir-style: XOR-based for demonstration In production: Use proper Shamir Secret Sharing
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if key is reconstructed
Sourcepub fn shard_count(&self) -> usize
pub fn shard_count(&self) -> usize
Get shard count
Auto Trait Implementations§
impl Freeze for ConsensusKey
impl RefUnwindSafe for ConsensusKey
impl Send for ConsensusKey
impl Sync for ConsensusKey
impl Unpin for ConsensusKey
impl UnwindSafe for ConsensusKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more