pub async fn rpc_call_is_valid_signature<T: Transport>(
    eth: &Eth<T>,
    address: Address,
    message: String,
    hash: Vec<u8>
) -> Result<bool, RPCCallError>
Expand description

A signature validator that receives an address, a message and a signature and validates it using local resources.

use ethabi::Contract;
use web3::{Web3, transports::Http};
use dcl_crypto::util::rpc_call_is_valid_signature;
use dcl_crypto::account::{Address, EIP1271Signature};

    let endpoint = env!("ETHEREUM_MAINNET_RPC");
    let transport = Http::new(endpoint).unwrap();
    let eth = Web3::new(transport).eth();
    let address = Address::try_from("0x3b21028719a4aca7ebee35b0157a6f1b0cf0d0c5").unwrap();
    // let address = Address::try_from("0xbdbee960fb7ce6267c467665dea046d0a4849cda").unwrap();
    let message = "Decentraland Login\nEphemeral address: 0x69fBdE5Da06eb76e8E7F6Fd2FEEd968F28b951a5\nExpiration: Tue Aug 06 7112 10:14:51 GMT-0300 (Argentina Standard Time)".to_string();
    let hash = EIP1271Signature::try_from("0x03524dbe44d19aacc8162b4d5d17820c370872de7bfd25d1add2b842adb1de546b454fc973b6d215883c30f4c21774ae71683869317d773f27e6bfaa9a2a05101b36946c3444914bb93f17a29d88e2449bcafdb6478b4835102c522197fa6f63d13ce5ab1d5c11c95db0c210fb4380995dff672392e5569c86d7c6bb2a44c53a151c").unwrap().to_vec();

    let result = rpc_call_is_valid_signature(&eth, address, message, hash).await.unwrap();
    assert_eq!(result, true);