export type Href = string | URL; export type Protocol = string; export type Domain = string; /** * @typedef {string|URL} Href * @typedef {string} Protocol * @typedef {string} Domain */ /** * Class representing an advanced security verifier for URLs. * Provides multi-layered protection including protocol, parameters, * credentials, IP addresses, and domain reputation (blacklist/whitelist). */ declare class TinyURLSecurityVerifier { #private; /** * Retrieves the current global default protocols as an array. * @returns {Protocol[]} An array of default protocols. */ static get defaultProtocols(): Protocol[]; /** * Replaces the global default protocols with a new array of protocols. * @param {Protocol[]} protocols - An array of protocol strings. * @throws {TypeError} If the input is not an array or contains non-string elements. */ static set defaultProtocols(protocols: Protocol[]); /** * Adds a new protocol to the global default list. * @param {Protocol} protocol - The protocol to add. * @throws {TypeError} If the protocol is not a string. */ static addProtocol(protocol: Protocol): void; /** * Removes a protocol from the global default list. * @param {Protocol} protocol - The protocol to remove. * @throws {TypeError} If the protocol is not a string. */ static removeProtocol(protocol: Protocol): void; /** * Resets the global default protocols list to an empty set. * @returns {void} */ static clearDefaultProtocols(): void; /** * Creates an instance of TinyURLSecurityVerifier. * Initializes the instance protocols with a copy of the current static default protocols. */ constructor(); /** * Returns the current list of protocols for this specific instance. * @returns {Protocol[]} An array of protocols. */ get protocols(): Protocol[]; /** * Returns the total count of protocols configured in this instance. * @returns {number} The number of protocols. */ get protocolsSize(): number; /** * Indicates if the protocols list should act as a whitelist. * If true, only protocols in the list are considered safe. * If false, protocols in the list are considered dangerous (blacklist mode). * @returns {boolean} */ get isWhitelistMode(): boolean; /** * Sets the mode of the protocol list. * @param {boolean} value - True for whitelist mode, false for blacklist mode. * @throws {TypeError} If the value is not a boolean. */ set isWhitelistMode(value: boolean); /** * Adds a new protocol to this specific instance's list. * @param {Protocol} protocol - The protocol to add. * @throws {TypeError} If the protocol is not a string. */ addProtocol(protocol: Protocol): void; /** * Removes a protocol from this specific instance's list. * @param {Protocol} protocol - The protocol to remove. * @throws {TypeError} If the protocol is not a string. * @returns {boolean} Returns `true` if the protocol existed and was successfully removed, or `false` if the protocol did not exist. */ removeProtocol(protocol: Protocol): boolean; /** * Clears all protocols from the instance-specific list. * @returns {void} */ clearProtocols(): void; /** * Returns the current list of allowed domains for this specific instance. * @returns {Domain[]} An array of domains. */ get allowedDomains(): Domain[]; /** * Returns the total count of allowed domains in this instance. * @returns {number} The number of allowed domains. */ get allowedDomainsSize(): number; /** * Adds a domain to the instance-specific blacklist. * @param {Domain} domain - The domain to block. * @throws {TypeError} If domain is not a string. */ addBlacklistedDomain(domain: Domain): void; /** * Removes a domain from the instance-specific blacklist. * @param {Domain} domain - The domain to remove. * @throws {TypeError} If domain is not a string. * @returns {boolean} Returns `true` if the domain existed and was successfully removed, or `false` if the domain did not exist. */ removeBlacklistedDomain(domain: Domain): boolean; /** * Returns the current list of blacklisted domains for this specific instance. * @returns {Domain[]} An array of blacklisted domains. */ get blacklistedDomains(): Domain[]; /** * Returns the total count of blacklisted domains in this instance. * @returns {number} The number of blacklisted domains. */ get blacklistedDomainsSize(): number; /** * Adds a domain to the instance-specific whitelist. * @param {Domain} domain - The domain to allow. * @throws {TypeError} If domain is not a string. */ addAllowedDomain(domain: Domain): void; /** * Removes a domain from the instance-specific whitelist. * @param {Domain} domain - The domain to remove. * @throws {TypeError} If domain is not a string. * @returns {boolean} Returns `true` if the domain existed and was successfully removed, or `false` if the domain did not exist. */ removeAllowedDomain(domain: Domain): boolean; /** * Clears all domains from the instance-specific whitelist. * @returns {void} */ clearAllowedDomains(): void; /** * Clears all domains from the instance-specific blacklist. * @returns {void} */ clearBlacklistedDomains(): void; /** * Checks if the URL contains user credentials in the authority component. * (e.g., https://user:pass@example.com) * @param {Href} href - The href address or URL instance. * @returns {boolean} True if credentials are present. * @throws {TypeError} If the argument is not a URL instance or valid href. */ hasCredentials(href: Href): boolean; /** * Checks if the hostname is an IPv4 address. * @param {Href} href - The href address or URL instance. * @returns {boolean} True if the hostname is an IPv4 address. * @throws {TypeError} If the argument is not a URL instance or valid href. */ isIPv4Address(href: Href): boolean; /** * Checks if the hostname is an IPv6 address. * @param {Href} href - The href address or URL instance. * @returns {boolean} True if the hostname is an IPv6 address. * @throws {TypeError} If the argument is not a URL instance or valid href. */ isIPv6Address(href: Href): boolean; /** * Checks if the hostname is either an IPv4 or an IPv6 address. * @param {Href} href - The href address or URL instance. * @returns {boolean} True if the hostname is an IP address. * @throws {TypeError} If the argument is not a URL instance or valid href. */ isIPAddress(href: Href): boolean; /** * Checks if the domain is present in the instance's blacklist. * @param {Href} href - The href address or URL instance. * @returns {boolean} True if the domain is blacklisted. * @throws {TypeError} If the argument is not a URL instance or valid href. */ isBlacklisted(href: Href): boolean; /** * Checks if the domain is present in the instance's whitelist. * @param {Href} href - The href address or URL instance. * @returns {boolean} True if the domain is whitelisted. * @throws {TypeError} If the argument is not a URL instance or valid href. */ isWhitelisted(href: Href): boolean; /** * Checks if the URL's primary protocol is in the local dangerous list. * @param {Href} href - The href address or URL instance to check. * @returns {boolean} True if the protocol is considered dangerous, false otherwise. * @throws {TypeError} If the provided argument is not a valid URL. */ isProtocolDangerous(href: Href): boolean; /** * Checks if any protocol present within the URL's search parameters is considered dangerous. * @param {Href} href - The href address or URL instance to check. * @returns {boolean} True if a dangerous protocol is found in search params, false otherwise. * @throws {TypeError} If the provided argument is not a valid URL. */ isSearchParamDangerous(href: Href): boolean; /** * Performs a comprehensive security scan on the provided href. * @param {Href} href - The href address or URL instance to check. * @returns {boolean} True if the URL is considered dangerous, false if it is safe. * @throws {TypeError} If the provided argument is not a valid URL. */ isDangerous(href: Href): boolean; /** * Resets all instance-specific lists (protocols, blacklisted domains, and allowed domains). * @returns {void} */ clearAll(): void; } export default TinyURLSecurityVerifier; //# sourceMappingURL=TinyURLSecurityVerifier.d.mts.map