Skip to content
Snippets Groups Projects
Commit 3243e1e7 authored by matograine's avatar matograine
Browse files

[enh] #301 : make `cert` command use <pubkey:checksum> format

    * for display
    * as input
parent 9b9925c7
No related branches found
No related tags found
2 merge requests!146Merge dev into master branch to complete v0.8.0 development cycle,!143#301: Generalize pubkey checksum display and check
...@@ -24,12 +24,13 @@ from duniterpy.documents import BlockUID, block_uid, Identity, Certification ...@@ -24,12 +24,13 @@ from duniterpy.documents import BlockUID, block_uid, Identity, Certification
from silkaj.auth import auth_method from silkaj.auth import auth_method
from silkaj.tools import message_exit, coroutine from silkaj.tools import message_exit, coroutine
from silkaj.tui import convert_time from silkaj.tui import convert_time, display_pubkey_and_checksum
from silkaj.network_tools import ClientInstance from silkaj.network_tools import ClientInstance
from silkaj.blockchain_tools import BlockchainParams, HeadBlock from silkaj.blockchain_tools import BlockchainParams, HeadBlock
from silkaj.license import license_approval from silkaj.license import license_approval
from silkaj import wot from silkaj import wot
from silkaj.constants import SUCCESS_EXIT_STATUS from silkaj.constants import SUCCESS_EXIT_STATUS
from silkaj.crypto_tools import is_pubkey_and_check
@command("cert", help="Send certification") @command("cert", help="Send certification")
...@@ -37,6 +38,11 @@ from silkaj.constants import SUCCESS_EXIT_STATUS ...@@ -37,6 +38,11 @@ from silkaj.constants import SUCCESS_EXIT_STATUS
@coroutine @coroutine
async def send_certification(uid_pubkey_to_certify): async def send_certification(uid_pubkey_to_certify):
client = ClientInstance().client client = ClientInstance().client
checked_pubkey = is_pubkey_and_check(uid_pubkey_to_certify)
if checked_pubkey:
uid_pubkey_to_certify = checked_pubkey
idty_to_certify, pubkey_to_certify, send_certs = await wot.choose_identity( idty_to_certify, pubkey_to_certify, send_certs = await wot.choose_identity(
uid_pubkey_to_certify uid_pubkey_to_certify
) )
...@@ -126,7 +132,14 @@ async def certification_confirmation( ...@@ -126,7 +132,14 @@ async def certification_confirmation(
": #" + idty_timestamp[:15] + "" + convert_time(block["time"], "all") ": #" + idty_timestamp[:15] + "" + convert_time(block["time"], "all")
) )
cert.append(["ID", issuer["uid"], "–>", idty_to_certify["uid"] + block_uid_date]) cert.append(["ID", issuer["uid"], "–>", idty_to_certify["uid"] + block_uid_date])
cert.append(["Pubkey", issuer_pubkey, "–>", pubkey_to_certify]) cert.append(
[
"Pubkey",
display_pubkey_and_checksum(issuer_pubkey),
"–>",
display_pubkey_and_checksum(pubkey_to_certify),
]
)
params = await BlockchainParams().params params = await BlockchainParams().params
cert_begins = convert_time(time(), "date") cert_begins = convert_time(time(), "date")
cert_ends = convert_time(time() + params["sigValidity"], "date") cert_ends = convert_time(time() + params["sigValidity"], "date")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment