Skip to content

Commit

Permalink
WIP: Remove setUserAuthenticationRequired
Browse files Browse the repository at this point in the history
Causing issues where you need to authenticate EVERY time. Only way we would get around this is by adding properties to both the get/set functions because both of them can potentially generate a new key.
  • Loading branch information
brian-weasner committed Dec 5, 2022
1 parent ca69b73 commit b41991e
Showing 1 changed file with 0 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,18 +297,6 @@ private Key generateKey(String KEY_ALIAS) throws GeneralSecurityException, IOExc
paramBuilder.setIsStrongBoxBacked(true);
}

KeyguardManager keyguardManager = (KeyguardManager) getActivity().getSystemService(Context.KEYGUARD_SERVICE);
if (keyguardManager.isDeviceSecure()) {
// Key can only be generated with Authentication Required if device has a secure lock screen setup.
paramBuilder.setUserAuthenticationRequired(true);

// NOTE: `verifyIdentity` must be called before `generateKey` is called or `setInvalidatedByBiometricEnrollment` will use the defaulted value.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// This applies only to keys which require user authentication, hence why we only set this after we setUserAuthenticationRequired(true)
paramBuilder.setInvalidatedByBiometricEnrollment(true);
}
}

generator.init(paramBuilder.build());
return generator.generateKey();
} else {
Expand Down

0 comments on commit b41991e

Please sign in to comment.