@blockchaincommons/components - v1.0.0-beta.4
    Preparing search index...

    Class URI

    Uniform Resource Identifier (URI) - String-based identifier

    A URI is a string of characters that unambiguously identifies a particular resource. This implementation validates URIs using the URL API to ensure conformance to RFC 3986.

    URIs are commonly used for:

    • Web addresses (URLs like "https://example.com")
    • Resource identifiers in various protocols
    • Namespace identifiers
    • References to resources in distributed systems

    CBOR Serialization

    URI is serialized to CBOR with tag 32 (standard URI tag).

    UR Serialization

    When serialized as a Uniform Resource (UR), a URI is represented with the type "url".

    Implements

    • ToCbor
    • ToUR
    Index
    • get raw(): string

      Get the raw URI string.

      Returns string

    • get scheme(): string | null

      Get scheme (e.g., "http", "https", "urn").

      Returns string | null

    • get length(): number

      Get the length of the URI string.

      Returns number

    • Creates a new URI from a string with validation.

      Parameters

      • uri: string

      Returns URI

    • Get the URI as a string reference.

      Returns string

    • Get the URI string.

      Returns string

    • Get the URI string (alias).

      Returns string

    • Get path component.

      Returns string

    • Check if URI is absolute (has a scheme).

      Returns boolean

    • Check if URI is relative.

      Returns boolean

    • Compare with another URI.

      Parameters

      Returns boolean

    • Check if URI starts with given prefix.

      Parameters

      • prefix: string

      Returns boolean

    • Get base64 representation of the URI string.

      Returns string

    • The CBOR tags this type decodes from; the first one is used to encode.

      Returns Tag[]

    • Returns the untagged CBOR encoding (as a text string).

      Returns Cbor

    • The tagged CBOR form.

      Returns Cbor

    • As a UR, typed by the first tag's name.

      Returns UR

    • Decode tagged or untagged CBOR.

      Parameters

      • cborValue: Cbor

      Returns URI