2018-09-17 22:13:30 +02:00
|
|
|
from copy import deepcopy
|
|
|
|
|
2019-02-26 22:26:15 +01:00
|
|
|
from lbrynet.schema.proto2 import signature_pb2 as signature_pb
|
2019-02-28 22:54:37 +01:00
|
|
|
from lbrynet.schema.legacy_schema_v1 import VERSION_MAP
|
|
|
|
from lbrynet.schema.constants import ECDSA_CURVES
|
2019-03-06 03:37:44 +01:00
|
|
|
from lbrynet.schema.baseschema import Schema
|
2018-09-17 22:13:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Signature(Schema):
|
|
|
|
@classmethod
|
|
|
|
def load(cls, message):
|
|
|
|
_signature = deepcopy(message)
|
|
|
|
_message_pb = signature_pb.Signature()
|
|
|
|
_message_pb.version = VERSION_MAP[_signature.pop("version")]
|
|
|
|
_message_pb.signatureType = ECDSA_CURVES[_signature.pop("signatureType")]
|
|
|
|
_message_pb.certificateId = _signature.pop("certificateId")
|
|
|
|
_message_pb.signature = _signature.pop("signature")
|
|
|
|
return cls._load(_signature, _message_pb)
|