Other operations
Before being able to execute any of the operations described, configure and initialize the SDK to obtain a MobileAuthenticationClient
java, swift, flutter.
Change PIN
Using the change PIN operation, you can modify the PIN of a registered PIN authenticator for a given user.
To change the PIN of a registered authenticator, provide the name of the user whose PIN is to be changed and a PinChanger
java, swift, flutter.
- Android/Kotlin
- Android/Java
- iOS/Swift
- Flutter/Dart
The PinChanger
is in charge of providing the old and new PINs to the SDK.
The PinChanger
can also define which is the PIN policy to be used for the new PIN, see PinChanger.pinPolicy
java, swift, flutter.
Change PIN
The PinChanger
is called by the SDK to obtain the value of the PIN to be registered.
- The application builds a
PinChange
operation and invokesPinChange.execute
java, swift, flutter - The SDK calls the
PinChanger.changePin
java, swift, flutter method. - The application asks the user to provide the old and the new PIN. For example, the application displays a textbox where the user provides the old PIN and another textbox to define the new one.
- The user provides the PINs.
- The application provides the PINs invoking the
PinChangeHandler.pins
java, swift, flutter method. - The SDK validates that the old PIN is valid, and that thew new PIN is compliant with the
PinPolicy
java, swift, flutter. - If the provided new PIN is not compliant with the PIN policy, the SDK invokes
PinChanger.changePin
again and thePinChangeContext
java, swift, flutter contains a recoverable error. The same occurs if the provided old PIN is not valid, but the PIN authenticator is not locked yet. - If the provided old PIN is not valid, and too many failed attempts occurred, then the operation fails and the object managing the error provided in the
onError
method when building the operation is invoked. For more information on PIN lockout, see Brute force attack prevention. - If the provided PINs are valid, and the modification is successful, the object provided in the
onSuccess
method when building the registration operation is invoked.
Decode out-of-band payload
Out-of-band operations occur when a message is delivered to the application through an alternate channel like a push notification, a QR code, or a deep link. The application is responsible to create an OutOfBandPayload
java, swift, flutter object from the data contained in such a message.
The OutOfBandPayload
is then used to start an OutOfBandOperation
java, swift, flutter, see chapters Out-of-Band Registration and Out-of-Band Authentication.
Out-of-band payload from QR code
An example to get an OutOfBandPayload
after scanning a Nevis mobile authentication registration QR code looks something like this:
- Android/Kotlin
- Android/Java
- iOS/Swift
- Flutter/Dart
Out-of-band payload from push notification
In case of push notifications, the OutOfBandPayload
is provided in a platform-specific object:
- Android:
com.google.firebase.messaging.RemoteMessage
- iOS:
UNNotificationResponse
The code uses a com.google.gson.Gson
object to generate JSON for Android.
- Android/Kotlin
- Android/Java
- iOS/Swift
- Flutter/Dart
Change device information
During registration, DeviceInformation
java, swift, flutter can be provided. The DeviceInformation
contains the name identifying your device, and also the Firebase Cloud Messaging registration token Android, iOS, Flutter used by the backend to send authentication push notifications to your application.
You can update both the name and the Firebase Cloud Messaging token using DeviceInformationChange
java, swift, flutter.
- Android/Kotlin
- Android/Java
- iOS/Swift
- Flutter/Dart
Handle changes in the Firebase registration token
If the Firebase token changes, the application has to inform the server about that change, otherwise future dispatching does not work.
In case of Android, changes in the Firebase registration token update are identified inside the implementation of the com.google.firebase.messaging.FirebaseMessagingService
class of your application. iOS identifies the changes using Firebase.MessagingDelegate
. Flutter identifies the changes by subscribing to the FirebaseMessaging.instance.onTokenRefresh
stream.
- Android/Kotlin
- Android/Java
- iOS/Swift
- Flutter/Dart
Disable push notifications
If you want the backend to stop sending push notifications, you can use the DeviceInformationChange.disablePushNotifications
java, swift, flutter method:
- Android/Kotlin
- Android/Java
- iOS/Swift
- Flutter/Dart
Get information
You can use the LocalData
java, swift, flutter object to obtain the following information:
LocalData.accounts
java, swift, flutter to get the registered accounts.LocalData.deviceInformation
java, swift, flutter to get the device information.LocalData.authenticators
java, swift, flutter to get the authenticator information.
To obtain a LocalData
object, invoke the MobileAuthenticationClient.localData
java, swift, flutter method.
Remove local data
You may need to delete the authenticator data stored by the SDK, for example, after a potential attack. Deregistration may not possible because deregistration is usually a protected operation that needs user intervention to obtain authorization.
To delete authenticator data locally, you can use the LocalData.deleteAuthenticator
java, swift, flutter method.