From c94c9d6825bdd32ba947bd7eaa91d4e98d28e5a6 Mon Sep 17 00:00:00 2001 From: Pramod Prajapati Date: Fri, 20 Sep 2024 12:33:14 +0530 Subject: [PATCH 1/2] Added region handling for creating correct streaming endpoint --- .../Liveness/SPI/LivenessStreamingURL.swift | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/SPI/LivenessStreamingURL.swift b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/SPI/LivenessStreamingURL.swift index 93ee45ad3c..122349ae8e 100644 --- a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/SPI/LivenessStreamingURL.swift +++ b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/SPI/LivenessStreamingURL.swift @@ -7,8 +7,20 @@ import Foundation +private let ISO_PARTITION_BASE_DOMAIN: String = "csp.hci.ic.gov" +private let DEFAULT_BASE_DOMAIN: String = "amazonaws.com" + func streamingSessionURL(for region: String) throws -> URL { - let urlString = "wss://streaming-rekognition.\(region).amazonaws.com/start-face-liveness-session-websocket" + + // Determine the base domain based on the region + let baseDomain: String + if region.lowercased().starts(with: "us-isof") { + baseDomain = ISO_PARTITION_BASE_DOMAIN + } else { + baseDomain = DEFAULT_BASE_DOMAIN + } + + let urlString = "wss://streaming-rekognition.\(region).\(baseDomain)/start-face-liveness-session-websocket" guard let url = URL(string: urlString) else { throw FaceLivenessSessionError.invalidRegion } From e1e7dfe885e9f7e5ce757c9575db1ccfe6ace949 Mon Sep 17 00:00:00 2001 From: Pramod Prajapati Date: Fri, 20 Sep 2024 12:33:14 +0530 Subject: [PATCH 2/2] Added region handling for creating correct streaming endpoint --- .../Liveness/SPI/LivenessStreamingURL.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/SPI/LivenessStreamingURL.swift b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/SPI/LivenessStreamingURL.swift index 122349ae8e..15c25593d2 100644 --- a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/SPI/LivenessStreamingURL.swift +++ b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/SPI/LivenessStreamingURL.swift @@ -7,17 +7,17 @@ import Foundation -private let ISO_PARTITION_BASE_DOMAIN: String = "csp.hci.ic.gov" -private let DEFAULT_BASE_DOMAIN: String = "amazonaws.com" +private let isoPartitionBaseDomain: String = "csp.hci.ic.gov" +private let defaultBaseDomain: String = "amazonaws.com" func streamingSessionURL(for region: String) throws -> URL { // Determine the base domain based on the region let baseDomain: String if region.lowercased().starts(with: "us-isof") { - baseDomain = ISO_PARTITION_BASE_DOMAIN + baseDomain = isoPartitionBaseDomain } else { - baseDomain = DEFAULT_BASE_DOMAIN + baseDomain = defaultBaseDomain } let urlString = "wss://streaming-rekognition.\(region).\(baseDomain)/start-face-liveness-session-websocket"