[−][src]Struct exonum::messages::Verified
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]
T: TryFrom<SignedMessage>,
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]
T: TryFrom<SignedMessage> + Into<ExonumMessage> + TryFrom<ExonumMessage>,
pub fn from_value(
inner: T,
public_key: PublicKey,
secret_key: &SecretKey
) -> Self
[src]
inner: T,
public_key: PublicKey,
secret_key: &SecretKey
) -> Self
Signs the specified value and creates a new verified message from it.
Trait Implementations
impl VoteMessage for Verified<Precommit>
[src]
fn validator(&self) -> ValidatorId
[src]
impl VoteMessage for Verified<Prevote>
[src]
fn validator(&self) -> ValidatorId
[src]
impl<T> AsRef<T> for Verified<T>
[src]
impl<T> From<Verified<T>> for SignedMessage
[src]
impl From<Verified<TransactionsResponse>> for Responses
[src]
fn from(msg: Verified<TransactionsResponse>) -> Self
[src]
impl From<Verified<BlockResponse>> for Responses
[src]
fn from(msg: Verified<BlockResponse>) -> Self
[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]
fn from(msg: Verified<BlockResponse>) -> Self
[src]
impl From<Verified<TransactionsResponse>> for Message
[src]
fn from(msg: Verified<TransactionsResponse>) -> Self
[src]
impl From<Verified<BlockRequest>> for Message
[src]
fn from(msg: Verified<BlockRequest>) -> Self
[src]
impl From<Verified<PeersRequest>> for Message
[src]
fn from(msg: Verified<PeersRequest>) -> Self
[src]
impl From<Verified<PrevotesRequest>> for Message
[src]
fn from(msg: Verified<PrevotesRequest>) -> Self
[src]
impl From<Verified<ProposeRequest>> for Message
[src]
fn from(msg: Verified<ProposeRequest>) -> Self
[src]
impl From<Verified<TransactionsRequest>> for Message
[src]
fn from(msg: Verified<TransactionsRequest>) -> Self
[src]
impl From<Verified<PoolTransactionsRequest>> for Message
[src]
fn from(msg: Verified<PoolTransactionsRequest>) -> Self
[src]
impl From<Verified<ExonumMessage>> for Message
[src]
fn from(msg: Verified<ExonumMessage>) -> Self
[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.
fn try_from(msg: Message) -> Result<Self, Self::Error>
[src]
impl TryFrom<Message> for Verified<Connect>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(msg: Message) -> Result<Self, Self::Error>
[src]
impl TryFrom<Message> for Verified<Status>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(msg: Message) -> Result<Self, Self::Error>
[src]
impl TryFrom<Message> for Verified<Precommit>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(msg: Message) -> Result<Self, Self::Error>
[src]
impl TryFrom<Message> for Verified<Prevote>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(msg: Message) -> Result<Self, Self::Error>
[src]
impl TryFrom<Message> for Verified<Propose>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(msg: Message) -> Result<Self, Self::Error>
[src]
impl TryFrom<Message> for Verified<BlockResponse>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(msg: Message) -> Result<Self, Self::Error>
[src]
impl TryFrom<Message> for Verified<TransactionsResponse>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(msg: Message) -> Result<Self, Self::Error>
[src]
impl TryFrom<Message> for Verified<BlockRequest>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(msg: Message) -> Result<Self, Self::Error>
[src]
impl TryFrom<Message> for Verified<PeersRequest>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(msg: Message) -> Result<Self, Self::Error>
[src]
impl TryFrom<Message> for Verified<PrevotesRequest>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(msg: Message) -> Result<Self, Self::Error>
[src]
impl TryFrom<Message> for Verified<ProposeRequest>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(msg: Message) -> Result<Self, Self::Error>
[src]
impl TryFrom<Message> for Verified<TransactionsRequest>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(msg: Message) -> Result<Self, Self::Error>
[src]
impl TryFrom<Message> for Verified<PoolTransactionsRequest>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(msg: Message) -> Result<Self, Self::Error>
[src]
impl<T> Serialize for Verified<T> where
T: TryFrom<SignedMessage>,
[src]
T: TryFrom<SignedMessage>,
impl<'de, T> Deserialize<'de> for Verified<T> where
T: TryFrom<SignedMessage>,
[src]
T: TryFrom<SignedMessage>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
Warning: This implementation checks signature which is slow operation.
impl<T> BinaryValue for Verified<T> where
T: TryFrom<&'a SignedMessage>,
[src]
T: TryFrom<&'a SignedMessage>,
fn to_bytes(&self) -> Vec<u8>
[src]
fn from_bytes(bytes: Cow<[u8]>) -> Result<Self, Error>
[src]
fn into_bytes(self) -> Vec<u8>
[src]
impl<T> ObjectHash for Verified<T> where
T: TryFrom<&'a SignedMessage>,
[src]
T: TryFrom<&'a SignedMessage>,
fn object_hash(&self) -> Hash
[src]
Auto Trait Implementations
impl<T> Send for Verified<T> where
T: Send,
T: Send,
impl<T> Sync for Verified<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Verified<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Verified<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for Verified<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> ToHex for T where
T: AsRef<[u8]>,
[src]
T: AsRef<[u8]>,
fn encode_hex<U>(&self) -> U where
U: FromIterator<char>,
[src]
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> U where
U: FromIterator<char>,
[src]
U: FromIterator<char>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<T> ToHex for T where
T: AsRef<[u8]>,
[src]
T: AsRef<[u8]>,
fn write_hex<W>(&self, w: &mut W) -> Result<(), Error> where
W: Write,
[src]
W: Write,
fn write_hex_upper<W>(&self, w: &mut W) -> Result<(), Error> where
W: Write,
[src]
W: Write,
impl<T> Erased for T
impl<T> Serialize for T where
T: Serialize + ?Sized,
[src]
T: Serialize + ?Sized,