Skip to content
Snippets Groups Projects
Commit 00d09904 authored by Moul's avatar Moul
Browse files

[enh] rename get_certifications_from_identities() and clarify with comments.

parent e9e00cfd
No related branches found
No related tags found
1 merge request!82Certification fails for members
...@@ -6,7 +6,7 @@ from silkaj.tools import get_publickey_from_seed, message_exit, sign_document_fr ...@@ -6,7 +6,7 @@ from silkaj.tools import get_publickey_from_seed, message_exit, sign_document_fr
from silkaj.network_tools import get_current_block, post_request from silkaj.network_tools import get_current_block, post_request
from silkaj.license import license_approval from silkaj.license import license_approval
from silkaj.constants import NO_MATCHING_ID from silkaj.constants import NO_MATCHING_ID
from silkaj.wot import is_member, get_pubkeys_from_id,\ from silkaj.wot import is_member,\
get_uid_from_pubkey, get_searched_id get_uid_from_pubkey, get_searched_id
......
...@@ -79,7 +79,7 @@ def id_pubkey_correspondence(ep, id_pubkey): ...@@ -79,7 +79,7 @@ def id_pubkey_correspondence(ep, id_pubkey):
if check_public_key(id_pubkey, False): if check_public_key(id_pubkey, False):
print("{} public key corresponds to identity: {}".format(id_pubkey, get_uid_from_pubkey(ep, id_pubkey))) print("{} public key corresponds to identity: {}".format(id_pubkey, get_uid_from_pubkey(ep, id_pubkey)))
else: else:
pubkeys = get_pubkeys_from_id(ep, id_pubkey) pubkeys = get_informations_for_identities(ep, id_pubkey)
if pubkeys == NO_MATCHING_ID: if pubkeys == NO_MATCHING_ID:
print(NO_MATCHING_ID) print(NO_MATCHING_ID)
else: else:
...@@ -97,7 +97,7 @@ def get_searched_id(ep, id): ...@@ -97,7 +97,7 @@ def get_searched_id(ep, id):
many identities could match many identities could match
return the one searched return the one searched
""" """
certs_req = get_pubkeys_from_id(ep, id) certs_req = get_informations_for_identities(ep, id)
if certs_req == NO_MATCHING_ID: if certs_req == NO_MATCHING_ID:
message_exit(NO_MATCHING_ID) message_exit(NO_MATCHING_ID)
for certs_id in certs_req: for certs_id in certs_req:
...@@ -118,12 +118,14 @@ def get_uid_from_pubkey(ep, pubkey): ...@@ -118,12 +118,14 @@ def get_uid_from_pubkey(ep, pubkey):
i += 1 i += 1
def get_pubkeys_from_id(ep, uid): def get_informations_for_identities(ep, identifier):
""" """
check id exist :identifier: identity or pubkey in part or whole
Return received and sent certifications lists of matching identities
if one identity found
""" """
try: try:
results = get_request(ep, "wot/lookup/" + uid) results = get_request(ep, "wot/lookup/" + identifier)
except: except:
return NO_MATCHING_ID return NO_MATCHING_ID
return results["results"] return results["results"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment