Decodes the CBOR-encoded data, and returns the decoded value as native JS values and the number of bytes decoded. This just uses decodeCBOR() and transformCBORValueToNative().

Use decodeCBORToNativeValueNoLeftoverBytes() if you don't expect any leftover bytes.

It can throw one of:


function decodeCBORNoLeftoverBytes(
	data: Uint8Array,
	maxDepth: number
): [data: unknown, size: number];


  • data
  • maxDepth: How much nesting is allowed (exclusive) where the first iteration is depth 0.