async fn read_wasm_module(
    wasm_module_path: &Option<PathBuf>,
    wasm_module_url: &Option<Url>,
    wasm_resource_sha256: &str,
) -> Vec<u8> {
    let wasm_file_path = match (wasm_module_path, wasm_module_url) {
        (None, None) => {
            panic!("Must provide either --wasm-module-path PATH or --wasm-module-url URL")
        }
        (Some(_), Some(_)) => {
            panic!("Cannot provide both --wasm-module-path PATH and --wasm-module-url URL")
        }
        (Some(path), None) => path.clone(),
        (None, Some(url)) => download_wasm_module(url).await,
    };

    check_file_hash(&wasm_file_path, wasm_resource_sha256)
        .expect("Wasm module's sha256 does not match provided sha256");

    read_file_fully(&wasm_file_path)
}
/// Reads the wasm module into memory and validates it against a sha256 checksum
Reads the wasm module into memory and validates it against a sha256 checksum
Reads the wasm module into memory and validates it against a sha256 checksum
async fn read_wasm_module(
    wasm_module_path: &Option<PathBuf>,
    wasm_module_url: &Option<Url>,
    wasm_resource_sha256: &str,
) -> Vec<u8> {
    let wasm_file_path = match (wasm_module_path, wasm_module_url) {
        (None, None) => {
            panic!("Must provide either --wasm-module-path PATH or --wasm-module-url URL")
        }
        (Some(_), Some(_)) => {
            panic!("Cannot provide both --wasm-module-path PATH and --wasm-module-url URL")
        }
        (Some(path), None) => path.clone(),
        (None, Some(url)) => download_wasm_module(url).await,
    };
    check_file_hash(&wasm_file_path, wasm_resource_sha256)
        .expect("Wasm module's sha256 does not match provided sha256");
    read_file_fully(&wasm_file_path)
}
async fn read_wasm_module ( wasm_module_path : & Option < PathBuf > , wasm_module_url : & Option < Url > , wasm_resource_sha256 : & str , ) -> Vec < u8 > { let wasm_file_path = match ( wasm_module_path , wasm_module_url ) { ( None , None ) => { panic ! ( " " ) } ( Some ( _ ) , Some ( _ ) ) => { panic ! ( " " ) } ( Some ( path ) , None ) => path . clone ( ) , ( None , Some ( url ) ) => download_wasm_module ( url ) . await , } ; check_file_hash ( & wasm_file_path , wasm_resource_sha256 ) . expect ( " " ) ; read_file_fully ( & wasm_file_path ) }
Reads the wasm module into memory and validates it against a sha256 checksum
Reads the wasm module into memory and validates it against a sha256 checksum
wasm_module_path
&Option<PathBuf>
wasm_module_url
&Option<Url>
wasm_resource_sha256
&str
wasm_module_path
&Option<PathBuf>
wasm_module_url
&Option<Url>
wasm_resource_sha256
&str