1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-16 17:42:02 +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])
else:
yield bytes([_CBOR_PRIMITIVE + _CBOR_FALSE])
elif isinstance(value, Raw):
yield value.value
elif value is None:
yield bytes([_CBOR_PRIMITIVE + _CBOR_NULL])
else:
@ -220,6 +222,11 @@ class Tagged:
)
class Raw:
def __init__(self, value: Value):
self.value = value
class IndefiniteLengthArray:
def __init__(self, array: List[Value]) -> None:
self.array = array