验证 1.8.0

验证 1.8.0

Marcus OliverJay Lorenzo 维护。



验证 1.8.0

  • 验证

验证

Version License Platform

运行示例

  1. 克隆仓库,从示例目录运行 pod install
  2. 设置 环境变量
  3. inference_graph.tflitelabelmap_mobilenet_card.txt 添加到 ./Example/Vouched 目录。确保这些文件在 复制资源包资源
  4. 在 iOS 11.0+ 的设备上运行 Vouched-Example

第 1 屏 - 输入名称(可选)
第 2 屏 - 卡片检测
第 3 屏 - 面部检测
第 4 屏 - 身份验证结果
第 5 屏 - 面部验证(仅用于演示目的)

示例中显示的功能

  • 身份证和护照检测
  • 面部检测(带活性和不带活性)
  • 身份证验证
  • 姓名验证
  • 面部验证(仅用于演示目的)

如何使用 Vouched 库

Verifiable库包含了Verifiable目录的内容。我们的目标是将其作为CocoaPod分发。要在自己的项目中使用这款库,请参考下面的代码片段。

身份证识别和提交

import Vouched
let cardDetect = CardDetect()
let session: VouchedSession = VouchedSession(type: .idVerificationWithFace)

let detectedCard = cardDetect.detect(cvPixelBuffer)


if let detectedCard = detectedCard {
  switch detectedCard.step {
  case .preDetected:
    // prompt user to show ID card
  case .detected:
    updateLabelFromInstruction(detectedCard.instruction)
  case .postable:
    do {
      let job = try session.postFrontId(detectedCard: detectedCard)
      let retryableErrors = VouchedUtils.extractRetryableErrors(job)
      if !retryableErrors.isEmpty {
        // retry card detection
      }
    } catch {
      // handle error cases
    }
  }
} else {
    // prompt user to show ID card
}

人脸(自拍)识别和提交

import Vouched
let faceDetect = FaceDetect(config: FaceDetectConfig(liveness: .mouthMovement))

if let detectedFace = detectedFace {
  switch detectedFace.step {
  case .preDetected:
    // prompt user to look into camera
  case .detected:
    updateLabelFromInstruction(detectedFace.instruction)
  case .postable:
    do {
      // make sure to use the same session instance created previously
      let job = try session.postFace(detectedFace: detectedFace)
      let retryableErrors = VouchedUtils.extractRetryableErrors(job)
      if !retryableErrors.isEmpty {
        // retry face detection
      }
    } catch {
      // handle error cases
    }
  }
} else {
    // prompt user to look into camera
}

调试/记录Verifiable
目的地 - 日志输出的位置

  • .xcode (Xcode输出)
  • .console (通过
  • .none

级别 - 日志的严重程度

  • .debug
  • .info
  • .error

该级别包含更严重的日志。例如 - 使用debug会输出info和error

将VouchedLogger配置为所需的目的地和级别

VouchedLogger.shared.configure(destination: .xcode, level: .debug)

如果未配置,VouchedLogger将默认为.none和.error

设置环境变量

API_KEY = <PUBLIC_KEY>
APP_NAME = Vouched (Dev)

// local dev server usage only. Otherwise don't specify API_URL
SLASH = /
API_URL = http:$(SLASH)/localhost:7700

位置在:Example/Tests

运行测试

  • 打开Xcode
  • 选择Product/Test (Cmd+U)

Verifiable库在Apache License 2.0许可下提供。更多信息请参阅LICENSE文件。