Move method to be in expected call order

This commit is contained in:
Joshua Soberg 2021-01-29 18:23:43 -05:00
parent 1780d24955
commit 44ca3c02c5

View file

@ -49,22 +49,6 @@ public class AuthenticationTask extends AsyncTask<Void, Void, Result> {
}
}
@NonNull
private Result confirmAuthentication() {
try {
PBKDF2Credentials credentials = EncryptionHelper.generatePBKDF2Credentials(plainPassword, settings.getSalt(), settings.getIterations());
byte[] passwordArray = Base64.decode(existingAuthCredentials, Base64.URL_SAFE);
if (Arrays.equals(passwordArray, credentials.password)) {
return Result.success(credentials.key);
}
return Result.failure();
} catch (NoSuchAlgorithmException | InvalidKeySpecException | IllegalArgumentException e) {
Log.e("DecodePasswordTask", "Problem decoding password", e);
return Result.failure();
}
}
@NonNull
private Result upgradeAuthentication() {
String hashedPassword = new String(Hex.encodeHex(DigestUtils.sha256(plainPassword)));
@ -85,6 +69,22 @@ public class AuthenticationTask extends AsyncTask<Void, Void, Result> {
return Result.success(key);
}
@NonNull
private Result confirmAuthentication() {
try {
PBKDF2Credentials credentials = EncryptionHelper.generatePBKDF2Credentials(plainPassword, settings.getSalt(), settings.getIterations());
byte[] passwordArray = Base64.decode(existingAuthCredentials, Base64.URL_SAFE);
if (Arrays.equals(passwordArray, credentials.password)) {
return Result.success(credentials.key);
}
return Result.failure();
} catch (NoSuchAlgorithmException | InvalidKeySpecException | IllegalArgumentException e) {
Log.e("DecodePasswordTask", "Problem decoding password", e);
return Result.failure();
}
}
@Override
protected void onPostExecute(Result result) {
callback.onComplete(result);