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
Branches
Tags
1 merge request!7750.50.0
......@@ -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:
......
......@@ -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
......
......@@ -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):
......
......@@ -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)
......
......@@ -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(
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment