0x1::Signature
Contains functions for ed25519 digital signatures.
ed25519_validate_pubkey
ed25519_verify
native_ecrecover
ecrecover
use 0x1::EVMAddress;
use 0x1::Option;
use 0x1::Vector;
ed25519_validate_pubkey
public fun ed25519_validate_pubkey(public_key: vector<u8>): bool
native public fun ed25519_validate_pubkey(public_key: vector<u8>): bool;
ed25519_verify
public fun ed25519_verify(signature: vector<u8>, public_key: vector<u8>, message: vector<u8>): bool
native public fun ed25519_verify(signature: vector<u8>, public_key: vector<u8>, message: vector<u8>): bool;
native_ecrecover
recover address from ECDSA signature, if recover fail, return an empty vector
fun native_ecrecover(hash: vector<u8>, signature: vector<u8>): vector<u8>
native fun native_ecrecover(hash: vector<u8>, signature: vector<u8>): vector<u8>;
ecrecover
recover address from ECDSA signature, if recover fail, return None
public fun ecrecover(hash: vector<u8>, signature: vector<u8>): Option::Option<EVMAddress::EVMAddress>
public fun ecrecover(hash: vector<u8>, signature: vector<u8>):Option<EVMAddress>{
let bytes = native_ecrecover(hash, signature);
if (Vector::is_empty(&bytes)){
Option::none<EVMAddress>()
}else{
Option::some(EVMAddress::new(bytes))
}
}
pragma intrinsic = true;