pub trait CryptoApi {
    type BigUint: BigUintApi + 'static;

    // Required methods
    fn sha256(&self, data: &[u8]) -> H256;
    fn keccak256(&self, data: &[u8]) -> H256;
    fn verify_bls(&self, key: &[u8], message: &[u8], signature: &[u8]) -> bool;
    fn verify_ed25519(
        &self,
        key: &[u8],
        message: &[u8],
        signature: &[u8]
    ) -> bool;
    fn verify_secp256k1(
        &self,
        key: &[u8],
        message: &[u8],
        signature: &[u8]
    ) -> bool;
}

Required Associated Types§

source

type BigUint: BigUintApi + 'static

Numeric type used in some of the Arwen hooks.

Required Methods§

source

fn sha256(&self, data: &[u8]) -> H256

source

fn keccak256(&self, data: &[u8]) -> H256

source

fn verify_bls(&self, key: &[u8], message: &[u8], signature: &[u8]) -> bool

source

fn verify_ed25519(&self, key: &[u8], message: &[u8], signature: &[u8]) -> bool

source

fn verify_secp256k1(&self, key: &[u8], message: &[u8], signature: &[u8]) -> bool

Note: the signature is minimum 2 bytes in length, the second byte encodes the length of the remaining signature bytes.

Implementors§