25 platformStyle(_platformStyle)
120 ui->
statusLabel_SM->setText(tr(
"The entered address is invalid.") + QString(
" ") + tr(
"Please check the address and try again."));
123 const PKHash* pkhash = std::get_if<PKHash>(&destination);
127 ui->
statusLabel_SM->setText(tr(
"The entered address does not refer to a key.") + QString(
" ") + tr(
"Please check the address and try again."));
139 const std::string& message =
ui->
messageIn_SM->document()->toPlainText().toStdString();
140 std::string signature;
146 error = tr(
"No error");
149 error = tr(
"Private key for the entered address is not available.");
152 error = tr(
"Message signing failed.");
164 ui->
statusLabel_SM->setText(QString(
"<nobr>") + tr(
"Message signed.") + QString(
"</nobr>"));
199 const std::string& address =
ui->
addressIn_VM->text().toStdString();
201 const std::string& message =
ui->
messageIn_VM->document()->toPlainText().toStdString();
203 const auto result =
MessageVerify(address, signature, message);
214 QString(
"<nobr>") + tr(
"Message verified.") + QString(
"</nobr>")
219 tr(
"The entered address is invalid.") + QString(
" ") +
220 tr(
"Please check the address and try again.")
226 tr(
"The entered address does not refer to a key.") + QString(
" ") +
227 tr(
"Please check the address and try again.")
233 tr(
"The signature could not be decoded.") + QString(
" ") +
234 tr(
"Please check the signature and try again.")
240 tr(
"The signature did not match the message digest.") + QString(
" ") +
241 tr(
"Please check the signature and try again.")
246 QString(
"<nobr>") + tr(
"Message verification failed.") + QString(
"</nobr>")
264 if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::FocusIn)
284 return QDialog::eventFilter(
object, event);
289 if (e->type() == QEvent::PaletteChange) {
300 QDialog::changeEvent(e);
Widget that shows a list of sending or receiving addresses.
@ ForSelection
Open address book to pick address.
void setModel(AddressTableModel *model)
const QString & getReturnValue() const
void setValid(bool valid)
void on_clearButton_VM_clicked()
void on_signMessageButton_SM_clicked()
void showTab_SM(bool fShow)
~SignVerifyMessageDialog()
bool eventFilter(QObject *object, QEvent *event) override
void on_pasteButton_SM_clicked()
void on_copySignatureButton_SM_clicked()
void setAddress_SM(const QString &address)
void showTab_VM(bool fShow)
void on_addressBookButton_SM_clicked()
void changeEvent(QEvent *e) override
SignVerifyMessageDialog(const PlatformStyle *platformStyle, QWidget *parent)
void on_addressBookButton_VM_clicked()
const PlatformStyle * platformStyle
void setModel(WalletModel *model)
Ui::SignVerifyMessageDialog * ui
void on_clearButton_SM_clicked()
void on_verifyMessageButton_VM_clicked()
void setAddress_VM(const QString &address)
QPlainTextEdit * messageIn_VM
QPushButton * pasteButton_SM
QPushButton * clearButton_SM
QPushButton * addressBookButton_SM
QPushButton * signMessageButton_SM
QValidatedLineEdit * addressIn_SM
QLineEdit * signatureOut_SM
void setupUi(QDialog *SignVerifyMessageDialog)
QPushButton * copySignatureButton_SM
QValidatedLineEdit * signatureIn_VM
QPushButton * clearButton_VM
QValidatedLineEdit * addressIn_VM
QPlainTextEdit * messageIn_SM
QPushButton * verifyMessageButton_VM
QPushButton * addressBookButton_VM
Interface to Bitcoin wallet from Qt view code.
void refresh(bool pk_hash_only=false)
AddressTableModel * getAddressTableModel()
interfaces::Wallet & wallet() const
UnlockContext requestUnlock()
virtual SigningResult signMessage(const std::string &message, const PKHash &pkhash, std::string &str_sig)=0
Sign message.
CTxDestination DecodeDestination(const std::string &str, std::string &error_msg)
@ PRIVATE_KEY_NOT_AVAILABLE
@ ERR_MALFORMED_SIGNATURE
The provided signature couldn't be parsed (maybe invalid base64).
@ ERR_INVALID_ADDRESS
The provided address is invalid.
@ ERR_ADDRESS_NO_KEY
The provided address is valid but does not refer to a public key.
@ ERR_NOT_SIGNED
The message was not signed with the private key of the provided address.
@ OK
The message verification was successful.
@ ERR_PUBKEY_NOT_RECOVERED
A public key could not be recovered from the provided signature and message.
Utility functions used by the Bitcoin Qt UI.
QFont fixedPitchFont(bool use_embedded_font)
void handleCloseWindowShortcut(QWidget *w)
constexpr auto dialog_flags
void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent)
void setClipboard(const QString &str)
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
bool error(const char *fmt, const Args &... args)
static secp256k1_context * ctx
MessageVerificationResult MessageVerify(const std::string &address, const std::string &signature, const std::string &message)
Verify a signed message.