pub struct NodeIdentity {
pub did: Did,
pub public_key: Vec<u8>,
pub stake: Option<u64>,
pub stake_registry: Option<String>,
/* private fields */
}Expand description
Node identity combining DID with cryptographic keypair
Used for authenticated node participation in the ZAP network.
Fields§
§did: DidThe node’s DID
public_key: Vec<u8>ML-DSA-65 public key bytes
stake: Option<u64>Optional staked amount (in smallest unit)
stake_registry: Option<String>Optional stake registry reference
Implementations§
Source§impl NodeIdentity
impl NodeIdentity
Sourcepub fn new(did: Did, public_key: Vec<u8>) -> Self
pub fn new(did: Did, public_key: Vec<u8>) -> Self
Create a new node identity from an existing DID and public key
Sourcepub fn generate() -> Result<Self>
pub fn generate() -> Result<Self>
Generate a new node identity
Returns an error when pq feature is disabled.
Sourcepub fn sign(&self, _message: &[u8]) -> Result<Vec<u8>>
pub fn sign(&self, _message: &[u8]) -> Result<Vec<u8>>
Sign a message with this node’s private key
Returns an error when pq feature is disabled.
Sourcepub fn verify(&self, _message: &[u8], _signature: &[u8]) -> Result<()>
pub fn verify(&self, _message: &[u8], _signature: &[u8]) -> Result<()>
Verify a signature against this node’s public key
Returns an error when pq feature is disabled.
Sourcepub fn with_stake(self, amount: u64) -> Self
pub fn with_stake(self, amount: u64) -> Self
Set the stake amount for this node
Sourcepub fn with_registry(self, registry: String) -> Self
pub fn with_registry(self, registry: String) -> Self
Set the stake registry reference
Sourcepub fn document(&self) -> Result<DidDocument>
pub fn document(&self) -> Result<DidDocument>
Get the DID document for this node identity
Trait Implementations§
Source§impl Clone for NodeIdentity
impl Clone for NodeIdentity
Source§fn clone(&self) -> NodeIdentity
fn clone(&self) -> NodeIdentity
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto 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