What changed, and why it matters
This commit adds a new feature to Stack Wallet that lets Monero wallet users cryptographically sign messages with their wallet keys and verify signatures from others. It is a routine feature implementation, not a security fix. There is no indication in the commit that it addresses a vulnerability or security incident.
No security action required. Review the feature for UX correctness and ensure the underlying cs_monero FFI error behavior is well documented, but the commit itself does not introduce a known security issue.
Security signals we found
Feature addition, not a patch or fix
View-only wallets are explicitly blocked from signing
Empty signature result from underlying library is treated as failure
No changes to key handling, storage, or transaction logic
Evidence from the diff
The change wires up existing Monero wallet2 signMessage/verifySignedMessage FFI wrappers (already present in cs_monero 4.0.0) through CsMoneroInterface and exposes them in LibMoneroWallet via the existing SignVerifyInterface. It adds guards so view-only wallets cannot sign and treats an empty-string signature from wallet2 as an error. The code is additive and does not modify existing security-critical logic.
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 17/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.