From 949b13de57a594e1ab8cae5a01fbf0aef4ff4527 Mon Sep 17 00:00:00 2001 From: Juma Allan Date: Fri, 13 Dec 2024 11:50:42 +0300 Subject: [PATCH] added active liveness metadata --- .../Classes/Networking/Models/v2/Metadata.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Sources/SmileID/Classes/Networking/Models/v2/Metadata.swift b/Sources/SmileID/Classes/Networking/Models/v2/Metadata.swift index a051148d..70b95f7c 100644 --- a/Sources/SmileID/Classes/Networking/Models/v2/Metadata.swift +++ b/Sources/SmileID/Classes/Networking/Models/v2/Metadata.swift @@ -11,6 +11,7 @@ public struct Metadata: Codable { Metadata(items: [ .sdk, .sdkVersion, + .activeLivenessVersion, .clientIP, .fingerprint, .deviceModel, @@ -50,10 +51,21 @@ public class Metadatum: Codable { public static let sdk = Metadatum(name: "sdk", value: "iOS") public static let sdkVersion = Metadatum(name: "sdk_version", value: SmileID.version) + public static let activeLivenessVersion = Metadatum(name: "active_liveness_version", value: "1.0.0") public static let clientIP = Metadatum(name: "client_ip", value: getIPAddress(useIPv4: true)) public static let fingerprint = Metadatum(name: "fingerprint", value: SmileID.deviceId) public static let deviceModel = Metadatum(name: "device_model", value: UIDevice.current.modelName) public static let deviceOS = Metadatum(name: "device_os", value: UIDevice.current.systemVersion) + + public class ActiveLivenessType: Metadatum { + public init(livenessType: LivenessType) { + super.init(name: "active_liveness_type", value: livenessType.rawValue) + } + + public required init(from decoder: Decoder) throws { + try super.init(from: decoder) + } + } public class SelfieImageOrigin: Metadatum { public init(cameraFacing: CameraFacingValue) { @@ -136,6 +148,11 @@ public class Metadatum: Codable { } } +public enum LivenessType: String, Codable { + case headPose = "head_pose" + case smile = "smile" +} + public enum DocumentImageOriginValue: String { case gallery case cameraAutoCapture = "camera_auto_capture"