Skip to main content

authenticate

Function authenticate 

Source
pub async fn authenticate(
    client: &Client,
    base_url: &str,
    username: &str,
    password: &str,
) -> Result<String, ClientError>
Expand description

Perform SCRAM SHA-256 authentication handshake against a Haystack server.

Executes the three-phase handshake:

  1. HELLO: sends username, receives SCRAM challenge
  2. SCRAM: sends client proof, receives auth token and server signature
  3. Returns the auth token for subsequent Bearer authentication

§Arguments

  • client - The reqwest HTTP client to use
  • base_url - The server API root (e.g. http://localhost:8080/api)
  • username - The username to authenticate as
  • password - The user’s plaintext password

§Returns

The auth token string on success.