mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-10-16 22:07:30 +02:00
refactor: move vendor app credentials and signing keys into config
The provider apps' own identifiers and protocol keys were scattered as constants across six packages. They are not user secrets and stay baked in so the tool still works out of the box, but they are now mirrored into the config so that when a provider rotates one, a user can fix their install with a config edit instead of waiting for a release. Moved, each with the current value as the default in internal/config: qobuz mobile_app_id, mobile_app_secret tidal app_client_id, app_client_secret deezer api_key, gateway_key, blowfish_secret yandex sign_key, legacy_mp3_sign_salt beatport app_client_id applyVendorDefaults backfills any empty value, so configs written before these keys existed keep working and the clients never have to nil-check them. Each client reads through a small accessor; the package-level signing helpers (mobileSignRequest, yandexDownloadSign, legacyDirectURL, deriveGatewayAuthToken and friends, deriveDeezerBlowfishKey) now take the key as a parameter instead of closing over a constant. The blowfish secret reaches internal/download through a field on Downloader set by app.New. The blowfish key derivation XORs 16 bytes of the secret, so a mistyped override would have panicked; a wrong-length value is now rejected with a warning and the built-in value is used. Tests pin the length and that the qobuz mobile secret is valid hex, since the HKDF step requires it. Also drops soundcloud.client_id and soundcloud.app_version: soundcloud goes through yt-dlp, which supplies its own, so nothing read them. config.toml.example documents each new key as "leave empty unless the vendor rotates theirs". Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
13 files changed
+323
-61
No files matched your search
@@ -728,7 +728,7 @@ func TestMobileUserAutologIncludesRefreshToken(t *testing.T) {
|
||||
func testMobileToken(t *testing.T) string {
|
||||
t.Helper()
|
||||
plain := []byte(strings.Repeat("A", 64) + strings.Repeat("B", 16) + strings.Repeat("C", 16))
|
||||
enc, err := aesECBEncrypt([]byte(gatewayDec), plain)
|
||||
enc, err := aesECBEncrypt([]byte(config.DefaultDeezerGatewayKey), plain)
|
||||
if err != nil {
|
||||
t.Fatalf("aesECBEncrypt() error = %v", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user