Skip to content

Recover from corrupted secure auth storage#1043

Open
Komzpa wants to merge 1 commit into
Zverik:mainfrom
Komzpa:fix/auth-corrupt-secure-storage
Open

Recover from corrupted secure auth storage#1043
Komzpa wants to merge 1 commit into
Zverik:mainfrom
Komzpa:fix/auth-corrupt-secure-storage

Conversation

@Komzpa

@Komzpa Komzpa commented May 28, 2026

Copy link
Copy Markdown

Summary

  • treat unreadable or non-JSON secure auth tokens as logged-out state and clear secure storage so OAuth can start fresh
  • add an Android native fallback that clears only Flutter secure-storage shared preferences when the plugin cannot initialize/delete them itself
  • exclude Flutter secure-storage data/key/config shared-pref files from legacy backup and Android 12+ cloud/device-transfer rules
  • add a regression test for the secure-storage recovery marker and malformed stored tokens

Fixes #951.
Fixes #1001.
Fixes #1030.

Evidence

On a migrated Samsung SM-F766B / Android 16 device running Every Door 7.1.0, launching the app logs:

SecureStorageAndroid: EncryptedSharedPreferences initialization failed
javax.crypto.AEADBadTagException
Caused by: android.security.KeyStoreException: Signature/MAC verification failed

That failure happens before normal OAuth token parsing can recover, so the PR now has a native shared-preferences cleanup fallback that does not clear the app database or unsent edits.

Testing

  • git diff --check HEAD~1..HEAD
  • xmllint --noout android/app/src/main/res/xml/backup_rules.xml android/app/src/main/res/xml/data_extraction_rules.xml android/app/src/main/AndroidManifest.xml
  • ADB logcat on the affected device confirms the secure-storage MAC verification failure above

Not run: flutter test / flutter analyze; this machine does not have Flutter or Dart installed.

@Komzpa Komzpa force-pushed the fix/auth-corrupt-secure-storage branch from 1925dde to 259fa43 Compare May 28, 2026 17:58
@IzzySoft IzzySoft mentioned this pull request Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't login with my Samsung Fold Can't login with Oauth Login does not work

1 participant