Skip to content
Open
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
36 changes: 36 additions & 0 deletions wit-0.3.0-draft/client.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
interface client {
resource hello {
/// Constructs a new ClientHello message.
constructor();

/// Sets the server name indicator.
///
/// Returns an error if it is not valid.
///
/// If this function is not called, the SNI extension will not be sent.
set-server-name: func(server-name: string) -> result;

/// Sets the ALPN IDs advertised by the client.
set-alpn-ids: func(alpn-ids: list<list<u8>>);

/// Sets a list of the symmetric cipher options supported by
/// the client, specifically the record protection algorithm
/// (including secret key length) and a hash to be used with HKDF, in
/// descending order of client preference.
///
/// If this list is empty, the implementation must use a reasonable default.
set-cipher-suites: func(cipher-suites: list<u16>);
}

resource handshake {
/// Gets the single cipher suite selected by the server from
/// the list in ClientHello.cipher_suites.
get-cipher-suite: func() -> u16;

/// Closing the `data` stream will trigger `close_notify`.
finish: static func(this: handshake, data: stream<u8>) -> tuple<stream<u8>, future<result>>;
}

/// Initiate the client TLS handshake
connect: func(hello: hello, incoming: stream<u8>) -> tuple<stream<u8>, future<result<handshake>>>;
}
5 changes: 5 additions & 0 deletions wit-0.3.0-draft/world.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package wasi:[email protected];

world imports {
import client;
}