Don't export / import pin codes when making / restoring backups ()

* initial commit

* remove print
This commit is contained in:
Matthew Fosse 2025-03-18 19:52:22 -07:00 committed by GitHub
parent cec414e44b
commit 2c68c57d10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 10 deletions
lib

View file

@ -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;

View file

@ -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;