fido2.cbor

Minimal CBOR implementation supporting a subset of functionality and types required for FIDO 2 CTAP.

Use the encode(), decode() and decode_from() functions to encode and decode objects to/from CBOR.

Attributes

CborType

Functions

encode(data)

Encodes data to a CBOR byte string.

decode_from(data)

Decodes a CBOR-encoded value from the start of a byte string.

decode(data)

Decodes data from a CBOR-encoded byte string.

Module Contents

fido2.cbor.CborType
fido2.cbor.encode(data)[source]

Encodes data to a CBOR byte string.

Parameters:

data (CborType)

Return type:

bytes

fido2.cbor.decode_from(data)[source]

Decodes a CBOR-encoded value from the start of a byte string.

Additional data after a valid CBOR object is returned as well.

Returns:

The decoded object, and any remaining data.

Parameters:

data (bytes)

Return type:

tuple[Any, bytes]

fido2.cbor.decode(data)[source]

Decodes data from a CBOR-encoded byte string.

Also validates that no extra data follows the encoded object.

Return type:

CborType