pub struct PublicKey(/* private fields */);Expand description
Public key for peer identity, key sharing, and update provenance
A thin wrapper around Iroh’s PublicKey, representing the public part of an Ed25519 keypair.
This key serves multiple purposes:
- Peer Identity: Uniquely identifies a peer in the network (equivalent to Iroh’s NodeId)
- Key Sharing: Used in ECDH key exchange (after conversion to X25519)
- Access Control: Listed in bucket shares to grant access
§Examples
ⓘ
let secret_key = SecretKey::generate();
let public_key = secret_key.public();
// Serialize to hex for storage/transmission
let hex = public_key.to_hex();
let recovered = PublicKey::from_hex(&hex)?;Implementations§
Methods from Deref<Target = PPublicKey>§
pub const LENGTH: usize = 32usize
Sourcepub fn public(&self) -> VerifyingKey
pub fn public(&self) -> VerifyingKey
Returns the VerifyingKey for this PublicKey.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PublicKey
impl<'de> Deserialize<'de> for PublicKey
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<PublicKey> for PublicKey
impl From<PublicKey> for PublicKey
Source§fn from(key: PPublicKey) -> Self
fn from(key: PPublicKey) -> Self
Converts to this type from the input type.
Source§impl Ord for PublicKey
impl Ord for PublicKey
Source§impl PartialOrd for PublicKey
impl PartialOrd for PublicKey
impl Copy for PublicKey
impl Eq for PublicKey
impl StructuralPartialEq for PublicKey
Auto Trait Implementations§
impl Freeze for PublicKey
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<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
Compare self to
key and return true if they are equal.