Skip to content

Commit

Permalink
fix(EWM-282): add account bugs (#521)
Browse files Browse the repository at this point in the history
* fix(EWM-282): get seed by any public key

* fix(EWM-282): use master key to get password

---------

Co-authored-by: Egor Komarov <egor.komarov@bf.rocks>
  • Loading branch information
Odrin and Egor Komarov authored Sep 20, 2024
1 parent 07bba78 commit 8fb79f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ class AddAccountConfirmModel extends ElementaryModel {
final NekotonRepository _nekotonRepository;

Future<List<BiometricType>> getAvailableBiometry(PublicKey publicKey) async {
final seed = _nekotonRepository.seedList.findSeedByAnyPublicKey(publicKey);
if (seed == null) return [];

final isBiometryEnabled = _biometryService.enabled;
final hasKeyPassword = await _biometryService.hasKeyPassword(publicKey);
final hasKeyPassword =
await _biometryService.hasKeyPassword(seed.publicKey);

if (isBiometryEnabled && hasKeyPassword) {
return _biometryService.getAvailableBiometry();
Expand All @@ -29,9 +33,12 @@ class AddAccountConfirmModel extends ElementaryModel {
}

Future<String?> requestBiometry(PublicKey publicKey) async {
final seed = _nekotonRepository.seedList.findSeedByAnyPublicKey(publicKey);
if (seed == null) return null;

try {
final password = await _biometryService.getKeyPassword(
publicKey: publicKey,
publicKey: seed.publicKey,
localizedReason: LocaleKeys.biometryAuthReason.tr(),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class AddAccountTypeModel extends ElementaryModel {
required PublicKey publicKey,
required String password,
}) async {
final seed = _nekotonRepository.seedList.findSeed(publicKey)!;
final seed = _nekotonRepository.seedList.findSeedByAnyPublicKey(publicKey)!;

if (!seed.masterKey.createdAccountTypes.contains(walletType)) {
return seed.masterKey;
Expand Down

0 comments on commit 8fb79f9

Please sign in to comment.