pub struct NetworkMetaKey(pub [u8; 32]);Expand description
32-byte symmetric key shared by all nodes in a given network.
This key is a randomly generated secret — it is never derived from the
network name. It is stored locally in network_keys.json and distributed
to new members exclusively via signed+encrypted invite tokens.
Used to encrypt/decrypt file metadata (names, …) stored in manifests.
Tuple Fields§
§0: [u8; 32]Implementations§
Source§impl NetworkMetaKey
impl NetworkMetaKey
Sourcepub fn generate() -> Self
pub fn generate() -> Self
Generate a new random 32-byte network key.
Call once when creating a network. The key must then be distributed via invite tokens to all other members.
Sourcepub fn load(network_id: &str) -> BpResult<Option<Self>>
pub fn load(network_id: &str) -> BpResult<Option<Self>>
Load the key for network_id from local storage.
Returns None if this node has never joined that network
(i.e. no key has been stored yet).
Sourcepub fn save(&self, network_id: &str) -> BpResult<()>
pub fn save(&self, network_id: &str) -> BpResult<()>
Persist this key for network_id to local storage.
Safe to call multiple times — overwrites an existing entry for the
same network_id. Never logs or surfaces the key bytes.
Sourcepub fn load_or_create(network_id: &str) -> BpResult<Self>
pub fn load_or_create(network_id: &str) -> BpResult<Self>
Load the key for network_id, generating and saving a new one if absent.
This is the production entry point used by the daemon when it joins or creates a network.
Trait Implementations§
Source§impl Clone for NetworkMetaKey
impl Clone for NetworkMetaKey
Source§fn clone(&self) -> NetworkMetaKey
fn clone(&self) -> NetworkMetaKey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NetworkMetaKey
impl Debug for NetworkMetaKey
Source§impl PartialEq for NetworkMetaKey
impl PartialEq for NetworkMetaKey
impl Eq for NetworkMetaKey
impl StructuralPartialEq for NetworkMetaKey
Auto Trait Implementations§
impl Freeze for NetworkMetaKey
impl RefUnwindSafe for NetworkMetaKey
impl Send for NetworkMetaKey
impl Sync for NetworkMetaKey
impl Unpin for NetworkMetaKey
impl UnwindSafe for NetworkMetaKey
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more