lbry-sdk/lbrynet/schema/signature/serializer.py
2018-11-04 10:50:15 -05:00

11 lines
No EOL
412 B
Python

import struct
from collections import namedtuple
from .flags import SignatureSerializationFlag
class Signature(namedtuple("Signature", "flags signature certificate_id")):
def deserialize(cls, payload):
flag = struct.unpack("<b", payload[0])[0]
if not SignatureSerializationFlag.is_flag_valid(flag):
return Signature(SignatureSerializationFlag.ECDSA_LEGACY, )
certificate