Migration from version 1.x to 2.x
New features and changes were introduced in version 2.0 that are compatible with version 1.x:
- Fingerprint generator configuration is now transferred in the deeplink. With this change, the project setup is easier
- ActivationSpawnManager was removed and replaced with 3 seperate classes - Transporter, Processor, and Activator.
- You no longer need to create the instance of the generator - it will be created based on your configuration.
Example change in the Source App
New code
val cfg = TransporterConfig.semiStable(false, 10)
val transporter = Transporter(appContext, cfg, byteArray(0x00, 0x11))
val activator = powerAuth.createActivationSpawnActivator(appContext, SSLValidationStrategy.default(), "https://your-domain.com/your-app")
activator.retrieveActivationData(
application,
auth,
object : IRetrieveActivationDataListener {
override fun onSuccess(data: ActivationSpawnData) {
try {
val tag = "User123" // tag that will be transported along with the activation data
val annotation = "MyDemoApp" // to tell the target app who opened it
// Send it to the Target App. This might prompt the user if he wants to
// open the application.
transporter.transportDataToApp(data, application, tag, annotation, sharedInfo)
} catch (t: Throwable) {
// process transport exception
}
}
override fun onError(error: ApiError) {
// show error to user
}
})
}
}
Old code
val generator = DeviceFingerprintGenerator.getSemiStable(appContext, false, 10, byteArray(0x00, 0x11))
val manager = powerAuth.createSpawnManager(appContext, SSLValidationStrategy.default(), generator, "https://your-domain.com/your-app")
manager.retrieveActivationData(
application,
auth,
object : IRetrieveActivationDataListener {
override fun onSuccess(data: ActivationSpawnData) {
try {
val tag = "User123" // tag that will be transported along with the activation data
val annotation = "MyDemoApp" // to tell the target app who opened it
// Send it to the Target App. This might prompt the user if he wants to
// open the application.
manager.transportDataToApp(data, application, tag, annotation, sharedInfo)
} catch (t: Throwable) {
// process transport exception
}
}
override fun onError(error: ApiError) {
// show error to user
}
})
}
}
Example change in the Target App
New code
val retrievedDeeplink: Uri
val cfg = TransporterConfig.semiStable(false, 10)
val processor = Processor(appContext, cfg, byteArray(0x00, 0x11))
val validation = processor.validateDeeplink(retrievedDeeplink)
val data = processor.processDeeplink(retrievedDeeplink, sharedInfo)
Old code
val retrievedDeeplink: Uri
val generator = DeviceFingerprintGenerator.getSemiStable(appContext, false, 10, byteArray(0x00, 0x11))
val manager = powerAuth.createSpawnManager(appContext, SSLValidationStrategy.default(), generator, "https://your-domain.com/your-app")
val validation = manager.validateDeeplink(retrievedDeeplink)
val transportData = manager.processDeeplink(retrievedDeeplink, sharedInfo)
Last updated on May 29, 2024 (11:19)
Edit on Github
Send Feedback