Enum near_crypto::Signature
source · [−]pub enum Signature {
ED25519(Signature),
SECP256K1(Secp256K1Signature),
}
Expand description
Signature container supporting different curves.
Variants
ED25519(Signature)
SECP256K1(Secp256K1Signature)
Implementations
sourceimpl Signature
impl Signature
sourcepub fn from_parts(
signature_type: KeyType,
signature_data: &[u8]
) -> Result<Self, ParseSignatureError>
pub fn from_parts(
signature_type: KeyType,
signature_data: &[u8]
) -> Result<Self, ParseSignatureError>
Construct Signature from key type and raw signature blob
sourcepub fn verify(&self, data: &[u8], public_key: &PublicKey) -> bool
pub fn verify(&self, data: &[u8], public_key: &PublicKey) -> bool
Verifies that this signature is indeed signs the data with given public key.
Also if public key doesn’t match on the curve returns false
.
pub fn key_type(&self) -> KeyType
Trait Implementations
sourceimpl BorshDeserialize for Signature
impl BorshDeserialize for Signature
sourceimpl BorshSerialize for Signature
impl BorshSerialize for Signature
sourceimpl<'de> Deserialize<'de> for Signature
impl<'de> Deserialize<'de> for Signature
sourcefn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Serialize for Signature
impl Serialize for Signature
sourcefn 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,
Serialize this value into the given Serde serializer. Read more
impl Eq for Signature
impl StructuralEq for Signature
impl StructuralPartialEq 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more