From 08d8fda85787edea89389bbbc842ab04de15af53 Mon Sep 17 00:00:00 2001 From: Kevin F Date: Tue, 13 Sep 2022 12:29:50 -0500 Subject: [PATCH] developing signature processing in wot --- .../wot/wot/identity/processtrustsignature.py | 8 ++++---- ...ock_processing.py => test_proccess_trust_signature.py} | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) rename tests/default-plugin-tests/wot/{test_block_processing.py => test_proccess_trust_signature.py} (74%) diff --git a/static-data/default-plugins/wot/wot/identity/processtrustsignature.py b/static-data/default-plugins/wot/wot/identity/processtrustsignature.py index 1d04d1c2..ca5e42cd 100644 --- a/static-data/default-plugins/wot/wot/identity/processtrustsignature.py +++ b/static-data/default-plugins/wot/wot/identity/processtrustsignature.py @@ -6,12 +6,12 @@ import nacl.exceptions from getbykey import get_identity_by_key -def process_trust_signature(signature: bytes): - if len(signature) != 128: +def process_trust_signature(sig_payload: bytes): + if len(sig_payload) != 128: logger.warn( f'Signature size is invalid for a signed identity') - signer = signature[:32] - signed = signature[32:65] + signer = sig_payload[:32] + signed = sig_payload[32:65] signature = signature[65:] # If bad signature, it raises nacl.exceptions.BadSignatureError diff --git a/tests/default-plugin-tests/wot/test_block_processing.py b/tests/default-plugin-tests/wot/test_proccess_trust_signature.py similarity index 74% rename from tests/default-plugin-tests/wot/test_block_processing.py rename to tests/default-plugin-tests/wot/test_proccess_trust_signature.py index 0ec07ba7..f3cfd13d 100644 --- a/tests/default-plugin-tests/wot/test_block_processing.py +++ b/tests/default-plugin-tests/wot/test_proccess_trust_signature.py @@ -15,11 +15,13 @@ sys.path.append(".") sys.path.append('static-data/default-plugins/wot/') sys.path.append("src/") from wot import identity -from wot import process_block -class BlockProcessingTest(unittest.TestCase): +class TrustSignatureProcessing(unittest.TestCase): def test_block_processing_trust(self): + identity1 = identity.Identity() + identity2 = identity.Identity() + identity1.trust(identity2) unittest.main()