/** * Copyright (c) 2022 Signum Network */ import { Ledger } from '@signumjs/core'; /** * @internal * @ignore * */ export declare const KnownTlds: string[]; /** * @ignore */ interface URI { schema: string; subdomain?: string; domain: string; tld?: string; path?: string; } /** * URI Resolver * * Resolves SRC47 compliant URIs via Signums Alias system to URLs, or other internal fields * * ```ts * const resolver = new URIResolver(ledger); * const resolvedURL = await resolver.resolve("http://arts.johndoe@signum"); * ``` * * with TLD * ```ts * const resolver = new URIResolver(ledger); * const resolvedURL = await resolver.resolve("https://arts.johndoe@crypto"); * ``` * * Or get the account Id (if set) * * ```ts * const resolver = new URIResolver(ledger); * const accountId = await resolver.resolve("https://arts.johndoe@signum/ac"); * ``` * * Also considers known top-level domains and accepts the following format for those URIs: .. (instead of `@`) * * */ export declare class URIResolver { private readonly ledger; constructor(ledger: Ledger); /** * Parses the URI. This method can be used to check SRC47 URI compliance * @param uri * @return The parsed URI components * @throws Error if URI is not compliant */ static parseURI(uri: string): URI; /** * Converts the given URI to a known top-level domain (TLD) format. * * @param {string} uri - The URI to be converted. * @return {string} - The converted URI with a known TLD format. */ static convertKnownTldUri(uri: string): string; /** * Tries to resolve the URI * @param uri A compliant URI * @return The URL or internal path, iff exists. * @throws Error if * - an alias does not exist * - alias descriptor is not SRC44 compliant * - URI cannot be resolved, * - have circular dependencies * - maxed out (>100 iterations */ resolve(uri: string): Promise; } export {};