verify messages working for monero

This commit is contained in:
Matthew Fosse 2024-04-19 09:26:41 -07:00
parent 94434c426d
commit 34b37d95cd
3 changed files with 9 additions and 16 deletions

View file

@ -405,7 +405,7 @@ String signMessage(String message, {String address = ""}) {
bool verifyMessage(String message, String address, String signature) { bool verifyMessage(String message, String address, String signature) {
final messagePointer = message.toNativeUtf8(); final messagePointer = message.toNativeUtf8();
final addressPointer = address.toNativeUtf8(); final addressPointer = address.toNativeUtf8();
final signaturePointer = address.toNativeUtf8(); final signaturePointer = signature.toNativeUtf8();
final isVerified = verifyMessageNative(messagePointer, addressPointer, signaturePointer); final isVerified = verifyMessageNative(messagePointer, addressPointer, signaturePointer);
calloc.free(messagePointer); calloc.free(messagePointer);

View file

@ -1029,7 +1029,7 @@ extern "C"
bool verify_message(char *message, char *address, char *signature) bool verify_message(char *message, char *address, char *signature)
{ {
return get_current_wallet()->verifySignedMessage(std::string(message), std::string(address), std::string(verifySignedMessage)); return get_current_wallet()->verifySignedMessage(std::string(message), std::string(address), std::string(signature));
} }
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -1,23 +1,10 @@
import 'package:cake_wallet/core/wallet_name_validator.dart';
import 'package:cake_wallet/entities/generate_name.dart';
import 'package:cake_wallet/entities/seed_type.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/address_text_field.dart'; import 'package:cake_wallet/src/widgets/address_text_field.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart'; import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
import 'package:cake_wallet/src/widgets/blockchain_height_widget.dart';
import 'package:cake_wallet/src/widgets/picker.dart';
import 'package:cake_wallet/src/widgets/seed_language_picker.dart';
import 'package:cake_wallet/src/widgets/seed_widget.dart';
import 'package:cake_wallet/themes/extensions/address_theme.dart';
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
import 'package:cake_wallet/utils/show_bar.dart'; import 'package:cake_wallet/utils/show_bar.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/seed_type_view_model.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:mobx/mobx.dart';
import 'package:polyseed/polyseed.dart';
class SignForm extends StatefulWidget { class SignForm extends StatefulWidget {
SignForm({ SignForm({
@ -75,7 +62,10 @@ class SignFormState extends State<SignForm> {
const SizedBox(height: 20), const SizedBox(height: 20),
AddressTextField( AddressTextField(
controller: addressController, controller: addressController,
options: [AddressTextFieldOption.paste, AddressTextFieldOption.walletAddresses], options: [
AddressTextFieldOption.paste,
AddressTextFieldOption.walletAddresses
],
buttonColor: Theme.of(context).hintColor, buttonColor: Theme.of(context).hintColor,
onSelectedContact: (contact) { onSelectedContact: (contact) {
addressController.text = contact.address; addressController.text = contact.address;
@ -89,6 +79,9 @@ class SignFormState extends State<SignForm> {
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
final text = signatureController.text; final text = signatureController.text;
if (text.isEmpty) {
return;
}
Clipboard.setData(ClipboardData(text: text)); Clipboard.setData(ClipboardData(text: text));
showBar<void>(context, S.of(context).transaction_details_copied(text)); showBar<void>(context, S.of(context).transaction_details_copied(text));
}, },