AuthorizeBiometry

public class AuthorizeBiometry : NSObject, AuthorizeProtocol, @unchecked Sendable

生物识别授权

  • Undocumented

    Declaration

    Swift

    public static let shared: AuthorizeBiometry

Accessor

  • 当前识别策略,默认为1不含Passcode,可设置为2开启Passcode

    Declaration

    Swift

    public var policy: LAPolicy
  • 本地化识别原因,默认身份验证,详见evaluatePolicy

    Declaration

    Swift

    public var localizedReason: (@Sendable (LAContext) -> String)?
  • 本地化回滚标题,默认根据policy自动处理,详见LAContext。为空串时隐藏Fallback操作,为nil时开启Fallback且需处理LAError.userFallback错误

    Declaration

    Swift

    public var localizedFallbackTitle: (@Sendable (LAContext) -> String?)?
  • 自定义上下文配置句柄,默认nil

    Declaration

    Swift

    public var customContextBlock: (@Sendable (LAContext) -> Void)?
  • 当前生物识别类型,如none|touchID|faceID|opticID,详见LAContext

    Declaration

    Swift

    public var biometryType: LABiometryType { get }

AuthorizeProtocol

  • 同步查询状态,默认返回最近一次认证状态,未认证时为notDetermined,不支持时为restricted

    Declaration

    Swift

    public func authorizeStatus() -> AuthorizeStatus
  • 异步查询状态,主线程回调,默认返回最近一次认证状态,未认证时为notDetermined,不支持时为restricted

    Declaration

    Swift

    public func authorizeStatus(_ completion: (@MainActor @Sendable (AuthorizeStatus, Error?) -> Void)?)
  • Declaration

    Swift

    public func requestAuthorize(_ completion: (@MainActor @Sendable (AuthorizeStatus, Error?) -> Void)?)