Merge pull request #1509 from cypherstack/feat/monero-signing
What changed, and why it matters
This commit adds a new feature to Stack Wallet that lets Monero (XMR) users cryptographically sign messages with their wallet address and verify signatures from others. It is a routine feature addition, not a security fix or vulnerability patch.
No security action required. Treat as a normal feature merge. If exposing message signing in the UI, ensure the UX clearly distinguishes signing from transaction authorization to reduce social-engineering risk.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The merge commit implements SignVerifyInterface for LibMoneroWallet by adding signMessage() and verifyMessage() methods. These methods delegate to the underlying cs_monero/lib_monero wallet library. The implementation includes a guard that prevents signing in view-only wallets and converts an empty-string failure return from wallet2 into an exception. No existing behavior is changed, and no security bug is corrected in the diff.
Changed components
lib/wallets/wallet/intermediate/lib_monero_wallet.dartlib/wl_gen/interfaces/cs_monero_interface.darttool/wl_templates/XMR_cs_monero_interface_impl.template.dartInspect captured patch +75 / −1
### lib/wallets/wallet/intermediate/lib_monero_wallet.dart
@@ -42,13 +42,14 @@ import '../../isar/models/wallet_info.dart';
import '../../models/tx_data.dart';
import '../wallet.dart';
import '../wallet_mixin_interfaces/multi_address_interface.dart';
+import '../wallet_mixin_interfaces/sign_verify_interface.dart';
import '../wallet_mixin_interfaces/view_only_option_interface.dart';
import 'cryptonote_wallet.dart';
abstract class LibMoneroWallet<T extends CryptonoteCurrency>
extends CryptonoteWallet<T>
with ViewOnlyOptionInterface<T>
- implements MultiAddressInterface<T> {
+ implements MultiAddressInterface<T>, SignVerifyInterface {
@override
int get isarTransactionVersion => 2;
@@ -175,6 +176,47 @@ abstract class LibMoneroWallet<T extends CryptonoteCurrency>
return csMonero.getTxKey(wallet!, txid);
}
+ @override
+ Future<String> signMessage(String message, {required Address address}) async {
+ if (isViewOnly) {
+ throw Exception("Cannot sign a message in a view only wallet");
+ }
+ if (wallet == null) {
+ throw Exception("Wallet not open");
+ }
+
+ final signature = await csMonero.signMessage(
+ wallet!,
+ message: message,
+ address: address.value,
+ );
+
+ // wallet2 returns an empty string on failure instead of throwing
+ if (signature.isEmpty) {
+ throw Exception("Failed to sign message with ${address.value}");
+ }
+
+ return signature;
+ }
+
+ @override
+ Future<bool> verifyMessage(
+ String message, {
+ required String address,
+ required String signature,
+ }) async {
+ if (wallet == null) {
+ throw Exception("Wallet not open");
+ }
+
+ return await csMonero.verifyMessage(
+ wallet!,
+ message: message,
+ address: address.trim(),
+ signature: signature.trim(),
+ );
+ }
+
void _setListener() {
if (wallet != null && !csMonero.hasListeners(wallet!)) {
csMonero.addListener(
### lib/wl_gen/interfaces/cs_monero_interface.dart
@@ -60,6 +60,19 @@ abstract class CsMoneroInterface {
Future<String> getTxKey(WrappedWallet wallet, String txid);
+ Future<String> signMessage(
+ WrappedWallet wallet, {
+ required String message,
+ required String address,
+ });
+
+ Future<bool> verifyMessage(
+ WrappedWallet wallet, {
+ required String message,
+ required String address,
+ required String signature,
+ });
+
Future<void> save(WrappedWallet wallet);
Future<String> getPublicViewKey(WrappedWallet wallet);
### tool/wl_templates/XMR_cs_monero_interface_impl.template.dart
@@ -177,6 +177,25 @@ class _CsMoneroInterfaceImpl extends CsMoneroInterface {
Future<String> getTxKey(WrappedWallet wallet, String txid) =>
wallet.get<lib_monero.Wallet>().getTxKey(txid);
+ @override
+ Future<String> signMessage(
+ WrappedWallet wallet, {
+ required String message,
+ required String address,
+ }) => wallet.get<lib_monero.Wallet>().signMessage(message, address);
+
+ @override
+ Future<bool> verifyMessage(
+ WrappedWallet wallet, {
+ required String message,
+ required String address,
+ required String signature,
+ }) => wallet.get<lib_monero.Wallet>().verifyMessage(
+ message,
+ address,
+ signature,
+ );
+
@override
Future<void> save(WrappedWallet wallet) =>
wallet.get<lib_monero.Wallet>().save();Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.