diff --git a/duniterpy/documents/certification.py b/duniterpy/documents/certification.py index d1a0c12bf9511291ea108842c2982ca255e08dea..b0c93bc57fb697453c2a1184a3cfcb48bb1a9163 100644 --- a/duniterpy/documents/certification.py +++ b/duniterpy/documents/certification.py @@ -220,14 +220,14 @@ CertTimestamp: {timestamp} """ if not isinstance(self.identity, Identity): raise MalformedDocumentError( - "Identity is a pubkey or None, can not create raw format" + "Identity is not defined or properly defined. Can not create raw format" ) if self.signature is None: - raise MalformedDocumentError("Signature is None, can not create raw format") + raise MalformedDocumentError( + "Signature is not defined, can not create signed raw format" + ) - raw = self.raw() - signed_raw = raw + self.signature + "\n" - return signed_raw + return f"{self.raw()}{self.signature}\n" def inline(self) -> str: """ diff --git a/duniterpy/documents/document.py b/duniterpy/documents/document.py index 22e1465128a29d59cd32b450a054f85c1c522408..0d16d7976da3843a2c1d6125af9dba07da975483 100644 --- a/duniterpy/documents/document.py +++ b/duniterpy/documents/document.py @@ -105,10 +105,11 @@ class Document: :return: """ if self.signature is None: - raise MalformedDocumentError("Signature is None, can not create raw format") - raw = self.raw() - signed_raw = raw + self.signature + "\n" - return signed_raw + raise MalformedDocumentError( + "Signature is not defined, can not create signed raw format" + ) + + return f"{self.raw()}{self.signature}\n" @property def sha_hash(self) -> str: @@ -128,7 +129,7 @@ class Document: :return: """ if self.signature is None: - raise Exception("Signature is None, can not check signature") + raise Exception("Signature is not defined, can not check signature") verifying_key = VerifyingKey(pubkey) diff --git a/duniterpy/documents/revocation.py b/duniterpy/documents/revocation.py index 1b12f71d695a1518d40be9af0d9acb893810930a..0bb43542fb80033b0bd99c207538927d6a4c3a46 100644 --- a/duniterpy/documents/revocation.py +++ b/duniterpy/documents/revocation.py @@ -198,7 +198,7 @@ IdtySignature: {signature} """ Sign the current document - :param key: List of libnacl key instances + :param key: Libnacl key instance :return: """ if not isinstance(self.identity, Identity): @@ -215,10 +215,9 @@ IdtySignature: {signature} """ if not isinstance(self.identity, Identity): raise MalformedDocumentError( - "Identity is a pubkey or None, can not create raw format" + "Identity is not defined or properly defined. Can not create raw format" ) if self.signature is None: raise MalformedDocumentError("Signature is None, can not create raw format") - raw = self.raw() - signed_raw = raw + self.signature + "\n" - return signed_raw + + return f"{self.raw()}{self.signature}\n" diff --git a/duniterpy/documents/transaction.py b/duniterpy/documents/transaction.py index c1a3d6d15de1bc3d9f3ee52263d78066b2a338e3..eba7def48870c32955ee4706316461451b9918b4 100644 --- a/duniterpy/documents/transaction.py +++ b/duniterpy/documents/transaction.py @@ -960,7 +960,7 @@ Currency: {1} def check_signatures(self, pubkeys: List[str]): """ - Check if the signatures matches pubkeys + Check if the signatures matches the pubkeys :param pubkeys: List of Base58 public keys