Skip to main content

Module cbor

Module cbor 

Source
Expand description

Strict CBOR codec for protocol values.

Port of native Pi’s packages/protocol/src/cbor/. The protocol only ever carries JSON-shaped values (null, bool, number, string, array, object), so this codec implements exactly that subset of CBOR (RFC 8949) with the defensive limits native uses for untrusted payloads:

Structs§

CborError
CBOR error.
CborOptions
Codec limits (native ResolvedCborOptions).

Constants§

DEFAULT_MAX_CBOR_BYTE_LENGTH
Native DEFAULT_MAX_CBOR_BYTE_LENGTH (16 MiB).
DEFAULT_MAX_CBOR_CONTAINER_LENGTH
Native DEFAULT_MAX_CBOR_CONTAINER_LENGTH.
DEFAULT_MAX_CBOR_DEPTH
Native DEFAULT_MAX_CBOR_DEPTH.

Functions§

decode
Decode CBOR bytes into a JSON value.
encode
Encode a JSON value to CBOR bytes.