Compare commits

...

8 commits

Author SHA1 Message Date
Victor Shyba
574c2ce794 adds integration test for release_time 2019-01-23 11:16:43 -03:00
Victor Shyba
7f5541eb5c adds release_time parameter to RPC publish 2019-01-23 11:16:43 -03:00
Victor Shyba
7b49241c38 adjust balance assertions for integration test using new signature model due new fees from new size 2019-01-23 11:16:43 -03:00
Victor Shyba
da716b2e3d remove new signature model integration test as its the default now 2019-01-23 11:16:43 -03:00
Victor Shyba
a144fae8b2 activate new signature model 2019-01-23 11:16:43 -03:00
Victor Shyba
0d90b82287 clear releaseTime when not set 2019-01-23 11:16:43 -03:00
Victor Shyba
567c23e10f regen for metadata releaseTime field 2019-01-23 11:16:43 -03:00
Victor Shyba
16970b7d37 regen proto from lbry/types, removes local .proto files 2019-01-23 11:16:43 -03:00
23 changed files with 229 additions and 528 deletions

View file

@ -2394,7 +2394,7 @@ class Daemon(metaclass=JSONRPCServerType):
description=None, author=None, language=None, license=None, description=None, author=None, language=None, license=None,
license_url=None, thumbnail=None, preview=None, nsfw=None, sources=None, license_url=None, thumbnail=None, preview=None, nsfw=None, sources=None,
channel_name=None, channel_id=None, channel_account_id=None, account_id=None, channel_name=None, channel_id=None, channel_account_id=None, account_id=None,
claim_address=None, change_address=None): claim_address=None, change_address=None, release_time=None):
""" """
Make a new name claim and publish associated data to lbrynet, Make a new name claim and publish associated data to lbrynet,
update over existing claim if user already has a claim for name. update over existing claim if user already has a claim for name.
@ -2420,6 +2420,7 @@ class Daemon(metaclass=JSONRPCServerType):
[--channel_name=<channel_name>] [--channel_id=<channel_id>] [--channel_name=<channel_name>] [--channel_id=<channel_id>]
[--channel_account_id=<channel_account_id>...] [--account_id=<account_id>] [--channel_account_id=<channel_account_id>...] [--account_id=<account_id>]
[--claim_address=<claim_address>] [--change_address=<change_address>] [--claim_address=<claim_address>] [--change_address=<change_address>]
[--release_time=<release_time>]
Options: Options:
--name=<name> : (str) name of the content (can only consist of a-z A-Z 0-9 and -(dash)) --name=<name> : (str) name of the content (can only consist of a-z A-Z 0-9 and -(dash))
@ -2452,6 +2453,7 @@ class Daemon(metaclass=JSONRPCServerType):
--thumbnail=<thumbnail> : (str) thumbnail url --thumbnail=<thumbnail> : (str) thumbnail url
--preview=<preview> : (str) preview url --preview=<preview> : (str) preview url
--nsfw=<nsfw> : (bool) whether the content is nsfw --nsfw=<nsfw> : (bool) whether the content is nsfw
--release_time=<release_time> : (int) seconds since Unix Epoch in GMT time. Can be negative.
--sources=<sources> : (str) {'lbry_sd_hash': sd_hash} specifies sd hash of file --sources=<sources> : (str) {'lbry_sd_hash': sd_hash} specifies sd hash of file
--channel_name=<channel_name> : (str) name of the publisher channel name in the wallet --channel_name=<channel_name> : (str) name of the publisher channel name in the wallet
--channel_id=<channel_id> : (str) claim id of the publisher channel, does not check --channel_id=<channel_id> : (str) claim id of the publisher channel, does not check
@ -2523,6 +2525,8 @@ class Daemon(metaclass=JSONRPCServerType):
metadata['preview'] = preview metadata['preview'] = preview
if nsfw is not None: if nsfw is not None:
metadata['nsfw'] = bool(nsfw) metadata['nsfw'] = bool(nsfw)
if release_time is not None:
metadata['releaseTime'] = int(release_time)
metadata['version'] = '_0_1_0' metadata['version'] = '_0_1_0'

View file

@ -411,8 +411,7 @@ class LbryWalletManager(BaseWalletManager):
claim_address = await account.receiving.get_or_create_usable_address() claim_address = await account.receiving.get_or_create_usable_address()
if certificate: if certificate:
claim = claim.sign( claim = claim.sign(
certificate.private_key, claim_address, certificate.claim_id, curve=SECP256k1, name=name, certificate.private_key, claim_address, certificate.claim_id, curve=SECP256k1, name=name
force_detached=False # TODO: delete it and make True default everywhere when its out
) )
existing_claims = await account.get_claims( existing_claims = await account.get_claims(
claim_name_type__any={'is_claim': 1, 'is_update': 1}, # exclude is_supports claim_name_type__any={'is_claim': 1, 'is_update': 1}, # exclude is_supports

View file

@ -162,9 +162,9 @@ class ClaimDict(OrderedDict):
signer = get_signer(curve).load_pem(private_key) signer = get_signer(curve).load_pem(private_key)
return cls.load_protobuf(signer.certificate) return cls.load_protobuf(signer.certificate)
def sign(self, private_key, claim_address, cert_claim_id, curve=SECP256k1, name=None, force_detached=False): def sign(self, private_key, claim_address, cert_claim_id, curve=SECP256k1, name=None, legacy=False):
signer = get_signer(curve).load_pem(private_key) signer = get_signer(curve).load_pem(private_key)
signed, signature = signer.sign_stream_claim(self, claim_address, cert_claim_id, name, force_detached) signed, signature = signer.sign_stream_claim(self, claim_address, cert_claim_id, name, legacy)
return ClaimDict.load_protobuf(signed, signature) return ClaimDict.load_protobuf(signed, signature)
def validate_signature(self, claim_address, certificate, name=None): def validate_signature(self, claim_address, certificate, name=None):

View file

@ -14,6 +14,10 @@ def encode_fields(claim_dictionary, detached_signature: Signature):
claim_value = claim_dictionary[claim_type] claim_value = claim_dictionary[claim_type]
if claim_type == CLAIM_TYPES[STREAM_TYPE]: if claim_type == CLAIM_TYPES[STREAM_TYPE]:
claim_value['source']['source'] = binascii.hexlify(claim_value['source']['source']).decode() claim_value['source']['source'] = binascii.hexlify(claim_value['source']['source']).decode()
if 'releaseTime' in claim_value['metadata']:
release_time = int(claim_value['metadata'].pop('releaseTime'))
if release_time != 0:
claim_value['metadata']['releaseTime'] = release_time
if 'fee' in claim_value['metadata']: if 'fee' in claim_value['metadata']:
try: try:
address = encode_address(claim_value['metadata']['fee']['address']) address = encode_address(claim_value['metadata']['fee']['address'])

View file

@ -1,18 +0,0 @@
syntax = "proto2";
enum KeyType {
UNKNOWN_PUBLIC_KEY_TYPE = 0;
NIST256p = 1;
NIST384p = 2;
SECP256k1 = 3;
}
message Certificate {
enum Version {
UNKNOWN_VERSION = 0;
_0_0_1 = 1;
}
required Version version = 1;
required KeyType keyType = 2;
required bytes publicKey = 4;
}

View file

@ -1,5 +1,5 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: lbrynet/schema/proto/certificate.proto # source: certificate.proto
import sys import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
@ -16,16 +16,16 @@ _sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor( DESCRIPTOR = _descriptor.FileDescriptor(
name='lbrynet/schema/proto/certificate.proto', name='certificate.proto',
package='', package='pb',
syntax='proto2', syntax='proto2',
serialized_options=None, serialized_options=None,
serialized_pb=_b('\n&lbrynet/schema/proto/certificate.proto\"\x8e\x01\n\x0b\x43\x65rtificate\x12%\n\x07version\x18\x01 \x02(\x0e\x32\x14.Certificate.Version\x12\x19\n\x07keyType\x18\x02 \x02(\x0e\x32\x08.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\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')
) )
_KEYTYPE = _descriptor.EnumDescriptor( _KEYTYPE = _descriptor.EnumDescriptor(
name='KeyType', name='KeyType',
full_name='KeyType', full_name='pb.KeyType',
filename=None, filename=None,
file=DESCRIPTOR, file=DESCRIPTOR,
values=[ values=[
@ -48,8 +48,8 @@ _KEYTYPE = _descriptor.EnumDescriptor(
], ],
containing_type=None, containing_type=None,
serialized_options=None, serialized_options=None,
serialized_start=187, serialized_start=176,
serialized_end=268, serialized_end=257,
) )
_sym_db.RegisterEnumDescriptor(_KEYTYPE) _sym_db.RegisterEnumDescriptor(_KEYTYPE)
@ -62,7 +62,7 @@ SECP256k1 = 3
_CERTIFICATE_VERSION = _descriptor.EnumDescriptor( _CERTIFICATE_VERSION = _descriptor.EnumDescriptor(
name='Version', name='Version',
full_name='Certificate.Version', full_name='pb.Certificate.Version',
filename=None, filename=None,
file=DESCRIPTOR, file=DESCRIPTOR,
values=[ values=[
@ -77,35 +77,35 @@ _CERTIFICATE_VERSION = _descriptor.EnumDescriptor(
], ],
containing_type=None, containing_type=None,
serialized_options=None, serialized_options=None,
serialized_start=143, serialized_start=132,
serialized_end=185, serialized_end=174,
) )
_sym_db.RegisterEnumDescriptor(_CERTIFICATE_VERSION) _sym_db.RegisterEnumDescriptor(_CERTIFICATE_VERSION)
_CERTIFICATE = _descriptor.Descriptor( _CERTIFICATE = _descriptor.Descriptor(
name='Certificate', name='Certificate',
full_name='Certificate', full_name='pb.Certificate',
filename=None, filename=None,
file=DESCRIPTOR, file=DESCRIPTOR,
containing_type=None, containing_type=None,
fields=[ fields=[
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='version', full_name='Certificate.version', index=0, name='version', full_name='pb.Certificate.version', index=0,
number=1, type=14, cpp_type=8, label=2, number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0, has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='keyType', full_name='Certificate.keyType', index=1, name='keyType', full_name='pb.Certificate.keyType', index=1,
number=2, type=14, cpp_type=8, label=2, number=2, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0, has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='publicKey', full_name='Certificate.publicKey', index=2, name='publicKey', full_name='pb.Certificate.publicKey', index=2,
number=4, type=12, cpp_type=9, label=2, number=4, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""), has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
@ -124,8 +124,8 @@ _CERTIFICATE = _descriptor.Descriptor(
extension_ranges=[], extension_ranges=[],
oneofs=[ oneofs=[
], ],
serialized_start=43, serialized_start=26,
serialized_end=185, serialized_end=174,
) )
_CERTIFICATE.fields_by_name['version'].enum_type = _CERTIFICATE_VERSION _CERTIFICATE.fields_by_name['version'].enum_type = _CERTIFICATE_VERSION
@ -137,8 +137,8 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
Certificate = _reflection.GeneratedProtocolMessageType('Certificate', (_message.Message,), dict( Certificate = _reflection.GeneratedProtocolMessageType('Certificate', (_message.Message,), dict(
DESCRIPTOR = _CERTIFICATE, DESCRIPTOR = _CERTIFICATE,
__module__ = 'lbrynet.schema.proto.certificate_pb2' __module__ = 'certificate_pb2'
# @@protoc_insertion_point(class_scope:Certificate) # @@protoc_insertion_point(class_scope:pb.Certificate)
)) ))
_sym_db.RegisterMessage(Certificate) _sym_db.RegisterMessage(Certificate)

View file

@ -1,22 +0,0 @@
syntax = "proto2";
import "lbrynet/schema/proto/stream.proto";
import "lbrynet/schema/proto/certificate.proto";
import "lbrynet/schema/proto/signature.proto";
message Claim {
enum Version {
UNKNOWN_VERSION = 0;
_0_0_1 = 1;
}
required Version version = 1;
enum ClaimType {
UNKNOWN_CLAIM_TYPE = 0;
streamType = 1;
certificateType = 2;
}
required ClaimType claimType = 2;
optional Stream stream = 3;
optional Certificate certificate = 4;
optional Signature publisherSignature = 5;
}

View file

@ -1,5 +1,5 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: lbrynet/schema/proto/claim.proto # source: claim.proto
import sys import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
@ -12,25 +12,25 @@ from google.protobuf import symbol_database as _symbol_database
_sym_db = _symbol_database.Default() _sym_db = _symbol_database.Default()
from lbrynet.schema.proto import stream_pb2 as lbrynet_dot_schema_dot_proto_dot_stream__pb2 from . import stream_pb2 as stream__pb2
from lbrynet.schema.proto import certificate_pb2 as lbrynet_dot_schema_dot_proto_dot_certificate__pb2 from . import certificate_pb2 as certificate__pb2
from lbrynet.schema.proto import signature_pb2 as lbrynet_dot_schema_dot_proto_dot_signature__pb2 from . import signature_pb2 as signature__pb2
DESCRIPTOR = _descriptor.FileDescriptor( DESCRIPTOR = _descriptor.FileDescriptor(
name='lbrynet/schema/proto/claim.proto', name='claim.proto',
package='', package='pb',
syntax='proto2', syntax='proto2',
serialized_options=None, serialized_options=None,
serialized_pb=_b('\n lbrynet/schema/proto/claim.proto\x1a!lbrynet/schema/proto/stream.proto\x1a&lbrynet/schema/proto/certificate.proto\x1a$lbrynet/schema/proto/signature.proto\"\xa7\x02\n\x05\x43laim\x12\x1f\n\x07version\x18\x01 \x02(\x0e\x32\x0e.Claim.Version\x12#\n\tclaimType\x18\x02 \x02(\x0e\x32\x10.Claim.ClaimType\x12\x17\n\x06stream\x18\x03 \x01(\x0b\x32\x07.Stream\x12!\n\x0b\x63\x65rtificate\x18\x04 \x01(\x0b\x32\x0c.Certificate\x12&\n\x12publisherSignature\x18\x05 \x01(\x0b\x32\n.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\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')
, ,
dependencies=[lbrynet_dot_schema_dot_proto_dot_stream__pb2.DESCRIPTOR,lbrynet_dot_schema_dot_proto_dot_certificate__pb2.DESCRIPTOR,lbrynet_dot_schema_dot_proto_dot_signature__pb2.DESCRIPTOR,]) dependencies=[stream__pb2.DESCRIPTOR,certificate__pb2.DESCRIPTOR,signature__pb2.DESCRIPTOR,])
_CLAIM_VERSION = _descriptor.EnumDescriptor( _CLAIM_VERSION = _descriptor.EnumDescriptor(
name='Version', name='Version',
full_name='Claim.Version', full_name='pb.Claim.Version',
filename=None, filename=None,
file=DESCRIPTOR, file=DESCRIPTOR,
values=[ values=[
@ -45,14 +45,14 @@ _CLAIM_VERSION = _descriptor.EnumDescriptor(
], ],
containing_type=None, containing_type=None,
serialized_options=None, serialized_options=None,
serialized_start=329, serialized_start=264,
serialized_end=371, serialized_end=306,
) )
_sym_db.RegisterEnumDescriptor(_CLAIM_VERSION) _sym_db.RegisterEnumDescriptor(_CLAIM_VERSION)
_CLAIM_CLAIMTYPE = _descriptor.EnumDescriptor( _CLAIM_CLAIMTYPE = _descriptor.EnumDescriptor(
name='ClaimType', name='ClaimType',
full_name='Claim.ClaimType', full_name='pb.Claim.ClaimType',
filename=None, filename=None,
file=DESCRIPTOR, file=DESCRIPTOR,
values=[ values=[
@ -71,49 +71,49 @@ _CLAIM_CLAIMTYPE = _descriptor.EnumDescriptor(
], ],
containing_type=None, containing_type=None,
serialized_options=None, serialized_options=None,
serialized_start=373, serialized_start=308,
serialized_end=445, serialized_end=380,
) )
_sym_db.RegisterEnumDescriptor(_CLAIM_CLAIMTYPE) _sym_db.RegisterEnumDescriptor(_CLAIM_CLAIMTYPE)
_CLAIM = _descriptor.Descriptor( _CLAIM = _descriptor.Descriptor(
name='Claim', name='Claim',
full_name='Claim', full_name='pb.Claim',
filename=None, filename=None,
file=DESCRIPTOR, file=DESCRIPTOR,
containing_type=None, containing_type=None,
fields=[ fields=[
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='version', full_name='Claim.version', index=0, name='version', full_name='pb.Claim.version', index=0,
number=1, type=14, cpp_type=8, label=2, number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0, has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='claimType', full_name='Claim.claimType', index=1, name='claimType', full_name='pb.Claim.claimType', index=1,
number=2, type=14, cpp_type=8, label=2, number=2, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0, has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='stream', full_name='Claim.stream', index=2, name='stream', full_name='pb.Claim.stream', index=2,
number=3, type=11, cpp_type=10, label=1, number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None, has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='certificate', full_name='Claim.certificate', index=3, name='certificate', full_name='pb.Claim.certificate', index=3,
number=4, type=11, cpp_type=10, label=1, number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None, has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='publisherSignature', full_name='Claim.publisherSignature', index=4, name='publisherSignature', full_name='pb.Claim.publisherSignature', index=4,
number=5, type=11, cpp_type=10, label=1, number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None, has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
@ -133,15 +133,15 @@ _CLAIM = _descriptor.Descriptor(
extension_ranges=[], extension_ranges=[],
oneofs=[ oneofs=[
], ],
serialized_start=150, serialized_start=70,
serialized_end=445, serialized_end=380,
) )
_CLAIM.fields_by_name['version'].enum_type = _CLAIM_VERSION _CLAIM.fields_by_name['version'].enum_type = _CLAIM_VERSION
_CLAIM.fields_by_name['claimType'].enum_type = _CLAIM_CLAIMTYPE _CLAIM.fields_by_name['claimType'].enum_type = _CLAIM_CLAIMTYPE
_CLAIM.fields_by_name['stream'].message_type = lbrynet_dot_schema_dot_proto_dot_stream__pb2._STREAM _CLAIM.fields_by_name['stream'].message_type = stream__pb2._STREAM
_CLAIM.fields_by_name['certificate'].message_type = lbrynet_dot_schema_dot_proto_dot_certificate__pb2._CERTIFICATE _CLAIM.fields_by_name['certificate'].message_type = certificate__pb2._CERTIFICATE
_CLAIM.fields_by_name['publisherSignature'].message_type = lbrynet_dot_schema_dot_proto_dot_signature__pb2._SIGNATURE _CLAIM.fields_by_name['publisherSignature'].message_type = signature__pb2._SIGNATURE
_CLAIM_VERSION.containing_type = _CLAIM _CLAIM_VERSION.containing_type = _CLAIM
_CLAIM_CLAIMTYPE.containing_type = _CLAIM _CLAIM_CLAIMTYPE.containing_type = _CLAIM
DESCRIPTOR.message_types_by_name['Claim'] = _CLAIM DESCRIPTOR.message_types_by_name['Claim'] = _CLAIM
@ -149,8 +149,8 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
Claim = _reflection.GeneratedProtocolMessageType('Claim', (_message.Message,), dict( Claim = _reflection.GeneratedProtocolMessageType('Claim', (_message.Message,), dict(
DESCRIPTOR = _CLAIM, DESCRIPTOR = _CLAIM,
__module__ = 'lbrynet.schema.proto.claim_pb2' __module__ = 'claim_pb2'
# @@protoc_insertion_point(class_scope:Claim) # @@protoc_insertion_point(class_scope:pb.Claim)
)) ))
_sym_db.RegisterMessage(Claim) _sym_db.RegisterMessage(Claim)

View file

@ -1,18 +0,0 @@
syntax = "proto2";
message Fee {
enum Version {
UNKNOWN_VERSION = 0;
_0_0_1 = 1;
}
enum Currency {
UNKNOWN_CURRENCY = 0;
LBC = 1;
BTC = 2;
USD = 3;
}
required Version version = 1;
required Currency currency = 2;
required bytes address = 3;
required float amount = 4;
}

View file

@ -1,5 +1,5 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: lbrynet/schema/proto/fee.proto # source: fee.proto
import sys import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
@ -15,18 +15,18 @@ _sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor( DESCRIPTOR = _descriptor.FileDescriptor(
name='lbrynet/schema/proto/fee.proto', name='fee.proto',
package='', package='pb',
syntax='proto2', syntax='proto2',
serialized_options=None, serialized_options=None,
serialized_pb=_b('\n\x1elbrynet/schema/proto/fee.proto\"\xcf\x01\n\x03\x46\x65\x65\x12\x1d\n\x07version\x18\x01 \x02(\x0e\x32\x0c.Fee.Version\x12\x1f\n\x08\x63urrency\x18\x02 \x02(\x0e\x32\r.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\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')
) )
_FEE_VERSION = _descriptor.EnumDescriptor( _FEE_VERSION = _descriptor.EnumDescriptor(
name='Version', name='Version',
full_name='Fee.Version', full_name='pb.Fee.Version',
filename=None, filename=None,
file=DESCRIPTOR, file=DESCRIPTOR,
values=[ values=[
@ -41,14 +41,14 @@ _FEE_VERSION = _descriptor.EnumDescriptor(
], ],
containing_type=None, containing_type=None,
serialized_options=None, serialized_options=None,
serialized_start=139, serialized_start=128,
serialized_end=181, serialized_end=170,
) )
_sym_db.RegisterEnumDescriptor(_FEE_VERSION) _sym_db.RegisterEnumDescriptor(_FEE_VERSION)
_FEE_CURRENCY = _descriptor.EnumDescriptor( _FEE_CURRENCY = _descriptor.EnumDescriptor(
name='Currency', name='Currency',
full_name='Fee.Currency', full_name='pb.Fee.Currency',
filename=None, filename=None,
file=DESCRIPTOR, file=DESCRIPTOR,
values=[ values=[
@ -71,42 +71,42 @@ _FEE_CURRENCY = _descriptor.EnumDescriptor(
], ],
containing_type=None, containing_type=None,
serialized_options=None, serialized_options=None,
serialized_start=183, serialized_start=172,
serialized_end=242, serialized_end=231,
) )
_sym_db.RegisterEnumDescriptor(_FEE_CURRENCY) _sym_db.RegisterEnumDescriptor(_FEE_CURRENCY)
_FEE = _descriptor.Descriptor( _FEE = _descriptor.Descriptor(
name='Fee', name='Fee',
full_name='Fee', full_name='pb.Fee',
filename=None, filename=None,
file=DESCRIPTOR, file=DESCRIPTOR,
containing_type=None, containing_type=None,
fields=[ fields=[
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='version', full_name='Fee.version', index=0, name='version', full_name='pb.Fee.version', index=0,
number=1, type=14, cpp_type=8, label=2, number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0, has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='currency', full_name='Fee.currency', index=1, name='currency', full_name='pb.Fee.currency', index=1,
number=2, type=14, cpp_type=8, label=2, number=2, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0, has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='address', full_name='Fee.address', index=2, name='address', full_name='pb.Fee.address', index=2,
number=3, type=12, cpp_type=9, label=2, number=3, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""), has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='amount', full_name='Fee.amount', index=3, name='amount', full_name='pb.Fee.amount', index=3,
number=4, type=2, cpp_type=6, label=2, number=4, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=float(0), has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
@ -126,8 +126,8 @@ _FEE = _descriptor.Descriptor(
extension_ranges=[], extension_ranges=[],
oneofs=[ oneofs=[
], ],
serialized_start=35, serialized_start=18,
serialized_end=242, serialized_end=231,
) )
_FEE.fields_by_name['version'].enum_type = _FEE_VERSION _FEE.fields_by_name['version'].enum_type = _FEE_VERSION
@ -139,8 +139,8 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
Fee = _reflection.GeneratedProtocolMessageType('Fee', (_message.Message,), dict( Fee = _reflection.GeneratedProtocolMessageType('Fee', (_message.Message,), dict(
DESCRIPTOR = _FEE, DESCRIPTOR = _FEE,
__module__ = 'lbrynet.schema.proto.fee_pb2' __module__ = 'fee_pb2'
# @@protoc_insertion_point(class_scope:Fee) # @@protoc_insertion_point(class_scope:pb.Fee)
)) ))
_sym_db.RegisterMessage(Fee) _sym_db.RegisterMessage(Fee)

View file

@ -1,212 +0,0 @@
syntax = "proto2";
import "lbrynet/schema/proto/fee.proto";
message Metadata {
enum Version {
UNKNOWN_VERSION = 0;
_0_0_1 = 1;
_0_0_2 = 2;
_0_0_3 = 3;
_0_1_0 = 4;
}
enum Language {
UNKNOWN_LANGUAGE = 0;
en = 1;
aa = 2;
ab = 3;
ae = 4;
af = 5;
ak = 6;
am = 7;
an = 8;
ar = 9;
as = 10;
av = 11;
ay = 12;
az = 13;
ba = 14;
be = 15;
bg = 16;
bh = 17;
bi = 18;
bm = 19;
bn = 20;
bo = 21;
br = 22;
bs = 23;
ca = 24;
ce = 25;
ch = 26;
co = 27;
cr = 28;
cs = 29;
cu = 30;
cv = 31;
cy = 32;
da = 33;
de = 34;
dv = 35;
dz = 36;
ee = 37;
el = 38;
eo = 39;
es = 40;
et = 41;
eu = 42;
fa = 43;
ff = 44;
fi = 45;
fj = 46;
fo = 47;
fr = 48;
fy = 49;
ga = 50;
gd = 51;
gl = 52;
gn = 53;
gu = 54;
gv = 55;
ha = 56;
he = 57;
hi = 58;
ho = 59;
hr = 60;
ht = 61;
hu = 62;
hy = 63;
hz = 64;
ia = 65;
id = 66;
ie = 67;
ig = 68;
ii = 69;
ik = 70;
io = 71;
is = 72;
it = 73;
iu = 74;
ja = 75;
jv = 76;
ka = 77;
kg = 78;
ki = 79;
kj = 80;
kk = 81;
kl = 82;
km = 83;
kn = 84;
ko = 85;
kr = 86;
ks = 87;
ku = 88;
kv = 89;
kw = 90;
ky = 91;
la = 92;
lb = 93;
lg = 94;
li = 95;
ln = 96;
lo = 97;
lt = 98;
lu = 99;
lv = 100;
mg = 101;
mh = 102;
mi = 103;
mk = 104;
ml = 105;
mn = 106;
mr = 107;
ms = 108;
mt = 109;
my = 110;
na = 111;
nb = 112;
nd = 113;
ne = 114;
ng = 115;
nl = 116;
nn = 117;
no = 118;
nr = 119;
nv = 120;
ny = 121;
oc = 122;
oj = 123;
om = 124;
or = 125;
os = 126;
pa = 127;
pi = 128;
pl = 129;
ps = 130;
pt = 131;
qu = 132;
rm = 133;
rn = 134;
ro = 135;
ru = 136;
rw = 137;
sa = 138;
sc = 139;
sd = 140;
se = 141;
sg = 142;
si = 143;
sk = 144;
sl = 145;
sm = 146;
sn = 147;
so = 148;
sq = 149;
sr = 150;
ss = 151;
st = 152;
su = 153;
sv = 154;
sw = 155;
ta = 156;
te = 157;
tg = 158;
th = 159;
ti = 160;
tk = 161;
tl = 162;
tn = 163;
to = 164;
tr = 165;
ts = 166;
tt = 167;
tw = 168;
ty = 169;
ug = 170;
uk = 171;
ur = 172;
uz = 173;
ve = 174;
vi = 175;
vo = 176;
wa = 177;
wo = 178;
xh = 179;
yi = 180;
yo = 181;
za = 182;
zh = 183;
zu = 184;
}
required Version version = 1;
required Language language = 2;
required string title = 3;
required string description = 4;
required string author = 5;
required string license = 6;
required bool nsfw = 7;
optional Fee fee = 8;
optional string thumbnail = 9;
optional string preview = 10;
optional string licenseUrl = 11;
}

File diff suppressed because one or more lines are too long

View file

@ -1,14 +0,0 @@
syntax = "proto2";
import "lbrynet/schema/proto/certificate.proto";
message Signature {
enum Version {
UNKNOWN_VERSION = 0;
_0_0_1 = 1;
}
required Version version = 1;
required KeyType signatureType = 2;
required bytes signature = 3;
required bytes certificateId = 4;
}

View file

@ -1,5 +1,5 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: lbrynet/schema/proto/signature.proto # source: signature.proto
import sys import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
@ -12,23 +12,23 @@ from google.protobuf import symbol_database as _symbol_database
_sym_db = _symbol_database.Default() _sym_db = _symbol_database.Default()
from lbrynet.schema.proto import certificate_pb2 as lbrynet_dot_schema_dot_proto_dot_certificate__pb2 from . import certificate_pb2 as certificate__pb2
DESCRIPTOR = _descriptor.FileDescriptor( DESCRIPTOR = _descriptor.FileDescriptor(
name='lbrynet/schema/proto/signature.proto', name='signature.proto',
package='', package='pb',
syntax='proto2', syntax='proto2',
serialized_options=None, serialized_options=None,
serialized_pb=_b('\n$lbrynet/schema/proto/signature.proto\x1a&lbrynet/schema/proto/certificate.proto\"\xa7\x01\n\tSignature\x12#\n\x07version\x18\x01 \x02(\x0e\x32\x12.Signature.Version\x12\x1f\n\rsignatureType\x18\x02 \x02(\x0e\x32\x08.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\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')
, ,
dependencies=[lbrynet_dot_schema_dot_proto_dot_certificate__pb2.DESCRIPTOR,]) dependencies=[certificate__pb2.DESCRIPTOR,])
_SIGNATURE_VERSION = _descriptor.EnumDescriptor( _SIGNATURE_VERSION = _descriptor.EnumDescriptor(
name='Version', name='Version',
full_name='Signature.Version', full_name='pb.Signature.Version',
filename=None, filename=None,
file=DESCRIPTOR, file=DESCRIPTOR,
values=[ values=[
@ -43,42 +43,42 @@ _SIGNATURE_VERSION = _descriptor.EnumDescriptor(
], ],
containing_type=None, containing_type=None,
serialized_options=None, serialized_options=None,
serialized_start=206, serialized_start=174,
serialized_end=248, serialized_end=216,
) )
_sym_db.RegisterEnumDescriptor(_SIGNATURE_VERSION) _sym_db.RegisterEnumDescriptor(_SIGNATURE_VERSION)
_SIGNATURE = _descriptor.Descriptor( _SIGNATURE = _descriptor.Descriptor(
name='Signature', name='Signature',
full_name='Signature', full_name='pb.Signature',
filename=None, filename=None,
file=DESCRIPTOR, file=DESCRIPTOR,
containing_type=None, containing_type=None,
fields=[ fields=[
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='version', full_name='Signature.version', index=0, name='version', full_name='pb.Signature.version', index=0,
number=1, type=14, cpp_type=8, label=2, number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0, has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='signatureType', full_name='Signature.signatureType', index=1, name='signatureType', full_name='pb.Signature.signatureType', index=1,
number=2, type=14, cpp_type=8, label=2, number=2, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0, has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='signature', full_name='Signature.signature', index=2, name='signature', full_name='pb.Signature.signature', index=2,
number=3, type=12, cpp_type=9, label=2, number=3, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""), has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='certificateId', full_name='Signature.certificateId', index=3, name='certificateId', full_name='pb.Signature.certificateId', index=3,
number=4, type=12, cpp_type=9, label=2, number=4, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""), has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
@ -97,20 +97,20 @@ _SIGNATURE = _descriptor.Descriptor(
extension_ranges=[], extension_ranges=[],
oneofs=[ oneofs=[
], ],
serialized_start=81, serialized_start=43,
serialized_end=248, serialized_end=216,
) )
_SIGNATURE.fields_by_name['version'].enum_type = _SIGNATURE_VERSION _SIGNATURE.fields_by_name['version'].enum_type = _SIGNATURE_VERSION
_SIGNATURE.fields_by_name['signatureType'].enum_type = lbrynet_dot_schema_dot_proto_dot_certificate__pb2._KEYTYPE _SIGNATURE.fields_by_name['signatureType'].enum_type = certificate__pb2._KEYTYPE
_SIGNATURE_VERSION.containing_type = _SIGNATURE _SIGNATURE_VERSION.containing_type = _SIGNATURE
DESCRIPTOR.message_types_by_name['Signature'] = _SIGNATURE DESCRIPTOR.message_types_by_name['Signature'] = _SIGNATURE
_sym_db.RegisterFileDescriptor(DESCRIPTOR) _sym_db.RegisterFileDescriptor(DESCRIPTOR)
Signature = _reflection.GeneratedProtocolMessageType('Signature', (_message.Message,), dict( Signature = _reflection.GeneratedProtocolMessageType('Signature', (_message.Message,), dict(
DESCRIPTOR = _SIGNATURE, DESCRIPTOR = _SIGNATURE,
__module__ = 'lbrynet.schema.proto.signature_pb2' __module__ = 'signature_pb2'
# @@protoc_insertion_point(class_scope:Signature) # @@protoc_insertion_point(class_scope:pb.Signature)
)) ))
_sym_db.RegisterMessage(Signature) _sym_db.RegisterMessage(Signature)

View file

@ -1,16 +0,0 @@
syntax = "proto2";
message Source {
enum Version {
UNKNOWN_VERSION = 0;
_0_0_1 = 1;
}
required Version version = 1;
enum SourceTypes {
UNKNOWN_SOURCE_TYPE = 0;
lbry_sd_hash = 1;
}
required SourceTypes sourceType = 2;
required bytes source = 3;
required string contentType = 4;
}

View file

@ -1,5 +1,5 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: lbrynet/schema/proto/source.proto # source: source.proto
import sys import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
@ -15,18 +15,18 @@ _sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor( DESCRIPTOR = _descriptor.FileDescriptor(
name='lbrynet/schema/proto/source.proto', name='source.proto',
package='', package='pb',
syntax='proto2', syntax='proto2',
serialized_options=None, serialized_options=None,
serialized_pb=_b('\n!lbrynet/schema/proto/source.proto\"\xde\x01\n\x06Source\x12 \n\x07version\x18\x01 \x02(\x0e\x32\x0f.Source.Version\x12\'\n\nsourceType\x18\x02 \x02(\x0e\x32\x13.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\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')
) )
_SOURCE_VERSION = _descriptor.EnumDescriptor( _SOURCE_VERSION = _descriptor.EnumDescriptor(
name='Version', name='Version',
full_name='Source.Version', full_name='pb.Source.Version',
filename=None, filename=None,
file=DESCRIPTOR, file=DESCRIPTOR,
values=[ values=[
@ -41,14 +41,14 @@ _SOURCE_VERSION = _descriptor.EnumDescriptor(
], ],
containing_type=None, containing_type=None,
serialized_options=None, serialized_options=None,
serialized_start=160, serialized_start=149,
serialized_end=202, serialized_end=191,
) )
_sym_db.RegisterEnumDescriptor(_SOURCE_VERSION) _sym_db.RegisterEnumDescriptor(_SOURCE_VERSION)
_SOURCE_SOURCETYPES = _descriptor.EnumDescriptor( _SOURCE_SOURCETYPES = _descriptor.EnumDescriptor(
name='SourceTypes', name='SourceTypes',
full_name='Source.SourceTypes', full_name='pb.Source.SourceTypes',
filename=None, filename=None,
file=DESCRIPTOR, file=DESCRIPTOR,
values=[ values=[
@ -63,42 +63,42 @@ _SOURCE_SOURCETYPES = _descriptor.EnumDescriptor(
], ],
containing_type=None, containing_type=None,
serialized_options=None, serialized_options=None,
serialized_start=204, serialized_start=193,
serialized_end=260, serialized_end=249,
) )
_sym_db.RegisterEnumDescriptor(_SOURCE_SOURCETYPES) _sym_db.RegisterEnumDescriptor(_SOURCE_SOURCETYPES)
_SOURCE = _descriptor.Descriptor( _SOURCE = _descriptor.Descriptor(
name='Source', name='Source',
full_name='Source', full_name='pb.Source',
filename=None, filename=None,
file=DESCRIPTOR, file=DESCRIPTOR,
containing_type=None, containing_type=None,
fields=[ fields=[
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='version', full_name='Source.version', index=0, name='version', full_name='pb.Source.version', index=0,
number=1, type=14, cpp_type=8, label=2, number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0, has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='sourceType', full_name='Source.sourceType', index=1, name='sourceType', full_name='pb.Source.sourceType', index=1,
number=2, type=14, cpp_type=8, label=2, number=2, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0, has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='source', full_name='Source.source', index=2, name='source', full_name='pb.Source.source', index=2,
number=3, type=12, cpp_type=9, label=2, number=3, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""), has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='contentType', full_name='Source.contentType', index=3, name='contentType', full_name='pb.Source.contentType', index=3,
number=4, type=9, cpp_type=9, label=2, number=4, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'), has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
@ -118,8 +118,8 @@ _SOURCE = _descriptor.Descriptor(
extension_ranges=[], extension_ranges=[],
oneofs=[ oneofs=[
], ],
serialized_start=38, serialized_start=21,
serialized_end=260, serialized_end=249,
) )
_SOURCE.fields_by_name['version'].enum_type = _SOURCE_VERSION _SOURCE.fields_by_name['version'].enum_type = _SOURCE_VERSION
@ -131,8 +131,8 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR)
Source = _reflection.GeneratedProtocolMessageType('Source', (_message.Message,), dict( Source = _reflection.GeneratedProtocolMessageType('Source', (_message.Message,), dict(
DESCRIPTOR = _SOURCE, DESCRIPTOR = _SOURCE,
__module__ = 'lbrynet.schema.proto.source_pb2' __module__ = 'source_pb2'
# @@protoc_insertion_point(class_scope:Source) # @@protoc_insertion_point(class_scope:pb.Source)
)) ))
_sym_db.RegisterMessage(Source) _sym_db.RegisterMessage(Source)

View file

@ -1,15 +0,0 @@
syntax = "proto2";
import "lbrynet/schema/proto/metadata.proto";
import "lbrynet/schema/proto/source.proto";
message Stream {
enum Version {
UNKNOWN_VERSION = 0;
_0_0_1 = 1;
}
required Version version = 1;
required Metadata metadata = 2;
required Source source = 3;
}

View file

@ -1,5 +1,5 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: lbrynet/schema/proto/stream.proto # source: stream.proto
import sys import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
@ -12,24 +12,24 @@ from google.protobuf import symbol_database as _symbol_database
_sym_db = _symbol_database.Default() _sym_db = _symbol_database.Default()
from lbrynet.schema.proto import metadata_pb2 as lbrynet_dot_schema_dot_proto_dot_metadata__pb2 from . import metadata_pb2 as metadata__pb2
from lbrynet.schema.proto import source_pb2 as lbrynet_dot_schema_dot_proto_dot_source__pb2 from . import source_pb2 as source__pb2
DESCRIPTOR = _descriptor.FileDescriptor( DESCRIPTOR = _descriptor.FileDescriptor(
name='lbrynet/schema/proto/stream.proto', name='stream.proto',
package='', package='pb',
syntax='proto2', syntax='proto2',
serialized_options=None, serialized_options=None,
serialized_pb=_b('\n!lbrynet/schema/proto/stream.proto\x1a#lbrynet/schema/proto/metadata.proto\x1a!lbrynet/schema/proto/source.proto\"\x8c\x01\n\x06Stream\x12 \n\x07version\x18\x01 \x02(\x0e\x32\x0f.Stream.Version\x12\x1b\n\x08metadata\x18\x02 \x02(\x0b\x32\t.Metadata\x12\x17\n\x06source\x18\x03 \x02(\x0b\x32\x07.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\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')
, ,
dependencies=[lbrynet_dot_schema_dot_proto_dot_metadata__pb2.DESCRIPTOR,lbrynet_dot_schema_dot_proto_dot_source__pb2.DESCRIPTOR,]) dependencies=[metadata__pb2.DESCRIPTOR,source__pb2.DESCRIPTOR,])
_STREAM_VERSION = _descriptor.EnumDescriptor( _STREAM_VERSION = _descriptor.EnumDescriptor(
name='Version', name='Version',
full_name='Stream.Version', full_name='pb.Stream.Version',
filename=None, filename=None,
file=DESCRIPTOR, file=DESCRIPTOR,
values=[ values=[
@ -44,35 +44,35 @@ _STREAM_VERSION = _descriptor.EnumDescriptor(
], ],
containing_type=None, containing_type=None,
serialized_options=None, serialized_options=None,
serialized_start=208, serialized_start=158,
serialized_end=250, serialized_end=200,
) )
_sym_db.RegisterEnumDescriptor(_STREAM_VERSION) _sym_db.RegisterEnumDescriptor(_STREAM_VERSION)
_STREAM = _descriptor.Descriptor( _STREAM = _descriptor.Descriptor(
name='Stream', name='Stream',
full_name='Stream', full_name='pb.Stream',
filename=None, filename=None,
file=DESCRIPTOR, file=DESCRIPTOR,
containing_type=None, containing_type=None,
fields=[ fields=[
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='version', full_name='Stream.version', index=0, name='version', full_name='pb.Stream.version', index=0,
number=1, type=14, cpp_type=8, label=2, number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0, has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='metadata', full_name='Stream.metadata', index=1, name='metadata', full_name='pb.Stream.metadata', index=1,
number=2, type=11, cpp_type=10, label=2, number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None, has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='source', full_name='Stream.source', index=2, name='source', full_name='pb.Stream.source', index=2,
number=3, type=11, cpp_type=10, label=2, number=3, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None, has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
@ -91,21 +91,21 @@ _STREAM = _descriptor.Descriptor(
extension_ranges=[], extension_ranges=[],
oneofs=[ oneofs=[
], ],
serialized_start=110, serialized_start=51,
serialized_end=250, serialized_end=200,
) )
_STREAM.fields_by_name['version'].enum_type = _STREAM_VERSION _STREAM.fields_by_name['version'].enum_type = _STREAM_VERSION
_STREAM.fields_by_name['metadata'].message_type = lbrynet_dot_schema_dot_proto_dot_metadata__pb2._METADATA _STREAM.fields_by_name['metadata'].message_type = metadata__pb2._METADATA
_STREAM.fields_by_name['source'].message_type = lbrynet_dot_schema_dot_proto_dot_source__pb2._SOURCE _STREAM.fields_by_name['source'].message_type = source__pb2._SOURCE
_STREAM_VERSION.containing_type = _STREAM _STREAM_VERSION.containing_type = _STREAM
DESCRIPTOR.message_types_by_name['Stream'] = _STREAM DESCRIPTOR.message_types_by_name['Stream'] = _STREAM
_sym_db.RegisterFileDescriptor(DESCRIPTOR) _sym_db.RegisterFileDescriptor(DESCRIPTOR)
Stream = _reflection.GeneratedProtocolMessageType('Stream', (_message.Message,), dict( Stream = _reflection.GeneratedProtocolMessageType('Stream', (_message.Message,), dict(
DESCRIPTOR = _STREAM, DESCRIPTOR = _STREAM,
__module__ = 'lbrynet.schema.proto.stream_pb2' __module__ = 'stream_pb2'
# @@protoc_insertion_point(class_scope:Stream) # @@protoc_insertion_point(class_scope:pb.Stream)
)) ))
_sym_db.RegisterMessage(Stream) _sym_db.RegisterMessage(Stream)

View file

@ -14,4 +14,8 @@ class Metadata(Schema):
if 'fee' in _metadata: if 'fee' in _metadata:
fee_pb = Fee.load(_metadata.pop('fee')) fee_pb = Fee.load(_metadata.pop('fee'))
_message_pb.fee.CopyFrom(fee_pb) _message_pb.fee.CopyFrom(fee_pb)
return cls._load(_metadata, _message_pb) _message_pb.releaseTime = int(_metadata.get('releaseTime', 0))
built_message = cls._load(_metadata, _message_pb)
if built_message.releaseTime == 0:
built_message.ClearField('releaseTime')
return built_message

View file

@ -50,11 +50,11 @@ class NIST_ECDSASigner(object):
digest = self.HASHFUNC(bytearray(b''.join(fields))).digest() digest = self.HASHFUNC(bytearray(b''.join(fields))).digest()
return self.private_key.sign_digest_deterministic(digest, hashfunc=self.HASHFUNC) return self.private_key.sign_digest_deterministic(digest, hashfunc=self.HASHFUNC)
def sign_stream_claim(self, claim, claim_address, cert_claim_id, name, detached=False): def sign_stream_claim(self, claim, claim_address, cert_claim_id, name, legacy=False):
validate_claim_id(cert_claim_id) validate_claim_id(cert_claim_id)
raw_cert_id = binascii.unhexlify(cert_claim_id) raw_cert_id = binascii.unhexlify(cert_claim_id)
decoded_addr = decode_address(claim_address) decoded_addr = decode_address(claim_address)
if detached: if not legacy:
assert name, "Name is required for detached signatures" assert name, "Name is required for detached signatures"
assert self.CURVE_NAME == SECP256k1, f"Only SECP256k1 is supported, not: {self.CURVE_NAME}" assert self.CURVE_NAME == SECP256k1, f"Only SECP256k1 is supported, not: {self.CURVE_NAME}"
signature = self.sign( signature = self.sign(
@ -66,7 +66,7 @@ class NIST_ECDSASigner(object):
else: else:
signature = self.sign(decoded_addr, claim.serialized_no_signature, raw_cert_id) signature = self.sign(decoded_addr, claim.serialized_no_signature, raw_cert_id)
if detached: if not legacy:
return Claim.load(decode_b64_fields(claim.protobuf_dict)), Signature(NAMED_SECP256K1( return Claim.load(decode_b64_fields(claim.protobuf_dict)), Signature(NAMED_SECP256K1(
signature, signature,
raw_cert_id, raw_cert_id,

View file

@ -2,6 +2,7 @@ import sys
import json import json
import tempfile import tempfile
import logging import logging
import time
from binascii import unhexlify from binascii import unhexlify
import twisted.internet import twisted.internet
@ -242,7 +243,7 @@ class EpicAdventuresOfChris45(CommandTestCase):
# After abandoning he just waits for his LBCs to be returned to his account # After abandoning he just waits for his LBCs to be returned to his account
await self.generate(5) await self.generate(5)
result = await self.daemon.jsonrpc_account_balance() result = await self.daemon.jsonrpc_account_balance()
self.assertEqual(result, '8.9693585') self.assertEqual(result, '8.969363')
# Amidst all this Chris receives a call from his friend Ramsey # Amidst all this Chris receives a call from his friend Ramsey
# who says that it is of utmost urgency that Chris transfer him # who says that it is of utmost urgency that Chris transfer him
@ -259,7 +260,7 @@ class EpicAdventuresOfChris45(CommandTestCase):
await self.generate(5) await self.generate(5)
result = await self.daemon.jsonrpc_account_balance() result = await self.daemon.jsonrpc_account_balance()
# Chris' balance was correct # Chris' balance was correct
self.assertEqual(result, '7.9692345') self.assertEqual(result, '7.969239')
# Ramsey too assured him that he had received the 1 LBC and thanks him # Ramsey too assured him that he had received the 1 LBC and thanks him
result = await self.daemon.jsonrpc_account_balance(ramsey_account_id) result = await self.daemon.jsonrpc_account_balance(ramsey_account_id)
@ -418,12 +419,12 @@ class ClaimManagement(CommandTestCase):
VERBOSITY = logging.WARN VERBOSITY = logging.WARN
async def make_claim(self, name='hovercraft', amount='1.0', data=b'hi!', channel_name=None, confirm=True): async def make_claim(self, name='hovercraft', amount='1.0', data=b'hi!', channel_name=None, confirm=True, **kwargs):
with tempfile.NamedTemporaryFile() as file: with tempfile.NamedTemporaryFile() as file:
file.write(data) file.write(data)
file.flush() file.flush()
claim = await self.out(self.daemon.jsonrpc_publish( claim = await self.out(self.daemon.jsonrpc_publish(
name, amount, file_path=file.name, channel_name=channel_name name, amount, file_path=file.name, channel_name=channel_name, **kwargs
)) ))
self.assertTrue(claim['success']) self.assertTrue(claim['success'])
if confirm: if confirm:
@ -612,6 +613,31 @@ class ClaimManagement(CommandTestCase):
) )
self.assertEqual(not_a_claim, 'claim not found') self.assertEqual(not_a_claim, 'claim not found')
async def test_release_time_create_update(self):
channel = await self.out(self.daemon.jsonrpc_channel_new('@rickroll-news', "1.0"))
self.assertTrue(channel['success'])
await self.confirm_tx(channel['tx']['txid'])
release_time = int(time.time())
claim = await self.make_claim(name='today', channel_name='@rickroll-news', release_time=release_time)
self.assertTrue(claim['success'])
uri = 'lbry://@rickroll-news/today'
response = await self.out(self.daemon.jsonrpc_resolve(uri=uri))
self.assertEqual(response[uri]['claim']['value']['stream']['metadata']['releaseTime'], release_time)
self.assertTrue(response[uri]['claim']['signature_is_valid'])
# moar news! stop the machines! update today's edition with extra metadata!
release_time = int(time.time())
self.assertTrue(claim['success'])
metadata = response[uri]['claim']['value']['stream']['metadata']
metadata['title'] = "[YOU WONT BELIEVE IT!] Hamster tries to climb a tree"
metadata['description'] = "Never gonna give you up; Never gonna let you down"
metadata['releaseTime'] = release_time
await self.make_claim(amount='0.0001', name='today', channel_name='@rickroll-news', metadata=metadata)
response = await self.out(self.daemon.jsonrpc_resolve(uri=uri))
self.assertEqual(response[uri]['claim']['value']['stream']['metadata'], metadata)
self.assertTrue(response[uri]['claim']['signature_is_valid'])
async def test_abandoned_channel_with_signed_claims(self): async def test_abandoned_channel_with_signed_claims(self):
channel = await self.out(self.daemon.jsonrpc_channel_new('@abc', "1.0")) channel = await self.out(self.daemon.jsonrpc_channel_new('@abc', "1.0"))
self.assertTrue(channel['success']) self.assertTrue(channel['success'])

View file

@ -101,34 +101,6 @@ class BasicTransactionTest(IntegrationTestCase):
self.assertEqual('URI lbry://404 cannot be resolved', response['lbry://404']['error']) self.assertEqual('URI lbry://404 cannot be resolved', response['lbry://404']['error'])
self.assertEqual('URI lbry://@404 cannot be resolved', response['lbry://@404']['error']) self.assertEqual('URI lbry://@404 cannot be resolved', response['lbry://@404']['error'])
async def test_new_signature_model(self):
address1, address2 = await self.account.receiving.get_addresses(limit=2, only_usable=True)
sendtxid1 = await self.blockchain.send_to_address(address1, 5)
sendtxid2 = await self.blockchain.send_to_address(address2, 5)
await self.blockchain.generate(1)
await asyncio.wait([
self.on_transaction_id(sendtxid1),
self.on_transaction_id(sendtxid2)
])
self.assertEqual(d2l(await self.account.get_balance()), '10.0')
cert, key = generate_certificate()
cert_tx = await Transaction.claim('@bar', cert, l2d('1.0'), address1, [self.account], self.account)
claim = ClaimDict.load_dict(example_claim_dict)
claim = claim.sign(key, address1, cert_tx.outputs[0].claim_id, name='foo', curve=SECP256k1, force_detached=True)
claim_tx = await Transaction.claim('foo', claim, l2d('1.0'), address1, [self.account], self.account)
await self.broadcast(cert_tx)
await self.broadcast(claim_tx)
await self.ledger.wait(claim_tx)
await self.blockchain.generate(1)
await self.ledger.wait(claim_tx)
response = await self.ledger.resolve(0, 10, 'lbry://@bar/foo')
self.assertIn('lbry://@bar/foo', response)
self.assertIn('claim', response['lbry://@bar/foo'])
async def test_new_signature_model_from_unserializable_claim(self): async def test_new_signature_model_from_unserializable_claim(self):
address1, address2 = await self.account.receiving.get_addresses(limit=2, only_usable=True) address1, address2 = await self.account.receiving.get_addresses(limit=2, only_usable=True)
sendtxid1 = await self.blockchain.send_to_address(address1, 5) sendtxid1 = await self.blockchain.send_to_address(address1, 5)

View file

@ -206,19 +206,19 @@ class TestNIST256pSignatures(UnitTest):
def test_validate_ecdsa_signature(self): def test_validate_ecdsa_signature(self):
cert = ClaimDict.generate_certificate(nist256p_private_key, curve=NIST256p) cert = ClaimDict.generate_certificate(nist256p_private_key, curve=NIST256p)
signed = ClaimDict.load_dict(example_010).sign(nist256p_private_key, signed = ClaimDict.load_dict(example_010).sign(nist256p_private_key,
claim_address_2, claim_id_1, curve=NIST256p) claim_address_2, claim_id_1, curve=NIST256p, legacy=True)
self.assertDictEqual(signed.claim_dict, claim_010_signed_nist256p) self.assertDictEqual(signed.claim_dict, claim_010_signed_nist256p)
signed_copy = ClaimDict.load_protobuf(signed.protobuf) signed_copy = ClaimDict.load_protobuf(signed.protobuf)
self.assertEqual(signed_copy.validate_signature(claim_address_2, cert), True) self.assertEqual(signed_copy.validate_signature(claim_address_2, cert), True)
def test_remove_signature_equals_unsigned(self): def test_remove_signature_equals_unsigned(self):
unsigned = ClaimDict.load_dict(example_010) unsigned = ClaimDict.load_dict(example_010)
signed = unsigned.sign(nist256p_private_key, claim_address_1, claim_id_1, curve=NIST256p) signed = unsigned.sign(nist256p_private_key, claim_address_1, claim_id_1, curve=NIST256p, legacy=True)
self.assertEqual(unsigned.serialized, signed.serialized_no_signature) self.assertEqual(unsigned.serialized, signed.serialized_no_signature)
def test_fail_to_validate_fake_ecdsa_signature(self): def test_fail_to_validate_fake_ecdsa_signature(self):
signed = ClaimDict.load_dict(example_010).sign(nist256p_private_key, claim_address_1, signed = ClaimDict.load_dict(example_010).sign(nist256p_private_key, claim_address_1,
claim_id_1, curve=NIST256p) claim_id_1, curve=NIST256p, legacy=True)
signed_copy = ClaimDict.load_protobuf(signed.protobuf) signed_copy = ClaimDict.load_protobuf(signed.protobuf)
fake_key = get_signer(NIST256p).generate().private_key.to_pem() fake_key = get_signer(NIST256p).generate().private_key.to_pem()
fake_cert = ClaimDict.generate_certificate(fake_key, curve=NIST256p) fake_cert = ClaimDict.generate_certificate(fake_key, curve=NIST256p)
@ -228,7 +228,7 @@ class TestNIST256pSignatures(UnitTest):
def test_fail_to_validate_ecdsa_sig_for_altered_claim(self): def test_fail_to_validate_ecdsa_sig_for_altered_claim(self):
cert = ClaimDict.generate_certificate(nist256p_private_key, curve=NIST256p) cert = ClaimDict.generate_certificate(nist256p_private_key, curve=NIST256p)
altered = ClaimDict.load_dict(example_010).sign(nist256p_private_key, claim_address_1, altered = ClaimDict.load_dict(example_010).sign(nist256p_private_key, claim_address_1,
claim_id_1, curve=NIST256p) claim_id_1, curve=NIST256p, legacy=True)
sd_hash = altered['stream']['source']['source'] sd_hash = altered['stream']['source']['source']
altered['stream']['source']['source'] = sd_hash[::-1] altered['stream']['source']['source'] = sd_hash[::-1]
altered_copy = ClaimDict.load_dict(altered.claim_dict) altered_copy = ClaimDict.load_dict(altered.claim_dict)
@ -245,19 +245,19 @@ class TestNIST384pSignatures(UnitTest):
def test_validate_ecdsa_signature(self): def test_validate_ecdsa_signature(self):
cert = ClaimDict.generate_certificate(nist384p_private_key, curve=NIST384p) cert = ClaimDict.generate_certificate(nist384p_private_key, curve=NIST384p)
signed = ClaimDict.load_dict(example_010).sign(nist384p_private_key, signed = ClaimDict.load_dict(example_010).sign(nist384p_private_key,
claim_address_2, claim_id_1, curve=NIST384p) claim_address_2, claim_id_1, curve=NIST384p, legacy=True)
self.assertDictEqual(signed.claim_dict, claim_010_signed_nist384p) self.assertDictEqual(signed.claim_dict, claim_010_signed_nist384p)
signed_copy = ClaimDict.load_protobuf(signed.protobuf) signed_copy = ClaimDict.load_protobuf(signed.protobuf)
self.assertEqual(signed_copy.validate_signature(claim_address_2, cert), True) self.assertEqual(signed_copy.validate_signature(claim_address_2, cert), True)
def test_remove_signature_equals_unsigned(self): def test_remove_signature_equals_unsigned(self):
unsigned = ClaimDict.load_dict(example_010) unsigned = ClaimDict.load_dict(example_010)
signed = unsigned.sign(nist384p_private_key, claim_address_1, claim_id_1, curve=NIST384p) signed = unsigned.sign(nist384p_private_key, claim_address_1, claim_id_1, curve=NIST384p, legacy=True)
self.assertEqual(unsigned.serialized, signed.serialized_no_signature) self.assertEqual(unsigned.serialized, signed.serialized_no_signature)
def test_fail_to_validate_fake_ecdsa_signature(self): def test_fail_to_validate_fake_ecdsa_signature(self):
signed = ClaimDict.load_dict(example_010).sign(nist384p_private_key, claim_address_1, signed = ClaimDict.load_dict(example_010).sign(nist384p_private_key, claim_address_1,
claim_id_1, curve=NIST384p) claim_id_1, curve=NIST384p, legacy=True)
signed_copy = ClaimDict.load_protobuf(signed.protobuf) signed_copy = ClaimDict.load_protobuf(signed.protobuf)
fake_key = get_signer(NIST384p).generate().private_key.to_pem() fake_key = get_signer(NIST384p).generate().private_key.to_pem()
fake_cert = ClaimDict.generate_certificate(fake_key, curve=NIST384p) fake_cert = ClaimDict.generate_certificate(fake_key, curve=NIST384p)
@ -267,7 +267,7 @@ class TestNIST384pSignatures(UnitTest):
def test_fail_to_validate_ecdsa_sig_for_altered_claim(self): def test_fail_to_validate_ecdsa_sig_for_altered_claim(self):
cert = ClaimDict.generate_certificate(nist384p_private_key, curve=NIST384p) cert = ClaimDict.generate_certificate(nist384p_private_key, curve=NIST384p)
altered = ClaimDict.load_dict(example_010).sign(nist384p_private_key, claim_address_1, altered = ClaimDict.load_dict(example_010).sign(nist384p_private_key, claim_address_1,
claim_id_1, curve=NIST384p) claim_id_1, curve=NIST384p, legacy=True)
sd_hash = altered['stream']['source']['source'] sd_hash = altered['stream']['source']['source']
altered['stream']['source']['source'] = sd_hash[::-1] altered['stream']['source']['source'] = sd_hash[::-1]
altered_copy = ClaimDict.load_dict(altered.claim_dict) altered_copy = ClaimDict.load_dict(altered.claim_dict)
@ -285,7 +285,7 @@ class TestSECP256k1Signatures(UnitTest):
cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1) cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1)
self.assertDictEqual(cert.claim_dict, secp256k1_cert) self.assertDictEqual(cert.claim_dict, secp256k1_cert)
signed = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_2, signed = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_2,
claim_id_1, curve=SECP256k1) claim_id_1, curve=SECP256k1, legacy=True)
self.assertDictEqual(signed.claim_dict, claim_010_signed_secp256k1) self.assertDictEqual(signed.claim_dict, claim_010_signed_secp256k1)
signed_copy = ClaimDict.load_protobuf(signed.protobuf) signed_copy = ClaimDict.load_protobuf(signed.protobuf)
self.assertEqual(signed_copy.validate_signature(claim_address_2, cert), True) self.assertEqual(signed_copy.validate_signature(claim_address_2, cert), True)
@ -300,19 +300,19 @@ class TestSECP256k1Signatures(UnitTest):
cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1) cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1)
self.assertDictEqual(cert.claim_dict, secp256k1_cert) self.assertDictEqual(cert.claim_dict, secp256k1_cert)
signed = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_2, signed = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_2,
claim_id_1, curve=SECP256k1) claim_id_1, curve=SECP256k1, legacy=True)
self.assertDictEqual(signed.claim_dict, claim_010_signed_secp256k1) self.assertDictEqual(signed.claim_dict, claim_010_signed_secp256k1)
signed_copy = ClaimDict.load_protobuf(signed.protobuf) signed_copy = ClaimDict.load_protobuf(signed.protobuf)
self.assertRaises(Exception, signed_copy.validate_signature, None, cert) self.assertRaises(Exception, signed_copy.validate_signature, None, cert)
def test_remove_signature_equals_unsigned(self): def test_remove_signature_equals_unsigned(self):
unsigned = ClaimDict.load_dict(example_010) unsigned = ClaimDict.load_dict(example_010)
signed = unsigned.sign(secp256k1_private_key, claim_address_1, claim_id_1, curve=SECP256k1) signed = unsigned.sign(secp256k1_private_key, claim_address_1, claim_id_1, curve=SECP256k1, legacy=True)
self.assertEqual(unsigned.serialized, signed.serialized_no_signature) self.assertEqual(unsigned.serialized, signed.serialized_no_signature)
def test_fail_to_validate_fake_ecdsa_signature(self): def test_fail_to_validate_fake_ecdsa_signature(self):
signed = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_1, signed = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_1,
claim_id_1, curve=SECP256k1) claim_id_1, curve=SECP256k1, legacy=True)
signed_copy = ClaimDict.load_protobuf(signed.protobuf) signed_copy = ClaimDict.load_protobuf(signed.protobuf)
fake_key = get_signer(SECP256k1).generate().private_key.to_pem() fake_key = get_signer(SECP256k1).generate().private_key.to_pem()
fake_cert = ClaimDict.generate_certificate(fake_key, curve=SECP256k1) fake_cert = ClaimDict.generate_certificate(fake_key, curve=SECP256k1)
@ -322,7 +322,7 @@ class TestSECP256k1Signatures(UnitTest):
def test_fail_to_validate_ecdsa_sig_for_altered_claim(self): def test_fail_to_validate_ecdsa_sig_for_altered_claim(self):
cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1) cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1)
altered = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_1, altered = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_1,
claim_id_1, curve=SECP256k1) claim_id_1, curve=SECP256k1, legacy=True)
sd_hash = altered['stream']['source']['source'] sd_hash = altered['stream']['source']['source']
altered['stream']['source']['source'] = sd_hash[::-1] altered['stream']['source']['source'] = sd_hash[::-1]
altered_copy = ClaimDict.load_dict(altered.claim_dict) altered_copy = ClaimDict.load_dict(altered.claim_dict)
@ -335,7 +335,7 @@ class TestDetachedNamedSECP256k1Signatures(UnitTest):
cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1) cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1)
self.assertDictEqual(cert.claim_dict, secp256k1_cert) self.assertDictEqual(cert.claim_dict, secp256k1_cert)
signed = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_2, claim_id_1, signed = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_2, claim_id_1,
curve=SECP256k1, name='example', force_detached=True) curve=SECP256k1, name='example')
signed_copy = ClaimDict.deserialize(signed.serialized) signed_copy = ClaimDict.deserialize(signed.serialized)
self.assertEqual(signed_copy.validate_signature(claim_address_2, cert, name='example'), True) self.assertEqual(signed_copy.validate_signature(claim_address_2, cert, name='example'), True)
@ -343,7 +343,7 @@ class TestDetachedNamedSECP256k1Signatures(UnitTest):
cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1) cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1)
self.assertDictEqual(cert.claim_dict, secp256k1_cert) self.assertDictEqual(cert.claim_dict, secp256k1_cert)
signed = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_2, claim_id_1, signed = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_2, claim_id_1,
curve=SECP256k1, name='example', force_detached=True) curve=SECP256k1, name='example')
self.assertEqual( self.assertEqual(
signed.claim_dict['publisherSignature']['detached_signature'], signed.claim_dict['publisherSignature']['detached_signature'],
binascii.hexlify(signed.serialized).decode() binascii.hexlify(signed.serialized).decode()
@ -408,13 +408,13 @@ class TestDetachedNamedSECP256k1Signatures(UnitTest):
cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1) cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1)
self.assertDictEqual(cert.claim_dict, secp256k1_cert) self.assertDictEqual(cert.claim_dict, secp256k1_cert)
self.assertRaises(Exception, ClaimDict.load_dict(example_010).sign, secp256k1_private_key, self.assertRaises(Exception, ClaimDict.load_dict(example_010).sign, secp256k1_private_key,
None, claim_id_1, curve=SECP256k1, name='example', force_detached=True) None, claim_id_1, curve=SECP256k1, name='example')
def test_fail_to_validate_with_no_claim_address(self): def test_fail_to_validate_with_no_claim_address(self):
cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1) cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1)
self.assertDictEqual(cert.claim_dict, secp256k1_cert) self.assertDictEqual(cert.claim_dict, secp256k1_cert)
signed = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_2, claim_id_1, signed = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_2, claim_id_1,
curve=SECP256k1, name='example', force_detached=True) curve=SECP256k1, name='example')
signed_copy = ClaimDict.load_protobuf(signed.protobuf) signed_copy = ClaimDict.load_protobuf(signed.protobuf)
self.assertRaises(Exception, signed_copy.validate_signature, None, cert, name='example') self.assertRaises(Exception, signed_copy.validate_signature, None, cert, name='example')
@ -422,19 +422,19 @@ class TestDetachedNamedSECP256k1Signatures(UnitTest):
cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1) cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1)
self.assertDictEqual(cert.claim_dict, secp256k1_cert) self.assertDictEqual(cert.claim_dict, secp256k1_cert)
signed = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_2, claim_id_1, signed = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_2, claim_id_1,
curve=SECP256k1, name='example', force_detached=True) curve=SECP256k1, name='example')
signed_copy = ClaimDict.load_protobuf(signed.protobuf) signed_copy = ClaimDict.load_protobuf(signed.protobuf)
self.assertRaises(Exception, signed_copy.validate_signature, None, cert, name=None) self.assertRaises(Exception, signed_copy.validate_signature, None, cert, name=None)
def test_remove_signature_equals_unsigned(self): def test_remove_signature_equals_unsigned(self):
unsigned = ClaimDict.load_dict(example_010) unsigned = ClaimDict.load_dict(example_010)
signed = unsigned.sign(secp256k1_private_key, claim_address_1, claim_id_1, signed = unsigned.sign(secp256k1_private_key, claim_address_1, claim_id_1,
curve=SECP256k1, name='example', force_detached=True) curve=SECP256k1, name='example')
self.assertEqual(unsigned.serialized, signed.serialized_no_signature) self.assertEqual(unsigned.serialized, signed.serialized_no_signature)
def test_fail_to_validate_fake_ecdsa_signature(self): def test_fail_to_validate_fake_ecdsa_signature(self):
signed = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_1, claim_id_1, signed = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_1, claim_id_1,
curve=SECP256k1, name='example', force_detached=True) curve=SECP256k1, name='example')
signed_copy = ClaimDict.deserialize(signed.serialized) signed_copy = ClaimDict.deserialize(signed.serialized)
fake_key = get_signer(SECP256k1).generate().private_key.to_pem() fake_key = get_signer(SECP256k1).generate().private_key.to_pem()
fake_cert = ClaimDict.generate_certificate(fake_key, curve=SECP256k1) fake_cert = ClaimDict.generate_certificate(fake_key, curve=SECP256k1)
@ -444,7 +444,7 @@ class TestDetachedNamedSECP256k1Signatures(UnitTest):
def test_fail_to_validate_ecdsa_sig_for_altered_claim(self): def test_fail_to_validate_ecdsa_sig_for_altered_claim(self):
cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1) cert = ClaimDict.generate_certificate(secp256k1_private_key, curve=SECP256k1)
altered = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_1, claim_id_1, altered = ClaimDict.load_dict(example_010).sign(secp256k1_private_key, claim_address_1, claim_id_1,
curve=SECP256k1, name='example', force_detached=True) curve=SECP256k1, name='example')
original_serialization = altered.serialized original_serialization = altered.serialized
sd_hash = altered['stream']['source']['source'] sd_hash = altered['stream']['source']['source']
altered['stream']['source']['source'] = sd_hash[::-1] altered['stream']['source']['source'] = sd_hash[::-1]