pub struct ParsedMessage {
pub source_public_key: PublicKey,
pub destination_public_key: PublicKey,
pub received_time: i64,
pub payload_digest: [u8; 32],
pub stamp: Stamp,
pub scheme: EncryptionScheme,
pub salt: Vec<u8>,
pub payload_hmac: [u8; 32],
pub payload_size: u64,
pub payload: Vec<u8>,
}
Expand description
Represents a Message post-parsing.
Fields§
§source_public_key: PublicKey
The source public key.
destination_public_key: PublicKey
The destinations public key.
received_time: i64
Maleable server time.
payload_digest: [u8; 32]
The SHA-256 digest of the payload.
stamp: Stamp
The stamp attached to the message.
scheme: EncryptionScheme
The encryption scheme used on the serialized Payload
to produce the payload
field.
salt: Vec<u8>
The salt
is used to salt both the payload_hmac
and the encryption key.
payload_hmac: [u8; 32]
The HMAC of the payload
, specifically HMAC(HMAC(sdG, salt), payload_digest)
payload_size: u64
The size, in bytes, of the payload
.
payload: Vec<u8>
The encrypted payload
.
Implementations§
Source§impl ParsedMessage
impl ParsedMessage
Sourcepub fn into_message(self) -> Message
pub fn into_message(self) -> Message
Convert ParsedMessage
into a Message
.
Source§impl ParsedMessage
impl ParsedMessage
Sourcepub fn create_merged_key(
&self,
private_key: &[u8],
) -> Result<PublicKey, SecpError>
pub fn create_merged_key( &self, private_key: &[u8], ) -> Result<PublicKey, SecpError>
Calculate the merged key from the destination private key.
Create the shared key from the destination private key, a salt, and a list of HKDF info.
Sourcepub fn authenticate(&self, shared_key: &[u8; 32]) -> Result<(), InvalidHmac>
pub fn authenticate(&self, shared_key: &[u8; 32]) -> Result<(), InvalidHmac>
Authenticate the HMAC payload and return the merged key.
Sourcepub fn verify_stamp(&self) -> Result<Vec<Transaction>, StampError>
pub fn verify_stamp(&self) -> Result<Vec<Transaction>, StampError>
Verify the stamp on the message and return the decoded transactions.
Trait Implementations§
Source§impl Clone for ParsedMessage
impl Clone for ParsedMessage
Source§fn clone(&self) -> ParsedMessage
fn clone(&self) -> ParsedMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more