NodeIdentityProfile

Struct NodeIdentityProfile 

Source
pub struct NodeIdentityProfile {
    pub public_key: PublicKey,
    pub role: NodeRole,
    pub capabilities: NodeCapabilities,
    pub name: Option<String>,
    pub location: Option<NodeLocation>,
    pub altitude_m: Option<i32>,
    pub supported_regions: Option<Vec<u8>>,
    pub clock: fn() -> Option<u32>,
}
Expand description

This node’s own identity, used to answer Identity Requests.

Holds descriptive fields only — no signing key. Config-like fields (role, capabilities, name, supported_regions) are typically set once at bring-up; live fields (location, altitude_m) can be refreshed at any time via LocalNode::update_identity_profile, e.g. from a GPS task.

Fields§

§public_key: PublicKey

This node’s public key. Its hint is matched against a request’s FILTER_NODE_HINT; the key itself reaches the requester via the reply’s MAC source address, not the identity payload.

§role: NodeRole§capabilities: NodeCapabilities§name: Option<String>§location: Option<NodeLocation>§altitude_m: Option<i32>§supported_regions: Option<Vec<u8>>§clock: fn() -> Option<u32>

Where identity option 3 comes from: the current Unix time, or None on a node that does not know what time it is.

A source rather than a value, because option 3 dates the payload and every payload is built fresh — a stored number would be the time some earlier payload was built. It lives here so that the one canonical builder stamps every framing identically; a node with no clock keeps the default and simply omits the option.

Implementations§

Source§

impl NodeIdentityProfile

Source

pub fn new( public_key: PublicKey, role: NodeRole, capabilities: NodeCapabilities, ) -> Self

Create a minimal profile (role + capabilities), no descriptive options.

Source

pub fn with_name(self, name: impl Into<String>) -> Self

Set the display name (builder style).

Source

pub fn with_location(self, location: NodeLocation) -> Self

Set the geographic location (builder style).

Source

pub fn hint(&self) -> NodeHint

This node’s hint, derived from its public key.

Source

pub fn to_payload(&self, nonce: Option<u32>) -> NodeIdentityPayload

Build the (unsigned) identity payload this node advertises, stamping nonce into option 5.

The one canonical builder, deliberately shared by both framings of a node identity: the Identity Request reply, which carries a request nonce and is authenticated by the enclosing unicast, and the standalone signed blob, which carries no nonce and is authenticated by a detached signature. They are different objects on the wire and the same statement about the node; the difference must not be able to drift into the contents.

Trait Implementations§

Source§

impl Clone for NodeIdentityProfile

Source§

fn clone(&self) -> NodeIdentityProfile

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeIdentityProfile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.