Skip to content

v0.1.0

Latest

Choose a tag to compare

@nnabeyang nnabeyang released this 01 Aug 12:59
0.1.0
068a3f9

Deterministic and policy-constrained CBOR

  • Added CborEncoder.Options and CborDecoder.Options, including .deterministicCbor presets for the core deterministic encoding requirements in RFC 8949 Section 4.2.1.
  • Added opt-in policies for map keys, simple values, floating-point representations, valid UTF-8 text, top-level item count, and CBOR tag allowlists.

Safer and more flexible decoding

  • Added configurable CborDecoder.Limits for nesting depth, container size, and string size. Malformed and truncated payloads now fail with decoding errors instead of trapping.
  • Added decodePrefix(_:from:), which returns the decoded value and the number of bytes consumed, and exposed CborDecoder.userInfo to top-level, nested, and tagged values.

Fixes

  • Corrected RFC 8949 major type 7 handling, rejected duplicate map keys during deterministic validation, and fixed a crash when decoding Data slices with a non-zero start index.

Compatibility notes

  • The package now requires Swift tools 6.1, up from 5.10. The minimum deployment targets remain macOS 11 and iOS 14.
  • Decoder resource limits are enabled by default: a nesting depth of 64, 100,000 elements per container, and 2 MiB per string. These limits can be customized through CborDecoder.Limits.