pub struct NodeIdentity {
pub ed25519_secret: [u8; 32],
pub wg_secret: [u8; 32],
}Expand description
The node’s persisted cryptographic identity.
Two independent 32-byte secrets: an ed25519 signing key (identity / challenge signing) and a Curve25519 WireGuard secret (transport / overlay addressing). Serialized to JSON for on-disk persistence.
Fields§
§ed25519_secret: [u8; 32]Raw 32-byte ed25519 signing (secret) key.
wg_secret: [u8; 32]Raw 32-byte Curve25519 WireGuard secret key.
Implementations§
Source§impl NodeIdentity
impl NodeIdentity
Sourcepub fn signing_key(&self) -> SigningKey
pub fn signing_key(&self) -> SigningKey
Reconstruct the ed25519 [SigningKey] from the stored secret bytes.
Sourcepub fn identity_pubkey_hex(&self) -> String
pub fn identity_pubkey_hex(&self) -> String
The node’s stable identity public key, lowercase hex (64 chars).
This is the ed25519 verifying key that peers use to check signatures on connection identifiers and challenge responses.
Sourcepub fn wireguard_pubkey_hex(&self) -> String
pub fn wireguard_pubkey_hex(&self) -> String
This node’s WireGuard public key, lowercase hex (64 chars).
Sourcepub fn overlay_addr(&self) -> String
pub fn overlay_addr(&self) -> String
The node’s overlay address, derived from its WireGuard public key.
This is an fd… ULA IPv6 string produced by
crate::connection_identifier::derive_overlay_addr.
Sourcepub fn load_or_create() -> Result<NodeIdentity, String>
pub fn load_or_create() -> Result<NodeIdentity, String>
Load the persisted node identity, or generate and persist a fresh one.
Reads app_meta_dir()/node_identity.json. If the file exists and parses,
it is returned as-is. Otherwise a new identity is generated from the OS
CSPRNG, written to that path (creating the parent directory as needed) as
pretty-printed JSON, and returned. All errors are mapped to String.
Available on all targets: mesh WG helpers remain native-only, but the Ed25519 apparatus identity is needed for multi-device person/fleet wiring.
Trait Implementations§
Source§impl Clone for NodeIdentity
impl Clone for NodeIdentity
Source§fn clone(&self) -> NodeIdentity
fn clone(&self) -> NodeIdentity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de> Deserialize<'de> for NodeIdentity
impl<'de> Deserialize<'de> for NodeIdentity
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for NodeIdentity
impl RefUnwindSafe for NodeIdentity
impl Send for NodeIdentity
impl Sync for NodeIdentity
impl Unpin for NodeIdentity
impl UnsafeUnpin for NodeIdentity
impl UnwindSafe for NodeIdentity
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<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