Class: LocalAuthPropertiesBuilder

LocalAuthPropertiesBuilder(id, pinChallengeCallback)

This is the builder for Local auth. This can be used for for device level authentication. Using this builder to init an authentication flow will return LocalAuthenticationFlow in the init promise. Multiple types of local authentications are supported.

For biometric based local auth, biometric is collected by the device using native UI. This UI is provided by each device OS. Device OS allows certain customizations to this UI, such as labels and titles. App can optionally set localized strings for biometric prompt using LocalAuthPropertiesBuilder#translations method. If these strings are not provided, default, english strings will be shown to the user. In addition, app can control the look and feel of the biometric dialog by providing appropriate theme for the MainActivity in AndroidManifest.xml.

For PIN based local authentication, the UI for collecting PIN from the user should be provided by the app. App provides this through LocalAuthPropertiesBuilder#pinChallengeCallback. The callback implementation details are explained in pin challenge callback documentation.

Constructor

new LocalAuthPropertiesBuilder(id, pinChallengeCallback)

Parameters:
Name Type Description
id String

Unique id for the local authentication flow.

pinChallengeCallback LocalAuthPropertiesBuilder~localAuthPinChallengeCallback

Callback for handling PIN challenges.

Source:

Extends

Members

(static, readonly) LocalAuthenticatorType

Enum values for types of local authenticators supported. Used in LocalAuthenticationFlow and LocalAuthenticationFlowManager

Properties:
Name Type Description
PIN string

Local authentication type is PIN.

Fingerprint string

Local authentication type is Fingerprint.

Biometric string

Local authentication type can be any Biometric. Currently supports: FaceID OR TouchID in iOS Fingerprint in Android

Source:

(static, readonly) PinChallengeReason

Enum values for challenge reason in pin challenge callback.

Properties:
Name Type Description
Login string

Reason for pin challenge is to login. In this case current pin has to be collected from the user and passed to completion callback

SetPin string

Reason for pin challenge is to set a new pin. In this case a new pin has to be collected from the user and passed to completion callback

ChangePin string

Reason for pin challenge is to change existing pin. In this case both current and new pin has to be collected from the user and passed to completion callback

Source:

Methods

build() → {Object}

Overrides:
Source:
Returns:

validate and return properties collected.

Type
Object

id(id) → {LocalAuthPropertiesBuilder}

Parameters:
Name Type Description
id string

Unique id for the local authentication flow.

Source:
Returns:
Type
LocalAuthPropertiesBuilder

maxLoginAttemptsForPIN(attempts) → {LocalAuthPropertiesBuilder}

This property comes into play whenever user is challenged to login using PIN. Typically this happens with LocalAuthenticationFlow#login is invoked. This also happens when LocalAuthenticationFlowManager#disable or LocalAuthenticationFlowManager#changePin is called, because as a first step for those actions, user has to login using PIN. When this property is set to a number greater than 1, user has those many attempts to login, if a wrong PIN was provided. Once max attempts are reached, the respective action's promise will be rejected.

Parameters:
Name Type Description
attempts number

maximum login attempts, should be greater than zero. Defaults to 1.

Source:
Returns:
Type
LocalAuthPropertiesBuilder

pinChallengeCallback(pinCallback) → {LocalAuthPropertiesBuilder}

Parameters:
Name Type Description
pinCallback LocalAuthPropertiesBuilder~localAuthPinChallengeCallback

Callback for handling PIN challenges.

Source:
Returns:
Type
LocalAuthPropertiesBuilder

put(key, value) → {Builder}

Convenience method to add key value pairs of auth settings to properties.

Parameters:
Name Type Description
key string

Authentication property key

value string

Authentication property value

Inherited From:
Source:
Returns:
Type
Builder

translations(translations, override) → {LocalAuthPropertiesBuilder}

Parameters:
Name Type Description
translations LocalAuthPropertiesBuilder~Translations
override boolean

Whether to override the existing translations or not. Defaults to true.

Source:
Returns:
Type
LocalAuthPropertiesBuilder

Type Definitions

localAuthCompletionCallback(currentPinopt, newPinopt)

Local authentication completion callback. Used to complete a PIN challenge by submitting the PIN collected from the user.

Parameters:
Name Type Attributes Description
currentPin number <optional>

Existing PIN collected from user. To be passed when LocalAuthPropertiesBuilder.PinChallengeReason.Login is requested. Since changePin now does a login upfront, there is no need to pass this parameter for LocalAuthPropertiesBuilder.PinChallengeReason.ChangePin requests.

newPin number <optional>

New PIN to be set, collected from user. To be passed when LocalAuthPropertiesBuilder.PinChallengeReason.SetPin or LocalAuthPropertiesBuilder.PinChallengeReason.ChangePin is requested.

Source:

localAuthPinChallengeCallback(challengeReason, challengeHandler, erroropt, optionsopt)

Local authentication PIN challenge callback This callback is invoked when there is a requirement to collect PIN from the user. App should show a UI for collecting PIN from the user. Depending on the challenge reason passed to this callback, app should collect existing PIN and / or new PIN from the user. App should then use the completion callback to submit the PIN. If user wishes to cancel the login attempt, app should invoke cancel callback. Both callbacks are provided as part of challenge handler passed to this callback.

Parameters:
Name Type Attributes Description
challengeReason LocalAuthPropertiesBuilder.PinChallengeReason
challengeHandler LocalAuthPropertiesBuilder~LocalAuthPinChallengeHandler

To be used by the app to either submit or cancel the current challenge.

error Error <optional>

Error (if any) with the previous attempt to login using PIN and maxLoginAttemptsForPIN has not reached.

options LocalAuthPropertiesBuilder~PinChallengeOptions <optional>

Object containing additional information (if any) passed to the PIN challenge callback.

Source:

LocalAuthPinChallengeHandler

Local authentication challenge handler

Type:
  • Object
Properties:
Name Type Description
submit LocalAuthPropertiesBuilder~localAuthCompletionCallback

App invokes this passing pin collector to proceed with the current challenge.

cancel RemoteAuthPropertiesBuilder~challengeCancelCallback

App invokes this to cancel the current challenge.

Source:

PinChallengeOptions

Type:
  • Object
Properties:
Name Type Description
loginAttemptCount number

Current login attempt. When maxLoginAttemptsForPIN is set, this will track the current retry attempt.

Source:

Translations

Localized strings for biometric authentication dialog prompt.

Type:
  • Object
Properties:
Name Type Attributes Description
promptMessage String <optional>

Text to be shown to the user on the dialog.

pinFallbackButtonLabel String <optional>

Label for the PIN fallback button in the dialog.

cancelButtonLabel String <optional>

Label for the cancel button in the dialog.

successMessage String <optional>

Text to be shown when biometric authentication is successful. Applicable to Android only.

errorMessage String <optional>

Text to be shown when biometric authentication is unsuccessful. Applicable to Android only.

promptTitle String <optional>

Title for the dialog. Applicable to Android only.

hintText String <optional>

Hint text to be shown to the user. Applicable to Android only.

Source: