Move method to be in expected call order
This commit is contained in:
parent
1780d24955
commit
44ca3c02c5
1 changed files with 16 additions and 16 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue