developing signature processing in wot

This commit is contained in:
Kevin F 2022-09-13 12:29:50 -05:00
parent 650e943182
commit 08d8fda857
2 changed files with 8 additions and 6 deletions

View File

@ -6,12 +6,12 @@ import nacl.exceptions
from getbykey import get_identity_by_key from getbykey import get_identity_by_key
def process_trust_signature(signature: bytes): def process_trust_signature(sig_payload: bytes):
if len(signature) != 128: if len(sig_payload) != 128:
logger.warn( logger.warn(
f'Signature size is invalid for a signed identity') f'Signature size is invalid for a signed identity')
signer = signature[:32] signer = sig_payload[:32]
signed = signature[32:65] signed = sig_payload[32:65]
signature = signature[65:] signature = signature[65:]
# If bad signature, it raises nacl.exceptions.BadSignatureError # If bad signature, it raises nacl.exceptions.BadSignatureError

View File

@ -15,11 +15,13 @@ sys.path.append(".")
sys.path.append('static-data/default-plugins/wot/') sys.path.append('static-data/default-plugins/wot/')
sys.path.append("src/") sys.path.append("src/")
from wot import identity from wot import identity
from wot import process_block
class BlockProcessingTest(unittest.TestCase): class TrustSignatureProcessing(unittest.TestCase):
def test_block_processing_trust(self): def test_block_processing_trust(self):
identity1 = identity.Identity()
identity2 = identity.Identity()
identity1.trust(identity2)
unittest.main() unittest.main()