~ knotless Search/
↑↓ move↵ open⇧↵ all results

geesawra.industries/hydraulophone

An unofficial YouTube Music app for iPhone, iPad, and Mac.

0
0
main
152 lines · 8.4 KB Raw History

Local proof of origin

Scope

WebViewProofOfOriginProvider is an app-layer, opt-in provider for the approved high-quality/debug player probe. The normal HLS path never waits for this provider and does not require a proof token. The provider accepts the visitor data and video ID already selected by Core; it does not bootstrap a visitor or read the login session.

The provider returns two in-memory values:

  • player: visitor-bound proof for the player request;
  • streaming: video-bound proof for the stream request.

Tokens are never logged, persisted, included in diagnostics, or placed in fixtures. The visitor token is minted once per live generator and cached only until that generator's locally tracked expiry. AuraMusic uses a ten-minute safety margin before the GenerateIT TTL; Hydraulophone applies the same margin. Video tokens use a small in-memory ten-minute cache (shorter than AuraMusic's six-hour cache as a conservative local choice). A cached pair never bypasses generator expiry or visitor identity checks. invalidate() clears both token caches and the WebView generator.

Pinned protocol observation

The implementation is based on TeamAuraMusic/AuraMusic revision 185a77d31733047de06cbec619d40731755a0ec1, specifically:

The helper follows BgUtils 3.2.0 behavior at revision 54c511b2bd4e3e3707f30d2907f33167e1b61b35, copyright 2024 LuanRT, under MIT. At runtime this is a clean app-layer resource adaptation; there is no package, third-party SDK, extractor, or remote token service.

Native JNN exchange

An ephemeral, cookie-disabled URLSession posts to:

https://www.youtube.com/api/jnn/v1/Create
https://www.youtube.com/api/jnn/v1/GenerateIT

Both requests use the pinned Chrome 131 user agent, Accept: application/json, Content-Type: application/json+protobuf, the public x-goog-api-key protocol value supplied by the approved in-memory runtime configuration, and x-user-agent: grpc-web-javascript/0.1. They do not send cookies, authorization, visitor headers, or login-session data. Responses must be exactly HTTP 200, are rejected on redirect, and are bounded to 2 MiB with request/resource timeouts.

The no-argument provider initializer fails closed until the explicit probe supplies that public protocol value through the internal initializer. The provider never persists or logs it, and it does not accept or derive a personal user API key.

Create is sent as [requestKey]. The response is either the plain array in element 0 or a URL-safe Base64 string in element 1; the encoded form is decoded and each byte is offset by 97 before UTF-8 JSON parsing. The challenge uses the first interpreter string from index 1, the program at index 4, and the global VM name at index 5. A possible remote interpreter URL at index 2 is ignored and never fetched.

The helper runs the interpreter with new Function, then invokes:

vm.a(program, callback, true, undefined, noOp, [[], []])

The callback immediately invokes the asynchronous snapshot function with a captured webPoSignalOutput array. The native side sends the snapshot response to GenerateIT as [requestKey, botGuardResponse]. The returned integrity Base64 value and TTL are decoded natively. In the page world, webPoSignalOutput[0](integrityBytes) creates the minter. The provider mints the visitor identifier first and the video ID second, and converts returned bytes to URL-safe Base64 while preserving = padding.

The generator is also keyed by the visitor identity. When it is expired, terminated, or requested for another visitor, the provider drops the cached visitor token and creates a matching generator before reusing any token pair. Replacing the generator does not by itself clear the video-token cache. AuraMusic keys its cache by video ID; Hydraulophone additionally includes visitor identity so a token is not reused across visitor contexts. Both choices keep token reuse independent of the WebView generator lifecycle. Hydraulophone rejects a generator whose effective expiry (GenerateIT TTL minus the ten-minute safety margin) has passed, including if it expires while either token is being minted. A TTL shorter than the safety margin therefore fails closed. If the one-byte media-range check returns HTTP 403, High resolution invalidates the proof cache and performs one fresh proof/player/range attempt. This bounded retry is Hydraulophone recovery policy, not an AuraMusic protocol requirement; it never repeats the rejected media URL.

WebKit boundary and cancellation

Every generator gets a new WKWebsiteDataStore.nonPersistent() and a new WKWebViewConfiguration; it never uses WebSessionStore.dataStore and never seeds login cookies. A content rule list blocks all WebView network traffic. Unexpected navigation, new windows, media capture, and device-motion permission requests are denied. JavaScript is invoked with callAsyncJavaScript in the page content world using typed arguments; there is no page-visible native message bridge.

The helper is loaded with loadHTMLString and base URL https://www.youtube.com. A preflight verifies that origin, Web Crypto, and TextEncoder are available before challenge execution. XcodeGen copies proof_of_origin.html and its license file individually into the app bundle. Do not copy a top-level folder named Resources into an iOS app: bundle layout detection can then fail even when the root Info.plist is valid. The loader checks the app/resource-anchor bundles and supports a ProofOfOrigin subdirectory or the flat resource path.

Each generation has a single 12-second deadline covering WebView cold start, both native exchanges, and both token mints. It uses a generation ID and single-shot checked continuations so late WebKit, URLSession, timeout, and cancellation callbacks cannot resume a caller twice. Timeout and cancellation cancel native URLSession tasks, mark the generator dead, and release it. Backgrounding, process termination, and WebKit content-process termination do the same. Public iOS WebKit has no supported renderer force-kill API; teardown therefore uses cancellation, stopLoading, delegate detachment, and releasing the WKWebView, with the provider deadline as the hard caller-facing bound.

Intentional risks and update boundary

Simulator evidence at 21:20 on 2026-09-22: Create and GenerateIT returned HTTP 200, the isolated WebKit helper passed preflight, and both token scopes were minted. Proof-assisted, timestamp-aligned High Opus subsequently passed zero/far range reads and actual foreground WebKit decoding. This does not establish physical-device, background, or long-session acceptance.

The attributed public JNN client key is vendored in Config/PublicJNNKey.txt and included as an app resource by project.yml. All builds, including just simulator and just device-install, therefore retain proof configuration when opened from the home screen without launch environment variables. HYDRAULOPHONE_PUBLIC_JNN_KEY remains an optional runtime override. The bundled file preserves its source URL, commit and GPL attribution. This public protocol key is not a user credential; account cookies remain in Keychain. The ordinary YouTube web API key is not a substitute for this proof-specific configuration.

BotGuard, BgUtils, JNN response layouts, public request constants, and the YouTube page environment are undocumented protocol behavior and may change without notice. The adapter intentionally rejects unknown challenge shapes, does not fetch remote interpreter URLs, and does not log raw challenge data, identifiers, response bodies, URLs, or error text. If the pinned layout changes, update the smallest parser/helper boundary, provenance notes, and license notice; do not add a remote extraction fallback.