Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update code to support Amplify 2.45.0 #99

Merged
merged 2 commits into from
Nov 26, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
{
Expand All @@ -23,26 +23,26 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/awslabs/aws-crt-swift",
"state" : {
"revision" : "7b42e0343f28b3451aab20840dc670abd12790bd",
"version" : "0.36.0"
"revision" : "3f844bef042cc0a4c3381f7090414ce3f9a7e935",
"version" : "0.37.0"
}
},
{
"identity" : "aws-sdk-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/awslabs/aws-sdk-swift.git",
"state" : {
"revision" : "828358a2c39d138325b0f87a2d813f4b972e5f4f",
"version" : "1.0.0"
"revision" : "c6c1064da9bfccb119a7a8ab9ba636fb3bbfa6f5",
"version" : "1.0.47"
}
},
{
"identity" : "smithy-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/smithy-lang/smithy-swift",
"state" : {
"revision" : "0ed3440f8c41e27a0937364d5035d2d4fefb8aa3",
"version" : "0.71.0"
"revision" : "3cd9f181b3ba8ff71da43bf53c09f8de6790a4ad",
"version" : "0.96.0"
}
},
{
Expand Down
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