rushisangani / biometricauthentication Goto Github PK
View Code? Open in Web Editor NEWUse Apple FaceID or TouchID authentication in your app using BiometricAuthentication.
License: MIT License
Use Apple FaceID or TouchID authentication in your app using BiometricAuthentication.
License: MIT License
It's necessary to invalidate previous LAContext.
While building the application in Xcode 11-beta, we are facing the following issue by the compiler:
Module compiled with Swift 5.0.1 cannot be imported by the Swift 5.1 compiler
Can you please check and try to resolve so that we can fix it in our project as well.
Framework with Swift version: [5.0.1]
Xcode version: [11.0 beta-2]
Your application language: [Swift-5.1]
I set a timer of 5 min to logout the app and shows loginViewConroller. In view will appear I call the Authenticate method.
But the problem is if the user is not on app screen and reading notification. When timer triggers and authenticate view appears on top of Notification screen.
Hello,
I think it would be useful to be able to see if touch id is available for devices that may not support the option or I believe if the device has touch id but is turned off, LAContext returns false. It would basically be a copy of faceIDAvailable() function just swapped with touchID biometric type. If you need me to create a pull request I can help out.
Thanks
Joe
Got the following error message:
/Authentication/BioMetricAuthenticator.swift:70:138: Use of undeclared type 'Result'
Do you have code for Swift 4?
Hello BiometricAuthentication users,
I use this nice SDK in an iOS project (XCode 10.1, Swift 4). Even when I set allowableReuseDuration = 0, the touchID is remembered by the device and not requested again. Any idea what could be the cause of this ?
Thanks for any advice
Frank
Test by iPhone X, when I refused Face ID Access Request .
the error == .biometryNotAvailable, not biometryNotEnrolled value
I'm getting this message. How do I fix it please
Any plans for adding context.evaluatedPolicyDomainState change check, as for full proof BioMetric Auth, this is a great addition since iOS 9.0
BioMetricAuthenticator.swift
let errorType = AuthenticationError(error: err as! LAError)
has error:
'AuthenticationError' cannot be constructed because it has no accessible initializers
"This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSFaceIDUsageDescription key with a string value explaining to the user how the app uses this data."
The Demo app's info.plist just needs this key.
Hi
I am trying to save fingerprint data or hash into a local db.
Can I do that with this library?
thanks
How to turn off faceid
public func faceIDAvailable() -> Bool { if #available(iOS 11.0, *) { let context = LAContext() return (context.canEvaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, error: nil) && context.biometryType == .typeFaceID) } return false }
returns an error
I have changed the provisioning profile in my Xcode and try to build my project in team city and this error pops ups
Here is the complete log
Testing failed:
No such module 'BiometricAuthentication'
Command CompileSwift failed with a nonzero exit code
Testing cancelled because the build failed.
** TEST FAILED **
After couple of FaceId fail attempts
"case biometryLockedout " not been called for showPasscodeAuth
working fine with TouchID
There are 2 issues when using allowableReuseDuration:
It can get trouble for example in situation when I set allowableReuseDuration and start scanning a lot of times - each next scanning will use the first result.
Could you change the logic of allowableReuseDuration?
For example
var allowableReuseDuration: TimeInterval = 0
// context
let context = LAContext()
context.touchIDAuthenticationAllowableReuseDuration = allowableReuseDuration
Hi Rushi, first of all, great work. I tried to install it using CocoaPods and it's giving me this error.
Specs satisfying the BiometricAuthentication (= 1.0.0)
dependency were found, but they required a higher minimum deployment target.
For my app, the deployment target is 9.0.
I need to ask you whether it will work with 9.0 or not? And if not, if I change my deployment target to 10.0 will my app install on the devices having lesser than 10.0?
It seems like your faceIDAvailable
function will always fail because you don't call canEvaluatePolicy
on the LAContext instance object before checking the biometry type.
Something like this should help:
public func faceIDAvailable() -> Bool {
if #available(iOS 11.0, *) {
let context = LAContext()
return (context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil) && LAContext().biometryType == .typeFaceID)
}
return false
}
Here's the apple doc describing the biometryType instance property: https://developer.apple.com/documentation/localauthentication/lacontext/2867583-biometrytype
FaceId try again not working on not matching face.
Hello,
Please add Swift Package Manager installation
Thanks,
Use of undeclared type 'Result'
class func authenticateWithBioMetrics(reason: String, fallbackTitle: String? = "", cancelTitle: String? = "", completion: @escaping (Result<Bool, AuthenticationError>) -> Void) {
from class BioMetricAuthenticator
It seems that Objective C is having trouble importing the public methods (if I add the @objc attribute to it). The success function block and failure function block is not compatible with Objective C.
thanks,
BioMetricAuthenticator.swift:52:203: Function types cannot be represented in Objective-C unless their parameters and returns can be
/// Check for biometric authentication
public class func authenticateWithBioMetrics(reason: String, fallbackTitle: String? = "", cancelTitle: String? = "", success successBlock:@escaping AuthenticationSuccess, failure failureBlock:@escaping AuthenticationFailure)
May I ask what are the project's additional features compared to the built-in LocalAuthentication
framework? I read the usage section in readme and tried the example, but it's still not clear to me. BTW, when trying the example, I notice that the project doesn't support device passcode by default (I believe it can be customized because there is a section in readme discussing fallback title). In my opinion, that's more like a limitation because if user doesn't enable touch/face id, it's better off to just use passcode rather than ask user to enable touch/face if for the app.
Background: I'm adding user authentication support to my app. I read LocalAuthentication
doc and find it's simple to use. During the course I also find this project, which I believe is a wrapper of LocalAuthentication
. But it's not clear to me what are the additional features the project provide. I think it may help to list them in readme for people to evaluate the project. Just my thought. Thanks.
I am now using BiometricAuthentication in my app. And right now, I don't have an iPhone X device to test this. So is there a way that I can tell BiometricAuthentication to use TouchID only? Or in other words, I don't have a requirement to use FaceID as of now so want to use their TouchID only.
BiometricAuthentication is giving errors when creating the build. It just says library not found in the errors. Recently I had updated the Xcode version to version 13.3 and MAC version 12.3.1
After this update the errors started coming up. Can someone please help me on this ?
I use latest version of BiometricAuthentication (2.2), after pod install.
When I try to import BiometricAuthentication, it cannot show snippet.
When I add manually import BiometricAuthentication, it has crash on modulemap and some private func.
Please repair this.
I use Xcode 10.1 and swift 4.2
Hi Rushi,
Thanks for the lib.
I don't have the device which is not supported touchId like (iPhone 4s, iPhone 5).
Is this case handle in this library ?
From Fall 2023 Apple starts rolling out new privacy requirements, The apps and third-party SDKs should contain a privacy manifest file when they access required reason API. SkeletonView SDK uses UserDefaults which is required description of use in PrivacyManifest.
Otherwise, apps that don’t describe their use of required reason API in their privacy manifest file won’t be accepted by App Store Connect. Here is a link to the [Apple documentation].(https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api).
Add a PrivacyInfo.xcprivacy file and the following information to the Privacy Accessed API Types section
Privacy Accessed API Type: User Defaults
Privacy Accessed API Reasons: CA92.1: Access info from same app, per documentation
Hi,
thx for this pod it is very useful.
I tested on Xcode 9.2 and swift version 4.0.
I found error in public func faceIDAvailable().
I think it might be like this:
public func faceIDAvailable() -> Bool {
if #available(iOS 11.0, *) {
let context = LAContext()
return (context.canEvaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, error: nil) && context.biometryType == LABiometryType.faceID)
}
return false
}
Thanks for great library but Apple rejected our app because of this :( Here is the message from Apple :
our app uses the "prefs:root=" non-public URL scheme, which is a private entity. The use of non-public APIs is not permitted on the App Store because it can lead to a poor user experience should these APIs change.
Specifically, your app uses the following non-public URL scheme:
app-prefs:root=touchid_passcode
Continuing to use or conceal non-public APIs in future submissions of this app may result in the termination of your Apple Developer account, as well as removal of all associated apps from the App Store.
Next Steps
To resolve this issue, please revise your app to provide the associated functionality using public APIs or remove the functionality using the "prefs:root" or "App-Prefs:root" URL scheme.
If there are no alternatives for providing the functionality your app requires, you can file an enhancement request.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.