Cw 488 seed offset (#1631)

* CW-488 minor code cleanup

* Add Derivation Path selector for BTC and LTC

* CW-488 Initial Passphrase Impl

* CW-488 Final Passphrase Impl

* Quick Fix of language Service

* CW-488 Implement PR Suggestions

* CW-488 Implement PR Suggestions

* CW-488 Implement Passphrase for Bitcoin Cash

* CW-488 Implement Passphrase for Bitcoin Cash

* CW-488 Implement Passphrase for Bitcoin Cash

* remove monero and wownero support for passphrase until merged [skip ci]

* CW-488 Apply requested change

* CW-488 Add Passphrase to QR

* CW-488 Fix Seed generation

* CW-488 Implement Electrum Passphrases

* CW-488 Add Seed Length Selector to BIP39 Seeds

* CW-488 Minor fix [skip ci]

---------

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
Konstantin Ullrich
2024-08-26 20:06:54 +03:00
committed by GitHub
co-authored by Omar Hatem
parent 40f85d215b
commit ce21098e98
67 changed files with 741 additions and 438 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ class LanguageService {
'yo': 'nga',
'ha': 'hau',
'tl': 'phl',
'hy': 'arm'
'hy': 'arm',
};
static final list = <String, String>{};
+1
View File
@@ -77,6 +77,7 @@ class PreferencesKey {
static const exchangeProvidersSelection = 'exchange-providers-selection';
static const autoGenerateSubaddressStatusKey = 'auto_generate_subaddress_status';
static const moneroSeedType = 'monero_seed_type';
static const bitcoinSeedType = 'bitcoin_seed_type';
static const clearnetDonationLink = 'clearnet_donation_link';
static const onionDonationLink = 'onion_donation_link';
static const donationLinkWalletName = 'donation_link_wallet_name';
+36 -10
View File
@@ -1,18 +1,19 @@
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cw_core/enumerable_item.dart';
import 'package:cw_core/wallet_info.dart';
class SeedType extends EnumerableItem<int> with Serializable<int> {
const SeedType({required String title, required int raw}) : super(title: title, raw: raw);
class MoneroSeedType extends EnumerableItem<int> with Serializable<int> {
const MoneroSeedType({required String title, required int raw}) : super(title: title, raw: raw);
static const all = [SeedType.legacy, SeedType.polyseed];
static const all = [MoneroSeedType.legacy, MoneroSeedType.polyseed];
static const defaultSeedType = polyseed;
static const legacy = SeedType(raw: 0, title: 'Legacy (25 words)');
static const polyseed = SeedType(raw: 1, title: 'Polyseed (16 words)');
static const wowneroSeed = SeedType(raw: 2, title: 'Wownero (14 words)');
static const legacy = MoneroSeedType(raw: 0, title: 'Legacy (25 words)');
static const polyseed = MoneroSeedType(raw: 1, title: 'Polyseed (16 words)');
static const wowneroSeed = MoneroSeedType(raw: 2, title: 'Wownero (14 words)');
static SeedType deserialize({required int raw}) {
static MoneroSeedType deserialize({required int raw}) {
switch (raw) {
case 0:
return legacy;
@@ -28,14 +29,39 @@ class SeedType extends EnumerableItem<int> with Serializable<int> {
@override
String toString() {
switch (this) {
case SeedType.legacy:
case MoneroSeedType.legacy:
return S.current.seedtype_legacy;
case SeedType.polyseed:
case MoneroSeedType.polyseed:
return S.current.seedtype_polyseed;
case SeedType.wowneroSeed:
case MoneroSeedType.wowneroSeed:
return S.current.seedtype_wownero;
default:
return '';
}
}
}
class BitcoinSeedType extends EnumerableItem<int> with Serializable<int> {
const BitcoinSeedType(this.type, {required String title, required int raw})
: super(title: title, raw: raw);
final DerivationType type;
static const all = [BitcoinSeedType.electrum, BitcoinSeedType.bip39];
static const defaultDerivationType = bip39;
static const electrum = BitcoinSeedType(DerivationType.electrum, raw: 0, title: 'Electrum');
static const bip39 = BitcoinSeedType(DerivationType.bip39, raw: 1, title: 'BIP39');
static BitcoinSeedType deserialize({required int raw}) {
switch (raw) {
case 0:
return electrum;
case 1:
return bip39;
default:
throw Exception('Unexpected token: $raw for SeedType deserialize');
}
}
}