pub struct EntityId(pub [u8; 32]);Expand description
Entity identity — a 32-byte ed25519 public key.
This is the canonical identity for a node in the mesh. All other identifiers (node_id, origin_hash) are derived from this.
Tuple Fields§
§0: [u8; 32]Implementations§
Source§impl EntityId
impl EntityId
Sourcepub fn from_bytes(bytes: [u8; 32]) -> EntityId
pub fn from_bytes(bytes: [u8; 32]) -> EntityId
Create an EntityId from raw bytes.
Sourcepub fn origin_hash(&self) -> u64
pub fn origin_hash(&self) -> u64
Derive the 8-byte origin hash for application-layer
accounting (DashMap keys, CausalLink, EventMeta,
migration registries). The per-packet
NetHeader::origin_hash stays u32 (routing fast-path);
callers there downcast kp.origin_hash() as u32.
Sourcepub fn node_id(&self) -> u64
pub fn node_id(&self) -> u64
Derive the 8-byte node ID for swarm/routing.
This replaces arbitrary u64 node IDs with cryptographically derived ones, binding node identity to the entity keypair.
Sourcepub fn verifying_key(&self) -> Result<VerifyingKey, EntityError>
pub fn verifying_key(&self) -> Result<VerifyingKey, EntityError>
Get the ed25519 verifying key for signature verification.
Sourcepub fn verify(
&self,
message: &[u8],
signature: &Signature,
) -> Result<(), EntityError>
pub fn verify( &self, message: &[u8], signature: &Signature, ) -> Result<(), EntityError>
Verify a signature against this entity’s public key.
Uses verify_strict so that signature malleability (the
(R, S + L) variant permitted by the lax verify) is
rejected. Callers cache tokens / announcements keyed on the
signed bytes; accepting malleated variants would let the
same logical message appear under two different byte
encodings and bypass content-hash dedup.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for EntityId
impl<'de> Deserialize<'de> for EntityId
Source§fn deserialize<D>(
deserializer: D,
) -> Result<EntityId, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<EntityId, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for EntityId
Source§impl Serialize for EntityId
impl Serialize for EntityId
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl StructuralPartialEq for EntityId
Auto Trait Implementations§
impl Freeze for EntityId
impl RefUnwindSafe for EntityId
impl Send for EntityId
impl Sync for EntityId
impl Unpin for EntityId
impl UnsafeUnpin for EntityId
impl UnwindSafe for EntityId
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> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.