[][src]Struct exonum::messages::Verified

pub struct Verified<T> { /* fields omitted */ }

Wraps a Payload together with the corresponding SignedMessage.

Usually one wants to work with fully parsed and verified messages (i.e., Payload). However, occasionally we have to retransmit the message into the network or save its serialized form. We could serialize the Payload back, but Protobuf does not have a canonical form so the resulting payload may have different binary representation (thus invalidating the message signature).

So we use Verified to keep the original byte buffer around with the parsed Payload.

Be careful with BinaryValue::from_bytes method! It for performance reasons skips signature verification.

See module documentation for examples.

Methods

impl<T> Verified<T>[src]

pub fn as_raw(&self) -> &SignedMessage[src]

Returns reference to the underlying signed message.

pub fn into_raw(self) -> SignedMessage[src]

Takes the underlying signed message.

pub fn author(&self) -> PublicKey[src]

Returns message author key.

impl<T> Verified<T> where
    T: TryFrom<SignedMessage>, 
[src]

pub fn payload(&self) -> &T[src]

Returns reference to the underlying message payload.

pub fn into_payload(self) -> T[src]

Takes the underlying message payload.

impl<T> Verified<T> where
    T: TryFrom<SignedMessage> + Into<ExonumMessage> + TryFrom<ExonumMessage>, 
[src]

pub fn from_value(
    inner: T,
    public_key: PublicKey,
    secret_key: &SecretKey
) -> Self
[src]

Signs the specified value and creates a new verified message from it.

Trait Implementations

impl VoteMessage for Verified<Precommit>[src]

impl VoteMessage for Verified<Prevote>[src]

impl<T> AsRef<T> for Verified<T>[src]

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

impl From<Verified<TransactionsResponse>> for Responses[src]

impl From<Verified<BlockResponse>> for Responses[src]

impl From<Verified<AnyTx>> for Message[src]

impl From<Verified<Connect>> for Message[src]

impl From<Verified<Status>> for Message[src]

impl From<Verified<Precommit>> for Message[src]

impl From<Verified<Prevote>> for Message[src]

impl From<Verified<Propose>> for Message[src]

impl From<Verified<BlockResponse>> for Message[src]

impl From<Verified<TransactionsResponse>> for Message[src]

impl From<Verified<BlockRequest>> for Message[src]

impl From<Verified<PeersRequest>> for Message[src]

impl From<Verified<PrevotesRequest>> for Message[src]

impl From<Verified<ProposeRequest>> for Message[src]

impl From<Verified<TransactionsRequest>> for Message[src]

impl From<Verified<PoolTransactionsRequest>> for Message[src]

impl From<Verified<ExonumMessage>> for Message[src]

impl<T: Clone> Clone for Verified<T>[src]

impl<T> PartialEq<Verified<T>> for Verified<T>[src]

impl<T: Debug> Debug for Verified<T>[src]

impl TryFrom<Message> for Verified<AnyTx>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Message> for Verified<Connect>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Message> for Verified<Status>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Message> for Verified<Precommit>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Message> for Verified<Prevote>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Message> for Verified<Propose>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Message> for Verified<BlockResponse>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Message> for Verified<TransactionsResponse>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Message> for Verified<BlockRequest>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Message> for Verified<PeersRequest>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Message> for Verified<PrevotesRequest>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Message> for Verified<ProposeRequest>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Message> for Verified<TransactionsRequest>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Message> for Verified<PoolTransactionsRequest>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<T> Serialize for Verified<T> where
    T: TryFrom<SignedMessage>, 
[src]

impl<'de, T> Deserialize<'de> for Verified<T> where
    T: TryFrom<SignedMessage>, 
[src]

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
    D: Deserializer<'de>, 
[src]

Warning: This implementation checks signature which is slow operation.

impl<T> BinaryValue for Verified<T> where
    T: TryFrom<&'a SignedMessage>, 
[src]

impl<T> ObjectHash for Verified<T> where
    T: TryFrom<&'a SignedMessage>, 
[src]

Auto Trait Implementations

impl<T> Send for Verified<T> where
    T: Send

impl<T> Sync for Verified<T> where
    T: Sync

impl<T> Unpin for Verified<T> where
    T: Unpin

impl<T> UnwindSafe for Verified<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for Verified<T> where
    T: RefUnwindSafe

Blanket Implementations

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

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

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 = !

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.

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

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

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

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> ToHex for T where
    T: AsRef<[u8]>, 
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> ToHex for T where
    T: AsRef<[u8]>, 
[src]

impl<T> Erased for T

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