pub fn ed25519_verify(
signature: &[u8; 64],
message: &[u8],
public_key: &[u8; 32],
) -> bool
Expand description
Verifies signature of message using provided ED25519 Public Key
ยงExamples
use near_sdk::env::ed25519_verify;
use hex;
assert_eq!(
ed25519_verify(
hex::decode("41C44494DAB13009BE73D2CCBD3A49677DDC1F26AD2823CE72833CE4B9603F77CA70A9E179272D92D28E8B2AE7006747C87AB1890362A50347EFF553F5EC4008")
.expect("Decoding failed")
.as_slice()
.try_into()
.unwrap(),
b"Hello world!",
hex::decode("9C16937BF04CCE709FED52344C43634F1E7A05FC29DD41F48844C3588C7FE663")
.expect("Decoding failed")
.as_slice()
.try_into()
.unwrap(),
),
true
);
assert_eq!(
ed25519_verify(
hex::decode("41C44494DAB13009BE73D2CCBD3A49677DDC1F26AD2823CE72833CE4B9603F77CA70A9E179272D92D28E8B2AE7006747C87AB1890362A50347EFF553F5EC4008")
.expect("Decoding failed")
.as_slice()
.try_into()
.unwrap(),
b"Modified message!",
hex::decode("9C16937BF04CCE709FED52344C43634F1E7A05FC29DD41F48844C3588C7FE663")
.expect("Decoding failed")
.as_slice()
.try_into()
.unwrap(),
),
false
);