API key rotation
API key that are used for SDK initialization may be rotated for security reasons. Please use the Incode dashboard to revoke keys and generate new ones.
Once an API key is revoked from the dashboard, all currently ongoing onboarding sessions that were using that API key will be aborted and onError(_ error: IncdFlowError)
method on the IncdOnboardingDelegate
will get called.
This is the place where you should handle the replacement of the API key.
func onError(_ error: IncdFlowError) {
if error == .apiKeyRevoked(let apiKey) { // asociated value is the revoked api key
//Your logic for the rotation of the key
}
}
When a new API key has been obtained, the SDK should be reinitialized using initIncdOnboarding(url:apiKey:token:loggingEnabled:testMode:_:)
method of the IncdOnboardingManager
:
IncdOnboardingManager.shared.initIncdOnboarding(url: url, apiKey: newApiKey) { (success, _) in
// SDK has been reinitialized successfully
}
Once the SDK has been reinitialized successfully, old session can be restarted or you can start a completely new onboarding session.