WasmEdge icon indicating copy to clipboard operation
WasmEdge copied to clipboard

[Example] Add a WASI-crypto example

Open q82419 opened this issue 3 years ago • 1 comments

Motivation

In current state, we only have unit tests for wasi-crypto plugin in WasmEdge. We need a tutorial for creating a WASM program which uses wasi-crypto.

Details

  1. A rust source to use wasi-crypto and compile into the wasm32-wasi target.
  2. Use WasmEdge with wasi-crypto plugin to run the WASM.

q82419 avatar Jul 26 '22 03:07 q82419

Hi @q82419, I am trying to add a example of using wasi-crypto in rust. But I fail to import host function like this:

#[link(wasm_import_module = "wasi_ephemeral_crypto_signatures")]
extern "C" {
    pub fn signature_import(
        AlgPtr: *const c_char,
        AlgLen: u32,
        EncodedPtr: *const u8,
        EncodedLen: u32,
        Encoding: u32,
        SigHandlePtr: *mut u32,
    );
}

I build the wasmedge from source with enabling the wasi-crypto plugin. How can I confirm if wasi-crypto plugin is loaded?

MediosZ avatar Sep 03 '22 01:09 MediosZ

@hydai Is this completed or are you looking for more examples?

Azanul avatar May 17 '23 05:05 Azanul

@hydai Is this completed or are you looking for more examples?

We always look for more examples :-) The previous example is here: https://github.com/WasmEdge/WasmEdge/pull/1817/files It only covers limited usage in WASI-Crypto.

hydai avatar May 17 '23 06:05 hydai