URI Resolver

Resolves SRC47 compliant URIs via Signums Alias system to URLs, or other internal fields

const resolver = new URIResolver(ledger);
const resolvedURL = await resolver.resolve("http://arts.johndoe@signum");

with TLD

const resolver = new URIResolver(ledger);
const resolvedURL = await resolver.resolve("https://arts.johndoe@crypto");

Or get the account Id (if set)

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 @)

Constructors

Methods

  • Tries to resolve the URI

    Parameters

    • uri: string

      A compliant URI

    Returns Promise<unknown>

    The URL or internal path, iff exists.

    Error if

    • an alias does not exist
    • alias descriptor is not SRC44 compliant
    • URI cannot be resolved,
    • have circular dependencies
    • maxed out (>100 iterations
  • Converts the given URI to a known top-level domain (TLD) format.

    Parameters

    • uri: string

      The URI to be converted.

    Returns string

    • The converted URI with a known TLD format.
  • Parses the URI. This method can be used to check SRC47 URI compliance

    Parameters

    • uri: string

    Returns URI

    The parsed URI components

    Error if URI is not compliant