decodeCBORToNativeValue()

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:

Definition

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

Parameters

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