authenticate_none

Function authenticate_none 

Source
pub async fn authenticate_none(socket: &mut ControlSocket) -> Result<(), Error>
Expand description

Authenticates to an open control socket (no credentials required).

This function sends an empty AUTHENTICATE command, which succeeds when Tor’s control port is configured without any authentication requirements.

§Preconditions

  • The socket must be connected
  • Tor must be configured with no authentication (NULL method)

§Postconditions

  • On success: The socket is authenticated
  • On failure: The socket may be disconnected by Tor

§Arguments

  • socket - A connected control socket

§Errors

Returns Error::Authentication with AuthError::SecurityFailure if Tor rejects the authentication attempt.

§Security Warning

Using NONE authentication is insecure and should only be used for:

  • Local testing environments
  • Trusted localhost connections
  • Development purposes

Never use NONE authentication in production or when the control port is accessible from untrusted networks.

§Example

use stem_rs::auth::authenticate_none;
use stem_rs::ControlSocket;

let mut socket = ControlSocket::connect_port("127.0.0.1:9051".parse()?).await?;
authenticate_none(&mut socket).await?;
// Socket is now authenticated