mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-04-11 04:11:53 +00:00
Don't export / import pin codes when making / restoring backups (#2089)
* initial commit * remove print
This commit is contained in:
parent
cec414e44b
commit
2c68c57d10
2 changed files with 4 additions and 10 deletions
lib
|
@ -449,8 +449,6 @@ class BackupService {
|
|||
final keychainJSON =
|
||||
json.decode(utf8.decode(decryptedKeychainDumpFileData)) as Map<String, dynamic>;
|
||||
final keychainWalletsInfo = keychainJSON['wallets'] as List;
|
||||
final decodedPin = keychainJSON['pin'] as String;
|
||||
final pinCodeKey = generateStoreKeyFor(key: SecretStoreKey.pinCodePassword);
|
||||
final backupPasswordKey = generateStoreKeyFor(key: SecretStoreKey.backupPassword);
|
||||
final backupPassword = keychainJSON[backupPasswordKey] as String;
|
||||
|
||||
|
@ -461,8 +459,6 @@ class BackupService {
|
|||
await importWalletKeychainInfo(info);
|
||||
});
|
||||
|
||||
await _secureStorage.write(key: pinCodeKey, value: encodedPinCode(pin: decodedPin));
|
||||
|
||||
keychainDumpFile.deleteSync();
|
||||
}
|
||||
|
||||
|
@ -481,8 +477,6 @@ class BackupService {
|
|||
Future<Uint8List> _exportKeychainDumpV2(String password,
|
||||
{String keychainSalt = secrets.backupKeychainSalt}) async {
|
||||
final key = generateStoreKeyFor(key: SecretStoreKey.pinCodePassword);
|
||||
final encodedPin = await _secureStorage.read(key: key);
|
||||
final decodedPin = decodedPinCode(pin: encodedPin!);
|
||||
final wallets = await Future.wait(_walletInfoSource.values.map((walletInfo) async {
|
||||
return {
|
||||
'name': walletInfo.name,
|
||||
|
@ -493,7 +487,7 @@ class BackupService {
|
|||
final backupPasswordKey = generateStoreKeyFor(key: SecretStoreKey.backupPassword);
|
||||
final backupPassword = await _secureStorage.read(key: backupPasswordKey);
|
||||
final data = utf8.encode(
|
||||
json.encode({'pin': decodedPin, 'wallets': wallets, backupPasswordKey: backupPassword}));
|
||||
json.encode({'wallets': wallets, backupPasswordKey: backupPassword}));
|
||||
final encrypted = await _encryptV2(Uint8List.fromList(data), '$keychainSalt$password');
|
||||
|
||||
return encrypted;
|
||||
|
|
|
@ -119,11 +119,11 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
|||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
);
|
||||
|
||||
return RawKeyboardListener(
|
||||
return KeyboardListener(
|
||||
focusNode: FocusNode(),
|
||||
autofocus: true,
|
||||
onKey: (keyEvent) {
|
||||
if (keyEvent is RawKeyDownEvent) {
|
||||
onKeyEvent: (keyEvent) {
|
||||
if (keyEvent is KeyDownEvent) {
|
||||
if (keyEvent.logicalKey.keyLabel == "Backspace") {
|
||||
_pop();
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue