diff --git a/silkaj/cert.py b/silkaj/cert.py index 49acd2657d69404d905707a26c4cf8f42359465c..cac7b105b7cf4267518914b00343417937e28120 100644 --- a/silkaj/cert.py +++ b/silkaj/cert.py @@ -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.license import license_approval 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 diff --git a/silkaj/wot.py b/silkaj/wot.py index 43c6829b29873ce634a75472e2b9d366c136321d..87e94420a70cb28c0eea7edf648639e89f8f2201 100644 --- a/silkaj/wot.py +++ b/silkaj/wot.py @@ -79,7 +79,7 @@ def id_pubkey_correspondence(ep, id_pubkey): if check_public_key(id_pubkey, False): print("{} public key corresponds to identity: {}".format(id_pubkey, get_uid_from_pubkey(ep, id_pubkey))) else: - pubkeys = get_pubkeys_from_id(ep, id_pubkey) + pubkeys = get_informations_for_identities(ep, id_pubkey) if pubkeys == NO_MATCHING_ID: print(NO_MATCHING_ID) else: @@ -97,7 +97,7 @@ def get_searched_id(ep, id): many identities could match 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: message_exit(NO_MATCHING_ID) for certs_id in certs_req: @@ -118,12 +118,14 @@ def get_uid_from_pubkey(ep, pubkey): 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: - results = get_request(ep, "wot/lookup/" + uid) + results = get_request(ep, "wot/lookup/" + identifier) except: return NO_MATCHING_ID return results["results"]