@blockchaincommons/uniform-resources - v1.0.0-beta.3
    Preparing search index...

    A UR: a URType and a CBOR payload, spelled ur:<type>/<minimal bytewords of the CBOR>.

    Index
    • A UR from an already-validated type and a decoded CBOR value.

      Parameters

      Returns UR

    • get cbor(): Cbor

      The payload.

      Returns Cbor

    • A UR of type over cbor.

      Parameters

      • type: string | URType
      • cbor: Cbor

      Returns UR

      InvalidType for a malformed type string.

    • Parse a single-part UR string (any case: the whole string is lower-cased first, as the reference's UR::from_ur_string does).

      Parameters

      • urString: string

      Returns UR

      In the reference's order: InvalidScheme (no ur:), TypeUnspecified (no /), InvalidType, then Decoder for what the reference's ur::decode rejects (a multipart header that is not two u16s, "Invalid indices"; or the payload's bytewords, "invalid word" / "invalid checksum" / "invalid length" / non-ASCII), NotSinglePart for a well-formed multipart string, and Cbor.

    • The string for already-encoded CBOR bytes.

      Parameters

      • type: string | URType
      • cborBytes: Uint8Array

      Returns string

      InvalidType; InvalidParameter for a non-Uint8Array.

    • The type and CBOR bytes of a single-part UR string, without decoding the CBOR; the checks and their order are those of UR.parse.

      Parameters

      • urString: string

      Returns { type: URType; bytes: Uint8Array<ArrayBuffer> }

      • type: URType

        The UR type.

      • bytes: Uint8Array<ArrayBuffer>

        The CBOR bytes, not yet decoded.

    • ur:<type>/<bytewords>

      Returns string

    • Upper-case form for alphanumeric QR encoding.

      Returns string

    • UTF-8 bytes of toQRString.

      Returns Uint8Array<ArrayBuffer>

    • Whether the UR's type is type.

      Parameters

      Returns boolean

      InvalidParameter for anything but a string or URType.

    • Throws unless the UR's type is type.

      Parameters

      Returns void

      UnexpectedType

    • Same type and structurally equal CBOR, as the reference's PartialEq compares them.

      Parameters

      • other: UR

      Returns boolean