diff --git a/Package.resolved b/Package.resolved index e59e5e3..7dd2383 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/aws-amplify/amplify-swift.git", "state": { "branch": null, - "revision": "99c72db23217c8944dda92a9be26f7c0d0d5de3f", - "version": "2.37.0" + "revision": "9a4ce09141d5045b8dfe55cb301b0691e3341a00", + "version": "2.41.0" } }, { @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/awslabs/aws-crt-swift", "state": { "branch": null, - "revision": "0d0a0cf2e2cb780ceeceac190b4ede94f4f96902", - "version": "0.26.0" + "revision": "7b42e0343f28b3451aab20840dc670abd12790bd", + "version": "0.36.0" } }, { @@ -33,8 +33,8 @@ "repositoryURL": "https://github.com/awslabs/aws-sdk-swift.git", "state": { "branch": null, - "revision": "47922c05dd66be717c7bce424651a534456717b7", - "version": "0.36.2" + "revision": "828358a2c39d138325b0f87a2d813f4b972e5f4f", + "version": "1.0.0" } }, { @@ -51,8 +51,8 @@ "repositoryURL": "https://github.com/smithy-lang/smithy-swift", "state": { "branch": null, - "revision": "8a5b0105c1b8a1d26a9435fb0af3959a7f5de578", - "version": "0.41.1" + "revision": "0ed3440f8c41e27a0937364d5035d2d4fefb8aa3", + "version": "0.71.0" } }, { diff --git a/Package.swift b/Package.swift index 2a7f29e..597546c 100644 --- a/Package.swift +++ b/Package.swift @@ -23,7 +23,7 @@ let package = Package( .package( name: "Amplify", url: "https://github.com/aws-amplify/amplify-swift.git", - .upToNextMajor(from: "2.2.0") + .upToNextMajor(from: "2.41.0") ), // MapLibre diff --git a/Sources/AmplifyMapLibreAdapter/AWSMapURLProtocol+GeoConfig.swift b/Sources/AmplifyMapLibreAdapter/AWSMapURLProtocol+GeoConfig.swift index 6c96f72..236fc84 100644 --- a/Sources/AmplifyMapLibreAdapter/AWSMapURLProtocol+GeoConfig.swift +++ b/Sources/AmplifyMapLibreAdapter/AWSMapURLProtocol+GeoConfig.swift @@ -8,13 +8,13 @@ import Foundation import Amplify import AWSLocationGeoPlugin -import AWSClientRuntime import InternalAmplifyCredentials +import SmithyIdentity extension AWSMapURLProtocol { struct GeoConfig { let regionName: String - let credentialsProvider: CredentialsProviding + let identityResolver: any AWSCredentialIdentityResolver let hostName: String init?() { @@ -25,7 +25,7 @@ extension AWSMapURLProtocol { guard let credentiaslProvider = plugin.authService as? AWSAuthCredentialsProviderBehavior else { return nil } - self.credentialsProvider = credentiaslProvider.getCredentialsProvider() + self.identityResolver = credentiaslProvider.getCredentialIdentityResolver() self.regionName = plugin.pluginConfig.regionName self.hostName = "maps.geo.\(regionName).amazonaws.com" } diff --git a/Sources/AmplifyMapLibreAdapter/AWSMapURLProtocol.swift b/Sources/AmplifyMapLibreAdapter/AWSMapURLProtocol.swift index a0164de..e4607cf 100644 --- a/Sources/AmplifyMapLibreAdapter/AWSMapURLProtocol.swift +++ b/Sources/AmplifyMapLibreAdapter/AWSMapURLProtocol.swift @@ -9,12 +9,15 @@ import Foundation import ClientRuntime import AWSClientRuntime import AwsCommonRuntimeKit +import AWSSDKHTTPAuth +import SmithyHTTPAPI class AWSMapURLProtocol: URLProtocol { private var urlSession = URLSession(configuration: .default) private var dataTask: URLSessionDataTask? private static var globallyRegistered = false private static var geoConfig = GeoConfig() + private static let signer = AWSSigV4Signer() /// Register the custom URL Protocol. /// - Parameter sessionConfig: Optional URLSessionConfiguration for URLSession you want to proxy. @@ -86,7 +89,7 @@ class AWSMapURLProtocol: URLProtocol { return } - let requestBuilder = SdkHttpRequestBuilder() + let requestBuilder = HTTPRequestBuilder() .withHost(host) .withPath(originalURLComponents.path.urlPercentEncoding(encodeForwardSlash: false)) .withMethod(.get) @@ -98,9 +101,9 @@ class AWSMapURLProtocol: URLProtocol { var signedRequest = request signedRequest.url = originalURLComponents.url signedRequest.addValue(host, forHTTPHeaderField: "host") - guard let url = await AWSSigV4Signer.sigV4SignedURL( + guard let url = await Self.signer.sigV4SignedURL( requestBuilder: requestBuilder, - credentialsProvider: geoConfig.credentialsProvider, + awsCredentialIdentityResolver: geoConfig.identityResolver, signingName: "geo", signingRegion: geoConfig.regionName, date: Date(),