kinetex - v1.0.0-rc.1
    Preparing search index...

    Function computeDigestResponse

    • Compute the Digest Access Authentication response value per RFC 7616 §3.4.

      The response is computed as:

      HA1  = H(username:realm:password)
      HA2 = H(method:uri)
      response = H(HA1:nonce[:nc:cnonce:qop]:HA2) // when qop is present
      response = H(HA1:nonce:HA2) // when qop is absent

      where H is the hash algorithm selected by the challenge (MD5, SHA-256, or SHA-512-256). Defaults to MD5 per RFC 7616 §3.4.1.

      Parameters

      • challenge: DigestChallenge

        Parsed challenge from the server's WWW-Authenticate header.

      • username: string

        Digest auth username.

      • password: string

        Digest auth password.

      • method: string

        HTTP method (e.g. "GET", "POST").

      • uri: string

        Request URI path + query (e.g. "/dir/index.html").

      • Optionalcnonce: string

        Client nonce (random). Auto-generated if omitted.

      • Optionalnc: string

        Nonce count as 8-char zero-padded hex (e.g. "00000001"). Defaults to "00000001" if omitted.

      Returns Promise<string>

      The hex-encoded response hash.

      const challenge = parseDigestChallenge(wwwAuthHeader);
      const response = await computeDigestResponse(challenge, "Mufasa",
      "Circle Of Life", "GET", "/dir/index.html");