diff --git a/HostApp/HostApp/Views/ExampleLivenessView.swift b/HostApp/HostApp/Views/ExampleLivenessView.swift index e05bccf3..39407c89 100644 --- a/HostApp/HostApp/Views/ExampleLivenessView.swift +++ b/HostApp/HostApp/Views/ExampleLivenessView.swift @@ -43,6 +43,8 @@ struct ExampleLivenessView: View { viewModel.presentationState = .error(.socketClosed) case .failure(.countdownNoFace), .failure(.countdownFaceTooClose), .failure(.countdownMultipleFaces): viewModel.presentationState = .error(.countdownFaceTooClose) + case .failure(.invalidSignature): + viewModel.presentationState = .error(.invalidSignature) default: viewModel.presentationState = .liveness } @@ -70,6 +72,8 @@ struct ExampleLivenessView: View { LivenessCheckErrorContentView.faceMatchTimeOut case .countdownNoFace, .countdownFaceTooClose, .countdownMultipleFaces: LivenessCheckErrorContentView.failedDuringCountdown + case .invalidSignature: + LivenessCheckErrorContentView.invalidSignature default: LivenessCheckErrorContentView.unexpected } diff --git a/HostApp/HostApp/Views/LivenessCheckErrorContentView.swift b/HostApp/HostApp/Views/LivenessCheckErrorContentView.swift index c3415318..3357aa7a 100644 --- a/HostApp/HostApp/Views/LivenessCheckErrorContentView.swift +++ b/HostApp/HostApp/Views/LivenessCheckErrorContentView.swift @@ -50,6 +50,11 @@ extension LivenessCheckErrorContentView { name: "Check failed during countdown", description: "Avoid moving closer during countdown and ensure only one face is in front of camera." ) + + static let invalidSignature = LivenessCheckErrorContentView( + name: "The signature on the request is invalid.", + description: "Ensure the device time is correct and try again." + ) } struct LivenessCheckErrorContentView_Previews: PreviewProvider { diff --git a/Package.swift b/Package.swift index 4cb1444d..41a26aa2 100644 --- a/Package.swift +++ b/Package.swift @@ -13,7 +13,7 @@ let package = Package( targets: ["FaceLiveness"]), ], dependencies: [ - .package(url: "https://github.com/aws-amplify/amplify-swift", exact: "2.29.1") + .package(url: "https://github.com/aws-amplify/amplify-swift", exact: "2.29.3") ], targets: [ .target( diff --git a/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionError.swift b/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionError.swift index 9027de46..a19cfd57 100644 --- a/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionError.swift +++ b/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionError.swift @@ -120,6 +120,12 @@ public struct FaceLivenessDetectionError: Error, Equatable { recoverySuggestion: "" ) + public static let invalidSignature = FaceLivenessDetectionError( + code: 17, + message: "The signature on the request is invalid.", + recoverySuggestion: "Ensure the device time is correct and try again." + ) + public static func == (lhs: FaceLivenessDetectionError, rhs: FaceLivenessDetectionError) -> Bool { lhs.code == rhs.code } diff --git a/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionView.swift b/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionView.swift index 320da58e..bc4e47e8 100644 --- a/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionView.swift +++ b/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionView.swift @@ -202,7 +202,7 @@ public struct FaceLivenessDetectorView: View { case .userCancelled: return .userCancelled case .timedOut: - return .sessionTimedOut + return .faceInOvalMatchExceededTimeLimitError case .socketClosed: return .socketClosed default: @@ -273,6 +273,8 @@ private func map(detectionCompletion: @escaping (Result CALayer { + override func configureCamera(frame: CGRect) throws -> CALayer { videoRenderView = VideoRenderView(frame: frame) let asset = AVAsset(url: inputFile) // Setup display link