Struct SvmSignature
pub(crate) struct SvmSignature<N>where
    N: Network,{
    challenge: Scalar<N>,
    response: Scalar<N>,
    compute_key: ComputeKey<N>,
}Fields§
§challenge: Scalar<N>§response: Scalar<N>§compute_key: ComputeKey<N>Implementations§
§impl<N> Signature<N>where
    N: Network,
 
impl<N> Signature<N>where
    N: Network,
pub fn verify(&self, address: &Address<N>, message: &[Field<N>]) -> bool
pub fn verify(&self, address: &Address<N>, message: &[Field<N>]) -> bool
Verifies (challenge == challenge’) && (address == address’) where: challenge’ := HashToScalar(G^response pk_sig^challenge, pk_sig, pr_sig, address, message)
pub fn verify_bytes(&self, address: &Address<N>, message: &[u8]) -> bool
pub fn verify_bytes(&self, address: &Address<N>, message: &[u8]) -> bool
Verifies a signature for the given address and message (as bytes).
pub fn verify_bits(&self, address: &Address<N>, message: &[bool]) -> bool
pub fn verify_bits(&self, address: &Address<N>, message: &[bool]) -> bool
Verifies a signature for the given address and message (as bits).
§impl<N> Signature<N>where
    N: Network,
 
impl<N> Signature<N>where
    N: Network,
pub fn sign<R>(
    private_key: &PrivateKey<N>,
    message: &[Field<N>],
    rng: &mut R,
) -> Result<Signature<N>, Error>
pub fn sign<R>( private_key: &PrivateKey<N>, message: &[Field<N>], rng: &mut R, ) -> Result<Signature<N>, Error>
Returns a signature (challenge, response, compute_key) for a given message and RNG, where:
challenge := HashToScalar(nonce * G, pk_sig, pr_sig, address, message)
response := nonce - challenge * private_key.sk_sig()
§impl<N> Signature<N>where
    N: Network,
 
impl<N> Signature<N>where
    N: Network,
pub const fn challenge(&self) -> Scalar<N>
pub const fn challenge(&self) -> Scalar<N>
Returns the verifier challenge.
pub const fn response(&self) -> Scalar<N>
pub const fn response(&self) -> Scalar<N>
Returns the prover response.
pub const fn compute_key(&self) -> ComputeKey<N>
pub const fn compute_key(&self) -> ComputeKey<N>
Returns the signer compute key.
pub fn to_address(&self) -> Address<N>
pub fn to_address(&self) -> Address<N>
Returns the signer address.
Trait Implementations§
§impl<'de, N> Deserialize<'de> for Signature<N>where
    N: Network,
 
impl<'de, N> Deserialize<'de> for Signature<N>where
    N: Network,
§fn deserialize<D>(
    deserializer: D,
) -> Result<Signature<N>, <D as Deserializer<'de>>::Error>where
    D: Deserializer<'de>,
 
fn deserialize<D>(
    deserializer: D,
) -> Result<Signature<N>, <D as Deserializer<'de>>::Error>where
    D: Deserializer<'de>,
Deserializes the signature from a string or bytes.
§impl<N> FromBytes for Signature<N>where
    N: Network,
 
impl<N> FromBytes for Signature<N>where
    N: Network,
§fn read_le<R>(reader: R) -> Result<Signature<N>, Error>where
    R: Read,
 
fn read_le<R>(reader: R) -> Result<Signature<N>, Error>where
    R: Read,
Reads an account signature from a buffer.
§fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>where
    Self: Sized,
 
fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>where
    Self: Sized,
Self from a byte array in little-endian order.§fn from_bytes_le_unchecked(bytes: &[u8]) -> Result<Self, Error>where
    Self: Sized,
 
fn from_bytes_le_unchecked(bytes: &[u8]) -> Result<Self, Error>where
    Self: Sized,
Self::from_bytes_le but avoids costly checks.
This shall only be called when deserializing from a trusted source, such as local storage. Read more§fn read_le_unchecked<R>(reader: R) -> Result<Self, Error>
 
fn read_le_unchecked<R>(reader: R) -> Result<Self, Error>
Self::read_le] but avoids costly checks.
This shall only be called when deserializing from a trusted source, such as local storage. Read more§impl<N> Serialize for Signature<N>where
    N: Network,
 
impl<N> Serialize for Signature<N>where
    N: Network,
§fn serialize<S>(
    &self,
    serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
    S: Serializer,
 
fn serialize<S>(
    &self,
    serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
    S: Serializer,
Serializes the signature into string or bytes.
§impl<N> SizeInBits for Signature<N>where
    N: Network,
 
impl<N> SizeInBits for Signature<N>where
    N: Network,
§fn size_in_bits() -> usize
 
fn size_in_bits() -> usize
Returns the signature size in bits.
§impl<N> SizeInBytes for Signature<N>where
    N: Network,
 
impl<N> SizeInBytes for Signature<N>where
    N: Network,
§fn size_in_bytes() -> usize
 
fn size_in_bytes() -> usize
Returns the signature size in bytes.
§impl<N> ToBits for Signature<N>where
    N: Network,
 
impl<N> ToBits for Signature<N>where
    N: Network,
§fn write_bits_le(&self, vec: &mut Vec<bool>)
 
fn write_bits_le(&self, vec: &mut Vec<bool>)
Returns the little-endian bits of the signature.
§fn write_bits_be(&self, vec: &mut Vec<bool>)
 
fn write_bits_be(&self, vec: &mut Vec<bool>)
Returns the big-endian bits of the signature.
§fn to_bits_le(&self) -> Vec<bool>
 
fn to_bits_le(&self) -> Vec<bool>
self as a boolean array in little-endian order.§fn to_bits_be(&self) -> Vec<bool>
 
fn to_bits_be(&self) -> Vec<bool>
self as a boolean array in big-endian order.impl<N> Copy for Signature<N>where
    N: Copy + Network,
impl<N> Eq for Signature<N>where
    N: Eq + Network,
impl<N> StructuralPartialEq for Signature<N>where
    N: Network,
Auto Trait Implementations§
impl<N> Freeze for Signature<N>
impl<N> RefUnwindSafe for Signature<N>where
    <N as Environment>::Scalar: RefUnwindSafe,
    <N as Environment>::Projective: RefUnwindSafe,
impl<N> Send for Signature<N>
impl<N> Sync for Signature<N>
impl<N> Unpin for Signature<N>
impl<N> UnwindSafe for Signature<N>where
    <N as Environment>::Scalar: UnwindSafe,
    <N as Environment>::Projective: 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
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
§impl<'de, T> DeserializeExt<'de> for Twhere
    T: DeserializeOwned,
 
impl<'de, T> DeserializeExt<'de> for Twhere
    T: DeserializeOwned,
fn take_from_value<D>(
    value: &mut Value,
    field: &str,
) -> Result<T, <D as Deserializer<'de>>::Error>where
    D: Deserializer<'de>,
§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
 
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
 
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
    T: ?Sized,
 
impl<T> PolicyExt for Twhere
    T: ?Sized,
§impl<T> ToSmolStr for T
 
impl<T> ToSmolStr for T
fn to_smolstr(&self) -> SmolStr
§impl<T> ToStringFallible for Twhere
    T: Display,
 
impl<T> ToStringFallible for Twhere
    T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
 
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.