For thread-local storage, which also abbreviates to TLS, see the Shared-Everything Threads Proposal.
A proposed WebAssembly System Interface API.
wasi-tls is currently in Phase 1
- Dave Bakker
- Joel Dice
- James Sturtevant
TODO before entering Phase 2.
- Transport Layer Security (TLS/SSL)
- wasi-tls
- Current Phase
- Champions
- Portability Criteria
- Table of Contents [if the explainer is longer than one printed page]
Wasi-tls is aimed at providing a high level api that provides the ability to read and write encrypted data over a stream. The API is a TLS specific way for clients and servers to configure the connection. The encryption work is done by the host allowing implementors to re-use hardened solutions and also perform more advance solutions such as hardware offloading and Kernel TLS.
- Use wasi-sockets to open a connection to a web server and then communicate using TLS via wasi-tls
- Enable mTLS connections to databases
- Provide a fully flushed out implementation of TLS/SSL
- Provide low level TLS primitives
The full API documentation can be found in imports.
A simple example in sudo code:
// initiate and complete handshake
let handshake = ClientHandshake::new(DOMAIN, tcp_input, tcp_output);
let (client, tls_input, tls_output) = handshake.finish().await?;
// send data to server and read
tls_output.write("GET / HTTP/1.1\r\nHost: {DOMAIN}\r\n\r\n").await?;
tls_output.read(buffer).await?;
//close the connection
client.close_notify()?
TODO
TODO
We opted to not go with this option due to no constant time operations in WASM and more advance scenarios like hardware acceleration could not be could be leveraged.
We opted to not go with this option since wasi-crypto is intended for low level use cases and it would be difficult to use correctly and require developers to re-implement libraries that already exist. It might be possible to virtualize wasi-tls using wasi-crypto in the future.
TODO before entering Phase 3.
[This should include a list of implementers who have expressed interest in implementing the proposal]
- Pre-proposal
- Proposal to WG
- Initial GitHub issue and discussion
- Draft PR, usage examples, and compatibility evaluation
- .NET guest + Wasmtime host proof-of-concept
- .NET runtime prototype
Many thanks for valuable feedback and advice from:
- [Person 1]
- [Person 2]
- [etc.]