mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-23 20:41:04 +02:00
fc2818dd97
extension_signed_session.go implements the HMAC-signed session scheme extensions use to authenticate against their own backends (namespace scoping, on-disk persistence, rolling-key signing, expiry/refresh, and the grant exchange flow), but had zero direct or indirect test coverage. Adds table-driven tests for the pure helpers (namespace sanitization, config defaults, time parsing, URL building, Retry-After parsing, record scope normalization) plus runtime-backed tests using a mocked http.RoundTripper for the stateful flows: file persistence round-trips, status/clear, grant exchange and refresh, 401-triggered session revocation, and unauthenticated fetches surfacing the verification URL. The centerpiece is TestDoSignedSessionRequestSignature, which recomputes the rolling-key HMAC signature server-side from the request headers the client actually sent, the same way a real backend would validate it, to catch any accidental regression in the signing scheme itself (field order, rolling-key derivation, or header names).