public class OtpModule extends Object
Modifier and Type | Method and Description |
---|---|
static OtpModule |
create()
Create OtpModule object.
|
boolean |
isMigrationNeededForAndroidQ(String tokenName)
Check if the migration is needed for Android Q with the given token name.
|
void |
migrateForAndroidQ(String tokenName,
byte[] customData)
Migrate the old token to be compatible with Android Q.
|
boolean |
reset()
Cleanup the data associated with OTP module.
|
void |
updateDeviceFingerprintTokenPolicy(String tokenName,
byte[] oldCustomFingerprintData,
DeviceFingerprintTokenPolicy newTokenFingerprintPolicy)
To apply the new device fingerprint policy to the token.
|
public static OtpModule create()
public boolean isMigrationNeededForAndroidQ(String tokenName) throws IdpException
migrateForAndroidQ(String, byte[])
.
NOTE: This API should be called during the application startup to make sure that the permission popup, if any, will not interfere with other business flow.
For more information on Android Q privacy changes, refer to https://developer.android.com/preview/privacy/data-identifiers#device-ids
tokenName
- The token name.IdpStorageException
- When database operation failed.PasswordManagerException
- When the TOKEN domain is not logged in using the password manager.IdpException
migrateForAndroidQ(String, byte[])
public void migrateForAndroidQ(String tokenName, byte[] customData) throws IdpException
For more information on Android Q privacy changes, refer to https://developer.android.com/preview/privacy/data-identifiers#device-ids
tokenName
- The name of the token to be migrated.customData
- The custom data.IdpStorageException
- When database operation failed.PasswordManagerException
- When the TOKEN domain is not logged in using the password manager.DeviceFingerprintException
- When the fingerprint data does not match.IdpException
isMigrationNeededForAndroidQ(String)
public boolean reset() throws IdpException
IdpException
- when database operation failed.IdpCore.reset()
public void updateDeviceFingerprintTokenPolicy(@NonNull String tokenName, @Nullable byte[] oldCustomFingerprintData, @NonNull DeviceFingerprintTokenPolicy newTokenFingerprintPolicy) throws IdpException
failIfInvalid
(refer to DeviceFingerprintTokenPolicy.DeviceFingerprintTokenPolicy(boolean, DeviceFingerprintSource)
)DeviceFingerprintSource.DeviceFingerprintSource(byte[], DeviceFingerprintSource.Type...)
).
NOTE: The application manages the custom fingerprint data value so that it uses the proper value while retrieving the token, for example, by calling
CapTokenManager.getToken(String, byte[])
DeviceFingerprintSource.Type
)NOTE: The application has to retrieve the token object again to update the changes, for example, by calling CapTokenManager.getToken(String)
or CapTokenManager.getToken(String, byte[])
tokenName
- The token name.oldCustomFingerprintData
- The old custom fingerprint data (if any).newTokenFingerprintPolicy
- The new token device fingerprint policy.IdpException
- If the update fails. The possible errors are as follows:
IdpStorageException
: Failed to retrieve the token information from internal database.PasswordManagerException
: The user has not logged in to PasswordManager.DeviceFingerprintException
: The provided oldCustomFingerprintData
does not match with the one in token.
Especially, the code IdpResultCode.FINGERPRINT_UPDATE_FAILED_IDENTICAL_POLICY
will be thrown if the old and new policy are identical.
IdpException
: A generic error. Check the code or message for more details.CapTokenManager.getToken(String)
,
CapTokenManager.getToken(String, byte[])
,
OathTokenManager.getToken(String)
,
OathTokenManager.getToken(String, byte[])
,
VicTokenManager.getToken(String)
,
VicTokenManager.getToken(String, byte[])