pub struct Signature {
    pub r: U256,
    pub s: U256,
    pub v: u64,
}
Expand description

An ECDSA signature with a recovery identifier.

The recovery identifier may be normalized, in Electrum notation or have EIP155 chain replay protection applied.

Fields§

§r: U256

R value

§s: U256

S value

§v: u64

V value for the recovery identifier

Implementations§

Create a signature with normalized recovery identifier.

Create a signature with electrum recovery identifier.

Create a signature with EIP155 chain replay protection.

Is the recovery identifier for this signature in the normalized form (0 or 1).

Is the recovery identifier for this signature in the electrum form (27 or 28).

Is the recovery identifier for this signature in the EIP155 form.

Converts this signature into normalized form from an Electrum signature.

Panics if this signature is not in Electrum format.

Converts this signature into normalized form from an EIP155 signature.

Panics if the signature could not be safely normalized for example if a chain_id was supplied that would cause the existing v value to become negative.

Converts this signature into Electrum form.

Panics if this signature is not in it’s normalized form.

Converts this signature applying EIP155 chain replay protection.

Panics if this signature is not in it’s normalized form.

Get the bytes for the r, s and v values.

Panics if this signature is not normalized.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
Converts to this type from the input type.
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Serialize this value into the given Serde serializer. Read more

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.

The type returned in the event of a conversion error.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.