omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Using FaceID

    Pythonista
    authentication objcutil
    2
    6
    4260
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • arandomperson
      arandomperson last edited by

      I'm trying to implement Face ID in a script, but following the example Touch ID scripts it just results in a crash, with faulthandler just saying Aborted

      This is what i'm using,

      from objc_util import *
      
      context = ObjCClass('LAContext').alloc().init()
      policy = 1
      reason = "FaceID Testing"
      
      def _handler(_cmd, success, error):
      	autherr = ObjCInstance(error).localizedDescription()
      	print(autherr)
      	if success:
      		print('authenicated')
      
      handler = ObjCBlock(_handler,restype = None, argtypes = [c_void_p, c_void_p, c_void_p])
      context.evaluatePolicy_localizedReason_reply_(policy, reason, handler)
      

      Using the "canEvaluatePolicy:error:" function, it returns true, so i'm assuming that Face ID works.
      Also setting policy to 2, defaults to passcode authentication.
      Of course it can as simple as @omz not adding "NSFaceIDUsageDescription" to pythonista's Info.plist

      Thanks for any help!

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        Well, your objc_block signature is wrong -- success (second argtypes) is a BOOL, not a c_void_p. BOOL in objc is a typedef for a signed char, or c_byte in ctypes. Note it is NOT c_bool.

        arandomperson 1 Reply Last reply Reply Quote 0
        • arandomperson
          arandomperson @JonB last edited by

          @JonB oops my mistake, though it still crashes unfortunately.
          Thanks for the reply!

          1 Reply Last reply Reply Quote 0
          • JonB
            JonB last edited by

            does it still crash with the same seg fault?

            1 Reply Last reply Reply Quote 0
            • JonB
              JonB last edited by

              try using None for the block, just to see if it crashes.

              arandomperson 1 Reply Last reply Reply Quote 0
              • arandomperson
                arandomperson @JonB last edited by

                @JonB yeah, changing c_void_p to c_byte still results in a crash with the same fault log, and setting the handler to None also results in a crash with the same fault log.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Powered by NodeBB Forums | Contributors