pub struct NodeIdentity { /* private fields */ }Expand description
Core node identity with cryptographic keys
Implementations§
Source§impl NodeIdentity
impl NodeIdentity
Sourcepub fn to_user_id(&self) -> UserId
pub fn to_user_id(&self) -> UserId
Convert this identity’s NodeId to a UserId for use in adaptive modules
Sourcepub fn public_key(&self) -> &MlDsaPublicKey
pub fn public_key(&self) -> &MlDsaPublicKey
Get public key
Sourcepub fn secret_key_bytes(&self) -> &[u8] ⓘ
pub fn secret_key_bytes(&self) -> &[u8] ⓘ
Get secret key bytes (for raw key authentication)
Sourcepub fn sign(&self, message: &[u8]) -> Result<MlDsaSignature>
pub fn sign(&self, message: &[u8]) -> Result<MlDsaSignature>
Sign a message
Sourcepub fn verify(&self, message: &[u8], signature: &MlDsaSignature) -> Result<bool>
pub fn verify(&self, message: &[u8], signature: &MlDsaSignature) -> Result<bool>
Verify a signature
Sourcepub fn to_public(&self) -> PublicNodeIdentity
pub fn to_public(&self) -> PublicNodeIdentity
Create a public version of this identity (safe to clone)
Source§impl NodeIdentity
impl NodeIdentity
Sourcepub fn from_secret_key(_secret_key: MlDsaSecretKey) -> Result<Self>
pub fn from_secret_key(_secret_key: MlDsaSecretKey) -> Result<Self>
Create an identity from an existing secret key Note: Currently not supported as ant-quic doesn’t provide public key derivation from secret key This would require storing both keys together
Source§impl NodeIdentity
impl NodeIdentity
Sourcepub async fn save_to_file(&self, path: &Path) -> Result<()>
pub async fn save_to_file(&self, path: &Path) -> Result<()>
Save identity to a JSON file (async)
Sourcepub async fn load_from_file(path: &Path) -> Result<Self>
pub async fn load_from_file(path: &Path) -> Result<Self>
Load identity from a JSON file (async)
Source§impl NodeIdentity
impl NodeIdentity
Sourcepub fn export(&self) -> IdentityData
pub fn export(&self) -> IdentityData
Export identity for persistence
Sourcepub fn import(data: &IdentityData) -> Result<Self>
pub fn import(data: &IdentityData) -> Result<Self>
Import identity from persisted data
Auto Trait Implementations§
impl Freeze for NodeIdentity
impl RefUnwindSafe for NodeIdentity
impl Send for NodeIdentity
impl Sync for NodeIdentity
impl Unpin for NodeIdentity
impl UnwindSafe for NodeIdentity
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