From a966f7801285859f18a1c59f45909e71fff533d1 Mon Sep 17 00:00:00 2001 From: Abhash Kumar Singh Date: Fri, 3 Oct 2025 15:58:54 -0700 Subject: [PATCH 1/5] fix: avoid invoking onCompletion handler twice for non-service errors --- HostApp/HostApp.xcodeproj/project.pbxproj | 10 +- .../xcshareddata/swiftpm/Package.resolved | 232 +++++++++++++++++- Package.resolved | 232 +++++++++++++++++- Package.swift | 2 +- .../FaceLivenessDetectionViewModel.swift | 7 +- .../Views/Liveness/LivenessStateMachine.swift | 4 + 6 files changed, 461 insertions(+), 26 deletions(-) diff --git a/HostApp/HostApp.xcodeproj/project.pbxproj b/HostApp/HostApp.xcodeproj/project.pbxproj index 76052c1..504c930 100644 --- a/HostApp/HostApp.xcodeproj/project.pbxproj +++ b/HostApp/HostApp.xcodeproj/project.pbxproj @@ -217,8 +217,6 @@ A5A9AF5054D0FF13505B212A /* AmplifyConfig */ = { isa = PBXGroup; children = ( - 973619242BA378690003A590 /* awsconfiguration.json */, - 973619232BA378690003A590 /* amplifyconfiguration.json */, ); name = AmplifyConfig; sourceTree = ""; @@ -536,7 +534,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"HostApp/Preview Content\""; - DEVELOPMENT_TEAM = W3DRXD72QU; + DEVELOPMENT_TEAM = N75V292K74; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = HostApp/Info.plist; @@ -552,7 +550,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.amazonaws.mobile.amplify.liveness.testing.hostapp; + PRODUCT_BUNDLE_IDENTIFIER = com.aws.amplify.liveness.testing.hostapp; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG LANDMARK_DEBUG_MODE"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -570,7 +568,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"HostApp/Preview Content\""; - DEVELOPMENT_TEAM = W3DRXD72QU; + DEVELOPMENT_TEAM = N75V292K74; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = HostApp/Info.plist; @@ -586,7 +584,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.amazonaws.mobile.amplify.liveness.testing.hostapp; + PRODUCT_BUNDLE_IDENTIFIER = com.aws.amplify.liveness.testing.hostapp; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; diff --git a/HostApp/HostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/HostApp/HostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a47e606..8749740 100644 --- a/HostApp/HostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/HostApp/HostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/aws-amplify/amplify-swift", "state" : { - "revision" : "7fa7abdb9daf25bdd97cc4fbcdd0d5a5cc9c4bf1", - "version" : "2.49.0" + "revision" : "c249f3674ad9eb80d7ff6c8da11bddfb46eab739", + "version" : "2.51.0" } }, { @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-crt-swift", "state" : { - "revision" : "74d970dde8a0d6b2fe1d8374767ca9793088ce2c", - "version" : "0.48.0" + "revision" : "5be6550f81c760cceb0a43c30d4149ac55c5640c", + "version" : "0.52.1" } }, { @@ -32,8 +32,35 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-sdk-swift", "state" : { - "revision" : "104958a898543582bb01102616bf5d61ed237352", - "version" : "1.2.59" + "revision" : "8b5336764297d34157bd580374b5f6e182746759", + "version" : "1.5.18" + } + }, + { + "identity" : "grpc-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/grpc/grpc-swift.git", + "state" : { + "revision" : "a56a157218877ef3e9625f7e1f7b2cb7e46ead1b", + "version" : "1.26.1" + } + }, + { + "identity" : "opentelemetry-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/open-telemetry/opentelemetry-swift", + "state" : { + "revision" : "ef63c346d05f4fa7c9ca883f92631fd139eb2cfe", + "version" : "1.17.1" + } + }, + { + "identity" : "opentracing-objc", + "kind" : "remoteSourceControl", + "location" : "https://github.com/undefinedlabs/opentracing-objc", + "state" : { + "revision" : "18c1a35ca966236cee0c5a714a51a73ff33384c1", + "version" : "0.5.2" } }, { @@ -41,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/smithy-lang/smithy-swift", "state" : { - "revision" : "755367ae4e10004f8b5a94fbfdf3f638a1f225bc", - "version" : "0.125.0" + "revision" : "a6cac0739d76ef08e2d927febc682d9898e76fe2", + "version" : "0.152.0" } }, { @@ -54,6 +81,96 @@ "version" : "0.15.3" } }, + { + "identity" : "swift-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-algorithms.git", + "state" : { + "revision" : "87e50f483c54e6efd60e885f7f5aa946cee68023", + "version" : "1.2.1" + } + }, + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser.git", + "state" : { + "revision" : "309a47b2b1d9b5e991f36961c983ecec72275be3", + "version" : "1.6.1" + } + }, + { + "identity" : "swift-asn1", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-asn1.git", + "state" : { + "revision" : "f70225981241859eb4aa1a18a75531d26637c8cc", + "version" : "1.4.0" + } + }, + { + "identity" : "swift-async-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-async-algorithms.git", + "state" : { + "revision" : "042e1c4d9d19748c9c228f8d4ebc97bb1e339b0b", + "version" : "1.0.4" + } + }, + { + "identity" : "swift-atomics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-atomics.git", + "state" : { + "revision" : "b601256eab081c0f92f059e12818ac1d4f178ff7", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-certificates", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-certificates.git", + "state" : { + "revision" : "4b092f15164144c24554e0a75e080a960c5190a6", + "version" : "1.14.0" + } + }, + { + "identity" : "swift-collections", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections.git", + "state" : { + "revision" : "7b847a3b7008b2dc2f47ca3110d8c782fb2e5c7e", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-crypto", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-crypto.git", + "state" : { + "revision" : "95ba0316a9b733e92bb6b071255ff46263bbe7dc", + "version" : "3.15.1" + } + }, + { + "identity" : "swift-http-structured-headers", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-structured-headers.git", + "state" : { + "revision" : "1625f271afb04375bf48737a5572613248d0e7a0", + "version" : "1.4.0" + } + }, + { + "identity" : "swift-http-types", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-types.git", + "state" : { + "revision" : "a0a57e949a8903563aba4615869310c0ebf14c03", + "version" : "1.4.0" + } + }, { "identity" : "swift-log", "kind" : "remoteSourceControl", @@ -62,6 +179,105 @@ "revision" : "3d8596ed08bd13520157f0355e35caed215ffbfa", "version" : "1.6.3" } + }, + { + "identity" : "swift-metrics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-metrics.git", + "state" : { + "revision" : "0743a9364382629da3bf5677b46a2c4b1ce5d2a6", + "version" : "2.7.1" + } + }, + { + "identity" : "swift-nio", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio.git", + "state" : { + "revision" : "a18bddb0acf7a40d982b2f128ce73ce4ee31f352", + "version" : "2.86.2" + } + }, + { + "identity" : "swift-nio-extras", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-extras.git", + "state" : { + "revision" : "a55c3dd3a81d035af8a20ce5718889c0dcab073d", + "version" : "1.29.0" + } + }, + { + "identity" : "swift-nio-http2", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-http2.git", + "state" : { + "revision" : "5e9e99ec96c53bc2c18ddd10c1e25a3cd97c55e5", + "version" : "1.38.0" + } + }, + { + "identity" : "swift-nio-ssl", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-ssl.git", + "state" : { + "revision" : "b2b043a8810ab6d51b3ff4df17f057d87ef1ec7c", + "version" : "2.34.1" + } + }, + { + "identity" : "swift-nio-transport-services", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-transport-services.git", + "state" : { + "revision" : "e645014baea2ec1c2db564410c51a656cf47c923", + "version" : "1.25.1" + } + }, + { + "identity" : "swift-numerics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-numerics.git", + "state" : { + "revision" : "0c0290ff6b24942dadb83a929ffaaa1481df04a2", + "version" : "1.1.1" + } + }, + { + "identity" : "swift-protobuf", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-protobuf.git", + "state" : { + "revision" : "2547102afd04fe49f1b286090f13ebce07284980", + "version" : "1.31.1" + } + }, + { + "identity" : "swift-service-lifecycle", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-server/swift-service-lifecycle.git", + "state" : { + "revision" : "e7187309187695115033536e8fc9b2eb87fd956d", + "version" : "2.8.0" + } + }, + { + "identity" : "swift-system", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-system.git", + "state" : { + "revision" : "395a77f0aa927f0ff73941d7ac35f2b46d47c9db", + "version" : "1.6.3" + } + }, + { + "identity" : "thrift-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/undefinedlabs/Thrift-Swift", + "state" : { + "revision" : "18ff09e6b30e589ed38f90a1af23e193b8ecef8e", + "version" : "1.1.2" + } } ], "version" : 2 diff --git a/Package.resolved b/Package.resolved index 3ecb0a7..0ff5d7d 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/aws-amplify/amplify-swift", "state" : { - "revision" : "bdf99fd638bc8da9159c46acb93a3c57f92ce180", - "version" : "2.49.1" + "revision" : "cfdda779c9bc699447b84a8afd9c234ace4f5ffd", + "version" : "2.51.1" } }, { @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-crt-swift", "state" : { - "revision" : "74d970dde8a0d6b2fe1d8374767ca9793088ce2c", - "version" : "0.48.0" + "revision" : "5be6550f81c760cceb0a43c30d4149ac55c5640c", + "version" : "0.52.1" } }, { @@ -32,8 +32,35 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-sdk-swift", "state" : { - "revision" : "104958a898543582bb01102616bf5d61ed237352", - "version" : "1.2.59" + "revision" : "8b5336764297d34157bd580374b5f6e182746759", + "version" : "1.5.18" + } + }, + { + "identity" : "grpc-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/grpc/grpc-swift.git", + "state" : { + "revision" : "a56a157218877ef3e9625f7e1f7b2cb7e46ead1b", + "version" : "1.26.1" + } + }, + { + "identity" : "opentelemetry-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/open-telemetry/opentelemetry-swift", + "state" : { + "revision" : "ef63c346d05f4fa7c9ca883f92631fd139eb2cfe", + "version" : "1.17.1" + } + }, + { + "identity" : "opentracing-objc", + "kind" : "remoteSourceControl", + "location" : "https://github.com/undefinedlabs/opentracing-objc", + "state" : { + "revision" : "18c1a35ca966236cee0c5a714a51a73ff33384c1", + "version" : "0.5.2" } }, { @@ -41,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/smithy-lang/smithy-swift", "state" : { - "revision" : "755367ae4e10004f8b5a94fbfdf3f638a1f225bc", - "version" : "0.125.0" + "revision" : "a6cac0739d76ef08e2d927febc682d9898e76fe2", + "version" : "0.152.0" } }, { @@ -54,6 +81,96 @@ "version" : "0.15.3" } }, + { + "identity" : "swift-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-algorithms.git", + "state" : { + "revision" : "87e50f483c54e6efd60e885f7f5aa946cee68023", + "version" : "1.2.1" + } + }, + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser.git", + "state" : { + "revision" : "309a47b2b1d9b5e991f36961c983ecec72275be3", + "version" : "1.6.1" + } + }, + { + "identity" : "swift-asn1", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-asn1.git", + "state" : { + "revision" : "f70225981241859eb4aa1a18a75531d26637c8cc", + "version" : "1.4.0" + } + }, + { + "identity" : "swift-async-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-async-algorithms.git", + "state" : { + "revision" : "042e1c4d9d19748c9c228f8d4ebc97bb1e339b0b", + "version" : "1.0.4" + } + }, + { + "identity" : "swift-atomics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-atomics.git", + "state" : { + "revision" : "b601256eab081c0f92f059e12818ac1d4f178ff7", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-certificates", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-certificates.git", + "state" : { + "revision" : "4b092f15164144c24554e0a75e080a960c5190a6", + "version" : "1.14.0" + } + }, + { + "identity" : "swift-collections", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections.git", + "state" : { + "revision" : "7b847a3b7008b2dc2f47ca3110d8c782fb2e5c7e", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-crypto", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-crypto.git", + "state" : { + "revision" : "95ba0316a9b733e92bb6b071255ff46263bbe7dc", + "version" : "3.15.1" + } + }, + { + "identity" : "swift-http-structured-headers", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-structured-headers.git", + "state" : { + "revision" : "1625f271afb04375bf48737a5572613248d0e7a0", + "version" : "1.4.0" + } + }, + { + "identity" : "swift-http-types", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-types.git", + "state" : { + "revision" : "a0a57e949a8903563aba4615869310c0ebf14c03", + "version" : "1.4.0" + } + }, { "identity" : "swift-log", "kind" : "remoteSourceControl", @@ -62,6 +179,105 @@ "revision" : "3d8596ed08bd13520157f0355e35caed215ffbfa", "version" : "1.6.3" } + }, + { + "identity" : "swift-metrics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-metrics.git", + "state" : { + "revision" : "0743a9364382629da3bf5677b46a2c4b1ce5d2a6", + "version" : "2.7.1" + } + }, + { + "identity" : "swift-nio", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio.git", + "state" : { + "revision" : "a18bddb0acf7a40d982b2f128ce73ce4ee31f352", + "version" : "2.86.2" + } + }, + { + "identity" : "swift-nio-extras", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-extras.git", + "state" : { + "revision" : "a55c3dd3a81d035af8a20ce5718889c0dcab073d", + "version" : "1.29.0" + } + }, + { + "identity" : "swift-nio-http2", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-http2.git", + "state" : { + "revision" : "5e9e99ec96c53bc2c18ddd10c1e25a3cd97c55e5", + "version" : "1.38.0" + } + }, + { + "identity" : "swift-nio-ssl", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-ssl.git", + "state" : { + "revision" : "b2b043a8810ab6d51b3ff4df17f057d87ef1ec7c", + "version" : "2.34.1" + } + }, + { + "identity" : "swift-nio-transport-services", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-transport-services.git", + "state" : { + "revision" : "e645014baea2ec1c2db564410c51a656cf47c923", + "version" : "1.25.1" + } + }, + { + "identity" : "swift-numerics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-numerics.git", + "state" : { + "revision" : "0c0290ff6b24942dadb83a929ffaaa1481df04a2", + "version" : "1.1.1" + } + }, + { + "identity" : "swift-protobuf", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-protobuf.git", + "state" : { + "revision" : "2547102afd04fe49f1b286090f13ebce07284980", + "version" : "1.31.1" + } + }, + { + "identity" : "swift-service-lifecycle", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-server/swift-service-lifecycle.git", + "state" : { + "revision" : "e7187309187695115033536e8fc9b2eb87fd956d", + "version" : "2.8.0" + } + }, + { + "identity" : "swift-system", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-system.git", + "state" : { + "revision" : "395a77f0aa927f0ff73941d7ac35f2b46d47c9db", + "version" : "1.6.3" + } + }, + { + "identity" : "thrift-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/undefinedlabs/Thrift-Swift", + "state" : { + "revision" : "18ff09e6b30e589ed38f90a1af23e193b8ecef8e", + "version" : "1.1.2" + } } ], "version" : 2 diff --git a/Package.swift b/Package.swift index 7ea6edc..6180ebb 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", from: "2.49.0") + .package(url: "https://github.com/aws-amplify/amplify-swift", from: "2.51.0") ], targets: [ .target( diff --git a/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionViewModel.swift b/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionViewModel.swift index ee49368..f1a3d0c 100644 --- a/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionViewModel.swift +++ b/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionViewModel.swift @@ -115,10 +115,11 @@ class FaceLivenessDetectionViewModel: ObservableObject { DispatchQueue.main.async { self?.livenessState.complete() } - case .unexpectedClosure: + case .unexpectedClosure(let error): DispatchQueue.main.async { - self?.livenessState - .unrecoverableStateEncountered(.socketClosed) + // known liveness errors already set `livenessState` + guard !error.isKnownLivenessError() else { return } + self?.livenessState.unrecoverableStateEncountered(.socketClosed) } } }) diff --git a/Sources/FaceLiveness/Views/Liveness/LivenessStateMachine.swift b/Sources/FaceLiveness/Views/Liveness/LivenessStateMachine.swift index 62e563e..a484015 100644 --- a/Sources/FaceLiveness/Views/Liveness/LivenessStateMachine.swift +++ b/Sources/FaceLiveness/Views/Liveness/LivenessStateMachine.swift @@ -180,4 +180,8 @@ extension URLSessionWebSocketTask.CloseCode { static let viewClosure = URLSessionWebSocketTask.CloseCode(rawValue: 4004) static let unexpectedRuntimeError = URLSessionWebSocketTask.CloseCode(rawValue: 4005) static let missingVideoPermission = URLSessionWebSocketTask.CloseCode(rawValue: 4006) + + func isKnownLivenessError() -> Bool { + return (4001...4006).contains(self.rawValue) + } } From 1b62ca3449b4cdf8ada80e5f22769052fa1c75cc Mon Sep 17 00:00:00 2001 From: Abhash Kumar Singh Date: Thu, 9 Oct 2025 13:31:17 -0700 Subject: [PATCH 2/5] update dependency to fix branch temporarily --- .../xcshareddata/swiftpm/Package.resolved | 20 +++++++++---------- Package.resolved | 20 +++++++++---------- Package.swift | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/HostApp/HostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/HostApp/HostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 8749740..5664cae 100644 --- a/HostApp/HostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/HostApp/HostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/aws-amplify/amplify-swift", "state" : { - "revision" : "c249f3674ad9eb80d7ff6c8da11bddfb46eab739", - "version" : "2.51.0" + "branch" : "fix/liveness-service-exception-callback", + "revision" : "304e2f8b5c96001a2d07a73725409f1acb619913" } }, { @@ -176,8 +176,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-log.git", "state" : { - "revision" : "3d8596ed08bd13520157f0355e35caed215ffbfa", - "version" : "1.6.3" + "revision" : "ce592ae52f982c847a4efc0dd881cc9eb32d29f2", + "version" : "1.6.4" } }, { @@ -230,8 +230,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-transport-services.git", "state" : { - "revision" : "e645014baea2ec1c2db564410c51a656cf47c923", - "version" : "1.25.1" + "revision" : "df6c28355051c72c884574a6c858bc54f7311ff9", + "version" : "1.25.2" } }, { @@ -248,8 +248,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "2547102afd04fe49f1b286090f13ebce07284980", - "version" : "1.31.1" + "revision" : "c6fe6442e6a64250495669325044052e113e990c", + "version" : "1.32.0" } }, { @@ -257,8 +257,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/swift-server/swift-service-lifecycle.git", "state" : { - "revision" : "e7187309187695115033536e8fc9b2eb87fd956d", - "version" : "2.8.0" + "revision" : "0fcc4c9c2d58dd98504c06f7308c86de775396ff", + "version" : "2.9.0" } }, { diff --git a/Package.resolved b/Package.resolved index 0ff5d7d..5664cae 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/aws-amplify/amplify-swift", "state" : { - "revision" : "cfdda779c9bc699447b84a8afd9c234ace4f5ffd", - "version" : "2.51.1" + "branch" : "fix/liveness-service-exception-callback", + "revision" : "304e2f8b5c96001a2d07a73725409f1acb619913" } }, { @@ -176,8 +176,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-log.git", "state" : { - "revision" : "3d8596ed08bd13520157f0355e35caed215ffbfa", - "version" : "1.6.3" + "revision" : "ce592ae52f982c847a4efc0dd881cc9eb32d29f2", + "version" : "1.6.4" } }, { @@ -230,8 +230,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-transport-services.git", "state" : { - "revision" : "e645014baea2ec1c2db564410c51a656cf47c923", - "version" : "1.25.1" + "revision" : "df6c28355051c72c884574a6c858bc54f7311ff9", + "version" : "1.25.2" } }, { @@ -248,8 +248,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "2547102afd04fe49f1b286090f13ebce07284980", - "version" : "1.31.1" + "revision" : "c6fe6442e6a64250495669325044052e113e990c", + "version" : "1.32.0" } }, { @@ -257,8 +257,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/swift-server/swift-service-lifecycle.git", "state" : { - "revision" : "e7187309187695115033536e8fc9b2eb87fd956d", - "version" : "2.8.0" + "revision" : "0fcc4c9c2d58dd98504c06f7308c86de775396ff", + "version" : "2.9.0" } }, { diff --git a/Package.swift b/Package.swift index 6180ebb..c83ab7a 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", from: "2.51.0") + .package(url: "https://github.com/aws-amplify/amplify-swift", branch: "fix/liveness-service-exception-callback") ], targets: [ .target( From e0272dd2a17b54737ec1c23c6e2b01348e36f157 Mon Sep 17 00:00:00 2001 From: Abhash Kumar Singh Date: Fri, 10 Oct 2025 11:40:56 -0700 Subject: [PATCH 3/5] update host app --- .../xcshareddata/swiftpm/Package.resolved | 6 +++--- HostApp/HostApp/Views/ExampleLivenessView.swift | 2 ++ HostApp/HostApp/Views/LivenessCheckErrorContentView.swift | 5 +++++ Package.resolved | 6 +++--- .../Views/Liveness/FaceLivenessDetectionViewModel.swift | 5 +++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/HostApp/HostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/HostApp/HostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 5664cae..ebc32c3 100644 --- a/HostApp/HostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/HostApp/HostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,7 +6,7 @@ "location" : "https://github.com/aws-amplify/amplify-swift", "state" : { "branch" : "fix/liveness-service-exception-callback", - "revision" : "304e2f8b5c96001a2d07a73725409f1acb619913" + "revision" : "4c96097c55f837bb944fb06e6e18be2147ed99f5" } }, { @@ -95,8 +95,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-argument-parser.git", "state" : { - "revision" : "309a47b2b1d9b5e991f36961c983ecec72275be3", - "version" : "1.6.1" + "revision" : "cdd0ef3755280949551dc26dee5de9ddeda89f54", + "version" : "1.6.2" } }, { diff --git a/HostApp/HostApp/Views/ExampleLivenessView.swift b/HostApp/HostApp/Views/ExampleLivenessView.swift index 03e4dd5..55226d8 100644 --- a/HostApp/HostApp/Views/ExampleLivenessView.swift +++ b/HostApp/HostApp/Views/ExampleLivenessView.swift @@ -93,6 +93,8 @@ struct ExampleLivenessView: View { LivenessCheckErrorContentView.invalidSignature case .cameraNotAvailable: LivenessCheckErrorContentView.cameraNotAvailable + case .validation: + LivenessCheckErrorContentView.validation default: LivenessCheckErrorContentView.unexpected } diff --git a/HostApp/HostApp/Views/LivenessCheckErrorContentView.swift b/HostApp/HostApp/Views/LivenessCheckErrorContentView.swift index 866c2c1..4237cc6 100644 --- a/HostApp/HostApp/Views/LivenessCheckErrorContentView.swift +++ b/HostApp/HostApp/Views/LivenessCheckErrorContentView.swift @@ -55,6 +55,11 @@ extension LivenessCheckErrorContentView { name: "The signature on the request is invalid.", description: "Ensure the device time is correct and try again." ) + + static let validation = LivenessCheckErrorContentView( + name: "The input fails to satisfy the constraints specified by the service.", + description: "Please try again." + ) static let cameraNotAvailable = LivenessCheckErrorContentView( name: "The camera could not be started.", diff --git a/Package.resolved b/Package.resolved index 5664cae..ebc32c3 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,7 +6,7 @@ "location" : "https://github.com/aws-amplify/amplify-swift", "state" : { "branch" : "fix/liveness-service-exception-callback", - "revision" : "304e2f8b5c96001a2d07a73725409f1acb619913" + "revision" : "4c96097c55f837bb944fb06e6e18be2147ed99f5" } }, { @@ -95,8 +95,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-argument-parser.git", "state" : { - "revision" : "309a47b2b1d9b5e991f36961c983ecec72275be3", - "version" : "1.6.1" + "revision" : "cdd0ef3755280949551dc26dee5de9ddeda89f54", + "version" : "1.6.2" } }, { diff --git a/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionViewModel.swift b/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionViewModel.swift index f1a3d0c..421c563 100644 --- a/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionViewModel.swift +++ b/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionViewModel.swift @@ -117,7 +117,8 @@ class FaceLivenessDetectionViewModel: ObservableObject { } case .unexpectedClosure(let error): DispatchQueue.main.async { - // known liveness errors already set `livenessState` + // known liveness/rekognition service exceptions set the `livenessState` and + // invoke onCompletion() callback directly guard !error.isKnownLivenessError() else { return } self?.livenessState.unrecoverableStateEncountered(.socketClosed) } @@ -222,7 +223,7 @@ class FaceLivenessDetectionViewModel: ObservableObject { try livenessService?.initializeLivenessStream( withSessionID: sessionID, userAgent: UserAgentValues.standard().userAgentString, - challenges: [challengeOptions.faceMovementChallengeOption.challenge, + challenges: [//challengeOptions.faceMovementChallengeOption.challenge, challengeOptions.faceMovementAndLightChallengeOption.challenge], options: .init( attemptCount: Self.attemptCount, From 3dea73663b206415c8450f38470657c624ab7ebb Mon Sep 17 00:00:00 2001 From: Abhash Kumar Singh Date: Fri, 10 Oct 2025 11:42:57 -0700 Subject: [PATCH 4/5] update code --- .../Views/Liveness/FaceLivenessDetectionViewModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionViewModel.swift b/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionViewModel.swift index 421c563..21ad7f6 100644 --- a/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionViewModel.swift +++ b/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionViewModel.swift @@ -223,7 +223,7 @@ class FaceLivenessDetectionViewModel: ObservableObject { try livenessService?.initializeLivenessStream( withSessionID: sessionID, userAgent: UserAgentValues.standard().userAgentString, - challenges: [//challengeOptions.faceMovementChallengeOption.challenge, + challenges: [challengeOptions.faceMovementChallengeOption.challenge, challengeOptions.faceMovementAndLightChallengeOption.challenge], options: .init( attemptCount: Self.attemptCount, From 2dccec5b2552f8c75b287e93d05caa5c464f0906 Mon Sep 17 00:00:00 2001 From: Abhash Kumar Singh Date: Mon, 13 Oct 2025 12:43:25 -0700 Subject: [PATCH 5/5] update amplify dependency --- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 4 ++-- Package.resolved | 4 ++-- Package.swift | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/HostApp/HostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/HostApp/HostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index ebc32c3..a6ccbdc 100644 --- a/HostApp/HostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/HostApp/HostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/aws-amplify/amplify-swift", "state" : { - "branch" : "fix/liveness-service-exception-callback", - "revision" : "4c96097c55f837bb944fb06e6e18be2147ed99f5" + "revision" : "c5a33cad99211150814183a2242d182dfd28fa2a", + "version" : "2.51.2" } }, { diff --git a/Package.resolved b/Package.resolved index ebc32c3..a6ccbdc 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/aws-amplify/amplify-swift", "state" : { - "branch" : "fix/liveness-service-exception-callback", - "revision" : "4c96097c55f837bb944fb06e6e18be2147ed99f5" + "revision" : "c5a33cad99211150814183a2242d182dfd28fa2a", + "version" : "2.51.2" } }, { diff --git a/Package.swift b/Package.swift index c83ab7a..298149e 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", branch: "fix/liveness-service-exception-callback") + .package(url: "https://github.com/aws-amplify/amplify-swift", from: "2.51.2") ], targets: [ .target(