Migrating from Core API to FastTrack API

Note
  • Performing this migration updates your SDK version to include FastTrack API.
  • For existing customers of Core API who are migrating to FastTrack API, you can also migrate your tokens to access the APIs in FastTrack API.

Migrating existing tokens from Core API to FastTrack API

To migrate existing tokens generated from Core API to FastTrack API, perform the following steps:

  1. Check that the token has been created with Core API.
  2. Configure the parameters required by FastTrack API and its Protector OATH.
  3. Create the token setting. For example, in the HOTP use case, call the persistHotpSettings API.
  4. Retrieve the token device.
  5. Generate an OTP using FastTrack API.

The following sample code snippet shows how to perform the migration of existing tokens from Core API to FastTrack API:

??<please give a title>
// 1. Token is created already with Core API
 
// 2. Configure the FastTrack
new FastTrack.Builder(mContext)
        .withDeviceBinding(true)
        .withActivationCode(FULL_ACTIVATION_CODE)
        .build();
 
// 3. Init the Protector
OathMobileProtector protector = mFastTrack.getOathMobileProtectorBuilder(
        new URL(mOathEps.getProvisioningUrl()),
        mOathEps.getEpsDomain(),
        mProtocol,
        mOathEps.getRsaKeyId(),
        mOathEps.getRsaKeyExponent(),
        mOathEps.getRsaKeyModulus()
).build();
 
OathTokenDevice tokenDevice;
 
// 4. Retrieve the token
// NOTE: have to pass the proper fingerprint data same as provisioned
try {
    tokenDevice = protector.getTokenDevice(tokenName, fingerprintData);
} catch (FastTrackException ex) {
    if (ex.getCode() == FastTrackException.OTP_SETTINGS_NOT_FOUND) {
         
        // 4.1. Create the token setting and persist it
        HotpSettings hotpSettings = new HotpSettings();
        hotpSettings.setHotpHashAlgorithm(OathMobileProtector.HashAlgorithm.SHA1);
        hotpSettings.setHotpLength(8);
        protector.persistHotpSettings(tokenName, hotpSettings);
         
        // 4.2. Retrieve the token device
        tokenDevice = protector.getTokenDevice(tokenName, fingerprintData);
    }
}
 
// 5. Generate OTP with FastTrack API
String pin = "9444";
String otp = tokenDevice.getOtp(pin);

Migrating existing client ID from Core API to FastTrack API

To migrate existing client ID generated from Core API to FastTrack API, perform the following steps:

  1. Check that the client ID has been created with Core API.
  2. Configure the FastTrack API and its Mobile Messenger.
  3. Check that the client ID exists using new FastTrack API. OTherwise, call the persistClientID API.
// 1. ClientID is created already with Core API
 
// 2. Configure the FastTrack API and its Mobile Messenger
new FastTrack.Builder(mContext)
        .withDeviceBinding(true)
        .withActivationCode(FULL_ACTIVATION_CODE)
        .build();

MobileMessenger mobileMessenger = FastTrack.getInstance().getMobileMessengerBuilder(MessengerConfigurations.getMessengerServerUrl(),
                MessengerConfigurations.getDomain(),
                MessengerConfigurations.getApplicationId(),
                MessengerConfigurations.getPublicKey().getPublicExponent().toByteArray(),
                MessengerConfigurations.getPublicKey().getModulus().toByteArray())
                .build();

// 3. Check the client ID exists using new FastTrack API
if (mobileMessenger.listClients() == null) {
	// 4. Call the PersistClientID, Make sure there's no client ID exists for FastTrack API
	mobileMessenger.persistClientId(userId, clientId);  
}