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
|
@ -44,7 +44,7 @@ String getSeed() {
|
|||
if (cakepolyseed != "") {
|
||||
if (cakepassphrase != "") {
|
||||
try {
|
||||
final lang = PolyseedLang.getByPhrase(cakepassphrase);
|
||||
final lang = PolyseedLang.getByPhrase(cakepolyseed);
|
||||
final coin = PolyseedCoin.POLYSEED_WOWNERO;
|
||||
final ps = Polyseed.decode(cakepolyseed, lang, coin);
|
||||
final passphrase = getPassphrase();
|
||||
|
|
|
@ -66,6 +66,7 @@ void createWalletSync(
|
|||
{required String path,
|
||||
required String password,
|
||||
required String language,
|
||||
required String passphrase,
|
||||
int nettype = 0}) {
|
||||
txhistory = null;
|
||||
final newWptr = wownero.WalletManager_createWallet(wmPtr,
|
||||
|
@ -76,6 +77,8 @@ void createWalletSync(
|
|||
throw WalletCreationException(message: wownero.Wallet_errorString(newWptr));
|
||||
}
|
||||
wptr = newWptr;
|
||||
wownero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.passphrase", value: passphrase);
|
||||
|
||||
wownero.Wallet_store(wptr!, path: path);
|
||||
openedWalletsByPath[path] = wptr!;
|
||||
|
||||
|
@ -362,8 +365,9 @@ void _createWallet(Map<String, dynamic> args) {
|
|||
final path = args['path'] as String;
|
||||
final password = args['password'] 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) {
|
||||
|
@ -431,11 +435,13 @@ Future<void> createWallet(
|
|||
{required String path,
|
||||
required String password,
|
||||
required String language,
|
||||
required String passphrase,
|
||||
int nettype = 0}) async =>
|
||||
_createWallet({
|
||||
'path': path,
|
||||
'password': password,
|
||||
'language': language,
|
||||
'passphrase': passphrase,
|
||||
'nettype': nettype
|
||||
});
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import 'package:cw_core/wallet_base.dart';
|
|||
import 'package:cw_core/wallet_info.dart';
|
||||
import 'package:cw_core/wownero_amount_format.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/structs/pending_transaction.dart';
|
||||
import 'package:cw_wownero/api/transaction_history.dart' as transaction_history;
|
||||
|
@ -131,6 +132,10 @@ abstract class WowneroWalletBase
|
|||
publicViewKey: wownero_wallet.getPublicViewKey(),
|
||||
passphrase: wownero_wallet.getPassphrase());
|
||||
|
||||
int? get restoreHeight =>
|
||||
transactionHistory.transactions.values.firstOrNull?.height ?? wownero.Wallet_getRefreshFromBlockHeight(wptr!);
|
||||
|
||||
|
||||
wownero_wallet.SyncListener? _listener;
|
||||
ReactionDisposer? _onAccountChangeReaction;
|
||||
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_type.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/wallet_manager.dart' as wownero_wallet_manager;
|
||||
import 'package:cw_wownero/api/wallet_manager.dart';
|
||||
|
@ -21,11 +22,12 @@ import 'package:monero/wownero.dart' as wownero;
|
|||
|
||||
class WowneroNewWalletCredentials extends WalletCredentials {
|
||||
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);
|
||||
|
||||
final String language;
|
||||
final bool isPolyseed;
|
||||
final String? passphrase;
|
||||
}
|
||||
|
||||
class WowneroRestoreWalletFromSeedCredentials extends WalletCredentials {
|
||||
|
@ -95,7 +97,7 @@ class WowneroWalletService extends WalletService<
|
|||
}
|
||||
|
||||
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(
|
||||
walletInfo: credentials.walletInfo!, unspentCoinsInfo: unspentCoinsInfoSource, password: credentials.password!);
|
||||
await wallet.init();
|
||||
|
@ -345,6 +347,9 @@ class WowneroWalletService extends WalletService<
|
|||
restoreHeight: height,
|
||||
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);
|
||||
await wallet.init();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue