Skip to content

Commit f4c015b

Browse files
authored
chore: Upgrading to Amplify 2.16+ (#38)
1 parent 7b068bb commit f4c015b

File tree

7 files changed

+28
-9
lines changed

7 files changed

+28
-9
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.0.6 (2023-09-14)
4+
5+
### Misc. Updates
6+
- Updating code to support Amplify 2.16+. However, **TOTP** workflows are **not** yet supported.
7+
38
## 1.0.5 (2023-08-31)
49

510
### Bug Fixes

Package.resolved

Lines changed: 6 additions & 6 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.8.1"..<"2.16.0"),
16+
.package(url: "https://github.com/aws-amplify/amplify-swift", from: "2.16.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.0.5"
11+
public static let version = "1.0.6"
1212
public static let name = "amplify-ui-swift-authenticator"
1313
}

Sources/Authenticator/Models/AuthenticatorState.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class AuthenticatorState: ObservableObject, AuthenticatorStateProtocol {
5858
}
5959

6060
func setCurrentStep(_ step: Step) {
61-
if case .error(let error) = step {
61+
if case .error(let error) = self.step {
6262
log.error(error)
6363
log.error("Cannot move to \(step), the Authenticator is in error state.")
6464
return

Sources/Authenticator/States/AuthenticatorBaseState.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ public class AuthenticatorBaseState: ObservableObject {
104104
log.verbose("User has attributes pending verification: \(unverifiedAttributes)")
105105
return .verifyUser(attributes: unverifiedAttributes)
106106
}
107+
case .confirmSignInWithTOTPCode,
108+
.continueSignInWithTOTPSetup(_):
109+
log.error("The Authenticator does not yet support TOTP workflows.")
110+
fallthrough
111+
default:
112+
throw AuthError.unknown("Unsupported next step: \(result.nextStep)", nil)
107113
}
108114
}
109115

Tests/AuthenticatorTests/Mocks/MockAuthenticationService.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@ class MockAuthenticationService: AuthenticationService {
177177
func forgetDevice(_ device: AuthDevice?, options: AuthForgetDeviceRequest.Options?) async throws {}
178178

179179
func rememberDevice(options: AuthRememberDeviceRequest.Options?) async throws {}
180+
181+
// MARK: - TOTP
182+
183+
func setUpTOTP() async throws -> TOTPSetupDetails {
184+
return .init(sharedSecret: "", username: "")
185+
}
186+
187+
func verifyTOTPSetup(code: String, options: VerifyTOTPSetupRequest.Options?) async throws {}
180188
}
181189

182190
extension MockAuthenticationService {

0 commit comments

Comments
 (0)