Skip to main content

CryptoProvider

Trait CryptoProvider 

Source
pub trait CryptoProvider: Send + Sync {
    // Required methods
    fn ed25519_verify<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        public_key: &'life1 [u8],
        message: &'life2 [u8],
        signature: &'life3 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(), PlatformError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             Self: 'async_trait;
    fn sha256<'life0, 'life1, 'async_trait>(
        &'life0 self,
        data: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<[u8; 32], PlatformError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Expand description

Platform-agnostic cryptography provider

Native: ed25519-dalek + sha2 Web: SubtleCrypto (Web Crypto API)

Required Methods§

Source

fn ed25519_verify<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, public_key: &'life1 [u8], message: &'life2 [u8], signature: &'life3 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), PlatformError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Ed25519 signature verification

Returns Ok(()) if the signature is valid, Err otherwise.

Source

fn sha256<'life0, 'life1, 'async_trait>( &'life0 self, data: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<[u8; 32], PlatformError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

SHA-256 hash

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§