pub struct Destination {
pub hash: DestHash,
pub dest_type: DestinationType,
pub direction: Direction,
pub app_name: String,
pub aspects: Vec<String>,
pub identity_hash: Option<IdentityHash>,
pub public_key: Option<[u8; 64]>,
pub group_key: Option<Vec<u8>>,
pub proof_strategy: ProofStrategy,
}Expand description
A network destination (endpoint) for sending or receiving packets.
This is a pure data struct with no behavior — all operations
(register, announce, send) are methods on RnsNode.
Fields§
§hash: DestHashComputed destination hash.
dest_type: DestinationTypeType: Single, Group, or Plain.
direction: DirectionDirection: In (receiving) or Out (sending).
app_name: StringApplication name (e.g. “echo_app”).
aspects: Vec<String>Aspects (e.g. [“echo”, “request”]).
identity_hash: Option<IdentityHash>Identity hash of the owner (for SINGLE destinations).
public_key: Option<[u8; 64]>Full public key (64 bytes) of the remote peer (for OUT SINGLE destinations).
group_key: Option<Vec<u8>>Symmetric key for GROUP destinations (32 or 64 bytes).
proof_strategy: ProofStrategyHow to handle proofs for incoming packets.
Implementations§
Source§impl Destination
impl Destination
Sourcepub fn single_in(
app_name: &str,
aspects: &[&str],
identity_hash: IdentityHash,
) -> Self
pub fn single_in( app_name: &str, aspects: &[&str], identity_hash: IdentityHash, ) -> Self
Create an inbound SINGLE destination (for receiving encrypted packets).
identity_hash is the local identity that owns this destination.
Sourcepub fn single_out(
app_name: &str,
aspects: &[&str],
recalled: &AnnouncedIdentity,
) -> Self
pub fn single_out( app_name: &str, aspects: &[&str], recalled: &AnnouncedIdentity, ) -> Self
Create an outbound SINGLE destination (for sending encrypted packets).
recalled contains the remote peer’s identity data (from announce/recall).
Sourcepub fn plain(app_name: &str, aspects: &[&str]) -> Self
pub fn plain(app_name: &str, aspects: &[&str]) -> Self
Create a PLAIN destination (unencrypted, no identity).
Sourcepub fn group(app_name: &str, aspects: &[&str]) -> Self
pub fn group(app_name: &str, aspects: &[&str]) -> Self
Create a GROUP destination (symmetric encryption with pre-shared key).
No identity needed — the hash is based only on app_name + aspects, same as PLAIN. All members sharing the same key can encrypt/decrypt.
Sourcepub fn create_keys(&mut self)
pub fn create_keys(&mut self)
Generate a new random 64-byte symmetric key (AES-256) for this GROUP destination.
Sourcepub fn load_private_key(&mut self, key: Vec<u8>) -> Result<(), GroupKeyError>
pub fn load_private_key(&mut self, key: Vec<u8>) -> Result<(), GroupKeyError>
Load an existing symmetric key for this GROUP destination.
Key must be 32 bytes (AES-128) or 64 bytes (AES-256).
Sourcepub fn get_private_key(&self) -> Option<&[u8]>
pub fn get_private_key(&self) -> Option<&[u8]>
Retrieve the symmetric key bytes, if set.
Sourcepub fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>, GroupKeyError>
pub fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>, GroupKeyError>
Encrypt plaintext using this destination’s GROUP key.
Sourcepub fn decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>, GroupKeyError>
pub fn decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>, GroupKeyError>
Decrypt ciphertext using this destination’s GROUP key.
Sourcepub fn set_proof_strategy(self, strategy: ProofStrategy) -> Self
pub fn set_proof_strategy(self, strategy: ProofStrategy) -> Self
Set the proof strategy for this destination.
Trait Implementations§
Source§impl Clone for Destination
impl Clone for Destination
Source§fn clone(&self) -> Destination
fn clone(&self) -> Destination
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more