[][src]Struct cashweb_relay::ParsedMessage

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>,
}

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

impl ParsedMessage[src]

pub fn into_message(self) -> Message[src]

Convert ParsedMessage into a Message.

impl ParsedMessage[src]

pub fn create_merged_key(
    &self,
    private_key: &[u8]
) -> Result<PublicKey, SecpError>
[src]

Calculate the merged key from the destination private key.

pub fn create_shared_key(
    &self,
    private_key: &[u8],
    salt: &[u8]
) -> Result<[u8; 32], SecpError>
[src]

Create the shared key from the destination private key, a salt, and a list of HKDF info.

pub fn authenticate(&self, shared_key: &[u8; 32]) -> Result<(), InvalidHmac>[src]

Authenticate the HMAC payload and return the merged key.

pub fn verify_stamp(&self) -> Result<Vec<Transaction>, StampError>[src]

Verify the stamp on the message and return the decoded transactions.

pub fn open_in_place(&mut self, private_key: &[u8]) -> Result<Opened, OpenError>[src]

Verify the stamp, authenticate the HMAC payload, and then decrypt and decode the payload.

This is done in-place, replacing the encrypted payload field with the plain text.

pub fn open(&self, private_key: &[u8]) -> Result<Opened, OpenError>[src]

Verify the stamp, authenticate the HMAC payload, and then decrypt and decode the payload.

Trait Implementations

impl Clone for ParsedMessage[src]

impl Debug for ParsedMessage[src]

impl PartialEq<ParsedMessage> for ParsedMessage[src]

impl StructuralPartialEq for ParsedMessage[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.