BC-DCBOR TypeScript Library - v1.0.0-alpha.13
    Preparing search index...

    Variable Cbor

    Cbor: {
        False: { isCbor: true; type: 7; value: { type: "False" } } & CborMethods;
        True: { isCbor: true; type: 7; value: { type: "True" } } & CborMethods;
        Null: { isCbor: true; type: 7; value: { type: "Null" } } & CborMethods;
        NaN: { isCbor: true; type: 7; value: { type: "Float"; value: number } } & CborMethods;
        from(value: CborInput): Cbor;
        tryFromData(data: Uint8Array): Cbor;
        tryFromHex(hex: string): Cbor;
    }

    CBOR constants and helper methods.

    Provides constants for common simple values (False, True, Null) and static methods matching the Rust CBOR API for encoding/decoding.

    Type Declaration

    • False: { isCbor: true; type: 7; value: { type: "False" } } & CborMethods
    • True: { isCbor: true; type: 7; value: { type: "True" } } & CborMethods
    • Null: { isCbor: true; type: 7; value: { type: "Null" } } & CborMethods
    • NaN: { isCbor: true; type: 7; value: { type: "Float"; value: number } } & CborMethods
    • from: function
      • Creates a CBOR value from any JavaScript value.

        Matches Rust's CBOR::from() behavior for various types.

        Parameters

        • value: CborInput

          Any JavaScript value (number, string, boolean, null, array, object, etc.)

        Returns Cbor

        A CBOR symbolic representation with instance methods

    • tryFromData: function
      • Decodes binary data into CBOR symbolic representation.

        Matches Rust's CBOR::try_from_data() method.

        Parameters

        • data: Uint8Array

          The binary data to decode

        Returns Cbor

        A CBOR value with instance methods

        Error if the data is not valid CBOR or violates dCBOR encoding rules

    • tryFromHex: function
      • Decodes a hexadecimal string into CBOR symbolic representation.

        Matches Rust's CBOR::try_from_hex() method.

        Parameters

        • hex: string

          A string containing hexadecimal characters

        Returns Cbor

        A CBOR value with instance methods

        Error if the hex string is invalid or the resulting data is not valid dCBOR