diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index e3e8a5d..fa12d2c 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -8,11 +8,11 @@ on: jobs: unit-test-ios: - runs-on: macos-latest + runs-on: macos-15 steps: - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Unit test Authenticator on iOS - run: xcodebuild test -scheme Authenticator -sdk 'iphonesimulator' -destination 'platform=iOS Simulator,name=iPhone 14,OS=latest' -derivedDataPath Build/ -enableCodeCoverage YES -clonedSourcePackagesDirPath ~/Library/Developer/Xcode/DerivedData/Authenticator | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} + run: xcodebuild test -scheme Authenticator -sdk 'iphonesimulator' -destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' -derivedDataPath Build/ -enableCodeCoverage YES -clonedSourcePackagesDirPath ~/Library/Developer/Xcode/DerivedData/Authenticator | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} - name: Generate Coverage Report continue-on-error: true run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 99ef20d..6d98c3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.2.2 (2024-11-26) + +### Misc. Updates +- Updating code to support Amplify 2.45+ + ## 1.2.1 (2024-11-21) ### Misc. Updates diff --git a/Package.resolved b/Package.resolved index 9247b1d..eb5c4ad 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/aws-amplify/amplify-swift", "state" : { - "revision" : "aef29d1665f9fad1c88fa6a781b8c847913dd7c6", - "version" : "2.44.0" + "revision" : "e43c65c2840c4b0a05d604125c8aedf97e16de89", + "version" : "2.45.0" } }, { @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-crt-swift", "state" : { - "revision" : "7b42e0343f28b3451aab20840dc670abd12790bd", - "version" : "0.36.0" + "revision" : "3f844bef042cc0a4c3381f7090414ce3f9a7e935", + "version" : "0.37.0" } }, { @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-sdk-swift.git", "state" : { - "revision" : "828358a2c39d138325b0f87a2d813f4b972e5f4f", - "version" : "1.0.0" + "revision" : "c6c1064da9bfccb119a7a8ab9ba636fb3bbfa6f5", + "version" : "1.0.47" } }, { @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/smithy-lang/smithy-swift", "state" : { - "revision" : "0ed3440f8c41e27a0937364d5035d2d4fefb8aa3", - "version" : "0.71.0" + "revision" : "3cd9f181b3ba8ff71da43bf53c09f8de6790a4ad", + "version" : "0.96.0" } }, { diff --git a/Package.swift b/Package.swift index 3f7756c..45df5fa 100644 --- a/Package.swift +++ b/Package.swift @@ -13,7 +13,7 @@ let package = Package( targets: ["Authenticator"]), ], dependencies: [ - .package(url: "https://github.com/aws-amplify/amplify-swift", "2.44.0"..<"2.45.0") + .package(url: "https://github.com/aws-amplify/amplify-swift", from: "2.45.0") ], targets: [ .target( diff --git a/Sources/Authenticator/Constants/ComponentInformation.swift b/Sources/Authenticator/Constants/ComponentInformation.swift index 4b8034b..fca0be0 100644 --- a/Sources/Authenticator/Constants/ComponentInformation.swift +++ b/Sources/Authenticator/Constants/ComponentInformation.swift @@ -8,6 +8,6 @@ import Foundation public class ComponentInformation { - public static let version = "1.2.1" + public static let version = "1.2.2" public static let name = "amplify-ui-swift-authenticator" } diff --git a/Sources/Authenticator/States/AuthenticatorBaseState.swift b/Sources/Authenticator/States/AuthenticatorBaseState.swift index 5b3a243..127593f 100644 --- a/Sources/Authenticator/States/AuthenticatorBaseState.swift +++ b/Sources/Authenticator/States/AuthenticatorBaseState.swift @@ -147,6 +147,8 @@ public class AuthenticatorBaseState: ObservableObject { credentials.message = self.error(for: error) return .signIn } + default: + throw AuthError.unknown("Unsupported next step: \(result.nextStep)", nil) } } diff --git a/Tests/AuthenticatorHostApp/AuthenticatorHostApp/Mocks/MockAuthenticationService.swift b/Tests/AuthenticatorHostApp/AuthenticatorHostApp/Mocks/MockAuthenticationService.swift index 4dc25d9..3b52bb8 100644 --- a/Tests/AuthenticatorHostApp/AuthenticatorHostApp/Mocks/MockAuthenticationService.swift +++ b/Tests/AuthenticatorHostApp/AuthenticatorHostApp/Mocks/MockAuthenticationService.swift @@ -39,6 +39,10 @@ class MockAuthenticationService: AuthenticationService { throw AuthenticatorError.error(message: "Unable to confirm sign in") } + func autoSignIn() async throws -> AuthSignInResult { + fatalError("Unsupported operation in Authenticator") + } + var mockedCurrentUser: AuthUser? func getCurrentUser() async throws -> AuthUser { if let mockedCurrentUser = mockedCurrentUser { @@ -195,6 +199,20 @@ class MockAuthenticationService: AuthenticationService { func verifyTOTPSetup(code: String, options: VerifyTOTPSetupRequest.Options?) async throws { } + + // MARK: - WebAuthn + + func associateWebAuthnCredential(presentationAnchor: AuthUIPresentationAnchor?, options: AuthAssociateWebAuthnCredentialRequest.Options?) async throws { + fatalError("Unsupported operation in Authenticator") + } + + func listWebAuthnCredentials(options: AuthListWebAuthnCredentialsRequest.Options?) async throws -> AuthListWebAuthnCredentialsResult { + fatalError("Unsupported operation in Authenticator") + } + + func deleteWebAuthnCredential(credentialId: String, options: AuthDeleteWebAuthnCredentialRequest.Options?) async throws { + fatalError("Unsupported operation in Authenticator") + } } extension MockAuthenticationService { diff --git a/Tests/AuthenticatorTests/Mocks/MockAuthenticationService.swift b/Tests/AuthenticatorTests/Mocks/MockAuthenticationService.swift index 3dbb89f..41daf82 100644 --- a/Tests/AuthenticatorTests/Mocks/MockAuthenticationService.swift +++ b/Tests/AuthenticatorTests/Mocks/MockAuthenticationService.swift @@ -35,6 +35,10 @@ class MockAuthenticationService: AuthenticationService { throw AuthenticatorError.error(message: "Unable to confirm sign in") } + func autoSignIn() async throws -> AuthSignInResult { + fatalError("Unsupported operation in Authenticator") + } + var mockedCurrentUser: AuthUser? func getCurrentUser() async throws -> AuthUser { if let mockedCurrentUser = mockedCurrentUser { @@ -74,7 +78,7 @@ class MockAuthenticationService: AuthenticationService { func signUp(username: String, password: String?, options: AuthSignUpRequest.Options?) async throws -> AuthSignUpResult { signUpCount += 1 signUpParams = (username, password) - + if let mockedSignUpResult = mockedSignUpResult { return mockedSignUpResult } @@ -188,14 +192,28 @@ class MockAuthenticationService: AuthenticationService { func forgetDevice(_ device: AuthDevice?, options: AuthForgetDeviceRequest.Options?) async throws {} func rememberDevice(options: AuthRememberDeviceRequest.Options?) async throws {} - + // MARK: - TOTP - + func setUpTOTP() async throws -> TOTPSetupDetails { return .init(sharedSecret: "", username: "") } - + func verifyTOTPSetup(code: String, options: VerifyTOTPSetupRequest.Options?) async throws {} + + // MARK: - WebAuthn + + func associateWebAuthnCredential(presentationAnchor: AuthUIPresentationAnchor?, options: AuthAssociateWebAuthnCredentialRequest.Options?) async throws { + fatalError("Unsupported operation in Authenticator") + } + + func listWebAuthnCredentials(options: AuthListWebAuthnCredentialsRequest.Options?) async throws -> AuthListWebAuthnCredentialsResult { + fatalError("Unsupported operation in Authenticator") + } + + func deleteWebAuthnCredential(credentialId: String, options: AuthDeleteWebAuthnCredentialRequest.Options?) async throws { + fatalError("Unsupported operation in Authenticator") + } } extension MockAuthenticationService {