pub struct WireMessage {
pub destination: [u8; 16],
pub source: [u8; 16],
pub signature: Option<[u8; 64]>,
pub payload: Payload,
}Fields§
§destination: [u8; 16]§source: [u8; 16]§signature: Option<[u8; 64]>§payload: PayloadImplementations§
Source§impl WireMessage
impl WireMessage
pub fn new(destination: [u8; 16], source: [u8; 16], payload: Payload) -> Self
pub fn message_id(&self) -> [u8; 32]
pub fn try_message_id(&self) -> Result<[u8; 32], LxmfError>
pub fn sign(&mut self, signer: &PrivateIdentity) -> Result<(), LxmfError>
pub fn verify(&self, identity: &Identity) -> Result<bool, LxmfError>
pub fn pack(&self) -> Result<Vec<u8>, LxmfError>
pub fn pack_storage(&self) -> Result<Vec<u8>, LxmfError>
pub fn pack_storage_container( &self, state: MessageState, method: TransportMethod, transport_encrypted: bool, transport_encryption: Option<String>, ) -> Result<Vec<u8>, LxmfError>
pub fn unpack(bytes: &[u8]) -> Result<Self, LxmfError>
pub fn unpack_from_file(path: impl AsRef<Path>) -> Result<Self, LxmfError>
pub fn unpack_storage(bytes: &[u8]) -> Result<Self, LxmfError>
pub fn unpack_storage_from_file( path: impl AsRef<Path>, ) -> Result<Self, LxmfError>
pub fn pack_to_file(&self, path: impl AsRef<Path>) -> Result<(), LxmfError>
pub fn pack_storage_to_file( &self, path: impl AsRef<Path>, ) -> Result<(), LxmfError>
pub fn pack_propagation_with_rng<R: CryptoRngCore + Copy>( &self, destination: &Identity, timestamp: f64, rng: R, ) -> Result<Vec<u8>, LxmfError>
Sourcepub fn pack_propagation_with_options_and_rng<R: CryptoRngCore + Copy>(
&self,
destination: &Identity,
timestamp: f64,
propagation_stamp: Option<&[u8]>,
rng: R,
) -> Result<(Vec<u8>, [u8; 32]), LxmfError>
pub fn pack_propagation_with_options_and_rng<R: CryptoRngCore + Copy>( &self, destination: &Identity, timestamp: f64, propagation_stamp: Option<&[u8]>, rng: R, ) -> Result<(Vec<u8>, [u8; 32]), LxmfError>
Packs the propagation envelope for destination.
propagation_stamp is the LXMF proof-of-work anti-spam stamp
appended in cleartext after the encrypted payload — it is not
a salt or nonce and plays no role in the cryptographic envelope
(issue #519 audit). Propagation nodes validate it against the
transient id (see crate::stamp); a fixed or absent stamp will be
rejected by nodes enforcing a stamp cost, so callers should
generate one with stamp::generate_propagation_stamp.
pub fn pack_propagation_transient_with_rng<R: CryptoRngCore + Copy>( &self, destination: &Identity, rng: R, ) -> Result<(Vec<u8>, [u8; 32]), LxmfError>
pub fn pack_propagation_envelope( timestamp: f64, lxmf_data: &[u8], propagation_stamp: Option<&[u8]>, ) -> Result<Vec<u8>, LxmfError>
pub fn pack_paper_with_rng<R: CryptoRngCore + Copy>( &self, destination: &Identity, rng: R, ) -> Result<Vec<u8>, LxmfError>
pub fn pack_paper_uri_with_rng<R: CryptoRngCore + Copy>( &self, destination: &Identity, rng: R, ) -> Result<String, LxmfError>
pub fn encode_lxm_uri(paper_bytes: &[u8]) -> String
pub fn decode_lxm_uri(uri: &str) -> Result<Vec<u8>, LxmfError>
pub fn unpack_paper( paper_bytes: &[u8], recipient: &PrivateIdentity, ) -> Result<Self, LxmfError>
pub fn unpack_paper_uri( uri: &str, recipient: &PrivateIdentity, ) -> Result<Self, LxmfError>
Trait Implementations§
Source§impl Clone for WireMessage
impl Clone for WireMessage
Source§fn clone(&self) -> WireMessage
fn clone(&self) -> WireMessage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 WireMessage
impl RefUnwindSafe for WireMessage
impl Send for WireMessage
impl Sync for WireMessage
impl Unpin for WireMessage
impl UnsafeUnpin for WireMessage
impl UnwindSafe for WireMessage
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