Blockchain Commons Components TypeScript Library - v1.0.0-alpha.13
    Preparing search index...

    Class XID

    Implements

    • CborTaggedEncodable
    • CborTaggedDecodable<XID>
    • UREncodable
    Index

    Properties

    XID_SIZE: 32 = XID_SIZE

    Methods

    • Create a new XID from data (validates length).

      Returns error if the data is not the correct length.

      Parameters

      • data: Uint8Array

      Returns XID

    • Generate a random XID (for testing purposes).

      Note: In practice, XIDs should be created from the SHA-256 hash of a public signing key's CBOR encoding.

      Returns XID

    • Get hex string representation (lowercase, matching Rust implementation).

      Returns string

    • Get short reference (first 4 bytes) as hex (alias for shortDescription).

      Returns string

    • Get the first four bytes of the XID as upper-case ByteWords.

      Parameters

      • prefix: boolean = false

        If true, prepends the XID prefix "🅧 "

      Returns string

      Space-separated uppercase bytewords, e.g., "🅧 URGE DICE GURU IRIS"

    • Get the first four bytes of the XID as Bytemoji.

      Parameters

      • prefix: boolean = false

        If true, prepends the XID prefix "🅧 "

      Returns string

      Space-separated emojis, e.g., "🅧 🐻 😻 🍞 💐"

    • Returns the CBOR tags associated with XID.

      Returns Tag[]

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

      Returns Cbor

    • Returns the tagged CBOR encoding.

      Returns Cbor

    • Returns the tagged value in CBOR binary representation.

      Returns Uint8Array

    • Creates a XID by decoding it from untagged CBOR.

      Parameters

      • cbor: Cbor

      Returns XID

    • Creates a XID by decoding it from tagged CBOR.

      Parameters

      • cbor: Cbor

      Returns XID

    • Static method to decode from tagged CBOR binary data.

      Parameters

      • data: Uint8Array

      Returns XID

    • Static method to decode from untagged CBOR binary data.

      Parameters

      • data: Uint8Array

      Returns XID

    • Returns the UR representation of the XID. Note: URs use untagged CBOR since the type is conveyed by the UR type itself.

      Returns UR

    • Returns the UR string representation.

      Returns string