Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 8 additions & 8 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
2 changes: 2 additions & 0 deletions Sources/Authenticator/States/AuthenticatorBaseState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
26 changes: 22 additions & 4 deletions Tests/AuthenticatorTests/Mocks/MockAuthenticationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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 {
Expand Down
Loading