Documentation Hub
Mobile SDK
Mobile SDK
  • Keyless SDK Documentation
  • Introduction
    • 🧩Components
    • ⚙️Integration Flows
    • 🤳Sample Apps
  • 📱Mobile SDK Guide
    • 1️⃣ Getting started
    • 2️⃣ Enrollment
    • 3️⃣ Authentication
    • 4️⃣ De-Enrollment
    • 5️⃣ Backup
    • 6️⃣ User and device management
  • 📱Mobile SDK Reference
    • UI Customization
    • Error handling
    • Liveness Settings
    • JWT signing
    • PIN authentication
    • Introduce Keyless to Users
  • 📱Mobile SDK Use Cases
    • Account recovery
    • Dynamic Linking
  • 📒Mobile SDK Changelog
    • Changelog
  • 💽Server API
    • Getting Started
    • Users
    • Devices
    • Operations
Powered by GitBook
On this page
  • Enrollment with PIN
  • Authentication with PIN
  • De-enrollment with PIN
  • Remove PIN (keeping biometric factor)
  • PIN utilities

Was this helpful?

  1. Mobile SDK Reference

PIN authentication

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

Last updated 3 months ago

Was this helpful?

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

PIN authentication has limited capabilities compared to biometric authentication. PIN supports:

  • ,

  • ,

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*/  }
)
let configuration =  PinEnrollConfig(pin: "1234")

Keyless.enroll(
  configuration: configuration,
  onCompletion: { /*TODO: process result*/  }
)
val configuration = EnrollmentConfiguration.builder
  .withPin("1234")
  .build()

Keyless.enroll(
  configuration = configuration,
  onCompletion = { /*TODO: process result*/  }
)
let configuration = Keyless.EnrollmentConfiguration.builder
  .withPin("1234")
  .build()

Keyless.enroll(
  configuration: configuration,
  onCompletion: { /*TODO: process result*/  }
)
final configuration = PinEnrollConfig(
    pin: "myPin"
);

try {
    await Keyless.instance.enroll(configuration);
    print("Enrollment successful");
} catch (error) {
    print("Enrollment failed: $error");
}

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*/  }
)
let configuration =  PinAuthConfig(pin: "1234")

Keyless.authenticate(
  configuration: configuration,
  onCompletion: { /*TODO: process result*/  }
)
val configuration = AuthenticationConfiguration.builder
  .withPin("1234")
  .build()

Keyless.authenticate(
  configuration = configuration,
  onCompletion = { /*TODO: process result*/  }
)
let configuration = Keyless.AuthenticationConfiguration.builder
  .withPin("1234")
  .build()

Keyless.authenticate(
  configuration: configuration,
  onCompletion: { /*TODO: process result*/  }
)
final configuration = PinAuthConfig(
    pin: "1234"
);

try {
    final result = await Keyless.instance.authenticate(configuration);
    print("Authentication successful");
} catch (error) {
    print("Authentication failed: $error");
}

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*/  }
)
let configuration =  PinDeEnrollConfig(pin: "1234")

Keyless.deEnroll(
  configuration: configuration,
  onCompletion: { /*TODO: process result*/  }
)
val configuration =
DeEnrollmentConfiguration.builder
  .withPin("myPin")
  .build()

Keyless.deEnroll(
  configuration = configuration,
  onCompletion = { /*TODO: process result*/  }
)
let configuration =
Keyless.DeEnrollmentConfiguration.builder
  .withPin("myPin")
  .build()

Keyless.deEnroll(
  configuration: configuration,
  onCompletion: { /*TODO: process result*/  }
)
final configuration = PinDeEnrollConfig(
    pin: "1234"
);

try {
    await Keyless.instance.deEnroll(configuration);
    print("De-enrollment successful");
} catch (error) {
    print("De-enrollment failed: $error");
}

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*/  }
)
let configuration =  BiomAuthConfig(shouldRemovePin: true)

Keyless.authenticate(
  configuration: configuration,
  onCompletion: { /*TODO: process result*/  }
)
val configuration =
AuthenticationConfiguration.builder
  .removingPin()
  .build()

Keyless.authenticate(
  configuration = configuration,
  onCompletion = { /*TODO: process result*/  }
)
let configuration =
Keyless.AuthenticationConfiguration.builder
  .removingPin()
  .build()

Keyless.authenticate(
  configuration: configuration,
  onCompletion: { /*TODO: process result*/  }
)
final configuration = BiomAuthConfig(
    shouldRemovePin: true
);

try {
    await Keyless.instance.authenticate(configuration);
    print("Pin remove successful");
} catch (error) {
    print("Pin remove failed: $error");
}

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*/  }
)
let configuration =  PinAuthConfig(pin: "1234", newPin: "5678")

Keyless.authenticate(
  configuration: configuration,
  onCompletion: { /*TODO: process result*/  }
)
Future<void> changePin({
  required String oldPin,
  required String newPin
}) async

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*/  }
)
let configuration =  PinAuthConfig(pin: "1234", shouldRemovePin: true)

Keyless.authenticate(
  configuration: configuration,
  onCompletion: { /*TODO: process result*/  }
)
Future<void> removePin({
  required String pin
}) async

Note that de-enrolling deletes the user biometric factor as well as the PIN factor. If you just want to remove the PIN authentication factor, use the instead.

📱
PIN utilities
jwt signing
operation info