migrate cert + adapt to latest types repo

This commit is contained in:
Victor Shyba 2019-03-05 23:37:44 -03:00 committed by Lex Berezhny
parent 291d65070d
commit df5662136d
21 changed files with 221 additions and 156 deletions

View file

@ -5,7 +5,7 @@ from google.protobuf.message import DecodeError as DecodeError_pb # pylint: dis
from collections import OrderedDict
from lbrynet.schema.proto2 import claim_pb2
from lbrynet.schema.proto2 import legacy_claim_pb2
from lbrynet.schema.signature import Signature
from lbrynet.schema.validator import get_validator
from lbrynet.schema.signer import get_signer
@ -19,7 +19,7 @@ from lbrynet.schema.fee import Fee
class ClaimDict(OrderedDict):
def __init__(self, claim_dict=None, detached_signature: Signature=None):
if isinstance(claim_dict, claim_pb2.Claim):
if isinstance(claim_dict, legacy_claim_pb2.Claim):
raise Exception("To initialize %s with a Claim protobuf use %s.load_protobuf" %
(self.__class__.__name__, self.__class__.__name__))
self.detached_signature = detached_signature
@ -151,7 +151,7 @@ class ClaimDict(OrderedDict):
"""Load a ClaimDict from a serialized protobuf string"""
detached_signature = Signature.flagged_parse(serialized)
temp_claim = claim_pb2.Claim()
temp_claim = legacy_claim_pb2.Claim()
try:
temp_claim.ParseFromString(detached_signature.payload)
except DecodeError_pb:

View file

@ -0,0 +1,46 @@
import json
from copy import deepcopy
import google.protobuf.json_format as json_pb # pylint: disable=no-name-in-module
from google.protobuf.message import Message # pylint: disable=no-name-in-module,import-error
from lbrynet.schema.proto3 import claim_pb2 as claim_pb
class Schema(Message):
@classmethod
def load(cls, message):
raise NotImplementedError
@classmethod
def _load(cls, data, message):
if isinstance(data, dict):
data = json.dumps(data)
return json_pb.Parse(data, message)
class Claim(Schema):
CLAIM_TYPE_STREAM = 0 #fixme: 0 is unset, should be fixed on proto file to be 1 and 2!
CLAIM_TYPE_CERT = 1
@classmethod
def load(cls, message: dict):
_claim = deepcopy(message)
_message_pb = claim_pb.Claim()
if "certificate" in _claim: # old protobuf, migrate
_cert = _claim.pop("certificate")
assert isinstance(_cert, dict)
_message_pb.type = Claim.CLAIM_TYPE_CERT
_message_pb.channel.MergeFrom(claim_pb.Channel(public_key=_cert.pop("publicKey")))
_claim = {} # so we dont need to know what other fields we ignored
elif "channel" in _claim:
_channel = _claim.pop("channel")
_message_pb.type = Claim.CLAIM_TYPE_CERT
_message_pb.channel = claim_pb.Channel(**_channel)
elif "stream" in _claim:
pass # fixme
else:
raise AttributeError
return cls._load(_claim, _message_pb)

View file

@ -7,6 +7,18 @@ from lbrynet.schema.legacy.migrate import migrate as schema_migrator
from lbrynet.schema.claim import ClaimDict
def migrate_legacy_protobuf(old_proto_bytes: bytes):
# TODO: where to put this?
from lbrynet.schema.proto2.legacy_claim_pb2 import Claim as OldClaimPB
from google.protobuf import json_format # pylint: disable=no-name-in-module
from lbrynet.schema.encoding import decode_b64_fields
from lbrynet.schema.current_schema.claim import Claim as CurrentClaim
old_msg = OldClaimPB()
old_msg.ParseFromString(old_proto_bytes)
old_json = json.loads(json_format.MessageToJson(old_msg, True))
return CurrentClaim.load(decode_b64_fields(old_json))
def migrate_json_claim_value(decoded_json):
try:

View file

@ -1,7 +1,7 @@
from copy import deepcopy
from lbrynet.schema.proto2 import certificate_pb2 as cert_pb
from lbrynet.schema.legacy_schema_v1.schema import Schema
from lbrynet.schema.baseschema import Schema
from lbrynet.schema.legacy_schema_v1 import VERSION_MAP, V_0_0_1
from lbrynet.schema.constants import ECDSA_CURVES, CURVE_NAMES
from lbrynet.schema.validator import get_key_type_from_dem

View file

@ -1,10 +1,10 @@
from copy import deepcopy
from lbrynet.schema.proto2 import claim_pb2 as claim_pb
from lbrynet.schema.proto2 import legacy_claim_pb2 as claim_pb
from lbrynet.schema.legacy_schema_v1 import VERSION_MAP
from lbrynet.schema.legacy_schema_v1.signature import Signature
from lbrynet.schema.legacy_schema_v1.certificate import Certificate
from lbrynet.schema.legacy_schema_v1.schema import Schema
from lbrynet.schema.baseschema import Schema
from lbrynet.schema.legacy_schema_v1.stream import Stream

View file

@ -1,7 +1,7 @@
from copy import deepcopy
from lbrynet.schema.proto2 import fee_pb2 as fee_pb
from lbrynet.schema.legacy_schema_v1.schema import Schema
from lbrynet.schema.baseschema import Schema
from lbrynet.schema.legacy_schema_v1 import VERSION_MAP
from lbrynet.schema.constants import CURRENCY_MAP

View file

@ -1,7 +1,7 @@
from copy import deepcopy
from lbrynet.schema.proto2 import metadata_pb2 as metadata_pb
from lbrynet.schema.legacy_schema_v1.fee import Fee
from lbrynet.schema.legacy_schema_v1.schema import Schema
from lbrynet.schema.baseschema import Schema
from lbrynet.schema.legacy_schema_v1 import VERSION_MAP

View file

@ -1,15 +0,0 @@
import json
import google.protobuf.json_format as json_pb # pylint: disable=no-name-in-module
from google.protobuf.message import Message # pylint: disable=no-name-in-module,import-error
class Schema(Message):
@classmethod
def load(cls, message):
raise NotImplementedError
@classmethod
def _load(cls, data, message):
if isinstance(data, dict):
data = json.dumps(data)
return json_pb.Parse(data, message)

View file

@ -3,7 +3,7 @@ from copy import deepcopy
from lbrynet.schema.proto2 import signature_pb2 as signature_pb
from lbrynet.schema.legacy_schema_v1 import VERSION_MAP
from lbrynet.schema.constants import ECDSA_CURVES
from lbrynet.schema.legacy_schema_v1.schema import Schema
from lbrynet.schema.baseschema import Schema
class Signature(Schema):

View file

@ -1,7 +1,7 @@
from copy import deepcopy
from lbrynet.schema.proto2 import source_pb2 as source_pb
from lbrynet.schema.legacy_schema_v1 import SOURCE_TYPES, LBRY_SD_HASH_LENGTH, VERSION_MAP
from lbrynet.schema.legacy_schema_v1.schema import Schema
from lbrynet.schema.baseschema import Schema
from lbrynet.schema.error import InvalidSourceHashLength

View file

@ -4,7 +4,7 @@ from lbrynet.schema.proto2 import stream_pb2 as stream_pb
from lbrynet.schema.legacy_schema_v1.source import Source
from lbrynet.schema.legacy_schema_v1 import VERSION_MAP
from lbrynet.schema.legacy_schema_v1.metadata import Metadata
from lbrynet.schema.legacy_schema_v1.schema import Schema
from lbrynet.schema.baseschema import Schema
class Stream(Schema):

View file

@ -17,15 +17,15 @@ _sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='certificate.proto',
package='pb',
package='legacy_pb',
syntax='proto2',
serialized_options=None,
serialized_pb=_b('\n\x11\x63\x65rtificate.proto\x12\x02pb\"\x94\x01\n\x0b\x43\x65rtificate\x12(\n\x07version\x18\x01 \x02(\x0e\x32\x17.pb.Certificate.Version\x12\x1c\n\x07keyType\x18\x02 \x02(\x0e\x32\x0b.pb.KeyType\x12\x11\n\tpublicKey\x18\x04 \x02(\x0c\"*\n\x07Version\x12\x13\n\x0fUNKNOWN_VERSION\x10\x00\x12\n\n\x06_0_0_1\x10\x01*Q\n\x07KeyType\x12\x1b\n\x17UNKNOWN_PUBLIC_KEY_TYPE\x10\x00\x12\x0c\n\x08NIST256p\x10\x01\x12\x0c\n\x08NIST384p\x10\x02\x12\r\n\tSECP256k1\x10\x03')
serialized_pb=_b('\n\x11\x63\x65rtificate.proto\x12\tlegacy_pb\"\xa2\x01\n\x0b\x43\x65rtificate\x12/\n\x07version\x18\x01 \x02(\x0e\x32\x1e.legacy_pb.Certificate.Version\x12#\n\x07keyType\x18\x02 \x02(\x0e\x32\x12.legacy_pb.KeyType\x12\x11\n\tpublicKey\x18\x04 \x02(\x0c\"*\n\x07Version\x12\x13\n\x0fUNKNOWN_VERSION\x10\x00\x12\n\n\x06_0_0_1\x10\x01*Q\n\x07KeyType\x12\x1b\n\x17UNKNOWN_PUBLIC_KEY_TYPE\x10\x00\x12\x0c\n\x08NIST256p\x10\x01\x12\x0c\n\x08NIST384p\x10\x02\x12\r\n\tSECP256k1\x10\x03')
)
_KEYTYPE = _descriptor.EnumDescriptor(
name='KeyType',
full_name='pb.KeyType',
full_name='legacy_pb.KeyType',
filename=None,
file=DESCRIPTOR,
values=[
@ -48,8 +48,8 @@ _KEYTYPE = _descriptor.EnumDescriptor(
],
containing_type=None,
serialized_options=None,
serialized_start=176,
serialized_end=257,
serialized_start=197,
serialized_end=278,
)
_sym_db.RegisterEnumDescriptor(_KEYTYPE)
@ -62,7 +62,7 @@ SECP256k1 = 3
_CERTIFICATE_VERSION = _descriptor.EnumDescriptor(
name='Version',
full_name='pb.Certificate.Version',
full_name='legacy_pb.Certificate.Version',
filename=None,
file=DESCRIPTOR,
values=[
@ -77,35 +77,35 @@ _CERTIFICATE_VERSION = _descriptor.EnumDescriptor(
],
containing_type=None,
serialized_options=None,
serialized_start=132,
serialized_end=174,
serialized_start=153,
serialized_end=195,
)
_sym_db.RegisterEnumDescriptor(_CERTIFICATE_VERSION)
_CERTIFICATE = _descriptor.Descriptor(
name='Certificate',
full_name='pb.Certificate',
full_name='legacy_pb.Certificate',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='version', full_name='pb.Certificate.version', index=0,
name='version', full_name='legacy_pb.Certificate.version', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='keyType', full_name='pb.Certificate.keyType', index=1,
name='keyType', full_name='legacy_pb.Certificate.keyType', index=1,
number=2, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='publicKey', full_name='pb.Certificate.publicKey', index=2,
name='publicKey', full_name='legacy_pb.Certificate.publicKey', index=2,
number=4, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
@ -124,8 +124,8 @@ _CERTIFICATE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=26,
serialized_end=174,
serialized_start=33,
serialized_end=195,
)
_CERTIFICATE.fields_by_name['version'].enum_type = _CERTIFICATE_VERSION
@ -138,7 +138,7 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
Certificate = _reflection.GeneratedProtocolMessageType('Certificate', (_message.Message,), dict(
DESCRIPTOR = _CERTIFICATE,
__module__ = 'certificate_pb2'
# @@protoc_insertion_point(class_scope:pb.Certificate)
# @@protoc_insertion_point(class_scope:legacy_pb.Certificate)
))
_sym_db.RegisterMessage(Certificate)

View file

@ -16,17 +16,17 @@ _sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='fee.proto',
package='pb',
package='legacy_pb',
syntax='proto2',
serialized_options=None,
serialized_pb=_b('\n\tfee.proto\x12\x02pb\"\xd5\x01\n\x03\x46\x65\x65\x12 \n\x07version\x18\x01 \x02(\x0e\x32\x0f.pb.Fee.Version\x12\"\n\x08\x63urrency\x18\x02 \x02(\x0e\x32\x10.pb.Fee.Currency\x12\x0f\n\x07\x61\x64\x64ress\x18\x03 \x02(\x0c\x12\x0e\n\x06\x61mount\x18\x04 \x02(\x02\"*\n\x07Version\x12\x13\n\x0fUNKNOWN_VERSION\x10\x00\x12\n\n\x06_0_0_1\x10\x01\";\n\x08\x43urrency\x12\x14\n\x10UNKNOWN_CURRENCY\x10\x00\x12\x07\n\x03LBC\x10\x01\x12\x07\n\x03\x42TC\x10\x02\x12\x07\n\x03USD\x10\x03')
serialized_pb=_b('\n\tfee.proto\x12\tlegacy_pb\"\xe3\x01\n\x03\x46\x65\x65\x12\'\n\x07version\x18\x01 \x02(\x0e\x32\x16.legacy_pb.Fee.Version\x12)\n\x08\x63urrency\x18\x02 \x02(\x0e\x32\x17.legacy_pb.Fee.Currency\x12\x0f\n\x07\x61\x64\x64ress\x18\x03 \x02(\x0c\x12\x0e\n\x06\x61mount\x18\x04 \x02(\x02\"*\n\x07Version\x12\x13\n\x0fUNKNOWN_VERSION\x10\x00\x12\n\n\x06_0_0_1\x10\x01\";\n\x08\x43urrency\x12\x14\n\x10UNKNOWN_CURRENCY\x10\x00\x12\x07\n\x03LBC\x10\x01\x12\x07\n\x03\x42TC\x10\x02\x12\x07\n\x03USD\x10\x03')
)
_FEE_VERSION = _descriptor.EnumDescriptor(
name='Version',
full_name='pb.Fee.Version',
full_name='legacy_pb.Fee.Version',
filename=None,
file=DESCRIPTOR,
values=[
@ -41,14 +41,14 @@ _FEE_VERSION = _descriptor.EnumDescriptor(
],
containing_type=None,
serialized_options=None,
serialized_start=128,
serialized_end=170,
serialized_start=149,
serialized_end=191,
)
_sym_db.RegisterEnumDescriptor(_FEE_VERSION)
_FEE_CURRENCY = _descriptor.EnumDescriptor(
name='Currency',
full_name='pb.Fee.Currency',
full_name='legacy_pb.Fee.Currency',
filename=None,
file=DESCRIPTOR,
values=[
@ -71,42 +71,42 @@ _FEE_CURRENCY = _descriptor.EnumDescriptor(
],
containing_type=None,
serialized_options=None,
serialized_start=172,
serialized_end=231,
serialized_start=193,
serialized_end=252,
)
_sym_db.RegisterEnumDescriptor(_FEE_CURRENCY)
_FEE = _descriptor.Descriptor(
name='Fee',
full_name='pb.Fee',
full_name='legacy_pb.Fee',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='version', full_name='pb.Fee.version', index=0,
name='version', full_name='legacy_pb.Fee.version', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='currency', full_name='pb.Fee.currency', index=1,
name='currency', full_name='legacy_pb.Fee.currency', index=1,
number=2, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='address', full_name='pb.Fee.address', index=2,
name='address', full_name='legacy_pb.Fee.address', index=2,
number=3, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='amount', full_name='pb.Fee.amount', index=3,
name='amount', full_name='legacy_pb.Fee.amount', index=3,
number=4, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
@ -126,8 +126,8 @@ _FEE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=18,
serialized_end=231,
serialized_start=25,
serialized_end=252,
)
_FEE.fields_by_name['version'].enum_type = _FEE_VERSION
@ -140,7 +140,7 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
Fee = _reflection.GeneratedProtocolMessageType('Fee', (_message.Message,), dict(
DESCRIPTOR = _FEE,
__module__ = 'fee_pb2'
# @@protoc_insertion_point(class_scope:pb.Fee)
# @@protoc_insertion_point(class_scope:legacy_pb.Fee)
))
_sym_db.RegisterMessage(Fee)

View file

@ -1,5 +1,5 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: claim.proto
# source: legacy_claim.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
@ -18,11 +18,11 @@ from . import signature_pb2 as signature__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='claim.proto',
package='pb',
name='legacy_claim.proto',
package='legacy_pb',
syntax='proto2',
serialized_options=None,
serialized_pb=_b('\n\x0b\x63laim.proto\x12\x02pb\x1a\x0cstream.proto\x1a\x11\x63\x65rtificate.proto\x1a\x0fsignature.proto\"\xb6\x02\n\x05\x43laim\x12\"\n\x07version\x18\x01 \x02(\x0e\x32\x11.pb.Claim.Version\x12&\n\tclaimType\x18\x02 \x02(\x0e\x32\x13.pb.Claim.ClaimType\x12\x1a\n\x06stream\x18\x03 \x01(\x0b\x32\n.pb.Stream\x12$\n\x0b\x63\x65rtificate\x18\x04 \x01(\x0b\x32\x0f.pb.Certificate\x12)\n\x12publisherSignature\x18\x05 \x01(\x0b\x32\r.pb.Signature\"*\n\x07Version\x12\x13\n\x0fUNKNOWN_VERSION\x10\x00\x12\n\n\x06_0_0_1\x10\x01\"H\n\tClaimType\x12\x16\n\x12UNKNOWN_CLAIM_TYPE\x10\x00\x12\x0e\n\nstreamType\x10\x01\x12\x13\n\x0f\x63\x65rtificateType\x10\x02')
serialized_pb=_b('\n\x12legacy_claim.proto\x12\tlegacy_pb\x1a\x0cstream.proto\x1a\x11\x63\x65rtificate.proto\x1a\x0fsignature.proto\"\xd9\x02\n\x05\x43laim\x12)\n\x07version\x18\x01 \x02(\x0e\x32\x18.legacy_pb.Claim.Version\x12-\n\tclaimType\x18\x02 \x02(\x0e\x32\x1a.legacy_pb.Claim.ClaimType\x12!\n\x06stream\x18\x03 \x01(\x0b\x32\x11.legacy_pb.Stream\x12+\n\x0b\x63\x65rtificate\x18\x04 \x01(\x0b\x32\x16.legacy_pb.Certificate\x12\x30\n\x12publisherSignature\x18\x05 \x01(\x0b\x32\x14.legacy_pb.Signature\"*\n\x07Version\x12\x13\n\x0fUNKNOWN_VERSION\x10\x00\x12\n\n\x06_0_0_1\x10\x01\"H\n\tClaimType\x12\x16\n\x12UNKNOWN_CLAIM_TYPE\x10\x00\x12\x0e\n\nstreamType\x10\x01\x12\x13\n\x0f\x63\x65rtificateType\x10\x02')
,
dependencies=[stream__pb2.DESCRIPTOR,certificate__pb2.DESCRIPTOR,signature__pb2.DESCRIPTOR,])
@ -30,7 +30,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
_CLAIM_VERSION = _descriptor.EnumDescriptor(
name='Version',
full_name='pb.Claim.Version',
full_name='legacy_pb.Claim.Version',
filename=None,
file=DESCRIPTOR,
values=[
@ -45,14 +45,14 @@ _CLAIM_VERSION = _descriptor.EnumDescriptor(
],
containing_type=None,
serialized_options=None,
serialized_start=264,
serialized_end=306,
serialized_start=313,
serialized_end=355,
)
_sym_db.RegisterEnumDescriptor(_CLAIM_VERSION)
_CLAIM_CLAIMTYPE = _descriptor.EnumDescriptor(
name='ClaimType',
full_name='pb.Claim.ClaimType',
full_name='legacy_pb.Claim.ClaimType',
filename=None,
file=DESCRIPTOR,
values=[
@ -71,49 +71,49 @@ _CLAIM_CLAIMTYPE = _descriptor.EnumDescriptor(
],
containing_type=None,
serialized_options=None,
serialized_start=308,
serialized_end=380,
serialized_start=357,
serialized_end=429,
)
_sym_db.RegisterEnumDescriptor(_CLAIM_CLAIMTYPE)
_CLAIM = _descriptor.Descriptor(
name='Claim',
full_name='pb.Claim',
full_name='legacy_pb.Claim',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='version', full_name='pb.Claim.version', index=0,
name='version', full_name='legacy_pb.Claim.version', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='claimType', full_name='pb.Claim.claimType', index=1,
name='claimType', full_name='legacy_pb.Claim.claimType', index=1,
number=2, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='stream', full_name='pb.Claim.stream', index=2,
name='stream', full_name='legacy_pb.Claim.stream', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='certificate', full_name='pb.Claim.certificate', index=3,
name='certificate', full_name='legacy_pb.Claim.certificate', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='publisherSignature', full_name='pb.Claim.publisherSignature', index=4,
name='publisherSignature', full_name='legacy_pb.Claim.publisherSignature', index=4,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
@ -133,8 +133,8 @@ _CLAIM = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=70,
serialized_end=380,
serialized_start=84,
serialized_end=429,
)
_CLAIM.fields_by_name['version'].enum_type = _CLAIM_VERSION
@ -149,8 +149,8 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
Claim = _reflection.GeneratedProtocolMessageType('Claim', (_message.Message,), dict(
DESCRIPTOR = _CLAIM,
__module__ = 'claim_pb2'
# @@protoc_insertion_point(class_scope:pb.Claim)
__module__ = 'legacy_claim_pb2'
# @@protoc_insertion_point(class_scope:legacy_pb.Claim)
))
_sym_db.RegisterMessage(Claim)

File diff suppressed because one or more lines are too long

View file

@ -17,10 +17,10 @@ from . import certificate_pb2 as certificate__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='signature.proto',
package='pb',
package='legacy_pb',
syntax='proto2',
serialized_options=None,
serialized_pb=_b('\n\x0fsignature.proto\x12\x02pb\x1a\x11\x63\x65rtificate.proto\"\xad\x01\n\tSignature\x12&\n\x07version\x18\x01 \x02(\x0e\x32\x15.pb.Signature.Version\x12\"\n\rsignatureType\x18\x02 \x02(\x0e\x32\x0b.pb.KeyType\x12\x11\n\tsignature\x18\x03 \x02(\x0c\x12\x15\n\rcertificateId\x18\x04 \x02(\x0c\"*\n\x07Version\x12\x13\n\x0fUNKNOWN_VERSION\x10\x00\x12\n\n\x06_0_0_1\x10\x01')
serialized_pb=_b('\n\x0fsignature.proto\x12\tlegacy_pb\x1a\x11\x63\x65rtificate.proto\"\xbb\x01\n\tSignature\x12-\n\x07version\x18\x01 \x02(\x0e\x32\x1c.legacy_pb.Signature.Version\x12)\n\rsignatureType\x18\x02 \x02(\x0e\x32\x12.legacy_pb.KeyType\x12\x11\n\tsignature\x18\x03 \x02(\x0c\x12\x15\n\rcertificateId\x18\x04 \x02(\x0c\"*\n\x07Version\x12\x13\n\x0fUNKNOWN_VERSION\x10\x00\x12\n\n\x06_0_0_1\x10\x01')
,
dependencies=[certificate__pb2.DESCRIPTOR,])
@ -28,7 +28,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
_SIGNATURE_VERSION = _descriptor.EnumDescriptor(
name='Version',
full_name='pb.Signature.Version',
full_name='legacy_pb.Signature.Version',
filename=None,
file=DESCRIPTOR,
values=[
@ -43,42 +43,42 @@ _SIGNATURE_VERSION = _descriptor.EnumDescriptor(
],
containing_type=None,
serialized_options=None,
serialized_start=174,
serialized_end=216,
serialized_start=195,
serialized_end=237,
)
_sym_db.RegisterEnumDescriptor(_SIGNATURE_VERSION)
_SIGNATURE = _descriptor.Descriptor(
name='Signature',
full_name='pb.Signature',
full_name='legacy_pb.Signature',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='version', full_name='pb.Signature.version', index=0,
name='version', full_name='legacy_pb.Signature.version', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='signatureType', full_name='pb.Signature.signatureType', index=1,
name='signatureType', full_name='legacy_pb.Signature.signatureType', index=1,
number=2, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='signature', full_name='pb.Signature.signature', index=2,
name='signature', full_name='legacy_pb.Signature.signature', index=2,
number=3, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='certificateId', full_name='pb.Signature.certificateId', index=3,
name='certificateId', full_name='legacy_pb.Signature.certificateId', index=3,
number=4, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
@ -97,8 +97,8 @@ _SIGNATURE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=43,
serialized_end=216,
serialized_start=50,
serialized_end=237,
)
_SIGNATURE.fields_by_name['version'].enum_type = _SIGNATURE_VERSION
@ -110,7 +110,7 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
Signature = _reflection.GeneratedProtocolMessageType('Signature', (_message.Message,), dict(
DESCRIPTOR = _SIGNATURE,
__module__ = 'signature_pb2'
# @@protoc_insertion_point(class_scope:pb.Signature)
# @@protoc_insertion_point(class_scope:legacy_pb.Signature)
))
_sym_db.RegisterMessage(Signature)

View file

@ -16,17 +16,17 @@ _sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='source.proto',
package='pb',
package='legacy_pb',
syntax='proto2',
serialized_options=None,
serialized_pb=_b('\n\x0csource.proto\x12\x02pb\"\xe4\x01\n\x06Source\x12#\n\x07version\x18\x01 \x02(\x0e\x32\x12.pb.Source.Version\x12*\n\nsourceType\x18\x02 \x02(\x0e\x32\x16.pb.Source.SourceTypes\x12\x0e\n\x06source\x18\x03 \x02(\x0c\x12\x13\n\x0b\x63ontentType\x18\x04 \x02(\t\"*\n\x07Version\x12\x13\n\x0fUNKNOWN_VERSION\x10\x00\x12\n\n\x06_0_0_1\x10\x01\"8\n\x0bSourceTypes\x12\x17\n\x13UNKNOWN_SOURCE_TYPE\x10\x00\x12\x10\n\x0clbry_sd_hash\x10\x01')
serialized_pb=_b('\n\x0csource.proto\x12\tlegacy_pb\"\xf2\x01\n\x06Source\x12*\n\x07version\x18\x01 \x02(\x0e\x32\x19.legacy_pb.Source.Version\x12\x31\n\nsourceType\x18\x02 \x02(\x0e\x32\x1d.legacy_pb.Source.SourceTypes\x12\x0e\n\x06source\x18\x03 \x02(\x0c\x12\x13\n\x0b\x63ontentType\x18\x04 \x02(\t\"*\n\x07Version\x12\x13\n\x0fUNKNOWN_VERSION\x10\x00\x12\n\n\x06_0_0_1\x10\x01\"8\n\x0bSourceTypes\x12\x17\n\x13UNKNOWN_SOURCE_TYPE\x10\x00\x12\x10\n\x0clbry_sd_hash\x10\x01')
)
_SOURCE_VERSION = _descriptor.EnumDescriptor(
name='Version',
full_name='pb.Source.Version',
full_name='legacy_pb.Source.Version',
filename=None,
file=DESCRIPTOR,
values=[
@ -41,14 +41,14 @@ _SOURCE_VERSION = _descriptor.EnumDescriptor(
],
containing_type=None,
serialized_options=None,
serialized_start=149,
serialized_end=191,
serialized_start=170,
serialized_end=212,
)
_sym_db.RegisterEnumDescriptor(_SOURCE_VERSION)
_SOURCE_SOURCETYPES = _descriptor.EnumDescriptor(
name='SourceTypes',
full_name='pb.Source.SourceTypes',
full_name='legacy_pb.Source.SourceTypes',
filename=None,
file=DESCRIPTOR,
values=[
@ -63,42 +63,42 @@ _SOURCE_SOURCETYPES = _descriptor.EnumDescriptor(
],
containing_type=None,
serialized_options=None,
serialized_start=193,
serialized_end=249,
serialized_start=214,
serialized_end=270,
)
_sym_db.RegisterEnumDescriptor(_SOURCE_SOURCETYPES)
_SOURCE = _descriptor.Descriptor(
name='Source',
full_name='pb.Source',
full_name='legacy_pb.Source',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='version', full_name='pb.Source.version', index=0,
name='version', full_name='legacy_pb.Source.version', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='sourceType', full_name='pb.Source.sourceType', index=1,
name='sourceType', full_name='legacy_pb.Source.sourceType', index=1,
number=2, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='source', full_name='pb.Source.source', index=2,
name='source', full_name='legacy_pb.Source.source', index=2,
number=3, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='contentType', full_name='pb.Source.contentType', index=3,
name='contentType', full_name='legacy_pb.Source.contentType', index=3,
number=4, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
@ -118,8 +118,8 @@ _SOURCE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=21,
serialized_end=249,
serialized_start=28,
serialized_end=270,
)
_SOURCE.fields_by_name['version'].enum_type = _SOURCE_VERSION
@ -132,7 +132,7 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
Source = _reflection.GeneratedProtocolMessageType('Source', (_message.Message,), dict(
DESCRIPTOR = _SOURCE,
__module__ = 'source_pb2'
# @@protoc_insertion_point(class_scope:pb.Source)
# @@protoc_insertion_point(class_scope:legacy_pb.Source)
))
_sym_db.RegisterMessage(Source)

View file

@ -18,10 +18,10 @@ from . import source_pb2 as source__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='stream.proto',
package='pb',
package='legacy_pb',
syntax='proto2',
serialized_options=None,
serialized_pb=_b('\n\x0cstream.proto\x12\x02pb\x1a\x0emetadata.proto\x1a\x0csource.proto\"\x95\x01\n\x06Stream\x12#\n\x07version\x18\x01 \x02(\x0e\x32\x12.pb.Stream.Version\x12\x1e\n\x08metadata\x18\x02 \x02(\x0b\x32\x0c.pb.Metadata\x12\x1a\n\x06source\x18\x03 \x02(\x0b\x32\n.pb.Source\"*\n\x07Version\x12\x13\n\x0fUNKNOWN_VERSION\x10\x00\x12\n\n\x06_0_0_1\x10\x01')
serialized_pb=_b('\n\x0cstream.proto\x12\tlegacy_pb\x1a\x0emetadata.proto\x1a\x0csource.proto\"\xaa\x01\n\x06Stream\x12*\n\x07version\x18\x01 \x02(\x0e\x32\x19.legacy_pb.Stream.Version\x12%\n\x08metadata\x18\x02 \x02(\x0b\x32\x13.legacy_pb.Metadata\x12!\n\x06source\x18\x03 \x02(\x0b\x32\x11.legacy_pb.Source\"*\n\x07Version\x12\x13\n\x0fUNKNOWN_VERSION\x10\x00\x12\n\n\x06_0_0_1\x10\x01')
,
dependencies=[metadata__pb2.DESCRIPTOR,source__pb2.DESCRIPTOR,])
@ -29,7 +29,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
_STREAM_VERSION = _descriptor.EnumDescriptor(
name='Version',
full_name='pb.Stream.Version',
full_name='legacy_pb.Stream.Version',
filename=None,
file=DESCRIPTOR,
values=[
@ -44,35 +44,35 @@ _STREAM_VERSION = _descriptor.EnumDescriptor(
],
containing_type=None,
serialized_options=None,
serialized_start=158,
serialized_end=200,
serialized_start=186,
serialized_end=228,
)
_sym_db.RegisterEnumDescriptor(_STREAM_VERSION)
_STREAM = _descriptor.Descriptor(
name='Stream',
full_name='pb.Stream',
full_name='legacy_pb.Stream',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='version', full_name='pb.Stream.version', index=0,
name='version', full_name='legacy_pb.Stream.version', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='metadata', full_name='pb.Stream.metadata', index=1,
name='metadata', full_name='legacy_pb.Stream.metadata', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='source', full_name='pb.Stream.source', index=2,
name='source', full_name='legacy_pb.Stream.source', index=2,
number=3, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
@ -91,8 +91,8 @@ _STREAM = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=51,
serialized_end=200,
serialized_start=58,
serialized_end=228,
)
_STREAM.fields_by_name['version'].enum_type = _STREAM_VERSION
@ -105,7 +105,7 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
Stream = _reflection.GeneratedProtocolMessageType('Stream', (_message.Message,), dict(
DESCRIPTOR = _STREAM,
__module__ = 'stream_pb2'
# @@protoc_insertion_point(class_scope:pb.Stream)
# @@protoc_insertion_point(class_scope:legacy_pb.Stream)
))
_sym_db.RegisterMessage(Stream)

View file

@ -19,7 +19,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
package='pb',
syntax='proto3',
serialized_options=None,
serialized_pb=_b('\n\x0b\x63laim.proto\x12\x02pb\"\x80\x01\n\x05\x43laim\x12\x1c\n\x04type\x18\x01 \x01(\x0e\x32\x0e.pb.Claim.Type\x12\x1a\n\x06stream\x18\x02 \x01(\x0b\x32\n.pb.Stream\x12\x1c\n\x07\x63hannel\x18\x03 \x01(\x0b\x32\x0b.pb.Channel\"\x1f\n\x04Type\x12\n\n\x06STREAM\x10\x00\x12\x0b\n\x07\x43HANNEL\x10\x01\"\x98\x01\n\x07\x43hannel\x12\x12\n\npublic_key\x18\x01 \x01(\x0c\x12\r\n\x05title\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x15\n\rcontact_email\x18\x04 \x01(\t\x12\x14\n\x0chomepage_url\x18\x05 \x01(\t\x12\x15\n\rthumbnail_url\x18\x10 \x01(\t\x12\x11\n\tcover_url\x18\x11 \x01(\t\"\xab\x02\n\x06Stream\x12\x0c\n\x04hash\x18\x01 \x01(\x0c\x12\x10\n\x08language\x18\x02 \x01(\t\x12\r\n\x05title\x18\x03 \x01(\t\x12\x0e\n\x06\x61uthor\x18\x04 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x05 \x01(\t\x12\x12\n\nmedia_type\x18\x06 \x01(\t\x12\x0f\n\x07license\x18\x07 \x01(\t\x12\x16\n\x04\x66ile\x18\x08 \x01(\x0b\x32\x08.pb.File\x12\x14\n\x03\x66\x65\x65\x18\x10 \x01(\x0b\x32\x07.pb.Fee\x12\x13\n\x0blicense_url\x18\x11 \x01(\t\x12\x15\n\rthumbnail_url\x18\x12 \x01(\t\x12\x10\n\x08\x64uration\x18\x13 \x01(\r\x12\x0c\n\x04tags\x18\x14 \x03(\t\x12\x14\n\x0crelease_time\x18\x15 \x01(\x03\x12\x18\n\x05video\x18\x16 \x01(\x0b\x32\t.pb.Video\"h\n\x03\x46\x65\x65\x12\"\n\x08\x63urrency\x18\x01 \x01(\x0e\x32\x10.pb.Fee.Currency\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\x0c\x12\x0e\n\x06\x61mount\x18\x03 \x01(\x04\"\x1c\n\x08\x43urrency\x12\x07\n\x03LBC\x10\x00\x12\x07\n\x03USD\x10\x01\"\"\n\x04\x46ile\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04size\x18\x02 \x01(\x04\"&\n\x05Video\x12\r\n\x05width\x18\x01 \x01(\r\x12\x0e\n\x06height\x18\x02 \x01(\rb\x06proto3')
serialized_pb=_b('\n\x0b\x63laim.proto\x12\x02pb\"\x80\x01\n\x05\x43laim\x12\x1c\n\x04type\x18\x01 \x01(\x0e\x32\x0e.pb.Claim.Type\x12\x1a\n\x06stream\x18\x02 \x01(\x0b\x32\n.pb.Stream\x12\x1c\n\x07\x63hannel\x18\x03 \x01(\x0b\x32\x0b.pb.Channel\"\x1f\n\x04Type\x12\n\n\x06STREAM\x10\x00\x12\x0b\n\x07\x43HANNEL\x10\x01\"\xb8\x01\n\x07\x43hannel\x12\x12\n\npublic_key\x18\x01 \x01(\x0c\x12\r\n\x05title\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x15\n\rcontact_email\x18\x04 \x01(\t\x12\x14\n\x0chomepage_url\x18\x05 \x01(\t\x12\x0c\n\x04tags\x18\x06 \x03(\t\x12\x15\n\rthumbnail_url\x18\x10 \x01(\t\x12\x11\n\tcover_url\x18\x11 \x01(\t\x12\x10\n\x08language\x18\x12 \x01(\t\"\xab\x02\n\x06Stream\x12\x0c\n\x04hash\x18\x01 \x01(\x0c\x12\x10\n\x08language\x18\x02 \x01(\t\x12\r\n\x05title\x18\x03 \x01(\t\x12\x0e\n\x06\x61uthor\x18\x04 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x05 \x01(\t\x12\x12\n\nmedia_type\x18\x06 \x01(\t\x12\x0f\n\x07license\x18\x07 \x01(\t\x12\x16\n\x04\x66ile\x18\x08 \x01(\x0b\x32\x08.pb.File\x12\x14\n\x03\x66\x65\x65\x18\x10 \x01(\x0b\x32\x07.pb.Fee\x12\x13\n\x0blicense_url\x18\x11 \x01(\t\x12\x15\n\rthumbnail_url\x18\x12 \x01(\t\x12\x10\n\x08\x64uration\x18\x13 \x01(\r\x12\x0c\n\x04tags\x18\x14 \x03(\t\x12\x14\n\x0crelease_time\x18\x15 \x01(\x03\x12\x18\n\x05video\x18\x16 \x01(\x0b\x32\t.pb.Video\"h\n\x03\x46\x65\x65\x12\"\n\x08\x63urrency\x18\x01 \x01(\x0e\x32\x10.pb.Fee.Currency\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\x0c\x12\x0e\n\x06\x61mount\x18\x03 \x01(\x04\"\x1c\n\x08\x43urrency\x12\x07\n\x03LBC\x10\x00\x12\x07\n\x03USD\x10\x01\"\"\n\x04\x46ile\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04size\x18\x02 \x01(\x04\"&\n\x05Video\x12\r\n\x05width\x18\x01 \x01(\r\x12\x0e\n\x06height\x18\x02 \x01(\rb\x06proto3')
)
@ -63,8 +63,8 @@ _FEE_CURRENCY = _descriptor.EnumDescriptor(
],
containing_type=None,
serialized_options=None,
serialized_start=683,
serialized_end=711,
serialized_start=715,
serialized_end=743,
)
_sym_db.RegisterEnumDescriptor(_FEE_CURRENCY)
@ -158,19 +158,33 @@ _CHANNEL = _descriptor.Descriptor(
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='thumbnail_url', full_name='pb.Channel.thumbnail_url', index=5,
name='tags', full_name='pb.Channel.tags', index=5,
number=6, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='thumbnail_url', full_name='pb.Channel.thumbnail_url', index=6,
number=16, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cover_url', full_name='pb.Channel.cover_url', index=6,
name='cover_url', full_name='pb.Channel.cover_url', index=7,
number=17, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='language', full_name='pb.Channel.language', index=8,
number=18, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
@ -184,7 +198,7 @@ _CHANNEL = _descriptor.Descriptor(
oneofs=[
],
serialized_start=151,
serialized_end=303,
serialized_end=335,
)
@ -312,8 +326,8 @@ _STREAM = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=306,
serialized_end=605,
serialized_start=338,
serialized_end=637,
)
@ -358,8 +372,8 @@ _FEE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=607,
serialized_end=711,
serialized_start=639,
serialized_end=743,
)
@ -396,8 +410,8 @@ _FILE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=713,
serialized_end=747,
serialized_start=745,
serialized_end=779,
)
@ -434,8 +448,8 @@ _VIDEO = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=749,
serialized_end=787,
serialized_start=781,
serialized_end=819,
)
_CLAIM.fields_by_name['type'].enum_type = _CLAIM_TYPE

View file

@ -20,7 +20,7 @@ from lbrynet.schema.constants import NIST256p, NIST384p, SECP256k1
from lbrynet.schema.legacy.migrate import migrate
from lbrynet.schema.signer import get_signer
from lbrynet.schema.uri import URI, URIParseError
from lbrynet.schema.decode import smart_decode
from lbrynet.schema.decode import smart_decode, migrate_legacy_protobuf
from lbrynet.schema.error import DecodeError, InvalidAddress
from lbrynet.schema.address import decode_address, encode_address
@ -555,5 +555,13 @@ class TestValidatePrivateKey(UnitTest):
False)
class TestMigrateLegacyProtobufToCurrentSchema(UnitTest):
def test_migrate_legacy_binary_certificate_to_proto3_certificate(self):
legacy_binary_cert = binary_claim
migrated_cert = migrate_legacy_protobuf(legacy_binary_cert)
self.assertEqual(binascii.hexlify(migrated_cert.channel.public_key).decode(),
expected_binary_claim_decoded['certificate']['publicKey'])
if __name__ == '__main__':
unittest.main()