Merge pull request #10426 from f321x/qml_preferences_section
qml: restructure preferences, security improvements
This commit is contained in:
@@ -346,4 +346,10 @@ Pane {
|
|||||||
dialog.open()
|
dialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binding {
|
||||||
|
target: AppController
|
||||||
|
property: 'secureWindow'
|
||||||
|
value: Boolean(addressdetails.privkey)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,6 +157,93 @@ Pane {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 0
|
||||||
|
Switch {
|
||||||
|
id: syncLabels
|
||||||
|
onCheckedChanged: {
|
||||||
|
if (activeFocus)
|
||||||
|
AppController.setPluginEnabled('labels', checked)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: qsTr('Synchronize labels')
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 0
|
||||||
|
Switch {
|
||||||
|
id: psbtNostr
|
||||||
|
onCheckedChanged: {
|
||||||
|
if (activeFocus)
|
||||||
|
AppController.setPluginEnabled('psbt_nostr', checked)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: qsTr('Nostr Cosigner')
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 0
|
||||||
|
enabled: AppController.isAndroid()
|
||||||
|
Switch {
|
||||||
|
id: setMaxBrightnessOnQrDisplay
|
||||||
|
onCheckedChanged: {
|
||||||
|
if (activeFocus)
|
||||||
|
Config.setMaxBrightnessOnQrDisplay = checked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: qsTr('Increase brightness when displaying QR codes')
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PrefsHeading {
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
text: qsTr('Security')
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
property bool noWalletPassword: Daemon.currentWallet ? Daemon.currentWallet.verifyPassword('') : true
|
||||||
|
enabled: Daemon.currentWallet && !noWalletPassword
|
||||||
|
|
||||||
|
Switch {
|
||||||
|
id: paymentAuthentication
|
||||||
|
// showing the toggle as checked even if the wallet has no password would be misleading
|
||||||
|
checked: Config.paymentAuthentication && !(Daemon.currentWallet && parent.noWalletPassword)
|
||||||
|
onCheckedChanged: {
|
||||||
|
if (activeFocus) {
|
||||||
|
// will request authentication when checked = false
|
||||||
|
console.log('paymentAuthentication: ' + checked)
|
||||||
|
Config.paymentAuthentication = checked;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: qsTr('Request authentication for payments')
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -214,79 +301,17 @@ Pane {
|
|||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
enabled: AppController.isAndroid()
|
||||||
property bool noWalletPassword: Daemon.currentWallet ? Daemon.currentWallet.verifyPassword('') : true
|
|
||||||
enabled: Daemon.currentWallet && !noWalletPassword
|
|
||||||
|
|
||||||
Switch {
|
Switch {
|
||||||
id: paymentAuthentication
|
id: disableScreenshots
|
||||||
// showing the toggle as checked even if the wallet has no password would be misleading
|
|
||||||
checked: Config.paymentAuthentication && !(Daemon.currentWallet && parent.noWalletPassword)
|
|
||||||
onCheckedChanged: {
|
|
||||||
if (activeFocus) {
|
|
||||||
// will request authentication when checked = false
|
|
||||||
console.log('paymentAuthentication: ' + checked)
|
|
||||||
Config.paymentAuthentication = checked;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
text: qsTr('Payment authentication')
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Layout.columnSpan: 2
|
|
||||||
Layout.fillWidth: true
|
|
||||||
spacing: 0
|
|
||||||
Switch {
|
|
||||||
id: syncLabels
|
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
if (activeFocus)
|
if (activeFocus)
|
||||||
AppController.setPluginEnabled('labels', checked)
|
Config.alwaysAllowScreenshots = !checked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: qsTr('Synchronize labels')
|
text: qsTr('Protect secrets from screenshots')
|
||||||
wrapMode: Text.Wrap
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Layout.columnSpan: 2
|
|
||||||
Layout.fillWidth: true
|
|
||||||
spacing: 0
|
|
||||||
Switch {
|
|
||||||
id: psbtNostr
|
|
||||||
onCheckedChanged: {
|
|
||||||
if (activeFocus)
|
|
||||||
AppController.setPluginEnabled('psbt_nostr', checked)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
text: qsTr('Nostr Cosigner')
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Layout.columnSpan: 2
|
|
||||||
Layout.fillWidth: true
|
|
||||||
spacing: 0
|
|
||||||
Switch {
|
|
||||||
id: setMaxBrightnessOnQrDisplay
|
|
||||||
onCheckedChanged: {
|
|
||||||
if (activeFocus)
|
|
||||||
Config.setMaxBrightnessOnQrDisplay = checked
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
text: qsTr('Set display to max brightness when displaying QR codes')
|
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -463,24 +488,6 @@ Pane {
|
|||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Layout.columnSpan: 2
|
|
||||||
Layout.fillWidth: true
|
|
||||||
spacing: 0
|
|
||||||
Switch {
|
|
||||||
id: alwaysAllowScreenshots
|
|
||||||
onCheckedChanged: {
|
|
||||||
if (activeFocus)
|
|
||||||
Config.alwaysAllowScreenshots = checked
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
text: qsTr('Always allow screenshots')
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -498,8 +505,8 @@ Pane {
|
|||||||
freezeReusedAddressUtxos.checked = Config.freezeReusedAddressUtxos
|
freezeReusedAddressUtxos.checked = Config.freezeReusedAddressUtxos
|
||||||
useTrampolineRouting.checked = !Config.useGossip
|
useTrampolineRouting.checked = !Config.useGossip
|
||||||
enableDebugLogs.checked = Config.enableDebugLogs
|
enableDebugLogs.checked = Config.enableDebugLogs
|
||||||
alwaysAllowScreenshots.checked = Config.alwaysAllowScreenshots
|
disableScreenshots.checked = !Config.alwaysAllowScreenshots && AppController.isAndroid()
|
||||||
setMaxBrightnessOnQrDisplay.checked = Config.setMaxBrightnessOnQrDisplay
|
setMaxBrightnessOnQrDisplay.checked = Config.setMaxBrightnessOnQrDisplay && AppController.isAndroid()
|
||||||
useRecoverableChannels.checked = Config.useRecoverableChannels
|
useRecoverableChannels.checked = Config.useRecoverableChannels
|
||||||
syncLabels.checked = AppController.isPluginEnabled('labels')
|
syncLabels.checked = AppController.isPluginEnabled('labels')
|
||||||
psbtNostr.checked = AppController.isPluginEnabled('psbt_nostr')
|
psbtNostr.checked = AppController.isPluginEnabled('psbt_nostr')
|
||||||
|
|||||||
@@ -189,8 +189,8 @@ ElDialog {
|
|||||||
enabled: _addressMine
|
enabled: _addressMine
|
||||||
icon.source: '../../icons/seal.png'
|
icon.source: '../../icons/seal.png'
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var sig = Daemon.currentWallet.signMessage(addressField.text, plaintext.text)
|
Daemon.currentWallet.signMessage(addressField.text, plaintext.text)
|
||||||
signature.text = sig
|
// emits messageSigned(sig)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FlatButton {
|
FlatButton {
|
||||||
@@ -207,7 +207,13 @@ ElDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: Daemon.currentWallet
|
||||||
|
function onMessageSigned(sig) {
|
||||||
|
signature.text = sig
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
|
|||||||
otpFailed = pyqtSignal([str, str], arguments=['code', 'message'])
|
otpFailed = pyqtSignal([str, str], arguments=['code', 'message'])
|
||||||
peersUpdated = pyqtSignal()
|
peersUpdated = pyqtSignal()
|
||||||
seedRetrieved = pyqtSignal()
|
seedRetrieved = pyqtSignal()
|
||||||
|
messageSigned = pyqtSignal([str], arguments=['signature'])
|
||||||
|
|
||||||
_network_signal = pyqtSignal(str, object)
|
_network_signal = pyqtSignal(str, object)
|
||||||
|
|
||||||
@@ -848,10 +849,12 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
|
|||||||
def isAddressMine(self, addr):
|
def isAddressMine(self, addr):
|
||||||
return self.wallet.is_mine(addr)
|
return self.wallet.is_mine(addr)
|
||||||
|
|
||||||
@pyqtSlot(str, str, result=str)
|
@pyqtSlot(str, str)
|
||||||
|
@auth_protect(message=_("Sign message?"))
|
||||||
def signMessage(self, address, message):
|
def signMessage(self, address, message):
|
||||||
sig = self.wallet.sign_message(address, message, self.password)
|
sig = self.wallet.sign_message(address, message, self.password)
|
||||||
return base64.b64encode(sig).decode('ascii')
|
result = base64.b64encode(sig).decode('ascii')
|
||||||
|
self.messageSigned.emit(result)
|
||||||
|
|
||||||
def determine_max(self, *, mktx: Callable[[FeePolicy], PartialTransaction]) -> Tuple[Optional[int], Optional[str]]:
|
def determine_max(self, *, mktx: Callable[[FeePolicy], PartialTransaction]) -> Tuple[Optional[int], Optional[str]]:
|
||||||
# TODO: merge with SendTab.spend_max() and move to backend wallet
|
# TODO: merge with SendTab.spend_max() and move to backend wallet
|
||||||
|
|||||||
Reference in New Issue
Block a user