Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,3 @@ class AppleDeleteUserOperation: AuthenticatedOperation,
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,18 @@ extension ASAuthorizationAppleIDCredential {

// MARK: - Authenticate With Apple Dialog

private func authenticateWithApple(
scopes: [ASAuthorization.Scope]
) async throws -> (ASAuthorizationAppleIDCredential, String) {
private func authenticateWithApple(scopes: [ASAuthorization.Scope]) async throws -> (
ASAuthorizationAppleIDCredential,
String
) {
return try await AuthenticateWithAppleDialog(scopes: scopes).authenticate()
}

private class AuthenticateWithAppleDialog: NSObject {
private var continuation: CheckedContinuation<(ASAuthorizationAppleIDCredential, String), Error>?
private var currentNonce: String?
private let scopes: [ASAuthorization.Scope]

init(scopes: [ASAuthorization.Scope]) {
self.scopes = scopes
super.init()
Expand Down Expand Up @@ -80,10 +81,8 @@ private class AuthenticateWithAppleDialog: NSObject {
}

extension AuthenticateWithAppleDialog: ASAuthorizationControllerDelegate {
func authorizationController(
controller: ASAuthorizationController,
didCompleteWithAuthorization authorization: ASAuthorization
) {
func authorizationController(controller _: ASAuthorizationController,
didCompleteWithAuthorization authorization: ASAuthorization) {
if let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential {
if let nonce = currentNonce {
continuation?.resume(returning: (appleIDCredential, nonce))
Expand All @@ -106,10 +105,8 @@ extension AuthenticateWithAppleDialog: ASAuthorizationControllerDelegate {
continuation = nil
}

func authorizationController(
controller: ASAuthorizationController,
didCompleteWithError error: Error
) {
func authorizationController(controller _: ASAuthorizationController,
didCompleteWithError error: Error) {
continuation?.resume(throwing: AuthServiceError.signInFailed(underlying: error))
continuation = nil
}
Expand Down Expand Up @@ -160,4 +157,3 @@ public class AppleProviderAuthUI: AuthProviderUI {
AnyView(SignInWithAppleButton(provider: provider))
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ public extension AuthService {
return self
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import Foundation
import CryptoKit
import Foundation

/// Set of utility APIs for generating cryptographical artifacts.
enum CryptoUtils {
Expand Down Expand Up @@ -50,4 +50,3 @@ enum CryptoUtils {
return hashString
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extension SignInWithAppleButton: View {
public var body: some View {
Button(action: {
Task {
try await authService.signIn(provider)
try? await authService.signIn(provider)
}
}) {
HStack {
Expand All @@ -51,4 +51,3 @@ extension SignInWithAppleButton: View {
.accessibilityIdentifier("sign-in-with-apple-button")
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ import Testing
@Test func example() async throws {
// Write your test here and use APIs like `#expect(...)` to check expected conditions.
}

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public struct EnrollmentSession {
public let expiresAt: Date

// Internal handle to finish TOTP
internal let _totpSecret: AnyObject?
let _totpSecret: AnyObject?

public enum EnrollmentStatus {
case initiated
Expand Down Expand Up @@ -111,4 +111,4 @@ public struct MFARequired {
public init(hints: [MFAHint]) {
self.hints = hints
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public enum AuthServiceError: LocalizedError {
case invalidPhoneAuthenticationArguments(String)
case providerNotFound(String)
case multiFactorAuth(String)


public var errorDescription: String? {
switch self {
Expand All @@ -62,7 +61,7 @@ public enum AuthServiceError: LocalizedError {
case let .providerNotFound(description):
return description
case let .invalidPhoneAuthenticationArguments(description):
return description
return description
case let .multiFactorAuth(description):
return description
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public struct AuthConfiguration {
public let emailLinkSignInActionCodeSettings: ActionCodeSettings?
public let verifyEmailActionCodeSettings: ActionCodeSettings?

// MARK: - MFA Configuration
// MARK: - MFA Configuration

public let mfaEnabled: Bool
public let allowedSecondFactors: Set<SecondFactorType>
Expand Down
Loading
Loading