LocalIdentity

Enum LocalIdentity 

Source
pub enum LocalIdentity<I: NodeIdentity> {
    LongTerm(I),
    Ephemeral(SoftwareIdentity),
}
Expand description

A local node identity that the Mac coordinator owns and acts on behalf of.

UMSH nodes are identified by Ed25519 public keys. An identity provides the public key and the ability to derive pairwise keys via ECDH with the corresponding private key. Two variants are supported:

  • LongTerm(I) — wraps the platform-supplied I: NodeIdentity, which is typically backed by secure-element storage, an HSM, or a platform keystore. Long-term identities persist across reboots; their frame counters are saved to the umsh_hal::CounterStore so that replay protection remains valid after a power cycle.

  • Ephemeral — wraps an in-memory SoftwareIdentity generated fresh at runtime for Perfect Forward Secrecy sessions. Because the key material itself vanishes on power loss, ephemeral identities do not persist their frame counters; replay protection is meaningful only within a single session. Requires the software-crypto crate feature.

Use LocalIdentity::public_key or LocalIdentity::hint to inspect the address presented to the network without matching on the variant.

Variants§

§

LongTerm(I)

Long-term platform identity.

§

Ephemeral(SoftwareIdentity)

Software ephemeral identity used for PFS sessions.

Implementations§

Source§

impl<I: NodeIdentity> LocalIdentity<I>

Source

pub fn public_key(&self) -> &PublicKey

Return the public key for this identity.

Source

pub fn hint(&self) -> NodeHint

Return the derived node hint for this identity.

Source

pub fn is_ephemeral(&self) -> bool

Return whether this identity is ephemeral.

Trait Implementations§

Source§

impl<I: NodeIdentity> From<I> for LocalIdentity<I>

Source§

fn from(value: I) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<I> Freeze for LocalIdentity<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for LocalIdentity<I>
where I: RefUnwindSafe,

§

impl<I> Send for LocalIdentity<I>
where I: Send,

§

impl<I> Sync for LocalIdentity<I>
where I: Sync,

§

impl<I> Unpin for LocalIdentity<I>
where I: Unpin,

§

impl<I> UnwindSafe for LocalIdentity<I>
where I: UnwindSafe,

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> 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, 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.