* Add support for the experimental wasi-crypto APIs The sole purpose of the implementation is to allow bindings and application developers to test the proposed APIs. Rust and AssemblyScript bindings are also available as examples. Like `wasi-nn`, it is currently disabled by default, and requires the `wasi-crypto` feature flag to be compiled in. * Rename the wasi-crypto/spec submodule * Add a path dependency into the submodule for wasi-crypto * Tell the publish script to vendor wasi-crypto
39 lines
742 B
Rust
39 lines
742 B
Rust
use std::rc::Rc;
|
|
|
|
use wasi_crypto::CryptoCtx;
|
|
|
|
wiggle::from_witx!({
|
|
witx: ["$CARGO_MANIFEST_DIR/spec/witx/wasi_ephemeral_crypto.witx"],
|
|
ctx: WasiCryptoCtx
|
|
});
|
|
|
|
pub mod wasi_modules {
|
|
pub use super::{
|
|
wasi_ephemeral_crypto_asymmetric_common, wasi_ephemeral_crypto_common,
|
|
wasi_ephemeral_crypto_kx, wasi_ephemeral_crypto_signatures,
|
|
wasi_ephemeral_crypto_symmetric,
|
|
};
|
|
}
|
|
|
|
pub use types as guest_types;
|
|
|
|
#[derive(Clone)]
|
|
pub struct WasiCryptoCtx {
|
|
ctx: Rc<CryptoCtx>,
|
|
}
|
|
|
|
impl WasiCryptoCtx {
|
|
pub fn new() -> Self {
|
|
WasiCryptoCtx {
|
|
ctx: Rc::new(CryptoCtx::new()),
|
|
}
|
|
}
|
|
}
|
|
|
|
mod asymmetric_common;
|
|
mod common;
|
|
mod error;
|
|
mod key_exchange;
|
|
mod signatures;
|
|
mod symmetric;
|