pub struct RecoverableSignature { /* private fields */ }Expand description
A secp256k1 ECDSA signature plus the recovery id needed to recover the signing public key.
Serializes to the 65-byte TRON wire format r || s || v, where v is the
recovery id (0 or 1).
Implementations§
Source§impl RecoverableSignature
impl RecoverableSignature
Sourcepub fn from_signature(sig: &Signature, recovery_id: RecoveryId) -> Self
pub fn from_signature(sig: &Signature, recovery_id: RecoveryId) -> Self
Build from a non-recoverable Signature and its RecoveryId.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, SignatureError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, SignatureError>
Parse the 65-byte r || s || v representation.
Accepts a v of 0/1 or the Ethereum-style 27/28, normalising to
0/1.
Sourcepub fn to_bytes(&self) -> [u8; 65]
pub fn to_bytes(&self) -> [u8; 65]
Serialize to the 65-byte r || s || v wire form (v = 0/1).
TRON’s native transaction encoding. For TronWeb/TronLink message
signatures (v = 27/28) use to_legacy_bytes.
Sourcepub fn to_legacy_bytes(&self) -> [u8; 65]
pub fn to_legacy_bytes(&self) -> [u8; 65]
Serialize to r || s || v using the legacy 27/28 recovery id.
Matches TronWeb signMessageV2 / TronLink output (ends in 1b/1c).
The internal v stays 0/1; only this encoding adds the +27 offset.
Sourcepub fn recover_address_from_prehash(
&self,
prehash: B256,
) -> Result<Address, SignatureError>
pub fn recover_address_from_prehash( &self, prehash: B256, ) -> Result<Address, SignatureError>
Recover the TRON address that produced this signature over prehash.
Sourcepub fn split(&self) -> Result<(Signature, RecoveryId), SignatureError>
pub fn split(&self) -> Result<(Signature, RecoveryId), SignatureError>
Recover the non-recoverable Signature and RecoveryId components.
Trait Implementations§
Source§impl Clone for RecoverableSignature
impl Clone for RecoverableSignature
Source§fn clone(&self) -> RecoverableSignature
fn clone(&self) -> RecoverableSignature
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RecoverableSignature
Source§impl Debug for RecoverableSignature
impl Debug for RecoverableSignature
impl Eq for RecoverableSignature
Source§impl From<&RecoverableSignature> for [u8; 65]
impl From<&RecoverableSignature> for [u8; 65]
Source§fn from(signature: &RecoverableSignature) -> Self
fn from(signature: &RecoverableSignature) -> Self
Source§impl From<(Signature<Secp256k1>, RecoveryId)> for RecoverableSignature
impl From<(Signature<Secp256k1>, RecoveryId)> for RecoverableSignature
Source§fn from((signature, recovery_id): (Signature, RecoveryId)) -> Self
fn from((signature, recovery_id): (Signature, RecoveryId)) -> Self
Source§impl From<RecoverableSignature> for [u8; 65]
impl From<RecoverableSignature> for [u8; 65]
Source§fn from(signature: RecoverableSignature) -> Self
fn from(signature: RecoverableSignature) -> Self
Source§impl FromStr for RecoverableSignature
impl FromStr for RecoverableSignature
Source§impl Hash for RecoverableSignature
impl Hash for RecoverableSignature
Source§impl PartialEq for RecoverableSignature
impl PartialEq for RecoverableSignature
impl StructuralPartialEq for RecoverableSignature
Source§impl TryFrom<&[u8]> for RecoverableSignature
impl TryFrom<&[u8]> for RecoverableSignature
Source§impl TryFrom<RecoverableSignature> for (Signature, RecoveryId)
impl TryFrom<RecoverableSignature> for (Signature, RecoveryId)
Source§type Error = SignatureError
type Error = SignatureError
Auto Trait Implementations§
impl Freeze for RecoverableSignature
impl RefUnwindSafe for RecoverableSignature
impl Send for RecoverableSignature
impl Sync for RecoverableSignature
impl Unpin for RecoverableSignature
impl UnsafeUnpin for RecoverableSignature
impl UnwindSafe for RecoverableSignature
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 65 bytes