authenticateWithNotificationPayload method

Future<void> authenticateWithNotificationPayload(
  1. Map<String, String> payload,
  2. String pin
)

Authenticates a user in the MIRACL Trust platform via push notification.

Use this method to authenticate another application using a push notification sent by the MIRACL Trust platform.

Parameters:

  • payload: key-value data provided by the notification.
  • pin: The user's PIN.

Throws AuthenticationException if the authentication process fails for any reason (e.g., incorrect PIN, invalid push notification payload, expired session).

Implementation

Future<void> authenticateWithNotificationPayload(Map<String, String> payload, String pin) async {
  try {
    await _sdk.authenticateWithNotificationPayload(payload, pin);
  } on PlatformException catch(e) {
    final exceptionCode = e._getExceptionCode();
    if (exceptionCode is MAuthenticationExceptionCode) {
      throw AuthenticationException._create(
        exceptionCode.toAuthenticationExceptionCode(),
        e.details["error"]
      );
    } else {
      rethrow;
    }
  }
}