1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-06 08:08:45 +00:00

Bring back cbor.Raw - to be used for metadata

This commit is contained in:
gabrielkerekes 2020-07-29 08:02:59 +02:00 committed by Pavol Rusnak
parent c29d297a77
commit 0438f318b4

View File

@ -92,6 +92,8 @@ def _cbor_encode(value: Value) -> Iterable[bytes]:
yield bytes([_CBOR_PRIMITIVE + _CBOR_TRUE]) yield bytes([_CBOR_PRIMITIVE + _CBOR_TRUE])
else: else:
yield bytes([_CBOR_PRIMITIVE + _CBOR_FALSE]) yield bytes([_CBOR_PRIMITIVE + _CBOR_FALSE])
elif isinstance(value, Raw):
yield value.value
elif value is None: elif value is None:
yield bytes([_CBOR_PRIMITIVE + _CBOR_NULL]) yield bytes([_CBOR_PRIMITIVE + _CBOR_NULL])
else: else:
@ -220,6 +222,11 @@ class Tagged:
) )
class Raw:
def __init__(self, value: Value):
self.value = value
class IndefiniteLengthArray: class IndefiniteLengthArray:
def __init__(self, array: List[Value]) -> None: def __init__(self, array: List[Value]) -> None:
self.array = array self.array = array