A cross-platform Fusion library to implement the local authentication using Biometry, or device password. It is fully compatible cross-platform for iOS and Android.
Features:
canAuthenticateWithBiometrics()
requestBiometricAuthentication()
requestDeviceAuthentication()
// swift-tools-version:5.3
import Foundation
import PackageDescription
let SCADE_SDK = ProcessInfo.processInfo.environment["SCADE_SDK"] ?? ""
let package = Package(
name: "LocalAuthDemo",
platforms: [
.macOS(.v10_14)
],
products: [
.library(
name: "LocalAuthDemo",
type: .static,
targets: [
"LocalAuthDemo"
]
)
],
dependencies: [
.package(
name: "FusionLocalAuth", url: "https://github.com/scade-platform/FusionLocalAuth.git",
.branch("android_impl")),
],
targets: [
.target(
name: "LocalAuthDemo",
dependencies: [
.product(name: "FusionLocalAuth", package: "FusionLocalAuth"),
],
exclude: ["main.page"],
swiftSettings: [
.unsafeFlags(["-F", SCADE_SDK], .when(platforms: [.macOS, .iOS])),
.unsafeFlags(["-I", "\(SCADE_SDK)/include"], .when(platforms: [.android])),
]
)
]
)
import FusionLocalAuth
let localAuth: LocalAuthManager = LocalAuthManager()
let bool = localAuth.canAuthenticateWithBiometrics()
if !bool {
self.label.text = "The device can't authenticate using Biometrics!"
} else {
self.label.text = "The device can authenticate with biometrics"
}
localAuth.requestBiometricAuthentication(
authTitle: "Biometric Authentication", reasonTitle: "This feature requires the biometrics for security purposes.", cancelTitle: "Cancel Biometric Authentication",
completionStatus: { [weak self] (success, error) in
guard success else {
print(error?.description)
S.label2.text = "Auth Failed"
return
}
S.label2.text = "Auth Successful"
})
Consider contributing by creating a pull request (PR) or opening an issue. By creating an issue, you can alert the repository's maintainers to any bugs or missing documentation you've found. 🐛📝 If you're feeling confident and want to make a bigger impact, creating a PR, can be a great way to help others. 📖💡 Remember, contributing to open source is a collaborative effort, and any contribution, big or small, is always appreciated! 🙌 So why not take the first step and start contributing today? 😊