Skip to main content

Module digest

Module digest 

Source
Expand description

HTTP Digest access authentication (RFC 2617) โ€” hand-rolled for HikVision ISAPI.

The flow lives in the service layer: send a request unauthenticated, and on 401 read the WWW-Authenticate header, build an Authorization: Digest ... header with digest_auth_header, and retry once. The MD5 hashing uses the md-5 crate; the client nonce is drawn from the OS CSPRNG (mirroring auth.rs / services/onvif.rs).

Functionsยง

digest_auth_header
Compute an HTTP Digest Authorization header for method+uri given a WWW-Authenticate challenge. Returns None when the challenge lacks the required realm/nonce. When the server offers qop=auth, a fresh client nonce (cnonce) is generated and nc is 00000001.