mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
CW-711 passphrase for XMR/WOWcreation (#1992)
* add monero passphrase add wownero passphrase add passphrase to seed screen * obscure passphrase by default disable passphrase create for zano * Update lib/view_model/wallet_keys_view_model.dart [skip ci] * Update lib/src/screens/wallet_keys/wallet_keys_page.dart [skip ci] * Update lib/view_model/advanced_privacy_settings_view_model.dart * dynamic passphrase icon * fix polyseed not being encrypted by passphrase --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
parent
96921d5767
commit
8b56c52dc6
15 changed files with 138 additions and 20 deletions
|
@ -45,12 +45,11 @@ String getSeed() {
|
||||||
if (cakepolyseed != "") {
|
if (cakepolyseed != "") {
|
||||||
if (cakepassphrase != "") {
|
if (cakepassphrase != "") {
|
||||||
try {
|
try {
|
||||||
final lang = PolyseedLang.getByPhrase(cakepassphrase);
|
final lang = PolyseedLang.getByPhrase(cakepolyseed);
|
||||||
final coin = PolyseedCoin.POLYSEED_MONERO;
|
final coin = PolyseedCoin.POLYSEED_MONERO;
|
||||||
final ps = Polyseed.decode(cakepolyseed, lang, coin);
|
final ps = Polyseed.decode(cakepolyseed, lang, coin);
|
||||||
final passphrase = getPassphrase();
|
if (ps.isEncrypted || cakepassphrase == "") return ps.encode(lang, coin);
|
||||||
if (ps.isEncrypted || passphrase == "") return ps.encode(lang, coin);
|
ps.crypt(cakepassphrase);
|
||||||
ps.crypt(getPassphrase());
|
|
||||||
return ps.encode(lang, coin);
|
return ps.encode(lang, coin);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
printV(e);
|
printV(e);
|
||||||
|
|
|
@ -70,6 +70,7 @@ void createWalletSync(
|
||||||
{required String path,
|
{required String path,
|
||||||
required String password,
|
required String password,
|
||||||
required String language,
|
required String language,
|
||||||
|
required String passphrase,
|
||||||
int nettype = 0}) {
|
int nettype = 0}) {
|
||||||
txhistory = null;
|
txhistory = null;
|
||||||
final newWptr = monero.WalletManager_createWallet(wmPtr,
|
final newWptr = monero.WalletManager_createWallet(wmPtr,
|
||||||
|
@ -80,6 +81,7 @@ void createWalletSync(
|
||||||
throw WalletCreationException(message: monero.Wallet_errorString(newWptr));
|
throw WalletCreationException(message: monero.Wallet_errorString(newWptr));
|
||||||
}
|
}
|
||||||
wptr = newWptr;
|
wptr = newWptr;
|
||||||
|
monero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.passphrase", value: passphrase);
|
||||||
monero.Wallet_store(wptr!, path: path);
|
monero.Wallet_store(wptr!, path: path);
|
||||||
openedWalletsByPath[path] = wptr!;
|
openedWalletsByPath[path] = wptr!;
|
||||||
_lastOpenedWallet = path;
|
_lastOpenedWallet = path;
|
||||||
|
@ -390,8 +392,9 @@ void _createWallet(Map<String, dynamic> args) {
|
||||||
final path = args['path'] as String;
|
final path = args['path'] as String;
|
||||||
final password = args['password'] as String;
|
final password = args['password'] as String;
|
||||||
final language = args['language'] as String;
|
final language = args['language'] as String;
|
||||||
|
final passphrase = args['passphrase'] as String;
|
||||||
|
|
||||||
createWalletSync(path: path, password: password, language: language);
|
createWalletSync(path: path, password: password, language: language, passphrase: passphrase);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _restoreFromSeed(Map<String, dynamic> args) {
|
void _restoreFromSeed(Map<String, dynamic> args) {
|
||||||
|
@ -459,11 +462,13 @@ Future<void> createWallet(
|
||||||
{required String path,
|
{required String path,
|
||||||
required String password,
|
required String password,
|
||||||
required String language,
|
required String language,
|
||||||
|
required String passphrase,
|
||||||
int nettype = 0}) async =>
|
int nettype = 0}) async =>
|
||||||
_createWallet({
|
_createWallet({
|
||||||
'path': path,
|
'path': path,
|
||||||
'password': password,
|
'password': password,
|
||||||
'language': language,
|
'language': language,
|
||||||
|
'passphrase': passphrase,
|
||||||
'nettype': nettype
|
'nettype': nettype
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
|
||||||
passphrase: monero_wallet.getPassphrase());
|
passphrase: monero_wallet.getPassphrase());
|
||||||
|
|
||||||
int? get restoreHeight =>
|
int? get restoreHeight =>
|
||||||
transactionHistory.transactions.values.firstOrNull?.height;
|
transactionHistory.transactions.values.firstOrNull?.height ?? monero.Wallet_getRefreshFromBlockHeight(wptr!);
|
||||||
|
|
||||||
monero_wallet.SyncListener? _listener;
|
monero_wallet.SyncListener? _listener;
|
||||||
ReactionDisposer? _onAccountChangeReaction;
|
ReactionDisposer? _onAccountChangeReaction;
|
||||||
|
|
|
@ -26,11 +26,12 @@ import 'package:polyseed/polyseed.dart';
|
||||||
|
|
||||||
class MoneroNewWalletCredentials extends WalletCredentials {
|
class MoneroNewWalletCredentials extends WalletCredentials {
|
||||||
MoneroNewWalletCredentials(
|
MoneroNewWalletCredentials(
|
||||||
{required String name, required this.language, required this.isPolyseed, String? password})
|
{required String name, required this.language, required this.isPolyseed, String? password, this.passphrase})
|
||||||
: super(name: name, password: password);
|
: super(name: name, password: password);
|
||||||
|
|
||||||
final String language;
|
final String language;
|
||||||
final bool isPolyseed;
|
final bool isPolyseed;
|
||||||
|
final String? passphrase;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MoneroRestoreWalletFromHardwareCredentials extends WalletCredentials {
|
class MoneroRestoreWalletFromHardwareCredentials extends WalletCredentials {
|
||||||
|
@ -92,7 +93,7 @@ class MoneroWalletService extends WalletService<
|
||||||
@override
|
@override
|
||||||
WalletType getType() => WalletType.monero;
|
WalletType getType() => WalletType.monero;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<MoneroWallet> create(MoneroNewWalletCredentials credentials, {bool? isTestnet}) async {
|
Future<MoneroWallet> create(MoneroNewWalletCredentials credentials, {bool? isTestnet}) async {
|
||||||
try {
|
try {
|
||||||
final path = await pathForWallet(name: credentials.name, type: getType());
|
final path = await pathForWallet(name: credentials.name, type: getType());
|
||||||
|
@ -112,7 +113,7 @@ class MoneroWalletService extends WalletService<
|
||||||
}
|
}
|
||||||
|
|
||||||
await monero_wallet_manager.createWallet(
|
await monero_wallet_manager.createWallet(
|
||||||
path: path, password: credentials.password!, language: credentials.language);
|
path: path, password: credentials.password!, language: credentials.language, passphrase: credentials.passphrase??"");
|
||||||
final wallet = MoneroWallet(
|
final wallet = MoneroWallet(
|
||||||
walletInfo: credentials.walletInfo!,
|
walletInfo: credentials.walletInfo!,
|
||||||
unspentCoinsInfo: unspentCoinsInfoSource,
|
unspentCoinsInfo: unspentCoinsInfoSource,
|
||||||
|
@ -382,6 +383,10 @@ class MoneroWalletService extends WalletService<
|
||||||
restoreHeight: height,
|
restoreHeight: height,
|
||||||
spendKey: spendKey);
|
spendKey: spendKey);
|
||||||
|
|
||||||
|
|
||||||
|
monero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.seed", value: seed);
|
||||||
|
monero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.passphrase", value: passphrase??'');
|
||||||
|
|
||||||
final wallet = MoneroWallet(
|
final wallet = MoneroWallet(
|
||||||
walletInfo: walletInfo,
|
walletInfo: walletInfo,
|
||||||
unspentCoinsInfo: unspentCoinsInfoSource,
|
unspentCoinsInfo: unspentCoinsInfoSource,
|
||||||
|
|
|
@ -44,7 +44,7 @@ String getSeed() {
|
||||||
if (cakepolyseed != "") {
|
if (cakepolyseed != "") {
|
||||||
if (cakepassphrase != "") {
|
if (cakepassphrase != "") {
|
||||||
try {
|
try {
|
||||||
final lang = PolyseedLang.getByPhrase(cakepassphrase);
|
final lang = PolyseedLang.getByPhrase(cakepolyseed);
|
||||||
final coin = PolyseedCoin.POLYSEED_WOWNERO;
|
final coin = PolyseedCoin.POLYSEED_WOWNERO;
|
||||||
final ps = Polyseed.decode(cakepolyseed, lang, coin);
|
final ps = Polyseed.decode(cakepolyseed, lang, coin);
|
||||||
final passphrase = getPassphrase();
|
final passphrase = getPassphrase();
|
||||||
|
|
|
@ -66,6 +66,7 @@ void createWalletSync(
|
||||||
{required String path,
|
{required String path,
|
||||||
required String password,
|
required String password,
|
||||||
required String language,
|
required String language,
|
||||||
|
required String passphrase,
|
||||||
int nettype = 0}) {
|
int nettype = 0}) {
|
||||||
txhistory = null;
|
txhistory = null;
|
||||||
final newWptr = wownero.WalletManager_createWallet(wmPtr,
|
final newWptr = wownero.WalletManager_createWallet(wmPtr,
|
||||||
|
@ -76,6 +77,8 @@ void createWalletSync(
|
||||||
throw WalletCreationException(message: wownero.Wallet_errorString(newWptr));
|
throw WalletCreationException(message: wownero.Wallet_errorString(newWptr));
|
||||||
}
|
}
|
||||||
wptr = newWptr;
|
wptr = newWptr;
|
||||||
|
wownero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.passphrase", value: passphrase);
|
||||||
|
|
||||||
wownero.Wallet_store(wptr!, path: path);
|
wownero.Wallet_store(wptr!, path: path);
|
||||||
openedWalletsByPath[path] = wptr!;
|
openedWalletsByPath[path] = wptr!;
|
||||||
|
|
||||||
|
@ -362,8 +365,9 @@ void _createWallet(Map<String, dynamic> args) {
|
||||||
final path = args['path'] as String;
|
final path = args['path'] as String;
|
||||||
final password = args['password'] as String;
|
final password = args['password'] as String;
|
||||||
final language = args['language'] as String;
|
final language = args['language'] as String;
|
||||||
|
final passphrase = args['passphrase'] as String;
|
||||||
|
|
||||||
createWalletSync(path: path, password: password, language: language);
|
createWalletSync(path: path, password: password, language: language, passphrase: passphrase);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _restoreFromSeed(Map<String, dynamic> args) {
|
void _restoreFromSeed(Map<String, dynamic> args) {
|
||||||
|
@ -431,11 +435,13 @@ Future<void> createWallet(
|
||||||
{required String path,
|
{required String path,
|
||||||
required String password,
|
required String password,
|
||||||
required String language,
|
required String language,
|
||||||
|
required String passphrase,
|
||||||
int nettype = 0}) async =>
|
int nettype = 0}) async =>
|
||||||
_createWallet({
|
_createWallet({
|
||||||
'path': path,
|
'path': path,
|
||||||
'password': password,
|
'password': password,
|
||||||
'language': language,
|
'language': language,
|
||||||
|
'passphrase': passphrase,
|
||||||
'nettype': nettype
|
'nettype': nettype
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ import 'package:cw_core/wallet_base.dart';
|
||||||
import 'package:cw_core/wallet_info.dart';
|
import 'package:cw_core/wallet_info.dart';
|
||||||
import 'package:cw_core/wownero_amount_format.dart';
|
import 'package:cw_core/wownero_amount_format.dart';
|
||||||
import 'package:cw_core/wownero_balance.dart';
|
import 'package:cw_core/wownero_balance.dart';
|
||||||
|
import 'package:cw_wownero/api/account_list.dart';
|
||||||
import 'package:cw_wownero/api/coins_info.dart';
|
import 'package:cw_wownero/api/coins_info.dart';
|
||||||
import 'package:cw_wownero/api/structs/pending_transaction.dart';
|
import 'package:cw_wownero/api/structs/pending_transaction.dart';
|
||||||
import 'package:cw_wownero/api/transaction_history.dart' as transaction_history;
|
import 'package:cw_wownero/api/transaction_history.dart' as transaction_history;
|
||||||
|
@ -131,6 +132,10 @@ abstract class WowneroWalletBase
|
||||||
publicViewKey: wownero_wallet.getPublicViewKey(),
|
publicViewKey: wownero_wallet.getPublicViewKey(),
|
||||||
passphrase: wownero_wallet.getPassphrase());
|
passphrase: wownero_wallet.getPassphrase());
|
||||||
|
|
||||||
|
int? get restoreHeight =>
|
||||||
|
transactionHistory.transactions.values.firstOrNull?.height ?? wownero.Wallet_getRefreshFromBlockHeight(wptr!);
|
||||||
|
|
||||||
|
|
||||||
wownero_wallet.SyncListener? _listener;
|
wownero_wallet.SyncListener? _listener;
|
||||||
ReactionDisposer? _onAccountChangeReaction;
|
ReactionDisposer? _onAccountChangeReaction;
|
||||||
ReactionDisposer? _onTxHistoryChangeReaction;
|
ReactionDisposer? _onTxHistoryChangeReaction;
|
||||||
|
|
|
@ -10,6 +10,7 @@ import 'package:cw_core/wallet_info.dart';
|
||||||
import 'package:cw_core/wallet_service.dart';
|
import 'package:cw_core/wallet_service.dart';
|
||||||
import 'package:cw_core/wallet_type.dart';
|
import 'package:cw_core/wallet_type.dart';
|
||||||
import 'package:cw_core/get_height_by_date.dart';
|
import 'package:cw_core/get_height_by_date.dart';
|
||||||
|
import 'package:cw_wownero/api/account_list.dart';
|
||||||
import 'package:cw_wownero/api/exceptions/wallet_opening_exception.dart';
|
import 'package:cw_wownero/api/exceptions/wallet_opening_exception.dart';
|
||||||
import 'package:cw_wownero/api/wallet_manager.dart' as wownero_wallet_manager;
|
import 'package:cw_wownero/api/wallet_manager.dart' as wownero_wallet_manager;
|
||||||
import 'package:cw_wownero/api/wallet_manager.dart';
|
import 'package:cw_wownero/api/wallet_manager.dart';
|
||||||
|
@ -21,11 +22,12 @@ import 'package:monero/wownero.dart' as wownero;
|
||||||
|
|
||||||
class WowneroNewWalletCredentials extends WalletCredentials {
|
class WowneroNewWalletCredentials extends WalletCredentials {
|
||||||
WowneroNewWalletCredentials(
|
WowneroNewWalletCredentials(
|
||||||
{required String name, required this.language, required this.isPolyseed, String? password})
|
{required String name, required this.language, required this.isPolyseed, this.passphrase, String? password})
|
||||||
: super(name: name, password: password);
|
: super(name: name, password: password);
|
||||||
|
|
||||||
final String language;
|
final String language;
|
||||||
final bool isPolyseed;
|
final bool isPolyseed;
|
||||||
|
final String? passphrase;
|
||||||
}
|
}
|
||||||
|
|
||||||
class WowneroRestoreWalletFromSeedCredentials extends WalletCredentials {
|
class WowneroRestoreWalletFromSeedCredentials extends WalletCredentials {
|
||||||
|
@ -95,7 +97,7 @@ class WowneroWalletService extends WalletService<
|
||||||
}
|
}
|
||||||
|
|
||||||
await wownero_wallet_manager.createWallet(
|
await wownero_wallet_manager.createWallet(
|
||||||
path: path, password: credentials.password!, language: credentials.language);
|
path: path, password: credentials.password!, language: credentials.language, passphrase: credentials.passphrase??'');
|
||||||
final wallet = WowneroWallet(
|
final wallet = WowneroWallet(
|
||||||
walletInfo: credentials.walletInfo!, unspentCoinsInfo: unspentCoinsInfoSource, password: credentials.password!);
|
walletInfo: credentials.walletInfo!, unspentCoinsInfo: unspentCoinsInfoSource, password: credentials.password!);
|
||||||
await wallet.init();
|
await wallet.init();
|
||||||
|
@ -345,6 +347,9 @@ class WowneroWalletService extends WalletService<
|
||||||
restoreHeight: height,
|
restoreHeight: height,
|
||||||
spendKey: spendKey);
|
spendKey: spendKey);
|
||||||
|
|
||||||
|
wownero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.seed", value: seed);
|
||||||
|
wownero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.passphrase", value: passphrase??'');
|
||||||
|
|
||||||
final wallet = WowneroWallet(walletInfo: walletInfo, unspentCoinsInfo: unspentCoinsInfoSource, password: password);
|
final wallet = WowneroWallet(walletInfo: walletInfo, unspentCoinsInfo: unspentCoinsInfoSource, password: password);
|
||||||
await wallet.init();
|
await wallet.init();
|
||||||
|
|
||||||
|
|
|
@ -253,9 +253,10 @@ class CWMonero extends Monero {
|
||||||
required String name,
|
required String name,
|
||||||
required String language,
|
required String language,
|
||||||
required bool isPolyseed,
|
required bool isPolyseed,
|
||||||
|
required String? passphrase,
|
||||||
String? password}) =>
|
String? password}) =>
|
||||||
MoneroNewWalletCredentials(
|
MoneroNewWalletCredentials(
|
||||||
name: name, password: password, language: language, isPolyseed: isPolyseed);
|
name: name, password: password, language: language, isPolyseed: isPolyseed, passphrase: passphrase);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, String> getKeys(Object wallet) {
|
Map<String, String> getKeys(Object wallet) {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:cake_wallet/entities/qr_view_data.dart';
|
import 'package:cake_wallet/entities/qr_view_data.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cake_wallet/routes.dart';
|
import 'package:cake_wallet/routes.dart';
|
||||||
|
@ -15,6 +17,8 @@ import 'package:cake_wallet/utils/show_bar.dart';
|
||||||
import 'package:cake_wallet/view_model/wallet_keys_view_model.dart';
|
import 'package:cake_wallet/view_model/wallet_keys_view_model.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:qr_flutter/qr_flutter.dart';
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
|
|
||||||
class WalletKeysPage extends BasePage {
|
class WalletKeysPage extends BasePage {
|
||||||
|
@ -162,6 +166,8 @@ class _WalletKeysPageBodyState extends State<WalletKeysPageBody>
|
||||||
children: [
|
children: [
|
||||||
if (isLegacySeedOnly || isLegacySeed) _buildHeightBox(),
|
if (isLegacySeedOnly || isLegacySeed) _buildHeightBox(),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
|
(_buildPassphraseBox() ?? Container()),
|
||||||
|
if (widget.walletKeysViewModel.passphrase.isNotEmpty) const SizedBox(height: 20),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SeedPhraseGridWidget(
|
child: SeedPhraseGridWidget(
|
||||||
list: isLegacySeed
|
list: isLegacySeed
|
||||||
|
@ -262,6 +268,64 @@ class _WalletKeysPageBodyState extends State<WalletKeysPageBody>
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Widget? _buildPassphraseBox() {
|
||||||
|
if (widget.walletKeysViewModel.passphrase.isEmpty) return null;
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 14),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
color: Theme.of(context).cardColor,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
S.of(context).passphrase_view_keys,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Theme.of(context).extension<CakeTextTheme>()!.buttonTextColor.withOpacity(0.5),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Expanded(
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Observer(builder: (BuildContext context) {
|
||||||
|
return Text(
|
||||||
|
(widget.walletKeysViewModel.obscurePassphrase) ?
|
||||||
|
"*****" :
|
||||||
|
widget.walletKeysViewModel.passphrase,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Theme.of(context).extension<CakeTextTheme>()!.buttonTextColor,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
Observer(builder: (BuildContext context) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
widget.walletKeysViewModel.obscurePassphrase = !widget.walletKeysViewModel.obscurePassphrase;
|
||||||
|
},
|
||||||
|
child: Icon(
|
||||||
|
widget.walletKeysViewModel.obscurePassphrase ? Icons.visibility_off : Icons.visibility,
|
||||||
|
size: 16,
|
||||||
|
color: Theme.of(context).textTheme.bodyLarge?.color?.withOpacity(0.7),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Widget _buildBottomActionPanel({
|
Widget _buildBottomActionPanel({
|
||||||
|
|
|
@ -78,8 +78,8 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store {
|
||||||
WalletType.ethereum,
|
WalletType.ethereum,
|
||||||
WalletType.polygon,
|
WalletType.polygon,
|
||||||
WalletType.tron,
|
WalletType.tron,
|
||||||
if (isRestore) WalletType.monero,
|
WalletType.monero,
|
||||||
if (isRestore) WalletType.wownero,
|
WalletType.wownero,
|
||||||
if (isRestore) WalletType.zano,
|
if (isRestore) WalletType.zano,
|
||||||
].contains(type);
|
].contains(type);
|
||||||
|
|
||||||
|
|
|
@ -86,9 +86,21 @@ abstract class WalletKeysViewModelBase with Store {
|
||||||
if (_wallet.type == WalletType.monero) {
|
if (_wallet.type == WalletType.monero) {
|
||||||
return monero!.getRestoreHeight(_wallet)?.toString() ?? '';
|
return monero!.getRestoreHeight(_wallet)?.toString() ?? '';
|
||||||
}
|
}
|
||||||
|
if (_wallet.type == WalletType.wownero) {
|
||||||
|
return wownero!.getRestoreHeight(_wallet)?.toString() ?? '';
|
||||||
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@observable
|
||||||
|
bool obscurePassphrase = true;
|
||||||
|
|
||||||
|
String get passphrase {
|
||||||
|
return _wallet.passphrase ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
/// The Regex split the words based on any whitespace character.
|
/// The Regex split the words based on any whitespace character.
|
||||||
///
|
///
|
||||||
/// Either standard ASCII space (U+0020) or the full-width space character (U+3000) used by the Japanese.
|
/// Either standard ASCII space (U+0020) or the full-width space character (U+3000) used by the Japanese.
|
||||||
|
@ -309,6 +321,12 @@ abstract class WalletKeysViewModelBase with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String?> get restoreHeight async {
|
Future<String?> get restoreHeight async {
|
||||||
|
if (_wallet.type == WalletType.monero) {
|
||||||
|
return monero!.getRestoreHeight(_wallet)?.toString();
|
||||||
|
}
|
||||||
|
if (_wallet.type == WalletType.wownero) {
|
||||||
|
return wownero!.getRestoreHeight(_wallet)?.toString();
|
||||||
|
}
|
||||||
if (_restoreHeightByTransactions != 0)
|
if (_restoreHeightByTransactions != 0)
|
||||||
return getRoundedRestoreHeight(_restoreHeightByTransactions);
|
return getRoundedRestoreHeight(_restoreHeightByTransactions);
|
||||||
if (_restoreHeight != 0) return _restoreHeight.toString();
|
if (_restoreHeight != 0) return _restoreHeight.toString();
|
||||||
|
|
|
@ -100,6 +100,7 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
|
||||||
name: name,
|
name: name,
|
||||||
language: options!.first as String,
|
language: options!.first as String,
|
||||||
password: walletPassword,
|
password: walletPassword,
|
||||||
|
passphrase: passphrase,
|
||||||
isPolyseed: options.last as bool);
|
isPolyseed: options.last as bool);
|
||||||
case WalletType.bitcoin:
|
case WalletType.bitcoin:
|
||||||
case WalletType.litecoin:
|
case WalletType.litecoin:
|
||||||
|
@ -168,6 +169,7 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
|
||||||
language: options!.first as String,
|
language: options!.first as String,
|
||||||
isPolyseed: options.last as bool,
|
isPolyseed: options.last as bool,
|
||||||
password: walletPassword,
|
password: walletPassword,
|
||||||
|
passphrase: passphrase,
|
||||||
);
|
);
|
||||||
case WalletType.zano:
|
case WalletType.zano:
|
||||||
return zano!.createZanoNewWalletCredentials(
|
return zano!.createZanoNewWalletCredentials(
|
||||||
|
|
|
@ -233,9 +233,10 @@ class CWWownero extends Wownero {
|
||||||
{required String name,
|
{required String name,
|
||||||
required String language,
|
required String language,
|
||||||
required bool isPolyseed,
|
required bool isPolyseed,
|
||||||
String? password}) =>
|
String? password,
|
||||||
|
String? passphrase}) =>
|
||||||
WowneroNewWalletCredentials(
|
WowneroNewWalletCredentials(
|
||||||
name: name, password: password, language: language, isPolyseed: isPolyseed);
|
name: name, password: password, language: language, isPolyseed: isPolyseed, passphrase: passphrase);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, String> getKeys(Object wallet) {
|
Map<String, String> getKeys(Object wallet) {
|
||||||
|
@ -250,6 +251,12 @@ class CWWownero extends Wownero {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int? getRestoreHeight(Object wallet) {
|
||||||
|
final wowneroWallet = wallet as WowneroWallet;
|
||||||
|
return wowneroWallet.restoreHeight;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Object createWowneroTransactionCreationCredentials(
|
Object createWowneroTransactionCreationCredentials(
|
||||||
{required List<Output> outputs, required TransactionPriority priority}) =>
|
{required List<Output> outputs, required TransactionPriority priority}) =>
|
||||||
|
|
|
@ -406,7 +406,7 @@ abstract class Monero {
|
||||||
required int height});
|
required int height});
|
||||||
WalletCredentials createMoneroRestoreWalletFromSeedCredentials({required String name, required String password, required String passphrase, required int height, required String mnemonic});
|
WalletCredentials createMoneroRestoreWalletFromSeedCredentials({required String name, required String password, required String passphrase, required int height, required String mnemonic});
|
||||||
WalletCredentials createMoneroRestoreWalletFromHardwareCredentials({required String name, required String password, required int height, required ledger.LedgerConnection ledgerConnection});
|
WalletCredentials createMoneroRestoreWalletFromHardwareCredentials({required String name, required String password, required int height, required ledger.LedgerConnection ledgerConnection});
|
||||||
WalletCredentials createMoneroNewWalletCredentials({required String name, required String language, required bool isPolyseed, String? password});
|
WalletCredentials createMoneroNewWalletCredentials({required String name, required String language, required bool isPolyseed, required String? passphrase, String? password});
|
||||||
Map<String, String> getKeys(Object wallet);
|
Map<String, String> getKeys(Object wallet);
|
||||||
int? getRestoreHeight(Object wallet);
|
int? getRestoreHeight(Object wallet);
|
||||||
Object createMoneroTransactionCreationCredentials({required List<Output> outputs, required TransactionPriority priority});
|
Object createMoneroTransactionCreationCredentials({required List<Output> outputs, required TransactionPriority priority});
|
||||||
|
@ -595,7 +595,8 @@ abstract class Wownero {
|
||||||
required String language,
|
required String language,
|
||||||
required int height});
|
required int height});
|
||||||
WalletCredentials createWowneroRestoreWalletFromSeedCredentials({required String name, required String password, required String passphrase, required int height, required String mnemonic});
|
WalletCredentials createWowneroRestoreWalletFromSeedCredentials({required String name, required String password, required String passphrase, required int height, required String mnemonic});
|
||||||
WalletCredentials createWowneroNewWalletCredentials({required String name, required String language, required bool isPolyseed, String? password});
|
WalletCredentials createWowneroNewWalletCredentials({required String name, required String language, required bool isPolyseed, String? password, String? passphrase});
|
||||||
|
int? getRestoreHeight(Object wallet);
|
||||||
Map<String, String> getKeys(Object wallet);
|
Map<String, String> getKeys(Object wallet);
|
||||||
Object createWowneroTransactionCreationCredentials({required List<Output> outputs, required TransactionPriority priority});
|
Object createWowneroTransactionCreationCredentials({required List<Output> outputs, required TransactionPriority priority});
|
||||||
Object createWowneroTransactionCreationCredentialsRaw({required List<OutputInfo> outputs, required TransactionPriority priority});
|
Object createWowneroTransactionCreationCredentialsRaw({required List<OutputInfo> outputs, required TransactionPriority priority});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue