Expand description
Wasmtime host implementation of the polymorph:webcrypto interfaces, backed by
the pure-Rust RustCrypto crates.
This crate factors the host-agnostic part of the Wasmtime WebCrypto host
out of the demo binaries so any host can satisfy the polymorph:webcrypto
imports with one call to add_to_linker. It is an async (component-model
async) implementation modeled after wasmtime_wasi_http::p3: a host
embeds a WasiWebcryptoCtx in its store state, implements
WasiWebcryptoView to expose it alongside the store’s [ResourceTable],
and calls add_to_linker to satisfy the full polymorph:webcrypto
package surface with RustCrypto implementations.
Modules§
- bindings
- Raw
bindgen!output for thepolymorph:webcryptopackage. - standalone
- Ready-made embedding for hosts whose component imports only
polymorph:webcrypto: the canonical store state and the engine/linker/store setup this repository’s drivers share (the demo host and the conformance adapter), so the engine configuration the async imports require has one definition.
Structs§
- AeadKey
- Backing type for the
aead.aead-keyresource. - Aead
KeyOptions - An
aead-key-optionsresource. SeeMacKeyOptions. - Agreement
KeyOptions - An
agreement-key-optionsresource. SeeMacKeyOptions. - Agreement
Public Key - Backing type for the
key-agreement.public-keyresource: public material only, exchangeable and secret-free. - Agreement
Secret Key - Backing type for the
key-agreement.secret-keyresource.agreeis one-shot and stateless per call; the derivation state lives in thederive-inputit mints. - Cipher
Key - Backing type for the
cipher.cipher-keyresource: the unauthenticated AES modes’ key material. - Cipher
KeyOptions - A
cipher-key-optionsresource. SeeMacKeyOptions. - Decryption
Key - Backing type for the
public-encryption.decryption-keyresource. - Decryption
KeyOptions - A
decryption-key-optionsresource. SeeMacKeyOptions. - Derive
Input - Backing type for the
derivation.derive-inputresource: a parameterized derivation, run eagerly (the extract step runs atprepare, so this retains the PRK rather than the base secret). - Derive
Options - A
derive-optionsresource. SeeMacKeyOptions. - Digest
- Backing type for the
digest.digestresource. - Encryption
Key - Backing type for the
public-encryption.encryption-keyresource. - Ikm
- Backing type for the
hkdf.ikmresource: input keying material, never readable through the API under any grant. - KwKey
- Backing type for the
key-wrap.kw-keyresource: the AES-KW key-encryption key’s material. - KwKey
Options - A
kw-key-optionsresource. SeeMacKeyOptions. - Link
Options - Which
@unstable-gated interfacesadd_to_linker_with_optionsadds. Every flag defaults to off; this host implements all of them, so a flag is embedder policy, not capability. - MacKey
- Backing type for the
mac.mac-keyresource. - MacKey
Options - A
mac-key-optionsresource: mint-time policy under construction. Constructed with the WIT defaults (nothing granted), mutated by the setters, consumed by a mint. - Password
- Backing type for the
pbkdf2.passwordresource: a password, never readable through the API under any grant. - Signing
Key - Backing type for the
signature.signing-keyresource. - Signing
KeyOptions - A
signing-key-optionsresource. SeeMacKeyOptions. - Unwrap
Input - Backing type for the
wrapping.unwrap-inputresource: decrypted key material awaiting a typed mint, consumed by the unwrap mints. - Verifying
Key - Backing type for the
signature.verifying-keyresource. - Wasi
Webcrypto - The type for which this crate implements the
polymorph:webcryptointerfaces. Used as the [HasData] marker for the generated bindings. - Wasi
Webcrypto Ctx - Configuration and per-store state for the WebCrypto host.
- Wasi
Webcrypto CtxView - A borrowed view into a host’s
WasiWebcryptoCtxand its [ResourceTable]. - Wrap
Input - Backing type for the
wrapping.wrap-inputresource: one key’s serialized material awaiting encryption under a wrapping key, consumed by the wrap operations.
Traits§
- Wasi
Webcrypto View - A trait that provides access to the
WasiWebcryptoCtxhost state.
Functions§
- add_
to_ linker - Add the
polymorph:webcryptointerfaces implemented by this crate —types, the primitive kinds (mac,aead,digest,signature), and the algorithm minting interfaces — to the provided [Linker]. - add_
to_ linker_ with_ options add_to_linker, with the@unstable-gated interfacesoptionsselects also served.