Change derivation %3 to %2; Harden derivation

This commit is contained in:
poka 2022-05-20 07:22:57 +02:00
parent d53facca05
commit 345a600599
3 changed files with 7 additions and 5 deletions

View File

@ -126,10 +126,10 @@ class MyWalletsProvider with ChangeNotifier {
List<WalletData> _walletConfig = readAllWallets(_chest); List<WalletData> _walletConfig = readAllWallets(_chest);
if (_walletConfig.isEmpty) { if (_walletConfig.isEmpty) {
_newDerivationNbr = 3; _newDerivationNbr = 2;
_newWalletNbr = 0; _newWalletNbr = 0;
} else { } else {
_newDerivationNbr = _walletConfig.last.derivation! + 3; _newDerivationNbr = _walletConfig.last.derivation! + 2;
_newWalletNbr = _walletConfig.last.number! + 1; _newWalletNbr = _walletConfig.last.number! + 1;
} }
@ -141,7 +141,8 @@ class MyWalletsProvider with ChangeNotifier {
final int? _currentChestNumber = myWalletProvider.getCurrentChest(); final int? _currentChestNumber = myWalletProvider.getCurrentChest();
final ChestData _currentChest = chestBox.get(_currentChestNumber)!; final ChestData _currentChest = chestBox.get(_currentChestNumber)!;
final address = await _sdk.derive(context, _currentChest.address!, _newDerivationNbr, pinCode); final address = await _sdk.derive(
context, _currentChest.address!, _newDerivationNbr, pinCode);
WalletData newWallet = WalletData( WalletData newWallet = WalletData(
chest: _chest, chest: _chest,

View File

@ -299,7 +299,7 @@ class SubstrateSdk with ChangeNotifier {
print(generatedMnemonic); print(generatedMnemonic);
print(sourceDerivation); print(sourceDerivation);
return await importAccount(fromMnemonic: true, derivePath: '/$number'); return await importAccount(fromMnemonic: true, derivePath: '//$number');
} }
} }

View File

@ -124,7 +124,8 @@ class SettingsScreen extends StatelessWidget {
), ),
onPressed: () async => { onPressed: () async => {
log.i('Suppression de tous les wallets'), log.i('Suppression de tous les wallets'),
await _myWallets.deleteAllWallet(context) await _myWallets.deleteAllWallet(context),
await _sub.deleteAllAccounts()
}, },
child: const Text("EFFACER TOUS MES PORTEFEUILLES", child: const Text("EFFACER TOUS MES PORTEFEUILLES",
style: TextStyle(fontSize: 20)))))), style: TextStyle(fontSize: 20)))))),