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:
CBORNotWellFormedError
: CBOR is not well formed.CBORTooDeepError
: The CBOR data is too deep.CBORInvalidError
: Invalid data.
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.