import Cdn from '../Loaders/Cdn'; /** Keeps CDN credentials separate while preserving other query values verbatim. */ export default class CdnTokenRegistry { private _authParamNames; private _learnedCredentialByHost; private _decisionTokenByHost; private _decisionCdns; private _retainedHosts; /** Keeps these hosts' credentials when a later decision no longer lists them (see `_retainedHosts`). */ retainHosts(hosts: string[]): void; /** * Forget credential parameter names learned from the previous content. * * A decision may use a customer-specific name such as `foo`. That name is * only a credential for that content. Keeping it in the registry after a * content handoff makes an unrelated `foo=episode42` query look like auth * material and silently drops it from the next request. */ resetForNewContent(): void; /** The credential last known for `host`: the one it issued itself, else its decision token. */ credentialForHost(host: string): string; learnFromDecision(cdnList: Map): void; /** * Learns the decision token of these providers' hosts only, by the same rule as `learnFromDecision`, and * forgets nothing else. For hosts a decision names but the CDN list in use does not (C15). */ learnHostTokens(providers: Array<{ host?: string; auth?: { signed_url_info?: { token?: string; }; }; }>): void; learnFromRedirect(requestUrl?: string, responseUrl?: string): void; credentialFor(cdn: Cdn): string; hasCredentialFor(cdn: Cdn): boolean; stripAuthParams(query?: string): string; /** * For a request where we apply no credential: keeps a credential param only when the request goes to * the host that credential was issued for, other params untouched and in order. The issuer is the * CDN host that minted it when this registry knows it (a decision token, a redirect-learned token); * any other credential came with the player's URL, so it belongs to that URL's host, `sourceHost`. * Android `CdnTokenRegistry.isolateCredentials` parity. */ isolateCredentials(query: string | undefined, sourceHost: string, targetHost: string): string; /** Whether the query carries any param known to be a CDN credential. */ hasKnownCredential(query?: string): boolean; /** The hosts this registry saw issue exactly this `name=value` credential. */ private _issuersOf; getAuthParamNames(): string[]; private _pairsIn; private _nameOf; }