pub struct Recovery {
pub message: RecoveryMessage,
pub v: u64,
pub r: H256,
pub s: H256,
}
Expand description
Data for recovering the public address of signed data.
Note that the signature data is in ‘Electrum’ notation and may have chain
replay protection applied. That means that v
is expected to be 27
, 28
,
or 35 + chain_id * 2
or 36 + chain_id * 2
.
Fields§
§message: RecoveryMessage
The message to recover
v: u64
V value.
r: H256
R value.
s: H256
S value.
Implementations§
Source§impl Recovery
impl Recovery
Sourcepub fn new<M>(message: M, v: u64, r: H256, s: H256) -> Recoverywhere
M: Into<RecoveryMessage>,
pub fn new<M>(message: M, v: u64, r: H256, s: H256) -> Recoverywhere
M: Into<RecoveryMessage>,
Creates new recovery data from its parts.
Sourcepub fn from_raw_signature<M, B>(
message: M,
raw_signature: B,
) -> Result<Recovery, ParseSignatureError>
pub fn from_raw_signature<M, B>( message: M, raw_signature: B, ) -> Result<Recovery, ParseSignatureError>
Creates new recovery data from a raw signature.
This parses a raw signature which is expected to be 65 bytes long where
the first 32 bytes is the r
value, the second 32 bytes the s
value
and the final byte is the v
value in ‘Electrum’ notation.
Sourcepub fn recovery_id(&self) -> Option<i32>
pub fn recovery_id(&self) -> Option<i32>
Retrieve the Recovery Id (“Standard V”)
Returns None
if v
value is invalid
(equivalent of returning 4
in some implementaions).
Trait Implementations§
Source§impl<'a> From<&'a SignedData> for Recovery
impl<'a> From<&'a SignedData> for Recovery
Source§fn from(signed: &'a SignedData) -> Self
fn from(signed: &'a SignedData) -> Self
Converts to this type from the input type.
Source§impl<'a> From<&'a SignedTransaction> for Recovery
impl<'a> From<&'a SignedTransaction> for Recovery
Source§fn from(tx: &'a SignedTransaction) -> Self
fn from(tx: &'a SignedTransaction) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for Recovery
Auto Trait Implementations§
impl Freeze for Recovery
impl RefUnwindSafe for Recovery
impl Send for Recovery
impl Sync for Recovery
impl Unpin for Recovery
impl UnwindSafe for Recovery
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