@@ -77,7 +77,8 @@ public class SwiftAuthgearPlugin: NSObject, FlutterPlugin, ASWebAuthenticationPr
7777 case " generateUUID " :
7878 self . generateUUID ( result: result)
7979 case " checkBiometricSupported " :
80- self . checkBiometricSupported ( result: result)
80+ let arguments = call. arguments as! Dictionary < String , AnyObject >
81+ self . checkBiometricSupported ( arguments: arguments, result: result)
8182 case " createBiometricPrivateKey " :
8283 let arguments = call. arguments as! Dictionary < String , AnyObject >
8384 self . createBiometricPrivateKey ( arguments: arguments, result: result)
@@ -434,9 +435,11 @@ public class SwiftAuthgearPlugin: NSObject, FlutterPlugin, ASWebAuthenticationPr
434435 result ( uuid)
435436 }
436437
437- private func checkBiometricSupported( result: @escaping FlutterResult ) {
438+ private func checkBiometricSupported( arguments: [ String : AnyObject ] , result: @escaping FlutterResult ) {
439+ let ios = arguments [ " ios " ] as! [ String : Any ]
440+ let policyString = ios [ " policy " ] as! String
438441 if #available( iOS 11 . 3 , * ) {
439- let policy = LAPolicy . deviceOwnerAuthenticationWithBiometrics
442+ let policy = LAPolicy ( policyString : policyString )
440443 let laContext = LAContext ( policy: policy)
441444 var nsError : NSError ? = nil
442445 _ = laContext. canEvaluatePolicy ( policy, error: & nsError)
@@ -456,12 +459,11 @@ public class SwiftAuthgearPlugin: NSObject, FlutterPlugin, ASWebAuthenticationPr
456459 let ios = arguments [ " ios " ] as! [ String : Any ]
457460 let constraint = ios [ " constraint " ] as! String
458461 let localizedReason = ios [ " localizedReason " ] as! String
462+ let policyString = ios [ " policy " ] as! String
459463 let tag = " com.authgear.keys.biometric. \( kid) "
460464
461465 if #available( iOS 11 . 3 , * ) {
462- // We intentionally ignore the option.
463- // We want to make sure the device owner has biometric
464- let policy = LAPolicy . deviceOwnerAuthenticationWithBiometrics
466+ let policy = LAPolicy ( policyString: policyString)
465467 let flags = SecAccessControlCreateFlags ( constraint: constraint)
466468 let laContext = LAContext ( policy: policy)
467469 laContext. evaluatePolicy ( policy, localizedReason: localizedReason) { _, error in
0 commit comments