The password authentication extension lets a server require that clients prove their identity with a username and password before any streams are created. Both sides exchange credentials as part of the Wisp v2 handshake, before the mux is returned to application code. The server rejects the connection immediately if the credentials do not match a known user.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/MercuryWorkshop/epoxy-tls/llms.txt
Use this file to discover all available pages before exploring further.
Extension details
| Field | Value |
|---|---|
| Extension ID | 0x02 |
| Extension enum | PasswordProtocolExtension |
| Builder enum | PasswordProtocolExtensionBuilder |
| Feature gate | none (always available) |
Client setup
UsePasswordProtocolExtensionBuilder::new_client to create the client-side builder. Pass Some((username, password)) to provide credentials, or None if you are on a server that has marked the extension as optional.
WispV2Handshake and enforce that the server accepted it:
Server setup
UsePasswordProtocolExtensionBuilder::new_server and provide a HashMap<String, String> mapping usernames to their expected passwords.
Map of allowed username → password pairs. The server checks the client’s submitted credentials against this map.
When
true, clients that do not send credentials are rejected with PasswordExtensionNoCreds. When false, unauthenticated clients are allowed to proceed.Error handling
| Error variant | When it occurs |
|---|---|
WispError::PasswordExtensionCredsInvalid | The client sent credentials but the username or password did not match any entry in the server’s user map |
WispError::PasswordExtensionNoCreds | The client was created with new_client(None) and has no credentials to send when the handshake requires them |
ClientMux::new / the server handshake future, before the mux is available to application code.
Full example
Credentials can also be set or changed after the builder is created using
set_creds((username, password)). This is useful when credentials are determined asynchronously after the builder is constructed but before the handshake begins.