pub struct SignedMessage<Signature: ByteArray<CRYPTO_SIGN_BYTES> + Zeroize, Message: Bytes + Zeroize> { /* private fields */ }Expand description
A signed message, for use with SigningKeyPair.
Implementations§
Source§impl<Signature: ByteArray<CRYPTO_SIGN_BYTES> + Zeroize, Message: Bytes + Zeroize> SignedMessage<Signature, Message>
impl<Signature: ByteArray<CRYPTO_SIGN_BYTES> + Zeroize, Message: Bytes + Zeroize> SignedMessage<Signature, Message>
Source§impl<'a, Signature: ByteArray<CRYPTO_SIGN_BYTES> + TryFrom<&'a [u8]> + Zeroize, Message: Bytes + From<&'a [u8]> + Zeroize> SignedMessage<Signature, Message>
impl<'a, Signature: ByteArray<CRYPTO_SIGN_BYTES> + TryFrom<&'a [u8]> + Zeroize, Message: Bytes + From<&'a [u8]> + Zeroize> SignedMessage<Signature, Message>
Sourcepub fn from_bytes(bytes: &'a [u8]) -> Result<Self, Error>
pub fn from_bytes(bytes: &'a [u8]) -> Result<Self, Error>
Initializes a SignedMessage from a slice. Expects the first
CRYPTO_SIGN_BYTES bytes to contain the message signature,
with the remaining bytes containing the message.
§Errors
Returns an error if bytes is shorter than a signature or the
signature cannot be converted to the requested output type.
Source§impl<Signature: ByteArray<CRYPTO_SIGN_BYTES> + Zeroize, Message: Bytes + Zeroize> SignedMessage<Signature, Message>
impl<Signature: ByteArray<CRYPTO_SIGN_BYTES> + Zeroize, Message: Bytes + Zeroize> SignedMessage<Signature, Message>
Sourcepub fn from_parts(signature: Signature, message: Message) -> Self
pub fn from_parts(signature: Signature, message: Message) -> Self
Returns a new signed message from signature and message, consuming
each.
Sourcepub fn signature(&self) -> &Signature
pub fn signature(&self) -> &Signature
Returns the signature.
Sourcepub fn to_vec(&self) -> Vec<u8> ⓘ
Available on crate feature alloc only.
pub fn to_vec(&self) -> Vec<u8> ⓘ
alloc only.Copies self into a new Vec
Sourcepub fn into_parts(self) -> (Signature, Message)
pub fn into_parts(self) -> (Signature, Message)
Moves the signature and message out of this instance, returning them as a tuple.
Sourcepub fn to_bytes<Bytes: NewBytes + ResizableBytes>(&self) -> Bytes
pub fn to_bytes<Bytes: NewBytes + ResizableBytes>(&self) -> Bytes
Copies self into the target. Can be used with protected memory.
Trait Implementations§
Source§impl<Signature: Clone + ByteArray<CRYPTO_SIGN_BYTES> + Zeroize, Message: Clone + Bytes + Zeroize> Clone for SignedMessage<Signature, Message>
impl<Signature: Clone + ByteArray<CRYPTO_SIGN_BYTES> + Zeroize, Message: Clone + Bytes + Zeroize> Clone for SignedMessage<Signature, Message>
Source§impl<Signature: Debug + ByteArray<CRYPTO_SIGN_BYTES> + Zeroize, Message: Debug + Bytes + Zeroize> Debug for SignedMessage<Signature, Message>
impl<Signature: Debug + ByteArray<CRYPTO_SIGN_BYTES> + Zeroize, Message: Debug + Bytes + Zeroize> Debug for SignedMessage<Signature, Message>
Source§impl<'de, Signature, Message> Deserialize<'de> for SignedMessage<Signature, Message>where
Signature: Deserialize<'de> + ByteArray<CRYPTO_SIGN_BYTES> + Zeroize,
Message: Deserialize<'de> + Bytes + Zeroize,
Available on crate feature serde only.
impl<'de, Signature, Message> Deserialize<'de> for SignedMessage<Signature, Message>where
Signature: Deserialize<'de> + ByteArray<CRYPTO_SIGN_BYTES> + Zeroize,
Message: Deserialize<'de> + Bytes + Zeroize,
Available on crate feature
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<Signature: ByteArray<CRYPTO_SIGN_BYTES> + Zeroize, Message: Bytes + Zeroize> PartialEq for SignedMessage<Signature, Message>
impl<Signature: ByteArray<CRYPTO_SIGN_BYTES> + Zeroize, Message: Bytes + Zeroize> PartialEq for SignedMessage<Signature, Message>
Source§impl<Signature, Message> Serialize for SignedMessage<Signature, Message>
Available on crate feature serde only.
impl<Signature, Message> Serialize for SignedMessage<Signature, Message>
Available on crate feature
serde only.Source§impl<Signature, Message> Zeroize for SignedMessage<Signature, Message>
impl<Signature, Message> Zeroize for SignedMessage<Signature, Message>
Auto Trait Implementations§
impl<Signature, Message> Freeze for SignedMessage<Signature, Message>
impl<Signature, Message> RefUnwindSafe for SignedMessage<Signature, Message>where
Signature: RefUnwindSafe,
Message: RefUnwindSafe,
impl<Signature, Message> Send for SignedMessage<Signature, Message>
impl<Signature, Message> Sync for SignedMessage<Signature, Message>
impl<Signature, Message> Unpin for SignedMessage<Signature, Message>
impl<Signature, Message> UnsafeUnpin for SignedMessage<Signature, Message>where
Signature: UnsafeUnpin,
Message: UnsafeUnpin,
impl<Signature, Message> UnwindSafe for SignedMessage<Signature, Message>where
Signature: UnwindSafe,
Message: UnwindSafe,
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