PIN authentication

Use a PIN to perform specific operations when biometric authentication is not necessary

For authentication scenarios that don't necessitate biometric recognition, you can use PIN as an alternative.

Keyless requires at least one of the following authentication factor to be present for each user:

  • biometric factor

  • PIN factor

PIN factor can be any valid String. Numbers are not enforced but are recommended, given the familiarity of numeric PINs for end users.

Enrollment with PIN

To enroll using the PIN factor create the following configuration:

val configuration = PinEnrollConfig(pin = "1234")

Keyless.enroll(
  configuration = configuration,
  onCompletion = { /*TODO: process result*/  }
)

To enroll multiple authentication factors you need call Keyless.enroll for each factor.

Authentication with PIN

To authenticate using the PIN factor create the following configuration:

val configuration = PinAuthConfig(pin = "1234")

Keyless.authenticate(
  configuration = configuration,
  onCompletion = { /*TODO: process result*/  }
)

De-enrollment with PIN

To de-enroll using the PIN authentication factor, create the following configuration:

val configuration = PinDeEnrollConfig(pin = "1234")

Keyless.deEnroll(
  configuration = configuration,
  onCompletion = { /*TODO: process result*/  }
)

Remove PIN (keeping biometric factor)

To remove the PIN factor, while still keeping the biometric factor, perform a biometric authentication using the following configuration:

val configuration = BiomAuthConfig(shouldRemovePin = true)

Keyless.authenticate(
  configuration = configuration,
  onCompletion = { /*TODO: process result*/  }
)

PIN utilities

To change the PIN use the newPin parameter in the PinAuthConfig:

val configuration = PinAuthConfig(pin = "1234", newPin = "5678")

Keyless.authenticate(
  configuration = configuration,
  onCompletion = { /*TODO: process result*/  }
)

To remove the PIN factor and keep the user enrolled with the biometric factor use the shouldRemovePin parameter in PinAuthConfig:

val configuration = PinAuthConfig(pin = "1234", shouldRemovePin = true)

Keyless.authenticate(
  configuration = configuration,
  onCompletion = { /*TODO: process result*/  }
)

Last updated

Was this helpful?