| cbor_annotate | R Documentation |
Shows where each byte of CBOR goes: one line per head, with its offset,
its bytes in hex, indented by nesting, and what it is. A string's content
follows its head, 16 bytes a line, and the first of those lines previews
it. Every byte of the input appears exactly once in the hex column. This
is the view needed to review a signed message byte by byte;
cbor_diagnose() shows what the message means instead.
cbor_annotate(
x,
sequence = FALSE,
deterministic = FALSE,
duplicate_keys = FALSE,
max_depth = 256L,
max_size = 64 * 1024^2,
max_items = 1e+06
)
x |
A raw vector. |
sequence |
If |
deterministic |
If |
duplicate_keys |
If |
max_depth |
Deepest nesting allowed, counting arrays, maps and tags.
At most |
max_size |
Largest input allowed, in bytes, or |
max_items |
Most data items allowed, counting every tag and every
chunk of an indefinite-length string, or |
The input is checked first, exactly as cbor_validate() checks it. The
output is bounded by a constant multiple of the input's size: previews
stop at 32 bytes and indentation at 16 levels.
Offsets are 0-based, in decimal, as in zucbor's error conditions.
Integers show their value (negative(-501)), floats their width and
value (float16 1.5), and indefinite-length items (*) and a break.
A character vector of class cbor_annotation, one element per
line, which prints as the lines.
cbor_diagnose() for diagnostic notation.
cbor_annotate(as.raw(c(0xa2, 0x61, 0x61, 0x01, 0x61, 0x62, 0x82, 0x02, 0x03)))
# A COSE_Sign1 message's protected header, {1: -7}, inside a byte string.
cbor_annotate(cbor_encode(list(cbor_encode(cbor_map(list(1L), list(-7))), "payload")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.