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

    Class Reference

    A globally unique reference to a globally unique object.

    Internally stores 32 raw bytes. Most callers obtain a Reference via fromDigest, but XID (and similar content-addressable types whose bytes are the reference) construct via fromData directly.

    Implements

    Index
    REFERENCE_SIZE: 32

    Reference data size in bytes.

    • get bytes(): Uint8Array

      The bytes (a view; do not mutate).

      Returns Uint8Array

    • Create a Reference whose bytes are the SHA-256 digest of the input.

      Parameters

      • data: Uint8Array

      Returns Reference

      Prefer Reference.fromDigest(Digest.fromImage(data)) for clarity, or Reference.from(data) if data is already 32 bytes that should be wrapped without hashing.

    • The full 64-character lowercase hex of the reference.

      Returns string

    • The first 4 bytes of the reference.

      Returns Uint8Array

    • The first 4 bytes of the reference, as 8 lowercase hex characters.

      Returns string

    • The first 4 bytes as upper-case bytewords identifier.

      Parameters

      • Optionalprefix: string

        Optional prefix prepended with a single space.

      Returns string

    • The first 4 bytes as upper-case bytemojis identifier.

      Parameters

      • Optionalprefix: string

        Optional prefix prepended with a single space.

      Returns string

    • Backwards-compatible alias of refHex().

      Returns string

    • Backwards-compatible alias of refHex().

      Returns string

    • Returns the 32 raw bytes encoded as base64.

      Returns string

    • Returns a short representation of this reference in the requested format.

      Mirrors the legacy TS API; new code should prefer refHexShort, bytewordsIdentifier, or bytemojiIdentifier directly.

      Parameters

      Returns string

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

      Returns Tag[]

    • Untagged CBOR — a single byte string of the 32 raw bytes.

      Returns Cbor

    • The tagged CBOR form.

      Returns Cbor

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

      Returns UR

    • Debug-style representation: Reference(<8-hex-prefix>).

      Returns string