Package-level declarations
Types
A growable byte buffer for encoders. Methods chain; toByteArray returns a copy of what was written.
Marks a published SPI that nothing implements yet, such as DatagramSecurity, which the DTLS engine will implement. Its shape may still change when the first implementation lands; the marker is removed in the same release as that implementation and its interop tests.
Marks plumbing that kcoap's modules share with each other, such as byte builders and option codecs. It is public only because Kotlin has no visibility between modules of one library: it may change or disappear in any release, and it is left out of the published ABI dumps.
The root of the exceptions kcoap's facades fail with at runtime: what went wrong with the peer, the network, message security, the protocol or the endpoint's lifecycle, as opposed to a mistake of the caller, which is an IllegalArgumentException or IllegalStateException. Each protocol has its own subtype, which says what failed and carries what that protocol needs to answer:
Functions
Compares two arrays in time that depends only on their lengths, never on where they differ. Use it for every comparison of a MAC, tag or other secret-derived value.
"0a ff".hexToBytes() contentEquals byteArrayOf(0x0a, 0xff).
Big-endian unsigned encoding of value in the fewest bytes; zero encodes as an empty array.