Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions wit-0.3.0-draft/client.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
interface client {
use types.{error};

resource connector {
constructor();

/// Set up the encryption stream transform.
/// This takes an unprotected `cleartext` application data stream and
/// returns an encrypted data stream, ready to be sent out over the network.
/// Closing the `cleartext` stream will cause a `close_notify` packet to be emitted on the returned output stream.
send: func(cleartext: stream<u8>) -> tuple<stream<u8>, future<result<_, error>>>;

/// Set up the decryption stream transform.
/// This takes an encrypted data stream, as received via e.g. the network,
/// and returns a decrypted application data stream.
receive: func(ciphertext: stream<u8>) -> tuple<stream<u8>, future<result<_, error>>>;

/// Perform the handshake.
/// The `send` & `receive` streams must be set up before calling this method.
connect: static async func(this: connector, server-name: string) -> result<_, error>;
}
}
5 changes: 5 additions & 0 deletions wit-0.3.0-draft/types.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
interface types {
resource error {
to-debug-string: func() -> string;
}
}
6 changes: 6 additions & 0 deletions wit-0.3.0-draft/world.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package wasi:tls@0.3.0-draft;

world imports {
import client;
import types;
}