pub struct Signature(/* private fields */);
Expand description
Cryptographic signature of a message signed by an Aleo account
Implementations§
source§impl Signature
impl Signature
sourcepub fn sign(private_key: &PrivateKey, message: &[u8]) -> Self
pub fn sign(private_key: &PrivateKey, message: &[u8]) -> Self
Sign a message with a private key
@param {PrivateKey} private_key The private key to sign the message with @param {Uint8Array} message Byte representation of the message to sign @returns {Signature} Signature of the message
sourcepub fn verify(&self, address: &Address, message: &[u8]) -> bool
pub fn verify(&self, address: &Address, message: &[u8]) -> bool
Verify a signature of a message with an address
@param {Address} address The address to verify the signature with @param {Uint8Array} message Byte representation of the message to verify @returns {boolean} True if the signature is valid, false otherwise
sourcepub fn from_string(signature: &str) -> Self
pub fn from_string(signature: &str) -> Self
Get a signature from a string representation of a signature
@param {string} signature String representation of a signature @returns {Signature} Signature
Methods from Deref<Target = Signature<Testnet3>>§
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).
pub fn challenge(&self) -> Scalar<N>
pub fn challenge(&self) -> Scalar<N>
Returns the verifier challenge.
pub fn response(&self) -> Scalar<N>
pub fn response(&self) -> Scalar<N>
Returns the prover response.
pub fn compute_key(&self) -> ComputeKey<N>
pub 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§
source§impl FromWasmAbi for Signature
impl FromWasmAbi for Signature
source§impl IntoWasmAbi for Signature
impl IntoWasmAbi for Signature
source§impl LongRefFromWasmAbi for Signature
impl LongRefFromWasmAbi for Signature
source§impl OptionFromWasmAbi for Signature
impl OptionFromWasmAbi for Signature
source§impl OptionIntoWasmAbi for Signature
impl OptionIntoWasmAbi for Signature
source§impl RefFromWasmAbi for Signature
impl RefFromWasmAbi for Signature
source§impl RefMutFromWasmAbi for Signature
impl RefMutFromWasmAbi for Signature
source§impl TryFromJsValue for Signature
impl TryFromJsValue for Signature
source§impl VectorFromWasmAbi for Signature
impl VectorFromWasmAbi for Signature
source§impl VectorIntoWasmAbi for Signature
impl VectorIntoWasmAbi for Signature
Auto Trait Implementations§
impl RefUnwindSafe for Signature
impl Send for Signature
impl Sync for Signature
impl Unpin for Signature
impl UnwindSafe for Signature
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
§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>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere T: IntoWasmAbi,
§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::Abi
source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
.