Skip to content

Commit 6240b60

Browse files
committed
chore: update code to support Amplify 2.45.0
1 parent e763a80 commit 6240b60

File tree

7 files changed

+57
-14
lines changed

7 files changed

+57
-14
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 1.2.2 (2024-11-26)
4+
5+
### Misc. Updates
6+
- Updating code to support Amplify 2.45+
7+
38
## 1.2.1 (2024-11-21)
49

510
### Misc. Updates

Package.resolved

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ let package = Package(
1313
targets: ["Authenticator"]),
1414
],
1515
dependencies: [
16-
.package(url: "https://github.com/aws-amplify/amplify-swift", "2.44.0"..<"2.45.0")
16+
.package(url: "https://github.com/aws-amplify/amplify-swift", from: "2.45.0")
1717
],
1818
targets: [
1919
.target(

Sources/Authenticator/Constants/ComponentInformation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
import Foundation
99

1010
public class ComponentInformation {
11-
public static let version = "1.2.1"
11+
public static let version = "1.2.2"
1212
public static let name = "amplify-ui-swift-authenticator"
1313
}

Sources/Authenticator/States/AuthenticatorBaseState.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ public class AuthenticatorBaseState: ObservableObject {
147147
credentials.message = self.error(for: error)
148148
return .signIn
149149
}
150+
default:
151+
throw AuthError.unknown("Unsupported next step: \(result.nextStep)", nil)
150152
}
151153
}
152154

Tests/AuthenticatorHostApp/AuthenticatorHostApp/Mocks/MockAuthenticationService.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ class MockAuthenticationService: AuthenticationService {
3939
throw AuthenticatorError.error(message: "Unable to confirm sign in")
4040
}
4141

42+
func autoSignIn() async throws -> AuthSignInResult {
43+
fatalError("Unsupported operation in Authenticator")
44+
}
45+
4246
var mockedCurrentUser: AuthUser?
4347
func getCurrentUser() async throws -> AuthUser {
4448
if let mockedCurrentUser = mockedCurrentUser {
@@ -195,6 +199,20 @@ class MockAuthenticationService: AuthenticationService {
195199
func verifyTOTPSetup(code: String, options: VerifyTOTPSetupRequest.Options?) async throws {
196200

197201
}
202+
203+
// MARK: - WebAuthn
204+
205+
func associateWebAuthnCredential(presentationAnchor: AuthUIPresentationAnchor?, options: AuthAssociateWebAuthnCredentialRequest.Options?) async throws {
206+
fatalError("Unsupported operation in Authenticator")
207+
}
208+
209+
func listWebAuthnCredentials(options: AuthListWebAuthnCredentialsRequest.Options?) async throws -> AuthListWebAuthnCredentialsResult {
210+
fatalError("Unsupported operation in Authenticator")
211+
}
212+
213+
func deleteWebAuthnCredential(credentialId: String, options: AuthDeleteWebAuthnCredentialRequest.Options?) async throws {
214+
fatalError("Unsupported operation in Authenticator")
215+
}
198216
}
199217

200218
extension MockAuthenticationService {

Tests/AuthenticatorTests/Mocks/MockAuthenticationService.swift

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ class MockAuthenticationService: AuthenticationService {
3535
throw AuthenticatorError.error(message: "Unable to confirm sign in")
3636
}
3737

38+
func autoSignIn() async throws -> AuthSignInResult {
39+
fatalError("Unsupported operation in Authenticator")
40+
}
41+
3842
var mockedCurrentUser: AuthUser?
3943
func getCurrentUser() async throws -> AuthUser {
4044
if let mockedCurrentUser = mockedCurrentUser {
@@ -74,7 +78,7 @@ class MockAuthenticationService: AuthenticationService {
7478
func signUp(username: String, password: String?, options: AuthSignUpRequest.Options?) async throws -> AuthSignUpResult {
7579
signUpCount += 1
7680
signUpParams = (username, password)
77-
81+
7882
if let mockedSignUpResult = mockedSignUpResult {
7983
return mockedSignUpResult
8084
}
@@ -188,14 +192,28 @@ class MockAuthenticationService: AuthenticationService {
188192
func forgetDevice(_ device: AuthDevice?, options: AuthForgetDeviceRequest.Options?) async throws {}
189193

190194
func rememberDevice(options: AuthRememberDeviceRequest.Options?) async throws {}
191-
195+
192196
// MARK: - TOTP
193-
197+
194198
func setUpTOTP() async throws -> TOTPSetupDetails {
195199
return .init(sharedSecret: "", username: "")
196200
}
197-
201+
198202
func verifyTOTPSetup(code: String, options: VerifyTOTPSetupRequest.Options?) async throws {}
203+
204+
// MARK: - WebAuthn
205+
206+
func associateWebAuthnCredential(presentationAnchor: AuthUIPresentationAnchor?, options: AuthAssociateWebAuthnCredentialRequest.Options?) async throws {
207+
fatalError("Unsupported operation in Authenticator")
208+
}
209+
210+
func listWebAuthnCredentials(options: AuthListWebAuthnCredentialsRequest.Options?) async throws -> AuthListWebAuthnCredentialsResult {
211+
fatalError("Unsupported operation in Authenticator")
212+
}
213+
214+
func deleteWebAuthnCredential(credentialId: String, options: AuthDeleteWebAuthnCredentialRequest.Options?) async throws {
215+
fatalError("Unsupported operation in Authenticator")
216+
}
199217
}
200218

201219
extension MockAuthenticationService {

0 commit comments

Comments
 (0)