Skip to content

Fall back to default values in the FreeOTP importer #1641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2025

Conversation

alexbakker
Copy link
Member

Fixes #1605

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request fixes issue #1605 by adding fallback default values for FreeOTP importer fields when they are missing in the input data.

  • Updated FreeOtpImporter to use optString and optInt to default missing "algo", "digits", and "period" values.
  • Added a new test (testImportFreeOtpV2NullAlgo) to verify that the importer correctly handles a null algorithm.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
app/src/test/java/com/beemdevelopment/aegis/importers/DatabaseImporterTest.java Added test case for null "algo" handling in encrypted FreeOTP v2 data
app/src/main/java/com/beemdevelopment/aegis/importers/FreeOtpImporter.java Changed JSON field extraction to provide default fallback values for missing fields
Comments suppressed due to low confidence (1)

app/src/main/java/com/beemdevelopment/aegis/importers/FreeOtpImporter.java:301

  • Consider adding additional test cases to verify that the default fallback values for 'digits' and 'period' fields are correctly applied when those fields are absent in the JSON input.
String algo = obj.optString("algo", OtpInfo.DEFAULT_ALGORITHM);

@michaelschattgen michaelschattgen merged commit 97762fa into beemdevelopment:master Apr 23, 2025
4 checks passed
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.

Import FreeOTP externalBackup.xml fails
2 participants