Package-level declarations

Types

Link copied to clipboard
data class ArrayBuilder<T>(parent: T, array: CborArray)

Array builder.

Link copied to clipboard

Extension for Base64 byte strings: b64'AQIDBA=='.

Link copied to clipboard
data class Bstr(val value: ByteArray) : DataItem

Byte String (major type 2).

Link copied to clipboard

Format preferred for byte strings when generating CDN text.

Link copied to clipboard
object Cbor

CBOR support routines.

Link copied to clipboard
class CborArray(val items: MutableList<DataItem>, val indefiniteLength: Boolean = false) : DataItem

Array (major type 4).

Link copied to clipboard
class CborBuilder(item: DataItem)

CBOR data item builder.

Link copied to clipboard
class CborDouble(val value: Double) : DataItem

Single-precision floating point number (major type 7).

Link copied to clipboard
class CborFloat(val value: Float) : DataItem

Single-precision floating point number (major type 7).

Link copied to clipboard
abstract class CborInt(majorType: MajorType) : DataItem

Base class for Nint and Uint.

Link copied to clipboard
class CborMap(val items: MutableMap<DataItem, DataItem>, val indefiniteLength: Boolean = false) : DataItem

Map (major type 5).

Link copied to clipboard
object Cdn

Main entry point for Concise Diagnostic Notation (CDN) parsing and generation.

Link copied to clipboard
class CdnException(message: String, val line: Int = 1, val column: Int = 1) : IllegalArgumentException

Exception thrown when parsing Concise Diagnostic Notation (CDN) fails.

Link copied to clipboard
interface CdnExtension

Interface for CDN application-oriented extension literals (e.g. dt'2026-07-27T16:00:00Z').

Link copied to clipboard

Registry for CDN application-oriented extensions.

Link copied to clipboard
data class CdnGeneratorOptions(val prettyPrint: Boolean = false, val indentSize: Int = 2, val byteStringFormat: ByteStringFormat = ByteStringFormat.HEX, val useEmbeddedCborShorthand: Boolean = true, val useEmbeddedCborOpportunistically: Boolean = true, val useEmbeddedCertsOpportunistically: Boolean = true, val useApplicationExtensions: Boolean = true, val sortMapKeys: Boolean = false, val annotateCoseOpportunistically: Boolean = true, val extensionRegistry: CdnExtensionRegistry = CdnExtensionRegistry.Default)

Options for CDN text generation (serializing DataItem to CDN string).

Link copied to clipboard
data class CdnParserOptions(val extensionRegistry: CdnExtensionRegistry = CdnExtensionRegistry.Default, val maxDepth: Int = 100)

Options for CDN text parsing (parsing CDN text to DataItem).

Link copied to clipboard

Extension for X.509 certificates: cert'''-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----'''.

Link copied to clipboard
sealed class DataItem

Abstract base class for CBOR data items.

Link copied to clipboard

Extension for RFC 3339 Date/Time: dt'2026-07-27T16:00:00Z'.

Link copied to clipboard

Enumeration of options that can be passed to Cbor.toDiagnostics.

Link copied to clipboard

Extension for explicit floating point precision bit-widths: float'16(0x7c00)'.

Link copied to clipboard

Extension for Hexadecimal byte strings: h'01020304' or h"01020304".

Link copied to clipboard
data class IndefLengthBstr(val chunks: List<ByteArray>) : DataItem

Byte String (major type 2), indefinite length.

Link copied to clipboard
data class IndefLengthTstr(val chunks: List<String>) : DataItem

Unicode String (major type 3), indefinite length.

Link copied to clipboard

Extension for IP addresses: ip'192.168.1.1' or ip'2001:db8::1'.

Link copied to clipboard

CBOR major types.

Link copied to clipboard
class MapBuilder<T>(parent: T, map: CborMap)

Map builder.

Link copied to clipboard
class Nint(val value: ULong) : CborInt

Negative Integer (major type 1).

Link copied to clipboard
class RawCbor(val encodedCbor: ByteArray) : DataItem

Data item for raw CBOR.

Link copied to clipboard
class Simple(val value: UInt) : DataItem

Simple (major type 7)

Link copied to clipboard

Extension for Byte String Concatenation: b1'...'.

Link copied to clipboard

Extension for Text String Concatenation: t1'...'.

Link copied to clipboard
class Tagged(val tagNumber: Long, val taggedItem: DataItem) : DataItem

Tag (major type 6).

Link copied to clipboard
class Tstr(val value: String) : DataItem

Unicode String (major type 3).

Link copied to clipboard
class Uint(val value: ULong) : CborInt

Unsigned Integer (major type 0).

Functions

Link copied to clipboard
inline fun <T> ArrayBuilder<T>.addCborArray(builderAction: ArrayBuilder<ArrayBuilder<T>>.() -> Unit)

Adds the DataItem for a CBOR array produced by the given builder action to a CBOR array.

Link copied to clipboard
inline fun <T> ArrayBuilder<T>.addCborMap(builderAction: MapBuilder<ArrayBuilder<T>>.() -> Unit)

Adds the DataItem for a CBOR map produced by the given builder action to a CBOR array.

Link copied to clipboard
inline fun buildCborArray(builderAction: ArrayBuilder<CborBuilder>.() -> Unit): DataItem

Builds a DataItem for a CBOR array with the given builder action.

Link copied to clipboard
inline fun buildCborMap(builderAction: MapBuilder<CborBuilder>.() -> Unit): DataItem

Builds a DataItem for a CBOR map with the given builder action.

Link copied to clipboard
inline fun <T> MapBuilder<T>.putCborArray(key: Long, builderAction: ArrayBuilder<MapBuilder<T>>.() -> Unit)
inline fun <T> MapBuilder<T>.putCborArray(key: String, builderAction: ArrayBuilder<MapBuilder<T>>.() -> Unit)
inline fun <T> MapBuilder<T>.putCborArray(key: DataItem, builderAction: ArrayBuilder<MapBuilder<T>>.() -> Unit)

Adds the DataItem for a CBOR array produced by the given builder action to a CBOR map.

Link copied to clipboard
inline fun <T> MapBuilder<T>.putCborMap(key: Long, builderAction: MapBuilder<MapBuilder<T>>.() -> Unit)
inline fun <T> MapBuilder<T>.putCborMap(key: String, builderAction: MapBuilder<MapBuilder<T>>.() -> Unit)
inline fun <T> MapBuilder<T>.putCborMap(key: DataItem, builderAction: MapBuilder<MapBuilder<T>>.() -> Unit)

Adds the DataItem for a CBOR map produced by the given builder action to a CBOR map.

Link copied to clipboard
fun DataItem.toCdn(options: CdnGeneratorOptions = CdnGeneratorOptions.Default): String

Extension function to convert a DataItem to a CDN string representation.

Link copied to clipboard

Extension to get a Simple data item for the value.

Extension to get a CborInt data item for the value.

Extension to get a Bstr data item for the value.

Extension to get a CborDouble data item for the value.

Extension to get a CborFloat data item for the value.

Extension to get a Tstr data item for the value.

Link copied to clipboard

Extension to get a date-time string data item for a point in time.

Extension to get a date-time string data item for a RFC 3339-formatted string representing a point in time.

Link copied to clipboard
fun String.toDataItemFromCdn(options: CdnParserOptions = CdnParserOptions.Default): DataItem

Extension function to parse a CDN string representation into a DataItem.

Link copied to clipboard
fun LocalDate.toDataItemFullDate(): DataItem

Extension to get a full-date data item as specified in RFC 8943.