diff --git a/src/sakia/gui/dialogs/connection_cfg/controller.py b/src/sakia/gui/dialogs/connection_cfg/controller.py index fea5a3a302871198d53f2414e7a56dd433487906..d91ed16564dc4f8d2ac3e3939b73c686aa47a952 100644 --- a/src/sakia/gui/dialogs/connection_cfg/controller.py +++ b/src/sakia/gui/dialogs/connection_cfg/controller.py @@ -330,7 +330,8 @@ class ConnectionConfigController(QObject): selected_files = await QAsyncFileDialog.get_save_filename( self.view, self.tr("Save a revocation document"), - "", + "revocation-{uid}-{pubkey}-{currency}.txt".format(uid=identity.uid, pubkey=identity.pubkey[:8], + currency=identity.currency), self.tr("All text files (*.txt)"), ) if selected_files: diff --git a/src/sakia/gui/dialogs/connection_cfg/model.py b/src/sakia/gui/dialogs/connection_cfg/model.py index 9d8e8c734ac0f8f53b50be1e998d481b9744e700..92d151b263661130efea1c260ee1fc2caee80a6c 100644 --- a/src/sakia/gui/dialogs/connection_cfg/model.py +++ b/src/sakia/gui/dialogs/connection_cfg/model.py @@ -48,7 +48,7 @@ class ConnectionConfigModel(QObject): self.connection.scrypt_r = scrypt_params.r self.connection.scrypt_p = scrypt_params.p self.connection.password = password - self.connection.pubkey = SigningKey( + self.connection.pubkey = SigningKey.from_credentials( self.connection.salt, password, scrypt_params ).pubkey diff --git a/src/sakia/gui/dialogs/connection_cfg/view.py b/src/sakia/gui/dialogs/connection_cfg/view.py index 396a2f8046e1355348a2cfecc75c19773c5cb76a..12363c63efa91309dd4cd32fbe7fc5807c65a227 100644 --- a/src/sakia/gui/dialogs/connection_cfg/view.py +++ b/src/sakia/gui/dialogs/connection_cfg/view.py @@ -150,7 +150,7 @@ class ConnectionConfigView(QDialog, Ui_ConnectionConfigurationDialog): def action_show_pubkey(self): salt = self.edit_salt.text() password = self.edit_password.text() - pubkey = SigningKey(salt, password, self.scrypt_params).pubkey + pubkey = SigningKey.from_credentials(salt, password, self.scrypt_params).pubkey self.label_info.setText(pubkey) def account_name(self): diff --git a/src/sakia/gui/navigation/controller.py b/src/sakia/gui/navigation/controller.py index 1210084b8f91c0dc70c8295f95fa5e433e9317df..cd3347539de0c22014c1104b2ec451335f30ad2a 100644 --- a/src/sakia/gui/navigation/controller.py +++ b/src/sakia/gui/navigation/controller.py @@ -235,7 +235,7 @@ class NavigationController(QObject): ) if not password or not secret_key: return - key = SigningKey(secret_key, password, connection.scrypt_params) + key = SigningKey.from_credentials(secret_key, password, connection.scrypt_params) identity_doc.sign([key]) identity.signature = identity_doc.signatures[0] self.model.update_identity(identity) @@ -321,7 +321,8 @@ neither your identity from the network.""" selected_files = await QAsyncFileDialog.get_save_filename( self.view, self.tr("Save a revokation document"), - "", + "revocation-{uid}-{pubkey}-{currency}.txt".format(uid=connection.uid, pubkey=connection.pubkey[:8], + currency=connection.currency), self.tr("All text files (*.txt)"), ) if selected_files: @@ -354,7 +355,7 @@ The publication of this document will remove your identity from the network.</p> ) if not password or not secret_key: return - key = SigningKey(secret_key, password, connection.scrypt_params) + key = SigningKey.from_credentials(secret_key, password, connection.scrypt_params) identity_doc.sign([key]) identity.signature = identity_doc.signatures[0] self.model.update_identity(identity) diff --git a/src/sakia/gui/sub/password_input/controller.py b/src/sakia/gui/sub/password_input/controller.py index 9a64499f31d3c269faef87a535ec67d27c162eb7..e93ab211a8f9b101e2d6b5b136f07a677d0a9fe2 100644 --- a/src/sakia/gui/sub/password_input/controller.py +++ b/src/sakia/gui/sub/password_input/controller.py @@ -70,9 +70,8 @@ class PasswordInputController(QObject): if detect_non_printable(password): self.view.error(self.tr("Non printable characters in password")) return False - if ( - SigningKey(secret_key, password, self.connection.scrypt_params).pubkey + SigningKey.from_credentials(secret_key, password, self.connection.scrypt_params).pubkey != self.connection.pubkey ): self.view.error( diff --git a/src/sakia/services/documents.py b/src/sakia/services/documents.py index 512f73b5ce5d526ddc00fe177eb34ffce38cce88..321cc22e5bf50e4bec761edf39b0af6a9b7ef388 100644 --- a/src/sakia/services/documents.py +++ b/src/sakia/services/documents.py @@ -152,7 +152,7 @@ class DocumentsService: connection.blockstamp, None, ) - key = SigningKey(secret_key, password, connection.scrypt_params) + key = SigningKey.from_credentials(secret_key, password, connection.scrypt_params) membership.sign([key]) self._logger.debug("Membership : {0}".format(membership.signed_raw())) responses = await self._bma_connector.broadcast( @@ -199,9 +199,9 @@ class DocumentsService: 10, connection.currency, connection.pubkey, identity.pubkey, blockUID, None ) - key = SigningKey(secret_key, password, connection.scrypt_params) - certification.sign(identity.document(), [key]) - signed_cert = certification.signed_raw(identity.document()) + key = SigningKey.from_credentials(secret_key, password, connection.scrypt_params) + certification.sign([key]) + signed_cert = certification.signed_raw() self._logger.debug("Certification : {0}".format(signed_cert)) timestamp = self._blockchain_processor.time(connection.currency) responses = await self._bma_connector.broadcast( @@ -225,14 +225,14 @@ class DocumentsService: :param str salt: The account SigningKey salt :param str password: The account SigningKey password """ - revocation = Revocation(10, currency, None) + revocation = Revocation(10, currency, identity, "") self_cert = identity.document() - key = SigningKey(salt, password) - revocation.sign(self_cert, [key]) + key = SigningKey.from_credentials(salt, password) + revocation.sign([key]) self._logger.debug( - "Self-Revokation Document : \n{0}".format(revocation.raw(self_cert)) + "Self-Revokation Document : \n{0}".format(revocation.raw()) ) self._logger.debug("Signature : \n{0}".format(revocation.signatures[0])) @@ -243,7 +243,7 @@ class DocumentsService: } self._logger.debug("Posted data : {0}".format(data)) responses = await self._bma_connector.broadcast( - currency, bma.wot.Revoke, {}, data + currency, bma.wot.revoke, data ) result = await parse_bma_responses(responses) return result @@ -256,26 +256,26 @@ class DocumentsService: :param str secret_key: The account SigningKey secret key :param str password: The account SigningKey password """ - document = Revocation(10, connection.currency, connection.pubkey, "") identity = self._identities_processor.get_identity( connection.currency, connection.pubkey, connection.uid ) if not identity: identity = self.generate_identity(connection) identity_doc = identity.document() - key = SigningKey( + key = SigningKey.from_credentials( connection.salt, connection.password, connection.scrypt_params ) identity_doc.sign([key]) identity.signature = identity_doc.signatures[0] self._identities_processor.insert_or_update_identity(identity) - self_cert = identity.document() + document = Revocation(10, connection.currency, identity.document(), "") + + key = SigningKey.from_credentials(secret_key, password, connection.scrypt_params) - key = SigningKey(secret_key, password, connection.scrypt_params) + document.sign([key]) - document.sign(self_cert, [key]) - return document.signed_raw(self_cert), identity + return document.signed_raw(), identity def tx_sources(self, amount, amount_base, currency, pubkey): """ @@ -527,7 +527,7 @@ class DocumentsService: :param str message: The message to send with the transfer """ blockstamp = self._blockchain_processor.current_buid(connection.currency) - key = SigningKey(secret_key, password, connection.scrypt_params) + key = SigningKey.from_credentials(secret_key, password, connection.scrypt_params) logging.debug("Sender pubkey:{0}".format(key.pubkey)) tx_entities = [] result = (True, ""), tx_entities