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

    Class UUID

    Universally Unique Identifier (UUID) - 16-byte identifier

    UUIDs are 128-bit (16-byte) identifiers that are designed to be unique across space and time. This implementation creates type 4 (random) UUIDs, following the UUID specification:

    • Version field (bits 48-51) is set to 4, indicating a random UUID
    • Variant field (bits 64-65) is set to 2, indicating RFC 4122/DCE 1.1 UUID variant

    Unlike ARIDs, UUIDs:

    • Are shorter (128 bits vs 256 bits)
    • Contain version and variant metadata within the identifier
    • Have a canonical string representation with 5 groups separated by hyphens

    The canonical textual representation of a UUID takes the form: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx where each x is a hexadecimal digit.

    CBOR Serialization

    UUID is serialized to CBOR with tag 37 (standard UUID tag).

    UR Serialization

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

    Implements

    • ToCbor
    • ToUR
    Index
    UUID_SIZE: number = UUID_SIZE

    The byte length of a UUID.

    • get bytes(): Uint8Array

      A copy of the bytes; mutating it does not touch this value.

      Returns Uint8Array

    • Create a UUID from raw bytes.

      Parameters

      • data: Uint8Array

      Returns UUID

    • Create a UUID from hex string (32 hex chars)

      Parameters

      • hex: string

      Returns UUID

    • A UUID from its text, as the reference's from_str: Rust str::trim, every - removed, strict hex (Hex on a malformed string), and 16 bytes (InvalidSize otherwise). Neither the dash positions nor the digit count between them is checked.

      Parameters

      • uuidString: string

      Returns UUID

    • Generate a random UUID (v4)

      Parameters

      • __namedParameters: RngOptions = {}

      Returns UUID

    • Get hex string representation (lowercase, as the reference implementation does implementation).

      Returns string

    • Get standard UUID string representation. Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

      Returns string

    • Get base64 representation.

      Returns string

    • Compare with another UUID.

      Parameters

      Returns boolean

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

      Returns Tag[]

    • Returns the untagged CBOR encoding (as a byte 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

      • cbor: Cbor

      Returns UUID