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.
DO NOT use the dump_x/load_x functions directly, these will be made private in
python-fido2 2.0.
Module Contents
-
fido2.cbor.CborType
-
fido2.cbor.dump_int(data, mt=0)[source]
- Parameters:
-
- Return type:
bytes
-
fido2.cbor.dump_bool(data)[source]
- Parameters:
data (bool)
- Return type:
bytes
-
fido2.cbor.dump_list(data)[source]
- Parameters:
data (Sequence[CborType])
- Return type:
bytes
-
fido2.cbor.dump_dict(data)[source]
- Parameters:
data (Mapping[CborType, CborType])
- Return type:
bytes
-
fido2.cbor.dump_bytes(data)[source]
- Parameters:
data (bytes)
- Return type:
bytes
-
fido2.cbor.dump_text(data)[source]
- Parameters:
data (str)
- Return type:
bytes
-
fido2.cbor.load_int(ai, data)[source]
- Parameters:
-
- Return type:
Tuple[int, bytes]
-
fido2.cbor.load_nint(ai, data)[source]
- Parameters:
-
- Return type:
Tuple[int, bytes]
-
fido2.cbor.load_bool(ai, data)[source]
- Parameters:
-
- Return type:
Tuple[bool, bytes]
-
fido2.cbor.load_bytes(ai, data)[source]
- Parameters:
-
- Return type:
Tuple[bytes, bytes]
-
fido2.cbor.load_text(ai, data)[source]
- Parameters:
-
- Return type:
Tuple[str, bytes]
-
fido2.cbor.load_array(ai, data)[source]
- Parameters:
-
- Return type:
Tuple[Sequence[CborType], bytes]
-
fido2.cbor.load_map(ai, data)[source]
- Parameters:
-
- Return type:
Tuple[Mapping[CborType, CborType], bytes]
-
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