Face Id not work in iphone 12

Hi all,

I face issue with some of iPhone 12 pro and all iPhone 12 pro max that Face ID prompt not show.

I am using https://github.com/agens-no/EllipticCurveKeyPair to create signature and send it to server.

I am developing in flutter and using MethodChannel as bridge between flutter and swift code.

My app works in other iPhone without any issue in Face ID.

Please assist if any changes happen in iPhone 12 that make this issue or it is related to my code.

Please assist if any changes happen in iPhone 12 that make this issue
or it is related to my code.

I’m not aware of any Face ID-related changes for iPhone 12 specifically. I strongly suspect that this is some other problem in your app that just happens to show up on that hardware. I recommend that you extract your core Face ID code out into a small test app. That’ll help in two ways:
  • If it doesn’t show the same problem, you know that the issue is being triggered by something in your main app.

  • OTOH, if it does show the problem, you have a small test project that you can share with others.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Hello All,

I got status error -2500 when call this:

Code Block
let status = SecItemCopyMatching(query as CFDictionary, &raw)


Any help why this happen in some of iPhone 12 pro and most of iPhone 12 pro max?
sorry the status code is : -25300
Error -25300 is errSecItemNotFound, which pretty much means what it says. It’s hard to say how you’re hitting this, so I’m going to reiterate my advice from earlier: Extract this code into a small test project so that you can isolate the circumstances under which it fails.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Hi
Here is my code:

Singing data:
Code Block private func Signing(dataToBeSigned: String) -> String {
    do {
      let digest = dataToBeSigned.data(using: .utf8)!
      let singedData = try Shared.keypair.sign(digest, hash: .sha256)
      let signature = singedData.base64EncodedString()
      return signature
    } catch {
      return "Cannot sign data"
    }
  }



I call it from this code:

Code Block
if(call.method == "Register") {
      guard let args = call.arguments else {
       
       return
      }
      if let myArgs = args as? [String: Any],
        let bla1 = myArgs["bla1"] as? String,
        let bla2 = myArgs["bla2"] as? String {
        let signatureBla1 = self?.Signing(dataToBeSigned: bla1)
        let signatureBla2 = self?.Signing(dataToBeSigned: bla2)
        let publicKey = self?.getPublicKey()
        var list = [String]()
        list.append(publicKey!)
        list.append(signatureBla1!)
        list.append(signatureBla2!)
       result(list)
      } else {
       result("iOS could not extract flutter arguments in method: (sendParams)")
      }
      self?.Register(result: result)
}


Code Block
call.method == "Register" 
is use to call Register Function from Flutter using MethodChannel.

Here is Shared:
Code Block
struct Shared {
    static let keypair: EllipticCurveKeyPair.Manager = {
      EllipticCurveKeyPair.logger = { print($0) }
      let publicAccessControl = EllipticCurveKeyPair.AccessControl(protection: kSecAttrAccessibleAlwaysThisDeviceOnly, flags: [])
      let privateAccessControl = EllipticCurveKeyPair.AccessControl(protection: kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly, flags: {
        return EllipticCurveKeyPair.Device.hasSecureEnclave ? [.userPresence, .privateKeyUsage] : [.userPresence]
      }())
      let config = EllipticCurveKeyPair.Config(
        publicLabel: "no.agens.sign.public",
        privateLabel: "no.agens.sign.private",
        operationPrompt: "Sign transact ion",
        publicKeyAccessControl: publicAccessControl,
        privateKeyAccessControl: privateAccessControl,
        token: .secureEnclaveIfAvailable)
      return EllipticCurveKeyPair.Manager(config: config)
    }()
  }


The sign the data and show the Face ID prompt I use this source code: agens-no/EllipticCurveKeyPair

The issue happen exactly in the shared source code of EllipticCurveKeyPair.swift line 366
Code Block
let status = SecItemCopyMatching(query as CFDictionary, &raw)


if other iphone the status 0 but in iphone 12 pro and pro max status -25300.

the query always passed in all iPhone like this

Code Block
SecItemCopyMatching: ["kcls": 1, "u_AuthCtx": LAContext[2264:5], "u_OpPrompt": "Sign User", "class": keys, "labl": "no.agens.sign.private", "r_Ref": true]


I hope this will help you to understand the problem.

Here is my code:

Thanks. I can’t see anything obviously wrong but I’m not in a position to audit the whole EllipticCurveKeyPair wrapper on your behalf. You have a couple of choices:
  • You can ask the author of that wrapper for help with your issue.

  • You can punch through that layer, creating a small test project that works directly in terms of Apple APIs. Once you do that, I can help explain the behaviour of those APIs (either here or, if things get too complex, in the context of a DTS tech support incident).

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Face Id not work in iphone 12
 
 
Q