mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 20:39:51 +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
|
@ -449,8 +449,6 @@ class BackupService {
|
||||||
final keychainJSON =
|
final keychainJSON =
|
||||||
json.decode(utf8.decode(decryptedKeychainDumpFileData)) as Map<String, dynamic>;
|
json.decode(utf8.decode(decryptedKeychainDumpFileData)) as Map<String, dynamic>;
|
||||||
final keychainWalletsInfo = keychainJSON['wallets'] as List;
|
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 backupPasswordKey = generateStoreKeyFor(key: SecretStoreKey.backupPassword);
|
||||||
final backupPassword = keychainJSON[backupPasswordKey] as String;
|
final backupPassword = keychainJSON[backupPasswordKey] as String;
|
||||||
|
|
||||||
|
@ -461,8 +459,6 @@ class BackupService {
|
||||||
await importWalletKeychainInfo(info);
|
await importWalletKeychainInfo(info);
|
||||||
});
|
});
|
||||||
|
|
||||||
await _secureStorage.write(key: pinCodeKey, value: encodedPinCode(pin: decodedPin));
|
|
||||||
|
|
||||||
keychainDumpFile.deleteSync();
|
keychainDumpFile.deleteSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,8 +477,6 @@ class BackupService {
|
||||||
Future<Uint8List> _exportKeychainDumpV2(String password,
|
Future<Uint8List> _exportKeychainDumpV2(String password,
|
||||||
{String keychainSalt = secrets.backupKeychainSalt}) async {
|
{String keychainSalt = secrets.backupKeychainSalt}) async {
|
||||||
final key = generateStoreKeyFor(key: SecretStoreKey.pinCodePassword);
|
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 {
|
final wallets = await Future.wait(_walletInfoSource.values.map((walletInfo) async {
|
||||||
return {
|
return {
|
||||||
'name': walletInfo.name,
|
'name': walletInfo.name,
|
||||||
|
@ -493,7 +487,7 @@ class BackupService {
|
||||||
final backupPasswordKey = generateStoreKeyFor(key: SecretStoreKey.backupPassword);
|
final backupPasswordKey = generateStoreKeyFor(key: SecretStoreKey.backupPassword);
|
||||||
final backupPassword = await _secureStorage.read(key: backupPasswordKey);
|
final backupPassword = await _secureStorage.read(key: backupPasswordKey);
|
||||||
final data = utf8.encode(
|
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');
|
final encrypted = await _encryptV2(Uint8List.fromList(data), '$keychainSalt$password');
|
||||||
|
|
||||||
return encrypted;
|
return encrypted;
|
||||||
|
|
|
@ -119,11 +119,11 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
||||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||||
);
|
);
|
||||||
|
|
||||||
return RawKeyboardListener(
|
return KeyboardListener(
|
||||||
focusNode: FocusNode(),
|
focusNode: FocusNode(),
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
onKey: (keyEvent) {
|
onKeyEvent: (keyEvent) {
|
||||||
if (keyEvent is RawKeyDownEvent) {
|
if (keyEvent is KeyDownEvent) {
|
||||||
if (keyEvent.logicalKey.keyLabel == "Backspace") {
|
if (keyEvent.logicalKey.keyLabel == "Backspace") {
|
||||||
_pop();
|
_pop();
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue