Skip to content
Snippets Groups Projects
Commit fb4dd5f8 authored by Vincent Texier's avatar Vincent Texier
Browse files

[fix] fix context menu Save revocation document

Add filename in file dialog
parent 01c9eb00
No related branches found
No related tags found
1 merge request!7750.50.0
...@@ -330,7 +330,8 @@ class ConnectionConfigController(QObject): ...@@ -330,7 +330,8 @@ class ConnectionConfigController(QObject):
selected_files = await QAsyncFileDialog.get_save_filename( selected_files = await QAsyncFileDialog.get_save_filename(
self.view, self.view,
self.tr("Save a revocation document"), 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)"), self.tr("All text files (*.txt)"),
) )
if selected_files: if selected_files:
......
...@@ -48,7 +48,7 @@ class ConnectionConfigModel(QObject): ...@@ -48,7 +48,7 @@ class ConnectionConfigModel(QObject):
self.connection.scrypt_r = scrypt_params.r self.connection.scrypt_r = scrypt_params.r
self.connection.scrypt_p = scrypt_params.p self.connection.scrypt_p = scrypt_params.p
self.connection.password = password self.connection.password = password
self.connection.pubkey = SigningKey( self.connection.pubkey = SigningKey.from_credentials(
self.connection.salt, password, scrypt_params self.connection.salt, password, scrypt_params
).pubkey ).pubkey
......
...@@ -150,7 +150,7 @@ class ConnectionConfigView(QDialog, Ui_ConnectionConfigurationDialog): ...@@ -150,7 +150,7 @@ class ConnectionConfigView(QDialog, Ui_ConnectionConfigurationDialog):
def action_show_pubkey(self): def action_show_pubkey(self):
salt = self.edit_salt.text() salt = self.edit_salt.text()
password = self.edit_password.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) self.label_info.setText(pubkey)
def account_name(self): def account_name(self):
......
...@@ -235,7 +235,7 @@ class NavigationController(QObject): ...@@ -235,7 +235,7 @@ class NavigationController(QObject):
) )
if not password or not secret_key: if not password or not secret_key:
return return
key = SigningKey(secret_key, password, connection.scrypt_params) key = SigningKey.from_credentials(secret_key, password, connection.scrypt_params)
identity_doc.sign([key]) identity_doc.sign([key])
identity.signature = identity_doc.signatures[0] identity.signature = identity_doc.signatures[0]
self.model.update_identity(identity) self.model.update_identity(identity)
...@@ -321,7 +321,8 @@ neither your identity from the network.""" ...@@ -321,7 +321,8 @@ neither your identity from the network."""
selected_files = await QAsyncFileDialog.get_save_filename( selected_files = await QAsyncFileDialog.get_save_filename(
self.view, self.view,
self.tr("Save a revokation document"), 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)"), self.tr("All text files (*.txt)"),
) )
if selected_files: if selected_files:
...@@ -354,7 +355,7 @@ The publication of this document will remove your identity from the network.</p> ...@@ -354,7 +355,7 @@ The publication of this document will remove your identity from the network.</p>
) )
if not password or not secret_key: if not password or not secret_key:
return return
key = SigningKey(secret_key, password, connection.scrypt_params) key = SigningKey.from_credentials(secret_key, password, connection.scrypt_params)
identity_doc.sign([key]) identity_doc.sign([key])
identity.signature = identity_doc.signatures[0] identity.signature = identity_doc.signatures[0]
self.model.update_identity(identity) self.model.update_identity(identity)
......
...@@ -70,9 +70,8 @@ class PasswordInputController(QObject): ...@@ -70,9 +70,8 @@ class PasswordInputController(QObject):
if detect_non_printable(password): if detect_non_printable(password):
self.view.error(self.tr("Non printable characters in password")) self.view.error(self.tr("Non printable characters in password"))
return False return False
if ( 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.connection.pubkey
): ):
self.view.error( self.view.error(
......
...@@ -152,7 +152,7 @@ class DocumentsService: ...@@ -152,7 +152,7 @@ class DocumentsService:
connection.blockstamp, connection.blockstamp,
None, None,
) )
key = SigningKey(secret_key, password, connection.scrypt_params) key = SigningKey.from_credentials(secret_key, password, connection.scrypt_params)
membership.sign([key]) membership.sign([key])
self._logger.debug("Membership : {0}".format(membership.signed_raw())) self._logger.debug("Membership : {0}".format(membership.signed_raw()))
responses = await self._bma_connector.broadcast( responses = await self._bma_connector.broadcast(
...@@ -199,9 +199,9 @@ class DocumentsService: ...@@ -199,9 +199,9 @@ class DocumentsService:
10, connection.currency, connection.pubkey, identity.pubkey, blockUID, None 10, connection.currency, connection.pubkey, identity.pubkey, blockUID, None
) )
key = SigningKey(secret_key, password, connection.scrypt_params) key = SigningKey.from_credentials(secret_key, password, connection.scrypt_params)
certification.sign(identity.document(), [key]) certification.sign([key])
signed_cert = certification.signed_raw(identity.document()) signed_cert = certification.signed_raw()
self._logger.debug("Certification : {0}".format(signed_cert)) self._logger.debug("Certification : {0}".format(signed_cert))
timestamp = self._blockchain_processor.time(connection.currency) timestamp = self._blockchain_processor.time(connection.currency)
responses = await self._bma_connector.broadcast( responses = await self._bma_connector.broadcast(
...@@ -225,14 +225,14 @@ class DocumentsService: ...@@ -225,14 +225,14 @@ class DocumentsService:
:param str salt: The account SigningKey salt :param str salt: The account SigningKey salt
:param str password: The account SigningKey password :param str password: The account SigningKey password
""" """
revocation = Revocation(10, currency, None) revocation = Revocation(10, currency, identity, "")
self_cert = identity.document() self_cert = identity.document()
key = SigningKey(salt, password) key = SigningKey.from_credentials(salt, password)
revocation.sign(self_cert, [key]) revocation.sign([key])
self._logger.debug( 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])) self._logger.debug("Signature : \n{0}".format(revocation.signatures[0]))
...@@ -243,7 +243,7 @@ class DocumentsService: ...@@ -243,7 +243,7 @@ class DocumentsService:
} }
self._logger.debug("Posted data : {0}".format(data)) self._logger.debug("Posted data : {0}".format(data))
responses = await self._bma_connector.broadcast( responses = await self._bma_connector.broadcast(
currency, bma.wot.Revoke, {}, data currency, bma.wot.revoke, data
) )
result = await parse_bma_responses(responses) result = await parse_bma_responses(responses)
return result return result
...@@ -256,26 +256,26 @@ class DocumentsService: ...@@ -256,26 +256,26 @@ class DocumentsService:
:param str secret_key: The account SigningKey secret key :param str secret_key: The account SigningKey secret key
:param str password: The account SigningKey password :param str password: The account SigningKey password
""" """
document = Revocation(10, connection.currency, connection.pubkey, "")
identity = self._identities_processor.get_identity( identity = self._identities_processor.get_identity(
connection.currency, connection.pubkey, connection.uid connection.currency, connection.pubkey, connection.uid
) )
if not identity: if not identity:
identity = self.generate_identity(connection) identity = self.generate_identity(connection)
identity_doc = identity.document() identity_doc = identity.document()
key = SigningKey( key = SigningKey.from_credentials(
connection.salt, connection.password, connection.scrypt_params connection.salt, connection.password, connection.scrypt_params
) )
identity_doc.sign([key]) identity_doc.sign([key])
identity.signature = identity_doc.signatures[0] identity.signature = identity_doc.signatures[0]
self._identities_processor.insert_or_update_identity(identity) 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(), identity
return document.signed_raw(self_cert), identity
def tx_sources(self, amount, amount_base, currency, pubkey): def tx_sources(self, amount, amount_base, currency, pubkey):
""" """
...@@ -527,7 +527,7 @@ class DocumentsService: ...@@ -527,7 +527,7 @@ class DocumentsService:
:param str message: The message to send with the transfer :param str message: The message to send with the transfer
""" """
blockstamp = self._blockchain_processor.current_buid(connection.currency) 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)) logging.debug("Sender pubkey:{0}".format(key.pubkey))
tx_entities = [] tx_entities = []
result = (True, ""), tx_entities result = (True, ""), tx_entities
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment