@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
24 lines • 1.41 kB
TypeScript
import type { LiveAppManifest } from "../platform/types";
/**
* Checks if two URLs are on the same base domain and protocol
* This allows matching across subdomains (e.g., example.com matches subdomain.example.com)
*/
export declare function isSameDomain(url1: string | undefined, url2: string | undefined): boolean;
/**
* Applies a custom dapp URL to a manifest if it's on the same domain as the original URL
*/
export declare function applyCustomDappUrl<T extends LiveAppManifest>(manifest: T | null | undefined, customDappUrl: string | null | undefined): T | null | undefined;
/**
* Checks if a URL is allowed by the manifest's domains array (origin-whitelist semantics).
* Used on desktop to mirror mobile's originWhitelist={manifest.domains} behavior.
* - Only allows schemes that appear in domains (e.g. https:, optionally http:).
* - Rejects javascript:, data:, file:, etc.
* - Each domain entry is origin-style: "https://*", "https://example.com", "http://".
* - Supports trailing "*" for "any host" with that protocol.
*
* @param url - The URL to check (e.g. navigation target)
* @param domains - Array of origin patterns from the manifest (e.g. ["https://*"])
* @returns true if the URL's origin is allowed by at least one pattern
*/
export declare function isUrlAllowedByManifestDomains(url: string, domains: string[]): boolean;
//# sourceMappingURL=manifestDomainUtils.d.ts.map