Comments (13)
I’m really not sure. https://youtu.be/fpaQpyU_QiM
from ellipticcurvekeypair.
Why do you want to cancel? What is the use case?
from ellipticcurvekeypair.
e.g. We prompt the user to authenticate using TouchID as soon as the app is opened. The app may also receive some authentication messages that he needs to action (select Accept/Reject on 2FA messages).
If the app receives an Authentication messages then we cancel the TouchID operation and show the authentication message.
from ellipticcurvekeypair.
I have rewritten some of the code so I'm now able to pass a LAContext to sign
and decrypt
. Sad thing is that I don't get to dismiss the LAContext once it is showing the fingerprint dialog. Do you know how?
Example
import UIKit
import LocalAuthentication
class ViewController: UIViewController {
var context: LAContext! = LAContext()
func createAccessControl(protection: CFString = kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly, flags: SecAccessControlCreateFlags = [.userPresence, .privateKeyUsage]) -> SecAccessControl {
var error: Unmanaged<CFError>?
let accessControl = SecAccessControlCreateWithFlags(kCFAllocatorDefault, protection, flags, &error)
return accessControl!
}
override func viewDidLoad() {
super.viewDidLoad()
delay(1.0, queue: .main) {
self.decrypt()
}
}
func decrypt() {
let accessControl = createAccessControl()
context.evaluateAccessControl(accessControl, operation: .useKeySign, localizedReason: "Sign") { (success, error) in
DispatchQueue.main.async {
if success {
let alert = UIAlertController(title: "Authenticated", message: "Ready to sign/decrypt", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: nil))
self.show(alert, sender: nil)
} else {
let alert = UIAlertController(title: "Failed to authenticate", message: "Error: \(error!)", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: nil))
self.show(alert, sender: nil)
}
}
}
delay(3.0, queue: .main) {
self.context.invalidate()
}
}
}
func delay( _ delay: Double, queue: DispatchQueue, completion: @escaping () -> () ) {
queue.asyncAfter(deadline: DispatchTime.now() + Double(Int64(delay * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)) { () -> Void in
completion()
}
}
It doesn't seem promising.
from ellipticcurvekeypair.
If you are able to remove the dialog then I'll be happy to finish the rewrite to support LAContext.
from ellipticcurvekeypair.
Hi
I am new to Swift development.
I also tried similar thing, it doesn't close TouchID dialog.
Rather calling invalidate method doesn't do anything, you can still authenticate yourself with correct fingerprint.
from ellipticcurvekeypair.
So then I guess this is not possible... sadly. If you find a way to close it I’ll be more than happy to change the library
from ellipticcurvekeypair.
I have pushed my code to master. Whenever you sign or decrypt you will have the possibility of passing a LAContext.
Like this
let signature = try manager.sign(digest, authenticationContext: context)
from ellipticcurvekeypair.
In this archive you'll find two files and you'll see there's a bug with LAContext
from ellipticcurvekeypair.
Thanks a lot
from ellipticcurvekeypair.
http://www.openradar.me/35069937
from ellipticcurvekeypair.
Apple thinks this is fixed in latest GM. Are you, @Vabs28, able to check this?
from ellipticcurvekeypair.
It seems apple solved this when working with the LAContext directly. It doesn't work for me when the LAContext is presented by Security framework for some reason.
from ellipticcurvekeypair.
Related Issues (20)
- Can I export the EC Private key ? HOT 2
- no prompts shown for face id auth on simulator HOT 5
- Encrypting messages using CLI Open SSL HOT 5
- deinitialize() and deallocate() causing Compiler Error in SHA256.swift HOT 6
- Demo Project Error HOT 2
- iOS 13 and CryptoKit HOT 1
- Error when signing or decrypting on Simulator (iOS 13) HOT 2
- Publish new version in CocoaPods? HOT 1
- Encryption on MacOS
- Wrong Simulator Detection
- AccessControl for publicKey doesn't restrict to biometryCurrentSet flag HOT 3
- SecItemCopyMatching not works in iphone 12 HOT 6
- Sign twice strings HOT 2
- Is secp256k1 curve supported?
- Create access control with only [.privateKeyUsage] HOT 3
- concern about userPresence HOT 2
- Authenticate only with Biometrics
- Deprecation Warnings and Making export() Method of PublicKey Public HOT 6
- iOS 13+ HOT 3
- Unable to generate key pair
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ellipticcurvekeypair.