Skip to content

Commit

Permalink
Android: #620: Deprecate removeActivationLocal(Context, boolean) (1.7.x)
Browse files Browse the repository at this point in the history
  • Loading branch information
hvge committed Sep 20, 2024
1 parent 1b34407 commit 423ed0a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public Builder(@NonNull Context context, @NonNull PowerAuthTestConfig testConfig
if (sdk.hasValidActivation()) {
Logger.e("Shared PowerAuthSDK has a valid activation at test initialization.");
}
sdk.removeActivationLocal(context, true);
sdk.removeActivationLocal(context);
} else {
if (!sdk.hasValidActivation()) {
Logger.e("Shared PowerAuthSDK doesn't have a valid activation at test initialization.");
Expand Down Expand Up @@ -451,7 +451,7 @@ private PowerAuthTestHelper(
.keychainConfiguration(getSharedPowerAuthKeychainConfiguration())
.build(getContext());
if (resetActivation && sdk.hasValidActivation()) {
sdk.removeActivationLocal(getContext(), true);
sdk.removeActivationLocal(getContext());
}
return sdk;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,15 @@ public void removeActivation(boolean revokeRecoveryCodes) throws Exception {
invalidAuthentication = null;
createActivationResult = null;
}
removeActivationLocal(true);
removeActivationLocal();
}

/**
* Remove activation locally.
*
* @param removeSharedBiometryKey If true, then also remove a shared biometry key.
*/
public void removeActivationLocal(boolean removeSharedBiometryKey) {
public void removeActivationLocal() {
if (powerAuthSDK.hasValidActivation()) {
powerAuthSDK.removeActivationLocal(testHelper.getContext(), removeSharedBiometryKey);
powerAuthSDK.removeActivationLocal(testHelper.getContext());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public void onActivationCreateFailed(@NonNull Throwable t) {
public void testRemoveActivationLocal() throws Exception {
activationHelper.createStandardActivation(true, null);
// Remove activation
powerAuthSDK.removeActivationLocal(testHelper.getContext(), true);
powerAuthSDK.removeActivationLocal(testHelper.getContext());
// Back to Initial expectations
assertFalse(powerAuthSDK.hasValidActivation());
assertFalse(powerAuthSDK.hasPendingActivation());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1436,25 +1436,6 @@ public void onCancel() {
* @throws PowerAuthMissingConfigException thrown in case configuration is not present.
*/
public void removeActivationLocal(@NonNull Context context) {
removeActivationLocal(context, true);
}

/**
* Removes existing activation from the device.
* <p>
* This method removes the activation session state and optionally also shared biometry factor key. Cached possession related
* key remains intact. Unlike the `removeActivationWithAuthentication`, this method doesn't inform server about activation removal.
* In this case user has to remove the activation by using another channel (typically internet banking, or similar web management console)
* <p>
* <b>NOTE:</b>The removeSharedBiometryKey parameter is now ignored, because PowerAuthSDK no longer use the shared key for a newly created
* biometry factors.
*
* @param context Android context.
* @param removeSharedBiometryKey This parameter is ignored.
* @throws PowerAuthMissingConfigException thrown in case configuration is not present.
*/
public void removeActivationLocal(@NonNull Context context, boolean removeSharedBiometryKey) {

checkForValidSetup();

final BiometricDataMapper.Mapping biometricDataMapping = mBiometricDataMapper.getMapping(null, context, BiometricDataMapper.BIO_MAPPING_REMOVE_KEY);
Expand All @@ -1477,6 +1458,26 @@ public void removeActivationLocal(@NonNull Context context, boolean removeShared
clearCachedData();
}

/**
* Removes existing activation from the device.
* <p>
* This method removes the activation session state and optionally also shared biometry factor key. Cached possession related
* key remains intact. Unlike the `removeActivationWithAuthentication`, this method doesn't inform server about activation removal.
* In this case user has to remove the activation by using another channel (typically internet banking, or similar web management console)
* <p>
* <b>NOTE:</b>The removeSharedBiometryKey parameter is now ignored, because PowerAuthSDK no longer use the shared key for a newly created
* biometry factors.
*
* @param context Android context.
* @param removeSharedBiometryKey This parameter is ignored.
* @throws PowerAuthMissingConfigException thrown in case configuration is not present.
* @deprecated Use {@link #removeActivationLocal(Context)} as a replacement.
*/
@Deprecated // 1.7.10 - remove in 1.10.0
public void removeActivationLocal(@NonNull Context context, boolean removeSharedBiometryKey) {
removeActivationLocal(context);
}

/**
* Clear in-memory cached data.
*/
Expand Down

0 comments on commit 423ed0a

Please sign in to comment.