
Enables local authentication on Android and iOS devices using fingerprint or touch ID, providing easy integration for biometric authentication within mobile applications.
KApp Auth is available on mavenCentral().
implementation("io.github.the-best-is-best:kbiometric:1.0.0")
// u need add[versions]
appcompat = "1.7.0"
....
[libraries]
....
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
androidMain.dependencies {
....
implementation(libs.androidx.appcompat)
}
pod 'BiometricAuthentication' , '3.1.3'class AppActivity : AppCompatActivity() { // change this
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
AndroidBiometricPromptManager.init(this, "Demo App Auth", "Demo Biometric") // add this
setContent { App() }
}
}val scope = rememberCoroutineScope()
var label by remember { mutableStateOf("Please auth first") }
val kBiometric = KBiometric()
scope.launch {
kBiometric.auth { result ->
result.onSuccess {
label = when (it) {
is BiometricResult.AuthenticationError -> it.error
BiometricResult.AuthenticationFailed -> "Auth failed"
BiometricResult.AuthenticationNotSet -> "Auth not set"
BiometricResult.AuthenticationSuccess -> "Auth success"
BiometricResult.FeatureUnavailable -> "Feature unavailable"
BiometricResult.HardwareUnavailable -> "Hardware unavailable"
}
}.onFailure {
label = "Failure"
}
}
}
KApp Auth is available on mavenCentral().
implementation("io.github.the-best-is-best:kbiometric:1.0.0")
// u need add[versions]
appcompat = "1.7.0"
....
[libraries]
....
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
androidMain.dependencies {
....
implementation(libs.androidx.appcompat)
}
pod 'BiometricAuthentication' , '3.1.3'class AppActivity : AppCompatActivity() { // change this
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
AndroidBiometricPromptManager.init(this, "Demo App Auth", "Demo Biometric") // add this
setContent { App() }
}
}val scope = rememberCoroutineScope()
var label by remember { mutableStateOf("Please auth first") }
val kBiometric = KBiometric()
scope.launch {
kBiometric.auth { result ->
result.onSuccess {
label = when (it) {
is BiometricResult.AuthenticationError -> it.error
BiometricResult.AuthenticationFailed -> "Auth failed"
BiometricResult.AuthenticationNotSet -> "Auth not set"
BiometricResult.AuthenticationSuccess -> "Auth success"
BiometricResult.FeatureUnavailable -> "Feature unavailable"
BiometricResult.HardwareUnavailable -> "Hardware unavailable"
}
}.onFailure {
label = "Failure"
}
}
}