From c959f1bdd364f3df62f2e445f7c6504ae545f759 Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Wed, 7 Feb 2024 08:25:52 -0800 Subject: [PATCH] [auth-swift] Modernize Auth API docs (#12353) --- .github/workflows/auth.yml | 5 +- .../Swift/ActionCode/ActionCodeInfo.swift | 26 +- .../ActionCode/ActionCodeOperation.swift | 18 +- .../Swift/ActionCode/ActionCodeSettings.swift | 68 +- .../Swift/ActionCode/ActionCodeURL.swift | 36 +- FirebaseAuth/Sources/Swift/Auth/Auth.swift | 1568 +++++++---------- .../Sources/Swift/Auth/AuthDataResult.swift | 36 +- .../Sources/Swift/Auth/AuthDispatcher.swift | 26 +- .../Swift/Auth/AuthOperationType.swift | 21 +- .../Sources/Swift/Auth/AuthSettings.swift | 10 +- .../Sources/Swift/Auth/AuthTokenResult.swift | 61 +- .../Swift/AuthProvider/AuthCredential.swift | 6 +- .../AuthProvider/AuthProviderStrings.swift | 1 + .../AuthProvider/EmailAuthProvider.swift | 27 +- .../AuthProvider/FacebookAuthProvider.swift | 14 +- .../AuthProvider/FederatedAuthProvider.swift | 15 +- .../AuthProvider/GameCenterAuthProvider.swift | 38 +- .../AuthProvider/GitHubAuthProvider.swift | 14 +- .../AuthProvider/GoogleAuthProvider.swift | 20 +- .../Swift/AuthProvider/OAuthCredential.swift | 18 +- .../Swift/AuthProvider/OAuthProvider.swift | 182 +- .../AuthProvider/PhoneAuthCredential.swift | 7 +- .../AuthProvider/PhoneAuthProvider.swift | 183 +- .../AuthProvider/TwitterAuthProvider.swift | 16 +- .../Sources/Swift/Backend/AuthBackend.swift | 62 +- .../Swift/Backend/AuthRPCResponse.swift | 22 +- .../Backend/AuthRequestConfiguration.swift | 36 +- .../Backend/IdentityToolkitRequest.swift | 12 +- .../Backend/RPC/CreateAuthURIRequest.swift | 76 +- .../Backend/RPC/CreateAuthURIResponse.swift | 30 +- .../Backend/RPC/DeleteAccountRequest.swift | 23 +- .../Backend/RPC/DeleteAccountResponse.swift | 7 +- .../Backend/RPC/EmailLinkSignInRequest.swift | 33 +- .../Backend/RPC/EmailLinkSignInResponse.swift | 34 +- .../Backend/RPC/GetAccountInfoRequest.swift | 29 +- .../Backend/RPC/GetAccountInfoResponse.swift | 105 +- .../RPC/GetOOBConfirmationCodeRequest.swift | 173 +- .../Backend/RPC/GetProjectConfigRequest.swift | 5 +- .../RPC/GetRecaptchaConfigRequest.swift | 34 +- .../Enroll/FinalizeMFAEnrollmentRequest.swift | 4 +- .../Enroll/StartMFAEnrollmentRequest.swift | 4 +- .../SignIn/FinalizeMFASignInRequest.swift | 4 +- .../SignIn/StartMFASignInRequest.swift | 5 +- .../Unenroll/WithdrawMFARequest.swift | 4 +- .../AuthProtoStartMFAPhoneRequestInfo.swift | 16 +- ...otoStartMFATOTPEnrollmentRequestInfo.swift | 6 +- .../Backend/RPC/ResetPasswordRequest.swift | 35 +- .../Backend/RPC/ResetPasswordResponse.swift | 32 +- .../Backend/RPC/RevokeTokenRequest.swift | 43 +- .../Backend/RPC/SecureTokenRequest.swift | 66 +- .../Backend/RPC/SecureTokenResponse.swift | 15 +- .../RPC/SendVerificationTokenRequest.swift | 33 +- .../Backend/RPC/SetAccountInfoRequest.swift | 147 +- .../Backend/RPC/SetAccountInfoResponse.swift | 58 +- .../RPC/SignInWithGameCenterRequest.swift | 60 +- .../Backend/RPC/SignUpNewUserRequest.swift | 78 +- .../Backend/RPC/SignUpNewUserResponse.swift | 16 +- .../Backend/RPC/VerifyAssertionRequest.swift | 163 +- .../Backend/RPC/VerifyAssertionResponse.swift | 160 +- .../RPC/VerifyCustomTokenRequest.swift | 16 +- .../RPC/VerifyCustomTokenResponse.swift | 24 +- .../Backend/RPC/VerifyPasswordRequest.swift | 79 +- .../Backend/RPC/VerifyPasswordResponse.swift | 47 +- .../RPC/VerifyPhoneNumberRequest.swift | 90 +- .../RPC/VerifyPhoneNumberResponse.swift | 33 +- .../Swift/MultiFactor/MultiFactor.swift | 75 +- .../MultiFactor/MultiFactorAssertion.swift | 13 +- .../Swift/MultiFactor/MultiFactorInfo.swift | 23 +- .../MultiFactor/MultiFactorResolver.swift | 43 +- .../MultiFactor/MultiFactorSession.swift | 35 +- .../Phone/PhoneMultiFactorAssertion.swift | 9 +- .../Phone/PhoneMultiFactorGenerator.swift | 21 +- .../Phone/PhoneMultiFactorInfo.swift | 24 +- .../TOTP/TOTPMultFactorAssertion.swift | 9 +- .../TOTP/TOTPMultiFactorGenerator.swift | 62 +- .../TOTP/TOTPMultiFactorInfo.swift | 23 +- .../Swift/MultiFactor/TOTP/TOTPSecret.swift | 65 +- .../Swift/Storage/AuthKeychainServices.swift | 72 +- .../Swift/Storage/AuthKeychainStorage.swift | 5 +- .../Storage/AuthKeychainStorageReal.swift | 5 +- .../Swift/Storage/AuthUserDefaults.swift | 21 +- .../Swift/SystemService/AuthAPNSToken.swift | 18 +- .../SystemService/AuthAPNSTokenManager.swift | 51 +- .../SystemService/AuthAPNSTokenType.swift | 20 +- .../SystemService/AuthAppCredential.swift | 23 +- .../AuthAppCredentialManager.swift | 28 +- .../AuthNotificationManager.swift | 85 +- .../SystemService/SecureTokenService.swift | 78 +- .../Swift/User/AdditionalUserInfo.swift | 18 +- FirebaseAuth/Sources/Swift/User/User.swift | 1158 +++++------- .../Sources/Swift/User/UserInfo.swift | 31 +- .../Sources/Swift/User/UserInfoImpl.swift | 26 +- .../Sources/Swift/User/UserMetadata.swift | 13 +- .../Swift/User/UserProfileChangeRequest.swift | 42 +- .../Utilities/AuthDefaultUIDelegate.swift | 15 +- .../Swift/Utilities/AuthErrorUtils.swift | 22 +- .../Sources/Swift/Utilities/AuthErrors.swift | 921 +++------- .../Swift/Utilities/AuthInternalErrors.swift | 124 +- .../Swift/Utilities/AuthUIDelegate.swift | 33 +- .../Swift/Utilities/AuthURLPresenter.swift | 66 +- .../Swift/Utilities/AuthWebUtils.swift | 6 +- .../Sources/Swift/Utilities/AuthWebView.swift | 4 +- .../Utilities/AuthWebViewController.swift | 39 +- .../AuthBackendRPCImplentationTests.swift | 2 +- 104 files changed, 2830 insertions(+), 4833 deletions(-) diff --git a/.github/workflows/auth.yml b/.github/workflows/auth.yml index a4627ff26cc..7a66d131cef 100644 --- a/.github/workflows/auth.yml +++ b/.github/workflows/auth.yml @@ -58,7 +58,7 @@ jobs: env: plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }} - runs-on: macos-12 + runs-on: macos-13 steps: - uses: actions/checkout@v4 - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126 @@ -85,7 +85,8 @@ jobs: FirebaseAuth/Tests/SampleSwift/Sample.entitlements "$plist_secret" scripts/decrypt_gha_secret.sh scripts/gha-encrypted/AuthSample/Credentials.swift.gpg \ FirebaseAuth/Tests/SampleSwift/SwiftApiTests/Credentials.swift "$plist_secret" - + - name: Xcode + run: sudo xcode-select -s /Applications/Xcode_15.1.app/Contents/Developer - name: BuildAndTest # can be replaced with pod lib lint with CocoaPods 1.10 run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/build.sh Auth iOS) diff --git a/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeInfo.swift b/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeInfo.swift index 677a8e5819d..09fcac26a46 100644 --- a/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeInfo.swift +++ b/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeInfo.swift @@ -14,24 +14,16 @@ import Foundation -/** @class ActionCodeInfo - @brief Manages information regarding action codes. - */ +/// Manages information regarding action codes. @objc(FIRActionCodeInfo) open class ActionCodeInfo: NSObject { - /** - @brief The operation being performed. - */ + /// The operation being performed. @objc public let operation: ActionCodeOperation - /** @property email - @brief The email address to which the code was sent. The new email address in the case of - `ActionCodeOperationRecoverEmail`. - */ + /// The email address to which the code was sent. The new email address in the case of + /// `ActionCodeOperation.recoverEmail`. @objc public let email: String? - /** @property previousEmail - @brief The email that is being recovered in the case of `ActionCodeOperationRecoverEmail`. - */ + /// The email that is being recovered in the case of `ActionCodeOperation.recoverEmail`. @objc public let previousEmail: String? init(withOperation operation: ActionCodeOperation, email: String, newEmail: String?) { @@ -45,11 +37,9 @@ import Foundation } } - /** @fn actionCodeOperationForRequestType: - @brief Returns the corresponding operation type per provided request type string. - @param requestType Request type returned in in the server response. - @return The corresponding ActionCodeOperation for the supplied request type. - */ + /// Map a request type string to the corresponding operation type. + /// - Parameter requestType: Request type returned in in the server response. + /// - Returns: The corresponding ActionCodeOperation for the supplied request type. class func actionCodeOperation(forRequestType requestType: String?) -> ActionCodeOperation { switch requestType { case "PASSWORD_RESET": return .passwordReset diff --git a/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeOperation.swift b/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeOperation.swift index 14dc28dd19a..e345b6e91e8 100644 --- a/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeOperation.swift +++ b/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeOperation.swift @@ -14,28 +14,26 @@ import Foundation -/** - @brief Operations which can be performed with action codes. - */ +/// Operations which can be performed with action codes. @objc(FIRActionCodeOperation) public enum ActionCodeOperation: Int, @unchecked Sendable { - /** Action code for unknown operation. */ + /// Action code for unknown operation. case unknown = 0 - /** Action code for password reset operation. */ + /// Action code for password reset operation. case passwordReset = 1 - /** Action code for verify email operation. */ + /// Action code for verify email operation. case verifyEmail = 2 - /** Action code for recover email operation. */ + /// Action code for recover email operation. case recoverEmail = 3 - /** Action code for email link operation. */ + /// Action code for email link operation. case emailLink = 4 - /** Action code for verifying and changing email */ + /// Action code for verifying and changing email. case verifyAndChangeEmail = 5 - /** Action code for reverting second factor addition */ + /// Action code for reverting second factor addition. case revertSecondFactorAddition = 6 } diff --git a/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeSettings.swift b/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeSettings.swift index 7c04d3a1ec8..f9cb95190d3 100644 --- a/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeSettings.swift +++ b/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeSettings.swift @@ -14,68 +14,49 @@ import Foundation -/** @class FIRActionCodeSettings - @brief Used to set and retrieve settings related to handling action codes. - */ +/// Used to set and retrieve settings related to handling action codes. @objc(FIRActionCodeSettings) open class ActionCodeSettings: NSObject { - /** @property URL - @brief This URL represents the state/Continue URL in the form of a universal link. - @remarks This URL can should be constructed as a universal link that would either directly open - the app where the action code would be handled or continue to the app after the action code - is handled by Firebase. - */ + /// This URL represents the state/Continue URL in the form of a universal link. + /// + /// This URL can should be constructed as a universal link that would either directly open + /// the app where the action code would be handled or continue to the app after the action code + /// is handled by Firebase. @objc(URL) open var url: URL? - /** @property handleCodeInApp - @brief Indicates whether the action code link will open the app directly or after being - redirected from a Firebase owned web widget. - */ + /// Indicates whether the action code link will open the app directly or after being + /// redirected from a Firebase owned web widget. @objc open var handleCodeInApp: Bool = false - /** @property iOSBundleID - @brief The iOS bundle ID, if available. The default value is the current app's bundle ID. - */ + /// The iOS bundle ID, if available. The default value is the current app's bundle ID. @objc open var iOSBundleID: String? - /** @property androidPackageName - @brief The Android package name, if available. - */ + /// The Android package name, if available. @objc open var androidPackageName: String? - /** @property androidMinimumVersion - @brief The minimum Android version supported, if available. - */ + /// The minimum Android version supported, if available. @objc open var androidMinimumVersion: String? - /** @property androidInstallIfNotAvailable - @brief Indicates whether the Android app should be installed on a device where it is not - available. - */ + /// Indicates whether the Android app should be installed on a device where it is not available. @objc open var androidInstallIfNotAvailable: Bool = false - /** @property dynamicLinkDomain - @brief The Firebase Dynamic Link domain used for out of band code flow. - */ + /// The Firebase Dynamic Link domain used for out of band code flow. @objc open var dynamicLinkDomain: String? - /** @fn - @brief Sets the iOS bundle Id. - */ - + /// Sets the iOS bundle ID. @objc override public init() { iOSBundleID = Bundle.main.bundleIdentifier } - /** @fn - @brief Sets the Android package name, the flag to indicate whether or not to install the app - and the minimum Android version supported. - @param androidPackageName The Android package name. - @param installIfNotAvailable Indicates whether or not the app should be installed if not - available. - @param minimumVersion The minimum version of Android supported. - @remarks If installIfNotAvailable is set to YES and the link is opened on an android device, it - will try to install the app if not already available. Otherwise the web URL is used. - */ + /// Sets the Android package name, the flag to indicate whether or not to install the app, + /// and the minimum Android version supported. + /// + /// If `installIfNotAvailable` is set to `true` and the link is opened on an android device, it + /// will try to install the app if not already available. Otherwise the web URL is used. + /// - Parameters: + /// - androidPackageName: The Android package name. + /// - installIfNotAvailable: Indicates whether or not the app should be installed if not + /// available. + /// - minimumVersion: The minimum version of Android supported. @objc open func setAndroidPackageName(_ androidPackageName: String, installIfNotAvailable: Bool, minimumVersion: String?) { @@ -84,6 +65,7 @@ import Foundation androidMinimumVersion = minimumVersion } + /// Sets the iOS bundle ID. open func setIOSBundleID(_ bundleID: String) { iOSBundleID = bundleID } diff --git a/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeURL.swift b/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeURL.swift index 48c99710c31..29bb8070c1a 100644 --- a/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeURL.swift +++ b/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeURL.swift @@ -14,41 +14,29 @@ import Foundation -/** @class FIRActionCodeURL - @brief This class will allow developers to easily extract information about out of band links. - */ +/// This class will allow developers to easily extract information about out of band links. @objc(FIRActionCodeURL) open class ActionCodeURL: NSObject { - /** @property APIKey - @brief Returns the API key from the link. nil, if not provided. - */ + /// Returns the API key from the link. nil, if not provided. @objc(APIKey) public let apiKey: String? - /** @property operation - @brief Returns the mode of oob action. The property will be of `FIRActionCodeOperation` type. - It will return `FIRActionCodeOperationUnknown` if no oob action is provided. - */ + /// Returns the mode of oob action. + /// + /// The property will be of `ActionCodeOperation` type. + /// It will return `.unknown` if no oob action is provided. @objc public let operation: ActionCodeOperation - /** @property code - @brief Returns the email action code from the link. nil, if not provided. - */ + /// Returns the email action code from the link. nil, if not provided. @objc public let code: String? - /** @property continueURL - @brief Returns the continue URL from the link. nil, if not provided. - */ + /// Returns the continue URL from the link. nil, if not provided. @objc public let continueURL: URL? - /** @property languageCode - @brief Returns the language code from the link. nil, if not provided. - */ + /// Returns the language code from the link. nil, if not provided. @objc public let languageCode: String? - /** @fn actionCodeURLWithLink: - @brief Construct an `ActionCodeURL` from an out of band link (e.g. email link). - @param link The oob link string used to construct the action code URL. - @return The `ActionCodeURL` object constructed based on the oob link provided. - */ + /// Construct an `ActionCodeURL` from an out of band link (e.g. email link). + /// - Parameter link: The oob link string used to construct the action code URL. + /// - Returns: The ActionCodeURL object constructed based on the oob link provided. @objc(actionCodeURLWithLink:) public init?(link: String) { var queryItems = ActionCodeURL.parseURL(link) if queryItems.count == 0 { diff --git a/FirebaseAuth/Sources/Swift/Auth/Auth.swift b/FirebaseAuth/Sources/Swift/Auth/Auth.swift index 279ba10a416..a67ebe77c2a 100644 --- a/FirebaseAuth/Sources/Swift/Auth/Auth.swift +++ b/FirebaseAuth/Sources/Swift/Auth/Auth.swift @@ -82,9 +82,12 @@ import FirebaseCoreExtension @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) extension Auth: AuthInterop { + /// Retrieves the Firebase authentication token, possibly refreshing it if it has expired. + /// + /// This method is not for public use. It is for Firebase clients of AuthInterop. @objc(getTokenForcingRefresh:withCallback:) - open func getToken(forcingRefresh forceRefresh: Bool, - completion callback: @escaping (String?, Error?) -> Void) { + public func getToken(forcingRefresh forceRefresh: Bool, + completion callback: @escaping (String?, Error?) -> Void) { kAuthGlobalWorkQueue.async { [weak self] in if let strongSelf = self { // Enable token auto-refresh if not already enabled. @@ -134,22 +137,22 @@ extension Auth: AuthInterop { } } + /// Get the current Auth user's UID. Returns nil if there is no user signed in. + /// + /// This method is not for public use. It is for Firebase clients of AuthInterop. open func getUserID() -> String? { return currentUser?.uid } } -/** @class Auth - @brief Manages authentication for Firebase apps. - @remarks This class is thread-safe. - */ +/// Manages authentication for Firebase apps. +/// +/// This class is thread-safe. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRAuth) open class Auth: NSObject { - /** @fn auth - @brief Gets the auth object for the default Firebase app. - @remarks The default Firebase app must have already been configured or an exception will be - raised. - */ + /// Gets the auth object for the default Firebase app. + /// + /// The default Firebase app must have already been configured or an exception will be raised. @objc open class func auth() -> Auth { guard let defaultApp = FirebaseApp.app() else { fatalError("The default FirebaseApp instance must be configured before the default Auth " + @@ -161,32 +164,25 @@ extension Auth: AuthInterop { return auth(app: defaultApp) } - /** @fn authWithApp: - @brief Gets the auth object for a `FirebaseApp`. - - @param app The app for which to retrieve the associated `Auth` instance. - @return The `Auth` instance associated with the given app. - */ + /// Gets the auth object for a `FirebaseApp`. + /// - Parameter app: The app for which to retrieve the associated `Auth` instance. + /// - Returns: The `Auth` instance associated with the given app. @objc open class func auth(app: FirebaseApp) -> Auth { return ComponentType.instance(for: AuthProvider.self, in: app.container).auth() } - /** @property app - @brief Gets the `FirebaseApp` object that this auth object is connected to. - */ + /// Gets the `FirebaseApp` object that this auth object is connected to. @objc public internal(set) weak var app: FirebaseApp? - /** @property currentUser - @brief Synchronously gets the cached current user, or null if there is none. - */ + /// Synchronously gets the cached current user, or null if there is none. @objc public internal(set) var currentUser: User? - /** @property languageCode - @brief The current user language code. This property can be set to the app's current language by - calling `useAppLanguage()`. - - @remarks The string used to set this property must be a language code that follows BCP 47. - */ + /// The current user language code. + /// + /// This property can be set to the app's current language by + /// calling `useAppLanguage()`. + /// + /// The string used to set this property must be a language code that follows BCP 47. @objc open var languageCode: String? { get { kAuthGlobalWorkQueue.sync { @@ -200,42 +196,34 @@ extension Auth: AuthInterop { } } - /** @property settings - @brief Contains settings related to the auth object. - */ + /// Contains settings related to the auth object. @NSCopying @objc open var settings: AuthSettings? - /** @property userAccessGroup - @brief The current user access group that the Auth instance is using. Default is nil. - */ + /// The current user access group that the Auth instance is using. + /// + /// Default is `nil`. @objc public internal(set) var userAccessGroup: String? - /** @property shareAuthStateAcrossDevices - @brief Contains shareAuthStateAcrossDevices setting related to the auth object. - @remarks If userAccessGroup is not set, setting shareAuthStateAcrossDevices will - have no effect. You should set shareAuthStateAcrossDevices to it's desired - state and then set the userAccessGroup after. - */ + /// Contains shareAuthStateAcrossDevices setting related to the auth object. + /// + /// If userAccessGroup is not set, setting shareAuthStateAcrossDevices will + /// have no effect. You should set shareAuthStateAcrossDevices to it's desired + /// state and then set the userAccessGroup after. @objc open var shareAuthStateAcrossDevices: Bool = false - /** @property tenantID - @brief The tenant ID of the auth instance. nil if none is available. - */ + /// The tenant ID of the auth instance. `nil` if none is available. @objc open var tenantID: String? - /** - * @property customAuthDomain - * @brief The custom authentication domain used to handle all sign-in redirects. End-users will see - * this domain when signing in. This domain must be allowlisted in the Firebase Console. - */ + /// The custom authentication domain used to handle all sign-in redirects. + /// End-users will see + /// this domain when signing in. This domain must be allowlisted in the Firebase Console. @objc open var customAuthDomain: String? - /** @fn updateCurrentUser:completion: - @brief Sets the `currentUser` on the receiver to the provided user object. - @param user The user object to be set as the current user of the calling Auth instance. - @param completion Optionally; a block invoked after the user of the calling Auth instance has - been updated or an error was encountered. - */ + /// Sets the `currentUser` on the receiver to the provided user object. + /// - Parameters: + /// - user: The user object to be set as the current user of the calling Auth instance. + /// - completion: Optionally; a block invoked after the user of the calling Auth instance has + /// been updated or an error was encountered. @objc open func updateCurrentUser(_ user: User?, completion: ((Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { guard let user else { @@ -268,12 +256,10 @@ extension Auth: AuthInterop { } } - /** @fn updateCurrentUser:completion: - @brief Sets the `currentUser` on the receiver to the provided user object. - @param user The user object to be set as the current user of the calling Auth instance. - @param completion Optionally; a block invoked after the user of the calling Auth instance has - been updated or an error was encountered. - */ + /// Sets the `currentUser` on the receiver to the provided user object. + /// - Parameter user: The user object to be set as the current user of the calling Auth instance. + /// - Parameter completion: Optionally; a block invoked after the user of the calling Auth + /// instance has been updated or an error was encountered. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func updateCurrentUser(_ user: User) async throws { return try await withCheckedThrowingContinuation { continuation in @@ -287,22 +273,18 @@ extension Auth: AuthInterop { } } - /** @fn fetchSignInMethodsForEmail:completion: - @brief [Deprecated] Fetches the list of all sign-in methods previously used for the provided - email address. This method returns an empty list when [Email Enumeration - Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) - is enabled, irrespective of the number of authentication methods available for the given email. - @param email The email address for which to obtain a list of sign-in methods. - @param completion Optionally; a block which is invoked when the list of sign in methods for the - specified email address is ready or an error was encountered. Invoked asynchronously on the - main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. - - @remarks See @c AuthErrors for a list of error codes that are common to all API methods. - */ + /// [Deprecated] Fetches the list of all sign-in methods previously used for the provided + /// email address. This method returns an empty list when [Email Enumeration + /// Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) + /// is enabled, irrespective of the number of authentication methods available for the given + /// email. + /// + /// Possible error codes: `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. + /// + /// - Parameter email: The email address for which to obtain a list of sign-in methods. + /// - Parameter completion: Optionally; a block which is invoked when the list of sign in methods + /// for the specified email address is ready or an error was encountered. Invoked asynchronously + /// on the main thread in the future. @available( *, deprecated, @@ -325,19 +307,16 @@ extension Auth: AuthInterop { } } - /** @fn fetchSignInMethodsForEmail:completion: - @brief [Deprecated] Fetches the list of all sign-in methods previously used for the provided - email address. This method returns an empty list when [Email Enumeration - Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) - is enabled, irrespective of the number of authentication methods available for the given email. - @param email The email address for which to obtain a list of sign-in methods. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. - - @remarks See @c AuthErrors for a list of error codes that are common to all API methods. - */ + /// [Deprecated] Fetches the list of all sign-in methods previously used for the provided + /// email address. This method returns an empty list when [Email Enumeration + /// Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) + /// is enabled, irrespective of the number of authentication methods available for the given + /// email. + /// + /// Possible error codes: `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. + /// + /// - Parameter email: The email address for which to obtain a list of sign-in methods. + /// - Returns: List of sign-in methods @available( *, deprecated, @@ -355,29 +334,25 @@ extension Auth: AuthInterop { } } - /** @fn signInWithEmail:password:completion: - @brief Signs in using an email address and password. When [Email Enumeration - Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) - is enabled, this method fails with FIRAuthErrorCodeInvalidCredentials in case of an invalid - email/password. - - @param email The user's email address. - @param password The user's password. - @param completion Optionally; a block which is invoked when the sign in flow finishes, or is - canceled. Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeOperationNotAllowed` - Indicates that email and password - accounts are not enabled. Enable them in the Auth section of the - Firebase console. - + `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. - + `AuthErrorCodeWrongPassword` - Indicates the user attempted - sign in with an incorrect password. - + `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Signs in using an email address and password. + /// + /// When [Email Enumeration + /// Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) + /// is enabled, this method fails with an error in case of an invalid + /// email/password. + /// + /// Possible error codes: + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that email and password + /// accounts are not enabled. Enable them in the Auth section of the + /// Firebase console. + /// * `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. + /// * `AuthErrorCodeWrongPassword` - Indicates the user attempted + /// sign in with an incorrect password. + /// * `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. + /// - Parameter email: The user's email address. + /// - Parameter password: The user's password. + /// - Parameter completion: Optionally; a block which is invoked when the sign in flow finishes, + /// or is canceled. Invoked asynchronously on the main thread in the future. @objc open func signIn(withEmail email: String, password: String, completion: ((AuthDataResult?, Error?) -> Void)? = nil) { @@ -397,18 +372,23 @@ extension Auth: AuthInterop { } } - /** @fn signInWithEmail:password:callback: - @brief Signs in using an email address and password. When [Email Enumeration - Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) - is enabled, this method fails with FIRAuthErrorCodeInvalidCredentials in case of an invalid - email/password. - @param email The user's email address. - @param password The user's password. - @param callback A block which is invoked when the sign in finishes (or is cancelled.) Invoked - asynchronously on the global auth work queue in the future. - @remarks This is the internal counterpart of this method, which uses a callback that does not - update the current user. - */ + /// Signs in using an email address and password. + /// + /// When [Email Enumeration + /// Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) + /// is enabled, this method throws in case of an invalid email/password. + /// + /// Possible error codes: + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that email and password + /// accounts are not enabled. Enable them in the Auth section of the + /// Firebase console. + /// * `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. + /// * `AuthErrorCodeWrongPassword` - Indicates the user attempted + /// sign in with an incorrect password. + /// * `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. + /// - Parameter email: The user's email address. + /// - Parameter password: The user's password. + /// - Returns: The signed in user. func internalSignInUser(withEmail email: String, password: String) async throws -> User { let request = VerifyPasswordRequest(email: email, @@ -431,24 +411,19 @@ extension Auth: AuthInterop { ) } - /** @fn signInWithEmail:password:completion: - @brief Signs in using an email address and password. - - @param email The user's email address. - @param password The user's password. - - @remarks Possible error codes: - - + `AuthErrorCodeOperationNotAllowed` - Indicates that email and password - accounts are not enabled. Enable them in the Auth section of the - Firebase console. - + `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. - + `AuthErrorCodeWrongPassword` - Indicates the user attempted - sign in with an incorrect password. - + `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Signs in using an email address and password. + /// + /// Possible error codes: + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that email and password + /// accounts are not enabled. Enable them in the Auth section of the + /// Firebase console. + /// * `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. + /// * `AuthErrorCodeWrongPassword` - Indicates the user attempted + /// sign in with an incorrect password. + /// * `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. + /// - Parameter email: The user's email address. + /// - Parameter password: The user's password. + /// - Returns: The `AuthDataResult` after a successful signin. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @discardableResult open func signIn(withEmail email: String, password: String) async throws -> AuthDataResult { @@ -463,24 +438,20 @@ extension Auth: AuthInterop { } } - /** @fn signInWithEmail:link:completion: - @brief Signs in using an email address and email sign-in link. - - @param email The user's email address. - @param link The email sign-in link. - @param completion Optionally; a block which is invoked when the sign in flow finishes, or is - canceled. Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeOperationNotAllowed` - Indicates that email and email sign-in link - accounts are not enabled. Enable them in the Auth section of the - Firebase console. - + `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. - + `AuthErrorCodeInvalidEmail` - Indicates the email address is invalid. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Signs in using an email address and email sign-in link. + /// + /// Possible error codes: + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that email and password + /// accounts are not enabled. Enable them in the Auth section of the + /// Firebase console. + /// * `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. + /// * `AuthErrorCodeWrongPassword` - Indicates the user attempted + /// sign in with an incorrect password. + /// * `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. + /// - Parameter email: The user's email address. + /// - Parameter link: The email sign-in link. + /// - Parameter completion: Optionally; a block which is invoked when the sign in flow finishes, + /// or is canceled. Invoked asynchronously on the main thread in the future. @objc open func signIn(withEmail email: String, link: String, completion: ((AuthDataResult?, Error?) -> Void)? = nil) { @@ -499,24 +470,18 @@ extension Auth: AuthInterop { } } - /** @fn signInWithEmail:link:completion: - @brief Signs in using an email address and email sign-in link. - - @param email The user's email address. - @param link The email sign-in link. - @param completion Optionally; a block which is invoked when the sign in flow finishes, or is - canceled. Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeOperationNotAllowed` - Indicates that email and email sign-in link - accounts are not enabled. Enable them in the Auth section of the - Firebase console. - + `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. - + `AuthErrorCodeInvalidEmail` - Indicates the email address is invalid. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Signs in using an email address and email sign-in link. + /// Possible error codes: + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that email and password + /// accounts are not enabled. Enable them in the Auth section of the + /// Firebase console. + /// * `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. + /// * `AuthErrorCodeWrongPassword` - Indicates the user attempted + /// sign in with an incorrect password. + /// * `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. + /// - Parameter email: The user's email address. + /// - Parameter link: The email sign-in link. + /// - Returns: The `AuthDataResult` after a successful signin. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func signIn(withEmail email: String, link: String) async throws -> AuthDataResult { return try await withCheckedThrowingContinuation { continuation in @@ -531,54 +496,40 @@ extension Auth: AuthInterop { } #if os(iOS) + /// Signs in using the provided auth provider instance. + /// + /// Possible error codes: + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that email and password + /// accounts are not enabled. Enable them in the Auth section of the + /// Firebase console. + /// * `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. + /// * `AuthErrorCodeWrongPassword` - Indicates the user attempted + /// sign in with an incorrect password. + /// * `AuthErrorCodeWebNetworkRequestFailed` - Indicates that a network request within a + /// SFSafariViewController or WKWebView failed. + /// * `AuthErrorCodeWebInternalError` - Indicates that an internal error occurred within a + /// SFSafariViewController or WKWebView. + /// * `AuthErrorCodeWebSignInUserInteractionFailure` - Indicates a general failure during + /// a web sign-in flow. + /// * `AuthErrorCodeWebContextAlreadyPresented` - Indicates that an attempt was made to + /// present a new web context while one was already being presented. + /// * `AuthErrorCodeWebContextCancelled` - Indicates that the URL presentation was + /// cancelled prematurely by the user. + /// * `AuthErrorCodeAccountExistsWithDifferentCredential` - Indicates the email asserted + /// by the credential (e.g. the email in a Facebook access token) is already in use by an + /// existing account, that cannot be authenticated with this sign-in method. Call + /// fetchProvidersForEmail for this user’s email and then prompt them to sign in with any of + /// the sign-in providers returned. This error will only be thrown if the "One account per + /// email address" setting is enabled in the Firebase console, under Auth settings. + /// - Parameter provider: An instance of an auth provider used to initiate the sign-in flow. + /// - Parameter uiDelegate: Optionally an instance of a class conforming to the AuthUIDelegate + /// protocol, this is used for presenting the web context. If nil, a default AuthUIDelegate + /// will be used. + /// - Parameter completion: Optionally; a block which is invoked when the sign in flow finishes, + /// or is canceled. Invoked asynchronously on the main thread in the future. @available(tvOS, unavailable) @available(macOS, unavailable) @available(watchOS, unavailable) - /** @fn signInWithProvider:UIDelegate:completion: - @brief Signs in using the provided auth provider instance. - This method is available on iOS, macOS Catalyst, and tvOS only. - - @param provider An instance of an auth provider used to initiate the sign-in flow. - @param uiDelegate Optionally an instance of a class conforming to the AuthUIDelegate - protocol, this is used for presenting the web context. If nil, a default AuthUIDelegate - will be used. - @param completion Optionally; a block which is invoked when the sign in flow finishes, or is - canceled. Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - - @remarks See @c AuthErrors for a list of error codes that are common to all API methods. - */ @objc(signInWithProvider:UIDelegate:completion:) open func signIn(with provider: FederatedAuthProvider, uiDelegate: AuthUIDelegate?, @@ -600,49 +551,36 @@ extension Auth: AuthInterop { } } - /** @fn signInWithProvider:UIDelegate:completion: - @brief Signs in using the provided auth provider instance. - This method is available on iOS, macOS Catalyst, and tvOS only. - - @param provider An instance of an auth provider used to initiate the sign-in flow. - @param uiDelegate Optionally an instance of a class conforming to the AuthUIDelegate - protocol, this is used for presenting the web context. If nil, a default AuthUIDelegate - will be used. - - @remarks Possible error codes: - - - @remarks See @c AuthErrors for a list of error codes that are common to all API methods. - */ + /// Signs in using the provided auth provider instance. + /// + /// Possible error codes: + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that email and password + /// accounts are not enabled. Enable them in the Auth section of the + /// Firebase console. + /// * `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. + /// * `AuthErrorCodeWrongPassword` - Indicates the user attempted + /// sign in with an incorrect password. + /// * `AuthErrorCodeWebNetworkRequestFailed` - Indicates that a network request within a + /// SFSafariViewController or WKWebView failed. + /// * `AuthErrorCodeWebInternalError` - Indicates that an internal error occurred within a + /// SFSafariViewController or WKWebView. + /// * `AuthErrorCodeWebSignInUserInteractionFailure` - Indicates a general failure during + /// a web sign-in flow. + /// * `AuthErrorCodeWebContextAlreadyPresented` - Indicates that an attempt was made to + /// present a new web context while one was already being presented. + /// * `AuthErrorCodeWebContextCancelled` - Indicates that the URL presentation was + /// cancelled prematurely by the user. + /// * `AuthErrorCodeAccountExistsWithDifferentCredential` - Indicates the email asserted + /// by the credential (e.g. the email in a Facebook access token) is already in use by an + /// existing account, that cannot be authenticated with this sign-in method. Call + /// fetchProvidersForEmail for this user’s email and then prompt them to sign in with any of + /// the sign-in providers returned. This error will only be thrown if the "One account per + /// email address" setting is enabled in the Firebase console, under Auth settings. + /// - Parameter provider: An instance of an auth provider used to initiate the sign-in flow. + /// - Parameter uiDelegate: Optionally an instance of a class conforming to the AuthUIDelegate + /// protocol, this is used for presenting the web context. If nil, a default AuthUIDelegate + /// will be used. + /// - Returns: The `AuthDataResult` after the successful signin. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @available(tvOS, unavailable) @available(macOS, unavailable) @@ -662,44 +600,38 @@ extension Auth: AuthInterop { } #endif // iOS - /** @fn signInWithCredential:completion: - @brief Asynchronously signs in to Firebase with the given 3rd-party credentials (e.g. a Facebook - login Access Token, a Google ID Token/Access Token pair, etc.) and returns additional - identity provider data. - - @param credential The credential supplied by the IdP. - @param completion Optionally; a block which is invoked when the sign in flow finishes, or is - canceled. Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidCredential` - Indicates the supplied credential is invalid. - This could happen if it has expired or it is malformed. - + `AuthErrorCodeOperationNotAllowed` - Indicates that accounts - with the identity provider represented by the credential are not enabled. - Enable them in the Auth section of the Firebase console. - + `AuthErrorCodeAccountExistsWithDifferentCredential` - Indicates the email asserted - by the credential (e.g. the email in a Facebook access token) is already in use by an - existing account, that cannot be authenticated with this sign-in method. Call - fetchProvidersForEmail for this user’s email and then prompt them to sign in with any of - the sign-in providers returned. This error will only be thrown if the "One account per - email address" setting is enabled in the Firebase console, under Auth settings. - + `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. - + `AuthErrorCodeWrongPassword` - Indicates the user attempted sign in with an - incorrect password, if credential is of the type EmailPasswordAuthCredential. - + `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. - + `AuthErrorCodeMissingVerificationID` - Indicates that the phone auth credential was - created with an empty verification ID. - + `AuthErrorCodeMissingVerificationCode` - Indicates that the phone auth credential - was created with an empty verification code. - + `AuthErrorCodeInvalidVerificationCode` - Indicates that the phone auth credential - was created with an invalid verification Code. - + `AuthErrorCodeInvalidVerificationID` - Indicates that the phone auth credential was - created with an invalid verification ID. - + `AuthErrorCodeSessionExpired` - Indicates that the SMS code has expired. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods - */ + /// Asynchronously signs in to Firebase with the given 3rd-party credentials (e.g. a Facebook + /// login Access Token, a Google ID Token/Access Token pair, etc.) and returns additional + /// identity provider data. + /// + /// Possible error codes: + /// * `AuthErrorCodeInvalidCredential` - Indicates the supplied credential is invalid. + /// This could happen if it has expired or it is malformed. + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that accounts + /// with the identity provider represented by the credential are not enabled. + /// Enable them in the Auth section of the Firebase console. + /// * `AuthErrorCodeAccountExistsWithDifferentCredential` - Indicates the email asserted + /// by the credential (e.g. the email in a Facebook access token) is already in use by an + /// existing account, that cannot be authenticated with this sign-in method. Call + /// fetchProvidersForEmail for this user’s email and then prompt them to sign in with any of + /// the sign-in providers returned. This error will only be thrown if the "One account per + /// email address" setting is enabled in the Firebase console, under Auth settings. + /// * `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. + /// * `AuthErrorCodeWrongPassword` - Indicates the user attempted sign in with an + /// incorrect password, if credential is of the type EmailPasswordAuthCredential. + /// * `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. + /// * `AuthErrorCodeMissingVerificationID` - Indicates that the phone auth credential was + /// created with an empty verification ID. + /// * `AuthErrorCodeMissingVerificationCode` - Indicates that the phone auth credential + /// was created with an empty verification code. + /// * `AuthErrorCodeInvalidVerificationCode` - Indicates that the phone auth credential + /// was created with an invalid verification Code. + /// * `AuthErrorCodeInvalidVerificationID` - Indicates that the phone auth credential was + /// created with an invalid verification ID. + /// * `AuthErrorCodeSessionExpired` - Indicates that the SMS code has expired. + /// - Parameter credential: The credential supplied by the IdP. + /// - Parameter completion: Optionally; a block which is invoked when the sign in flow finishes, + /// or is canceled. Invoked asynchronously on the main thread in the future. @objc(signInWithCredential:completion:) open func signIn(with credential: AuthCredential, completion: ((AuthDataResult?, Error?) -> Void)? = nil) { @@ -717,44 +649,37 @@ extension Auth: AuthInterop { } } - /** @fn signInWithCredential:completion: - @brief Asynchronously signs in to Firebase with the given 3rd-party credentials (e.g. a Facebook - login Access Token, a Google ID Token/Access Token pair, etc.) and returns additional - identity provider data. - - @param credential The credential supplied by the IdP. - @param completion Optionally; a block which is invoked when the sign in flow finishes, or is - canceled. Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidCredential` - Indicates the supplied credential is invalid. - This could happen if it has expired or it is malformed. - + `AuthErrorCodeOperationNotAllowed` - Indicates that accounts - with the identity provider represented by the credential are not enabled. - Enable them in the Auth section of the Firebase console. - + `AuthErrorCodeAccountExistsWithDifferentCredential` - Indicates the email asserted - by the credential (e.g. the email in a Facebook access token) is already in use by an - existing account, that cannot be authenticated with this sign-in method. Call - fetchProvidersForEmail for this user’s email and then prompt them to sign in with any of - the sign-in providers returned. This error will only be thrown if the "One account per - email address" setting is enabled in the Firebase console, under Auth settings. - + `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. - + `AuthErrorCodeWrongPassword` - Indicates the user attempted sign in with an - incorrect password, if credential is of the type EmailPasswordAuthCredential. - + `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. - + `AuthErrorCodeMissingVerificationID` - Indicates that the phone auth credential was - created with an empty verification ID. - + `AuthErrorCodeMissingVerificationCode` - Indicates that the phone auth credential - was created with an empty verification code. - + `AuthErrorCodeInvalidVerificationCode` - Indicates that the phone auth credential - was created with an invalid verification Code. - + `AuthErrorCodeInvalidVerificationID` - Indicates that the phone auth credential was - created with an invalid verification ID. - + `AuthErrorCodeSessionExpired` - Indicates that the SMS code has expired. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods - */ + /// Asynchronously signs in to Firebase with the given 3rd-party credentials (e.g. a Facebook + /// login Access Token, a Google ID Token/Access Token pair, etc.) and returns additional + /// identity provider data. + /// + /// Possible error codes: + /// * `AuthErrorCodeInvalidCredential` - Indicates the supplied credential is invalid. + /// This could happen if it has expired or it is malformed. + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that accounts + /// with the identity provider represented by the credential are not enabled. + /// Enable them in the Auth section of the Firebase console. + /// * `AuthErrorCodeAccountExistsWithDifferentCredential` - Indicates the email asserted + /// by the credential (e.g. the email in a Facebook access token) is already in use by an + /// existing account, that cannot be authenticated with this sign-in method. Call + /// fetchProvidersForEmail for this user’s email and then prompt them to sign in with any of + /// the sign-in providers returned. This error will only be thrown if the "One account per + /// email address" setting is enabled in the Firebase console, under Auth settings. + /// * `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. + /// * `AuthErrorCodeWrongPassword` - Indicates the user attempted sign in with an + /// incorrect password, if credential is of the type EmailPasswordAuthCredential. + /// * `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. + /// * `AuthErrorCodeMissingVerificationID` - Indicates that the phone auth credential was + /// created with an empty verification ID. + /// * `AuthErrorCodeMissingVerificationCode` - Indicates that the phone auth credential + /// was created with an empty verification code. + /// * `AuthErrorCodeInvalidVerificationCode` - Indicates that the phone auth credential + /// was created with an invalid verification Code. + /// * `AuthErrorCodeInvalidVerificationID` - Indicates that the phone auth credential was + /// created with an invalid verification ID. + /// * `AuthErrorCodeSessionExpired` - Indicates that the SMS code has expired. + /// - Parameter credential: The credential supplied by the IdP. + /// - Returns: The `AuthDataResult` after the successful signin. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @discardableResult open func signIn(with credential: AuthCredential) async throws -> AuthDataResult { @@ -769,21 +694,16 @@ extension Auth: AuthInterop { } } - /** @fn signInAnonymouslyWithCompletion: - @brief Asynchronously creates and becomes an anonymous user. - @param completion Optionally; a block which is invoked when the sign in finishes, or is - canceled. Invoked asynchronously on the main thread in the future. - - @remarks If there is already an anonymous user signed in, that user will be returned instead. - If there is any other existing user signed in, that user will be signed out. - - @remarks Possible error codes: - - + `AuthErrorCodeOperationNotAllowed` - Indicates that anonymous accounts are - not enabled. Enable them in the Auth section of the Firebase console. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Asynchronously creates and becomes an anonymous user. + /// + /// If there is already an anonymous user signed in, that user will be returned instead. + /// If there is any other existing user signed in, that user will be signed out. + /// + /// Possible error codes: + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that anonymous accounts are + /// not enabled. Enable them in the Auth section of the Firebase console. + /// - Parameter completion: Optionally; a block which is invoked when the sign in finishes, or is + /// canceled. Invoked asynchronously on the main thread in the future. @objc open func signInAnonymously(completion: ((AuthDataResult?, Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { let decoratedCallback = self.signInFlowAuthDataResultCallback(byDecorating: completion) @@ -816,19 +736,15 @@ extension Auth: AuthInterop { } } - /** @fn signInAnonymouslyWithCompletion: - @brief Asynchronously creates and becomes an anonymous user. - - @remarks If there is already an anonymous user signed in, that user will be returned instead. - If there is any other existing user signed in, that user will be signed out. - - @remarks Possible error codes: - - + `AuthErrorCodeOperationNotAllowed` - Indicates that anonymous accounts are - not enabled. Enable them in the Auth section of the Firebase console. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Asynchronously creates and becomes an anonymous user. + /// + /// If there is already an anonymous user signed in, that user will be returned instead. + /// If there is any other existing user signed in, that user will be signed out. + /// + /// Possible error codes: + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that anonymous accounts are + /// not enabled. Enable them in the Auth section of the Firebase console. + /// - Returns: The `AuthDataResult` after the successful signin. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @discardableResult @objc open func signInAnonymously() async throws -> AuthDataResult { @@ -843,22 +759,16 @@ extension Auth: AuthInterop { } } - /** @fn signInWithCustomToken:completion: - @brief Asynchronously signs in to Firebase with the given Auth token. - - @param token A self-signed custom auth token. - @param completion Optionally; a block which is invoked when the sign in finishes, or is - canceled. Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidCustomToken` - Indicates a validation error with - the custom token. - + `AuthErrorCodeCustomTokenMismatch` - Indicates the service account and the API key - belong to different projects. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Asynchronously signs in to Firebase with the given Auth token. + /// + /// Possible error codes: + /// * `AuthErrorCodeInvalidCustomToken` - Indicates a validation error with + /// the custom token. + /// * `AuthErrorCodeCustomTokenMismatch` - Indicates the service account and the API key + /// belong to different projects. + /// - Parameter token: A self-signed custom auth token. + /// - Parameter completion: Optionally; a block which is invoked when the sign in finishes, or is + /// canceled. Invoked asynchronously on the main thread in the future. @objc open func signIn(withCustomToken token: String, completion: ((AuthDataResult?, Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { @@ -888,22 +798,15 @@ extension Auth: AuthInterop { } } - /** @fn signInWithCustomToken:completion: - @brief Asynchronously signs in to Firebase with the given Auth token. - - @param token A self-signed custom auth token. - @param completion Optionally; a block which is invoked when the sign in finishes, or is - canceled. Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidCustomToken` - Indicates a validation error with - the custom token. - + `AuthErrorCodeCustomTokenMismatch` - Indicates the service account and the API key - belong to different projects. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Asynchronously signs in to Firebase with the given Auth token. + /// + /// Possible error codes: + /// * `AuthErrorCodeInvalidCustomToken` - Indicates a validation error with + /// the custom token. + /// * `AuthErrorCodeCustomTokenMismatch` - Indicates the service account and the API key + /// belong to different projects. + /// - Parameter token: A self-signed custom auth token. + /// - Returns: The `AuthDataResult` after the successful signin. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @discardableResult open func signIn(withCustomToken token: String) async throws -> AuthDataResult { @@ -918,28 +821,22 @@ extension Auth: AuthInterop { } } - /** @fn createUserWithEmail:password:completion: - @brief Creates and, on success, signs in a user with the given email address and password. - - @param email The user's email address. - @param password The user's desired password. - @param completion Optionally; a block which is invoked when the sign up flow finishes, or is - canceled. Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. - + `AuthErrorCodeEmailAlreadyInUse` - Indicates the email used to attempt sign up - already exists. Call fetchProvidersForEmail to check which sign-in mechanisms the user - used, and prompt the user to sign in with one of those. - + `AuthErrorCodeOperationNotAllowed` - Indicates that email and password accounts - are not enabled. Enable them in the Auth section of the Firebase console. - + `AuthErrorCodeWeakPassword` - Indicates an attempt to set a password that is - considered too weak. The NSLocalizedFailureReasonErrorKey field in the NSError.userInfo - dictionary object will contain more detailed explanation that can be shown to the user. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Creates and, on success, signs in a user with the given email address and password. + /// + /// Possible error codes: + /// * `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. + /// * `AuthErrorCodeEmailAlreadyInUse` - Indicates the email used to attempt sign up + /// already exists. Call fetchProvidersForEmail to check which sign-in mechanisms the user + /// used, and prompt the user to sign in with one of those. + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that email and password accounts + /// are not enabled. Enable them in the Auth section of the Firebase console. + /// * `AuthErrorCodeWeakPassword` - Indicates an attempt to set a password that is + /// considered too weak. The NSLocalizedFailureReasonErrorKey field in the NSError.userInfo + /// dictionary object will contain more detailed explanation that can be shown to the user. + /// - Parameter email: The user's email address. + /// - Parameter password: The user's desired password. + /// - Parameter completion: Optionally; a block which is invoked when the sign up flow finishes, + /// or is canceled. Invoked asynchronously on the main thread in the future. @objc open func createUser(withEmail email: String, password: String, completion: ((AuthDataResult?, Error?) -> Void)? = nil) { @@ -1011,28 +908,21 @@ extension Auth: AuthInterop { } } - /** @fn createUserWithEmail:password:completion: - @brief Creates and, on success, signs in a user with the given email address and password. - - @param email The user's email address. - @param password The user's desired password. - @param completion Optionally; a block which is invoked when the sign up flow finishes, or is - canceled. Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. - + `AuthErrorCodeEmailAlreadyInUse` - Indicates the email used to attempt sign up - already exists. Call fetchProvidersForEmail to check which sign-in mechanisms the user - used, and prompt the user to sign in with one of those. - + `AuthErrorCodeOperationNotAllowed` - Indicates that email and password accounts - are not enabled. Enable them in the Auth section of the Firebase console. - + `AuthErrorCodeWeakPassword` - Indicates an attempt to set a password that is - considered too weak. The NSLocalizedFailureReasonErrorKey field in the NSError.userInfo - dictionary object will contain more detailed explanation that can be shown to the user. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Creates and, on success, signs in a user with the given email address and password. + /// + /// Possible error codes: + /// * `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. + /// * `AuthErrorCodeEmailAlreadyInUse` - Indicates the email used to attempt sign up + /// already exists. Call fetchProvidersForEmail to check which sign-in mechanisms the user + /// used, and prompt the user to sign in with one of those. + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that email and password accounts + /// are not enabled. Enable them in the Auth section of the Firebase console. + /// * `AuthErrorCodeWeakPassword` - Indicates an attempt to set a password that is + /// considered too weak. The NSLocalizedFailureReasonErrorKey field in the NSError.userInfo + /// dictionary object will contain more detailed explanation that can be shown to the user. + /// - Parameter email: The user's email address. + /// - Parameter password: The user's desired password. + /// - Returns: The `AuthDataResult` after the successful signin. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @discardableResult open func createUser(withEmail email: String, password: String) async throws -> AuthDataResult { @@ -1047,25 +937,20 @@ extension Auth: AuthInterop { } } - /** @fn confirmPasswordResetWithCode:newPassword:completion: - @brief Resets the password given a code sent to the user outside of the app and a new password - for the user. - - @param newPassword The new password. - @param completion Optionally; a block which is invoked when the request finishes. Invoked - asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeWeakPassword` - Indicates an attempt to set a password that is - considered too weak. - + `AuthErrorCodeOperationNotAllowed` - Indicates the administrator disabled sign - in with the specified identity provider. - + `AuthErrorCodeExpiredActionCode` - Indicates the OOB code is expired. - + `AuthErrorCodeInvalidActionCode` - Indicates the OOB code is invalid. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Resets the password given a code sent to the user outside of the app and a new password + /// for the user. + /// + /// Possible error codes: + /// * `AuthErrorCodeWeakPassword` - Indicates an attempt to set a password that is + /// considered too weak. + /// * `AuthErrorCodeOperationNotAllowed` - Indicates the administrator disabled sign + /// in with the specified identity provider. + /// * `AuthErrorCodeExpiredActionCode` - Indicates the OOB code is expired. + /// * `AuthErrorCodeInvalidActionCode` - Indicates the OOB code is invalid. + /// - Parameter code: The reset code. + /// - Parameter newPassword: The new password. + /// - Parameter completion: Optionally; a block which is invoked when the request finishes. + /// Invoked asynchronously on the main thread in the future. @objc open func confirmPasswordReset(withCode code: String, newPassword: String, completion: @escaping (Error?) -> Void) { kAuthGlobalWorkQueue.async { @@ -1076,25 +961,18 @@ extension Auth: AuthInterop { } } - /** @fn confirmPasswordResetWithCode:newPassword:completion: - @brief Resets the password given a code sent to the user outside of the app and a new password - for the user. - - @param newPassword The new password. - @param completion Optionally; a block which is invoked when the request finishes. Invoked - asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeWeakPassword` - Indicates an attempt to set a password that is - considered too weak. - + `AuthErrorCodeOperationNotAllowed` - Indicates the administrator disabled sign - in with the specified identity provider. - + `AuthErrorCodeExpiredActionCode` - Indicates the OOB code is expired. - + `AuthErrorCodeInvalidActionCode` - Indicates the OOB code is invalid. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Resets the password given a code sent to the user outside of the app and a new password + /// for the user. + /// + /// Possible error codes: + /// * `AuthErrorCodeWeakPassword` - Indicates an attempt to set a password that is + /// considered too weak. + /// * `AuthErrorCodeOperationNotAllowed` - Indicates the administrator disabled sign + /// in with the specified identity provider. + /// * `AuthErrorCodeExpiredActionCode` - Indicates the OOB code is expired. + /// * `AuthErrorCodeInvalidActionCode` - Indicates the OOB code is invalid. + /// - Parameter code: The reset code. + /// - Parameter newPassword: The new password. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func confirmPasswordReset(withCode code: String, newPassword: String) async throws { return try await withCheckedThrowingContinuation { continuation in @@ -1108,13 +986,11 @@ extension Auth: AuthInterop { } } - /** @fn checkActionCode:completion: - @brief Checks the validity of an out of band code. - - @param code The out of band code to check validity. - @param completion Optionally; a block which is invoked when the request finishes. Invoked - asynchronously on the main thread in the future. - */ + /// Checks the validity of an out of band code. + /// - Parameter code: The out of band code to check validity. + /// - Parameter completion: Optionally; a block which is invoked when the request finishes. + /// Invoked + /// asynchronously on the main thread in the future. @objc open func checkActionCode(_ code: String, completion: @escaping (ActionCodeInfo?, Error?) -> Void) { kAuthGlobalWorkQueue.async { @@ -1140,13 +1016,9 @@ extension Auth: AuthInterop { } } - /** @fn checkActionCode:completion: - @brief Checks the validity of an out of band code. - - @param code The out of band code to check validity. - @param completion Optionally; a block which is invoked when the request finishes. Invoked - asynchronously on the main thread in the future. - */ + /// Checks the validity of an out of band code. + /// - Parameter code: The out of band code to check validity. + /// - Returns: An `ActionCodeInfo`. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func checkActionCode(_ code: String) async throws -> ActionCodeInfo { return try await withCheckedThrowingContinuation { continuation in @@ -1160,13 +1032,10 @@ extension Auth: AuthInterop { } } - /** @fn verifyPasswordResetCode:completion: - @brief Checks the validity of a verify password reset code. - - @param code The password reset code to be verified. - @param completion Optionally; a block which is invoked when the request finishes. Invoked - asynchronously on the main thread in the future. - */ + /// Checks the validity of a verify password reset code. + /// - Parameter code: The password reset code to be verified. + /// - Parameter completion: Optionally; a block which is invoked when the request finishes. + /// Invoked asynchronously on the main thread in the future. @objc open func verifyPasswordResetCode(_ code: String, completion: @escaping (String?, Error?) -> Void) { checkActionCode(code) { info, error in @@ -1178,13 +1047,9 @@ extension Auth: AuthInterop { } } - /** @fn verifyPasswordResetCode:completion: - @brief Checks the validity of a verify password reset code. - - @param code The password reset code to be verified. - @param completion Optionally; a block which is invoked when the request finishes. Invoked - asynchronously on the main thread in the future. - */ + /// Checks the validity of a verify password reset code. + /// - Parameter code: The password reset code to be verified. + /// - Returns: An email. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func verifyPasswordResetCode(_ code: String) async throws -> String { return try await withCheckedThrowingContinuation { continuation in @@ -1198,16 +1063,13 @@ extension Auth: AuthInterop { } } - /** @fn applyActionCode:completion: - @brief Applies out of band code. - - @param code The out of band code to be applied. - @param completion Optionally; a block which is invoked when the request finishes. Invoked - asynchronously on the main thread in the future. - - @remarks This method will not work for out of band codes which require an additional parameter, - such as password reset code. - */ + /// Applies out of band code. + /// + /// This method will not work for out of band codes which require an additional parameter, + /// such as password reset code. + /// - Parameter code: The out of band code to be applied. + /// - Parameter completion: Optionally; a block which is invoked when the request finishes. + /// Invoked asynchronously on the main thread in the future. @objc open func applyActionCode(_ code: String, completion: @escaping (Error?) -> Void) { kAuthGlobalWorkQueue.async { let request = SetAccountInfoRequest(requestConfiguration: self.requestConfiguration) @@ -1216,16 +1078,11 @@ extension Auth: AuthInterop { } } - /** @fn applyActionCode:completion: - @brief Applies out of band code. - - @param code The out of band code to be applied. - @param completion Optionally; a block which is invoked when the request finishes. Invoked - asynchronously on the main thread in the future. - - @remarks This method will not work for out of band codes which require an additional parameter, - such as password reset code. - */ + /// Applies out of band code. + /// + /// This method will not work for out of band codes which require an additional parameter, + /// such as password reset code. + /// - Parameter code: The out of band code to be applied. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func applyActionCode(_ code: String) async throws { return try await withCheckedThrowingContinuation { continuation in @@ -1239,58 +1096,56 @@ extension Auth: AuthInterop { } } - /** @fn sendPasswordResetWithEmail:completion: - @brief Initiates a password reset for the given email address. This method does not throw an - error when there's no user account with the given email address and [Email Enumeration - Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) - is enabled. - - @param email The email address of the user. - @param completion Optionally; a block which is invoked when the request finishes. Invoked - asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was - sent in the request. - + `AuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in - the console for this action. - + `AuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for - sending update email. - - */ + /// Initiates a password reset for the given email address. + /// + /// This method does not throw an + /// error when there's no user account with the given email address and [Email Enumeration + /// Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) + /// is enabled. + /// + /// Possible error codes: + /// * `AuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was + /// sent in the request. + /// * `AuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in + /// the console for this action. + /// * `AuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for + /// sending update email. + /// - Parameter email: The email address of the user. + /// - Parameter completion: Optionally; a block which is invoked when the request finishes. + /// Invoked + /// asynchronously on the main thread in the future. @objc open func sendPasswordReset(withEmail email: String, completion: ((Error?) -> Void)? = nil) { sendPasswordReset(withEmail: email, actionCodeSettings: nil, completion: completion) } - /** @fn sendPasswordResetWithEmail:actionCodeSetting:completion: - @brief Initiates a password reset for the given email address and `ActionCodeSettings` object. - - @param email The email address of the user. - @param actionCodeSettings An `ActionCodeSettings` object containing settings related to - handling action codes. - @param completion Optionally; a block which is invoked when the request finishes. Invoked - asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was - sent in the request. - + `AuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in - the console for this action. - + `AuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for - sending update email. - + `AuthErrorCodeMissingIosBundleID` - Indicates that the iOS bundle ID is missing when - `handleCodeInApp` is set to true. - + `AuthErrorCodeMissingAndroidPackageName` - Indicates that the android package name - is missing when the `androidInstallApp` flag is set to true. - + `AuthErrorCodeUnauthorizedDomain` - Indicates that the domain specified in the - continue URL is not allowlisted in the Firebase console. - + `AuthErrorCodeInvalidContinueURI` - Indicates that the domain specified in the - continue URL is not valid. - - */ + /// Initiates a password reset for the given email address and `ActionCodeSettings` object. + /// + /// This method does not throw an + /// error when there's no user account with the given email address and [Email Enumeration + /// Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) + /// is enabled. + /// + /// Possible error codes: + /// * `AuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was + /// sent in the request. + /// * `AuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in + /// the console for this action. + /// * `AuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for + /// sending update email. + /// * `AuthErrorCodeMissingIosBundleID` - Indicates that the iOS bundle ID is missing when + /// `handleCodeInApp` is set to true. + /// * `AuthErrorCodeMissingAndroidPackageName` - Indicates that the android package name + /// is missing when the `androidInstallApp` flag is set to true. + /// * `AuthErrorCodeUnauthorizedDomain` - Indicates that the domain specified in the + /// continue URL is not allowlisted in the Firebase console. + /// * `AuthErrorCodeInvalidContinueURI` - Indicates that the domain specified in the + /// continue URL is not valid. + /// - Parameter email: The email address of the user. + /// - Parameter actionCodeSettings: An `ActionCodeSettings` object containing settings related to + /// handling action codes. + /// - Parameter completion: Optionally; a block which is invoked when the request finishes. + /// Invoked asynchronously on the main thread in the future. @objc open func sendPasswordReset(withEmail email: String, actionCodeSettings: ActionCodeSettings?, completion: ((Error?) -> Void)? = nil) { @@ -1315,37 +1170,31 @@ extension Auth: AuthInterop { } } - /** @fn sendPasswordResetWithEmail:actionCodeSetting:completion: - @brief Initiates a password reset for the given email address and `ActionCodeSettings` object. - This method does not throw an - error when there's no user account with the given email address and [Email Enumeration - Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) - is enabled. - - @param email The email address of the user. - @param actionCodeSettings An `ActionCodeSettings` object containing settings related to - handling action codes. - @param completion Optionally; a block which is invoked when the request finishes. Invoked - asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was - sent in the request. - + `AuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in - the console for this action. - + `AuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for - sending update email. - + `AuthErrorCodeMissingIosBundleID` - Indicates that the iOS bundle ID is missing when - `handleCodeInApp` is set to true. - + `AuthErrorCodeMissingAndroidPackageName` - Indicates that the android package name - is missing when the `androidInstallApp` flag is set to true. - + `AuthErrorCodeUnauthorizedDomain` - Indicates that the domain specified in the - continue URL is not allowlisted in the Firebase console. - + `AuthErrorCodeInvalidContinueURI` - Indicates that the domain specified in the - continue URL is not valid. - - */ + /// Initiates a password reset for the given email address and `ActionCodeSettings` object. + /// + /// This method does not throw an + /// error when there's no user account with the given email address and [Email Enumeration + /// Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) + /// is enabled. + /// + /// Possible error codes: + /// * `AuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was + /// sent in the request. + /// * `AuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in + /// the console for this action. + /// * `AuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for + /// sending update email. + /// * `AuthErrorCodeMissingIosBundleID` - Indicates that the iOS bundle ID is missing when + /// `handleCodeInApp` is set to true. + /// * `AuthErrorCodeMissingAndroidPackageName` - Indicates that the android package name + /// is missing when the `androidInstallApp` flag is set to true. + /// * `AuthErrorCodeUnauthorizedDomain` - Indicates that the domain specified in the + /// continue URL is not allowlisted in the Firebase console. + /// * `AuthErrorCodeInvalidContinueURI` - Indicates that the domain specified in the + /// continue URL is not valid. + /// - Parameter email: The email address of the user. + /// - Parameter actionCodeSettings: An `ActionCodeSettings` object containing settings related to + /// handling action codes. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func sendPasswordReset(withEmail email: String, actionCodeSettings: ActionCodeSettings? = nil) async throws { @@ -1360,15 +1209,12 @@ extension Auth: AuthInterop { } } - /** @fn sendSignInLinkToEmail:actionCodeSettings:completion: - @brief Sends a sign in with email link to provided email address. - - @param email The email address of the user. - @param actionCodeSettings An `ActionCodeSettings` object containing settings related to - handling action codes. - @param completion Optionally; a block which is invoked when the request finishes. Invoked - asynchronously on the main thread in the future. - */ + /// Sends a sign in with email link to provided email address. + /// - Parameter email: The email address of the user. + /// - Parameter actionCodeSettings: An `ActionCodeSettings` object containing settings related to + /// handling action codes. + /// - Parameter completion: Optionally; a block which is invoked when the request finishes. + /// Invoked asynchronously on the main thread in the future. @objc open func sendSignInLink(toEmail email: String, actionCodeSettings: ActionCodeSettings, completion: ((Error?) -> Void)? = nil) { @@ -1397,15 +1243,10 @@ extension Auth: AuthInterop { } } - /** @fn sendSignInLinkToEmail:actionCodeSettings:completion: - @brief Sends a sign in with email link to provided email address. - - @param email The email address of the user. - @param actionCodeSettings An `ActionCodeSettings` object containing settings related to - handling action codes. - @param completion Optionally; a block which is invoked when the request finishes. Invoked - asynchronously on the main thread in the future. - */ + /// Sends a sign in with email link to provided email address. + /// - Parameter email: The email address of the user. + /// - Parameter actionCodeSettings: An `ActionCodeSettings` object containing settings related to + /// handling action codes. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func sendSignInLink(toEmail email: String, actionCodeSettings: ActionCodeSettings) async throws { @@ -1420,20 +1261,12 @@ extension Auth: AuthInterop { } } - /** @fn signOut: - @brief Signs out the current user. - - @param error Optionally; if an error occurs, upon return contains an NSError object that - describes the problem; is nil otherwise. - @return @YES when the sign out request was successful. @NO otherwise. - - @remarks Possible error codes: - - + `AuthErrorCodeKeychainError` - Indicates an error occurred when accessing the - keychain. The `NSLocalizedFailureReasonErrorKey` field in the `userInfo` - dictionary will contain more information about the error encountered. - - */ + /// Signs out the current user. + /// + /// Possible error codes: + /// * `AuthErrorCodeKeychainError` - Indicates an error occurred when accessing the + /// keychain. The `NSLocalizedFailureReasonErrorKey` field in the `userInfo` + /// dictionary will contain more information about the error encountered. @objc(signOut:) open func signOut() throws { try kAuthGlobalWorkQueue.sync { guard self.currentUser != nil else { @@ -1443,12 +1276,9 @@ extension Auth: AuthInterop { } } - /** @fn isSignInWithEmailLink - @brief Checks if link is an email sign-in link. - - @param link The email sign-in link. - @return Returns true when the link passed matches the expected format of an email sign-in link. - */ + /// Checks if link is an email sign-in link. + /// - Parameter link: The email sign-in link. + /// - Returns: `true` when the link passed matches the expected format of an email sign-in link. @objc open func isSignIn(withEmailLink link: String) -> Bool { guard link.count > 0 else { return false @@ -1463,13 +1293,11 @@ extension Auth: AuthInterop { } #if os(iOS) && !targetEnvironment(macCatalyst) - /** @fn initializeRecaptchaConfigWithCompletion:completion: - @brief Initializes reCAPTCHA using the settings configured for the project or - tenant. - If you change the tenant ID of the `Auth` instance, the configuration will be - reloaded. - */ + /// Initializes reCAPTCHA using the settings configured for the project or tenant. + /// + /// If you change the tenant ID of the `Auth` instance, the configuration will be + /// reloaded. @objc(initializeRecaptchaConfigWithCompletion:) open func initializeRecaptchaConfig(completion: ((Error?) -> Void)?) { Task { @@ -1486,13 +1314,10 @@ extension Auth: AuthInterop { } } - /** @fn initializeRecaptchaConfig - @brief Initializes reCAPTCHA using the settings configured for the project or - tenant. - - If you change the tenant ID of the `Auth` instance, the configuration will be - reloaded. - */ + /// Initializes reCAPTCHA using the settings configured for the project or tenant. + /// + /// If you change the tenant ID of the `Auth` instance, the configuration will be + /// reloaded. open func initializeRecaptchaConfig() async throws { // Trigger recaptcha verification flow to initialize the recaptcha client and // config. Recaptcha token will be returned. @@ -1501,24 +1326,21 @@ extension Auth: AuthInterop { } #endif - /** @fn addAuthStateDidChangeListener: - @brief Registers a block as an "auth state did change" listener. To be invoked when: - - + The block is registered as a listener, - + A user with a different UID from the current user has signed in, or - + The current user has signed out. - - @param listener The block to be invoked. The block is always invoked asynchronously on the main - thread, even for it's initial invocation after having been added as a listener. - - @remarks The block is invoked immediately after adding it according to it's standard invocation - semantics, asynchronously on the main thread. Users should pay special attention to - making sure the block does not inadvertently retain objects which should not be retained by - the long-lived block. The block itself will be retained by `Auth` until it is - unregistered or until the `Auth` instance is otherwise deallocated. - - @return A handle useful for manually unregistering the block as a listener. - */ + /// Registers a block as an "auth state did change" listener. + /// + /// To be invoked when: + /// * The block is registered as a listener, + /// * A user with a different UID from the current user has signed in, or + /// * The current user has signed out. + /// + /// The block is invoked immediately after adding it according to it's standard invocation + /// semantics, asynchronously on the main thread. Users should pay special attention to + /// making sure the block does not inadvertently retain objects which should not be retained by + /// the long-lived block. The block itself will be retained by `Auth` until it is + /// unregistered or until the `Auth` instance is otherwise deallocated. + /// - Parameter listener: The block to be invoked. The block is always invoked asynchronously on + /// the main thread, even for it's initial invocation after having been added as a listener. + /// - Returns: A handle useful for manually unregistering the block as a listener. @objc(addAuthStateDidChangeListener:) open func addStateDidChangeListener(_ listener: @escaping (Auth, User?) -> Void) -> NSObjectProtocol { @@ -1534,11 +1356,8 @@ extension Auth: AuthInterop { } } - /** @fn removeAuthStateDidChangeListener: - @brief Unregisters a block as an "auth state did change" listener. - - @param listenerHandle The handle for the listener. - */ + /// Unregisters a block as an "auth state did change" listener. + /// - Parameter listenerHandle: The handle for the listener. @objc(removeAuthStateDidChangeListener:) open func removeStateDidChangeListener(_ listenerHandle: NSObjectProtocol) { NotificationCenter.default.removeObserver(listenerHandle) @@ -1547,25 +1366,22 @@ extension Auth: AuthInterop { listenerHandles.remove(listenerHandle) } - /** @fn addIDTokenDidChangeListener: - @brief Registers a block as an "ID token did change" listener. To be invoked when: - - + The block is registered as a listener, - + A user with a different UID from the current user has signed in, - + The ID token of the current user has been refreshed, or - + The current user has signed out. - - @param listener The block to be invoked. The block is always invoked asynchronously on the main - thread, even for it's initial invocation after having been added as a listener. - - @remarks The block is invoked immediately after adding it according to it's standard invocation - semantics, asynchronously on the main thread. Users should pay special attention to - making sure the block does not inadvertently retain objects which should not be retained by - the long-lived block. The block itself will be retained by `Auth` until it is - unregistered or until the `Auth` instance is otherwise deallocated. - - @return A handle useful for manually unregistering the block as a listener. - */ + /// Registers a block as an "ID token did change" listener. + /// + /// To be invoked when: + /// * The block is registered as a listener, + /// * A user with a different UID from the current user has signed in, + /// * The ID token of the current user has been refreshed, or + /// * The current user has signed out. + /// + /// The block is invoked immediately after adding it according to it's standard invocation + /// semantics, asynchronously on the main thread. Users should pay special attention to + /// making sure the block does not inadvertently retain objects which should not be retained by + /// the long-lived block. The block itself will be retained by `Auth` until it is + /// unregistered or until the `Auth` instance is otherwise deallocated. + /// - Parameter listener: The block to be invoked. The block is always invoked asynchronously on + /// the main thread, even for it's initial invocation after having been added as a listener. + /// - Returns: A handle useful for manually unregistering the block as a listener. @objc open func addIDTokenDidChangeListener(_ listener: @escaping (Auth, User?) -> Void) -> NSObjectProtocol { let handle = NotificationCenter.default.addObserver( @@ -1586,11 +1402,8 @@ extension Auth: AuthInterop { return handle } - /** @fn removeIDTokenDidChangeListener: - @brief Unregisters a block as an "ID token did change" listener. - - @param listenerHandle The handle for the listener. - */ + /// Unregisters a block as an "ID token did change" listener. + /// - Parameter listenerHandle: The handle for the listener. @objc open func removeIDTokenDidChangeListener(_ listenerHandle: NSObjectProtocol) { NotificationCenter.default.removeObserver(listenerHandle) objc_sync_enter(Auth.self) @@ -1598,18 +1411,14 @@ extension Auth: AuthInterop { objc_sync_exit(Auth.self) } - /** @fn useAppLanguage - @brief Sets `languageCode` to the app's current language. - */ + /// Sets `languageCode` to the app's current language. @objc open func useAppLanguage() { kAuthGlobalWorkQueue.sync { self.requestConfiguration.languageCode = Locale.preferredLanguages.first } } - /** @fn useEmulatorWithHost:port - @brief Configures Firebase Auth to connect to an emulated host instead of the remote backend. - */ + /// Configures Firebase Auth to connect to an emulated host instead of the remote backend. @objc open func useEmulator(withHost host: String, port: Int) { guard host.count > 0 else { fatalError("Cannot connect to empty host") @@ -1624,11 +1433,9 @@ extension Auth: AuthInterop { } } - /** @fn revokeTokenWithAuthorizationCode:Completion - @brief Revoke the users token with authorization code. - @param completion (Optional) the block invoked when the request to revoke the token is - complete, or fails. Invoked asynchronously on the main thread in the future. - */ + /// Revoke the users token with authorization code. + /// - Parameter completion: (Optional) the block invoked when the request to revoke the token is + /// complete, or fails. Invoked asynchronously on the main thread in the future. @objc open func revokeToken(withAuthorizationCode authorizationCode: String, completion: ((Error?) -> Void)? = nil) { currentUser?.internalGetToken { idToken, error in @@ -1646,11 +1453,9 @@ extension Auth: AuthInterop { } } - /** @fn revokeTokenWithAuthorizationCode:Completion - @brief Revoke the users token with authorization code. - @param completion (Optional) the block invoked when the request to revoke the token is - complete, or fails. Invoked asynchronously on the main thread in the future. - */ + /// Revoke the users token with authorization code. + /// - Parameter completion: (Optional) the block invoked when the request to revoke the token is + /// complete, or fails. Invoked asynchronously on the main thread in the future. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func revokeToken(withAuthorizationCode authorizationCode: String) async throws { return try await withCheckedThrowingContinuation { continuation in @@ -1664,10 +1469,7 @@ extension Auth: AuthInterop { } } - /** @fn useUserAccessGroup:error: - @brief Switch userAccessGroup and current user to the given accessGroup and the user stored in - it. - */ + /// Switch userAccessGroup and current user to the given accessGroup and the user stored in it. @objc open func useUserAccessGroup(_ accessGroup: String?) throws { // self.storedUserManager is initialized asynchronously. Make sure it is done. kAuthGlobalWorkQueue.sync {} @@ -1686,12 +1488,11 @@ extension Auth: AuthInterop { lastNotifiedUserToken = user?.rawAccessToken() } - /** @fn getStoredUserForAccessGroup:error: - @brief Get the stored user in the given accessGroup. - @note This API is not supported on tvOS when `shareAuthStateAcrossDevices` is set to `true`. - This case will return `nil`. - Please refer to https://github.com/firebase/firebase-ios-sdk/issues/8878 for details. - */ + /// Get the stored user in the given accessGroup. + /// + /// This API is not supported on tvOS when `shareAuthStateAcrossDevices` is set to `true`. + /// and will return `nil`. + /// Please refer to https://github.com/firebase/firebase-ios-sdk/issues/8878 for details. @available(swift 1000.0) // Objective-C only API @objc(getStoredUserForAccessGroup:error:) open func __getStoredUser(forAccessGroup accessGroup: String?, @@ -1704,12 +1505,12 @@ extension Auth: AuthInterop { } } - /** @fn getStoredUserForAccessGroup - @brief Get the stored user in the given accessGroup. - @note This API is not supported on tvOS when `shareAuthStateAcrossDevices` is set to `true`. - This case will return `nil`. - Please refer to https://github.com/firebase/firebase-ios-sdk/issues/8878 for details. - */ + /// Get the stored user in the given accessGroup. + /// + /// This API is not supported on tvOS when `shareAuthStateAcrossDevices` is set to `true`. + /// and will return `nil`. + /// + /// Please refer to https://github.com/firebase/firebase-ios-sdk/issues/8878 for details. open func getStoredUser(forAccessGroup accessGroup: String?) throws -> User? { var user: User? if let accessGroup { @@ -1742,24 +1543,63 @@ extension Auth: AuthInterop { } #if os(iOS) + /// The APNs token used for phone number authentication. + /// + /// The type of the token (production or sandbox) will be automatically + /// detected based on your provisioning profile. + /// + /// This property is available on iOS only. + /// + /// If swizzling is disabled, the APNs Token must be set for phone number auth to work, + /// by either setting this property or by calling `setAPNSToken(_:type:)`. @objc(APNSToken) open var apnsToken: Data? { kAuthGlobalWorkQueue.sync { self.tokenManager.token?.data } } + /// Sets the APNs token along with its type. + /// + /// This method is available on iOS only. + /// + /// If swizzling is disabled, the APNs Token must be set for phone number auth to work, + /// by either setting calling this method or by setting the `APNSToken` property. @objc open func setAPNSToken(_ token: Data, type: AuthAPNSTokenType) { kAuthGlobalWorkQueue.sync { self.tokenManager.token = AuthAPNSToken(withData: token, type: type) } } + /// Whether the specific remote notification is handled by `Auth` . + /// + /// This method is available on iOS only. + /// + /// If swizzling is disabled, related remote notifications must be forwarded to this method + /// for phone number auth to work. + /// - Parameter userInfo: A dictionary that contains information related to the + /// notification in question. + /// - Returns: Whether or the notification is handled. A return value of `true` means the + /// notification is for Firebase Auth so the caller should ignore the notification from further + /// processing, and `false` means the notification is for the app (or another library) so + /// the caller should continue handling this notification as usual. @objc open func canHandleNotification(_ userInfo: [AnyHashable: Any]) -> Bool { kAuthGlobalWorkQueue.sync { self.notificationManager.canHandle(notification: userInfo) } } + /// Whether the specific URL is handled by `Auth` . + /// + /// This method is available on iOS only. + /// + /// If swizzling is disabled, URLs received by the application delegate must be forwarded + /// to this method for phone number auth to work. + /// - Parameter url: The URL received by the application delegate from any of the openURL + /// method. + /// - Returns: Whether or the URL is handled. `true` means the URL is for Firebase Auth + /// so the caller should ignore the URL from further processing, and `false` means the + /// the URL is for the app (or another library) so the caller should continue handling + /// this URL as usual. @objc(canHandleURL:) open func canHandle(_ url: URL) -> Bool { kAuthGlobalWorkQueue.sync { guard let authURLPresenter = self.authURLPresenter as? AuthURLPresenter else { @@ -1770,6 +1610,10 @@ extension Auth: AuthInterop { } #endif + /// The name of the `NSNotificationCenter` notification which is posted when the auth state + /// changes (for example, a new token has been produced, a user signs in or signs out). + /// + /// The object parameter of the notification is the sender `Auth` instance. public static let authStateDidChangeNotification = NSNotification.Name(rawValue: "FIRAuthStateDidChangeNotification") @@ -1937,10 +1781,8 @@ extension Auth: AuthInterop { return user } - /** @fn keychainServiceNameForAppName: - @brief Gets the keychain service name global data for the particular app by name. - @param appName The name of the Firebase app to get keychain service name for. - */ + /// Gets the keychain service name global data for the particular app by name. + /// - Parameter appName: The name of the Firebase app to get keychain service name for. class func keychainServiceForAppID(_ appID: String) -> String { return "firebase_auth_\(appID)" } @@ -1960,38 +1802,31 @@ extension Auth: AuthInterop { return nil } - /** @var gKeychainServiceNameForAppName - @brief A map from Firebase app name to keychain service names. - @remarks This map is needed for looking up the keychain service name after the FIRApp instance - is deleted, to remove the associated keychain item. Accessing should occur within a - @syncronized([FIRAuth class]) context."" - */ + /// A map from Firebase app name to keychain service names. + /// + /// This map is needed for looking up the keychain service name after the FirebaseApp instance + /// is deleted, to remove the associated keychain item. Accessing should occur within a + /// @syncronized([FIRAuth class]) context. fileprivate static var gKeychainServiceNameForAppName: [String: String] = [:] - /** @fn setKeychainServiceNameForApp - @brief Sets the keychain service name global data for the particular app. - @param app The Firebase app to set keychain service name for. - */ + /// Sets the keychain service name global data for the particular app. + /// - Parameter app: The Firebase app to set keychain service name for. class func setKeychainServiceNameForApp(_ app: FirebaseApp) { objc_sync_enter(Auth.self) gKeychainServiceNameForAppName[app.name] = "firebase_auth_\(app.options.googleAppID)" objc_sync_exit(Auth.self) } - /** @fn keychainServiceNameForAppName: - @brief Gets the keychain service name global data for the particular app by name. - @param appName The name of the Firebase app to get keychain service name for. - */ + /// Gets the keychain service name global data for the particular app by name. + /// - Parameter appName: The name of the Firebase app to get keychain service name for. class func keychainServiceName(forAppName appName: String) -> String? { objc_sync_enter(Auth.self) defer { objc_sync_exit(Auth.self) } return gKeychainServiceNameForAppName[appName] } - /** @fn deleteKeychainServiceNameForAppName: - @brief Deletes the keychain service name global data for the particular app by name. - @param appName The name of the Firebase app to delete keychain service name for. - */ + /// Deletes the keychain service name global data for the particular app by name. + /// - Parameter appName: The name of the Firebase app to delete keychain service name for. class func deleteKeychainServiceNameForAppName(_ appName: String) { objc_sync_enter(Auth.self) gKeychainServiceNameForAppName.removeValue(forKey: appName) @@ -2007,9 +1842,7 @@ extension Auth: AuthInterop { // MARK: Private methods - /** @fn possiblyPostAuthStateChangeNotification - @brief Posts the auth state change notificaton if current user's token has been changed. - */ + /// Posts the auth state change notificaton if current user's token has been changed. private func possiblyPostAuthStateChangeNotification() { let token = currentUser?.rawAccessToken() if lastNotifiedUserToken == token || @@ -2039,23 +1872,20 @@ extension Auth: AuthInterop { } } - /** @fn scheduleAutoTokenRefreshWithDelay: - @brief Schedules a task to automatically refresh tokens on the current user. The0 token refresh - is scheduled 5 minutes before the scheduled expiration time. - @remarks If the token expires in less than 5 minutes, schedule the token refresh immediately. - */ + /// Schedules a task to automatically refresh tokens on the current user. The0 token refresh + /// is scheduled 5 minutes before the scheduled expiration time. + /// + /// If the token expires in less than 5 minutes, schedule the token refresh immediately. private func scheduleAutoTokenRefresh() { let tokenExpirationInterval = (currentUser?.accessTokenExpirationDate()?.timeIntervalSinceNow ?? 0) - 5 * 60 scheduleAutoTokenRefresh(withDelay: max(tokenExpirationInterval, 0), retry: false) } - /** @fn scheduleAutoTokenRefreshWithDelay: - @brief Schedules a task to automatically refresh tokens on the current user. - @param delay The delay in seconds after which the token refresh task should be scheduled to be - executed. - @param retry Flag to determine whether the invocation is a retry attempt or not. - */ + /// Schedules a task to automatically refresh tokens on the current user. + /// - Parameter delay: The delay in seconds after which the token refresh task should be scheduled + /// to be executed. + /// - Parameter retry: Flag to determine whether the invocation is a retry attempt or not. private func scheduleAutoTokenRefresh(withDelay delay: TimeInterval, retry: Bool) { guard let accessToken = currentUser?.rawAccessToken() else { return @@ -2099,16 +1929,15 @@ extension Auth: AuthInterop { } } - /** @fn updateCurrentUser:byForce:savingToDisk:error: - @brief Update the current user; initializing the user's internal properties correctly, and - optionally saving the user to disk. - @remarks This method is called during: sign in and sign out events, as well as during class - initialization time. The only time the saveToDisk parameter should be set to NO is during - class initialization time because the user was just read from disk. - @param user The user to use as the current user (including nil, which is passed at sign out - time.) - @param saveToDisk Indicates the method should persist the user data to disk. - */ + /// Update the current user; initializing the user's internal properties correctly, and + /// optionally saving the user to disk. + /// + /// This method is called during: sign in and sign out events, as well as during class + /// initialization time. The only time the saveToDisk parameter should be set to NO is during + /// class initialization time because the user was just read from disk. + /// - Parameter user: The user to use as the current user (including nil, which is passed at sign + /// out time.) + /// - Parameter saveToDisk: Indicates the method should persist the user data to disk. func updateCurrentUser(_ user: User?, byForce force: Bool, savingToDisk saveToDisk: Bool) throws { if user == currentUser { @@ -2169,15 +1998,11 @@ extension Auth: AuthInterop { } } - /** @fn completeSignInWithTokenService:callback: - @brief Completes a sign-in flow once we have access and refresh tokens for the user. - @param accessToken The STS access token. - @param accessTokenExpirationDate The approximate expiration date of the access token. - @param refreshToken The STS refresh token. - @param anonymous Whether or not the user is anonymous. - @param callback Called when the user has been signed in or when an error occurred. Invoked - asynchronously on the global auth work queue in the future. - */ + /// Completes a sign-in flow once we have access and refresh tokens for the user. + /// - Parameter accessToken: The STS access token. + /// - Parameter accessTokenExpirationDate: The approximate expiration date of the access token. + /// - Parameter refreshToken: The STS refresh token. + /// - Parameter anonymous: Whether or not the user is anonymous. @discardableResult func completeSignIn(withAccessToken accessToken: String?, accessTokenExpirationDate: Date?, @@ -2190,15 +2015,12 @@ extension Auth: AuthInterop { anonymous: anonymous) } - /** @fn internalSignInAndRetrieveDataWithEmail:password:callback: - @brief Signs in using an email address and password. - @param email The user's email address. - @param password The user's password. - @param completion A block which is invoked when the sign in finishes (or is cancelled.) Invoked - asynchronously on the global auth work queue in the future. - @remarks This is the internal counterpart of this method, which uses a callback that does not - update the current user. - */ + /// Signs in using an email address and password. + /// + /// This is the internal counterpart of this method, which uses a callback that does not + /// update the current user. + /// - Parameter email: The user's email address. + /// - Parameter password: The user's password. private func internalSignInAndRetrieveData(withEmail email: String, password: String) async throws -> AuthDataResult { let credential = EmailAuthCredential(withEmail: email, password: password) @@ -2286,13 +2108,9 @@ extension Auth: AuthInterop { } #if os(iOS) - /** @fn signInWithPhoneCredential:callback: - @brief Signs in using a phone credential. - @param credential The Phone Auth credential used to sign in. - @param operation The type of operation for which this sign-in attempt is initiated. - @param callback A block which is invoked when the sign in finishes (or is cancelled.) Invoked - asynchronously on the global auth work queue in the future. - */ + /// Signs in using a phone credential. + /// - Parameter credential: The Phone Auth credential used to sign in. + /// - Parameter operation: The type of operation for which this sign-in attempt is initiated. private func signIn(withPhoneCredential credential: PhoneAuthCredential, operation: AuthOperationType) async throws -> VerifyPhoneNumberResponse { switch credential.credentialKind { @@ -2319,12 +2137,8 @@ extension Auth: AuthInterop { #endif #if !os(watchOS) - /** @fn signInAndRetrieveDataWithGameCenterCredential:callback: - @brief Signs in using a game center credential. - @param credential The Game Center Auth Credential used to sign in. - @param callback A block which is invoked when the sign in finished (or is cancelled). Invoked - asynchronously on the global auth work queue in the future. - */ + /// Signs in using a game center credential. + /// - Parameter credential: The Game Center Auth Credential used to sign in. private func signInAndRetrieveData(withGameCenterCredential credential: GameCenterAuthCredential) async throws -> AuthDataResult { guard let publicKeyURL = credential.publicKeyURL, @@ -2358,13 +2172,9 @@ extension Auth: AuthInterop { #endif - /** @fn internalSignInAndRetrieveDataWithEmail:link:completion: - @brief Signs in using an email and email sign-in link. - @param email The user's email address. - @param link The email sign-in link. - @param callback A block which is invoked when the sign in finishes (or is cancelled.) Invoked - asynchronously on the global auth work queue in the future. - */ + /// Signs in using an email and email sign-in link. + /// - Parameter email: The user's email address. + /// - Parameter link: The email sign-in link. private func internalSignInAndRetrieveData(withEmail email: String, link: String) async throws -> AuthDataResult { guard isSignIn(withEmailLink: link) else { @@ -2404,15 +2214,15 @@ extension Auth: AuthInterop { return queryItems } - /** @fn signInFlowAuthDataResultCallbackByDecoratingCallback: - @brief Creates a AuthDataResultCallback block which wraps another AuthDataResultCallback; - trying to update the current user before forwarding it's invocations along to a subject block. - @param callback Called when the user has been updated or when an error has occurred. Invoked - asynchronously on the main thread in the future. - @return Returns a block that updates the current user. - @remarks Typically invoked as part of the complete sign-in flow. For any other uses please - consider alternative ways of updating the current user. - */ + /// Creates a AuthDataResultCallback block which wraps another AuthDataResultCallback; + /// trying to update the current user before forwarding it's invocations along to a subject + /// block. + /// + /// Typically invoked as part of the complete sign-in flow. For any other uses please + /// consider alternative ways of updating the current user. + /// - Parameter callback: Called when the user has been updated or when an error has occurred. + /// Invoked asynchronously on the main thread in the future. + /// - Returns: Returns a block that updates the current user. func signInFlowAuthDataResultCallback(byDecorating callback: ((AuthDataResult?, Error?) -> Void)?) -> (AuthDataResult?, Error?) -> Void { let authDataCallback: (((AuthDataResult?, Error?) -> Void)?, AuthDataResult?, Error?) -> Void = @@ -2514,106 +2324,72 @@ extension Auth: AuthInterop { // MARK: Internal properties - /** @property mainBundle - @brief Allow tests to swap in an alternate mainBundle. - */ + /// Allow tests to swap in an alternate mainBundle. var mainBundleUrlTypes: [[String: Any]]! - /** @property requestConfiguration - @brief The configuration object comprising of parameters needed to make a request to Firebase - Auth's backend. - */ + /// The configuration object comprising of parameters needed to make a request to Firebase + /// Auth's backend. var requestConfiguration: AuthRequestConfiguration #if os(iOS) - /** @property tokenManager - @brief The manager for APNs tokens used by phone number auth. - */ + + /// The manager for APNs tokens used by phone number auth. var tokenManager: AuthAPNSTokenManager! - /** @property appCredentailManager - @brief The manager for app credentials used by phone number auth. - */ + /// The manager for app credentials used by phone number auth. var appCredentialManager: AuthAppCredentialManager! - /** @property notificationManager - @brief The manager for remote notifications used by phone number auth. - */ + /// The manager for remote notifications used by phone number auth. var notificationManager: AuthNotificationManager! - /** @property authURLPresenter - @brief An object that takes care of presenting URLs via the auth instance. - */ + /// An object that takes care of presenting URLs via the auth instance. var authURLPresenter: AuthWebViewControllerDelegate #endif // TARGET_OS_IOS // MARK: Private properties - /** @property storedUserManager - @brief The stored user manager. - */ + /// The stored user manager. private var storedUserManager: AuthStoredUserManager! - /** @var _firebaseAppName - @brief The Firebase app name. - */ + /// The Firebase app name. private let firebaseAppName: String - /** @var _keychainServices - @brief The keychain service. - */ + /// The keychain service. private var keychainServices: AuthKeychainServices! - /** @var _lastNotifiedUserToken - @brief The user access (ID) token used last time for posting auth state changed notification. - */ + /// The user access (ID) token used last time for posting auth state changed notification. private var lastNotifiedUserToken: String? - /** @var _autoRefreshTokens - @brief This flag denotes whether or not tokens should be automatically refreshed. - @remarks Will only be set to @YES if the another Firebase service is included (additionally to - Firebase Auth). - */ + /// This flag denotes whether or not tokens should be automatically refreshed. + /// Will only be set to `true` if the another Firebase service is included (additionally to + /// Firebase Auth). private var autoRefreshTokens = false - /** @var _autoRefreshScheduled - @brief Whether or not token auto-refresh is currently scheduled. - */ + /// Whether or not token auto-refresh is currently scheduled. private var autoRefreshScheduled = false - /** @var _isAppInBackground - @brief A flag that is set to YES if the app is put in the background and no when the app is - returned to the foreground. - */ + /// A flag that is set to YES if the app is put in the background and no when the app is + /// returned to the foreground. private var isAppInBackground = false - /** @var _applicationDidBecomeActiveObserver - @brief An opaque object to act as the observer for UIApplicationDidBecomeActiveNotification. - */ + /// An opaque object to act as the observer for UIApplicationDidBecomeActiveNotification. private var applicationDidBecomeActiveObserver: NSObjectProtocol? - /** @var _applicationDidBecomeActiveObserver - @brief An opaque object to act as the observer for - UIApplicationDidEnterBackgroundNotification. - */ + /// An opaque object to act as the observer for + /// UIApplicationDidEnterBackgroundNotification. private var applicationDidEnterBackgroundObserver: NSObjectProtocol? - /** @var _protectedDataDidBecomeAvailableObserver - @brief An opaque object to act as the observer for - UIApplicationProtectedDataDidBecomeAvailable. - */ + /// An opaque object to act as the observer for + /// UIApplicationProtectedDataDidBecomeAvailable. private var protectedDataDidBecomeAvailableObserver: NSObjectProtocol? - /** @var kUserKey - @brief Key of user stored in the keychain. Prefixed with a Firebase app name. - */ + /// Key of user stored in the keychain. Prefixed with a Firebase app name. private let kUserKey = "_firebase_user" - /** @var _listenerHandles - @brief Handles returned from @c NSNotificationCenter for blocks which are "auth state did - change" notification listeners. - @remarks Mutations should occur within a @syncronized(self) context. - */ + /// Handles returned from `NSNotificationCenter` for blocks which are "auth state did + /// change" notification listeners. + /// + /// Mutations should occur within a @syncronized(self) context. private var listenerHandles: NSMutableArray = [] } diff --git a/FirebaseAuth/Sources/Swift/Auth/AuthDataResult.swift b/FirebaseAuth/Sources/Swift/Auth/AuthDataResult.swift index 7462ff87725..bd09c1ddac2 100644 --- a/FirebaseAuth/Sources/Swift/Auth/AuthDataResult.swift +++ b/FirebaseAuth/Sources/Swift/Auth/AuthDataResult.swift @@ -17,35 +17,29 @@ import Foundation @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) extension AuthDataResult: NSSecureCoding {} -/** @class AuthDataResult - @brief Helper object that contains the result of a successful sign-in, link and reauthenticate - action. It contains references to a `User` instance and a `AdditionalUserInfo` instance. - */ +/// Helper object that contains the result of a successful sign-in, link and reauthenticate +/// action. +/// +/// It contains references to a `User` instance and an `AdditionalUserInfo` instance. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRAuthDataResult) open class AuthDataResult: NSObject { - /** @property user - @brief The signed in user. - */ + /// The signed in user. @objc public let user: User - /** @property additionalUserInfo - @brief If available contains the additional IdP specific information about signed in user. - */ + /// If available, contains the additional IdP specific information about signed in user. @objc public let additionalUserInfo: AdditionalUserInfo? - /** @property credential - @brief This property will be non-nil after a successful headful-lite sign-in via - `signIn(with:uiDelegate:completion:)`. May be used to obtain the accessToken and/or IDToken - pertaining to a recently signed-in user. - */ + /// This property will be non-nil after a successful headful-lite sign-in via + /// `signIn(with:uiDelegate:completion:)`. + /// + /// May be used to obtain the accessToken and/or IDToken + /// pertaining to a recently signed-in user. @objc public let credential: OAuthCredential? - /** @fn initWithUser:additionalUserInfo: - @brief Designated initializer. - @param user The signed in user reference. - @param additionalUserInfo The additional user info. - @param credential The updated OAuth credential if available. - */ + /// Designated initializer. + /// - Parameter user: The signed in user reference. + /// - Parameter additionalUserInfo: The additional user info. + /// - Parameter credential: The updated OAuth credential if available. init(withUser user: User, additionalUserInfo: AdditionalUserInfo?, credential: OAuthCredential? = nil) { diff --git a/FirebaseAuth/Sources/Swift/Auth/AuthDispatcher.swift b/FirebaseAuth/Sources/Swift/Auth/AuthDispatcher.swift index b2bc47322de..6373cdfb4cc 100644 --- a/FirebaseAuth/Sources/Swift/Auth/AuthDispatcher.swift +++ b/FirebaseAuth/Sources/Swift/Auth/AuthDispatcher.swift @@ -14,26 +14,22 @@ import Foundation -/** @class AuthDispatcher - @brief A utility class used to facilitate scheduling tasks to be executed in the future. - */ +/// A utility class used to facilitate scheduling tasks to be executed in the future. class AuthDispatcher { static let shared = AuthDispatcher() - /** @property dispatchAfterImplementation - @brief Allows custom implementation of dispatchAfterDelay:queue:callback:. - @remarks Set to nil to restore default implementation. - */ + /// Allows custom implementation of dispatchAfterDelay:queue:callback:. + /// + /// Set to nil to restore default implementation. var dispatchAfterImplementation: ((TimeInterval, DispatchQueue, @escaping () -> Void) -> Void)? - /** @fn dispatchAfterDelay:queue:callback: - @brief Schedules task in the future after a specified delay. - - @param delay The delay in seconds after which the task will be scheduled to execute. - @param queue The dispatch queue on which the task will be submitted. - @param task The task (block) to be scheduled for future execution. - */ - func dispatch(afterDelay delay: TimeInterval, queue: DispatchQueue, task: @escaping () -> Void) { + /// Schedules task in the future after a specified delay. + /// - Parameter delay: The delay in seconds after which the task will be scheduled to execute. + /// - Parameter queue: The dispatch queue on which the task will be submitted. + /// - Parameter task: The task(block) to be scheduled for future execution. + func dispatch(afterDelay delay: TimeInterval, + queue: DispatchQueue, + task: @escaping () -> Void) { if let dispatchAfterImplementation { dispatchAfterImplementation(delay, queue, task) } else { diff --git a/FirebaseAuth/Sources/Swift/Auth/AuthOperationType.swift b/FirebaseAuth/Sources/Swift/Auth/AuthOperationType.swift index c21b561b9b6..08ffe5cf8c0 100644 --- a/FirebaseAuth/Sources/Swift/Auth/AuthOperationType.swift +++ b/FirebaseAuth/Sources/Swift/Auth/AuthOperationType.swift @@ -13,28 +13,21 @@ // limitations under the License. import Foundation -/** - @brief Indicates the type of operation performed for RPCs that support the operation - parameter. - */ + +/// Indicates the type of operation performed for RPCs that support the operation parameter. enum AuthOperationType: Int { - /** Indicates that the operation type is uspecified. - */ + /// Indicates that the operation type is uspecified. case unspecified = 0 - /** Indicates that the operation type is sign in or sign up. - */ + /// Indicates that the operation type is sign in or sign up. case signUpOrSignIn = 1 - /** Indicates that the operation type is reauthentication. - */ + /// Indicates that the operation type is reauthentication. case reauth = 2 - /** Indicates that the operation type is update. - */ + /// Indicates that the operation type is update. case update = 3 - /** Indicates that the operation type is link. - */ + /// Indicates that the operation type is link. case link = 4 } diff --git a/FirebaseAuth/Sources/Swift/Auth/AuthSettings.swift b/FirebaseAuth/Sources/Swift/Auth/AuthSettings.swift index 10ce42396dc..dbd77df5306 100644 --- a/FirebaseAuth/Sources/Swift/Auth/AuthSettings.swift +++ b/FirebaseAuth/Sources/Swift/Auth/AuthSettings.swift @@ -14,14 +14,12 @@ import Foundation -/** @class AuthSettings - @brief Determines settings related to an auth object. - */ +/// Determines settings related to an auth object. @objc(FIRAuthSettings) open class AuthSettings: NSObject, NSCopying { - /** @property appVerificationDisabledForTesting - @brief Flag to determine whether app verification should be disabled for testing or not. - */ + /// Flag to determine whether app verification should be disabled for testing or not. @objc open var appVerificationDisabledForTesting: Bool + + /// Flag to determine whether app verification should be disabled for testing or not. @objc open var isAppVerificationDisabledForTesting: Bool { get { return appVerificationDisabledForTesting diff --git a/FirebaseAuth/Sources/Swift/Auth/AuthTokenResult.swift b/FirebaseAuth/Sources/Swift/Auth/AuthTokenResult.swift index 47c3e592947..76bdbb73204 100644 --- a/FirebaseAuth/Sources/Swift/Auth/AuthTokenResult.swift +++ b/FirebaseAuth/Sources/Swift/Auth/AuthTokenResult.swift @@ -16,48 +16,35 @@ import Foundation extension AuthTokenResult: NSSecureCoding {} -/** @class FIRAuthTokenResult - @brief A data class containing the ID token JWT string and other properties associated with the - token including the decoded payload claims. - */ +/// A data class containing the ID token JWT string and other properties associated with the +/// token including the decoded payload claims. @objc(FIRAuthTokenResult) open class AuthTokenResult: NSObject { - /** @property token - @brief Stores the JWT string of the ID token. - */ + /// Stores the JWT string of the ID token. @objc open var token: String - /** @property expirationDate - @brief Stores the ID token's expiration date. - */ + /// Stores the ID token's expiration date. @objc open var expirationDate: Date - /** @property authDate - @brief Stores the ID token's authentication date. - @remarks This is the date the user was signed in and NOT the date the token was refreshed. - */ + /// Stores the ID token's authentication date. + /// + /// This is the date the user was signed in and NOT the date the token was refreshed. @objc open var authDate: Date - /** @property issuedAtDate - @brief Stores the date that the ID token was issued. - @remarks This is the date last refreshed and NOT the last authentication date. - */ + /// Stores the date that the ID token was issued. + /// + /// This is the date last refreshed and NOT the last authentication date. @objc open var issuedAtDate: Date - /** @property signInProvider - @brief Stores sign-in provider through which the token was obtained. - @remarks This does not necessarily map to provider IDs. - */ + /// Stores sign-in provider through which the token was obtained. @objc open var signInProvider: String - /** @property signInSecondFactor - @brief Stores sign-in second factor through which the token was obtained. - */ + /// Stores sign-in second factor through which the token was obtained. @objc open var signInSecondFactor: String - /** @property claims - @brief Stores the entire payload of claims found on the ID token. This includes the standard - reserved claims as well as custom claims set by the developer via the Admin SDK. - */ + /// Stores the entire payload of claims found on the ID token. + /// + /// This includes the standard + /// reserved claims as well as custom claims set by the developer via the Admin SDK. @objc open var claims: [String: Any] private class func getTokenPayloadData(_ token: String) -> Data? { @@ -68,12 +55,12 @@ extension AuthTokenResult: NSSecureCoding {} return nil } - // The token payload is always the second index of the array. + /// The token payload is always the second index of the array. let IDToken = tokenStringArray[1] - // Convert the base64URL encoded string to a base64 encoded string. - // Replace "_" with "/" - // Replace "-" with "+" + /// Convert the base64URL encoded string to a base64 encoded string. + /// * Replace "_" with "/" + /// * Replace "-" with "+" var tokenPayload = IDToken.replacingOccurrences(of: "_", with: "/") .replacingOccurrences(of: "-", with: "+") @@ -104,11 +91,9 @@ extension AuthTokenResult: NSSecureCoding {} return jwt } - /** @fn tokenResultWithToken: - @brief Parse a token string to a structured token. - @param token The token string to parse. - @return A structured token result. - */ + /// Parse a token string to a structured token. + /// - Parameter token: The token string to parse. + /// - Returns: A structured token result. @objc open class func tokenResult(token: String) -> AuthTokenResult? { guard let payloadData = getTokenPayloadData(token), let claims = getTokenPayloadDictionary(payloadData), diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/AuthCredential.swift b/FirebaseAuth/Sources/Swift/AuthProvider/AuthCredential.swift index ea2cebbe7d3..0500875b10f 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/AuthCredential.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/AuthCredential.swift @@ -14,12 +14,12 @@ import Foundation -/** - @brief Public representation of a credential. - */ +/// Public representation of a credential. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRAuthCredential) open class AuthCredential: NSObject { + /// The name of the identity provider for the credential. @objc public let provider: String + init(provider: String) { self.provider = provider } diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/AuthProviderStrings.swift b/FirebaseAuth/Sources/Swift/AuthProvider/AuthProviderStrings.swift index a11e7e7ec25..978497fc8f4 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/AuthProviderStrings.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/AuthProviderStrings.swift @@ -14,6 +14,7 @@ import Foundation +/// Enumeration of the available Auth Providers. public enum AuthProviderString: String { case apple = "apple.com" case email = "password" diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/EmailAuthProvider.swift b/FirebaseAuth/Sources/Swift/AuthProvider/EmailAuthProvider.swift index 047df6a46a9..0675f02f737 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/EmailAuthProvider.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/EmailAuthProvider.swift @@ -14,31 +14,24 @@ import Foundation -/** - @brief A concrete implementation of `AuthProvider` for Email & Password Sign In. - */ +/// A concrete implementation of `AuthProvider` for Email & Password Sign In. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIREmailAuthProvider) open class EmailAuthProvider: NSObject { + /// A string constant identifying the email & password identity provider. @objc public static let id = "password" - /** - @brief Creates an `AuthCredential` for an email & password sign in. - - @param email The user's email address. - @param password The user's password. - @return An `AuthCredential` containing the email & password credential. - */ + /// Creates an `AuthCredential` for an email & password sign in + /// - Parameter email: The user's email address. + /// - Parameter password: The user's password. + /// - Returns: An `AuthCredential` containing the email & password credential. @objc open class func credential(withEmail email: String, password: String) -> AuthCredential { return EmailAuthCredential(withEmail: email, password: password) } - /** @fn credentialWithEmail:Link: - @brief Creates an `AuthCredential` for an email & link sign in. - - @param email The user's email address. - @param link The email sign-in link. - @return An `AuthCredential` containing the email & link credential. - */ + /// Creates an `AuthCredential` for an email & link sign in. + /// - Parameter email: The user's email address. + /// - Parameter link: The email sign-in link. + /// - Returns: An `AuthCredential` containing the email & link credential. @objc open class func credential(withEmail email: String, link: String) -> AuthCredential { return EmailAuthCredential(withEmail: email, link: link) } diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/FacebookAuthProvider.swift b/FirebaseAuth/Sources/Swift/AuthProvider/FacebookAuthProvider.swift index e868f1c9b91..9ffbec55dba 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/FacebookAuthProvider.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/FacebookAuthProvider.swift @@ -14,19 +14,15 @@ import Foundation -/** - @brief Utility class for constructing Facebook Sign In credentials. - */ +/// Utility class for constructing Facebook Sign In credentials. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRFacebookAuthProvider) open class FacebookAuthProvider: NSObject { + /// A string constant identifying the Facebook identity provider. @objc public static let id = "facebook.com" - /** - @brief Creates an `AuthCredential` for a Facebook sign in. - - @param accessToken The Access Token from Facebook. - @return An AuthCredential containing the Facebook credentials. - */ + /// Creates an `AuthCredential` for a Facebook sign in. + /// - Parameter accessToken: The Access Token from Facebook. + /// - Returns: An `AuthCredential` containing the Facebook credentials. @objc open class func credential(withAccessToken accessToken: String) -> AuthCredential { return FacebookAuthCredential(withAccessToken: accessToken) } diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/FederatedAuthProvider.swift b/FirebaseAuth/Sources/Swift/AuthProvider/FederatedAuthProvider.swift index 44969082bec..419f87f06af 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/FederatedAuthProvider.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/FederatedAuthProvider.swift @@ -14,19 +14,16 @@ import Foundation -/** - Utility type for constructing federated auth provider credentials. - */ +/// Utility type for constructing federated auth provider credentials. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRFederatedAuthProvider) public protocol FederatedAuthProvider: NSObjectProtocol { #if os(iOS) - /** @fn getCredentialWithUIDelegate:completion: - @brief Used to obtain an auth credential via a mobile web flow. - This method is available on iOS only. - @param UIDelegate An optional UI delegate used to present the mobile web flow. - */ + + /// Used to obtain an auth credential via a mobile web flow. + /// This method is available on iOS only. + /// - Parameter uiDelegate: An optional UI delegate used to present the mobile web flow. @available(iOS 13, tvOS 13, macOS 10.15, watchOS 8, *) @objc(getCredentialWithUIDelegate:completion:) - func credential(with UIDelegate: AuthUIDelegate?) async throws -> AuthCredential + func credential(with uiDelegate: AuthUIDelegate?) async throws -> AuthCredential #endif } diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/GameCenterAuthProvider.swift b/FirebaseAuth/Sources/Swift/AuthProvider/GameCenterAuthProvider.swift index 45168981047..aecab7ca77d 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/GameCenterAuthProvider.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/GameCenterAuthProvider.swift @@ -28,16 +28,13 @@ @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) extension GameCenterAuthProvider: WarningWorkaround {} - /** - @brief A concrete implementation of `AuthProvider` for Game Center Sign In. Not available on watchOS. - */ + /// A concrete implementation of `AuthProvider` for Game Center Sign In. Not available on watchOS. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRGameCenterAuthProvider) open class GameCenterAuthProvider: NSObject { + /// A string constant identifying the Game Center identity provider. @objc public static let id = "gc.apple.com" - /** @fn - @brief Creates an `AuthCredential` for a Game Center sign in. - */ + /// Creates an `AuthCredential` for a Game Center sign in. @objc open class func getCredential(completion: @escaping (AuthCredential?, Error?) -> Void) { /** Linking GameKit.framework without using it on macOS results in App Store rejection. @@ -92,7 +89,7 @@ completion(nil, error) } else { /** - @c `localPlayer.alias` is actually the displayname needed, instead of + `localPlayer.alias` is actually the displayname needed, instead of `localPlayer.displayname`. For more information, check https://developer.apple.com/documentation/gamekit/gkplayer **/ @@ -110,9 +107,7 @@ } } - /** @fn - @brief Creates an `AuthCredential` for a Game Center sign in. - */ + /// Creates an `AuthCredential` for a Game Center sign in. @available(iOS 13, tvOS 13, macOS 10.15, watchOS 8, *) open class func getCredential() async throws -> AuthCredential { return try await withCheckedThrowingContinuation { continuation in @@ -133,8 +128,8 @@ } @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) - @objc(FIRGameCenterAuthCredential) class GameCenterAuthCredential: AuthCredential, - NSSecureCoding { + @objc(FIRGameCenterAuthCredential) + class GameCenterAuthCredential: AuthCredential, NSSecureCoding { let playerID: String let teamPlayerID: String? let gamePlayerID: String? @@ -144,17 +139,14 @@ let timestamp: UInt64 let displayName: String - /** - @brief Designated initializer. - @param playerID The ID of the Game Center local player. - @param teamPlayerID The teamPlayerID of the Game Center local player. - @param gamePlayerID The gamePlayerID of the Game Center local player. - @param publicKeyURL The URL for the public encryption key. - @param signature The verification signature generated. - @param salt A random string used to compute the hash and keep it randomized. - @param timestamp The date and time that the signature was created. - @param displayName The display name of the Game Center player. - */ + /// - Parameter playerID: The ID of the Game Center local player. + /// - Parameter teamPlayerID: The teamPlayerID of the Game Center local player. + /// - Parameter gamePlayerID: The gamePlayerID of the Game Center local player. + /// - Parameter publicKeyURL: The URL for the public encryption key. + /// - Parameter signature: The verification signature generated. + /// - Parameter salt: A random string used to compute the hash and keep it randomized. + /// - Parameter timestamp: The date and time that the signature was created. + /// - Parameter displayName: The display name of the Game Center player. init(withPlayerID playerID: String, teamPlayerID: String?, gamePlayerID: String?, publicKeyURL: URL?, signature: Data?, salt: Data?, timestamp: UInt64, displayName: String) { diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/GitHubAuthProvider.swift b/FirebaseAuth/Sources/Swift/AuthProvider/GitHubAuthProvider.swift index 0385cfca5b4..4704e4fe014 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/GitHubAuthProvider.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/GitHubAuthProvider.swift @@ -14,19 +14,15 @@ import Foundation -/** - @brief Utility class for constructing GitHub Sign In credentials. - */ +/// Utility class for constructing GitHub Sign In credentials. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRGitHubAuthProvider) open class GitHubAuthProvider: NSObject { + /// A string constant identifying the GitHub identity provider. @objc public static let id = "github.com" - /** - @brief Creates an `AuthCredential` for a GitHub sign in. - - @param token The GitHub OAuth access token. - @return An AuthCredential containing the GitHub credentials. - */ + /// Creates an `AuthCredential` for a GitHub sign in. + /// - Parameter token: The GitHub OAuth access token. + /// - Returns: An AuthCredential containing the GitHub credentials. @objc open class func credential(withToken token: String) -> AuthCredential { return GitHubAuthCredential(withToken: token) } diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/GoogleAuthProvider.swift b/FirebaseAuth/Sources/Swift/AuthProvider/GoogleAuthProvider.swift index ce198358803..b4f3b806837 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/GoogleAuthProvider.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/GoogleAuthProvider.swift @@ -14,23 +14,19 @@ import Foundation -/** - @brief Utility class for constructing Google Sign In credentials. - */ +/// Utility class for constructing Google Sign In credentials. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRGoogleAuthProvider) open class GoogleAuthProvider: NSObject { + /// A string constant identifying the Google identity provider. @objc public static let id = "google.com" - /** - @brief Creates an `AuthCredential` for a Google sign in. - - @param IDToken The ID Token from Google. - @param accessToken The Access Token from Google. - @return An AuthCredential containing the Google credentials. - */ - @objc open class func credential(withIDToken IDToken: String, + /// Creates an `AuthCredential` for a Google sign in. + /// - Parameter idToken: The ID Token from Google. + /// - Parameter accessToken: The Access Token from Google. + /// - Returns: An AuthCredential containing the Google credentials. + @objc open class func credential(withIDToken idToken: String, accessToken: String) -> AuthCredential { - return GoogleAuthCredential(withIDToken: IDToken, accessToken: accessToken) + return GoogleAuthCredential(withIDToken: idToken, accessToken: accessToken) } @available(*, unavailable) diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/OAuthCredential.swift b/FirebaseAuth/Sources/Swift/AuthProvider/OAuthCredential.swift index 8d21df49cff..a7fc244e16e 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/OAuthCredential.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/OAuthCredential.swift @@ -14,23 +14,19 @@ import Foundation +/// Internal implementation of `AuthCredential` for generic credentials. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIROAuthCredential) open class OAuthCredential: AuthCredential, NSSecureCoding { - /** @property IDToken - @brief The ID Token associated with this credential. - */ + /// The ID Token associated with this credential. @objc(IDToken) public let idToken: String? - /** @property accessToken - @brief The access token associated with this credential. - */ + /// The access token associated with this credential. @objc public let accessToken: String? - /** @property secret - @brief The secret associated with this credential. This will be nil for OAuth 2.0 providers. - @detail OAuthCredential already exposes a providerId getter. This will help the developer - determine whether an access token/secret pair is needed. - */ + /// The secret associated with this credential. This will be nil for OAuth 2.0 providers. + /// + /// OAuthCredential already exposes a `provider` getter. This will help the developer + /// determine whether an access token / secret pair is needed. @objc public let secret: String? // internal diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift b/FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift index 2cdb8b33611..1566513855f 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift @@ -15,55 +15,40 @@ import CommonCrypto import Foundation -/** - @brief Utility class for constructing OAuth Sign In credentials. - */ +/// Utility class for constructing OAuth Sign In credentials. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIROAuthProvider) open class OAuthProvider: NSObject, FederatedAuthProvider { @objc public static let id = "OAuth" - /** @property scopes - @brief Array used to configure the OAuth scopes. - */ + /// Array used to configure the OAuth scopes. @objc open var scopes: [String]? - /** @property customParameters - @brief Dictionary used to configure the OAuth custom parameters. - */ + /// Dictionary used to configure the OAuth custom parameters. @objc open var customParameters: [String: String]? - /** @property providerID - @brief The provider ID indicating the specific OAuth provider this OAuthProvider instance - represents. - */ + /// The provider ID indicating the specific OAuth provider this OAuthProvider instance represents. @objc public let providerID: String - /** - @param providerID The provider ID of the IDP for which this auth provider instance will be - configured. - @return An instance of `OAuthProvider` corresponding to the specified provider ID. - */ + /// - Parameter providerID: The provider ID of the IDP for which this auth provider instance will + /// be configured. + /// - Returns: An instance of OAuthProvider corresponding to the specified provider ID. @objc(providerWithProviderID:) open class func provider(providerID: String) -> OAuthProvider { return OAuthProvider(providerID: providerID, auth: Auth.auth()) } - /** - @param providerID The provider ID of the IDP for which this auth provider instance will be - configured. - @param auth The auth instance to be associated with the `OAuthProvider` instance. - @return An instance of `OAuthProvider` corresponding to the specified provider ID. - */ + /// - Parameter providerID: The provider ID of the IDP for which this auth provider instance will + /// be configured. + /// - Parameter auth: The auth instance to be associated with the OAuthProvider instance. + /// - Returns: An instance of OAuthProvider corresponding to the specified provider ID. @objc(providerWithProviderID:auth:) open class func provider(providerID: String, auth: Auth) -> OAuthProvider { return OAuthProvider(providerID: providerID, auth: auth) } - /** - @param providerID The provider ID of the IDP for which this auth provider instance will be - configured. - @param auth The auth instance to be associated with the `OAuthProvider` instance. - @return An instance of `OAuthProvider` corresponding to the specified provider ID. - */ + /// - Parameter providerID: The provider ID of the IDP for which this auth provider instance will + /// be configured. + /// - Parameter auth: The auth instance to be associated with the OAuthProvider instance. + /// - Returns: An instance of OAuthProvider corresponding to the specified provider ID. public init(providerID: String, auth: Auth = Auth.auth()) { if auth.requestConfiguration.emulatorHostAndPort == nil { if providerID == FacebookAuthProvider.id { @@ -99,16 +84,13 @@ import Foundation } } - /** - @brief Creates an `AuthCredential` for the OAuth 2 provider identified by provider ID, ID - token, and access token. - - @param providerID The provider ID associated with the Auth credential being created. - @param idToken The IDToken associated with the Auth credential being created. - @param accessToken The access token associated with the Auth credential be created, if - available. - @return A `AuthCredential` for the specified provider ID, ID token and access token. - */ + /// Creates an `AuthCredential` for the OAuth 2 provider identified by provider ID, ID + /// token, and access token. + /// - Parameter providerID: The provider ID associated with the Auth credential being created. + /// - Parameter idToken: The IDToken associated with the Auth credential being created. + /// - Parameter accessToken: The access token associated with the Auth credential be created, if + /// available. + /// - Returns: An AuthCredential for the specified provider ID, ID token and access token. @objc(credentialWithProviderID:IDToken:accessToken:) public static func credential(withProviderID providerID: String, idToken: String, @@ -116,31 +98,25 @@ import Foundation return OAuthCredential(withProviderID: providerID, idToken: idToken, accessToken: accessToken) } - /** - @brief Creates an `AuthCredential` for the OAuth 2 provider identified by provider ID using - an ID token. - - @param providerID The provider ID associated with the Auth credential being created. - @param accessToken The access token associated with the Auth credential be created - @return An `AuthCredential`. - */ + /// Creates an `AuthCredential` for the OAuth 2 provider identified by provider ID using + /// an ID token. + /// - Parameter providerID: The provider ID associated with the Auth credential being created. + /// - Parameter accessToken: The access token associated with the Auth credential be created + /// - Returns: An AuthCredential. @objc(credentialWithProviderID:accessToken:) public static func credential(withProviderID providerID: String, accessToken: String) -> OAuthCredential { return OAuthCredential(withProviderID: providerID, accessToken: accessToken) } - /** - @brief Creates an `AuthCredential` for that OAuth 2 provider identified by provider ID, ID - token, raw nonce, and access token. - - @param providerID The provider ID associated with the Auth credential being created. - @param idToken The IDToken associated with the Auth credential being created. - @param rawNonce The raw nonce associated with the Auth credential being created. - @param accessToken The access token associated with the Auth credential be created, if - available. - @return A `AuthCredential` for the specified provider ID, ID token and access token. - */ + /// Creates an `AuthCredential` for that OAuth 2 provider identified by provider ID, ID + /// token, raw nonce, and access token. + /// - Parameter providerID: The provider ID associated with the Auth credential being created. + /// - Parameter idToken: The IDToken associated with the Auth credential being created. + /// - Parameter rawNonce: The raw nonce associated with the Auth credential being created. + /// - Parameter accessToken: The access token associated with the Auth credential be created, if + /// available. + /// - Returns: An AuthCredential for the specified provider ID, ID token and access token. @objc(credentialWithProviderID:IDToken:rawNonce:accessToken:) public static func credential(withProviderID providerID: String, idToken: String, rawNonce: String, @@ -153,15 +129,12 @@ import Foundation ) } - /** - @brief Creates an `AuthCredential` for that OAuth 2 provider identified by providerID using - an ID token and raw nonce. - - @param providerID The provider ID associated with the Auth credential being created. - @param idToken The IDToken associated with the Auth credential being created. - @param rawNonce The raw nonce associated with the Auth credential being created. - @return A `AuthCredential`. - */ + /// Creates an `AuthCredential` for that OAuth 2 provider identified by providerID using + /// an ID token and raw nonce. + /// - Parameter providerID: The provider ID associated with the Auth credential being created. + /// - Parameter idToken: The IDToken associated with the Auth credential being created. + /// - Parameter rawNonce: The raw nonce associated with the Auth credential being created. + /// - Returns: An AuthCredential. @objc(credentialWithProviderID:IDToken:rawNonce:) public static func credential(withProviderID providerID: String, idToken: String, rawNonce: String) -> OAuthCredential { @@ -169,13 +142,12 @@ import Foundation } #if os(iOS) - /** @fn getCredentialWithUIDelegate:completion: - @brief Used to obtain an auth credential via a mobile web flow. - This method is available on iOS only. - @param uiDelegate An optional UI delegate used to present the mobile web flow. - @param completion Optionally; a block which is invoked asynchronously on the main thread when - the mobile web flow is completed. - */ + /// Used to obtain an auth credential via a mobile web flow. + /// + /// This method is available on iOS only. + /// - Parameter uiDelegate: An optional UI delegate used to present the mobile web flow. + /// - Parameter completion: Optionally; a block which is invoked asynchronously on the main + /// thread when the mobile web flow is completed. open func getCredentialWith(_ uiDelegate: AuthUIDelegate?, completion: ((AuthCredential?, Error?) -> Void)? = nil) { guard let urlTypes = auth.mainBundleUrlTypes, @@ -243,11 +215,9 @@ import Foundation } } - /** @fn getCredentialWithUIDelegate:completion: - @brief Used to obtain an auth credential via a mobile web flow. - This method is available on iOS only. - @param uiDelegate An optional UI delegate used to present the mobile web flow. - */ + /// Used to obtain an auth credential via a mobile web flow. + /// This method is available on iOS only. + /// - Parameter uiDelegate: An optional UI delegate used to present the mobile web flow. @available(iOS 13, tvOS 13, macOS 10.15, watchOS 8, *) @objc(getCredentialWithUIDelegate:completion:) open func credential(with uiDelegate: AuthUIDelegate?) async throws -> AuthCredential { @@ -263,18 +233,16 @@ import Foundation } #endif - /** @fn appleCredentialWithIDToken:rawNonce:fullName: - * @brief Creates an `AuthCredential` for the Sign in with Apple OAuth 2 provider identified by ID - * token, raw nonce, and full name. This method is specific to the Sign in with Apple OAuth 2 - * provider as this provider requires the full name to be passed explicitly. - * - * @param idToken The IDToken associated with the Sign in with Apple Auth credential being created. - * @param rawNonce The raw nonce associated with the Sign in with Apple Auth credential being - * created. - * @param fullName The full name associated with the Sign in with Apple Auth credential being - * created. - * @return An `AuthCredential`. - */ + /// Creates an `AuthCredential` for the Sign in with Apple OAuth 2 provider identified by ID + /// token, raw nonce, and full name.This method is specific to the Sign in with Apple OAuth 2 + /// provider as this provider requires the full name to be passed explicitly. + /// - Parameter idToken: The IDToken associated with the Sign in with Apple Auth credential being + /// created. + /// - Parameter rawNonce: The raw nonce associated with the Sign in with Apple Auth credential + /// being created. + /// - Parameter fullName: The full name associated with the Sign in with Apple Auth credential + /// being created. + /// - Returns: An AuthCredential. @objc(appleCredentialWithIDToken:rawNonce:fullName:) public static func appleCredential(withIDToken idToken: String, rawNonce: String?, @@ -287,12 +255,9 @@ import Foundation // MARK: - Private Methods - /** @fn OAuthResponseForURL:error: - @brief Parses the redirected URL and returns a string representation of the OAuth response URL. - @param URL The url to be parsed for an OAuth response URL. - @param error The error that occurred if any. - @return The OAuth response if successful. - */ + /// Parses the redirected URL and returns a string representation of the OAuth response URL. + /// - Parameter url: The url to be parsed for an OAuth response URL. + /// - Returns: The OAuth response if successful. private func oAuthResponseForURL(url: URL) -> (String?, Error?) { var urlQueryItems = AuthWebUtils.dictionary(withHttpArgumentsString: url.query) if let item = urlQueryItems["deep_link_id"], @@ -317,14 +282,11 @@ import Foundation )) } - /** @fn getHeadfulLiteURLWithEventID - @brief Constructs a URL used for opening a headful-lite flow using a given event - ID and session ID. - @param eventID The event ID used for this purpose. - @param sessionID The session ID used when completing the headful lite flow. - @param completion The callback invoked after the URL has been constructed or an error - has been encountered. - */ + /// Constructs a URL used for opening a headful-lite flow using a given event + /// ID and session ID. + /// - Parameter eventID: The event ID used for this purpose. + /// - Parameter sessionID: The session ID used when completing the headful lite flow. + /// - Returns: A url. private func getHeadfulLiteUrl(eventID: String, sessionID: String) async throws -> URL? { let authDomain = try await AuthWebUtils @@ -395,11 +357,9 @@ import Foundation return components?.url } - /** @fn hashforString: - @brief Returns the SHA256 hash representation of a given string object. - @param string The string for which a SHA256 hash is desired. - @return An hexadecimal string representation of the SHA256 hash. - */ + /// Returns the SHA256 hash representation of a given string object. + /// - Parameter string: The string for which a SHA256 hash is desired. + /// - Returns: An hexadecimal string representation of the SHA256 hash. private func hash(forString string: String) -> String { guard let sessionIdData = string.data(using: .utf8) as? NSData else { fatalError("FirebaseAuth Internal error: Failed to create hash for sessionID") diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthCredential.swift b/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthCredential.swift index 0b55c5979e7..2b42df11e7d 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthCredential.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthCredential.swift @@ -14,10 +14,9 @@ import Foundation -/** @class PhoneAuthCredential - @brief Implementation of FIRAuthCredential for Phone Auth credentials. - This class is available on iOS only. - */ +/// Implementation of AuthCredential for Phone Auth credentials. +/// +/// This class is available on iOS only. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRPhoneAuthCredential) open class PhoneAuthCredential: AuthCredential, NSSecureCoding { enum CredentialKind { diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift b/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift index f6bd4d1228e..8a12d7cb5cf 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift @@ -15,47 +15,40 @@ import FirebaseCore import Foundation -/** - @brief A concrete implementation of `AuthProvider` for phone auth providers. - This class is available on iOS only. - */ +/// A concrete implementation of `AuthProvider` for phone auth providers. +/// +/// This class is available on iOS only. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRPhoneAuthProvider) open class PhoneAuthProvider: NSObject { + /// A string constant identifying the phone identity provider. @objc public static let id = "phone" #if os(iOS) - /** - @brief Returns an instance of `PhoneAuthProvider` for the default `Auth` object. - */ + /// Returns an instance of `PhoneAuthProvider` for the default `Auth` object. @objc(provider) open class func provider() -> PhoneAuthProvider { return PhoneAuthProvider(auth: Auth.auth()) } - /** - @brief Returns an instance of `PhoneAuthProvider` for the provided `Auth` object. - @param auth The auth object to associate with the phone auth provider instance. - */ + /// Returns an instance of `PhoneAuthProvider` for the provided `Auth` object. + /// - Parameter auth: The auth object to associate with the phone auth provider instance. @objc(providerWithAuth:) open class func provider(auth: Auth) -> PhoneAuthProvider { return PhoneAuthProvider(auth: auth) } - /** - @brief Starts the phone number authentication flow by sending a verification code to the - specified phone number. - @param phoneNumber The phone number to be verified. - @param uiDelegate An object used to present the SFSafariViewController. The object is retained - by this method until the completion block is executed. - @param completion The callback to be invoked when the verification flow is finished. - @remarks Possible error codes: - - + `AuthErrorCodeCaptchaCheckFailed` - Indicates that the reCAPTCHA token obtained by - the Firebase Auth is invalid or has expired. - + `AuthErrorCodeQuotaExceeded` - Indicates that the phone verification quota for this - project has been exceeded. - + `AuthErrorCodeInvalidPhoneNumber` - Indicates that the phone number provided is - invalid. - + `AuthErrorCodeMissingPhoneNumber` - Indicates that a phone number was not provided. - */ + /// Starts the phone number authentication flow by sending a verification code to the + /// specified phone number. + /// + /// Possible error codes: + /// * `AuthErrorCodeCaptchaCheckFailed` - Indicates that the reCAPTCHA token obtained by + /// the Firebase Auth is invalid or has expired. + /// * `AuthErrorCodeQuotaExceeded` - Indicates that the phone verification quota for this + /// project has been exceeded. + /// * `AuthErrorCodeInvalidPhoneNumber` - Indicates that the phone number provided is invalid. + /// * `AuthErrorCodeMissingPhoneNumber` - Indicates that a phone number was not provided. + /// - Parameter phoneNumber: The phone number to be verified. + /// - Parameter uiDelegate: An object used to present the SFSafariViewController. The object is + /// retained by this method until the completion block is executed. + /// - Parameter completion: The callback to be invoked when the verification flow is finished. @objc(verifyPhoneNumber:UIDelegate:completion:) open func verifyPhoneNumber(_ phoneNumber: String, uiDelegate: AuthUIDelegate? = nil, @@ -66,16 +59,14 @@ import Foundation completion: completion) } - /** - @brief Verify ownership of the second factor phone number by the current user. - @param phoneNumber The phone number to be verified. - @param uiDelegate An object used to present the SFSafariViewController. The object is retained - by this method until the completion block is executed. - @param multiFactorSession A session to identify the MFA flow. For enrollment, this identifies the user - trying to enroll. For sign-in, this identifies that the user already passed the first - factor challenge. - @param completion The callback to be invoked when the verification flow is finished. - */ + /// Verify ownership of the second factor phone number by the current user. + /// - Parameter phoneNumber: The phone number to be verified. + /// - Parameter uiDelegate: An object used to present the SFSafariViewController. The object is + /// retained by this method until the completion block is executed. + /// - Parameter multiFactorSession: A session to identify the MFA flow. For enrollment, this + /// identifies the user trying to enroll. For sign-in, this identifies that the user already + /// passed the first factor challenge. + /// - Parameter completion: The callback to be invoked when the verification flow is finished. @objc(verifyPhoneNumber:UIDelegate:multiFactorSession:completion:) open func verifyPhoneNumber(_ phoneNumber: String, uiDelegate: AuthUIDelegate? = nil, @@ -103,16 +94,14 @@ import Foundation } } - /** - @brief Verify ownership of the second factor phone number by the current user. - @param phoneNumber The phone number to be verified. - @param uiDelegate An object used to present the SFSafariViewController. The object is retained - by this method until the completion block is executed. - @param multiFactorSession A session to identify the MFA flow. For enrollment, this identifies the user - trying to enroll. For sign-in, this identifies that the user already passed the first - factor challenge. - @returns The verification ID - */ + /// Verify ownership of the second factor phone number by the current user. + /// - Parameter phoneNumber: The phone number to be verified. + /// - Parameter uiDelegate: An object used to present the SFSafariViewController. The object is + /// retained by this method until the completion block is executed. + /// - Parameter multiFactorSession: A session to identify the MFA flow. For enrollment, this + /// identifies the user trying to enroll. For sign-in, this identifies that the user already + /// passed the first factor challenge. + /// - Returns: The verification ID @available(iOS 13, tvOS 13, macOS 10.15, watchOS 8, *) open func verifyPhoneNumber(_ phoneNumber: String, uiDelegate: AuthUIDelegate? = nil, @@ -131,16 +120,14 @@ import Foundation } } - /** - @brief Verify ownership of the second factor phone number by the current user. - @param multiFactorInfo The phone multi factor whose number need to be verified. - @param uiDelegate An object used to present the SFSafariViewController. The object is retained - by this method until the completion block is executed. - @param multiFactorSession A session to identify the MFA flow. For enrollment, this identifies the user - trying to enroll. For sign-in, this identifies that the user already passed the first - factor challenge. - @param completion The callback to be invoked when the verification flow is finished. - */ + /// Verify ownership of the second factor phone number by the current user. + /// - Parameter multiFactorInfo: The phone multi factor whose number need to be verified. + /// - Parameter uiDelegate: An object used to present the SFSafariViewController. The object is + /// retained by this method until the completion block is executed. + /// - Parameter multiFactorSession: A session to identify the MFA flow. For enrollment, this + /// identifies the user trying to enroll. For sign-in, this identifies that the user already + /// passed the first factor challenge. + /// - Parameter completion: The callback to be invoked when the verification flow is finished. @objc(verifyPhoneNumberWithMultiFactorInfo:UIDelegate:multiFactorSession:completion:) open func verifyPhoneNumber(with multiFactorInfo: PhoneMultiFactorInfo, uiDelegate: AuthUIDelegate? = nil, @@ -153,6 +140,14 @@ import Foundation completion: completion) } + /// Verify ownership of the second factor phone number by the current user. + /// - Parameter multiFactorInfo: The phone multi factor whose number need to be verified. + /// - Parameter uiDelegate: An object used to present the SFSafariViewController. The object is + /// retained by this method until the completion block is executed. + /// - Parameter multiFactorSession: A session to identify the MFA flow. For enrollment, this + /// identifies the user trying to enroll. For sign-in, this identifies that the user already + /// passed the first factor challenge. + /// - Returns: The verification ID. @available(iOS 13, tvOS 13, macOS 10.15, watchOS 8, *) open func verifyPhoneNumber(with multiFactorInfo: PhoneMultiFactorInfo, uiDelegate: AuthUIDelegate? = nil, @@ -170,16 +165,14 @@ import Foundation } } - /** - @brief Creates an `AuthCredential` for the phone number provider identified by the - verification ID and verification code. - - @param verificationID The verification ID obtained from invoking - verifyPhoneNumber:completion: - @param verificationCode The verification code obtained from the user. - @return The corresponding phone auth credential for the verification ID and verification code - provided. - */ + /// Creates an `AuthCredential` for the phone number provider identified by the + /// verification ID and verification code. + /// + /// - Parameter verificationID: The verification ID obtained from invoking + /// verifyPhoneNumber:completion: + /// - Parameter verificationCode: The verification code obtained from the user. + /// - Returns: The corresponding phone auth credential for the verification ID and verification + /// code provided. @objc(credentialWithVerificationID:verificationCode:) open func credential(withVerificationID verificationID: String, verificationCode: String) -> PhoneAuthCredential { @@ -207,14 +200,12 @@ import Foundation uiDelegate: uiDelegate) } - /** @fn - @brief Starts the flow to verify the client via silent push notification. - @param retryOnInvalidAppCredential Whether of not the flow should be retried if an - AuthErrorCodeInvalidAppCredential error is returned from the backend. - @param phoneNumber The phone number to be verified. - @param callback The callback to be invoked on the global work queue when the flow is - finished. - */ + /// Starts the flow to verify the client via silent push notification. + /// - Parameter retryOnInvalidAppCredential: Whether of not the flow should be retried if an + /// AuthErrorCodeInvalidAppCredential error is returned from the backend. + /// - Parameter phoneNumber: The phone number to be verified. + /// - Parameter callback: The callback to be invoked on the global work queue when the flow is + /// finished. private func verifyClAndSendVerificationCode(toPhoneNumber phoneNumber: String, retryOnInvalidAppCredential: Bool, uiDelegate: AuthUIDelegate?) async throws @@ -237,14 +228,10 @@ import Foundation } } - /** @fn - @brief Starts the flow to verify the client via silent push notification. - @param retryOnInvalidAppCredential Whether of not the flow should be retried if an - AuthErrorCodeInvalidAppCredential error is returned from the backend. - @param phoneNumber The phone number to be verified. - @param callback The callback to be invoked on the global work queue when the flow is - finished. - */ + /// Starts the flow to verify the client via silent push notification. + /// - Parameter retryOnInvalidAppCredential: Whether of not the flow should be retried if an + /// AuthErrorCodeInvalidAppCredential error is returned from the backend. + /// - Parameter phoneNumber: The phone number to be verified. private func verifyClAndSendVerificationCode(toPhoneNumber phoneNumber: String, retryOnInvalidAppCredential: Bool, multiFactorSession session: MultiFactorSession?, @@ -316,10 +303,7 @@ import Foundation throw error } - /** @fn - @brief Continues the flow to verify the client via silent push notification. - @param completion The callback to be invoked when the client verification flow is finished. - */ + /// Continues the flow to verify the client via silent push notification. private func verifyClient(withUIDelegate uiDelegate: AuthUIDelegate?) async throws -> CodeIdentity { // Remove the simulator check below after FCM supports APNs in simulators @@ -374,10 +358,7 @@ import Foundation } } - /** @fn - @brief Continues the flow to verify the client via silent push notification. - @param completion The callback to be invoked when the client verification flow is finished. - */ + /// Continues the flow to verify the client via silent push notification. private func reCAPTCHAFlowWithUIDelegate(withUIDelegate uiDelegate: AuthUIDelegate?) async throws -> String { let eventID = AuthWebUtils.randomString(withLength: 10) @@ -412,12 +393,9 @@ import Foundation } } - /** - @brief Parses the reCAPTCHA URL and returns the reCAPTCHA token. - @param URL The url to be parsed for a reCAPTCHA token. - @param error The error that occurred if any. - @return The reCAPTCHA token if successful. - */ + /// Parses the reCAPTCHA URL and returns the reCAPTCHA token. + /// - Parameter url: The url to be parsed for a reCAPTCHA token. + /// - Returns: The reCAPTCHA token if successful. private func reCAPTCHAToken(forURL url: URL?) throws -> String { guard let url = url else { let reason = "Internal Auth Error: nil URL trying to access RECAPTCHA token" @@ -457,13 +435,8 @@ import Foundation throw AuthErrorUtils.appVerificationUserInteractionFailure(reason: reason) } - /** @fn - @brief Constructs a URL used for opening a reCAPTCHA app verification flow using a given event - ID. - @param eventID The event ID used for this purpose. - @param completion The callback invoked after the URL has been constructed or an error - has been encountered. - */ + /// Constructs a URL used for opening a reCAPTCHA app verification flow using a given event ID. + /// - Parameter eventID: The event ID used for this purpose. private func reCAPTCHAURL(withEventID eventID: String) async throws -> URL? { let authDomain = try await AuthWebUtils .fetchAuthDomain(withRequestConfiguration: auth.requestConfiguration) diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/TwitterAuthProvider.swift b/FirebaseAuth/Sources/Swift/AuthProvider/TwitterAuthProvider.swift index dd1984892d1..177b08ed894 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/TwitterAuthProvider.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/TwitterAuthProvider.swift @@ -14,20 +14,16 @@ import Foundation -/** - @brief Utility class for constructing Twitter Sign In credentials. - */ +/// Utility class for constructing Twitter Sign In credentials. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRTwitterAuthProvider) open class TwitterAuthProvider: NSObject { + /// A string constant identifying the Twitter identity provider. @objc public static let id = "twitter.com" - /** - @brief Creates an `AuthCredential` for a Twitter sign in. - - @param token The Twitter OAuth token. - @param secret The Twitter OAuth secret. - @return An AuthCredential containing the Twitter credentials. - */ + /// Creates an `AuthCredential` for a Twitter sign in. + /// - Parameter token: The Twitter OAuth token. + /// - Parameter secret: The Twitter OAuth secret. + /// - Returns: An AuthCredential containing the Twitter credentials. @objc open class func credential(withToken token: String, secret: String) -> AuthCredential { return TwitterAuthCredential(withToken: token, secret: secret) } diff --git a/FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift b/FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift index ba7bb4e6137..8aa81c56419 100644 --- a/FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift +++ b/FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift @@ -24,15 +24,12 @@ import Foundation @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) protocol AuthBackendRPCIssuer: NSObjectProtocol { - /** @fn - @brief Asynchronously sends a HTTP request. - @param requestConfiguration The request to be made. - @param URL The request URL. - @param body Request body. - @param contentType Content type of the body. - @param handler provided that handles HTTP response. Invoked asynchronously on the auth global - work queue in the future. - */ + /// Asynchronously send a HTTP request. + /// - Parameter request: The request to be made. + /// - Parameter body: Request body. + /// - Parameter contentType: Content type of the body. + /// - Parameter completionHandler: Handles HTTP response. Invoked asynchronously + /// on the auth global work queue in the future. func asyncCallToURL(with request: T, body: Data?, contentType: String, @@ -152,19 +149,16 @@ private class AuthBackendRPCImplementation: NSObject, AuthBackendImplementation rpcIssuer = AuthBackendRPCIssuerImplementation() } - /** @fn call - @brief Calls the RPC using HTTP request. - @remarks Possible error responses: - @see FIRAuthInternalErrorCodeRPCRequestEncodingError - @see FIRAuthInternalErrorCodeJSONSerializationError - @see FIRAuthInternalErrorCodeNetworkError - @see FIRAuthInternalErrorCodeUnexpectedErrorResponse - @see FIRAuthInternalErrorCodeUnexpectedResponse - @see FIRAuthInternalErrorCodeRPCResponseDecodingError - @param request The request. - @param response The empty response to be filled. - @param callback The callback for both success and failure. - */ + /// Calls the RPC using HTTP request. + /// Possible error responses: + /// * See FIRAuthInternalErrorCodeRPCRequestEncodingError + /// * See FIRAuthInternalErrorCodeJSONSerializationError + /// * See FIRAuthInternalErrorCodeNetworkError + /// * See FIRAuthInternalErrorCodeUnexpectedErrorResponse + /// * See FIRAuthInternalErrorCodeUnexpectedResponse + /// * See FIRAuthInternalErrorCodeRPCResponseDecodingError + /// - Parameter request: The request. + /// - Returns: The response. fileprivate func call(with request: T) async throws -> T.Response { let response = try await callInternal(with: request) if let auth = request.requestConfiguration().auth, @@ -233,19 +227,17 @@ private class AuthBackendRPCImplementation: NSObject, AuthBackendImplementation } #endif - /** @fn call - @brief Calls the RPC using HTTP request. - @remarks Possible error responses: - @see FIRAuthInternalErrorCodeRPCRequestEncodingError - @see FIRAuthInternalErrorCodeJSONSerializationError - @see FIRAuthInternalErrorCodeNetworkError - @see FIRAuthInternalErrorCodeUnexpectedErrorResponse - @see FIRAuthInternalErrorCodeUnexpectedResponse - @see FIRAuthInternalErrorCodeRPCResponseDecodingError - @param request The request. - @param response The empty response to be filled. - @param callback The callback for both success and failure. - */ + /// Calls the RPC using HTTP request. + /// + /// Possible error responses: + /// * See FIRAuthInternalErrorCodeRPCRequestEncodingError + /// * See FIRAuthInternalErrorCodeJSONSerializationError + /// * See FIRAuthInternalErrorCodeNetworkError + /// * See FIRAuthInternalErrorCodeUnexpectedErrorResponse + /// * See FIRAuthInternalErrorCodeUnexpectedResponse + /// * See FIRAuthInternalErrorCodeRPCResponseDecodingError + /// - Parameter request: The request. + /// - Returns: The response. fileprivate func callInternal(with request: T) async throws -> T.Response { var bodyData: Data? if request.containsPostBody { diff --git a/FirebaseAuth/Sources/Swift/Backend/AuthRPCResponse.swift b/FirebaseAuth/Sources/Swift/Backend/AuthRPCResponse.swift index 02651cf818a..b1284762fb2 100644 --- a/FirebaseAuth/Sources/Swift/Backend/AuthRPCResponse.swift +++ b/FirebaseAuth/Sources/Swift/Backend/AuthRPCResponse.swift @@ -18,21 +18,17 @@ protocol AuthRPCResponse { /// Bare initializer for a response. init() - /** @fn setFieldsWithDictionary:error: - @brief Sets the response instance from the decoded JSON response. - @param dictionary The dictionary decoded from HTTP JSON response. - @param error An out field for an error which occurred constructing the request. - @return Whether the operation was successful or not. - */ + /// Sets the response instance from the decoded JSON response. + /// - Parameter dictionary: The dictionary decoded from HTTP JSON response. + /// - Parameter error: An out field for an error which occurred constructing the request. + /// - Returns: Whether the operation was successful or not. func setFields(dictionary: [String: AnyHashable]) throws - /** @fn clientErrorWithshortErrorMessage:detailErrorMessage - @brief This optional method allows response classes to create client errors given a short error - message and a detail error message from the server. - @param shortErrorMessage The short error message from the server. - @param detailErrorMessage The detailed error message from the server. - @return A client error, if any. - */ + /// This optional method allows response classes to create client errors given a short error + /// message and a detail error message from the server. + /// - Parameter shortErrorMessage: The short error message from the server. + /// - Parameter detailErrorMessage: The detailed error message from the server. + /// - Returns: A client error, if any. func clientError(shortErrorMessage: String, detailedErrorMessage: String?) -> Error? } diff --git a/FirebaseAuth/Sources/Swift/Backend/AuthRequestConfiguration.swift b/FirebaseAuth/Sources/Swift/Backend/AuthRequestConfiguration.swift index 80ce4a79ac7..9aa53d7e68f 100644 --- a/FirebaseAuth/Sources/Swift/Backend/AuthRequestConfiguration.swift +++ b/FirebaseAuth/Sources/Swift/Backend/AuthRequestConfiguration.swift @@ -17,52 +17,34 @@ import Foundation import FirebaseAppCheckInterop import FirebaseCoreExtension -/** @class FIRAuthRequestConfiguration - @brief Defines configurations to be added to a request to Firebase Auth's backend. - */ +/// Defines configurations to be added to a request to Firebase Auth's backend. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class AuthRequestConfiguration: NSObject { - /** @property APIKey - @brief The Firebase Auth API key used in the request. - */ + /// The Firebase Auth API key used in the request. let apiKey: String - /** @property LanguageCode - @brief The language code used in the request. - */ + /// The language code used in the request. var languageCode: String? - /** @property appID - @brief The Firebase appID used in the request. - */ + /// The Firebase appID used in the request. let appID: String - /** @property auth - @brief The FIRAuth instance used in the request. - */ + /// The `Auth` instance used in the request. weak var auth: Auth? /// The heartbeat logger used to add heartbeats to the corresponding request's header. var heartbeatLogger: FIRHeartbeatLoggerProtocol? - /** @property appCheck - @brief The appCheck is used to generate a token. - */ + /// The appCheck is used to generate a token. var appCheck: AppCheckInterop? - /** @property HTTPMethod - @brief The HTTP method used in the request. - */ + /// The HTTP method used in the request. var httpMethod: String - /** @property additionalFrameworkMarker - @brief Additional framework marker that will be added as part of the header of every request. - */ + /// Additional framework marker that will be added as part of the header of every request. var additionalFrameworkMarker: String? - /** @property emulatorHostAndPort - @brief If set, the local emulator host and port to point to instead of the remote backend. - */ + /// If set, the local emulator host and port to point to instead of the remote backend. var emulatorHostAndPort: String? init(apiKey: String, diff --git a/FirebaseAuth/Sources/Swift/Backend/IdentityToolkitRequest.swift b/FirebaseAuth/Sources/Swift/Backend/IdentityToolkitRequest.swift index b31292c807e..ebc549b3288 100644 --- a/FirebaseAuth/Sources/Swift/Backend/IdentityToolkitRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/IdentityToolkitRequest.swift @@ -40,19 +40,13 @@ class IdentityToolkitRequest { /// The tenant ID of the request. nil if none is available. let tenantID: String? - /** @property useIdentityPlatform - @brief The toggle of using Identity Platform endpoints. - */ + /// The toggle of using Identity Platform endpoints. let useIdentityPlatform: Bool - /** @property useStaging - @brief The toggle of using staging endpoints. - */ + /// The toggle of using staging endpoints. let useStaging: Bool - /** @property clientType - @brief The type of the client that the request sent from, which should be CLIENT_TYPE_IOS; - */ + /// The type of the client that the request sent from, which should be CLIENT_TYPE_IOS; var clientType: String private let _requestConfiguration: AuthRequestConfiguration diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/CreateAuthURIRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/CreateAuthURIRequest.swift index 6fadfcfde04..1a7503ced9a 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/CreateAuthURIRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/CreateAuthURIRequest.swift @@ -14,95 +14,61 @@ import Foundation -/** @var kCreateAuthURIEndpoint - @brief The "createAuthUri" endpoint. - */ +/// The "createAuthUri" endpoint. private let kCreateAuthURIEndpoint = "createAuthUri" -/** @var kProviderIDKey - @brief The key for the "providerId" value in the request. - */ +/// The key for the "providerId" value in the request. private let kProviderIDKey = "providerId" -/** @var kIdentifierKey - @brief The key for the "identifier" value in the request. - */ +/// The key for the "identifier" value in the request. private let kIdentifierKey = "identifier" -/** @var kContinueURIKey - @brief The key for the "continueUri" value in the request. - */ +/// The key for the "continueUri" value in the request. private let kContinueURIKey = "continueUri" -/** @var kOpenIDRealmKey - @brief The key for the "openidRealm" value in the request. - */ +/// The key for the "openidRealm" value in the request. private let kOpenIDRealmKey = "openidRealm" -/** @var kClientIDKey - @brief The key for the "clientId" value in the request. - */ +/// The key for the "clientId" value in the request. private let kClientIDKey = "clientId" -/** @var kContextKey - @brief The key for the "context" value in the request. - */ +/// The key for the "context" value in the request. private let kContextKey = "context" -/** @var kAppIDKey - @brief The key for the "appId" value in the request. - */ +/// The key for the "appId" value in the request. private let kAppIDKey = "appId" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. private let kTenantIDKey = "tenantId" -/** @class FIRCreateAuthURIRequest - @brief Represents the parameters for the createAuthUri endpoint. - @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/createAuthUri - */ +/// Represents the parameters for the createAuthUri endpoint. +/// See https://developers.google.com/identity/toolkit/web/reference/relyingparty/createAuthUri @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class CreateAuthURIRequest: IdentityToolkitRequest, AuthRPCRequest { typealias Response = CreateAuthURIResponse - /** @property identifier - @brief The email or federated ID of the user. - */ + /// The email or federated ID of the user. let identifier: String - /** @property continueURI - @brief The URI to which the IDP redirects the user after the federated login flow. - */ + /// The URI to which the IDP redirects the user after the federated login flow. let continueURI: String - /** @property openIDRealm - @brief Optional realm for OpenID protocol. The sub string "scheme://domain:port" of the param - "continueUri" is used if this is not set. - */ + /// Optional realm for OpenID protocol. The sub string "scheme://domain:port" of the param + /// "continueUri" is used if this is not set. var openIDRealm: String? - /** @property providerID - @brief The IdP ID. For white listed IdPs it's a short domain name e.g. google.com, aol.com, - live.net and yahoo.com. For other OpenID IdPs it's the OP identifier. - */ + /// The IdP ID. For white listed IdPs it's a short domain name e.g. google.com, aol.com, + /// live.net and yahoo.com. For other OpenID IdPs it's the OP identifier. var providerID: String? - /** @property clientID - @brief The relying party OAuth client ID. - */ + /// The relying party OAuth client ID. var clientID: String? - /** @property context - @brief The opaque value used by the client to maintain context info between the authentication - request and the IDP callback. - */ + /// The opaque value used by the client to maintain context info between the authentication + /// request and the IDP callback. var context: String? - /** @property appID - @brief The iOS client application's bundle identifier. - */ + /// The iOS client application's bundle identifier. var appID: String? init(identifier: String, continueURI: String, diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/CreateAuthURIResponse.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/CreateAuthURIResponse.swift index b5cdef16482..d80b09e1aaa 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/CreateAuthURIResponse.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/CreateAuthURIResponse.swift @@ -14,40 +14,26 @@ import Foundation -/** @class FIRCreateAuthURIResponse - @brief Represents the parameters for the createAuthUri endpoint. - @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/createAuthUri - */ +/// Represents the parameters for the createAuthUri endpoint. +/// See https: // developers.google.com/identity/toolkit/web/reference/relyingparty/createAuthUri class CreateAuthURIResponse: AuthRPCResponse { - /** @property authUri - @brief The URI used by the IDP to authenticate the user. - */ + /// The URI used by the IDP to authenticate the user. var authURI: String? - /** @property registered - @brief Whether the user is registered if the identifier is an email. - */ + /// Whether the user is registered if the identifier is an email. var registered: Bool = false - /** @property providerId - @brief The provider ID of the auth URI. - */ + /// The provider ID of the auth URI. var providerID: String? - /** @property forExistingProvider - @brief True if the authUri is for user's existing provider. - */ + /// True if the authUri is for user's existing provider. var forExistingProvider: Bool = false - /** @property allProviders - @brief A list of provider IDs the passed @c identifier could use to sign in with. - */ + /// A list of provider IDs the passed identifier could use to sign in with. var allProviders: [String]? - /** @property signinMethods - @brief A list of sign-in methods available for the passed @c identifier. - */ + /// A list of sign-in methods available for the passed identifier. var signinMethods: [String]? /// Bare initializer. diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/DeleteAccountRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/DeleteAccountRequest.swift index bf059cb7967..430b74a4b76 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/DeleteAccountRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/DeleteAccountRequest.swift @@ -14,34 +14,25 @@ import Foundation -/** @var kCreateAuthURIEndpoint - @brief The "deleteAccount" endpoint. - */ +/// The "deleteAccount" endpoint. + private let kDeleteAccountEndpoint = "deleteAccount" -/** @var kIDTokenKey - @brief The key for the "idToken" value in the request. This is actually the STS Access Token, - despite it's confusing (backwards compatiable) parameter name. - */ +/// The key for the "idToken" value in the request. This is actually the STS Access Token, +/// despite its confusing (backwards compatiable) parameter name. private let kIDTokenKey = "idToken" -/** @var kLocalIDKey - @brief The key for the "localID" value in the request. - */ +/// The key for the "localID" value in the request. private let kLocalIDKey = "localId" @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class DeleteAccountRequest: IdentityToolkitRequest, AuthRPCRequest { typealias Response = DeleteAccountResponse - /** @var _accessToken - @brief The STS Access Token of the authenticated user. - */ + /// The STS Access Token of the authenticated user. let accessToken: String - /** @var _localID - @brief The localID of the user. - */ + /// The localID of the user. let localID: String init(localID: String, accessToken: String, requestConfiguration: AuthRequestConfiguration) { diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/DeleteAccountResponse.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/DeleteAccountResponse.swift index c5d80c863a2..92208e7581b 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/DeleteAccountResponse.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/DeleteAccountResponse.swift @@ -14,10 +14,9 @@ import Foundation -/** @class FIRDeleteAccountResponse - @brief Represents the response from the deleteAccount endpoint. - @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/deleteAccount - */ +/// Represents the response from the deleteAccount endpoint. +/// +/// See https://developers.google.com/identity/toolkit/web/reference/relyingparty/deleteAccount class DeleteAccountResponse: NSObject, AuthRPCResponse { override required init() {} diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/EmailLinkSignInRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/EmailLinkSignInRequest.swift index cfbf1247a25..b57c2170450 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/EmailLinkSignInRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/EmailLinkSignInRequest.swift @@ -14,34 +14,22 @@ import Foundation -/** @var kEmailLinkSigninEndpoint - @brief The "EmailLinkSignin" endpoint. - */ +/// The "EmailLinkSignin" endpoint. private let kEmailLinkSigninEndpoint = "emailLinkSignin" -/** @var kEmailKey - @brief The key for the "identifier" value in the request. - */ +/// The key for the "identifier" value in the request. private let kEmailKey = "email" -/** @var kEmailLinkKey - @brief The key for the "emailLink" value in the request. - */ +/// The key for the "emailLink" value in the request. private let kOOBCodeKey = "oobCode" -/** @var kIDTokenKey - @brief The key for the "IDToken" value in the request. - */ +/// The key for the "IDToken" value in the request. private let kIDTokenKey = "idToken" -/** @var kPostBodyKey - @brief The key for the "postBody" value in the request. - */ +/// The key for the "postBody" value in the request. private let kPostBodyKey = "postBody" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. private let kTenantIDKey = "tenantId" @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @@ -50,15 +38,10 @@ class EmailLinkSignInRequest: IdentityToolkitRequest, AuthRPCRequest { let email: String - /** @property oobCode - @brief The OOB code used to complete the email link sign-in flow. - */ + /// The OOB code used to complete the email link sign-in flow. let oobCode: String - /** @property IDToken - @brief The ID Token code potentially used to complete the email link sign-in flow. - */ - + /// The ID Token code potentially used to complete the email link sign-in flow. var idToken: String? init(email: String, oobCode: String, diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/EmailLinkSignInResponse.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/EmailLinkSignInResponse.swift index f41d0bde732..4147c4962e0 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/EmailLinkSignInResponse.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/EmailLinkSignInResponse.swift @@ -14,48 +14,32 @@ import Foundation -/** @class FIRVerifyAssertionResponse - @brief Represents the response from the emailLinkSignin endpoint. - */ +/// Represents the response from the emailLinkSignin endpoint. class EmailLinkSignInResponse: NSObject, AuthRPCResponse, AuthMFAResponse { override required init() {} - /** @property IDToken - @brief The ID token in the email link sign-in response. - */ + /// The ID token in the email link sign-in response. private(set) var idToken: String? - /** @property email - @brief The email returned by the IdP. - */ + /// The email returned by the IdP. var email: String? - /** @property refreshToken - @brief The refreshToken returned by the server. - */ + /// The refreshToken returned by the server. var refreshToken: String? - /** @property approximateExpirationDate - @brief The approximate expiration date of the access token. - */ + /// The approximate expiration date of the access token. var approximateExpirationDate: Date? - /** @property isNewUser - @brief Flag indicating that the user signing in is a new user and not a returning user. - */ + /// Flag indicating that the user signing in is a new user and not a returning user. var isNewUser: Bool = false // MARK: - AuthMFAResponse - /** @property MFAPendingCredential - @brief An opaque string that functions as proof that the user has successfully passed the first - factor check. - */ + /// An opaque string that functions as proof that the user has successfully passed the first + /// factor check. private(set) var mfaPendingCredential: String? - /** @property MFAInfo - @brief Info on which multi-factor authentication providers are enabled. - */ + /// Info on which multi-factor authentication providers are enabled. private(set) var mfaInfo: [AuthProtoMFAEnrollment]? func setFields(dictionary: [String: AnyHashable]) throws { diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/GetAccountInfoRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/GetAccountInfoRequest.swift index 9a0e19af0be..ce94425d311 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/GetAccountInfoRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/GetAccountInfoRequest.swift @@ -14,35 +14,26 @@ import Foundation -/** @var kGetAccountInfoEndpoint - @brief The "getAccountInfo" endpoint. - */ +/// The "getAccountInfo" endpoint. private let kGetAccountInfoEndpoint = "getAccountInfo" -/** @var kIDTokenKey - @brief The key for the "idToken" value in the request. This is actually the STS Access Token, - despite it's confusing (backwards compatiable) parameter name. - */ +/// The key for the "idToken" value in the request. This is actually the STS Access Token, +/// despite its confusing (backwards compatiable) parameter name. private let kIDTokenKey = "idToken" -/** @class FIRGetAccountInfoRequest - @brief Represents the parameters for the getAccountInfo endpoint. - @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/getAccountInfo - */ +/// Represents the parameters for the getAccountInfo endpoint. +/// See https://developers.google.com/identity/toolkit/web/reference/relyingparty/getAccountInfo @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class GetAccountInfoRequest: IdentityToolkitRequest, AuthRPCRequest { typealias Response = GetAccountInfoResponse - /** @property accessToken - @brief The STS Access Token for the authenticated user. - */ + /// The STS Access Token for the authenticated user. let accessToken: String - /** @fn initWithAccessToken:requestConfiguration - @brief Designated initializer. - @param accessToken The Access Token of the authenticated user. - @param requestConfiguration An object containing configurations to be added to the request. - */ + /// Designated initializer. + /// - Parameter accessToken: The Access Token of the authenticated user. + /// - Parameter requestConfiguration: An object containing configurations to be added to the + /// request. init(accessToken: String, requestConfiguration: AuthRequestConfiguration) { self.accessToken = accessToken super.init(endpoint: kGetAccountInfoEndpoint, requestConfiguration: requestConfiguration) diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/GetAccountInfoResponse.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/GetAccountInfoResponse.swift index 07413e94c84..2f39fdfe68d 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/GetAccountInfoResponse.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/GetAccountInfoResponse.swift @@ -14,50 +14,32 @@ import Foundation -/** @var kErrorKey - @brief The key for the "error" value in JSON responses from the server. - */ +/// The key for the "error" value in JSON responses from the server. private let kErrorKey = "error" -/** @class FIRGetAccountInfoResponseProviderUserInfo - @brief Represents the provider user info part of the response from the getAccountInfo endpoint. - @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/getAccountInfo - */ +/// Represents the provider user info part of the response from the getAccountInfo endpoint. +/// See https://developers.google.com/identity/toolkit/web/reference/relyingparty/getAccountInfo class GetAccountInfoResponseProviderUserInfo: NSObject { - /** @property providerID - @brief The ID of the identity provider. - */ + /// The ID of the identity provider. let providerID: String? - /** @property displayName - @brief The user's display name at the identity provider. - */ + /// The user's display name at the identity provider. let displayName: String? - /** @property photoURL - @brief The user's photo URL at the identity provider. - */ + /// The user's photo URL at the identity provider. let photoURL: URL? - /** @property federatedID - @brief The user's identifier at the identity provider. - */ + /// The user's identifier at the identity provider. let federatedID: String? - /** @property email - @brief The user's email at the identity provider. - */ + /// The user's email at the identity provider. let email: String? - /** @property phoneNumber - @brief A phone number associated with the user. - */ + /// A phone number associated with the user. let phoneNumber: String? - /** @fn initWithAPIKey: - @brief Designated initializer. - @param dictionary The provider user info data from endpoint. - */ + /// Designated initializer. + /// - Parameter dictionary: The provider user info data from endpoint. init(dictionary: [String: Any]) { providerID = dictionary["providerId"] as? String displayName = dictionary["displayName"] as? String @@ -73,69 +55,44 @@ class GetAccountInfoResponseProviderUserInfo: NSObject { } } -/** @class FIRGetAccountInfoResponseUser - @brief Represents the firebase user info part of the response from the getAccountInfo endpoint. - @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/getAccountInfo - */ +/// Represents the firebase user info part of the response from the getAccountInfo endpoint. +/// See https://developers.google.com/identity/toolkit/web/reference/relyingparty/getAccountInfo class GetAccountInfoResponseUser: NSObject { - /** @property localID - @brief The ID of the user. - */ + /// The ID of the user. let localID: String? - /** @property email - @brief The email or the user. - */ + /// The email or the user. let email: String? - /** @property emailVerified - @brief Whether the email has been verified. - */ + /// Whether the email has been verified. let emailVerified: Bool - /** @property displayName - @brief The display name of the user. - */ + /// The display name of the user. let displayName: String? - /** @property photoURL - @brief The user's photo URL. - */ + /// The user's photo URL. let photoURL: URL? - /** @property creationDate - @brief The user's creation date. - */ + /// The user's creation date. let creationDate: Date? - /** @property lastSignInDate - @brief The user's last login date. - */ + /// The user's last login date. let lastLoginDate: Date? - /** @property providerUserInfo - @brief The user's profiles at the associated identity providers. - */ + /// The user's profiles at the associated identity providers. let providerUserInfo: [GetAccountInfoResponseProviderUserInfo]? - /** @property passwordHash - @brief Information about user's password. - @remarks This is not necessarily the hash of user's actual password. - */ - + /// Information about user's password. + /// This is not necessarily the hash of user's actual password. let passwordHash: String? - /** @property phoneNumber - @brief A phone number associated with the user. - */ + /// A phone number associated with the user. let phoneNumber: String? let mfaEnrollments: [AuthProtoMFAEnrollment]? - /** @fn initWithAPIKey: - @brief Designated initializer. - @param dictionary The provider user info data from endpoint. - */ + /// Designated initializer. + /// - Parameter dictionary: The provider user info data from endpoint. init(dictionary: [String: Any]) { if let providerUserInfoData = dictionary["providerUserInfo"] as? [[String: Any]] { providerUserInfo = providerUserInfoData.map { @@ -179,17 +136,13 @@ class GetAccountInfoResponseUser: NSObject { } } -/** @class FIRGetAccountInfoResponse - @brief Represents the response from the setAccountInfo endpoint. - @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/getAccountInfo - */ +/// Represents the response from the setAccountInfo endpoint. +/// See https://developers.google.com/identity/toolkit/web/reference/relyingparty/getAccountInfo @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class GetAccountInfoResponse: AuthRPCResponse { required init() {} - /** @property providerUserInfo - @brief The requested users' profiles. - */ + /// The requested users' profiles. var users: [GetAccountInfoResponseUser]? func setFields(dictionary: [String: AnyHashable]) throws { guard let usersData = dictionary["users"] as? [[String: AnyHashable]] else { diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/GetOOBConfirmationCodeRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/GetOOBConfirmationCodeRequest.swift index 7b33352e102..bd3925d1f67 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/GetOOBConfirmationCodeRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/GetOOBConfirmationCodeRequest.swift @@ -15,24 +15,16 @@ import Foundation enum GetOOBConfirmationCodeRequestType: Int { - /** @var FIRGetOOBConfirmationCodeRequestTypePasswordReset - @brief Requests a password reset code. - */ + /// Requests a password reset code. case passwordReset - /** @var FIRGetOOBConfirmationCodeRequestTypeVerifyEmail - @brief Requests an email verification code. - */ + /// Requests an email verification code. case verifyEmail - /** @var FIRGetOOBConfirmationCodeRequestTypeEmailLink - @brief Requests an email sign-in link. - */ + /// Requests an email sign-in link. case emailLink - /** @var FIRGetOOBConfirmationCodeRequestTypeVerifyBeforeUpdateEmail - @brief Requests an verify before update email. - */ + /// Requests an verify before update email. case verifyBeforeUpdateEmail var value: String { @@ -51,187 +43,118 @@ enum GetOOBConfirmationCodeRequestType: Int { private let kGetOobConfirmationCodeEndpoint = "getOobConfirmationCode" -/** @var kRequestTypeKey - @brief The name of the required "requestType" property in the request. - */ +/// The name of the required "requestType" property in the request. private let kRequestTypeKey = "requestType" -/** @var kEmailKey - @brief The name of the "email" property in the request. - */ +/// The name of the "email" property in the request. private let kEmailKey = "email" -/** @var kNewEmailKey - @brief The name of the "newEmail" property in the request. - */ +/// The name of the "newEmail" property in the request. private let kNewEmailKey = "newEmail" -/** @var kIDTokenKey - @brief The key for the "idToken" value in the request. This is actually the STS Access Token, - despite it's confusing (backwards compatiable) parameter name. - */ +/// The key for the "idToken" value in the request. This is actually the STS Access Token, +/// despite its confusing (backwards compatiable) parameter name. private let kIDTokenKey = "idToken" -/** @var kContinueURLKey - @brief The key for the "continue URL" value in the request. - */ +/// The key for the "continue URL" value in the request. private let kContinueURLKey = "continueUrl" -/** @var kIosBundeIDKey - @brief The key for the "iOS Bundle Identifier" value in the request. - */ +/// The key for the "iOS Bundle Identifier" value in the request. private let kIosBundleIDKey = "iOSBundleId" -/** @var kAndroidPackageNameKey - @brief The key for the "Android Package Name" value in the request. - */ +/// The key for the "Android Package Name" value in the request. private let kAndroidPackageNameKey = "androidPackageName" -/** @var kAndroidInstallAppKey - @brief The key for the request parameter indicating whether the android app should be installed - or not. - */ +/// The key for the request parameter indicating whether the android app should be installed or not. private let kAndroidInstallAppKey = "androidInstallApp" -/** @var kAndroidMinimumVersionKey - @brief The key for the "minimum Android version supported" value in the request. - */ +/// The key for the "minimum Android version supported" value in the request. private let kAndroidMinimumVersionKey = "androidMinimumVersion" -/** @var kCanHandleCodeInAppKey - @brief The key for the request parameter indicating whether the action code can be handled in - the app or not. - */ +/// The key for the request parameter indicating whether the action code can be handled in the app +/// or not. private let kCanHandleCodeInAppKey = "canHandleCodeInApp" -/** @var kDynamicLinkDomainKey - @brief The key for the "dynamic link domain" value in the request. - */ +/// The key for the "dynamic link domain" value in the request. private let kDynamicLinkDomainKey = "dynamicLinkDomain" -/** @var kPasswordResetRequestTypeValue - @brief The value for the "PASSWORD_RESET" request type. - */ +/// The value for the "PASSWORD_RESET" request type. private let kPasswordResetRequestTypeValue = "PASSWORD_RESET" -/** @var kEmailLinkSignInTypeValue - @brief The value for the "EMAIL_SIGNIN" request type. - */ +/// The value for the "EMAIL_SIGNIN" request type. private let kEmailLinkSignInTypeValue = "EMAIL_SIGNIN" -/** @var kVerifyEmailRequestTypeValue - @brief The value for the "VERIFY_EMAIL" request type. - */ +/// The value for the "VERIFY_EMAIL" request type. private let kVerifyEmailRequestTypeValue = "VERIFY_EMAIL" -/** @var kVerifyBeforeUpdateEmailRequestTypeValue - @brief The value for the "VERIFY_AND_CHANGE_EMAIL" request type. - */ +/// The value for the "VERIFY_AND_CHANGE_EMAIL" request type. private let kVerifyBeforeUpdateEmailRequestTypeValue = "VERIFY_AND_CHANGE_EMAIL" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. private let kTenantIDKey = "tenantId" -/** @var kCaptchaResponseKey - @brief The key for the "captchaResponse" value in the request. - */ +/// The key for the "captchaResponse" value in the request. private let kCaptchaResponseKey = "captchaResp" -/** @var kClientType - @brief The key for the "clientType" value in the request. - */ +/// The key for the "clientType" value in the request. private let kClientType = "clientType" -/** @var kRecaptchaVersion - @brief The key for the "recaptchaVersion" value in the request. - */ +/// The key for the "recaptchaVersion" value in the request. private let kRecaptchaVersion = "recaptchaVersion" @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class GetOOBConfirmationCodeRequest: IdentityToolkitRequest, AuthRPCRequest { typealias Response = GetOOBConfirmationCodeResponse - /** @property requestType - @brief The types of OOB Confirmation Code to request. - */ + /// The types of OOB Confirmation Code to request. let requestType: GetOOBConfirmationCodeRequestType - /** @property email - @brief The email of the user. - @remarks For password reset. - */ + /// The email of the user for password reset. private(set) var email: String? - /** @property updatedEmail - @brief The new email to be updated. - @remarks For verifyBeforeUpdateEmail. - */ + /// The new email to be updated for verifyBeforeUpdateEmail. private(set) var updatedEmail: String? - /** @property accessToken - @brief The STS Access Token of the authenticated user. - @remarks For email change. - */ + /// The STS Access Token of the authenticated user for email change. private(set) var accessToken: String? - /** @property continueURL - @brief This URL represents the state/Continue URL in the form of a universal link. - */ + /// This URL represents the state/Continue URL in the form of a universal link. private(set) var continueURL: String? - /** @property iOSBundleID - @brief The iOS bundle Identifier, if available. - */ + /// The iOS bundle Identifier, if available. private(set) var iOSBundleID: String? - /** @property androidPackageName - @brief The Android package name, if available. - */ + /// The Android package name, if available. private(set) var androidPackageName: String? - /** @property androidMinimumVersion - @brief The minimum Android version supported, if available. - */ + /// The minimum Android version supported, if available. private(set) var androidMinimumVersion: String? - /** @property androidInstallIfNotAvailable - @brief Indicates whether or not the Android app should be installed if not already available. - */ + /// Indicates whether or not the Android app should be installed if not already available. private(set) var androidInstallApp: Bool - /** @property handleCodeInApp - @brief Indicates whether the action code link will open the app directly or after being - redirected from a Firebase owned web widget. - */ + /// Indicates whether the action code link will open the app directly or after being + /// redirected from a Firebase owned web widget. private(set) var handleCodeInApp: Bool - /** @property dynamicLinkDomain - @brief The Firebase Dynamic Link domain used for out of band code flow. - */ + /// The Firebase Dynamic Link domain used for out of band code flow. private(set) var dynamicLinkDomain: String? - /** @property captchaResponse - @brief Response to the captcha. - */ + /// Response to the captcha. var captchaResponse: String? - /** @property captchaResponse - @brief The reCAPTCHA version. - */ + /// The reCAPTCHA version. var recaptchaVersion: String? - /** @fn initWithRequestType:email:APIKey: - @brief Designated initializer. - @param requestType The types of OOB Confirmation Code to request. - @param email The email of the user. - @param newEmail The email of the user to be updated. - @param accessToken The STS Access Token of the currently signed in user. - @param actionCodeSettings An object of FIRActionCodeSettings which specifies action code - settings to be applied to the OOB code request. - @param requestConfiguration An object containing configurations to be added to the request. - */ + /// Designated initializer. + /// - Parameter requestType: The types of OOB Confirmation Code to request. + /// - Parameter email: The email of the user. + /// - Parameter newEmail: The email of the user to be updated. + /// - Parameter accessToken: The STS Access Token of the currently signed in user. + /// - Parameter actionCodeSettings: An object of FIRActionCodeSettings which specifies action code + /// settings to be applied to the OOB code request. + /// - Parameter requestConfiguration: An object containing configurations to be added to the + /// request. required init(requestType: GetOOBConfirmationCodeRequestType, email: String?, newEmail: String?, diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/GetProjectConfigRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/GetProjectConfigRequest.swift index 33c9b442d21..f731e6df8fc 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/GetProjectConfigRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/GetProjectConfigRequest.swift @@ -14,9 +14,8 @@ import Foundation -/** @var kGetProjectConfigEndPoint - @brief The "getProjectConfig" endpoint. - */ +/// The "getProjectConfig" endpoint. + private let kGetProjectConfigEndPoint = "getProjectConfig" @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/GetRecaptchaConfigRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/GetRecaptchaConfigRequest.swift index 4b57f74d315..885f407a052 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/GetRecaptchaConfigRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/GetRecaptchaConfigRequest.swift @@ -18,45 +18,29 @@ private let kRecaptchaVersion = "RECAPTCHA_ENTERPRISE" private let kGetOobConfirmationCodeEndpoint = "getOobConfirmationCode" -/** @var kRequestTypeKey - @brief The name of the required "requestType" property in the request. - */ +/// The name of the required "requestType" property in the request. private let kRequestTypeKey = "requestType" -/** @var kEmailKey - @brief The name of the "email" property in the request. - */ +/// The name of the "email" property in the request. private let kEmailKey = "email" -/** @var kNewEmailKey - @brief The name of the "newEmail" property in the request. - */ +/// The name of the "newEmail" property in the request. private let kNewEmailKey = "newEmail" -/** @var kIDTokenKey - @brief The key for the "idToken" value in the request. This is actually the STS Access Token, - despite it's confusing (backwards compatiable) parameter name. - */ +/// The key for the "idToken" value in the request. This is actually the STS Access Token, +/// despite its confusing (backwards compatiable) parameter name. private let kIDTokenKey = "idToken" -/** @var kGetRecaptchaConfigEndpoint - @brief The "getRecaptchaConfig" endpoint. - */ +/// The "getRecaptchaConfig" endpoint. private let kGetRecaptchaConfigEndpoint = "recaptchaConfig" -/** @var kClientType - @brief The key for the "clientType" value in the request. - */ +/// The key for the "clientType" value in the request. private let kClientTypeKey = "clientType" -/** @var kVersionKey - @brief The key for the "version" value in the request. - */ +/// The key for the "version" value in the request. private let kVersionKey = "version" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. private let kTenantIDKey = "tenantId" @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/Enroll/FinalizeMFAEnrollmentRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/Enroll/FinalizeMFAEnrollmentRequest.swift index d2adb4d9cdb..773b448a136 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/Enroll/FinalizeMFAEnrollmentRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/Enroll/FinalizeMFAEnrollmentRequest.swift @@ -16,9 +16,7 @@ import Foundation private let kFinalizeMFAEnrollmentEndPoint = "accounts/mfaEnrollment:finalize" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. private let kTenantIDKey = "tenantId" @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/Enroll/StartMFAEnrollmentRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/Enroll/StartMFAEnrollmentRequest.swift index ffaf18f6e97..2ae904eac46 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/Enroll/StartMFAEnrollmentRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/Enroll/StartMFAEnrollmentRequest.swift @@ -16,9 +16,7 @@ import Foundation private let kStartMFAEnrollmentEndPoint = "accounts/mfaEnrollment:start" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. private let kTenantIDKey = "tenantId" @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/SignIn/FinalizeMFASignInRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/SignIn/FinalizeMFASignInRequest.swift index 8c94ea5dc9d..53f8a783b67 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/SignIn/FinalizeMFASignInRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/SignIn/FinalizeMFASignInRequest.swift @@ -16,9 +16,7 @@ import Foundation private let kFinalizeMFASignInEndPoint = "accounts/mfaSignIn:finalize" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. private let kTenantIDKey = "tenantId" @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/SignIn/StartMFASignInRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/SignIn/StartMFASignInRequest.swift index 977901fc563..413245776a7 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/SignIn/StartMFASignInRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/SignIn/StartMFASignInRequest.swift @@ -16,9 +16,8 @@ import Foundation private let kStartMFASignInEndPoint = "accounts/mfaSignIn:start" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. + private let kTenantIDKey = "tenantId" @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/Unenroll/WithdrawMFARequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/Unenroll/WithdrawMFARequest.swift index 240f909e262..5f8156a5191 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/Unenroll/WithdrawMFARequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/Unenroll/WithdrawMFARequest.swift @@ -16,9 +16,7 @@ import Foundation private let kWithdrawMFAEndPoint = "accounts/mfaEnrollment:withdraw" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. private let kTenantIDKey = "tenantId" @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/Proto/Phone/AuthProtoStartMFAPhoneRequestInfo.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/Proto/Phone/AuthProtoStartMFAPhoneRequestInfo.swift index fc52c4cfb94..274a7b97883 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/Proto/Phone/AuthProtoStartMFAPhoneRequestInfo.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/Proto/Phone/AuthProtoStartMFAPhoneRequestInfo.swift @@ -14,24 +14,16 @@ import Foundation -/** @var kPhoneNumberKey - @brief The key for the Phone Number parameter in the request. - */ +/// The key for the Phone Number parameter in the request. private let kPhoneNumberKey = "phoneNumber" -/** @var kReceiptKey - @brief The key for the receipt parameter in the request. - */ +/// The key for the receipt parameter in the request. private let kReceiptKey = "iosReceipt" -/** @var kSecretKey - @brief The key for the Secret parameter in the request. - */ +/// The key for the Secret parameter in the request. private let kSecretKey = "iosSecret" -/** @var kreCAPTCHATokenKey - @brief The key for the reCAPTCHAToken parameter in the request. - */ +/// The key for the reCAPTCHAToken parameter in the request. private let kreCAPTCHATokenKey = "recaptchaToken" class AuthProtoStartMFAPhoneRequestInfo: NSObject, AuthProto { diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/Proto/TOTP/AuthProtoStartMFATOTPEnrollmentRequestInfo.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/Proto/TOTP/AuthProtoStartMFATOTPEnrollmentRequestInfo.swift index f6c0af69381..69f65349aa1 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/Proto/TOTP/AuthProtoStartMFATOTPEnrollmentRequestInfo.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/Proto/TOTP/AuthProtoStartMFATOTPEnrollmentRequestInfo.swift @@ -14,10 +14,8 @@ import Foundation -/** - @brief AuthProtoFinalizeMFATOTPSignInRequestInfo class. This class is used to compose - finalizeMFASignInRequest for TOTP case. - */ +/// AuthProtoFinalizeMFATOTPSignInRequestInfo class. This class is used to compose +/// finalizeMFASignInRequest for TOTP case . class AuthProtoFinalizeMFATOTPSignInRequestInfo: NSObject, AuthProto { required init(dictionary: [String: AnyHashable]) { fatalError() diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/ResetPasswordRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/ResetPasswordRequest.swift index 69b6c085624..aa39c927b83 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/ResetPasswordRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/ResetPasswordRequest.swift @@ -14,46 +14,33 @@ import Foundation -/** @var kResetPasswordEndpoint - @brief The "resetPassword" endpoint. - */ +/// The "resetPassword" endpoint. private let kResetPasswordEndpoint = "resetPassword" -/** @var kOOBCodeKey - @brief The "resetPassword" key. - */ +/// The "resetPassword" key. private let kOOBCodeKey = "oobCode" -/** @var kCurrentPasswordKey - @brief The "newPassword" key. - */ +/// The "newPassword" key. private let kCurrentPasswordKey = "newPassword" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. private let kTenantIDKey = "tenantId" @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class ResetPasswordRequest: IdentityToolkitRequest, AuthRPCRequest { typealias Response = ResetPasswordResponse - /** @property oobCode - @brief The oobCode sent in the request. - */ + /// The oobCode sent in the request. let oobCode: String - /** @property updatedPassword - @brief The new password sent in the request. - */ + /// The new password sent in the request. let updatedPassword: String? - /** @fn initWithOobCode:newPassword:requestConfiguration: - @brief Designated initializer. - @param oobCode The OOB Code. - @param newPassword The new password. - @param requestConfiguration An object containing configurations to be added to the request. - */ + /// Designated initializer. + /// - Parameter oobCode: The OOB Code. + /// - Parameter newPassword: The new password. + /// - Parameter requestConfiguration: An object containing configurations to be added to the + /// request. init(oobCode: String, newPassword: String?, requestConfiguration: AuthRequestConfiguration) { self.oobCode = oobCode diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/ResetPasswordResponse.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/ResetPasswordResponse.swift index 8cb85aaffd6..fcfb619732e 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/ResetPasswordResponse.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/ResetPasswordResponse.swift @@ -14,32 +14,26 @@ import Foundation -/** @class FIRAuthResetPasswordResponse - @brief Represents the response from the resetPassword endpoint. - @remarks Possible error codes: - - FIRAuthErrorCodeWeakPassword - - FIRAuthErrorCodeUserDisabled - - FIRAuthErrorCodeOperationNotAllowed - - FIRAuthErrorCodeExpiredActionCode - - FIRAuthErrorCodeInvalidActionCode - @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/resetPassword - */ +/// Represents the response from the resetPassword endpoint. +/// +/// Possible error codes: +/// * FIRAuthErrorCodeWeakPassword +/// * FIRAuthErrorCodeUserDisabled +/// * FIRAuthErrorCodeOperationNotAllowed +/// * FIRAuthErrorCodeExpiredActionCode +/// * FIRAuthErrorCodeInvalidActionCode +/// +/// See https: // developers.google.com/identity/toolkit/web/reference/relyingparty/resetPassword class ResetPasswordResponse: AuthRPCResponse { required init() {} - /** @property email - @brief The email address corresponding to the reset password request. - */ + /// The email address corresponding to the reset password request. var email: String? - /** @property verifiedEmail - @brief The verified email returned from the backend. - */ + /// The verified email returned from the backend. var verifiedEmail: String? - /** @property requestType - @brief The type of request as returned by the backend. - */ + /// The type of request as returned by the backend. var requestType: String? func setFields(dictionary: [String: AnyHashable]) throws { diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/RevokeTokenRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/RevokeTokenRequest.swift index c50151fc93c..c69ab2b60b0 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/RevokeTokenRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/RevokeTokenRequest.swift @@ -14,57 +14,38 @@ import Foundation -/** @var kRevokeTokenEndpoint - @brief The endpoint for the revokeToken request. - */ +/// The endpoint for the revokeToken request. private let kRevokeTokenEndpoint = "accounts:revokeToken" -/** @var kProviderIDKey - @brief The key for the provider that issued the token to revoke. - */ +/// The key for the provider that issued the token to revoke. private let kProviderIDKey = "providerId" -/** @var kTokenTypeKey - @brief The key for the type of the token to revoke. - */ +/// The key for the type of the token to revoke. private let kTokenTypeKey = "tokenType" -/** @var kTokenKey - @brief The key for the token to be revoked. - */ +/// The key for the token to be revoked. private let kTokenKey = "token" -/** @var kIDTokenKey - @brief The key for the ID Token associated with this credential. - */ +/// The key for the ID Token associated with this credential. private let kIDTokenKey = "idToken" -/** @class FIRVerifyPasswordRequest - @brief Represents the parameters for the verifyPassword endpoint. - @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/verifyPassword - */ +/// Represents the parameters for the verifyPassword endpoint. +/// +/// See https: // developers.google.com/identity/toolkit/web/reference/relyingparty/verifyPassword @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class RevokeTokenRequest: IdentityToolkitRequest, AuthRPCRequest { typealias Response = RevokeTokenResponse - /** @property providerID - @brief The provider that issued the token to revoke. - */ + /// The provider that issued the token to revoke. private(set) var providerID: String - /** @property tokenType - @brief The type of the token to revoke. - */ + /// The type of the token to revoke. private(set) var tokenType: TokenType - /** @property token - @brief The token to be revoked. - */ + /// The token to be revoked. private(set) var token: String - /** @property idToken - @brief The ID Token associated with this credential. - */ + /// The ID Token associated with this credential. private(set) var idToken: String enum TokenType: Int { diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/SecureTokenRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/SecureTokenRequest.swift index e0f0829fe95..60a504a367a 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/SecureTokenRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/SecureTokenRequest.swift @@ -28,84 +28,54 @@ enum SecureTokenRequestGrantType: Int { } } -/** @var kFIRSecureTokenServiceGetTokenURLFormat - @brief The format of the secure token service URLs. Requires string format substitution with - the client's API Key. - */ +/// The format of the secure token service URLs. Requires string format substitution with +/// the client's API Key. private let kFIRSecureTokenServiceGetTokenURLFormat = "https://%@/v1/token?key=%@" -/** @var kFIREmulatorURLFormat - @brief The format of the emulated secure token service URLs. Requires string format substitution - with the emulator host, the gAPIHost, and the client's API Key. - */ +/// The format of the emulated secure token service URLs. Requires string format substitution +/// with the emulator host, the gAPIHost, and the client's API Key. private let kFIREmulatorURLFormat = "http://%@/%@/v1/token?key=%@" -/** @var kFIRSecureTokenServiceGrantTypeRefreshToken - @brief The string value of the @c FIRSecureTokenRequestGrantTypeRefreshToken request type. - */ +/// The string value of the `SecureTokenRequestGrantTypeRefreshToken` request type. private let kFIRSecureTokenServiceGrantTypeRefreshToken = "refresh_token" -/** @var kFIRSecureTokenServiceGrantTypeAuthorizationCode - @brief The string value of the @c FIRSecureTokenRequestGrantTypeAuthorizationCode request type. - */ +/// The string value of the `SecureTokenRequestGrantTypeAuthorizationCode` request type. private let kFIRSecureTokenServiceGrantTypeAuthorizationCode = "authorization_code" -/** @var kGrantTypeKey - @brief The key for the "grantType" parameter in the request. - */ +/// The key for the "grantType" parameter in the request. private let kGrantTypeKey = "grantType" -/** @var kScopeKey - @brief The key for the "scope" parameter in the request. - */ +/// The key for the "scope" parameter in the request. private let kScopeKey = "scope" -/** @var kRefreshTokenKey - @brief The key for the "refreshToken" parameter in the request. - */ +/// The key for the "refreshToken" parameter in the request. private let kRefreshTokenKey = "refreshToken" -/** @var kCodeKey - @brief The key for the "code" parameter in the request. - */ +/// The key for the "code" parameter in the request. private let kCodeKey = "code" -/** @var gAPIHost - @brief Host for server API calls. - */ +/// Host for server API calls. private var gAPIHost = "securetoken.googleapis.com" -/** @class FIRSecureTokenRequest - @brief Represents the parameters for the token endpoint. - */ +/// Represents the parameters for the token endpoint. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class SecureTokenRequest: AuthRPCRequest { typealias Response = SecureTokenResponse - /** @property grantType - @brief The type of grant requested. - @see FIRSecureTokenRequestGrantType - */ + /// The type of grant requested. + /// See FIRSecureTokenRequestGrantType var grantType: SecureTokenRequestGrantType - /** @property scope - @brief The scopes requested (a comma-delimited list of scope strings.) - */ + /// The scopes requested (a comma-delimited list of scope strings). var scope: String? - /** @property refreshToken - @brief The client's refresh token. - */ + /// The client's refresh token. var refreshToken: String? - /** @property code - @brief The client's authorization code (legacy Gitkit "ID Token"). - */ + /// The client's authorization code (legacy Gitkit "ID Token"). var code: String? - /** @property APIKey - @brief The client's API Key. - */ + /// The client's API Key. let apiKey: String let _requestConfiguration: AuthRequestConfiguration diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/SecureTokenResponse.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/SecureTokenResponse.swift index d2331b44bf5..f16bd573da0 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/SecureTokenResponse.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/SecureTokenResponse.swift @@ -16,19 +16,16 @@ import Foundation private let kExpiresInKey = "expires_in" -/** @var kRefreshTokenKey - @brief The key for the refresh token. - */ +/// The key for the refresh token. + private let kRefreshTokenKey = "refresh_token" -/** @var kAccessTokenKey - @brief The key for the access token. - */ +/// The key for the access token. + private let kAccessTokenKey = "access_token" -/** @var kIDTokenKey - @brief The key for the "id_token" value in the response. - */ +/// The key for the "id_token" value in the response. + private let kIDTokenKey = "id_token" @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/SendVerificationTokenRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/SendVerificationTokenRequest.swift index a3ae44f95ac..af090fdd3b3 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/SendVerificationTokenRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/SendVerificationTokenRequest.swift @@ -14,34 +14,22 @@ import Foundation -/** @var kSendVerificationCodeEndPoint - @brief The "sendVerificationCodeEnd" endpoint. - */ +/// The "sendVerificationCodeEnd" endpoint. private let kSendVerificationCodeEndPoint = "sendVerificationCode" -/** @var kPhoneNumberKey - @brief The key for the Phone Number parameter in the request. - */ +/// The key for the Phone Number parameter in the request. private let kPhoneNumberKey = "phoneNumber" -/** @var kReceiptKey - @brief The key for the receipt parameter in the request. - */ +/// The key for the receipt parameter in the request. private let kReceiptKey = "iosReceipt" -/** @var kSecretKey - @brief The key for the Secret parameter in the request. - */ +/// The key for the Secret parameter in the request. private let kSecretKey = "iosSecret" -/** @var kreCAPTCHATokenKey - @brief The key for the reCAPTCHAToken parameter in the request. - */ +/// The key for the reCAPTCHAToken parameter in the request. private let kreCAPTCHATokenKey = "recaptchaToken" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. private let kTenantIDKey = "tenantId" /// A verification code can be an appCredential or a reCaptcha Token @@ -55,14 +43,11 @@ enum CodeIdentity { class SendVerificationCodeRequest: IdentityToolkitRequest, AuthRPCRequest { typealias Response = SendVerificationCodeResponse - /** @property phoneNumber - @brief The phone number to which the verification code should be sent. - */ + /// The phone number to which the verification code should be sent. let phoneNumber: String - /** @property verificationCode - @brief The credential or reCAPTCHA token to prove the identity of the app in order to send the verification code. - */ + /// The credential or reCAPTCHA token to prove the identity of the app in order to send the + /// verification code. let codeIdentity: CodeIdentity init(phoneNumber: String, codeIdentity: CodeIdentity, diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/SetAccountInfoRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/SetAccountInfoRequest.swift index a6f242ab92d..2680d41e16e 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/SetAccountInfoRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/SetAccountInfoRequest.swift @@ -24,179 +24,114 @@ private let FIRSetAccountInfoUserAttributePhotoURL = "PHOTO_URL" private let FIRSetAccountInfoUserAttributePassword = "PASSWORD" -/** @var kCreateAuthURIEndpoint - @brief The "setAccountInfo" endpoint. - */ +/// The "setAccountInfo" endpoint. private let kSetAccountInfoEndpoint = "setAccountInfo" -/** @var kIDTokenKey - @brief The key for the "idToken" value in the request. This is actually the STS Access Token, - despite it's confusing (backwards compatiable) parameter name. - */ +/// The key for the "idToken" value in the request. This is actually the STS Access Token, +/// despite its confusing (backwards compatiable) parameter name. private let kIDTokenKey = "idToken" -/** @var kDisplayNameKey - @brief The key for the "displayName" value in the request. - */ +/// The key for the "displayName" value in the request. private let kDisplayNameKey = "displayName" -/** @var kLocalIDKey - @brief The key for the "localID" value in the request. - */ +/// The key for the "localID" value in the request. private let kLocalIDKey = "localId" -/** @var kEmailKey - @brief The key for the "email" value in the request. - */ +/// The key for the "email" value in the request. private let kEmailKey = "email" -/** @var kPasswordKey - @brief The key for the "password" value in the request. - */ +/// The key for the "password" value in the request. private let kPasswordKey = "password" -/** @var kPhotoURLKey - @brief The key for the "photoURL" value in the request. - */ +/// The key for the "photoURL" value in the request. private let kPhotoURLKey = "photoUrl" -/** @var kProvidersKey - @brief The key for the "providers" value in the request. - */ +/// The key for the "providers" value in the request. private let kProvidersKey = "provider" -/** @var kOOBCodeKey - @brief The key for the "OOBCode" value in the request. - */ +/// The key for the "OOBCode" value in the request. private let kOOBCodeKey = "oobCode" -/** @var kEmailVerifiedKey - @brief The key for the "emailVerified" value in the request. - */ +/// The key for the "emailVerified" value in the request. private let kEmailVerifiedKey = "emailVerified" -/** @var kUpgradeToFederatedLoginKey - @brief The key for the "upgradeToFederatedLogin" value in the request. - */ +/// The key for the "upgradeToFederatedLogin" value in the request. private let kUpgradeToFederatedLoginKey = "upgradeToFederatedLogin" -/** @var kCaptchaChallengeKey - @brief The key for the "captchaChallenge" value in the request. - */ +/// The key for the "captchaChallenge" value in the request. private let kCaptchaChallengeKey = "captchaChallenge" -/** @var kCaptchaResponseKey - @brief The key for the "captchaResponse" value in the request. - */ +/// The key for the "captchaResponse" value in the request. private let kCaptchaResponseKey = "captchaResponse" -/** @var kDeleteAttributesKey - @brief The key for the "deleteAttribute" value in the request. - */ +/// The key for the "deleteAttribute" value in the request. private let kDeleteAttributesKey = "deleteAttribute" -/** @var kDeleteProvidersKey - @brief The key for the "deleteProvider" value in the request. - */ +/// The key for the "deleteProvider" value in the request. private let kDeleteProvidersKey = "deleteProvider" -/** @var kReturnSecureTokenKey - @brief The key for the "returnSecureToken" value in the request. - */ +/// The key for the "returnSecureToken" value in the request. private let kReturnSecureTokenKey = "returnSecureToken" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. private let kTenantIDKey = "tenantId" -/** @class FIRSetAccountInfoRequest - @brief Represents the parameters for the setAccountInfo endpoint. - @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/setAccountInfo - */ +/// Represents the parameters for the setAccountInfo endpoint. +/// See https://developers.google.com/identity/toolkit/web/reference/relyingparty/setAccountInfo @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class SetAccountInfoRequest: IdentityToolkitRequest, AuthRPCRequest { typealias Response = SetAccountInfoResponse - /** @property accessToken - @brief The STS Access Token of the authenticated user. - */ + + /// The STS Access Token of the authenticated user. var accessToken: String? - /** @property displayName - @brief The name of the user. - */ + /// The name of the user. var displayName: String? - /** @property localID - @brief The local ID of the user. - */ + /// The local ID of the user. var localID: String? - /** @property email - @brief The email of the user. - */ + /// The email of the user. var email: String? - /** @property photoURL - @brief The photoURL of the user. - */ + /// The photoURL of the user. var photoURL: URL? - /** @property password - @brief The new password of the user. - */ + /// The new password of the user. var password: String? - /** @property providers - @brief The associated identity providers of the user. - */ + /// The associated identity providers of the user. var providers: [String]? - /** @property OOBCode - @brief The out-of-band code of the change email request. - */ + /// The out-of-band code of the change email request. var oobCode: String? - /** @property emailVerified - @brief Whether to mark the email as verified or not. - */ + /// Whether to mark the email as verified or not. var emailVerified: Bool = false - /** @property upgradeToFederatedLogin - @brief Whether to mark the user to upgrade to federated login. - */ + /// Whether to mark the user to upgrade to federated login. var upgradeToFederatedLogin: Bool = false - /** @property captchaChallenge - @brief The captcha challenge. - */ + /// The captcha challenge. var captchaChallenge: String? - /** @property captchaResponse - @brief Response to the captcha. - */ + /// Response to the captcha. var captchaResponse: String? - /** @property deleteAttributes - @brief The list of user attributes to delete. - @remarks Every element of the list must be one of the predefined constant starts with - "FIRSetAccountInfoUserAttribute". - */ + /// The list of user attributes to delete. + /// + /// Every element of the list must be one of the predefined constant starts with + /// `SetAccountInfoUserAttribute`. var deleteAttributes: [String]? - /** @property deleteProviders - @brief The list of identity providers to delete. - */ + /// The list of identity providers to delete. var deleteProviders: [String]? - /** @property returnSecureToken - @brief Whether the response should return access token and refresh token directly. - @remarks The default value is @c YES . - */ - var returnSecureToken: Bool = false + /// Whether the response should return access token and refresh token directly. + /// The default value is `true` . + var returnSecureToken: Bool = true init(requestConfiguration: AuthRequestConfiguration) { - returnSecureToken = true super.init(endpoint: kSetAccountInfoEndpoint, requestConfiguration: requestConfiguration) } diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/SetAccountInfoResponse.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/SetAccountInfoResponse.swift index ac498ce458c..d6bd97ccd70 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/SetAccountInfoResponse.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/SetAccountInfoResponse.swift @@ -14,30 +14,20 @@ import Foundation -/** @class FIRSetAccountInfoResponseProviderUserInfo - @brief Represents the provider user info part of the response from the setAccountInfo endpoint. - @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/setAccountInfo - */ +/// Represents the provider user info part of the response from the setAccountInfo endpoint. +/// See https: // developers.google.com/identity/toolkit/web/reference/relyingparty/setAccountInfo class SetAccountInfoResponseProviderUserInfo: NSObject { - /** @property providerID - @brief The ID of the identity provider. - */ + /// The ID of the identity provider. var providerID: String? - /** @property displayName - @brief The user's display name at the identity provider. - */ + /// The user's display name at the identity provider. var displayName: String? - /** @property photoURL - @brief The user's photo URL at the identity provider. - */ + /// The user's photo URL at the identity provider. var photoURL: URL? - /** @fn initWithAPIKey: - @brief Designated initializer. - @param dictionary The provider user info data from endpoint. - */ + /// Designated initializer. + /// - Parameter dictionary: The provider user info data from endpoint. init(dictionary: [String: Any]) { providerID = dictionary["providerId"] as? String displayName = dictionary["displayName"] as? String @@ -47,43 +37,29 @@ class SetAccountInfoResponseProviderUserInfo: NSObject { } } -/** @class FIRSetAccountInfoResponse - @brief Represents the response from the setAccountInfo endpoint. - @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/setAccountInfo - */ +/// Represents the response from the setAccountInfo endpoint. +/// See https: // developers.google.com/identity/toolkit/web/reference/relyingparty/setAccountInfo class SetAccountInfoResponse: AuthRPCResponse { required init() {} - /** @property email - @brief The email or the user. - */ + /// The email or the user. var email: String? - /** @property displayName - @brief The display name of the user. - */ + /// The display name of the user. var displayName: String? - /** @property providerUserInfo - @brief The user's profiles at the associated identity providers. - */ + /// The user's profiles at the associated identity providers. var providerUserInfo: [SetAccountInfoResponseProviderUserInfo]? - /** @property idToken - @brief Either an authorization code suitable for performing an STS token exchange, or the - access token from Secure Token Service, depending on whether @c returnSecureToken is set - on the request. - */ + /// Either an authorization code suitable for performing an STS token exchange, or the + /// access token from Secure Token Service, depending on whether `returnSecureToken` is set + /// on the request. var idToken: String? - /** @property approximateExpirationDate - @brief The approximate expiration date of the access token. - */ + /// The approximate expiration date of the access token. var approximateExpirationDate: Date? - /** @property refreshToken - @brief The refresh token from Secure Token Service. - */ + /// The refresh token from Secure Token Service. var refreshToken: String? func setFields(dictionary: [String: AnyHashable]) throws { diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/SignInWithGameCenterRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/SignInWithGameCenterRequest.swift index 39e346f6325..adab76dcd34 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/SignInWithGameCenterRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/SignInWithGameCenterRequest.swift @@ -16,69 +16,47 @@ import Foundation private let kSignInWithGameCenterEndPoint = "signInWithGameCenter" -/** @class FIRSignInWithGameCenterRequest - @brief The request to sign in with Game Center account - */ +/// The request to sign in with Game Center account @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class SignInWithGameCenterRequest: IdentityToolkitRequest, AuthRPCRequest { typealias Response = SignInWithGameCenterResponse - /** @property playerID - @brief The playerID to verify. - */ + /// The playerID to verify. var playerID: String - /** @property teamPlayerID - @brief The team player ID of the Game Center local player. - */ + /// The team player ID of the Game Center local player. var teamPlayerID: String? - /** @property gamePlayerID - @brief The game player ID of the Game Center local player. - */ + /// The game player ID of the Game Center local player. var gamePlayerID: String? - /** @property publicKeyURL - @brief The URL for the encryption key. - */ + /// The URL for the encryption key. var publicKeyURL: URL - /** @property signature - @brief The verification signature data generated by Game Center. - */ + /// The verification signature data generated by Game Center. var signature: Data - /** @property salt - @brief A random strong used to compute the hash and keep it randomized. - */ + /// A random strong used to compute the hash and keep it randomized. var salt: Data - /** @property timestamp - @brief The date and time that the signature was created. - */ + /// The date and time that the signature was created. var timestamp: UInt64 - /** @property accessToken - @brief The STS Access Token for the authenticated user, only needed for linking the user. - */ + /// The STS Access Token for the authenticated user, only needed for linking the user. var accessToken: String? - /** @property displayName - @brief The display name of the local Game Center player. - */ + /// The display name of the local Game Center player. var displayName: String? - /** @fn initWithPlayerID:publicKeyURL:signature:salt:timestamp:displayName:requestConfiguration: - @brief Designated initializer. - @param playerID The ID of the Game Center player. - @param teamPlayerID The teamPlayerID of the Game Center local player. - @param gamePlayerID The gamePlayerID of the Game Center local player. - @param publicKeyURL The URL for the encryption key. - @param signature The verification signature generated. - @param salt A random string used to compute the hash and keep it randomized. - @param timestamp The date and time that the signature was created. - @param displayName The display name of the Game Center player. - */ + /// Designated initializer. + /// - Parameter playerID: The ID of the Game Center player. + /// - Parameter teamPlayerID: The teamPlayerID of the Game Center local player. + /// - Parameter gamePlayerID: The gamePlayerID of the Game Center local player. + /// - Parameter publicKeyURL: The URL for the encryption key. + /// - Parameter signature: The verification signature generated. + /// - Parameter salt: A random string used to compute the hash and keep it randomized. + /// - Parameter timestamp: The date and time that the signature was created. + /// - Parameter displayName: The display name of the Game Center player. init(playerID: String, teamPlayerID: String?, gamePlayerID: String?, publicKeyURL: URL, signature: Data, salt: Data, diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/SignUpNewUserRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/SignUpNewUserRequest.swift index f96703fff35..9a2d7096418 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/SignUpNewUserRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/SignUpNewUserRequest.swift @@ -14,105 +14,69 @@ import Foundation -/** @var kSignupNewUserEndpoint - @brief The "SingupNewUserEndpoint" endpoint. - */ +/// The "SignupNewUserEndpoint" endpoint. private let kSignupNewUserEndpoint = "signupNewUser" -/** @var kEmailKey - @brief The key for the "email" value in the request. - */ +/// The key for the "email" value in the request. private let kEmailKey = "email" -/** @var kPasswordKey - @brief The key for the "password" value in the request. - */ +/// The key for the "password" value in the request. private let kPasswordKey = "password" -/** @var kDisplayNameKey - @brief The key for the "kDisplayName" value in the request. - */ +/// The key for the "kDisplayName" value in the request. private let kDisplayNameKey = "displayName" -/** @var kIDToken - @brief The key for the "kIDToken" value in the request. - */ +/// The key for the "kIDToken" value in the request. private let kIDToken = "idToken" -/** @var kCaptchaResponseKey - @brief The key for the "captchaResponse" value in the request. - */ +/// The key for the "captchaResponse" value in the request. private let kCaptchaResponseKey = "captchaResponse" -/** @var kClientType - @brief The key for the "clientType" value in the request. - */ +/// The key for the "clientType" value in the request. private let kClientType = "clientType" -/** @var kRecaptchaVersion - @brief The key for the "recaptchaVersion" value in the request. - */ +/// The key for the "recaptchaVersion" value in the request. private let kRecaptchaVersion = "recaptchaVersion" -/** @var kReturnSecureTokenKey - @brief The key for the "returnSecureToken" value in the request. - */ +/// The key for the "returnSecureToken" value in the request. private let kReturnSecureTokenKey = "returnSecureToken" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. private let kTenantIDKey = "tenantId" @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class SignUpNewUserRequest: IdentityToolkitRequest, AuthRPCRequest { typealias Response = SignUpNewUserResponse - /** @property email - @brief The email of the user. - */ + /// The email of the user. private(set) var email: String? - /** @property password - @brief The password inputed by the user. - */ + /// The password inputed by the user. private(set) var password: String? - /** @property displayName - @brief The password inputed by the user. - */ + /// The password inputed by the user. private(set) var displayName: String? - /** @property idToken - @brief The idToken of the user. - */ + /// The idToken of the user. private(set) var idToken: String? - /** @property captchaResponse - @brief Response to the captcha. - */ - + /// Response to the captcha. var captchaResponse: String? - /** @property captchaResponse - @brief The reCAPTCHA version. - */ + /// The reCAPTCHA version. var recaptchaVersion: String? - /** @property returnSecureToken - @brief Whether the response should return access token and refresh token directly. - @remarks The default value is @c YES . - */ + /// Whether the response should return access token and refresh token directly. + /// The default value is `true`. var returnSecureToken: Bool = true init(requestConfiguration: AuthRequestConfiguration) { super.init(endpoint: kSignupNewUserEndpoint, requestConfiguration: requestConfiguration) } - /** @fn initWithAPIKey:email:password:displayName:requestConfiguration - @brief Designated initializer. - @param requestConfiguration An object containing configurations to be added to the request. - */ + /// Designated initializer. + /// - Parameter requestConfiguration: An object containing configurations to be added to the + /// request. init(email: String?, password: String?, displayName: String?, diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/SignUpNewUserResponse.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/SignUpNewUserResponse.swift index d46ae7398dd..fe6c8d9556e 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/SignUpNewUserResponse.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/SignUpNewUserResponse.swift @@ -17,21 +17,15 @@ import Foundation class SignUpNewUserResponse: AuthRPCResponse { required init() {} - /** @property IDToken - @brief Either an authorization code suitable for performing an STS token exchange, or the - access token from Secure Token Service, depending on whether @c returnSecureToken is set - on the request. - */ + /// Either an authorization code suitable for performing an STS token exchange, or the + /// access token from Secure Token Service, depending on whether `returnSecureToken` is set + /// on the request. var idToken: String? - /** @property approximateExpirationDate - @brief The approximate expiration date of the access token. - */ + /// The approximate expiration date of the access token. var approximateExpirationDate: Date? - /** @property refreshToken - @brief The refresh token from Secure Token Service. - */ + /// The refresh token from Secure Token Service. var refreshToken: String? func setFields(dictionary: [String: AnyHashable]) throws { diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyAssertionRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyAssertionRequest.swift index fd97de6c282..59f6f52f84f 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyAssertionRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyAssertionRequest.swift @@ -14,197 +14,124 @@ import Foundation -/** @var kVerifyAssertionEndpoint - @brief The "verifyAssertion" endpoint. - */ +/// The "verifyAssertion" endpoint. private let kVerifyAssertionEndpoint = "verifyAssertion" -/** @var kProviderIDKey - @brief The key for the "providerId" value in the request. - */ +/// The key for the "providerId" value in the request. private let kProviderIDKey = "providerId" -/** @var kProviderIDTokenKey - @brief The key for the "id_token" value in the request. - */ +/// The key for the "id_token" value in the request. private let kProviderIDTokenKey = "id_token" -/** @var kProviderNonceKey - @brief The key for the "nonce" value in the request. - */ +/// The key for the "nonce" value in the request. private let kProviderNonceKey = "nonce" -/** @var kProviderAccessTokenKey - @brief The key for the "access_token" value in the request. - */ +/// The key for the "access_token" value in the request. private let kProviderAccessTokenKey = "access_token" -/** @var kProviderOAuthTokenSecretKey - @brief The key for the "oauth_token_secret" value in the request. - */ +/// The key for the "oauth_token_secret" value in the request. private let kProviderOAuthTokenSecretKey = "oauth_token_secret" -/** @var kIdentifierKey - @brief The key for the "identifier" value in the request. - */ +/// The key for the "identifier" value in the request. private let kIdentifierKey = "identifier" -/** @var kRequestURIKey - @brief The key for the "requestUri" value in the request. - */ +/// The key for the "requestUri" value in the request. private let kRequestURIKey = "requestUri" -/** @var kPostBodyKey - @brief The key for the "postBody" value in the request. - */ +/// The key for the "postBody" value in the request. private let kPostBodyKey = "postBody" -/** @var kPendingTokenKey - @brief The key for the "pendingToken" value in the request. - */ +/// The key for the "pendingToken" value in the request. private let kPendingTokenKey = "pendingToken" -/** @var kAutoCreateKey - @brief The key for the "autoCreate" value in the request. - */ +/// The key for the "autoCreate" value in the request. private let kAutoCreateKey = "autoCreate" -/** @var kIDTokenKey - @brief The key for the "idToken" value in the request. This is actually the STS Access Token, - despite it's confusing (backwards compatiable) parameter name. - */ +/// The key for the "idToken" value in the request. This is actually the STS Access Token, +/// despite its confusing (backwards compatiable) parameter name. private let kIDTokenKey = "idToken" -/** @var kReturnSecureTokenKey - @brief The key for the "returnSecureToken" value in the request. - */ +/// The key for the "returnSecureToken" value in the request. private let kReturnSecureTokenKey = "returnSecureToken" -/** @var kReturnIDPCredentialKey - @brief The key for the "returnIdpCredential" value in the request. - */ +/// The key for the "returnIdpCredential" value in the request. private let kReturnIDPCredentialKey = "returnIdpCredential" -/** @var kSessionIDKey - @brief The key for the "sessionID" value in the request. - */ +/// The key for the "sessionID" value in the request. private let kSessionIDKey = "sessionId" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. private let kTenantIDKey = "tenantId" -/** @var kUserKey - @brief The key for the "user" value in the request. The value is a JSON object that contains the - name of the user. - */ +/// The key for the "user" value in the request. The value is a JSON object that contains the +/// name of the user. private let kUserKey = "user" -/** @var kNameKey - @brief The key for the "name" value in the request. The value is a JSON object that contains the - first and/or last name of the user. - */ +/// The key for the "name" value in the request. The value is a JSON object that contains the +/// first and/or last name of the user. private let kNameKey = "name" -/** @var kFirstNameKey - @brief The key for the "firstName" value in the request. - */ +/// The key for the "firstName" value in the request. private let kFirstNameKey = "firstName" -/** @var kLastNameKey - @brief The key for the "lastName" value in the request. - */ +/// The key for the "lastName" value in the request. private let kLastNameKey = "lastName" -/** @class FIRVerifyAssertionRequest - @brief Represents the parameters for the verifyAssertion endpoint. - @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/verifyAssertion - */ +/// Represents the parameters for the verifyAssertion endpoint. +/// See https://developers.google.com/identity/toolkit/web/reference/relyingparty/verifyAssertion @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class VerifyAssertionRequest: IdentityToolkitRequest, AuthRPCRequest { typealias Response = VerifyAssertionResponse - /** @property requestURI - @brief The URI to which the IDP redirects the user back. It may contain federated login result - params added by the IDP. - */ + /// The URI to which the IDP redirects the user back. It may contain federated login result + /// params added by the IDP. var requestURI: String? - /** @property pendingToken - @brief The Firebase ID Token for the IDP pending to be confirmed by the user. - */ + /// The Firebase ID Token for the IDP pending to be confirmed by the user. var pendingToken: String? - /** @property accessToken - @brief The STS Access Token for the authenticated user, only needed for linking the user. - */ + /// The STS Access Token for the authenticated user, only needed for linking the user. var accessToken: String? - /** @property returnSecureToken - @brief Whether the response should return access token and refresh token directly. - @remarks The default value is @c YES . - */ - var returnSecureToken: Bool = false + /// Whether the response should return access token and refresh token directly. + /// The default value is `true` . + + var returnSecureToken: Bool = true // MARK: - Components of "postBody" - /** @property providerID - @brief The ID of the IDP whose credentials are being presented to the endpoint. - */ + /// The ID of the IDP whose credentials are being presented to the endpoint. let providerID: String - /** @property providerAccessToken - @brief An access token from the IDP. - */ + /// An access token from the IDP. var providerAccessToken: String? - /** @property providerIDToken - @brief An ID Token from the IDP. - */ + /// An ID Token from the IDP. var providerIDToken: String? - /** @property providerRawNonce - @brief An raw nonce from the IDP. - */ + /// An raw nonce from the IDP. var providerRawNonce: String? - /** @property returnIDPCredential - @brief Whether the response should return the IDP credential directly. - */ - var returnIDPCredential: Bool = false + /// Whether the response should return the IDP credential directly. + var returnIDPCredential: Bool = true - /** @property providerOAuthTokenSecret - @brief A session ID used to map this request to a headful-lite flow. - */ + /// A session ID used to map this request to a headful-lite flow. var sessionID: String? - /** @property providerOAuthTokenSecret - @brief An OAuth client secret from the IDP. - */ + /// An OAuth client secret from the IDP. var providerOAuthTokenSecret: String? - /** @property inputEmail - @brief The originally entered email in the UI. - */ + /// The originally entered email in the UI. var inputEmail: String? - /** @property autoCreate - @brief A flag that indicates whether or not the user should be automatically created. - */ - var autoCreate: Bool = false + /// A flag that indicates whether or not the user should be automatically created. + var autoCreate: Bool = true - /** @property fullName - @brief A full name from the IdP. - */ + /// A full name from the IdP. var fullName: PersonNameComponents? init(providerID: String, requestConfiguration: AuthRequestConfiguration) { self.providerID = providerID - returnSecureToken = true - autoCreate = true - returnIDPCredential = true - super.init(endpoint: kVerifyAssertionEndpoint, requestConfiguration: requestConfiguration) } diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyAssertionResponse.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyAssertionResponse.swift index b8610028df5..a2077ba8bb9 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyAssertionResponse.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyAssertionResponse.swift @@ -14,191 +14,119 @@ import Foundation -/** @class FIRVerifyAssertionResponse - @brief Represents the response from the verifyAssertion endpoint. - @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/verifyAssertion - */ +/// Represents the response from the verifyAssertion endpoint. +/// See https: // developers.google.com/identity/toolkit/web/reference/relyingparty/verifyAssertion class VerifyAssertionResponse: AuthRPCResponse, AuthMFAResponse { required init() {} - /** @property federatedID - @brief The unique ID identifies the IdP account. - */ + /// The unique ID identifies the IdP account. var federatedID: String? - /** @property providerID - @brief The IdP ID. For white listed IdPs it's a short domain name e.g. google.com, aol.com, - live.net and yahoo.com. If the "providerId" param is set to OpenID OP identifer other than - the whilte listed IdPs the OP identifier is returned. If the "identifier" param is federated - ID in the createAuthUri request. The domain part of the federated ID is returned. - */ + /// The IdP ID. For white listed IdPs it's a short domain name e.g. google.com, aol.com, + /// live.net and yahoo.com.If the "providerId" param is set to OpenID OP identifer other than + /// the white listed IdPs the OP identifier is returned.If the "identifier" param is federated + /// ID in the createAuthUri request.The domain part of the federated ID is returned. var providerID: String? - /** @property localID - @brief The RP local ID if it's already been mapped to the IdP account identified by the - federated ID. - */ + /// The RP local ID if it's already been mapped to the IdP account identified by the federated ID. var localID: String? - /** @property email - @brief The email returned by the IdP. NOTE: The federated login user may not own the email. - */ + /// The email returned by the IdP. NOTE: The federated login user may not own the email. var email: String? - /** @property inputEmail - @brief It's the identifier param in the createAuthUri request if the identifier is an email. It - can be used to check whether the user input email is different from the asserted email. - */ + /// It's the identifier param in the createAuthUri request if the identifier is an email. It + /// can be used to check whether the user input email is different from the asserted email. var inputEmail: String? - /** @property originalEmail - @brief The original email stored in the mapping storage. It's returned when the federated ID is - associated to a different email. - */ + /// The original email stored in the mapping storage. It's returned when the federated ID is + /// associated to a different email. var originalEmail: String? - /** @property oauthRequestToken - @brief The user approved request token for the OpenID OAuth extension. - */ + /// The user approved request token for the OpenID OAuth extension. var oauthRequestToken: String? - /** @property oauthScope - @brief The scope for the OpenID OAuth extension. - */ + /// The scope for the OpenID OAuth extension. var oauthScope: String? - /** @property firstName - @brief The first name of the user. - */ + /// The first name of the user. var firstName: String? - /** @property lastName - @brief The last name of the user. - */ + /// The last name of the user. var lastName: String? - /** @property fullName - @brief The full name of the user. - */ + /// The full name of the user. var fullName: String? - /** @property nickName - @brief The nick name of the user. - */ + /// The nickname of the user. var nickName: String? - /** @property displayName - @brief The display name of the user. - */ + /// The display name of the user. var displayName: String? - /** @property idToken - @brief Either an authorization code suitable for performing an STS token exchange, or the - access token from Secure Token Service, depending on whether @c returnSecureToken is set - on the request. - */ + /// Either an authorization code suitable for performing an STS token exchange, or the + /// access token from Secure Token Service, depending on whether `returnSecureToken` is set + /// on the request. private(set) var idToken: String? - /** @property approximateExpirationDate - @brief The approximate expiration date of the access token. - */ + /// The approximate expiration date of the access token. var approximateExpirationDate: Date? - /** @property refreshToken - @brief The refresh token from Secure Token Service. - */ + /// The refresh token from Secure Token Service. var refreshToken: String? - /** @property action - @brief The action code. - */ + /// The action code. var action: String? - /** @property language - @brief The language preference of the user. - */ + /// The language preference of the user. var language: String? - /** @property timeZone - @brief The timezone of the user. - */ + /// The timezone of the user. var timeZone: String? - /** @property photoURL - @brief The URI of the accessible profile picture. - */ + /// The URI of the accessible profile picture. var photoURL: URL? - /** @property dateOfBirth - @brief The birth date of the IdP account. - */ + /// The birth date of the IdP account. var dateOfBirth: String? - /** @property context - @brief The opaque value used by the client to maintain context info between the authentication - request and the IDP callback. - */ + /// The opaque value used by the client to maintain context info between the authentication + /// request and the IDP callback. var context: String? - /** @property verifiedProvider - @brief When action is 'map', contains the idps which can be used for confirmation. - */ + /// When action is 'map', contains the idps which can be used for confirmation. var verifiedProvider: [String]? - /** @property needConfirmation - @brief Whether the assertion is from a non-trusted IDP and need account linking confirmation. - */ + /// Whether the assertion is from a non-trusted IDP and need account linking confirmation. var needConfirmation: Bool = false - /** @property emailRecycled - @brief It's true if the email is recycled. - */ + /// It's true if the email is recycled. var emailRecycled: Bool = false - /** @property emailVerified - @brief The value is true if the IDP is also the email provider. It means the user owns the - email. - */ + /// The value is true if the IDP is also the email provider. It means the user owns the email. var emailVerified: Bool = false - /** @property isNewUser - @brief Flag indicating that the user signing in is a new user and not a returning user. - */ + /// Flag indicating that the user signing in is a new user and not a returning user. var isNewUser: Bool = false - /** @property profile - @brief Dictionary containing the additional IdP specific information. - */ + /// Dictionary containing the additional IdP specific information. var profile: [String: Any]? - /** @property username - @brief The name of the user. - */ + /// The name of the user. var username: String? - /** @property oauthIDToken - @brief The ID token for the OpenID OAuth extension. - */ + /// The ID token for the OpenID OAuth extension. var oauthIDToken: String? - /** @property oauthExpirationDate - @brief The approximate expiration date of the oauth access token. - */ + /// The approximate expiration date of the oauth access token. var oauthExpirationDate: Date? - /** @property oauthAccessToken - @brief The access token for the OpenID OAuth extension. - */ + /// The access token for the OpenID OAuth extension. var oauthAccessToken: String? - /** @property oauthSecretToken - @brief The secret for the OpenID OAuth extention. - */ + /// The secret for the OpenID OAuth extention. var oauthSecretToken: String? - /** @property pendingToken - @brief The pending ID Token string. - */ + /// The pending ID Token string. var pendingToken: String? // MARK: - AuthMFAResponse diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyCustomTokenRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyCustomTokenRequest.swift index e23143c1026..af1518ee653 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyCustomTokenRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyCustomTokenRequest.swift @@ -14,24 +14,16 @@ import Foundation -/** @var kVerifyCustomTokenEndpoint - @brief The "verifyPassword" endpoint. - */ +/// The "verifyPassword" endpoint. private let kVerifyCustomTokenEndpoint = "verifyCustomToken" -/** @var kTokenKey - @brief The key for the "token" value in the request. - */ +/// The key for the "token" value in the request. private let kTokenKey = "token" -/** @var kReturnSecureTokenKey - @brief The key for the "returnSecureToken" value in the request. - */ +/// The key for the "returnSecureToken" value in the request. private let kReturnSecureTokenKey = "returnSecureToken" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. private let kTenantIDKey = "tenantId" @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyCustomTokenResponse.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyCustomTokenResponse.swift index a309707b325..74053b5f3b5 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyCustomTokenResponse.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyCustomTokenResponse.swift @@ -14,32 +14,22 @@ import Foundation -/** @class FIRVerifyCustomTokenResponse - @brief Represents the response from the verifyCustomToken endpoint. - */ +/// Represents the response from the verifyCustomToken endpoint. class VerifyCustomTokenResponse: AuthRPCResponse { required init() {} - /** @property idToken - @brief Either an authorization code suitable for performing an STS token exchange, or the - access token from Secure Token Service, depending on whether @c returnSecureToken is set - on the request. - */ + /// Either an authorization code suitable for performing an STS token exchange, or the + /// access token from Secure Token Service, depending on whether `returnSecureToken` is set + /// on the request. var idToken: String? - /** @property approximateExpirationDate - @brief The approximate expiration date of the access token. - */ + /// The approximate expiration date of the access token. var approximateExpirationDate: Date? - /** @property refreshToken - @brief The refresh token from Secure Token Service. - */ + /// The refresh token from Secure Token Service. var refreshToken: String? - /** @property isNewUser - @brief Flag indicating that the user signing in is a new user and not a returning user. - */ + /// Flag indicating that the user signing in is a new user and not a returning user. var isNewUser: Bool = false func setFields(dictionary: [String: AnyHashable]) throws { diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPasswordRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPasswordRequest.swift index de351d79c67..7a95848c985 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPasswordRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPasswordRequest.swift @@ -14,105 +14,68 @@ import Foundation -/** @var kVerifyPasswordEndpoint - @brief The "verifyPassword" endpoint. - */ +/// The "verifyPassword" endpoint. private let kVerifyPasswordEndpoint = "verifyPassword" -/** @var kEmailKey - @brief The key for the "email" value in the request. - */ +/// The key for the "email" value in the request. private let kEmailKey = "email" -/** @var kPasswordKey - @brief The key for the "password" value in the request. - */ +/// The key for the "password" value in the request. private let kPasswordKey = "password" -/** @var kPendingIDTokenKey - @brief The key for the "pendingIdToken" value in the request. - */ +/// The key for the "pendingIdToken" value in the request. private let kPendingIDTokenKey = "pendingIdToken" -/** @var kCaptchaChallengeKey - @brief The key for the "captchaChallenge" value in the request. - */ +/// The key for the "captchaChallenge" value in the request. private let kCaptchaChallengeKey = "captchaChallenge" -/** @var kCaptchaResponseKey - @brief The key for the "captchaResponse" value in the request. - */ +/// The key for the "captchaResponse" value in the request. private let kCaptchaResponseKey = "captchaResponse" -/** @var kClientType - @brief The key for the "clientType" value in the request. - */ +/// The key for the "clientType" value in the request. private let kClientType = "clientType" -/** @var kRecaptchaVersion - @brief The key for the "recaptchaVersion" value in the request. - */ +/// The key for the "recaptchaVersion" value in the request. private let kRecaptchaVersion = "recaptchaVersion" -/** @var kReturnSecureTokenKey - @brief The key for the "returnSecureToken" value in the request. - */ +/// The key for the "returnSecureToken" value in the request. private let kReturnSecureTokenKey = "returnSecureToken" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. private let kTenantIDKey = "tenantId" -/** @class FIRVerifyPasswordRequest - @brief Represents the parameters for the verifyPassword endpoint. - @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/verifyPassword - */ +/// Represents the parameters for the verifyPassword endpoint. +/// See https: // developers.google.com/identity/toolkit/web/reference/relyingparty/verifyPassword @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class VerifyPasswordRequest: IdentityToolkitRequest, AuthRPCRequest { typealias Response = VerifyPasswordResponse - /** @property email - @brief The email of the user. - */ + /// The email of the user. private(set) var email: String - /** @property password - @brief The password inputed by the user. - */ + /// The password inputed by the user. private(set) var password: String - /** @property pendingIDToken - @brief The GITKit token for the non-trusted IDP, which is to be confirmed by the user. - */ + /// The GITKit token for the non-trusted IDP, which is to be confirmed by the user. var pendingIDToken: String? - /** @property captchaChallenge - @brief The captcha challenge. - */ + /// The captcha challenge. var captchaChallenge: String? - /** @property captchaResponse - @brief Response to the captcha. - */ + /// Response to the captcha. var captchaResponse: String? - /** @property captchaResponse - @brief The reCAPTCHA version. - */ + /// The reCAPTCHA version. var recaptchaVersion: String? - /** @property returnSecureToken - @brief Whether the response should return access token and refresh token directly. - @remarks The default value is @c YES . - */ - private(set) var returnSecureToken: Bool + /// Whether the response should return access token and refresh token directly. + /// The default value is `true`. + private(set) var returnSecureToken: Bool = true init(email: String, password: String, requestConfiguration: AuthRequestConfiguration) { self.email = email self.password = password - returnSecureToken = true super.init(endpoint: kVerifyPasswordEndpoint, requestConfiguration: requestConfiguration) } diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPasswordResponse.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPasswordResponse.swift index 8a5e03262c6..7735450ed76 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPasswordResponse.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPasswordResponse.swift @@ -14,52 +14,37 @@ import Foundation -/** @class FIRVerifyPasswordResponse - @brief Represents the response from the verifyPassword endpoint. - @remarks Possible error codes: - - FIRAuthInternalErrorCodeUserDisabled - - FIRAuthInternalErrorCodeEmailNotFound - @see https://developers.google.com/identity/toolkit/web/reference/relyingparty/verifyPassword - */ +/// Represents the response from the verifyPassword endpoint. +/// +/// Possible error codes: +/// * FIRAuthInternalErrorCodeUserDisabled +/// * FIRAuthInternalErrorCodeEmailNotFound +/// +/// See https: // developers.google.com/identity/toolkit/web/reference/relyingparty/verifyPassword class VerifyPasswordResponse: AuthRPCResponse, AuthMFAResponse { required init() {} - /** @property localID - @brief The RP local ID if it's already been mapped to the IdP account identified by the - federated ID. - */ + /// The RP local ID if it's already been mapped to the IdP account identified by the federated ID. var localID: String? - /** @property email - @brief The email returned by the IdP. NOTE: The federated login user may not own the email. - */ + /// The email returned by the IdP. NOTE: The federated login user may not own the email. var email: String? - /** @property displayName - @brief The display name of the user. - */ + /// The display name of the user. var displayName: String? - /** @property IDToken - @brief Either an authorization code suitable for performing an STS token exchange, or the - access token from Secure Token Service, depending on whether @c returnSecureToken is set - on the request. - */ + /// Either an authorization code suitable for performing an STS token exchange, or the + /// access token from Secure Token Service, depending on whether `returnSecureToken` is set + /// on the request. private(set) var idToken: String? - /** @property approximateExpirationDate - @brief The approximate expiration date of the access token. - */ + /// The approximate expiration date of the access token. var approximateExpirationDate: Date? - /** @property refreshToken - @brief The refresh token from Secure Token Service. - */ + /// The refresh token from Secure Token Service. var refreshToken: String? - /** @property photoURL - @brief The URI of the accessible profile picture. - */ + /// The URI of the accessible profile picture. var photoURL: URL? // MARK: - AuthMFAResponse diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPhoneNumberRequest.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPhoneNumberRequest.swift index 93389e654b3..2fb0b183709 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPhoneNumberRequest.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPhoneNumberRequest.swift @@ -14,53 +14,32 @@ import Foundation -/** @var kVerifyPhoneNumberEndPoint - @brief The "verifyPhoneNumber" endpoint. - */ +/// The "verifyPhoneNumber" endpoint. private let kVerifyPhoneNumberEndPoint = "verifyPhoneNumber" -/** @var kVerificationIDKey - @brief The key for the verification ID parameter in the request. - */ +/// The key for the verification ID parameter in the request. private let kVerificationIDKey = "sessionInfo" -/** @var kVerificationCodeKey - @brief The key for the verification code parameter in the request. - */ +/// The key for the verification code parameter in the request. private let kVerificationCodeKey = "code" -/** @var kIDTokenKey - @brief The key for the "ID Token" value in the request. - */ +/// The key for the "ID Token" value in the request. private let kIDTokenKey = "idToken" -/** @var kTemporaryProofKey - @brief The key for the temporary proof value in the request. - */ +/// The key for the temporary proof value in the request. private let kTemporaryProofKey = "temporaryProof" -/** @var kPhoneNumberKey - @brief The key for the phone number value in the request. - */ +/// The key for the phone number value in the request. private let kPhoneNumberKey = "phoneNumber" -/** @var kOperationKey - @brief The key for the operation value in the request. - */ +/// The key for the operation value in the request. private let kOperationKey = "operation" -/** @var kTenantIDKey - @brief The key for the tenant id value in the request. - */ +/// The key for the tenant id value in the request. private let kTenantIDKey = "tenantId" extension AuthOperationType { - /** @fn FIRAuthOperationString - @brief Returns a string object corresponding to the provided FIRAuthOperationType value. - @param operationType The value of the FIRAuthOperationType enum which will be translated to its - corresponding string value. - @return The string value corresponding to the FIRAuthOperationType argument. - */ + /// - Returns: The string value corresponding to the AuthOperationType. var operationString: String { switch self { case .unspecified: @@ -81,43 +60,30 @@ extension AuthOperationType { class VerifyPhoneNumberRequest: IdentityToolkitRequest, AuthRPCRequest { typealias Response = VerifyPhoneNumberResponse - /** @property verificationID - @brief The verification ID obtained from the response of @c sendVerificationCode. - */ + /// The verification ID obtained from the response of `sendVerificationCode`. var verificationID: String? - /** @property verificationCode - @brief The verification code provided by the user. - */ + /// The verification code provided by the user. var verificationCode: String? - /** @property accessToken - @brief The STS Access Token for the authenticated user. - */ + /// The STS Access Token for the authenticated user. var accessToken: String? - /** @var temporaryProof - @brief The temporary proof code, previously returned from the backend. - */ + /// The temporary proof code, previously returned from the backend. var temporaryProof: String? - /** @var phoneNumber - @brief The phone number to be verified in the request. - */ + /// The phone number to be verified in the request. var phoneNumber: String? - /** @var operation - @brief The type of operation triggering this verify phone number request. - */ + /// The type of operation triggering this verify phone number request. var operation: AuthOperationType - /** @fn initWithTemporaryProof:phoneNumberAPIKey - @brief Designated initializer. - @param temporaryProof The temporary proof sent by the backed. - @param phoneNumber The phone number associated with the credential to be signed in. - @param operation Indicates what operation triggered the verify phone number request. - @param requestConfiguration An object containing configurations to be added to the request. - */ + /// Designated initializer. + /// - Parameter temporaryProof: The temporary proof sent by the backed. + /// - Parameter phoneNumber: The phone number associated with the credential to be signed in . + /// - Parameter operation: Indicates what operation triggered the verify phone number request. + /// - Parameter requestConfiguration: An object containing configurations to be added to the + /// request. init(temporaryProof: String, phoneNumber: String, operation: AuthOperationType, requestConfiguration: AuthRequestConfiguration) { self.temporaryProof = temporaryProof @@ -126,13 +92,13 @@ class VerifyPhoneNumberRequest: IdentityToolkitRequest, AuthRPCRequest { super.init(endpoint: kVerifyPhoneNumberEndPoint, requestConfiguration: requestConfiguration) } - /** @fn initWithVerificationID:verificationCode:requestConfiguration - @brief Designated initializer. - @param verificationID The verification ID obtained from the response of @c sendVerificationCode. - @param verificationCode The verification code provided by the user. - @param operation Indicates what operation triggered the verify phone number request. - @param requestConfiguration An object containing configurations to be added to the request. - */ + /// Designated initializer. + /// - Parameter verificationID: The verification ID obtained from the response of + /// `sendVerificationCode`. + /// - Parameter verificationCode: The verification code provided by the user. + /// - Parameter operation: Indicates what operation triggered the verify phone number request. + /// - Parameter requestConfiguration: An object containing configurations to be added to the + /// request. init(verificationID: String, verificationCode: String, operation: AuthOperationType, diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPhoneNumberResponse.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPhoneNumberResponse.swift index 9ac4821ed37..82325a25fbe 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPhoneNumberResponse.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPhoneNumberResponse.swift @@ -17,42 +17,27 @@ import Foundation class VerifyPhoneNumberResponse: AuthRPCResponse { required init() {} - /** @property IDToken - @brief Either an authorization code suitable for performing an STS token exchange, or the - access token from Secure Token Service, depending on whether @c returnSecureToken is set - on the request. - */ + /// Either an authorization code suitable for performing an STS token exchange, or the + /// access token from Secure Token Service, depending on whether `returnSecureToken` is set + /// on the request. var idToken: String? - /** @property refreshToken - @brief The refresh token from Secure Token Service. - */ + /// The refresh token from Secure Token Service. var refreshToken: String? - /** @property localID - @brief The Firebase Auth user ID. - */ + /// The Firebase Auth user ID. var localID: String? - /** @property phoneNumber - @brief The verified phone number. - */ + /// The verified phone number. var phoneNumber: String? - /** @property temporaryProof - @brief The temporary proof code returned by the backend. - */ + /// The temporary proof code returned by the backend. var temporaryProof: String? - /** @property isNewUser - @brief Flag indicating that the user signing in is a new user and not a returning user. - */ - + /// Flag indicating that the user signing in is a new user and not a returning user. var isNewUser: Bool = false - /** @property approximateExpirationDate - @brief The approximate expiration date of the access token. - */ + /// The approximate expiration date of the access token. var approximateExpirationDate: Date? // XXX TODO(ObjC): What might this be? diff --git a/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactor.swift b/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactor.swift index dce862d2ed0..8b6cd0b0512 100644 --- a/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactor.swift +++ b/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactor.swift @@ -18,20 +18,20 @@ import Foundation @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) extension MultiFactor: NSSecureCoding {} - /** @class FIRMultiFactor - @brief The interface defining the multi factor related properties and operations pertaining to a - user. - This class is available on iOS only. - */ + + /// The interface defining the multi factor related properties and operations pertaining to a + /// user. + /// + /// This class is available on iOS only. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRMultiFactor) open class MultiFactor: NSObject { @objc open var enrolledFactors: [MultiFactorInfo] - /** @fn getSessionWithCompletion: - @brief Get a session for a second factor enrollment operation. - @param completion A block with the session identifier for a second factor enrollment operation. - This is used to identify the current user trying to enroll a second factor. - */ + /// Get a session for a second factor enrollment operation. + /// + /// This is used to identify the current user trying to enroll a second factor. + /// - Parameter completion: A block with the session identifier for a second factor enrollment + /// operation. @objc(getSessionWithCompletion:) open func getSessionWithCompletion(_ completion: ((MultiFactorSession?, Error?) -> Void)?) { let session = MultiFactorSession.sessionForCurrentUser @@ -40,11 +40,9 @@ import Foundation } } - /** @fn getSessionWithCompletion: - @brief Get a session for a second factor enrollment operation. - @param completion A block with the session identifier for a second factor enrollment operation. - This is used to identify the current user trying to enroll a second factor. - */ + /// Get a session for a second factor enrollment operation. + /// + /// This is used to identify the current user trying to enroll a second factor. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func session() async throws -> MultiFactorSession { return try await withCheckedThrowingContinuation { continuation in @@ -58,12 +56,12 @@ import Foundation } } - /** @fn enrollWithAssertion:displayName:completion: - @brief Enrolls a second factor as identified by the `MultiFactorAssertion` parameter for the - current user. - @param displayName An optional display name associated with the multi factor to enroll. - @param completion The block invoked when the request is complete, or fails. - */ + /// Enrolls a second factor as identified by the `MultiFactorAssertion` parameter for the + /// current user. + /// - Parameter assertion: The `MultiFactorAssertion`. + /// - Parameter displayName: An optional display name associated with the multi factor to + /// enroll. + /// - Parameter completion: The block invoked when the request is complete, or fails. @objc(enrollWithAssertion:displayName:completion:) open func enroll(with assertion: MultiFactorAssertion, displayName: String?, @@ -168,12 +166,12 @@ import Foundation } } - /** @fn enrollWithAssertion:displayName:completion: - @brief Enrolls a second factor as identified by the `MultiFactorAssertion` parameter for the - current user. - @param displayName An optional display name associated with the multi factor to enroll. - @param completion The block invoked when the request is complete, or fails. - */ + /// Enrolls a second factor as identified by the `MultiFactorAssertion` parameter for the + /// current user. + /// - Parameter assertion: The `MultiFactorAssertion`. + /// - Parameter displayName: An optional display name associated with the multi factor to + /// enroll. + /// - Parameter completion: The block invoked when the request is complete, or fails. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func enroll(with assertion: MultiFactorAssertion, displayName: String?) async throws { return try await withCheckedThrowingContinuation { continuation in @@ -187,32 +185,24 @@ import Foundation } } - /** @fn unenrollWithInfo:completion: - @brief Unenroll the given multi factor. - @param completion The block invoked when the request to send the verification email is complete, - or fails. - */ + /// Unenroll the given multi factor. + /// - Parameter completion: The block invoked when the request to send the verification email is + /// complete, or fails. @objc(unenrollWithInfo:completion:) open func unenroll(with factorInfo: MultiFactorInfo, completion: ((Error?) -> Void)?) { unenroll(withFactorUID: factorInfo.uid, completion: completion) } - /** @fn unenrollWithInfo:completion: - @brief Unenroll the given multi factor. - @param completion The block invoked when the request to send the verification email is complete, - or fails. - */ + /// Unenroll the given multi factor. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func unenroll(with factorInfo: MultiFactorInfo) async throws { try await unenroll(withFactorUID: factorInfo.uid) } - /** @fn unenrollWithFactorUID:completion: - @brief Unenroll the given multi factor. - @param completion The block invoked when the request to send the verification email is complete, - or fails. - */ + /// Unenroll the given multi factor. + /// - Parameter completion: The block invoked when the request to send the verification email is + /// complete, or fails. @objc(unenrollWithFactorUID:completion:) open func unenroll(withFactorUID factorUID: String, completion: ((Error?) -> Void)?) { @@ -252,6 +242,7 @@ import Foundation } } + /// Unenroll the given multi factor. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func unenroll(withFactorUID factorUID: String) async throws { return try await withCheckedThrowingContinuation { continuation in diff --git a/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactorAssertion.swift b/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactorAssertion.swift index 1c313b3a18c..ff3edc94dd0 100644 --- a/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactorAssertion.swift +++ b/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactorAssertion.swift @@ -16,15 +16,12 @@ import Foundation #if os(iOS) - /** @class FIRMultiFactorAssertion - @brief The base class for asserting ownership of a second factor. This is equivalent to the - AuthCredential class. - This class is available on iOS only. - */ + /// The base class for asserting ownership of a second factor. This is equivalent to the + /// AuthCredential class. + /// + /// This class is available on iOS only. @objc(FIRMultiFactorAssertion) open class MultiFactorAssertion: NSObject { - /** - @brief The second factor identifier for this opaque object asserting a second factor. - */ + /// The second factor identifier for this opaque object asserting a second factor. @objc open var factorID: String init(factorID: String) { diff --git a/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactorInfo.swift b/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactorInfo.swift index 60d51cbb5dd..2b19b4963f0 100644 --- a/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactorInfo.swift +++ b/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactorInfo.swift @@ -17,29 +17,20 @@ import Foundation #if os(iOS) extension MultiFactorInfo: NSSecureCoding {} - /** @class FIRMultiFactorInfo - @brief Safe public structure used to represent a second factor entity from a client perspective. - This class is available on iOS only. - */ + /// Safe public structure used to represent a second factor entity from a client perspective. + /// + /// This class is available on iOS only. @objc(FIRMultiFactorInfo) open class MultiFactorInfo: NSObject { - /** - @brief The multi-factor enrollment ID. - */ + /// The multi-factor enrollment ID. @objc(UID) public let uid: String - /** - @brief The user friendly name of the current second factor. - */ + /// The user friendly name of the current second factor. @objc public let displayName: String? - /** - @brief The second factor enrollment date. - */ + /// The second factor enrollment date. @objc public let enrollmentDate: Date - /** - @brief The identifier of the second factor. - */ + /// The identifier of the second factor. @objc public let factorID: String init(proto: AuthProtoMFAEnrollment, factorID: String) { diff --git a/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactorResolver.swift b/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactorResolver.swift index fd0eef4c8d9..a9936928fec 100644 --- a/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactorResolver.swift +++ b/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactorResolver.swift @@ -15,36 +15,28 @@ import Foundation #if os(iOS) - /** @class FIRPhoneMultiFactorAssertion - @brief The subclass of base class FIRMultiFactorAssertion, used to assert ownership of a phone - second factor. - This class is available on iOS only. - */ + + /// The subclass of base class `MultiFactorAssertion`, used to assert ownership of a phone + /// second factor. + /// + /// This class is available on iOS only. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRMultiFactorResolver) open class MultiFactorResolver: NSObject { - /** - @brief The opaque session identifier for the current sign-in flow. - */ + /// The opaque session identifier for the current sign-in flow. @objc public let session: MultiFactorSession - /** - @brief The list of hints for the second factors needed to complete the sign-in for the current - session. - */ + /// The list of hints for the second factors needed to complete the sign-in for the current + /// session. @objc public let hints: [MultiFactorInfo] - /** - @brief The Auth reference for the current FIRMultiResolver. - */ + /// The Auth reference for the current `MultiResolver`. @objc public let auth: Auth - /** @fn resolveSignInWithAssertion:completion: - @brief A helper function to help users complete sign in with a second factor using an - FIRMultiFactorAssertion confirming the user successfully completed the second factor - challenge. - @param completion The block invoked when the request is complete, or fails. - */ + /// A helper function to help users complete sign in with a second factor using a + /// `MultiFactorAssertion` confirming the user successfully completed the second factor + /// challenge. + /// - Parameter completion: The block invoked when the request is complete, or fails. @objc(resolveSignInWithAssertion:completion:) open func resolveSignIn(with assertion: MultiFactorAssertion, completion: ((AuthDataResult?, Error?) -> Void)? = nil) { @@ -97,12 +89,9 @@ import Foundation } } - /** @fn resolveSignInWithAssertion:completion: - @brief A helper function to help users complete sign in with a second factor using an - FIRMultiFactorAssertion confirming the user successfully completed the second factor - challenge. - @param completion The block invoked when the request is complete, or fails. - */ + /// A helper function to help users complete sign in with a second factor using a + /// `MultiFactorAssertion` confirming the user successfully completed the second factor + /// challenge. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func resolveSignIn(with assertion: MultiFactorAssertion) async throws -> AuthDataResult { return try await withCheckedThrowingContinuation { continuation in diff --git a/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactorSession.swift b/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactorSession.swift index c1b8979f76e..cc83e3f2f0d 100644 --- a/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactorSession.swift +++ b/FirebaseAuth/Sources/Swift/MultiFactor/MultiFactorSession.swift @@ -15,38 +15,31 @@ import Foundation #if os(iOS) - /** @class FIRMultiFactorSession - @brief Opaque object that identifies the current session to enroll a second factor or to - complete sign in when previously enrolled. Identifies the current session to enroll a second factor or to complete sign in when - previously enrolled. It contains additional context on the existing user, notably the confirmation - that the user passed the first factor challenge. - This class is available on iOS only. - */ + + /// Opaque object that identifies the current session to enroll a second factor or to + /// complete sign in when previously enrolled. + /// + /// Identifies the current session to enroll a second factor + /// or to complete sign in when previously enrolled. It contains additional context on the + /// existing user, notably the confirmation that the user passed the first factor challenge. + /// + /// This class is available on iOS only. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRMultiFactorSession) open class MultiFactorSession: NSObject { - /** - @brief The ID token for an enroll flow. This has to be retrieved after recent authentication. - */ + /// The ID token for an enroll flow. This has to be retrieved after recent authentication. var idToken: String? - /** - @brief The pending credential after an enrolled second factor user signs in successfully with the - first factor - */ + /// The pending credential after an enrolled second factor user signs in successfully with the + /// first factor. var mfaPendingCredential: String? - /** - @brief Multi factor info for the current user. - */ + /// Multi factor info for the current user. var multiFactorInfo: MultiFactorInfo? - /** - @brief Current user object - */ + /// Current user object. var currentUser: User? class var sessionForCurrentUser: MultiFactorSession { - // TODO: Fix for the right Auth instance. (broken in ObjC) guard let currentUser = Auth.auth().currentUser else { fatalError("Internal Auth Error: missing user for multifactor auth") } diff --git a/FirebaseAuth/Sources/Swift/MultiFactor/Phone/PhoneMultiFactorAssertion.swift b/FirebaseAuth/Sources/Swift/MultiFactor/Phone/PhoneMultiFactorAssertion.swift index 7271bb1a7ff..999809e4bd3 100644 --- a/FirebaseAuth/Sources/Swift/MultiFactor/Phone/PhoneMultiFactorAssertion.swift +++ b/FirebaseAuth/Sources/Swift/MultiFactor/Phone/PhoneMultiFactorAssertion.swift @@ -16,11 +16,10 @@ import Foundation #if os(iOS) - /** @class FIRPhoneMultiFactorAssertion - @brief The subclass of base class FIRMultiFactorAssertion, used to assert ownership of a phone - second factor. - This class is available on iOS only. - */ + /// The subclass of base class FIRMultiFactorAssertion, used to assert ownership of a phone + /// second factor. + /// + /// This class is available on iOS only. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRPhoneMultiFactorAssertion) open class PhoneMultiFactorAssertion: MultiFactorAssertion { var authCredential: PhoneAuthCredential? diff --git a/FirebaseAuth/Sources/Swift/MultiFactor/Phone/PhoneMultiFactorGenerator.swift b/FirebaseAuth/Sources/Swift/MultiFactor/Phone/PhoneMultiFactorGenerator.swift index 9370402de5d..cd213c14196 100644 --- a/FirebaseAuth/Sources/Swift/MultiFactor/Phone/PhoneMultiFactorGenerator.swift +++ b/FirebaseAuth/Sources/Swift/MultiFactor/Phone/PhoneMultiFactorGenerator.swift @@ -16,20 +16,19 @@ import Foundation #if os(iOS) - /** @class FIRPhoneMultiFactorGenerator - @brief The data structure used to help initialize an assertion for a second factor entity to the - Firebase Auth/CICP server. Depending on the type of second factor, this will help generate - the assertion. - This class is available on iOS only. - */ + /// The data structure used to help initialize an assertion for a second factor entity to the + /// Firebase Auth/CICP server. + /// + /// Depending on the type of second factor, this will help generate the assertion. + /// + /// This class is available on iOS only. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRPhoneMultiFactorGenerator) open class PhoneMultiFactorGenerator: NSObject { - /** @fn assertionWithCredential: - @brief Initializes the MFA assertion to confirm ownership of the phone second factor. Note that - this API is used for both enrolling and signing in with a phone second factor. - @param phoneAuthCredential The phone auth credential used for multi factor flows. - */ + /// Initializes the MFA assertion to confirm ownership of the phone second factor. + /// + /// Note that this API is used for both enrolling and signing in with a phone second factor. + /// - Parameter phoneAuthCredential: The phone auth credential used for multi factor flows. @objc(assertionWithCredential:) open class func assertion(with phoneAuthCredential: PhoneAuthCredential) -> PhoneMultiFactorAssertion { diff --git a/FirebaseAuth/Sources/Swift/MultiFactor/Phone/PhoneMultiFactorInfo.swift b/FirebaseAuth/Sources/Swift/MultiFactor/Phone/PhoneMultiFactorInfo.swift index 35be568d8a8..58e5fc5fb8b 100644 --- a/FirebaseAuth/Sources/Swift/MultiFactor/Phone/PhoneMultiFactorInfo.swift +++ b/FirebaseAuth/Sources/Swift/MultiFactor/Phone/PhoneMultiFactorInfo.swift @@ -16,27 +16,19 @@ import Foundation #if os(iOS) - /** @class FIRPhoneMultiFactorInfo - @brief Extends the MultiFactorInfo class for phone number second factors. - The identifier of this second factor is "phone". - This class is available on iOS only. - */ + /// Extends the MultiFactorInfo class for phone number second factors. + /// + /// The identifier of this second factor is "phone". + /// + /// This class is available on iOS only. @objc(FIRPhoneMultiFactorInfo) open class PhoneMultiFactorInfo: MultiFactorInfo { - /** - @brief The string identifier for using phone as a second factor. - This constant is available on iOS only. - */ + /// The string identifier for using phone as a second factor. @objc(FIRPhoneMultiFactorID) public static let PhoneMultiFactorID = "phone" - /** - @brief The string identifier for using TOTP as a second factor. - This constant is available on iOS only. - */ + /// The string identifier for using TOTP as a second factor. @objc(FIRTOTPMultiFactorID) public static let TOTPMultiFactorID = "totp" - /** - @brief This is the phone number associated with the current second factor. - */ + /// This is the phone number associated with the current second factor. @objc open var phoneNumber: String init(proto: AuthProtoMFAEnrollment) { diff --git a/FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPMultFactorAssertion.swift b/FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPMultFactorAssertion.swift index a11eed8074d..b5b1c43f3d6 100644 --- a/FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPMultFactorAssertion.swift +++ b/FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPMultFactorAssertion.swift @@ -21,11 +21,10 @@ import Foundation case enrollmentID(String) } - /** @class FIRTOTPMultiFactorAssertion - @brief The subclass of base class MultiFactorAssertion, used to assert ownership of a TOTP - (Time-based One Time Password) second factor. - This class is available on iOS only. - */ + /// The subclass of base class MultiFactorAssertion, used to assert ownership of a TOTP + /// (Time-based One Time Password) second factor. + /// + /// This class is available on iOS only. @objc(FIRTOTPMultiFactorAssertion) open class TOTPMultiFactorAssertion: MultiFactorAssertion { let oneTimePassword: String let secretOrID: SecretOrID diff --git a/FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPMultiFactorGenerator.swift b/FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPMultiFactorGenerator.swift index 970eb3b1881..4fc574caedb 100644 --- a/FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPMultiFactorGenerator.swift +++ b/FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPMultiFactorGenerator.swift @@ -15,23 +15,19 @@ import Foundation #if os(iOS) - /** - @class TOTPMultiFactorGenerator - @brief The data structure used to help initialize an assertion for a second factor entity to the - Firebase Auth/CICP server. Depending on the type of second factor, this will help generate - the assertion. - This class is available on iOS only. - */ + + /// The data structure used to help initialize an assertion for a second factor entity to the + /// Firebase Auth/CICP server. Depending on the type of second factor, this will help generate + /// the assertion. + /// + /// This class is available on iOS only. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRTOTPMultiFactorGenerator) open class TOTPMultiFactorGenerator: NSObject { - /** - @fn generateSecretWithMultiFactorSession - @brief Creates a TOTP secret as part of enrolling a TOTP second factor. Used for generating a - QR code URL or inputting into a TOTP app. This method uses the auth instance corresponding to the - user in the multiFactorSession. - @param session The multiFactorSession instance. - @param completion Completion block - */ + /// Creates a TOTP secret as part of enrolling a TOTP second factor. Used for generating a + /// QR code URL or inputting into a TOTP app. This method uses the auth instance corresponding + /// to the user in the multiFactorSession. + /// - Parameter session: The multiFactorSession instance. + /// - Parameter completion: Completion block @objc(generateSecretWithMultiFactorSession:completion:) open class func generateSecret(with session: MultiFactorSession, completion: @escaping (TOTPSecret?, Error?) -> Void) { @@ -71,9 +67,14 @@ import Foundation } } + /// Creates a TOTP secret as part of enrolling a TOTP second factor. + /// + /// Used for generating a QR code URL or inputting into a TOTP app. This + /// method uses the auth instance correspondingto the user in the multiFactorSession. + /// - Parameter session: The multiFactorSession instance. + /// - Returns: The TOTP secret. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) - open class func generateSecret(with session: MultiFactorSession) async throws - -> TOTPSecret { + open class func generateSecret(with session: MultiFactorSession) async throws -> TOTPSecret { return try await withCheckedThrowingContinuation { continuation in self.generateSecret(with: session) { secret, error in if let secret { @@ -85,13 +86,12 @@ import Foundation } } - /** - @fn assertionForEnrollmentWithSecret: - @brief Initializes the MFA assertion to confirm ownership of the TOTP second factor. This assertion - is used to complete enrollment of TOTP as a second factor. - @param secret The TOTP secret. - @param oneTimePassword one time password string. - */ + /// Initializes the MFA assertion to confirm ownership of the TOTP second factor. + /// + /// This assertion is used to complete enrollment of TOTP as a second factor. + /// - Parameter secret: The TOTP secret. + /// - Parameter oneTimePassword: One time password string. + /// - Returns: The MFA assertion. @objc(assertionForEnrollmentWithSecret:oneTimePassword:) open class func assertionForEnrollment(with secret: TOTPSecret, oneTimePassword: String) -> TOTPMultiFactorAssertion { @@ -99,13 +99,12 @@ import Foundation oneTimePassword: oneTimePassword) } - /** - @fn assertionForSignInWithenrollmentID: - @brief Initializes the MFA assertion to confirm ownership of the TOTP second factor. This - assertion is used to complete signIn with TOTP as a second factor. - @param enrollmentID The ID that identifies the enrolled TOTP second factor. - @param oneTimePassword one time password string. - */ + /// Initializes the MFA assertion to confirm ownership of the TOTP second factor. + /// + /// This assertion is used to complete signIn with TOTP as a second factor. + /// - Parameter enrollmentID: The ID that identifies the enrolled TOTP second factor. + /// - Parameter oneTimePassword: one time password string. + /// - Returns: The MFA assertion. @objc(assertionForSignInWithEnrollmentID:oneTimePassword:) open class func assertionForSignIn(withEnrollmentID enrollmentID: String, oneTimePassword: String) -> TOTPMultiFactorAssertion { @@ -113,5 +112,4 @@ import Foundation oneTimePassword: oneTimePassword) } } - #endif diff --git a/FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPMultiFactorInfo.swift b/FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPMultiFactorInfo.swift index 7cc3f01ae1c..2273b2aea9e 100644 --- a/FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPMultiFactorInfo.swift +++ b/FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPMultiFactorInfo.swift @@ -16,23 +16,17 @@ import Foundation #if os(iOS) - /** - @class FIRTotpMultiFactorInfo - @brief Extends the MultiFactorInfo class for time based one-time password second factors. - The identifier of this second factor is "totp". - This class is available on iOS only. - */ + /// Extends the MultiFactorInfo class for time based one-time password second factors. + /// + /// The identifier of this second factor is "totp". + /// + /// This class is available on iOS only. class TOTPMultiFactorInfo: MultiFactorInfo { - /** - @brief This is the totp info for the second factor. - */ + /// This is the totp info for the second factor. let totpInfo: NSObject? - /** - @fn initWithProto: - @brief Initilize the FIRAuthProtoMFAEnrollment instance with proto. - @param proto FIRAuthProtoMFAEnrollment proto object. - */ + /// Initialize the AuthProtoMFAEnrollment instance with proto. + /// - Parameter proto: AuthProtoMFAEnrollment proto object. init(proto: AuthProtoMFAEnrollment) { totpInfo = proto.totpInfo super.init(proto: proto, factorID: PhoneMultiFactorInfo.TOTPMultiFactorID) @@ -43,5 +37,4 @@ import Foundation fatalError("init(coder:) has not been implemented") } } - #endif diff --git a/FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPSecret.swift b/FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPSecret.swift index b8d34281a79..5588539a89b 100644 --- a/FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPSecret.swift +++ b/FirebaseAuth/Sources/Swift/MultiFactor/TOTP/TOTPSecret.swift @@ -22,28 +22,24 @@ import Foundation #if os(iOS) import UIKit - /** @class FIRTOTPMultiFactorAssertion - @brief The subclass of base class MultiFactorAssertion, used to assert ownership of a TOTP - (Time-based One Time Password) second factor. - This class is available on iOS only. - */ + /// The subclass of base class MultiFactorAssertion, used to assert ownership of a TOTP + /// (Time-based One Time Password) second factor. + /// + /// This class is available on iOS only. @objc(FIRTOTPSecret) open class TOTPSecret: NSObject { - /** - @brief Returns the shared secret key/seed used to generate time-based one-time passwords. - */ + /// Returns the shared secret key/seed used to generate time-based one-time passwords. @objc open func sharedSecretKey() -> String { return secretKey } - /** - @brief Returns a QRCode URL as described in - https://github.com/google/google-authenticator/wiki/Key-Uri-Format - This can be displayed to the user as a QRCode to be scanned into a TOTP app like Google - Authenticator. - @param accountName the name of the account/app. - @param issuer issuer of the TOTP(likely the app name). - @returns A QRCode URL string. - */ + /// Returns a QRCode URL as described in + /// https://github.com/google/google-authenticator/wiki/Key-Uri-Format. + /// + /// This can be displayed to the user as a QRCode to be scanned into a TOTP app like Google + /// Authenticator. + /// - Parameter accountName: The name of the account/app. + /// - Parameter issuer: Issuer of the TOTP(likely the app name). + /// - Returns: A QRCode URL string. @objc(generateQRCodeURLWithAccountName:issuer:) open func generateQRCodeURL(withAccountName accountName: String, issuer: String) -> String { @@ -54,11 +50,10 @@ import Foundation "&algorithm=%\(hashingAlgorithm)&digits=\(codeLength)" } - /** - @brief Opens the specified QR Code URL in a password manager like iCloud Keychain. - * See more details here: - https://developer.apple.com/documentation/authenticationservices/securing_logins_with_icloud_keychain_verification_codes - */ + /// Opens the specified QR Code URL in a password manager like iCloud Keychain. + /// + /// See more details + /// [here](https://developer.apple.com/documentation/authenticationservices/securing_logins_with_icloud_keychain_verification_codes) @objc(openInOTPAppWithQRCodeURL:) open func openInOTPApp(withQRCodeURL qrCodeURL: String) { if GULAppEnvironmentUtil.isAppExtension() { @@ -82,35 +77,23 @@ import Foundation } } - /** - @brief Shared secret key/seed used for enrolling in TOTP MFA and generating OTPs. - */ + /// Shared secret key/seed used for enrolling in TOTP MFA and generating OTPs. private let secretKey: String - /** - @brief Hashing algorithm used. - */ + /// Hashing algorithm used. private let hashingAlgorithm: String? - /** - @brief Length of the one-time passwords to be generated. - */ + /// Length of the one-time passwords to be generated. private let codeLength: Int - /** - @brief The interval (in seconds) when the OTP codes should change. - */ + /// The interval (in seconds) when the OTP codes should change. private let codeIntervalSeconds: Int - /** - @brief The timestamp by which TOTP enrollment should be completed. This can be used by callers to - show a countdown of when to enter OTP code by. - */ + /// The timestamp by which TOTP enrollment should be completed. This can be used by callers to + /// show a countdown of when to enter OTP code by. private let enrollmentCompletionDeadline: Date? - /** - @brief Additional session information. - */ + /// Additional session information. let sessionInfo: String? init(secretKey: String, hashingAlgorithm: String?, codeLength: Int, codeIntervalSeconds: Int, diff --git a/FirebaseAuth/Sources/Swift/Storage/AuthKeychainServices.swift b/FirebaseAuth/Sources/Swift/Storage/AuthKeychainServices.swift index 785ea8b85e5..fcf24de126a 100644 --- a/FirebaseAuth/Sources/Swift/Storage/AuthKeychainServices.swift +++ b/FirebaseAuth/Sources/Swift/Storage/AuthKeychainServices.swift @@ -15,20 +15,15 @@ import FirebaseCoreExtension import Foundation -/** @var kAccountPrefix - @brief The prefix string for keychain item account attribute before the key. - @remarks A number "1" is encoded in the prefix in case we need to upgrade the scheme in future. - */ +/// The prefix string for keychain item account attribute before the key. +/// +/// A number "1" is encoded in the prefix in case we need to upgrade the scheme in future. private let kAccountPrefix = "firebase_auth_1_" -/** @class FIRAuthKeychain - @brief The utility class to manipulate data in iOS Keychain. - */ +/// The utility class to manipulate data in iOS Keychain. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) final class AuthKeychainServices { - /** @var _service - @brief The name of the keychain service. - */ + /// The name of the keychain service. let service: String let keychainStorage: AuthKeychainStorage @@ -41,11 +36,9 @@ final class AuthKeychainServices { keychainStorage = storage } - /** @fn getItemWithQuery:error: - @brief Get the item from keychain by given query. - @param query The query to query the keychain. - @return The item of the given query. `nil`` if not exist. - */ + /// Get the item from keychain by given query. + /// - Parameter query: The query to query the keychain. + /// - Returns: The item of the given query. `nil` if it doesn't exist. func getItem(query: [String: Any]) throws -> Data? { var mutableQuery = query mutableQuery[kSecReturnData as String] = true @@ -71,12 +64,10 @@ final class AuthKeychainServices { } } - /** @fn setItem:withQuery:error: - @brief Set the item into keychain with given query. - @param item The item to be added into keychain. - @param query The query to query the keychain. - @return Whether the operation succeed. - */ + /// Set the item into keychain with given query. + /// - Parameter item: The item to be added into keychain. + /// - Parameter query: The query to query the keychain. + /// - Returns: Whether the operation succeed. func setItem(_ item: Data, withQuery query: [String: Any]) throws { let status: OSStatus let function: String @@ -97,11 +88,8 @@ final class AuthKeychainServices { throw AuthErrorUtils.keychainError(function: function, status: status) } - /** @fn removeItemWithQuery:error: - @brief Remove the item with given queryfrom keychain. - @param query The query to query the keychain. - @return Whether the operation succeed. - */ + /// Remove the item with given queryfrom keychain. + /// - Parameter query: The query to query the keychain. func removeItem(query: [String: Any]) throws { let status = keychainStorage.delete(query: query) if status == noErr || status == errSecItemNotFound { @@ -110,12 +98,10 @@ final class AuthKeychainServices { throw AuthErrorUtils.keychainError(function: "SecItemDelete", status: status) } - /** @var _legacyItemDeletedForKey - @brief Indicates whether or not this class knows that the legacy item for a particular key has - been deleted. - @remarks This dictionary is to avoid unecessary keychain operations against legacy items. - */ - + /// Indicates whether or not this class knows that the legacy item for a particular key has + /// been deleted. + /// + /// This dictionary is to avoid unnecessary keychain operations against legacy items. private var legacyEntryDeletedForKey: Set = [] static func storage(identifier: String) -> Self { @@ -225,10 +211,8 @@ final class AuthKeychainServices { throw AuthErrorUtils.keychainError(function: function, status: status) } - /** @fn deleteLegacyItemsWithKey: - @brief Deletes legacy item from the keychain if it is not already known to be deleted. - @param key The key for the item. - */ + /// Deletes legacy item from the keychain if it is not already known to be deleted. + /// - Parameter key: The key for the item. private func deleteLegacyItem(key: String) { if legacyEntryDeletedForKey.contains(key) { return @@ -238,10 +222,9 @@ final class AuthKeychainServices { legacyEntryDeletedForKey.insert(key) } - /** @fn genericPasswordQueryWithKey: - @brief Returns a keychain query of generic password to be used to manipulate key'ed value. - @param key The key for the value being manipulated, used as the account field in the query. - */ + /// Returns a keychain query of generic password to be used to manipulate key'ed value. + /// - Parameter key: The key for the value being manipulated, used as the account field in the + /// query. private func genericPasswordQuery(key: String) -> [String: Any] { if key.isEmpty { fatalError("The key cannot be empty.") @@ -255,11 +238,10 @@ final class AuthKeychainServices { return query } - /** @fn legacyGenericPasswordQueryWithKey: - @brief Returns a keychain query of generic password without service field, which is used by - previous version of this class. - @param key The key for the value being manipulated, used as the account field in the query. - */ + /// Returns a keychain query of generic password without service field, which is used by + /// previous version of this class . + /// - Parameter key: The key for the value being manipulated, used as the account field in the + /// query. private func legacyGenericPasswordQuery(key: String) -> [String: Any] { [ kSecClass as String: kSecClassGenericPassword, diff --git a/FirebaseAuth/Sources/Swift/Storage/AuthKeychainStorage.swift b/FirebaseAuth/Sources/Swift/Storage/AuthKeychainStorage.swift index 41838c6974c..d53bb612402 100644 --- a/FirebaseAuth/Sources/Swift/Storage/AuthKeychainStorage.swift +++ b/FirebaseAuth/Sources/Swift/Storage/AuthKeychainStorage.swift @@ -14,9 +14,8 @@ import Foundation -/** @class AuthKeychainStorage - @brief Protocol to manage keychain updates. Tests can do a fake implementation. - */ +/// Protocol to manage keychain updates. Tests can do a fake implementation. + @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) protocol AuthKeychainStorage { func get(query: [String: Any], result: inout AnyObject?) -> OSStatus diff --git a/FirebaseAuth/Sources/Swift/Storage/AuthKeychainStorageReal.swift b/FirebaseAuth/Sources/Swift/Storage/AuthKeychainStorageReal.swift index 48f3c775df2..777ff056c3b 100644 --- a/FirebaseAuth/Sources/Swift/Storage/AuthKeychainStorageReal.swift +++ b/FirebaseAuth/Sources/Swift/Storage/AuthKeychainStorageReal.swift @@ -14,9 +14,8 @@ import Foundation -/** @class AuthKeychainStorage - @brief The utility class to update the real keychain - */ +/// The utility class to update the real keychain + @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class AuthKeychainStorageReal: AuthKeychainStorage { func get(query: [String: Any], result: inout AnyObject?) -> OSStatus { diff --git a/FirebaseAuth/Sources/Swift/Storage/AuthUserDefaults.swift b/FirebaseAuth/Sources/Swift/Storage/AuthUserDefaults.swift index fb7d03645ed..54be969dc01 100644 --- a/FirebaseAuth/Sources/Swift/Storage/AuthUserDefaults.swift +++ b/FirebaseAuth/Sources/Swift/Storage/AuthUserDefaults.swift @@ -16,18 +16,14 @@ import Foundation private let kPersistentDomainNamePrefix = "com.google.Firebase.Auth." -/** @class AuthUserDefaults - @brief The utility class to storage data in NSUserDefaults. - */ +/// The utility class to manage data storage in NSUserDefaults. class AuthUserDefaults { - /** @var _persistentDomainName - @brief The name of the persistent domain in user defaults. - */ + /// The name of the persistent domain in user defaults. + private let persistentDomainName: String - /** @var _storage - @brief The backing NSUserDefaults storage for this instance. - */ + /// The backing NSUserDefaults storage for this instance. + private let storage: UserDefaults static func storage(identifier: String) -> Self { @@ -60,10 +56,9 @@ class AuthUserDefaults { storage.setPersistentDomain(allData, forName: persistentDomainName) } - /** @fn clear - @brief Clears all data from the storage. - @remarks This method is only supposed to be called from tests. - */ + /// Clears all data from the storage. + /// + /// This method is only supposed to be called from tests. func clear() { storage.setPersistentDomain([:], forName: persistentDomainName) } diff --git a/FirebaseAuth/Sources/Swift/SystemService/AuthAPNSToken.swift b/FirebaseAuth/Sources/Swift/SystemService/AuthAPNSToken.swift index 72e3d658209..5031a0e212e 100644 --- a/FirebaseAuth/Sources/Swift/SystemService/AuthAPNSToken.swift +++ b/FirebaseAuth/Sources/Swift/SystemService/AuthAPNSToken.swift @@ -15,27 +15,21 @@ #if !os(macOS) import Foundation - /** @class AuthAPNSToken - @brief A data structure for an APNs token. - */ + /// A data structure for an APNs token. class AuthAPNSToken: NSObject { let data: Data let type: AuthAPNSTokenType - /** @fn initWithData:type: - @brief Initializes the instance. - @param data The APNs token data. - @param type The APNs token type. - @return The initialized instance. - */ + /// Initializes the instance. + /// - Parameter data: The APNs token data. + /// - Parameter type: The APNs token type. + /// - Returns: The initialized instance. init(withData data: Data, type: AuthAPNSTokenType) { self.data = data self.type = type } - /** @property string - @brief The uppercase hexadecimal string form of the APNs token data. - */ + /// The uppercase hexadecimal string form of the APNs token data. lazy var string: String = { let byteArray = [UInt8](data) var s = "" diff --git a/FirebaseAuth/Sources/Swift/SystemService/AuthAPNSTokenManager.swift b/FirebaseAuth/Sources/Swift/SystemService/AuthAPNSTokenManager.swift index dc821748ab0..0e4f87d3b42 100644 --- a/FirebaseAuth/Sources/Swift/SystemService/AuthAPNSTokenManager.swift +++ b/FirebaseAuth/Sources/Swift/SystemService/AuthAPNSTokenManager.swift @@ -32,32 +32,26 @@ extension UIApplication: AuthAPNSTokenApplication {} - /** @class AuthAPNSToken - @brief A data structure for an APNs token. - */ + /// A class to manage APNs token in memory. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class AuthAPNSTokenManager: NSObject { - /** @property timeout - @brief The timeout for registering for remote notification. - @remarks Only tests should access this property. - */ + /// The timeout for registering for remote notification. + /// + /// Only tests should access this property. var timeout: TimeInterval = 5 - /** @fn initWithApplication: - @brief Initializes the instance. - @param application The @c UIApplication to request the token from. - @return The initialized instance. - */ + /// Initializes the instance. + /// - Parameter application: The `UIApplication` to request the token from. + /// - Returns: The initialized instance. init(withApplication application: AuthAPNSTokenApplication) { self.application = application } - // This function is internal to make visible for tests. - /** @fn getTokenWithCallback: - @brief Attempts to get the APNs token. - @param callback The block to be called either immediately or in future, either when a token - becomes available, or when timeout occurs, whichever happens earlier. - */ + /// Attempts to get the APNs token. + /// - Parameter callback: The block to be called either immediately or in future, either when a + /// token becomes available, or when timeout occurs, whichever happens earlier. + /// + /// This function is internal to make visible for tests. func getTokenInternal(callback: @escaping (AuthAPNSToken?, Error?) -> Void) { if let token = tokenStore { callback(token, nil) @@ -94,14 +88,13 @@ } } - /** @property token - @brief The APNs token, if one is available. - @remarks Setting a token with AuthAPNSTokenTypeUnknown will automatically converts it to - a token with the automatically detected type. - */ + /// The APNs token, if one is available. + /// + /// Setting a token with AuthAPNSTokenTypeUnknown will automatically converts it to + /// a token with the automatically detected type. var token: AuthAPNSToken? { get { - return tokenStore + tokenStore } set(setToken) { guard let setToken else { @@ -119,18 +112,16 @@ } } - // Should only be written to in tests + /// Should only be written to in tests var tokenStore: AuthAPNSToken? - /** @fn cancelWithError: - @brief Cancels any pending `getTokenWithCallback:` request. - @param error The error to return. - */ + /// Cancels any pending `getTokenWithCallback:` request. + /// - Parameter error: The error to return . func cancel(withError error: Error) { callback(withToken: nil, error: error) } - // `application` is a var to enable unit test faking. + /// Enable unit test faking. var application: AuthAPNSTokenApplication private var pendingCallbacks: [(AuthAPNSToken?, Error?) -> Void] = [] diff --git a/FirebaseAuth/Sources/Swift/SystemService/AuthAPNSTokenType.swift b/FirebaseAuth/Sources/Swift/SystemService/AuthAPNSTokenType.swift index 35f8e73a6f5..a11ab157bd4 100644 --- a/FirebaseAuth/Sources/Swift/SystemService/AuthAPNSTokenType.swift +++ b/FirebaseAuth/Sources/Swift/SystemService/AuthAPNSTokenType.swift @@ -15,22 +15,20 @@ #if !os(macOS) import Foundation - /** - * @brief The APNs token type for the app. - * This enum is available on iOS, macOS Catalyst, tvOS, and watchOS only. - */ + /// The APNs token type for the app. + /// + /// This enum is available on iOS, macOS Catalyst, tvOS, and watchOS only. + @objc(FIRAuthAPNSTokenType) public enum AuthAPNSTokenType: Int { - /** Unknown token type. - The actual token type will be detected from the provisioning profile in the app's bundle. - */ + /// Unknown token type. + /// + /// The actual token type will be detected from the provisioning profile in the app's bundle. case unknown - /** Sandbox token type. - */ + /// Sandbox token type. case sandbox - /** Production token type. - */ + /// Production token type. case prod } #endif diff --git a/FirebaseAuth/Sources/Swift/SystemService/AuthAppCredential.swift b/FirebaseAuth/Sources/Swift/SystemService/AuthAppCredential.swift index e1218f84678..38fdcb06e34 100644 --- a/FirebaseAuth/Sources/Swift/SystemService/AuthAppCredential.swift +++ b/FirebaseAuth/Sources/Swift/SystemService/AuthAppCredential.swift @@ -14,26 +14,19 @@ import Foundation -/** @class FIRAuthAppCredential - @brief A class represents a credential that proves the identity of the app. - */ +/// A class represents a credential that proves the identity of the app. @objc(FIRAuthAppCredential) class AuthAppCredential: NSObject, NSSecureCoding { - /** @property receipt - @brief The server acknowledgement of receiving client's claim of identity. - */ + /// The server acknowledgement of receiving client's claim of identity. var receipt: String - /** @property secret - @brief The secret that the client received from server via a trusted channel, if ever. - */ + /// The secret that the client received from server via a trusted channel, if ever. var secret: String? - /** @fn initWithReceipt:secret: - @brief Initializes the instance. - @param receipt The server acknowledgement of receiving client's claim of identity. - @param secret The secret that the client received from server via a trusted channel, if ever. - @return The initialized instance. - */ + /// Initializes the instance. + /// - Parameter receipt: The server acknowledgement of receiving client's claim of identity. + /// - Parameter secret: The secret that the client received from server via a trusted channel, if + /// ever. + /// - Returns: The initialized instance. init(receipt: String, secret: String?) { self.secret = secret self.receipt = receipt diff --git a/FirebaseAuth/Sources/Swift/SystemService/AuthAppCredentialManager.swift b/FirebaseAuth/Sources/Swift/SystemService/AuthAppCredentialManager.swift index 094cac5f292..511d354e2fd 100644 --- a/FirebaseAuth/Sources/Swift/SystemService/AuthAppCredentialManager.swift +++ b/FirebaseAuth/Sources/Swift/SystemService/AuthAppCredentialManager.swift @@ -15,24 +15,20 @@ #if !os(macOS) import Foundation - /** @class FIRAuthAppCredentialManager - @brief A class to manage app credentials backed by iOS Keychain. - */ + /// A class to manage app credentials backed by iOS Keychain. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class AuthAppCredentialManager: NSObject { let kKeychainDataKey = "app_credentials" let kFullCredentialKey = "full_credential" let kPendingReceiptsKey = "pending_receipts" - /** @property credential - @brief The full credential (which has a secret) to be used by the app, if one is available. - */ + /// The full credential (which has a secret) to be used by the app, if one is available. + var credential: AuthAppCredential? - /** @property maximumNumberOfPendingReceipts - @brief The maximum (but not necessarily the minimum) number of pending receipts to be kept. - @remarks Only tests should access this property. - */ + /// The maximum (but not necessarily the minimum) number of pending receipts to be kept. + /// + /// Only tests should access this property. let maximumNumberOfPendingReceipts = 32 init(withKeychain keychain: AuthKeychainServices) { @@ -116,19 +112,13 @@ } } - /** @var _keychainServices - @brief The keychain for app credentials to load from and to save to. - */ + /// The keychain for app credentials to load from and to save to. private let keychainServices: AuthKeychainServices - /** @var pendingReceipts - @brief A list of pending receipts sorted in the order they were recorded. - */ + /// A list of pending receipts sorted in the order they were recorded. private var pendingReceipts: [String] = [] - /** @var callbacksByReceipt - @brief A map from pending receipts to callbacks. - */ + /// A map from pending receipts to callbacks. private var callbacksByReceipt: [String: (AuthAppCredential) -> Void] = [:] // Only for testing. diff --git a/FirebaseAuth/Sources/Swift/SystemService/AuthNotificationManager.swift b/FirebaseAuth/Sources/Swift/SystemService/AuthNotificationManager.swift index d6383ef3d6e..2d78927bec0 100644 --- a/FirebaseAuth/Sources/Swift/SystemService/AuthNotificationManager.swift +++ b/FirebaseAuth/Sources/Swift/SystemService/AuthNotificationManager.swift @@ -16,79 +16,54 @@ import Foundation import UIKit - /** @class FIRAuthAppCredential - @brief A class represents a credential that proves the identity of the app. - */ + /// A class represents a credential that proves the identity of the app. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class AuthNotificationManager: NSObject { - /** @var kNotificationKey - @brief The key to locate payload data in the remote notification. - */ + /// The key to locate payload data in the remote notification. private let kNotificationDataKey = "com.google.firebase.auth" - /** @var kNotificationReceiptKey - @brief The key for the receipt in the remote notification payload data. - */ + /// The key for the receipt in the remote notification payload data. private let kNotificationReceiptKey = "receipt" - /** @var kNotificationSecretKey - @brief The key for the secret in the remote notification payload data. - */ + /// The key for the secret in the remote notification payload data. private let kNotificationSecretKey = "secret" - /** @var kNotificationProberKey - @brief The key for marking the prober in the remote notification payload data. - */ + /// The key for marking the prober in the remote notification payload data. private let kNotificationProberKey = "warning" - /** @var kProbingTimeout - @brief Timeout for probing whether the app delegate forwards the remote notification to us. - */ + /// Timeout for probing whether the app delegate forwards the remote notification to us. private let kProbingTimeout = 1.0 - /** @var _application - @brief The application. - */ + /// The application. private let application: UIApplication - /** @var _appCredentialManager - @brief The object to handle app credentials delivered via notification. - */ + /// The object to handle app credentials delivered via notification. private let appCredentialManager: AuthAppCredentialManager - /** @var _hasCheckedNotificationForwarding - @brief Whether notification forwarding has been checked or not. - */ + /// Whether notification forwarding has been checked or not. private var hasCheckedNotificationForwarding: Bool = false - /** @var _isNotificationBeingForwarded - @brief Whether or not notification is being forwarded - */ + /// Whether or not notification is being forwarded private var isNotificationBeingForwarded: Bool = false - /** @property timeout - @brief The timeout for checking for notification forwarding. - @remarks Only tests should access this property. - */ + /// The timeout for checking for notification forwarding. + /// + /// Only tests should access this property. let timeout: TimeInterval - /** @property immediateCallbackForTestFaking - @brief Disable callback waiting for tests. - @remarks Only tests should access this property. - */ + /// Disable callback waiting for tests. + /// + /// Only tests should access this property. var immediateCallbackForTestFaking: (() -> Bool)? - /** @var _pendingCallbacks - @brief All pending callbacks while a check is being performed. - */ + /// All pending callbacks while a check is being performed. private var pendingCallbacks: [(Bool) -> Void]? - /** @fn initWithApplication:appCredentialManager: - @brief Initializes the instance. - @param application The application. - @param appCredentialManager The object to handle app credentials delivered via notification. - @return The initialized instance. - */ + /// Initializes the instance. + /// - Parameter application: The application. + /// - Parameter appCredentialManager: The object to handle app credentials delivered via + /// notification. + /// - Returns: The initialized instance. init(withApplication application: UIApplication, appCredentialManager: AuthAppCredentialManager) { self.application = application @@ -96,11 +71,9 @@ timeout = kProbingTimeout } - /** @fn checkNotificationForwardingWithCallback: - @brief Checks whether or not remote notifications are being forwarded to this class. - @param callback The block to be called either immediately or in future once a result - is available. - */ + /// Checks whether or not remote notifications are being forwarded to this class. + /// - Parameter callback: The block to be called either immediately or in future once a result + /// is available. func checkNotificationForwardingInternal(withCallback callback: @escaping (Bool) -> Void) { if pendingCallbacks != nil { pendingCallbacks?.append(callback) @@ -154,11 +127,9 @@ } } - /** @fn canHandleNotification: - @brief Attempts to handle the remote notification. - @param notification The notification in question. - @return Whether or the notification has been handled. - */ + /// Attempts to handle the remote notification. + /// - Parameter notification: The notification in question. + /// - Returns: Whether or the notification has been handled. func canHandle(notification: [AnyHashable: Any]) -> Bool { var stringDictionary: [String: Any]? let data = notification[kNotificationDataKey] diff --git a/FirebaseAuth/Sources/Swift/SystemService/SecureTokenService.swift b/FirebaseAuth/Sources/Swift/SystemService/SecureTokenService.swift index 6e3dabf164c..e7dc9c8d0d6 100644 --- a/FirebaseAuth/Sources/Swift/SystemService/SecureTokenService.swift +++ b/FirebaseAuth/Sources/Swift/SystemService/SecureTokenService.swift @@ -16,43 +16,33 @@ import Foundation private let kFiveMinutes = 5 * 60.0 -/** @class FIRAuthAppCredential - @brief A class represents a credential that proves the identity of the app. - */ +/// A class represents a credential that proves the identity of the app. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRSecureTokenService) // objc Needed for decoding old versions class SecureTokenService: NSObject, NSSecureCoding { - /** @property requestConfiguration - @brief The configuration for making requests to server. - */ + /// The configuration for making requests to server. var requestConfiguration: AuthRequestConfiguration? - /** @property accessToken - @brief The cached access token. - @remarks This method is specifically for providing the access token to internal clients during - deserialization and sign-in events, and should not be used to retrieve the access token by - anyone else. - */ + /// The cached access token. + /// + /// This method is specifically for providing the access token to internal clients during + /// deserialization and sign-in events, and should not be used to retrieve the access token by + /// anyone else. var accessToken: String - /** @property refreshToken - @brief The refresh token for the user, or @c nil if the user has yet completed sign-in flow. - @remarks This property needs to be set manually after the instance is decoded from archive. - */ + /// The refresh token for the user, or `nil` if the user has yet completed sign-in flow. + /// + /// This property needs to be set manually after the instance is decoded from archive. var refreshToken: String? - /** @property accessTokenExpirationDate - @brief The expiration date of the cached access token. - */ + /// The expiration date of the cached access token. var accessTokenExpirationDate: Date? - /** @fn initWithRequestConfiguration:accessToken:accessTokenExpirationDate:refreshToken - @brief Creates a @c FIRSecureTokenService with access and refresh tokens. - @param requestConfiguration The configuration for making requests to server. - @param accessToken The STS access token. - @param accessTokenExpirationDate The approximate expiration date of the access token. - @param refreshToken The STS refresh token. - */ + /// Creates a `SecureTokenService` with access and refresh tokens. + /// - Parameter requestConfiguration: The configuration for making requests to server. + /// - Parameter accessToken: The STS access token. + /// - Parameter accessTokenExpirationDate: The approximate expiration date of the access token. + /// - Parameter refreshToken: The STS refresh token. init(withRequestConfiguration requestConfiguration: AuthRequestConfiguration?, accessToken: String, accessTokenExpirationDate: Date?, @@ -64,13 +54,13 @@ class SecureTokenService: NSObject, NSSecureCoding { taskQueue = AuthSerialTaskQueue() } - /** @fn fetchAccessTokenForcingRefresh:callback: - @brief Fetch a fresh ephemeral access token for the ID associated with this instance. The token - received in the callback should be considered short lived and not cached. - @param forceRefresh Forces the token to be refreshed. - @param callback Callback block that will be called to return either the token or an error. - Invoked asyncronously on the auth global work queue in the future. - */ + /// Fetch a fresh ephemeral access token for the ID associated with this instance. The token + /// received in the callback should be considered short lived and not cached. + /// + /// Invoked asyncronously on the auth global work queue in the future. + /// - Parameter forceRefresh: Forces the token to be refreshed. + /// - Parameter callback: Callback block that will be called to return either the token or an + /// error. func fetchAccessToken(forcingRefresh forceRefresh: Bool, callback: @escaping (String?, Error?, Bool) -> Void) { taskQueue.enqueueTask { complete in @@ -139,17 +129,17 @@ class SecureTokenService: NSObject, NSSecureCoding { // MARK: Private methods - /** @fn requestAccessToken: - @brief Makes a request to STS for an access token. - @details This handles both the case that the token has not been granted yet and that it just - needs to be refreshed. The caller is responsible for making sure that this is occurring in - a @c _taskQueue task. - @Returns token and Bool indicating if update occurred. - @remarks Because this method is guaranteed to only be called from tasks enqueued in - @c _taskQueue, we do not need any @synchronized guards around access to _accessToken/etc. - since only one of those tasks is ever running at a time, and those tasks are the only - access to and mutation of these instance variables. - */ + /// Makes a request to STS for an access token. + /// + /// This handles both the case that the token has not been granted yet and that it just + /// needs to be refreshed. The caller is responsible for making sure that this is occurring in + /// a `_taskQueue` task. + /// + /// Because this method is guaranteed to only be called from tasks enqueued in + /// `_taskQueue`, we do not need any @synchronized guards around access to _accessToken/etc. + /// since only one of those tasks is ever running at a time, and those tasks are the only + /// access to and mutation of these instance variables. + /// - Returns: Token and Bool indicating if update occurred. private func requestAccessToken(retryIfExpired: Bool) async throws -> (String?, Bool) { // TODO: This was a crash in ObjC SDK, should it callback with an error? guard let refreshToken, let requestConfiguration else { diff --git a/FirebaseAuth/Sources/Swift/User/AdditionalUserInfo.swift b/FirebaseAuth/Sources/Swift/User/AdditionalUserInfo.swift index a6b9f101a89..455075903eb 100644 --- a/FirebaseAuth/Sources/Swift/User/AdditionalUserInfo.swift +++ b/FirebaseAuth/Sources/Swift/User/AdditionalUserInfo.swift @@ -16,27 +16,21 @@ import Foundation extension AdditionalUserInfo: NSSecureCoding {} @objc(FIRAdditionalUserInfo) open class AdditionalUserInfo: NSObject { - /** @property providerID - @brief The provider identifier. - */ + /// The provider identifier. @objc public let providerID: String - /** @property profile - @brief Dictionary containing the additional IdP specific information. - */ + /// Dictionary containing the additional IdP specific information. @objc public let profile: [String: Any]? - /** @property username - @brief username The name of the user. - */ + /// The name of the user. @objc public let username: String? - /** @property isMewUser - @brief Indicates whether or not the current user was signed in for the first time. - */ + /// Indicates whether or not the current user was signed in for the first time. @objc public let isNewUser: Bool // Maintain newUser for Objective C API. + + /// Indicates whether or not the current user was signed in for the first time. @objc open func newUser() -> Bool { return isNewUser } diff --git a/FirebaseAuth/Sources/Swift/User/User.swift b/FirebaseAuth/Sources/Swift/User/User.swift index 6e28a54bd14..cf6ec906231 100644 --- a/FirebaseAuth/Sources/Swift/User/User.swift +++ b/FirebaseAuth/Sources/Swift/User/User.swift @@ -17,86 +17,79 @@ import Foundation @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) extension User: NSSecureCoding {} -/** @class User - @brief Represents a user. Firebase Auth does not attempt to validate users - when loading them from the keychain. Invalidated users (such as those - whose passwords have been changed on another client) are automatically - logged out when an auth-dependent operation is attempted or when the - ID token is automatically refreshed. - @remarks This class is thread-safe. - */ +/// Represents a user. +/// +/// Firebase Auth does not attempt to validate users +/// when loading them from the keychain. Invalidated users (such as those +/// whose passwords have been changed on another client) are automatically +/// logged out when an auth-dependent operation is attempted or when the +/// ID token is automatically refreshed. +/// +/// This class is thread-safe. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRUser) open class User: NSObject, UserInfo { - /** @property anonymous - @brief Indicates the user represents an anonymous user. - */ + /// Indicates the user represents an anonymous user. @objc public private(set) var isAnonymous: Bool + + /// Indicates the user represents an anonymous user. @objc open func anonymous() -> Bool { return isAnonymous } - /** @property emailVerified - @brief Indicates the email address associated with this user has been verified. - */ + /// Indicates the email address associated with this user has been verified. @objc public private(set) var isEmailVerified: Bool + + /// Indicates the email address associated with this user has been verified. @objc open func emailVerified() -> Bool { return isEmailVerified } - /** @property providerData - @brief Profile data for each identity provider, if any. - @remarks This data is cached on sign-in and updated when linking or unlinking. - */ + /// Profile data for each identity provider, if any. + /// + /// This data is cached on sign-in and updated when linking or unlinking. @objc open var providerData: [UserInfo] { return Array(providerDataRaw.values) } private var providerDataRaw: [String: UserInfoImpl] - /** @property metadata - @brief Metadata associated with the Firebase user in question. - */ + /// Metadata associated with the Firebase user in question. @objc public private(set) var metadata: UserMetadata - /** @property tenantID - @brief The tenant ID of the current user. nil if none is available. - */ + /// The tenant ID of the current user. `nil` if none is available. @objc public private(set) var tenantID: String? #if os(iOS) - /** @property multiFactor - @brief Multi factor object associated with the user. - This property is available on iOS only. - */ + /// Multi factor object associated with the user. + /// + /// This property is available on iOS only. @objc public private(set) var multiFactor: MultiFactor #endif - /** @fn updateEmail:completion: - @brief [Deprecated] Updates the email address for the user. On success, the cached user - profile data is updated. Returns AuthErrorCodeInvalidCredentials error when - [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) - is enabled. - @remarks May fail if there is already an account with this email address that was created using - email and password authentication. - - @param email The email address for the user. - @param completion Optionally; the block invoked when the user profile change has finished. - Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was - sent in the request. - + `AuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in - the console for this action. - + `AuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for - sending update email. - + `AuthErrorCodeEmailAlreadyInUse` - Indicates the email is already in use by another - account. - + `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. - + `AuthErrorCodeRequiresRecentLogin` - Updating a user’s email is a security - sensitive operation that requires a recent login from the user. This error indicates - the user has not signed in recently enough. To resolve, reauthenticate the user by - calling `reauthenticate(with:)`. - - @remarks See `AuthErrors` for a list of error codes that are common to all `User` methods. - */ + /// [Deprecated] Updates the email address for the user. + /// + /// On success, the cached user profile data is updated. Returns an error when + /// [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) + /// is enabled. + /// + /// May fail if there is already an account with this email address that was created using + /// email and password authentication. + /// + /// Invoked asynchronously on the main thread in the future. + /// + /// Possible error codes: + /// * `AuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was + /// sent in the request. + /// * `AuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in + /// the console for this action. + /// * `AuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for + /// sending update email. + /// * `AuthErrorCodeEmailAlreadyInUse` - Indicates the email is already in use by another + /// account. + /// * `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. + /// * `AuthErrorCodeRequiresRecentLogin` - Updating a user’s email is a security + /// sensitive operation that requires a recent login from the user. This error indicates + /// the user has not signed in recently enough. To resolve, reauthenticate the user by + /// calling `reauthenticate(with:)`. + /// - Parameter email: The email address for the user. + /// - Parameter completion: Optionally; the block invoked when the user profile change has + /// finished. @available( *, deprecated, @@ -111,35 +104,32 @@ extension User: NSSecureCoding {} } } - /** @fn updateEmail - @brief [Deprecated] Updates the email address for the user. On success, the cached user - profile data is updated. Returns AuthErrorCodeInvalidCredentials error when - [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) - is enabled. - @remarks May fail if there is already an account with this email address that was created using - email and password authentication. - - @param email The email address for the user. - @throws Error on failure. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was - sent in the request. - + `AuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in - the console for this action. - + `AuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for - sending update email. - + `AuthErrorCodeEmailAlreadyInUse` - Indicates the email is already in use by another - account. - + `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. - + `AuthErrorCodeRequiresRecentLogin` - Updating a user’s email is a security - sensitive operation that requires a recent login from the user. This error indicates - the user has not signed in recently enough. To resolve, reauthenticate the user by - calling `reauthenticate(with:)`. - - @remarks See `AuthErrors` for a list of error codes that are common to all `User` methods. - */ + /// [Deprecated] Updates the email address for the user. + /// + /// On success, the cached user profile data is updated. Throws when + /// [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) + /// is enabled. + /// + /// May fail if there is already an account with this email address that was created using + /// email and password authentication. + /// + /// Invoked asynchronously on the main thread in the future. + /// + /// Possible error codes: + /// * `AuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was + /// sent in the request. + /// * `AuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in + /// the console for this action. + /// * `AuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for + /// sending update email. + /// * `AuthErrorCodeEmailAlreadyInUse` - Indicates the email is already in use by another + /// account. + /// * `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. + /// * `AuthErrorCodeRequiresRecentLogin` - Updating a user’s email is a security + /// sensitive operation that requires a recent login from the user. This error indicates + /// the user has not signed in recently enough. To resolve, reauthenticate the user by + /// calling `reauthenticate(with:)`. + /// - Parameter email: The email address for the user. @available( *, deprecated, @@ -158,27 +148,23 @@ extension User: NSSecureCoding {} } } - /** @fn updatePassword:completion: - @brief Updates the password for the user. On success, the cached user profile data is updated. - - @param password The new password for the user. - @param completion Optionally; the block invoked when the user profile change has finished. - Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeOperationNotAllowed` - Indicates the administrator disabled - sign in with the specified identity provider. - + `AuthErrorCodeRequiresRecentLogin` - Updating a user’s password is a security - sensitive operation that requires a recent login from the user. This error indicates - the user has not signed in recently enough. To resolve, reauthenticate the user by - calling `reauthenticate(with:)`. - + `AuthErrorCodeWeakPassword` - Indicates an attempt to set a password that is - considered too weak. The `NSLocalizedFailureReasonErrorKey` field in the `userInfo` - dictionary object will contain more detailed explanation that can be shown to the user. - - @remarks See `AuthErrors` for a list of error codes that are common to all `User` methods. - */ + /// Updates the password for the user. On success, the cached user profile data is updated. + /// + /// Invoked asynchronously on the main thread in the future. + /// + /// Possible error codes: + /// * `AuthErrorCodeOperationNotAllowed` - Indicates the administrator disabled + /// sign in with the specified identity provider. + /// * `AuthErrorCodeRequiresRecentLogin` - Updating a user’s password is a security + /// sensitive operation that requires a recent login from the user. This error indicates + /// the user has not signed in recently enough. To resolve, reauthenticate the user by + /// calling `reauthenticate(with:)`. + /// * `AuthErrorCodeWeakPassword` - Indicates an attempt to set a password that is + /// considered too weak. The `NSLocalizedFailureReasonErrorKey` field in the `userInfo` + /// dictionary object will contain more detailed explanation that can be shown to the user. + /// - Parameter password: The new password for the user. + /// - Parameter completion: Optionally; the block invoked when the user profile change has + /// finished. @objc(updatePassword:completion:) open func updatePassword(to password: String, completion: ((Error?) -> Void)? = nil) { guard password.count > 0 else { @@ -194,26 +180,21 @@ extension User: NSSecureCoding {} } } - /** @fn updatePassword - @brief Updates the password for the user. On success, the cached user profile data is updated. - - @param password The new password for the user. - @throws Error on failure. - - @remarks Possible error codes: - - + `AuthErrorCodeOperationNotAllowed` - Indicates the administrator disabled - sign in with the specified identity provider. - + `AuthErrorCodeRequiresRecentLogin` - Updating a user’s password is a security - sensitive operation that requires a recent login from the user. This error indicates - the user has not signed in recently enough. To resolve, reauthenticate the user by - calling `reauthenticate(with:)`. - + `AuthErrorCodeWeakPassword` - Indicates an attempt to set a password that is - considered too weak. The `NSLocalizedFailureReasonErrorKey` field in the `userInfo` - dictionary object will contain more detailed explanation that can be shown to the user. - - @remarks See `AuthErrors` for a list of error codes that are common to all `User` methods. - */ + /// Updates the password for the user. On success, the cached user profile data is updated. + /// + /// Invoked asynchronously on the main thread in the future. + /// + /// Possible error codes: + /// * `AuthErrorCodeOperationNotAllowed` - Indicates the administrator disabled + /// sign in with the specified identity provider. + /// * `AuthErrorCodeRequiresRecentLogin` - Updating a user’s password is a security + /// sensitive operation that requires a recent login from the user. This error indicates + /// the user has not signed in recently enough. To resolve, reauthenticate the user by + /// calling `reauthenticate(with:)`. + /// * `AuthErrorCodeWeakPassword` - Indicates an attempt to set a password that is + /// considered too weak. The `NSLocalizedFailureReasonErrorKey` field in the `userInfo` + /// dictionary object will contain more detailed explanation that can be shown to the user. + /// - Parameter password: The new password for the user. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func updatePassword(to password: String) async throws { return try await withCheckedThrowingContinuation { continuation in @@ -228,26 +209,22 @@ extension User: NSSecureCoding {} } #if os(iOS) - /** @fn updatePhoneNumberCredential:completion: - @brief Updates the phone number for the user. On success, the cached user profile data is - updated. - This method is available on iOS only. - - @param phoneNumberCredential The new phone number credential corresponding to the phone number - to be added to the Firebase account, if a phone number is already linked to the account this - new phone number will replace it. - @param completion Optionally; the block invoked when the user profile change has finished. - Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeRequiresRecentLogin` - Updating a user’s phone number is a security - sensitive operation that requires a recent login from the user. This error indicates - the user has not signed in recently enough. To resolve, reauthenticate the user by - calling `reauthenticate(with:)`. - - @remarks See `AuthErrors` for a list of error codes that are common to all `User` methods. - */ + /// Updates the phone number for the user. On success, the cached user profile data is updated. + /// + /// Invoked asynchronously on the main thread in the future. + /// + /// This method is available on iOS only. + /// + /// Possible error codes: + /// * `AuthErrorCodeRequiresRecentLogin` - Updating a user’s phone number is a security + /// sensitive operation that requires a recent login from the user. This error indicates + /// the user has not signed in recently enough. To resolve, reauthenticate the user by + /// calling `reauthenticate(with:)`. + /// - Parameter credential: The new phone number credential corresponding to the + /// phone number to be added to the Firebase account, if a phone number is already linked to the + /// account this new phone number will replace it. + /// - Parameter completion: Optionally; the block invoked when the user profile change has + /// finished. @objc(updatePhoneNumberCredential:completion:) open func updatePhoneNumber(_ credential: PhoneAuthCredential, completion: ((Error?) -> Void)? = nil) { @@ -259,25 +236,20 @@ extension User: NSSecureCoding {} } } - /** @fn updatePhoneNumberCredential - @brief Updates the phone number for the user. On success, the cached user profile data is - updated. - This method is available on iOS only. - - @param phoneNumberCredential The new phone number credential corresponding to the phone number - to be added to the Firebase account, if a phone number is already linked to the account this - new phone number will replace it. - @throws an error. - - @remarks Possible error codes: - - + `AuthErrorCodeRequiresRecentLogin` - Updating a user’s phone number is a security - sensitive operation that requires a recent login from the user. This error indicates - the user has not signed in recently enough. To resolve, reauthenticate the user by - calling `reauthenticate(with:)`. - - @remarks See `AuthErrors` for a list of error codes that are common to all `User` methods. - */ + /// Updates the phone number for the user. On success, the cached user profile data is updated. + /// + /// Invoked asynchronously on the main thread in the future. + /// + /// This method is available on iOS only. + /// + /// Possible error codes: + /// * `AuthErrorCodeRequiresRecentLogin` - Updating a user’s phone number is a security + /// sensitive operation that requires a recent login from the user. This error indicates + /// the user has not signed in recently enough. To resolve, reauthenticate the user by + /// calling `reauthenticate(with:)`. + /// - Parameter phoneNumberCredential: The new phone number credential corresponding to the + /// phone number to be added to the Firebase account, if a phone number is already linked to the + /// account this new phone number will replace it. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func updatePhoneNumber(_ credential: PhoneAuthCredential) async throws { return try await withCheckedThrowingContinuation { continuation in @@ -292,14 +264,11 @@ extension User: NSSecureCoding {} } #endif - /** @fn profileChangeRequest - @brief Creates an object which may be used to change the user's profile data. - - @remarks Set the properties of the returned object, then call - `UserProfileChangeRequest.commitChanges()` to perform the updates atomically. - - @return An object which may be used to change the user's profile data atomically. - */ + /// Creates an object which may be used to change the user's profile data. + /// + /// Set the properties of the returned object, then call + /// `UserProfileChangeRequest.commitChanges()` to perform the updates atomically. + /// - Returns: An object which may be used to change the user's profile data atomically. @objc(profileChangeRequest) open func createProfileChangeRequest() -> UserProfileChangeRequest { var result: UserProfileChangeRequest! @@ -309,10 +278,9 @@ extension User: NSSecureCoding {} return result } - /** @property refreshToken - @brief A refresh token; useful for obtaining new access tokens independently. - @remarks This property should only be used for advanced scenarios, and is not typically needed. - */ + /// A refresh token; useful for obtaining new access tokens independently. + /// + /// This property should only be used for advanced scenarios, and is not typically needed. @objc open var refreshToken: String? { var result: String? kAuthGlobalWorkQueue.sync { @@ -321,18 +289,13 @@ extension User: NSSecureCoding {} return result } - /** @fn reloadWithCompletion: - @brief Reloads the user's profile data from the server. - - @param completion Optionally; the block invoked when the reload has finished. Invoked - asynchronously on the main thread in the future. - - @remarks May fail with a `AuthErrorCodeRequiresRecentLogin` error code. In this case - you should call `reauthenticate(with:)` before re-invoking - `updateEmail(to:)`. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Reloads the user's profile data from the server. + /// + /// May fail with an `AuthErrorCodeRequiresRecentLogin` error code. In this case + /// you should call `reauthenticate(with:)` before re-invoking + /// `updateEmail(to:)`. + /// - Parameter completion: Optionally; the block invoked when the reload has finished. Invoked + /// asynchronously on the main thread in the future. @objc open func reload(completion: ((Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { self.getAccountInfoRefreshingCache { user, error in @@ -341,18 +304,11 @@ extension User: NSSecureCoding {} } } - /** @fn reload - @brief Reloads the user's profile data from the server. - - @param completion Optionally; the block invoked when the reload has finished. Invoked - asynchronously on the main thread in the future. - - @remarks May fail with a `AuthErrorCodeRequiresRecentLogin` error code. In this case - you should call `reauthenticate(with:)` before re-invoking - `updateEmail(to:)`. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Reloads the user's profile data from the server. + /// + /// May fail with an `AuthErrorCodeRequiresRecentLogin` error code. In this case + /// you should call `reauthenticate(with:)` before re-invoking + /// `updateEmail(to:)`. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func reload() async throws { return try await withCheckedThrowingContinuation { continuation in @@ -366,41 +322,36 @@ extension User: NSSecureCoding {} } } - /** @fn reauthenticateWithCredential:completion: - @brief Renews the user's authentication tokens by validating a fresh set of credentials supplied - by the user and returns additional identity provider data. - - @param credential A user-supplied credential, which will be validated by the server. This can be - a successful third-party identity provider sign-in, or an email address and password. - @param completion Optionally; the block invoked when the re-authentication operation has - finished. Invoked asynchronously on the main thread in the future. - - @remarks If the user associated with the supplied credential is different from the current user, - or if the validation of the supplied credentials fails; an error is returned and the current - user remains signed in. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidCredential` - Indicates the supplied credential is invalid. - This could happen if it has expired or it is malformed. - + `AuthErrorCodeOperationNotAllowed` - Indicates that accounts with the - identity provider represented by the credential are not enabled. Enable them in the - Auth section of the Firebase console. - + `AuthErrorCodeEmailAlreadyInUse` - Indicates the email asserted by the credential - (e.g. the email in a Facebook access token) is already in use by an existing account, - that cannot be authenticated with this method. This error will only be thrown if the - "One account per email address" setting is enabled in the Firebase console, under Auth - settings. Please note that the error code raised in this specific situation may not be - the same on Web and Android. - + `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. - + `AuthErrorCodeWrongPassword` - Indicates the user attempted reauthentication with - an incorrect password, if credential is of the type `EmailPasswordAuthCredential`. - + `AuthErrorCodeUserMismatch` - Indicates that an attempt was made to - reauthenticate with a user which is not the current user. - + `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Renews the user's authentication tokens by validating a fresh set of credentials supplied + /// by the user and returns additional identity provider data. + /// + /// If the user associated with the supplied credential is different from the current user, + /// or if the validation of the supplied credentials fails; an error is returned and the current + /// user remains signed in. + /// + /// Possible error codes: + /// * `AuthErrorCodeInvalidCredential` - Indicates the supplied credential is invalid. + /// This could happen if it has expired or it is malformed. + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that accounts with the + /// identity provider represented by the credential are not enabled. Enable them in the + /// Auth section of the Firebase console. + /// * `AuthErrorCodeEmailAlreadyInUse` - Indicates the email asserted by the credential + /// (e.g. the email in a Facebook access token) is already in use by an existing account, + /// that cannot be authenticated with this method. This error will only be thrown if the + /// "One account per email address" setting is enabled in the Firebase console, under Auth + /// settings. Please note that the error code raised in this specific situation may not be + /// the same on Web and Android. + /// * `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. + /// * `AuthErrorCodeWrongPassword` - Indicates the user attempted reauthentication with + /// an incorrect password, if credential is of the type `EmailPasswordAuthCredential`. + /// * `AuthErrorCodeUserMismatch` - Indicates that an attempt was made to + /// reauthenticate with a user which is not the current user. + /// * `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. + /// - Parameter credential: A user-supplied credential, which will be validated by the server. + /// This can be a successful third-party identity provider sign-in, or an email address and + /// password. + /// - Parameter completion: Optionally; the block invoked when the re-authentication operation has + /// finished. Invoked asynchronously on the main thread in the future. @objc(reauthenticateWithCredential:completion:) open func reauthenticate(with credential: AuthCredential, completion: ((AuthDataResult?, Error?) -> Void)? = nil) { @@ -442,40 +393,35 @@ extension User: NSSecureCoding {} } } - /** @fn reauthenticateWithCredential - @brief Renews the user's authentication tokens by validating a fresh set of credentials supplied - by the user and returns additional identity provider data. - - @param credential A user-supplied credential, which will be validated by the server. This can be - a successful third-party identity provider sign-in, or an email address and password. - @returns An AuthDataResult. - - @remarks If the user associated with the supplied credential is different from the current user, - or if the validation of the supplied credentials fails; an error is returned and the current - user remains signed in. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidCredential` - Indicates the supplied credential is invalid. - This could happen if it has expired or it is malformed. - + `AuthErrorCodeOperationNotAllowed` - Indicates that accounts with the - identity provider represented by the credential are not enabled. Enable them in the - Auth section of the Firebase console. - + `AuthErrorCodeEmailAlreadyInUse` - Indicates the email asserted by the credential - (e.g. the email in a Facebook access token) is already in use by an existing account, - that cannot be authenticated with this method. This error will only be thrown if the - "One account per email address" setting is enabled in the Firebase console, under Auth - settings. Please note that the error code raised in this specific situation may not be - the same on Web and Android. - + `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. - + `AuthErrorCodeWrongPassword` - Indicates the user attempted reauthentication with - an incorrect password, if credential is of the type `EmailPasswordAuthCredential`. - + `AuthErrorCodeUserMismatch` - Indicates that an attempt was made to - reauthenticate with a user which is not the current user. - + `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Renews the user's authentication tokens by validating a fresh set of credentials supplied + /// by the user and returns additional identity provider data. + /// + /// If the user associated with the supplied credential is different from the current user, + /// or if the validation of the supplied credentials fails; an error is returned and the current + /// user remains signed in. + /// + /// Possible error codes: + /// * `AuthErrorCodeInvalidCredential` - Indicates the supplied credential is invalid. + /// This could happen if it has expired or it is malformed. + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that accounts with the + /// identity provider represented by the credential are not enabled. Enable them in the + /// Auth section of the Firebase console. + /// * `AuthErrorCodeEmailAlreadyInUse` - Indicates the email asserted by the credential + /// (e.g. the email in a Facebook access token) is already in use by an existing account, + /// that cannot be authenticated with this method. This error will only be thrown if the + /// "One account per email address" setting is enabled in the Firebase console, under Auth + /// settings. Please note that the error code raised in this specific situation may not be + /// the same on Web and Android. + /// * `AuthErrorCodeUserDisabled` - Indicates the user's account is disabled. + /// * `AuthErrorCodeWrongPassword` - Indicates the user attempted reauthentication with + /// an incorrect password, if credential is of the type `EmailPasswordAuthCredential`. + /// * `AuthErrorCodeUserMismatch` - Indicates that an attempt was made to + /// reauthenticate with a user which is not the current user. + /// * `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. + /// - Parameter credential: A user-supplied credential, which will be validated by the server. + /// This can be a successful third-party identity provider sign-in, or an email address and + /// password. + /// - Returns: The `AuthDataResult` after the reauthentication. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @discardableResult open func reauthenticate(with credential: AuthCredential) async throws -> AuthDataResult { @@ -491,17 +437,16 @@ extension User: NSSecureCoding {} } #if os(iOS) - /** @fn reauthenticateWithProvider:UIDelegate:completion: - @brief Renews the user's authentication using the provided auth provider instance. - This method is available on iOS only. - - @param provider An instance of an auth provider used to initiate the reauthenticate flow. - @param UIDelegate Optionally an instance of a class conforming to the `AuthUIDelegate` - protocol, used for presenting the web context. If nil, a default `AuthUIDelegate` - will be used. - @param completion Optionally; a block which is invoked when the reauthenticate flow finishes, or - is canceled. Invoked asynchronously on the main thread in the future. - */ + /// Renews the user's authentication using the provided auth provider instance. + /// + /// This method is available on iOS only. + /// - Parameter provider: An instance of an auth provider used to initiate the reauthenticate + /// flow. + /// - Parameter uiDelegate: Optionally an instance of a class conforming to the `AuthUIDelegate` + /// protocol, used for presenting the web context. If nil, a default `AuthUIDelegate` + /// will be used. + /// - Parameter completion: Optionally; a block which is invoked when the reauthenticate flow + /// finishes, or is canceled. Invoked asynchronously on the main thread in the future. @objc(reauthenticateWithProvider:UIDelegate:completion:) open func reauthenticate(with provider: FederatedAuthProvider, uiDelegate: AuthUIDelegate?, @@ -520,16 +465,15 @@ extension User: NSSecureCoding {} } } - /** @fn reauthenticateWithProvider:UIDelegate - @brief Renews the user's authentication using the provided auth provider instance. - This method is available on iOS only. - - @param provider An instance of an auth provider used to initiate the reauthenticate flow. - @param UIDelegate Optionally an instance of a class conforming to the `AuthUIDelegate` - protocol, used for presenting the web context. If nil, a default `AuthUIDelegate` - will be used. - @returns An AuthDataResult. - */ + /// Renews the user's authentication using the provided auth provider instance. + /// + /// This method is available on iOS only. + /// - Parameter provider: An instance of an auth provider used to initiate the reauthenticate + /// flow. + /// - Parameter uiDelegate: Optionally an instance of a class conforming to the `AuthUIDelegate` + /// protocol, used for presenting the web context. If nil, a default `AuthUIDelegate` + /// will be used. + /// - Returns: The `AuthDataResult` after the reauthentication. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @discardableResult open func reauthenticate(with provider: FederatedAuthProvider, @@ -546,14 +490,9 @@ extension User: NSSecureCoding {} } #endif - /** @fn getIDTokenWithCompletion: - @brief Retrieves the Firebase authentication token, possibly refreshing it if it has expired. - - @param completion Optionally; the block invoked when the token is available. Invoked - asynchronously on the main thread in the future. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Retrieves the Firebase authentication token, possibly refreshing it if it has expired. + /// - Parameter completion: Optionally; the block invoked when the token is available. Invoked + /// asynchronously on the main thread in the future. @objc(getIDTokenWithCompletion:) open func getIDToken(completion: ((String?, Error?) -> Void)?) { // |getIDTokenForcingRefresh:completion:| is also a public API so there is no need to dispatch to @@ -561,19 +500,14 @@ extension User: NSSecureCoding {} getIDTokenForcingRefresh(false, completion: completion) } - /** @fn getIDTokenForcingRefresh:completion: - @brief Retrieves the Firebase authentication token, possibly refreshing it if it has expired. - - @param forceRefresh Forces a token refresh. Useful if the token becomes invalid for some reason - other than an expiration. - @param completion Optionally; the block invoked when the token is available. Invoked - asynchronously on the main thread in the future. - - @remarks The authentication token will be refreshed (by making a network request) if it has - expired, or if `forceRefresh` is true. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Retrieves the Firebase authentication token, possibly refreshing it if it has expired. + /// + /// The authentication token will be refreshed (by making a network request) if it has + /// expired, or if `forceRefresh` is `true`. + /// - Parameter forceRefresh: Forces a token refresh. Useful if the token becomes invalid for some + /// reason other than an expiration. + /// - Parameter completion: Optionally; the block invoked when the token is available. Invoked + /// asynchronously on the main thread in the future. @objc(getIDTokenForcingRefresh:completion:) open func getIDTokenForcingRefresh(_ forceRefresh: Bool, completion: ((String?, Error?) -> Void)?) { @@ -586,18 +520,13 @@ extension User: NSSecureCoding {} } } - /** @fn getIDTokenForcingRefresh:completion: - @brief Retrieves the Firebase authentication token, possibly refreshing it if it has expired. - - @param forceRefresh Forces a token refresh. Useful if the token becomes invalid for some reason - other than an expiration. - @returns The Token. - - @remarks The authentication token will be refreshed (by making a network request) if it has - expired, or if `forceRefresh` is true. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Retrieves the Firebase authentication token, possibly refreshing it if it has expired. + /// + /// The authentication token will be refreshed (by making a network request) if it has + /// expired, or if `forceRefresh` is `true`. + /// - Parameter forceRefresh: Forces a token refresh. Useful if the token becomes invalid for some + /// reason other than an expiration. + /// - Returns: The Firebase authentication token. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func getIDToken() async throws -> String { return try await withCheckedThrowingContinuation { continuation in @@ -611,14 +540,9 @@ extension User: NSSecureCoding {} } } - /** @fn getIDTokenResultWithCompletion: - @brief Retrieves the Firebase authentication token, possibly refreshing it if it has expired. - - @param completion Optionally; the block invoked when the token is available. Invoked - asynchronously on the main thread in the future. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Retrieves the Firebase authentication token, possibly refreshing it if it has expired. + /// - Parameter completion: Optionally; the block invoked when the token is available. Invoked + /// asynchronously on the main thread in the future. @objc(getIDTokenResultWithCompletion:) open func getIDTokenResult(completion: ((AuthTokenResult?, Error?) -> Void)?) { getIDTokenResult(forcingRefresh: false) { tokenResult, error in @@ -630,19 +554,15 @@ extension User: NSSecureCoding {} } } - /** @fn getIDTokenResultForcingRefresh:completion: - @brief Retrieves the Firebase authentication token, possibly refreshing it if it has expired. - - @param forceRefresh Forces a token refresh. Useful if the token becomes invalid for some reason - other than an expiration. - @param completion Optionally; the block invoked when the token is available. Invoked - asynchronously on the main thread in the future. - - @remarks The authentication token will be refreshed (by making a network request) if it has - expired, or if `forceRefresh` is YES. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Retrieves the Firebase authentication token, possibly refreshing it if it has expired. + /// + /// The authentication token will be refreshed (by making a network request) if it has + /// expired, or if `forcingRefresh` is `true`. + /// - Parameter forcingRefresh: Forces a token refresh. Useful if the token becomes invalid for + /// some + /// reason other than an expiration. + /// - Parameter completion: Optionally; the block invoked when the token is available. Invoked + /// asynchronously on the main thread in the future. @objc(getIDTokenResultForcingRefresh:completion:) open func getIDTokenResult(forcingRefresh: Bool, completion: ((AuthTokenResult?, Error?) -> Void)?) { @@ -664,18 +584,13 @@ extension User: NSSecureCoding {} } } - /** @fn getIDTokenResultForcingRefresh - @brief Retrieves the Firebase authentication token, possibly refreshing it if it has expired. - - @param forceRefresh Forces a token refresh. Useful if the token becomes invalid for some reason - other than an expiration. - @returns The token. - - @remarks The authentication token will be refreshed (by making a network request) if it has - expired, or if `forceRefresh` is YES. - - @remarks See `AuthErrors` for a list of error codes that are common to all API methods. - */ + /// Retrieves the Firebase authentication token, possibly refreshing it if it has expired. + /// + /// The authentication token will be refreshed (by making a network request) if it has + /// expired, or if `forceRefresh` is `true`. + /// - Parameter forceRefresh: Forces a token refresh. Useful if the token becomes invalid for some + /// reason other than an expiration. + /// - Returns: The Firebase authentication token. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func getIDTokenResult(forcingRefresh forceRefresh: Bool = false) async throws -> AuthTokenResult { @@ -690,29 +605,25 @@ extension User: NSSecureCoding {} } } - /** @fn linkWithCredential:completion: - @brief Associates a user account from a third-party identity provider with this user and - returns additional identity provider data. - - @param credential The credential for the identity provider. - @param completion Optionally; the block invoked when the unlinking is complete, or fails. - Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeProviderAlreadyLinked` - Indicates an attempt to link a provider of a - type already linked to this account. - + `AuthErrorCodeCredentialAlreadyInUse` - Indicates an attempt to link with a - credential that has already been linked with a different Firebase account. - + `AuthErrorCodeOperationNotAllowed` - Indicates that accounts with the identity - provider represented by the credential are not enabled. Enable them in the Auth section - of the Firebase console. - - @remarks This method may also return error codes associated with `updateEmail(to:)` and - `updatePassword(to:)` on `User`. - - @remarks See `AuthErrors` for a list of error codes that are common to all `User` methods. - */ + /// Associates a user account from a third-party identity provider with this user and + /// returns additional identity provider data. + /// + /// Invoked asynchronously on the main thread in the future. + /// + /// Possible error codes: + /// * `AuthErrorCodeProviderAlreadyLinked` - Indicates an attempt to link a provider of a + /// type already linked to this account. + /// * `AuthErrorCodeCredentialAlreadyInUse` - Indicates an attempt to link with a + /// credential that has already been linked with a different Firebase account. + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that accounts with the identity + /// provider represented by the credential are not enabled. Enable them in the Auth section + /// of the Firebase console. + /// + /// This method may also return error codes associated with `updateEmail(to:)` and + /// `updatePassword(to:)` on `User`. + /// - Parameter credential: The credential for the identity provider. + /// - Parameter completion: Optionally; the block invoked when the unlinking is complete, or + /// fails. @objc(linkWithCredential:completion:) open func link(with credential: AuthCredential, completion: ((AuthDataResult?, Error?) -> Void)? = nil) { @@ -794,28 +705,24 @@ extension User: NSSecureCoding {} } } - /** @fn linkWithCredential: - @brief Associates a user account from a third-party identity provider with this user and - returns additional identity provider data. - - @param credential The credential for the identity provider. - @returns The AuthDataResult. - - @remarks Possible error codes: - - + `AuthErrorCodeProviderAlreadyLinked` - Indicates an attempt to link a provider of a - type already linked to this account. - + `AuthErrorCodeCredentialAlreadyInUse` - Indicates an attempt to link with a - credential that has already been linked with a different Firebase account. - + `AuthErrorCodeOperationNotAllowed` - Indicates that accounts with the identity - provider represented by the credential are not enabled. Enable them in the Auth section - of the Firebase console. - - @remarks This method may also return error codes associated with `updateEmail(to:)` and - `updatePassword(to:)` on `User`. - - @remarks See `AuthErrors` for a list of error codes that are common to all `User` methods. - */ + /// Associates a user account from a third-party identity provider with this user and + /// returns additional identity provider data. + /// + /// Invoked asynchronously on the main thread in the future. + /// + /// Possible error codes: + /// * `AuthErrorCodeProviderAlreadyLinked` - Indicates an attempt to link a provider of a + /// type already linked to this account. + /// * `AuthErrorCodeCredentialAlreadyInUse` - Indicates an attempt to link with a + /// credential that has already been linked with a different Firebase account. + /// * `AuthErrorCodeOperationNotAllowed` - Indicates that accounts with the identity + /// provider represented by the credential are not enabled. Enable them in the Auth section + /// of the Firebase console. + /// + /// This method may also return error codes associated with `updateEmail(to:)` and + /// `updatePassword(to:)` on `User`. + /// - Parameter credential: The credential for the identity provider. + /// - Returns: An `AuthDataResult`. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @discardableResult open func link(with credential: AuthCredential) async throws -> AuthDataResult { @@ -831,17 +738,15 @@ extension User: NSSecureCoding {} } #if os(iOS) - /** @fn linkWithProvider:UIDelegate:completion: - @brief link the user with the provided auth provider instance. - This method is available on iOSonly. - - @param provider An instance of an auth provider used to initiate the link flow. - @param UIDelegate Optionally an instance of a class conforming to the `AuthUIDelegate` - protocol used for presenting the web context. If nil, a default `AuthUIDelegate` - will be used. - @param completion Optionally; a block which is invoked when the link flow finishes, or - is canceled. Invoked asynchronously on the main thread in the future. - */ + /// Link the user with the provided auth provider instance. + /// + /// This method is available on iOSonly. + /// - Parameter provider: An instance of an auth provider used to initiate the link flow. + /// - Parameter uiDelegate: Optionally an instance of a class conforming to the `AuthUIDelegate` + /// protocol used for presenting the web context. If nil, a default `AuthUIDelegate` will be + /// used. + /// - Parameter completion: Optionally; a block which is invoked when the link flow finishes, or + /// is canceled. Invoked asynchronously on the main thread in the future. @objc(linkWithProvider:UIDelegate:completion:) open func link(with provider: FederatedAuthProvider, uiDelegate: AuthUIDelegate?, @@ -860,16 +765,16 @@ extension User: NSSecureCoding {} } } - /** @fn linkWithProvider:UIDelegate: - @brief link the user with the provided auth provider instance. - This method is available on iOS, macOS Catalyst, and tvOS only. - - @param provider An instance of an auth provider used to initiate the link flow. - @param UIDelegate Optionally an instance of a class conforming to the `AuthUIDelegate` - protocol used for presenting the web context. If nil, a default `AuthUIDelegate` - will be used. - @returns An AuthDataResult. - */ + /// Link the user with the provided auth provider instance. + /// + /// This method is available on iOSonly. + /// - Parameter provider: An instance of an auth provider used to initiate the link flow. + /// - Parameter uiDelegate: Optionally an instance of a class conforming to the `AuthUIDelegate` + /// protocol used for presenting the web context. If nil, a default `AuthUIDelegate` + /// will be used. + /// - Parameter completion: Optionally; a block which is invoked when the link flow finishes, or + /// is canceled. Invoked asynchronously on the main thread in the future. + /// - Returns: An AuthDataResult. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @discardableResult open func link(with provider: FederatedAuthProvider, @@ -886,24 +791,20 @@ extension User: NSSecureCoding {} } #endif - /** @fn unlinkFromProvider:completion: - @brief Disassociates a user account from a third-party identity provider with this user. - - @param provider The provider ID of the provider to unlink. - @param completion Optionally; the block invoked when the unlinking is complete, or fails. - Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeNoSuchProvider` - Indicates an attempt to unlink a provider - that is not linked to the account. - + `AuthErrorCodeRequiresRecentLogin` - Updating email is a security sensitive - operation that requires a recent login from the user. This error indicates the user - has not signed in recently enough. To resolve, reauthenticate the user by calling - `reauthenticate(with:)`. - - @remarks See `AuthErrors` for a list of error codes that are common to all `User` methods. - */ + /// Disassociates a user account from a third-party identity provider with this user. + /// + /// Invoked asynchronously on the main thread in the future. + /// + /// Possible error codes: + /// * `AuthErrorCodeNoSuchProvider` - Indicates an attempt to unlink a provider + /// that is not linked to the account. + /// * `AuthErrorCodeRequiresRecentLogin` - Updating email is a security sensitive + /// operation that requires a recent login from the user. This error indicates the user + /// has not signed in recently enough. To resolve, reauthenticate the user by calling + /// `reauthenticate(with:)`. + /// - Parameter provider: The provider ID of the provider to unlink. + /// - Parameter completion: Optionally; the block invoked when the unlinking is complete, or + /// fails. @objc open func unlink(fromProvider provider: String, completion: ((User?, Error?) -> Void)? = nil) { taskQueue.enqueueTask { complete in @@ -972,23 +873,19 @@ extension User: NSSecureCoding {} } } - /** @fn unlinkFromProvider: - @brief Disassociates a user account from a third-party identity provider with this user. - - @param provider The provider ID of the provider to unlink. - @returns The user. - - @remarks Possible error codes: - - + `AuthErrorCodeNoSuchProvider` - Indicates an attempt to unlink a provider - that is not linked to the account. - + `AuthErrorCodeRequiresRecentLogin` - Updating email is a security sensitive - operation that requires a recent login from the user. This error indicates the user - has not signed in recently enough. To resolve, reauthenticate the user by calling - `reauthenticate(with:)`. - - @remarks See `AuthErrors` for a list of error codes that are common to all `User` methods. - */ + /// Disassociates a user account from a third-party identity provider with this user. + /// + /// Invoked asynchronously on the main thread in the future. + /// + /// Possible error codes: + /// * `AuthErrorCodeNoSuchProvider` - Indicates an attempt to unlink a provider + /// that is not linked to the account. + /// * `AuthErrorCodeRequiresRecentLogin` - Updating email is a security sensitive + /// operation that requires a recent login from the user. This error indicates the user + /// has not signed in recently enough. To resolve, reauthenticate the user by calling + /// `reauthenticate(with:)`. + /// - Parameter provider: The provider ID of the provider to unlink. + /// - Returns: The user. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func unlink(fromProvider provider: String) async throws -> User { return try await withCheckedThrowingContinuation { continuation in @@ -1002,53 +899,37 @@ extension User: NSSecureCoding {} } } - /** @fn sendEmailVerificationWithCompletion: - @brief Initiates email verification for the user. - - @param completion Optionally; the block invoked when the request to send an email verification - is complete, or fails. Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was - sent in the request. - + `AuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in - the console for this action. - + `AuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for - sending update email. - + `AuthErrorCodeUserNotFound` - Indicates the user account was not found. - - @remarks See `AuthErrors` for a list of error codes that are common to all `User` methods. - */ + /// Initiates email verification for the user. + /// + /// Possible error codes: + /// * `AuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was + /// sent in the request. + /// * `AuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in + /// the console for this action. + /// * `AuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for + /// sending update email. + /// * `AuthErrorCodeUserNotFound` - Indicates the user account was not found. + /// - Parameter completion: Optionally; the block invoked when the request to send an email + /// verification is complete, or fails. Invoked asynchronously on the main thread in the future. @objc(sendEmailVerificationWithCompletion:) open func __sendEmailVerification(withCompletion completion: ((Error?) -> Void)?) { sendEmailVerification(completion: completion) } - /** @fn sendEmailVerificationWithActionCodeSettings:completion: - @brief Initiates email verification for the user. - - @param actionCodeSettings An `ActionCodeSettings` object containing settings related to - handling action codes. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was - sent in the request. - + `AuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in - the console for this action. - + `AuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for - sending update email. - + `AuthErrorCodeUserNotFound` - Indicates the user account was not found. - + `AuthErrorCodeMissingIosBundleID` - Indicates that the iOS bundle ID is missing when - a iOS App Store ID is provided. - + `AuthErrorCodeMissingAndroidPackageName` - Indicates that the android package name - is missing when the `androidInstallApp` flag is set to true. - + `AuthErrorCodeUnauthorizedDomain` - Indicates that the domain specified in the - continue URL is not allowlisted in the Firebase console. - + `AuthErrorCodeInvalidContinueURI` - Indicates that the domain specified in the - continue URL is not valid. - */ + /// Initiates email verification for the user. + /// + /// Possible error codes: + /// * `AuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was + /// sent in the request. + /// * `AuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in + /// the console for this action. + /// * `AuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for + /// sending update email. + /// * `AuthErrorCodeUserNotFound` - Indicates the user account was not found. + /// - Parameter actionCodeSettings: An `ActionCodeSettings` object containing settings related to + /// handling action codes. + /// - Parameter completion: Optionally; the block invoked when the request to send an email + /// verification is complete, or fails. Invoked asynchronously on the main thread in the future. @objc(sendEmailVerificationWithActionCodeSettings:completion:) open func sendEmailVerification(with actionCodeSettings: ActionCodeSettings? = nil, completion: ((Error?) -> Void)? = nil) { @@ -1082,30 +963,18 @@ extension User: NSSecureCoding {} } } - /** @fn sendEmailVerificationWithActionCodeSettings: - @brief Initiates email verification for the user. - - @param actionCodeSettings An `ActionCodeSettings` object containing settings related to - handling action codes. - - @remarks Possible error codes: - - + `AuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was - sent in the request. - + `AuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in - the console for this action. - + `AuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for - sending update email. - + `AuthErrorCodeUserNotFound` - Indicates the user account was not found. - + `AuthErrorCodeMissingIosBundleID` - Indicates that the iOS bundle ID is missing when - a iOS App Store ID is provided. - + `AuthErrorCodeMissingAndroidPackageName` - Indicates that the android package name - is missing when the `androidInstallApp` flag is set to true. - + `AuthErrorCodeUnauthorizedDomain` - Indicates that the domain specified in the - continue URL is not allowlisted in the Firebase console. - + `AuthErrorCodeInvalidContinueURI` - Indicates that the domain specified in the - continue URL is not valid. - */ + /// Initiates email verification for the user. + /// + /// Possible error codes: + /// * `AuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was + /// sent in the request. + /// * `AuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in + /// the console for this action. + /// * `AuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for + /// sending update email. + /// * `AuthErrorCodeUserNotFound` - Indicates the user account was not found. + /// - Parameter actionCodeSettings: An `ActionCodeSettings` object containing settings related to + /// handling action codes. The default value is `nil`. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func sendEmailVerification(with actionCodeSettings: ActionCodeSettings? = nil) async throws { return try await withCheckedThrowingContinuation { continuation in @@ -1119,21 +988,15 @@ extension User: NSSecureCoding {} } } - /** @fn deleteWithCompletion: - @brief Deletes the user account (also signs out the user, if this was the current user). - - @param completion Optionally; the block invoked when the request to delete the account is - complete, or fails. Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeRequiresRecentLogin` - Updating email is a security sensitive - operation that requires a recent login from the user. This error indicates the user - has not signed in recently enough. To resolve, reauthenticate the user by calling - `reauthenticate(with:)`. - - @remarks See `AuthErrors` for a list of error codes that are common to all `User` methods. - */ + /// Deletes the user account (also signs out the user, if this was the current user). + /// + /// Possible error codes: + /// * `AuthErrorCodeRequiresRecentLogin` - Updating email is a security sensitive + /// operation that requires a recent login from the user. This error indicates the user + /// has not signed in recently enough. To resolve, reauthenticate the user by calling + /// `reauthenticate(with:)`. + /// - Parameter completion: Optionally; the block invoked when the request to delete the account + /// is complete, or fails. Invoked asynchronously on the main thread in the future. @objc open func delete(completion: ((Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { self.internalGetToken { accessToken, error in @@ -1165,21 +1028,13 @@ extension User: NSSecureCoding {} } } - /** @fn delete - @brief Deletes the user account (also signs out the user, if this was the current user). - - @param completion Optionally; the block invoked when the request to delete the account is - complete, or fails. Invoked asynchronously on the main thread in the future. - - @remarks Possible error codes: - - + `AuthErrorCodeRequiresRecentLogin` - Updating email is a security sensitive - operation that requires a recent login from the user. This error indicates the user - has not signed in recently enough. To resolve, reauthenticate the user by calling - `reauthenticate(with:)`. - - @remarks See `AuthErrors` for a list of error codes that are common to all `User` methods. - */ + /// Deletes the user account (also signs out the user, if this was the current user). + /// + /// Possible error codes: + /// * `AuthErrorCodeRequiresRecentLogin` - Updating email is a security sensitive + /// operation that requires a recent login from the user. This error indicates the user + /// has not signed in recently enough. To resolve, reauthenticate the user by calling + /// `reauthenticate(with:)`. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func delete() async throws { return try await withCheckedThrowingContinuation { continuation in @@ -1193,25 +1048,21 @@ extension User: NSSecureCoding {} } } - /** @fn sendEmailVerificationBeforeUpdatingEmail:completion: - @brief Send an email to verify the ownership of the account then update to the new email. - @param email The email to be updated to. - @param completion Optionally; the block invoked when the request to send the verification - email is complete, or fails. - */ + /// Send an email to verify the ownership of the account then update to the new email. + /// - Parameter email: The email to be updated to. + /// - Parameter completion: Optionally; the block invoked when the request to send the + /// verification email is complete, or fails. @objc(sendEmailVerificationBeforeUpdatingEmail:completion:) open func __sendEmailVerificationBeforeUpdating(email: String, completion: ((Error?) -> Void)?) { sendEmailVerification(beforeUpdatingEmail: email, completion: completion) } - /** @fn sendEmailVerificationBeforeUpdatingEmail:completion: - @brief Send an email to verify the ownership of the account then update to the new email. - @param email The email to be updated to. - @param actionCodeSettings An `ActionCodeSettings` object containing settings related to - handling action codes. - @param completion Optionally; the block invoked when the request to send the verification - email is complete, or fails. - */ + /// Send an email to verify the ownership of the account then update to the new email. + /// - Parameter email: The email to be updated to. + /// - Parameter actionCodeSettings: An `ActionCodeSettings` object containing settings related to + /// handling action codes. + /// - Parameter completion: Optionally; the block invoked when the request to send the + /// verification email is complete, or fails. @objc open func sendEmailVerification(beforeUpdatingEmail email: String, actionCodeSettings: ActionCodeSettings? = nil, completion: ((Error?) -> Void)? = nil) { @@ -1245,13 +1096,10 @@ extension User: NSSecureCoding {} } } - /** @fn sendEmailVerificationBeforeUpdatingEmail:completion: - @brief Send an email to verify the ownership of the account then update to the new email. - @param email The email to be updated to. - @param actionCodeSettings An `ActionCodeSettings` object containing settings related to - handling action codes. - @throws on failure. - */ + /// Send an email to verify the ownership of the account then update to the new email. + /// - Parameter email: The email to be updated to. + /// - Parameter actionCodeSettings: An `ActionCodeSettings` object containing settings related to + /// handling action codes. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func sendEmailVerification(beforeUpdatingEmail newEmail: String, actionCodeSettings: ActionCodeSettings? = nil) async throws { @@ -1267,16 +1115,16 @@ extension User: NSSecureCoding {} } } - @objc open func rawAccessToken() -> String { + // MARK: Internal implementations below + + func rawAccessToken() -> String { return tokenService.accessToken } - @objc open func accessTokenExpirationDate() -> Date? { + func accessTokenExpirationDate() -> Date? { return tokenService.accessTokenExpirationDate } - // MARK: Internal implementations below - init(withTokenService tokenService: SecureTokenService) { providerDataRaw = [:] taskQueue = AuthSerialTaskQueue() @@ -1325,57 +1173,39 @@ extension User: NSSecureCoding {} return "Firebase" } - /** @property uid - @brief The provider's user ID for the user. - */ + /// The provider's user ID for the user. @objc open var uid: String? - /** @property displayName - @brief The name of the user. - */ + /// The name of the user. @objc open var displayName: String? - /** @property photoURL - @brief The URL of the user's profile photo. - */ + /// The URL of the user's profile photo. @objc open var photoURL: URL? - /** @property email - @brief The user's email address. - */ + /// The user's email address. @objc open var email: String? - /** @property phoneNumber - @brief A phone number associated with the user. - @remarks This property is only available for users authenticated via phone number auth. - */ + /// A phone number associated with the user. + /// + /// This property is only available for users authenticated via phone number auth. @objc open var phoneNumber: String? - /** @var hasEmailPasswordCredential - @brief Whether or not the user can be authenticated by using Firebase email and password. - */ + /// Whether or not the user can be authenticated by using Firebase email and password. private var hasEmailPasswordCredential: Bool - /** @var _taskQueue - @brief Used to serialize the update profile calls. - */ + /// Used to serialize the update profile calls. private var taskQueue: AuthSerialTaskQueue - /** @property requestConfiguration - @brief A strong reference to a requestConfiguration instance associated with this user instance. - */ + /// A strong reference to a requestConfiguration instance associated with this user instance. var requestConfiguration: AuthRequestConfiguration - /** @var _tokenService - @brief A secure token service associated with this user. For performing token exchanges and - refreshing access tokens. - */ + /// A secure token service associated with this user. For performing token exchanges and + /// refreshing access tokens. var tokenService: SecureTokenService private weak var _auth: Auth? - /** @property auth - @brief A weak reference to a FIRAuth instance associated with this instance. - */ + + /// A weak reference to an `Auth` instance associated with this instance. weak var auth: Auth? { set { _auth = newValue @@ -1467,13 +1297,11 @@ extension User: NSSecureCoding {} } } - /** @fn executeUserUpdateWithChanges:callback: - @brief Performs a setAccountInfo request by mutating the results of a getAccountInfo response, - atomically in regards to other calls to this method. - @param changeBlock A block responsible for mutating a template @c FIRSetAccountInfoRequest - @param callback A block to invoke when the change is complete. Invoked asynchronously on the - auth global work queue in the future. - */ + /// Performs a setAccountInfo request by mutating the results of a getAccountInfo response, + /// atomically in regards to other calls to this method. + /// - Parameter changeBlock: A block responsible for mutating a template `SetAccountInfoRequest` + /// - Parameter callback: A block to invoke when the change is complete. Invoked asynchronously on + /// the auth global work queue in the future. func executeUserUpdateWithChanges(changeBlock: @escaping (GetAccountInfoResponseUser, SetAccountInfoRequest) -> Void, callback: @escaping (Error?) -> Void) { @@ -1529,13 +1357,12 @@ extension User: NSSecureCoding {} } } - /** @fn setTokenService:callback: - @brief Sets a new token service for the @c FIRUser instance. - @param tokenService The new token service object. - @param callback The block to be called in the global auth working queue once finished. - @remarks The method makes sure the token service has access and refresh token and the new tokens - are saved in the keychain before calling back. - */ + /// Sets a new token service for the `User` instance. + /// + /// The method makes sure the token service has access and refresh token and the new tokens + /// are saved in the keychain before calling back. + /// - Parameter tokenService: The new token service object. + /// - Parameter callback: The block to be called in the global auth working queue once finished. private func setTokenService(tokenService: SecureTokenService, callback: @escaping (Error?) -> Void) { tokenService.fetchAccessToken(forcingRefresh: false) { token, error, tokenUpdated in @@ -1552,11 +1379,9 @@ extension User: NSSecureCoding {} } } - /** @fn getAccountInfoRefreshingCache: - @brief Gets the users's account data from the server, updating our local values. - @param callback Invoked when the request to getAccountInfo has completed, or when an error has - been detected. Invoked asynchronously on the auth global work queue in the future. - */ + /// Gets the users' account data from the server, updating our local values. + /// - Parameter callback: Invoked when the request to getAccountInfo has completed, or when an + /// error has been detected. Invoked asynchronously on the auth global work queue in the future. private func getAccountInfoRefreshingCache(callback: @escaping (GetAccountInfoResponseUser?, Error?) -> Void) { internalGetToken { token, error in @@ -1624,17 +1449,16 @@ extension User: NSSecureCoding {} } #if os(iOS) - /** @fn internalUpdateOrLinkPhoneNumber - @brief Updates the phone number for the user. On success, the cached user profile data is - updated. - - @param phoneAuthCredential The new phone number credential corresponding to the phone number - to be added to the Firebase account, if a phone number is already linked to the account this - new phone number will replace it. - @param isLinkOperation Boolean value indicating whether or not this is a link operation. - @param completion Optionally; the block invoked when the user profile change has finished. - Invoked asynchronously on the global work queue in the future. - */ + /// Updates the phone number for the user. On success, the cached user profile data is updated. + /// + /// Invoked asynchronously on the global work queue in the future. + /// - Parameter credential: The new phone number credential corresponding to the phone + /// number to be added to the Firebase account. If a phone number is already linked to the + /// account, this new phone number will replace it. + /// - Parameter isLinkOperation: Boolean value indicating whether or not this is a link + /// operation. + /// - Parameter completion: Optionally; the block invoked when the user profile change has + /// finished. private func internalUpdateOrLinkPhoneNumber(credential: PhoneAuthCredential, isLinkOperation: Bool, completion: @escaping (Error?) -> Void) { @@ -1956,10 +1780,8 @@ extension User: NSSecureCoding {} } } - /** @fn signOutIfTokenIsInvalidWithError: - @brief Signs out this user if the user or the token is invalid. - @param error The error from the server. - */ + /// Signs out this user if the user or the token is invalid. + /// - Parameter error: The error from the server. private func signOutIfTokenIsInvalid(withError error: Error) { guard let uid else { return @@ -1975,11 +1797,9 @@ extension User: NSSecureCoding {} } } - /** @fn internalGetToken - @brief Retrieves the Firebase authentication token, possibly refreshing it if it has expired. - @param callback The block to invoke when the token is available. Invoked asynchronously on the - global work thread in the future. - */ + /// Retrieves the Firebase authentication token, possibly refreshing it if it has expired. + /// - Parameter callback: The block to invoke when the token is available. Invoked asynchronously + /// on the global work thread in the future. func internalGetToken(forceRefresh: Bool = false, callback: @escaping (String?, Error?) -> Void) { tokenService.fetchAccessToken(forcingRefresh: forceRefresh) { token, error, tokenUpdated in @@ -2010,20 +1830,16 @@ extension User: NSSecureCoding {} } } - /** @fn updateKeychain: - @brief Updates the keychain for user token or info changes. - @param error The error if NO is returned. - @return Whether the operation is successful. - */ + /// Updates the keychain for user token or info changes. + /// - Returns: An `Error` on failure. func updateKeychain() -> Error? { return auth?.updateKeychain(withUser: self) } - /** @fn callInMainThreadWithError - @brief Calls a callback in main thread with error. - @param callback The callback to be called in main thread. - @param error The error to pass to callback. - */ + /// Calls a callback in main thread with error. + /// - Parameter callback: The callback to be called in main thread. + /// - Parameter error: The error to pass to callback. + class func callInMainThreadWithError(callback: ((Error?) -> Void)?, error: Error?) { if let callback { DispatchQueue.main.async { @@ -2032,12 +1848,10 @@ extension User: NSSecureCoding {} } } - /** @fn callInMainThreadWithUserAndError - @brief Calls a callback in main thread with user and error. - @param callback The callback to be called in main thread. - @param user The user to pass to callback if there is no error. - @param error The error to pass to callback. - */ + /// Calls a callback in main thread with user and error. + /// - Parameter callback: The callback to be called in main thread. + /// - Parameter user: The user to pass to callback if there is no error. + /// - Parameter error: The error to pass to callback. private class func callInMainThreadWithUserAndError(callback: ((User?, Error?) -> Void)?, user: User, error: Error?) { @@ -2048,12 +1862,8 @@ extension User: NSSecureCoding {} } } - /** @fn callInMainThreadWithAuthDataResultAndError - @brief Calls a callback in main thread with user and error. - @param callback The callback to be called in main thread. - @param result The result to pass to callback if there is no error. - @param error The error to pass to callback. - */ + /// Calls a callback in main thread with user and error. + /// - Parameter callback: The callback to be called in main thread. private class func callInMainThreadWithAuthDataResultAndError(callback: ( (AuthDataResult?, Error?) -> Void )?, diff --git a/FirebaseAuth/Sources/Swift/User/UserInfo.swift b/FirebaseAuth/Sources/Swift/User/UserInfo.swift index 65e244ba6c7..9ce14dcb26a 100644 --- a/FirebaseAuth/Sources/Swift/User/UserInfo.swift +++ b/FirebaseAuth/Sources/Swift/User/UserInfo.swift @@ -14,38 +14,25 @@ import Foundation -/** - @brief Represents user data returned from an identity provider. - */ +/// Represents user data returned from an identity provider. @objc(FIRUserInfo) public protocol UserInfo: NSObjectProtocol { - /** @property providerID - @brief The provider identifier. - */ + /// The provider identifier. var providerID: String { get } - /** @property uid - @brief The provider's user ID for the user. - */ + /// The provider's user ID for the user. var uid: String? { get } - /** @property displayName - @brief The name of the user. - */ + /// The name of the user. var displayName: String? { get } - /** @property photoURL - @brief The URL of the user's profile photo. - */ + /// The URL of the user's profile photo. var photoURL: URL? { get } - /** @property email - @brief The user's email address. - */ + /// The user's email address. var email: String? { get } - /** @property phoneNumber - @brief A phone number associated with the user. - @remarks This property is only available for users authenticated via phone number auth. - */ + /// A phone number associated with the user. + /// + /// This property is only available for users authenticated via phone number auth. var phoneNumber: String? { get } } diff --git a/FirebaseAuth/Sources/Swift/User/UserInfoImpl.swift b/FirebaseAuth/Sources/Swift/User/UserInfoImpl.swift index ad3e4acca89..5e68a2d2cb7 100644 --- a/FirebaseAuth/Sources/Swift/User/UserInfoImpl.swift +++ b/FirebaseAuth/Sources/Swift/User/UserInfoImpl.swift @@ -17,12 +17,10 @@ import Foundation extension UserInfoImpl: NSSecureCoding {} @objc(FIRUserInfoImpl) class UserInfoImpl: NSObject, UserInfo { - /** @fn userInfoWithGetAccountInfoResponseProviderUserInfo: - @brief A convenience factory method for constructing a @c FIRUserInfo instance from data - returned by the getAccountInfo endpoint. - @param providerUserInfo Data returned by the getAccountInfo endpoint. - @return A new instance of @c FIRUserInfo using data from the getAccountInfo endpoint. - */ + /// A convenience factory method for constructing a `UserInfo` instance from data + /// returned by the getAccountInfo endpoint. + /// - Parameter providerUserInfo: Data returned by the getAccountInfo endpoint. + /// - Returns: A new instance of `UserInfo` using data from the getAccountInfo endpoint. class func userInfo(withGetAccountInfoResponseProviderUserInfo providerUserInfo: GetAccountInfoResponseProviderUserInfo) -> UserInfoImpl { guard let providerID = providerUserInfo.providerID else { @@ -37,15 +35,13 @@ extension UserInfoImpl: NSSecureCoding {} phoneNumber: providerUserInfo.phoneNumber) } - /** @fn initWithProviderID:userID:displayName:photoURL:email: - @brief Designated initializer. - @param providerID The provider identifier. - @param userID The unique user ID for the user (the value of the @c uid field in the token.) - @param displayName The name of the user. - @param photoURL The URL of the user's profile photo. - @param email The user's email address. - @param phoneNumber The user's phone number. - */ + /// Designated initializer. + /// - Parameter providerID: The provider identifier. + /// - Parameter userID: The unique user ID for the user (the value of the uid field in the token.) + /// - Parameter displayName: The name of the user. + /// - Parameter photoURL: The URL of the user's profile photo. + /// - Parameter email: The user's email address. + /// - Parameter phoneNumber: The user's phone number. private init(withProviderID providerID: String, userID: String?, displayName: String?, diff --git a/FirebaseAuth/Sources/Swift/User/UserMetadata.swift b/FirebaseAuth/Sources/Swift/User/UserMetadata.swift index bff7875625c..b126350c449 100644 --- a/FirebaseAuth/Sources/Swift/User/UserMetadata.swift +++ b/FirebaseAuth/Sources/Swift/User/UserMetadata.swift @@ -14,23 +14,16 @@ import Foundation -/** @class UserMetadata - @brief A data class representing the metadata corresponding to a Firebase user. - */ - @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) extension UserMetadata: NSSecureCoding {} +/// A data class representing the metadata corresponding to a Firebase user. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRUserMetadata) open class UserMetadata: NSObject { - /** @property lastSignInDate - @brief Stores the last sign in date for the corresponding Firebase user. - */ + /// Stores the last sign in date for the corresponding Firebase user. @objc public let lastSignInDate: Date? - /** @property creationDate - @brief Stores the creation date for the corresponding Firebase user. - */ + /// Stores the creation date for the corresponding Firebase user. @objc public let creationDate: Date? init(withCreationDate creationDate: Date?, lastSignInDate: Date?) { diff --git a/FirebaseAuth/Sources/Swift/User/UserProfileChangeRequest.swift b/FirebaseAuth/Sources/Swift/User/UserProfileChangeRequest.swift index d73da417a1c..493f3d80f92 100644 --- a/FirebaseAuth/Sources/Swift/User/UserProfileChangeRequest.swift +++ b/FirebaseAuth/Sources/Swift/User/UserProfileChangeRequest.swift @@ -14,16 +14,13 @@ import Foundation -/** @class UserProfileChangeRequest - @brief Represents an object capable of updating a user's profile data. - @remarks Properties are marked as being part of a profile update when they are set. Setting a - property value to nil is not the same as leaving the property unassigned. - */ +/// Represents an object capable of updating a user's profile data. +/// +/// Properties are marked as being part of a profile update when they are set. Setting a +/// property value to nil is not the same as leaving the property unassigned. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) @objc(FIRUserProfileChangeRequest) open class UserProfileChangeRequest: NSObject { - /** @property displayName - @brief The name of the user. - */ + /// The name of the user. @objc open var displayName: String? { get { return _displayName } set(newDisplayName) { @@ -39,9 +36,7 @@ import Foundation private var _displayName: String? - /** @property photoURL - @brief The URL of the user's profile photo. - */ + /// The URL of the user's profile photo. @objc open var photoURL: URL? { get { return _photoURL } set(newPhotoURL) { @@ -57,14 +52,13 @@ import Foundation private var _photoURL: URL? - /** @fn commitChangesWithCompletion: - @brief Commits any pending changes. - @remarks This method should only be called once. Once called, property values should not be - changed. - - @param completion Optionally; the block invoked when the user profile change has been applied. - Invoked asynchronously on the main thread in the future. - */ + /// Commits any pending changes. + /// + /// Invoked asynchronously on the main thread in the future. + /// + /// This method should only be called once.Once called, property values should not be changed. + /// - Parameter completion: Optionally; the block invoked when the user profile change has been + /// applied. @objc open func commitChanges(completion: ((Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { if self.consumed { @@ -107,13 +101,9 @@ import Foundation } } - /** @fn commitChanges - @brief Commits any pending changes. - @remarks This method should only be called once. Once called, property values should not be - changed. - - @throws on error. - */ + /// Commits any pending changes. + /// + /// This method should only be called once. Once called, property values should not be changed. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) open func commitChanges() async throws { return try await withCheckedThrowingContinuation { continuation in diff --git a/FirebaseAuth/Sources/Swift/Utilities/AuthDefaultUIDelegate.swift b/FirebaseAuth/Sources/Swift/Utilities/AuthDefaultUIDelegate.swift index 55d8a880801..6e7a5b30a57 100644 --- a/FirebaseAuth/Sources/Swift/Utilities/AuthDefaultUIDelegate.swift +++ b/FirebaseAuth/Sources/Swift/Utilities/AuthDefaultUIDelegate.swift @@ -22,16 +22,13 @@ @_implementationOnly import GoogleUtilities_Environment #endif - /** @class AuthDefaultUIDelegate - @brief Class responsible for providing a default FIRAuthUIDelegate. - @remarks This class should be used in the case that a UIDelegate was expected and necessary to - continue a given flow, but none was provided. - */ + /// Class responsible for providing a default AuthUIDelegate. + /// + /// This class should be used in the case that a UIDelegate was expected and necessary to + /// continue a given flow, but none was provided. class AuthDefaultUIDelegate: NSObject, AuthUIDelegate { - /** @fn defaultUIDelegate - @brief Returns a default FIRAuthUIDelegate object. - @return The default FIRAuthUIDelegate object. - */ + /// Returns a default AuthUIDelegate object. + /// - Returns: The default AuthUIDelegate object. class func defaultUIDelegate() -> AuthUIDelegate? { if GULAppEnvironmentUtil.isAppExtension() { // iOS App extensions should not call [UIApplication sharedApplication], even if diff --git a/FirebaseAuth/Sources/Swift/Utilities/AuthErrorUtils.swift b/FirebaseAuth/Sources/Swift/Utilities/AuthErrorUtils.swift index 0496997fc33..353e21aa67a 100644 --- a/FirebaseAuth/Sources/Swift/Utilities/AuthErrorUtils.swift +++ b/FirebaseAuth/Sources/Swift/Utilities/AuthErrorUtils.swift @@ -16,21 +16,15 @@ import Foundation // MARK: - URL response error codes -/** @var kURLResponseErrorCodeInvalidClientID - @brief Error code that indicates that the client ID provided was invalid. - */ +/// Error code that indicates that the client ID provided was invalid. private let kURLResponseErrorCodeInvalidClientID = "auth/invalid-oauth-client-id" -/** @var kURLResponseErrorCodeNetworkRequestFailed - @brief Error code that indicates that a network request within the SFSafariViewController or - WKWebView failed. - */ +/// Error code that indicates that a network request within the SFSafariViewController or WKWebView +/// failed. private let kURLResponseErrorCodeNetworkRequestFailed = "auth/network-request-failed" -/** @var kURLResponseErrorCodeInternalError - @brief Error code that indicates that an internal error occurred within the - SFSafariViewController or WKWebView failed. - */ +/// Error code that indicates that an internal error occurred within the +/// SFSafariViewController or WKWebView failed. private let kURLResponseErrorCodeInternalError = "auth/internal-error" private let kFIRAuthErrorMessageMalformedJWT = @@ -42,10 +36,8 @@ class AuthErrorUtils: NSObject { static let userInfoDeserializedResponseKey = "FIRAuthErrorUserInfoDeserializedResponseKey" static let userInfoDataKey = "FIRAuthErrorUserInfoDataKey" - /** @var kServerErrorDetailMarker - @brief This marker indicates that the server error message contains a detail error message which - should be used instead of the hardcoded client error message. - */ + /// This marker indicates that the server error message contains a detail error message which + /// should be used instead of the hardcoded client error message. private static let kServerErrorDetailMarker = " : " static func error(code: SharedErrorCode, userInfo: [String: Any]? = nil) -> Error { diff --git a/FirebaseAuth/Sources/Swift/Utilities/AuthErrors.swift b/FirebaseAuth/Sources/Swift/Utilities/AuthErrors.swift index ac12c7e459e..d0ab6604c2a 100644 --- a/FirebaseAuth/Sources/Swift/Utilities/AuthErrors.swift +++ b/FirebaseAuth/Sources/Swift/Utilities/AuthErrors.swift @@ -14,575 +14,466 @@ import Foundation -/* - @remarks Error Codes common to all API Methods: - - + `FIRAuthErrorCodeNetworkError` - + `FIRAuthErrorCodeUserNotFound` - + `FIRAuthErrorCodeUserTokenExpired` - + `FIRAuthErrorCodeTooManyRequests` - + `FIRAuthErrorCodeInvalidAPIKey` - + `FIRAuthErrorCodeAppNotAuthorized` - + `FIRAuthErrorCodeKeychainError` - + `FIRAuthErrorCodeInternalError` - - @remarks Common error codes for `FIRUser` operations: - - + `FIRAuthErrorCodeInvalidUserToken` - + `FIRAuthErrorCodeUserDisabled` - */ +/// Error Codes common to all API Methods: @objc(FIRAuthErrors) open class AuthErrors: NSObject { + /// The Firebase Auth error domain. @objc public static let domain: String = "FIRAuthErrorDomain" + /// The name of the key for the error short string of an error code. @objc public static let userInfoNameKey: String = "FIRAuthErrorUserInfoNameKey" - /** - @brief Errors with one of the following three codes: - - `FIRAuthErrorCodeAccountExistsWithDifferentCredential` - - `FIRAuthErrorCodeCredentialAlreadyInUse` - - `FIRAuthErrorCodeEmailAlreadyInUse` - may contain an `NSError.userInfo` dictinary object which contains this key. The value - associated with this key is an NSString of the email address of the account that already - exists. - */ + /// Error codes for Email operations + /// + /// Errors with one of the following three codes: + /// * `accountExistsWithDifferentCredential` + /// * `credentialAlreadyInUse` + /// * emailAlreadyInUse` + /// + /// may contain an `NSError.userInfo` dictionary object which contains this key. The value + /// associated with this key is an NSString of the email address of the account that already + /// exists. @objc public static let userInfoEmailKey: String = "FIRAuthErrorUserInfoEmailKey" - /** - @brief The key used to read the updated Auth credential from the userInfo dictionary of the - NSError object returned. This is the updated auth credential the developer should use for - recovery if applicable. - */ + /// The key used to read the updated Auth credential from the userInfo dictionary of the + /// NSError object returned. This is the updated auth credential the developer should use for + /// recovery if applicable. @objc public static let userInfoUpdatedCredentialKey: String = "FIRAuthErrorUserInfoUpdatedCredentialKey" - /** - @brief The key used to read the MFA resolver from the userInfo dictionary of the NSError object - returned when 2FA is required for sign-incompletion. - */ + /// The key used to read the MFA resolver from the userInfo dictionary of the NSError object + /// returned when 2FA is required for sign-incompletion. @objc(FIRAuthErrorUserInfoMultiFactorResolverKey) public static let userInfoMultiFactorResolverKey: String = "FIRAuthErrorUserInfoMultiFactorResolverKey" } +/// Error codes used by Firebase Auth. @objc(FIRAuthErrorCode) public enum AuthErrorCode: Int { - /** Indicates a validation error with the custom token. - */ + /// Indicates a validation error with the custom token. case invalidCustomToken = 17000 - /** Indicates the service account and the API key belong to different projects. - */ + + /// Indicates the service account and the API key belong to different projects. case customTokenMismatch = 17002 - /** Indicates the IDP token or requestUri is invalid. - */ + /// Indicates the IDP token or requestUri is invalid. case invalidCredential = 17004 - /** Indicates the user's account is disabled on the server. - */ + /// Indicates the user's account is disabled on the server. case userDisabled = 17005 - /** Indicates the administrator disabled sign in with the specified identity provider. - */ + /// Indicates the administrator disabled sign in with the specified identity provider. case operationNotAllowed = 17006 - /** Indicates the email used to attempt a sign up is already in use. - */ + /// Indicates the email used to attempt a sign up is already in use. case emailAlreadyInUse = 17007 - /** Indicates the email is invalid. - */ + /// Indicates the email is invalid. case invalidEmail = 17008 - /** Indicates the user attempted sign in with a wrong password. - */ + /// Indicates the user attempted sign in with a wrong password. case wrongPassword = 17009 - /** Indicates that too many requests were made to a server method. - */ + /// Indicates that too many requests were made to a server method. case tooManyRequests = 17010 - /** Indicates the user account was not found. - */ + /// Indicates the user account was not found. case userNotFound = 17011 - /** Indicates account linking is required. - */ + /// Indicates account linking is required. case accountExistsWithDifferentCredential = 17012 - /** Indicates the user has attemped to change email or password more than 5 minutes after - signing in. - */ + /// Indicates the user has attemped to change email or password more than 5 minutes after + /// signing in. case requiresRecentLogin = 17014 - /** Indicates an attempt to link a provider to which the account is already linked. - */ + /// Indicates an attempt to link a provider to which the account is already linked. case providerAlreadyLinked = 17015 - /** Indicates an attempt to unlink a provider that is not linked. - */ + /// Indicates an attempt to unlink a provider that is not linked. case noSuchProvider = 17016 - /** Indicates user's saved auth credential is invalid the user needs to sign in again. - */ + /// Indicates user's saved auth credential is invalid the user needs to sign in again. case invalidUserToken = 17017 - /** Indicates a network error occurred (such as a timeout interrupted connection or - unreachable host). These types of errors are often recoverable with a retry. The - `NSUnderlyingError` field in the `NSError.userInfo` dictionary will contain the error - encountered. - */ + /// Indicates a network error occurred (such as a timeout interrupted connection or + /// unreachable host). These types of errors are often recoverable with a retry. The + /// `NSUnderlyingError` field in the `NSError.userInfo` dictionary will contain the error + /// encountered. case networkError = 17020 - /** Indicates the saved token has expired for example the user may have changed account - password on another device. The user needs to sign in again on the device that made this - request. - */ + /// Indicates the saved token has expired for example the user may have changed account + /// password on another device. The user needs to sign in again on the device that made this + /// request. case userTokenExpired = 17021 - /** Indicates an invalid API key was supplied in the request. - */ + /// Indicates an invalid API key was supplied in the request. case invalidAPIKey = 17023 - /** Indicates that an attempt was made to reauthenticate with a user which is not the current - user. - */ + /// Indicates that an attempt was made to reauthenticate with a user which is not the current + /// user. case userMismatch = 17024 - /** Indicates an attempt to link with a credential that has already been linked with a - different Firebase account - */ + /// Indicates an attempt to link with a credential that has already been linked with a + /// different Firebase account. case credentialAlreadyInUse = 17025 - /** Indicates an attempt to set a password that is considered too weak. - */ + /// Indicates an attempt to set a password that is considered too weak. case weakPassword = 17026 - /** Indicates the App is not authorized to use Firebase Authentication with the - provided API Key. - */ + /// Indicates the App is not authorized to use Firebase Authentication with the + /// provided API Key. case appNotAuthorized = 17028 - /** Indicates the OOB code is expired. - */ + /// Indicates the OOB code is expired. case expiredActionCode = 17029 - /** Indicates the OOB code is invalid. - */ + /// Indicates the OOB code is invalid. case invalidActionCode = 17030 - /** Indicates that there are invalid parameters in the payload during a "send password reset - * email" attempt. - */ + /// Indicates that there are invalid parameters in the payload during a + /// "send password reset email" attempt. case invalidMessagePayload = 17031 - /** Indicates that the sender email is invalid during a "send password reset email" attempt. - */ + /// Indicates that the sender email is invalid during a "send password reset email" attempt. case invalidSender = 17032 - /** Indicates that the recipient email is invalid. - */ + /// Indicates that the recipient email is invalid. case invalidRecipientEmail = 17033 - /** Indicates that an email address was expected but one was not provided. - */ + /// Indicates that an email address was expected but one was not provided. case missingEmail = 17034 // The enum values 17035 is reserved and should NOT be used for new error codes. - /** Indicates that the iOS bundle ID is missing when a iOS App Store ID is provided. - */ + /// Indicates that the iOS bundle ID is missing when a iOS App Store ID is provided. case missingIosBundleID = 17036 - /** Indicates that the android package name is missing when the `androidInstallApp` flag is set - to true. - */ + /// Indicates that the android package name is missing when the `androidInstallApp` flag is set + /// to `true`. case missingAndroidPackageName = 17037 - /** Indicates that the domain specified in the continue URL is not allowlisted in the Firebase - console. - */ + /// Indicates that the domain specified in the continue URL is not allowlisted in the Firebase + /// console. case unauthorizedDomain = 17038 - /** Indicates that the domain specified in the continue URI is not valid. - */ + /// Indicates that the domain specified in the continue URI is not valid. case invalidContinueURI = 17039 - /** Indicates that a continue URI was not provided in a request to the backend which requires - one. - */ + /// Indicates that a continue URI was not provided in a request to the backend which requires one. case missingContinueURI = 17040 - /** Indicates that a phone number was not provided in a call to - `verifyPhoneNumber:completion:`. - */ + /// Indicates that a phone number was not provided in a call to + /// `verifyPhoneNumber:completion:`. case missingPhoneNumber = 17041 - /** Indicates that an invalid phone number was provided in a call to - `verifyPhoneNumber:completion:`. - */ + /// Indicates that an invalid phone number was provided in a call to + /// `verifyPhoneNumber:completion:`. case invalidPhoneNumber = 17042 - /** Indicates that the phone auth credential was created with an empty verification code. - */ + /// Indicates that the phone auth credential was created with an empty verification code. case missingVerificationCode = 17043 - /** Indicates that an invalid verification code was used in the verifyPhoneNumber request. - */ + /// Indicates that an invalid verification code was used in the verifyPhoneNumber request. case invalidVerificationCode = 17044 - /** Indicates that the phone auth credential was created with an empty verification ID. - */ + /// Indicates that the phone auth credential was created with an empty verification ID. case missingVerificationID = 17045 - /** Indicates that an invalid verification ID was used in the verifyPhoneNumber request. - */ + /// Indicates that an invalid verification ID was used in the verifyPhoneNumber request. case invalidVerificationID = 17046 - /** Indicates that the APNS device token is missing in the verifyClient request. - */ + /// Indicates that the APNS device token is missing in the verifyClient request. case missingAppCredential = 17047 - /** Indicates that an invalid APNS device token was used in the verifyClient request. - */ + /// Indicates that an invalid APNS device token was used in the verifyClient request. case invalidAppCredential = 17048 // The enum values between 17048 and 17051 are reserved and should NOT be used for new error // codes. - /** Indicates that the SMS code has expired. - */ + /// Indicates that the SMS code has expired. case sessionExpired = 17051 - /** Indicates that the quota of SMS messages for a given project has been exceeded. - */ + /// Indicates that the quota of SMS messages for a given project has been exceeded. case quotaExceeded = 17052 - /** Indicates that the APNs device token could not be obtained. The app may not have set up - remote notification correctly or may fail to forward the APNs device token to FIRAuth - if app delegate swizzling is disabled. - */ + /// Indicates that the APNs device token could not be obtained. The app may not have set up + /// remote notification correctly or may fail to forward the APNs device token to Auth + /// if app delegate swizzling is disabled. case missingAppToken = 17053 - /** Indicates that the app fails to forward remote notification to FIRAuth. - */ + /// Indicates that the app fails to forward remote notification to FIRAuth. case notificationNotForwarded = 17054 - /** Indicates that the app could not be verified by Firebase during phone number authentication. - */ + /// Indicates that the app could not be verified by Firebase during phone number authentication. case appNotVerified = 17055 - /** Indicates that the reCAPTCHA token is not valid. - */ + /// Indicates that the reCAPTCHA token is not valid. case captchaCheckFailed = 17056 - /** Indicates that an attempt was made to present a new web context while one was already being - presented. - */ + /// Indicates that an attempt was made to present a new web context while one was already being + /// presented. case webContextAlreadyPresented = 17057 - /** Indicates that the URL presentation was cancelled prematurely by the user. - */ + /// Indicates that the URL presentation was cancelled prematurely by the user. case webContextCancelled = 17058 - /** Indicates a general failure during the app verification flow. - */ + /// Indicates a general failure during the app verification flow. case appVerificationUserInteractionFailure = 17059 - /** Indicates that the clientID used to invoke a web flow is invalid. - */ + /// Indicates that the clientID used to invoke a web flow is invalid. case invalidClientID = 17060 - /** Indicates that a network request within a SFSafariViewController or WKWebView failed. - */ + /// Indicates that a network request within a SFSafariViewController or WKWebView failed. case webNetworkRequestFailed = 17061 - /** Indicates that an internal error occurred within a SFSafariViewController or WKWebView. - */ + /// Indicates that an internal error occurred within a SFSafariViewController or WKWebView. case webInternalError = 17062 - /** Indicates a general failure during a web sign-in flow. - */ + /// Indicates a general failure during a web sign-in flow. case webSignInUserInteractionFailure = 17063 - /** Indicates that the local player was not authenticated prior to attempting Game Center - signin. - */ + /// Indicates that the local player was not authenticated prior to attempting Game Center signin. case localPlayerNotAuthenticated = 17066 - /** Indicates that a non-null user was expected as an argmument to the operation but a null - user was provided. - */ + /// Indicates that a non-null user was expected as an argmument to the operation but a null + /// user was provided. case nullUser = 17067 - /** Indicates that a Firebase Dynamic Link is not activated. - */ + /// Indicates that a Firebase Dynamic Link is not activated. case dynamicLinkNotActivated = 17068 - /** - * Represents the error code for when the given provider id for a web operation is invalid. - */ + /// Represents the error code for when the given provider id for a web operation is invalid. case invalidProviderID = 17071 - /** - * Represents the error code for when an attempt is made to update the current user with a - * tenantId that differs from the current FirebaseAuth instance's tenantId. - */ + /// Represents the error code for when an attempt is made to update the current user with a + /// tenantId that differs from the current FirebaseAuth instance's tenantId. case tenantIDMismatch = 17072 - /** - * Represents the error code for when a request is made to the backend with an associated tenant - * ID for an operation that does not support multi-tenancy. - */ + /// Represents the error code for when a request is made to the backend with an associated tenant + /// ID for an operation that does not support multi-tenancy. case unsupportedTenantOperation = 17073 - /** Indicates that the Firebase Dynamic Link domain used is either not configured or is - unauthorized for the current project. - */ + /// Indicates that the Firebase Dynamic Link domain used is either not configured or is + /// unauthorized for the current project. case invalidDynamicLinkDomain = 17074 - /** Indicates that the credential is rejected because it's misformed or mismatching. - */ + /// Indicates that the credential is rejected because it's misformed or mismatching. case rejectedCredential = 17075 - /** Indicates that the GameKit framework is not linked prior to attempting Game Center signin. - */ + /// Indicates that the GameKit framework is not linked prior to attempting Game Center signin. case gameKitNotLinked = 17076 - /** Indicates that the second factor is required for signin. - */ + /// Indicates that the second factor is required for signin. case secondFactorRequired = 17078 - /** Indicates that the multi factor session is missing. - */ + /// Indicates that the multi factor session is missing. case missingMultiFactorSession = 17081 - /** Indicates that the multi factor info is missing. - */ + /// Indicates that the multi factor info is missing. case missingMultiFactorInfo = 17082 - /** Indicates that the multi factor session is invalid. - */ + /// Indicates that the multi factor session is invalid. case invalidMultiFactorSession = 17083 - /** Indicates that the multi factor info is not found. - */ + /// Indicates that the multi factor info is not found. case multiFactorInfoNotFound = 17084 - /** Indicates that the operation is admin restricted. - */ + /// Indicates that the operation is admin restricted. case adminRestrictedOperation = 17085 - /** Indicates that the email is required for verification. - */ + /// Indicates that the email is required for verification. case unverifiedEmail = 17086 - /** Indicates that the second factor is already enrolled. - */ + /// Indicates that the second factor is already enrolled. case secondFactorAlreadyEnrolled = 17087 - /** Indicates that the maximum second factor count is exceeded. - */ + /// Indicates that the maximum second factor count is exceeded. case maximumSecondFactorCountExceeded = 17088 - /** Indicates that the first factor is not supported. - */ + /// Indicates that the first factor is not supported. case unsupportedFirstFactor = 17089 - /** Indicates that the a verifed email is required to changed to. - */ + /// Indicates that the a verifed email is required to changed to. case emailChangeNeedsVerification = 17090 - /** Indicates that the request does not contain a client identifier. - */ + /// Indicates that the request does not contain a client identifier. case missingClientIdentifier = 17093 - /** Indicates that the nonce is missing or invalid. - */ + /// Indicates that the nonce is missing or invalid. case missingOrInvalidNonce = 17094 - /** Raised when n Cloud Function returns a blocking error. Will include a message returned from - * the function. - */ + /// Raised when n Cloud Function returns a blocking error. Will include a message returned from + /// the function. case blockingCloudFunctionError = 17105 - /** Indicates that reCAPTCHA Enterprise integration is not enabled for this project. - */ + /// Indicates that reCAPTCHA Enterprise integration is not enabled for this project. case recaptchaNotEnabled = 17200 - /** Indicates that the reCAPTCHA token is missing from the backend request. - */ + /// Indicates that the reCAPTCHA token is missing from the backend request. case missingRecaptchaToken = 17201 - /** Indicates that the reCAPTCHA token sent with the backend request is invalid. - */ + /// Indicates that the reCAPTCHA token sent with the backend request is invalid. case invalidRecaptchaToken = 17202 - /** Indicates that the requested reCAPTCHA action is invalid. - */ + /// Indicates that the requested reCAPTCHA action is invalid. case invalidRecaptchaAction = 17203 - /** Indicates that the client type is missing from the request. - */ + /// Indicates that the client type is missing from the request. case missingClientType = 17204 - /** Indicates that the reCAPTCHA version is missing from the request. - */ + /// Indicates that the reCAPTCHA version is missing from the request. case missingRecaptchaVersion = 17205 - /** Indicates that the reCAPTCHA version sent to the backend is invalid. - */ + /// Indicates that the reCAPTCHA version sent to the backend is invalid. case invalidRecaptchaVersion = 17206 - /** Indicates that the request type sent to the backend is invalid. - */ + /// Indicates that the request type sent to the backend is invalid. case invalidReqType = 17207 - /** Indicates that the reCAPTCHA SDK is not linked to the app. - */ + /// Indicates that the reCAPTCHA SDK is not linked to the app. case recaptchaSDKNotLinked = 17208 - /** Indicates an error occurred while attempting to access the keychain. - */ + /// Indicates an error occurred while attempting to access the keychain. case keychainError = 17995 - /** Indicates an internal error occurred. - */ + /// Indicates an internal error occurred. case internalError = 17999 - /** Raised when a JWT fails to parse correctly. May be accompanied by an underlying error - describing which step of the JWT parsing process failed. - */ + /// Raised when a JWT fails to parse correctly. May be accompanied by an underlying error + /// describing which step of the JWT parsing process failed. case malformedJWT = 18000 var errorDescription: String { switch self { case .invalidCustomToken: - return kFIRAuthErrorMessageInvalidCustomToken + return kErrorInvalidCustomToken case .customTokenMismatch: - return kFIRAuthErrorMessageCustomTokenMismatch + return kErrorCustomTokenMismatch case .invalidEmail: - return kFIRAuthErrorMessageInvalidEmail + return kErrorInvalidEmail case .invalidCredential: - return kFIRAuthErrorMessageInvalidCredential + return kErrorInvalidCredential case .userDisabled: - return kFIRAuthErrorMessageUserDisabled + return kErrorUserDisabled case .emailAlreadyInUse: - return kFIRAuthErrorMessageEmailAlreadyInUse + return kErrorEmailAlreadyInUse case .wrongPassword: - return kFIRAuthErrorMessageWrongPassword + return kErrorWrongPassword case .tooManyRequests: - return kFIRAuthErrorMessageTooManyRequests + return kErrorTooManyRequests case .accountExistsWithDifferentCredential: - return kFIRAuthErrorMessageAccountExistsWithDifferentCredential + return kErrorAccountExistsWithDifferentCredential case .requiresRecentLogin: - return kFIRAuthErrorMessageRequiresRecentLogin + return kErrorRequiresRecentLogin case .providerAlreadyLinked: - return kFIRAuthErrorMessageProviderAlreadyLinked + return kErrorProviderAlreadyLinked case .noSuchProvider: - return kFIRAuthErrorMessageNoSuchProvider + return kErrorNoSuchProvider case .invalidUserToken: - return kFIRAuthErrorMessageInvalidUserToken + return kErrorInvalidUserToken case .networkError: - return kFIRAuthErrorMessageNetworkError + return kErrorNetworkError case .keychainError: - return kFIRAuthErrorMessageKeychainError + return kErrorKeychainError case .missingClientIdentifier: - return kFIRAuthErrorMessageMissingClientIdentifier + return kErrorMissingClientIdentifier case .userTokenExpired: - return kFIRAuthErrorMessageUserTokenExpired + return kErrorUserTokenExpired case .userNotFound: - return kFIRAuthErrorMessageUserNotFound + return kErrorUserNotFound case .invalidAPIKey: - return kFIRAuthErrorMessageInvalidAPIKey + return kErrorInvalidAPIKey case .credentialAlreadyInUse: - return kFIRAuthErrorMessageCredentialAlreadyInUse + return kErrorCredentialAlreadyInUse case .internalError: - return kFIRAuthErrorMessageInternalError + return kErrorInternalError case .userMismatch: return FIRAuthErrorMessageUserMismatch case .operationNotAllowed: - return kFIRAuthErrorMessageOperationNotAllowed + return kErrorOperationNotAllowed case .weakPassword: - return kFIRAuthErrorMessageWeakPassword + return kErrorWeakPassword case .appNotAuthorized: - return kFIRAuthErrorMessageAppNotAuthorized + return kErrorAppNotAuthorized case .expiredActionCode: - return kFIRAuthErrorMessageExpiredActionCode + return kErrorExpiredActionCode case .invalidActionCode: - return kFIRAuthErrorMessageInvalidActionCode + return kErrorInvalidActionCode case .invalidSender: - return kFIRAuthErrorMessageInvalidSender + return kErrorInvalidSender case .invalidMessagePayload: - return kFIRAuthErrorMessageInvalidMessagePayload + return kErrorInvalidMessagePayload case .invalidRecipientEmail: - return kFIRAuthErrorMessageInvalidRecipientEmail + return kErrorInvalidRecipientEmail case .missingIosBundleID: - return kFIRAuthErrorMessageMissingIosBundleID + return kErrorMissingIosBundleID case .missingAndroidPackageName: - return kFIRAuthErrorMessageMissingAndroidPackageName + return kErrorMissingAndroidPackageName case .unauthorizedDomain: - return kFIRAuthErrorMessageUnauthorizedDomain + return kErrorUnauthorizedDomain case .invalidContinueURI: - return kFIRAuthErrorMessageInvalidContinueURI + return kErrorInvalidContinueURI case .missingContinueURI: - return kFIRAuthErrorMessageMissingContinueURI + return kErrorMissingContinueURI case .missingEmail: - return kFIRAuthErrorMessageMissingEmail + return kErrorMissingEmail case .missingPhoneNumber: - return kFIRAuthErrorMessageMissingPhoneNumber + return kErrorMissingPhoneNumber case .invalidPhoneNumber: - return kFIRAuthErrorMessageInvalidPhoneNumber + return kErrorInvalidPhoneNumber case .missingVerificationCode: - return kFIRAuthErrorMessageMissingVerificationCode + return kErrorMissingVerificationCode case .invalidVerificationCode: - return kFIRAuthErrorMessageInvalidVerificationCode + return kErrorInvalidVerificationCode case .missingVerificationID: - return kFIRAuthErrorMessageMissingVerificationID + return kErrorMissingVerificationID case .invalidVerificationID: - return kFIRAuthErrorMessageInvalidVerificationID + return kErrorInvalidVerificationID case .sessionExpired: - return kFIRAuthErrorMessageSessionExpired + return kErrorSessionExpired case .missingAppCredential: - return kFIRAuthErrorMessageMissingAppCredential + return kErrorMissingAppCredential case .invalidAppCredential: - return kFIRAuthErrorMessageInvalidAppCredential + return kErrorInvalidAppCredential case .quotaExceeded: - return kFIRAuthErrorMessageQuotaExceeded + return kErrorQuotaExceeded case .missingAppToken: - return kFIRAuthErrorMessageMissingAppToken + return kErrorMissingAppToken case .notificationNotForwarded: - return kFIRAuthErrorMessageNotificationNotForwarded + return kErrorNotificationNotForwarded case .appNotVerified: - return kFIRAuthErrorMessageAppNotVerified + return kErrorAppNotVerified case .captchaCheckFailed: - return kFIRAuthErrorMessageCaptchaCheckFailed + return kErrorCaptchaCheckFailed case .webContextAlreadyPresented: - return kFIRAuthErrorMessageWebContextAlreadyPresented + return kErrorWebContextAlreadyPresented case .webContextCancelled: - return kFIRAuthErrorMessageWebContextCancelled + return kErrorWebContextCancelled case .invalidClientID: - return kFIRAuthErrorMessageInvalidClientID + return kErrorInvalidClientID case .appVerificationUserInteractionFailure: - return kFIRAuthErrorMessageAppVerificationUserInteractionFailure + return kErrorAppVerificationUserInteractionFailure case .webNetworkRequestFailed: - return kFIRAuthErrorMessageWebRequestFailed + return kErrorWebRequestFailed case .nullUser: - return kFIRAuthErrorMessageNullUser + return kErrorNullUser case .invalidProviderID: - return kFIRAuthErrorMessageInvalidProviderID + return kErrorInvalidProviderID case .invalidDynamicLinkDomain: - return kFIRAuthErrorMessageInvalidDynamicLinkDomain + return kErrorInvalidDynamicLinkDomain case .webInternalError: - return kFIRAuthErrorMessageWebInternalError + return kErrorWebInternalError case .webSignInUserInteractionFailure: - return kFIRAuthErrorMessageAppVerificationUserInteractionFailure + return kErrorAppVerificationUserInteractionFailure case .malformedJWT: - return kFIRAuthErrorMessageMalformedJWT + return kErrorMalformedJWT case .localPlayerNotAuthenticated: - return kFIRAuthErrorMessageLocalPlayerNotAuthenticated + return kErrorLocalPlayerNotAuthenticated case .gameKitNotLinked: - return kFIRAuthErrorMessageGameKitNotLinked + return kErrorGameKitNotLinked case .secondFactorRequired: - return kFIRAuthErrorMessageSecondFactorRequired + return kErrorSecondFactorRequired case .missingMultiFactorSession: return FIRAuthErrorMessageMissingMultiFactorSession case .missingMultiFactorInfo: @@ -604,35 +495,35 @@ import Foundation case .emailChangeNeedsVerification: return FIRAuthErrorMessageEmailChangeNeedsVerification case .dynamicLinkNotActivated: - return kFIRAuthErrorMessageDynamicLinkNotActivated + return kErrorDynamicLinkNotActivated case .rejectedCredential: - return kFIRAuthErrorMessageRejectedCredential + return kErrorRejectedCredential case .missingOrInvalidNonce: - return kFIRAuthErrorMessageMissingOrInvalidNonce + return kErrorMissingOrInvalidNonce case .tenantIDMismatch: - return kFIRAuthErrorMessageTenantIDMismatch + return kErrorTenantIDMismatch case .unsupportedTenantOperation: - return kFIRAuthErrorMessageUnsupportedTenantOperation + return kErrorUnsupportedTenantOperation case .blockingCloudFunctionError: - return kFIRAuthErrorMessageBlockingCloudFunctionReturnedError + return kErrorBlockingCloudFunctionReturnedError case .recaptchaNotEnabled: - return kFIRAuthErrorMessageRecaptchaNotEnabled + return kErrorRecaptchaNotEnabled case .missingRecaptchaToken: - return kFIRAuthErrorMessageMissingRecaptchaToken + return kErrorMissingRecaptchaToken case .invalidRecaptchaToken: - return kFIRAuthErrorMessageInvalidRecaptchaToken + return kErrorInvalidRecaptchaToken case .invalidRecaptchaAction: - return kFIRAuthErrorMessageInvalidRecaptchaAction + return kErrorInvalidRecaptchaAction case .missingClientType: - return kFIRAuthErrorMessageMissingClientType + return kErrorMissingClientType case .missingRecaptchaVersion: - return kFIRAuthErrorMessageMissingRecaptchaVersion + return kErrorMissingRecaptchaVersion case .invalidRecaptchaVersion: - return kFIRAuthErrorMessageInvalidRecaptchaVersion + return kErrorInvalidRecaptchaVersion case .invalidReqType: - return kFIRAuthErrorMessageInvalidReqType + return kErrorInvalidReqType case .recaptchaSDKNotLinked: - return kFIRAuthErrorMessageRecaptchaSDKNotLinked + return kErrorRecaptchaSDKNotLinked } } @@ -822,501 +713,263 @@ import Foundation // MARK: - Standard Error Messages -/** @var kFIRAuthErrorMessageInvalidCustomToken - @brief Message for @c FIRAuthErrorCodeInvalidCustomToken error code. - */ -private let kFIRAuthErrorMessageInvalidCustomToken = +private let kErrorInvalidCustomToken = "The custom token format is incorrect. Please check the documentation." -/** @var kFIRAuthErrorMessageCustomTokenMismatch - @brief Message for @c FIRAuthErrorCodeCustomTokenMismatch error code. - */ -private let kFIRAuthErrorMessageCustomTokenMismatch = +private let kErrorCustomTokenMismatch = "The custom token corresponds to a different audience." -/** @var kFIRAuthErrorMessageInvalidEmail - @brief Message for @c FIRAuthErrorCodeInvalidEmail error code. - */ -private let kFIRAuthErrorMessageInvalidEmail = "The email address is badly formatted." +private let kErrorInvalidEmail = "The email address is badly formatted." -/** @var kFIRAuthErrorMessageInvalidCredential - @brief Message for @c FIRAuthErrorCodeInvalidCredential error code. - */ -private let kFIRAuthErrorMessageInvalidCredential = +private let kErrorInvalidCredential = "The supplied auth credential is malformed or has expired." -/** @var kFIRAuthErrorMessageUserDisabled - @brief Message for @c FIRAuthErrorCodeUserDisabled error code. - */ -private let kFIRAuthErrorMessageUserDisabled = +private let kErrorUserDisabled = "The user account has been disabled by an administrator." -/** @var kFIRAuthErrorMessageEmailAlreadyInUse - @brief Message for @c FIRAuthErrorCodeEmailAlreadyInUse error code. - */ -private let kFIRAuthErrorMessageEmailAlreadyInUse = +private let kErrorEmailAlreadyInUse = "The email address is already in use by another account." -/** @var kFIRAuthErrorMessageWrongPassword - @brief Message for @c FIRAuthErrorCodeWrongPassword error code. - */ -private let kFIRAuthErrorMessageWrongPassword = +private let kErrorWrongPassword = "The password is invalid or the user does not have a password." -/** @var kFIRAuthErrorMessageTooManyRequests - @brief Message for @c FIRAuthErrorCodeTooManyRequests error code. - */ -private let kFIRAuthErrorMessageTooManyRequests = +private let kErrorTooManyRequests = "We have blocked all requests from this device due to unusual activity. Try again later." -/** @var kFIRAuthErrorMessageAccountExistsWithDifferentCredential - @brief Message for @c FIRAuthErrorCodeAccountExistsWithDifferentCredential error code. - */ -private let kFIRAuthErrorMessageAccountExistsWithDifferentCredential = +private let kErrorAccountExistsWithDifferentCredential = "An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address." -/** @var kFIRAuthErrorMessageRequiresRecentLogin - @brief Message for @c FIRAuthErrorCodeRequiresRecentLogin error code. - */ -private let kFIRAuthErrorMessageRequiresRecentLogin = +private let kErrorRequiresRecentLogin = "This operation is sensitive and requires recent authentication. Log in again before retrying this request." -/** @var kFIRAuthErrorMessageProviderAlreadyLinked - @brief Message for @c FIRAuthErrorCodeProviderAlreadyExists error code. - */ -private let kFIRAuthErrorMessageProviderAlreadyLinked = +private let kErrorProviderAlreadyLinked = "[ERROR_PROVIDER_ALREADY_LINKED] - User can only be linked to one identity for the given provider." -/** @var kFIRAuthErrorMessageNoSuchProvider - @brief Message for @c FIRAuthErrorCodeNoSuchProvider error code. - */ -private let kFIRAuthErrorMessageNoSuchProvider = +private let kErrorNoSuchProvider = "User was not linked to an account with the given provider." -/** @var kFIRAuthErrorMessageInvalidUserToken - @brief Message for @c FIRAuthErrorCodeInvalidUserToken error code. - */ -private let kFIRAuthErrorMessageInvalidUserToken = +private let kErrorInvalidUserToken = "This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user doesn’t belong to the project associated with the API key used in your request." -/** @var kFIRAuthErrorMessageNetworkError - @brief Message for @c FIRAuthErrorCodeNetworkError error code. - */ -private let kFIRAuthErrorMessageNetworkError = +private let kErrorNetworkError = "Network error (such as timeout, interrupted connection or unreachable host) has occurred." -/** @var kFIRAuthErrorMessageKeychainError - @brief Message for @c FIRAuthErrorCodeKeychainError error code. - */ -private let kFIRAuthErrorMessageKeychainError = +private let kErrorKeychainError = "An error occurred when accessing the keychain. The NSLocalizedFailureReasonErrorKey field in the NSError.userInfo dictionary will contain more information about the error encountered" -/** @var kFIRAuthErrorMessageUserTokenExpired - @brief Message for @c FIRAuthErrorCodeTokenExpired error code. - */ -private let kFIRAuthErrorMessageUserTokenExpired = +private let kErrorUserTokenExpired = "The user's credential is no longer valid. The user must sign in again." -/** @var kFIRAuthErrorMessageUserNotFound - @brief Message for @c FIRAuthErrorCodeUserNotFound error code. - */ -private let kFIRAuthErrorMessageUserNotFound = +private let kErrorUserNotFound = "There is no user record corresponding to this identifier. The user may have been deleted." -/** @var kFIRAuthErrorMessageInvalidAPIKey - @brief Message for @c FIRAuthErrorCodeInvalidAPIKey error code. - @remarks This error is not thrown by the server. - */ -private let kFIRAuthErrorMessageInvalidAPIKey = "An invalid API Key was supplied in the request." +private let kErrorInvalidAPIKey = "An invalid API Key was supplied in the request." -/** @var kFIRAuthErrorMessageUserMismatch. - @brief Message for @c FIRAuthErrorCodeInvalidAPIKey error code. - */ private let FIRAuthErrorMessageUserMismatch = "The supplied credentials do not correspond to the previously signed in user." -/** @var kFIRAuthErrorMessageCredentialAlreadyInUse - @brief Message for @c FIRAuthErrorCodeCredentialAlreadyInUse error code. - */ -private let kFIRAuthErrorMessageCredentialAlreadyInUse = +private let kErrorCredentialAlreadyInUse = "This credential is already associated with a different user account." -/** @var kFIRAuthErrorMessageOperationNotAllowed - @brief Message for @c FIRAuthErrorCodeOperationNotAllowed error code. - */ -private let kFIRAuthErrorMessageOperationNotAllowed = +private let kErrorOperationNotAllowed = "The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section." -/** @var kFIRAuthErrorMessageWeakPassword - @brief Message for @c FIRAuthErrorCodeWeakPassword error code. - */ -private let kFIRAuthErrorMessageWeakPassword = "The password must be 6 characters long or more." +private let kErrorWeakPassword = "The password must be 6 characters long or more." -/** @var kFIRAuthErrorMessageAppNotAuthorized - @brief Message for @c FIRAuthErrorCodeAppNotAuthorized error code. - */ -private let kFIRAuthErrorMessageAppNotAuthorized = +private let kErrorAppNotAuthorized = "This app is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console and ensure that it accepts requests from your app's bundle ID." -/** @var kFIRAuthErrorMessageExpiredActionCode - @brief Message for @c FIRAuthErrorCodeExpiredActionCode error code. - */ -private let kFIRAuthErrorMessageExpiredActionCode = "The action code has expired." +private let kErrorExpiredActionCode = "The action code has expired." -/** @var kFIRAuthErrorMessageInvalidActionCode - @brief Message for @c FIRAuthErrorCodeInvalidActionCode error code. - */ -private let kFIRAuthErrorMessageInvalidActionCode = +private let kErrorInvalidActionCode = "The action code is invalid. This can happen if the code is malformed, expired, or has already been used." -/** @var kFIRAuthErrorMessageInvalidMessagePayload - @brief Message for @c FIRAuthErrorCodeInvalidMessagePayload error code. - */ -private let kFIRAuthErrorMessageInvalidMessagePayload = +private let kErrorInvalidMessagePayload = "The action code is invalid. This can happen if the code is malformed, expired, or has already been used." -/** @var kFIRAuthErrorMessageInvalidSender - @brief Message for @c FIRAuthErrorCodeInvalidSender error code. - */ -private let kFIRAuthErrorMessageInvalidSender = +private let kErrorInvalidSender = "The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console." -/** @var kFIRAuthErrorMessageInvalidRecipientEmail - @brief Message for @c FIRAuthErrorCodeInvalidRecipient error code. - */ -private let kFIRAuthErrorMessageInvalidRecipientEmail = +private let kErrorInvalidRecipientEmail = "The action code is invalid. This can happen if the code is malformed, expired, or has already been used." -/** @var kFIRAuthErrorMessageMissingIosBundleID - @brief Message for @c FIRAuthErrorCodeMissingIosbundleID error code. - */ -private let kFIRAuthErrorMessageMissingIosBundleID = +private let kErrorMissingIosBundleID = "An iOS Bundle ID must be provided if an App Store ID is provided." -/** @var kFIRAuthErrorMessageMissingAndroidPackageName - @brief Message for @c FIRAuthErrorCodeMissingAndroidPackageName error code. - */ -private let kFIRAuthErrorMessageMissingAndroidPackageName = +private let kErrorMissingAndroidPackageName = "An Android Package Name must be provided if the Android App is required to be installed." -/** @var kFIRAuthErrorMessageUnauthorizedDomain - @brief Message for @c FIRAuthErrorCodeUnauthorizedDomain error code. - */ -private let kFIRAuthErrorMessageUnauthorizedDomain = +private let kErrorUnauthorizedDomain = "The domain of the continue URL is not allowlisted. Please allowlist the domain in the Firebase console." -/** @var kFIRAuthErrorMessageInvalidContinueURI - @brief Message for @c FIRAuthErrorCodeInvalidContinueURI error code. - */ -private let kFIRAuthErrorMessageInvalidContinueURI = +private let kErrorInvalidContinueURI = "The continue URL provided in the request is invalid." -/** @var kFIRAuthErrorMessageMissingEmail - @brief Message for @c FIRAuthErrorCodeMissingEmail error code. - */ -private let kFIRAuthErrorMessageMissingEmail = "An email address must be provided." +private let kErrorMissingEmail = "An email address must be provided." -/** @var kFIRAuthErrorMessageMissingContinueURI - @brief Message for @c FIRAuthErrorCodeMissingContinueURI error code. - */ -private let kFIRAuthErrorMessageMissingContinueURI = +private let kErrorMissingContinueURI = "A continue URL must be provided in the request." -/** @var kFIRAuthErrorMessageMissingPhoneNumber - @brief Message for @c FIRAuthErrorCodeMissingPhoneNumber error code. - */ -private let kFIRAuthErrorMessageMissingPhoneNumber = +private let kErrorMissingPhoneNumber = "To send verification codes, provide a phone number for the recipient." -/** @var kFIRAuthErrorMessageInvalidPhoneNumber - @brief Message for @c FIRAuthErrorCodeInvalidPhoneNumber error code. - */ -private let kFIRAuthErrorMessageInvalidPhoneNumber = +private let kErrorInvalidPhoneNumber = "The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code]." -/** @var kFIRAuthErrorMessageMissingVerificationCode - @brief Message for @c FIRAuthErrorCodeMissingVerificationCode error code. - */ -private let kFIRAuthErrorMessageMissingVerificationCode = +private let kErrorMissingVerificationCode = "The phone auth credential was created with an empty SMS verification Code." -/** @var kFIRAuthErrorMessageInvalidVerificationCode - @brief Message for @c FIRAuthErrorCodeInvalidVerificationCode error code. - */ -private let kFIRAuthErrorMessageInvalidVerificationCode = +private let kErrorInvalidVerificationCode = "The multifactor verification code used to create the auth credential is invalid. " + "Re-collect the verification code and be sure to use the verification code provided by the user." -/** @var kFIRAuthErrorMessageMissingVerificationID - @brief Message for @c FIRAuthErrorCodeInvalidVerificationID error code. - */ -private let kFIRAuthErrorMessageMissingVerificationID = +private let kErrorMissingVerificationID = "The phone auth credential was created with an empty verification ID." -/** @var kFIRAuthErrorMessageInvalidVerificationID - @brief Message for @c FIRAuthErrorCodeInvalidVerificationID error code. - */ -private let kFIRAuthErrorMessageInvalidVerificationID = +private let kErrorInvalidVerificationID = "The verification ID used to create the phone auth credential is invalid." -/** @var kFIRAuthErrorMessageLocalPlayerNotAuthenticated - @brief Message for @c FIRAuthErrorCodeLocalPlayerNotAuthenticated error code. - */ -private let kFIRAuthErrorMessageLocalPlayerNotAuthenticated = +private let kErrorLocalPlayerNotAuthenticated = "The local player is not authenticated. Please log the local player in to Game Center." -/** @var kFIRAuthErrorMessageGameKitNotLinked - @brief Message for @c kFIRAuthErrorMessageGameKitNotLinked error code. - */ -private let kFIRAuthErrorMessageGameKitNotLinked = +private let kErrorGameKitNotLinked = "The GameKit framework is not linked. Please turn on the Game Center capability." -/** @var kFIRAuthErrorMessageSessionExpired - @brief Message for @c FIRAuthErrorCodeSessionExpired error code. - */ -private let kFIRAuthErrorMessageSessionExpired = +private let kErrorSessionExpired = "The SMS code has expired. Please re-send the verification code to try again." -/** @var kFIRAuthErrorMessageMissingAppCredential - @brief Message for @c FIRAuthErrorCodeMissingAppCredential error code. - */ -private let kFIRAuthErrorMessageMissingAppCredential = +private let kErrorMissingAppCredential = "The phone verification request is missing an APNs Device token. Firebase Auth automatically detects APNs Device Tokens, however, if method swizzling is disabled, the APNs token must be set via the APNSToken property on FIRAuth or by calling setAPNSToken:type on FIRAuth." -/** @var kFIRAuthErrorMessageInvalidAppCredential - @brief Message for @c FIRAuthErrorCodeInvalidAppCredential error code. - */ -private let kFIRAuthErrorMessageInvalidAppCredential = +private let kErrorInvalidAppCredential = "The APNs device token provided is either incorrect or does not match the private certificate uploaded to the Firebase Console." -/** @var kFIRAuthErrorMessageQuotaExceeded - @brief Message for @c FIRAuthErrorCodeQuotaExceeded error code. - */ -private let kFIRAuthErrorMessageQuotaExceeded = "The quota for this operation has been exceeded." +private let kErrorQuotaExceeded = "The quota for this operation has been exceeded." -/** @var kFIRAuthErrorMessageMissingAppToken - @brief Message for @c FIRAuthErrorCodeMissingAppToken error code. - */ -private let kFIRAuthErrorMessageMissingAppToken = +private let kErrorMissingAppToken = "There seems to be a problem with your project's Firebase phone number authentication set-up, please make sure to follow the instructions found at https://firebase.google.com/docs/auth/ios/phone-auth" -/** @var kFIRAuthErrorMessageMissingAppToken - @brief Message for @c FIRAuthErrorCodeMissingAppToken error code. - */ -private let kFIRAuthErrorMessageNotificationNotForwarded = +private let kErrorNotificationNotForwarded = "If app delegate swizzling is disabled, remote notifications received by UIApplicationDelegate need to" + "be forwarded to FirebaseAuth's canHandleNotificaton method." -/** @var kFIRAuthErrorMessageAppNotVerified - @brief Message for @c FIRAuthErrorCodeMissingAppToken error code. - */ -private let kFIRAuthErrorMessageAppNotVerified = +private let kErrorAppNotVerified = "Firebase could not retrieve the silent push notification and therefore could not verify your app. Ensure that you configured your app correctly to receive push notifications." -/** @var kFIRAuthErrorMessageCaptchaCheckFailed - @brief Message for @c FIRAuthErrorCodeCaptchaCheckFailed error code. - */ -private let kFIRAuthErrorMessageCaptchaCheckFailed = +private let kErrorCaptchaCheckFailed = "The reCAPTCHA response token provided is either invalid, expired or already" -/** @var kFIRAuthErrorMessageWebContextAlreadyPresented - @brief Message for @c FIRAuthErrorCodeWebContextAlreadyPresented error code. - */ -private let kFIRAuthErrorMessageWebContextAlreadyPresented = +private let kErrorWebContextAlreadyPresented = "User interaction is still ongoing, another view cannot be presented." -/** @var kFIRAuthErrorMessageWebContextCancelled - @brief Message for @c FIRAuthErrorCodeWebContextCancelled error code. - */ -private let kFIRAuthErrorMessageWebContextCancelled = "The interaction was cancelled by the user." +private let kErrorWebContextCancelled = "The interaction was cancelled by the user." -/** @var kFIRAuthErrorMessageInvalidClientID - @brief Message for @c FIRAuthErrorCodeInvalidClientID error code. - */ -private let kFIRAuthErrorMessageInvalidClientID = +private let kErrorInvalidClientID = "The OAuth client ID provided is either invalid or does not match the specified API key." -/** @var kFIRAuthErrorMessageWebRequestFailed - @brief Message for @c FIRAuthErrorCodeWebRequestFailed error code. - */ -private let kFIRAuthErrorMessageWebRequestFailed = +private let kErrorWebRequestFailed = "A network error (such as timeout, interrupted connection, or unreachable host) has occurred within the web context." -/** @var kFIRAuthErrorMessageWebInternalError - @brief Message for @c FIRAuthErrorCodeWebInternalError error code. - */ -private let kFIRAuthErrorMessageWebInternalError = +private let kErrorWebInternalError = "An internal error has occurred within the SFSafariViewController or WKWebView." -/** @var kFIRAuthErrorMessageAppVerificationUserInteractionFailure - @brief Message for @c FIRAuthErrorCodeInvalidClientID error code. - */ -private let kFIRAuthErrorMessageAppVerificationUserInteractionFailure = +private let kErrorAppVerificationUserInteractionFailure = "The app verification process has failed, print and inspect the error details for more information" -/** @var kFIRAuthErrorMessageNullUser - @brief Message for @c FIRAuthErrorCodeNullUser error code. - */ -private let kFIRAuthErrorMessageNullUser = +private let kErrorNullUser = "A null user object was provided as the argument for an operation which requires a non-null user object." -/** @var kFIRAuthErrorMessageInvalidProviderID - @brief Message for @c FIRAuthErrorCodeInvalidProviderID error code. - */ -private let kFIRAuthErrorMessageInvalidProviderID = +private let kErrorInvalidProviderID = "The provider ID provided for the attempted web operation is invalid." -/** @var kFIRAuthErrorMessageInvalidDynamicLinkDomain - @brief Message for @c kFIRAuthErrorMessageInvalidDynamicLinkDomain error code. - */ -private let kFIRAuthErrorMessageInvalidDynamicLinkDomain = +private let kErrorInvalidDynamicLinkDomain = "The Firebase Dynamic Link domain used is either not configured or is unauthorized for the current project." -/** @var kFIRAuthErrorMessageInternalError - @brief Message for @c FIRAuthErrorCodeInternalError error code. - */ -private let kFIRAuthErrorMessageInternalError = +private let kErrorInternalError = "An internal error has occurred, print and inspect the error details for more information." -/** @var kFIRAuthErrorMessageMalformedJWT - @brief Error message constant describing @c FIRAuthErrorCodeMalformedJWT errors. - */ -private let kFIRAuthErrorMessageMalformedJWT = +private let kErrorMalformedJWT = "Failed to parse JWT. Check the userInfo dictionary for the full token." -/** @var kFIRAuthErrorMessageSecondFactorRequired - @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code. - */ -private let kFIRAuthErrorMessageSecondFactorRequired = +private let kErrorSecondFactorRequired = "Please complete a second factor challenge to finish signing into this account." -/** @var kFIRAuthErrorMessageSecondFactorRequired - @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code. - */ private let FIRAuthErrorMessageMissingMultiFactorSession = "The request is missing proof of first factor successful sign-in." -/** @var kFIRAuthErrorMessageSecondFactorRequired - @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code. - */ private let FIRAuthErrorMessageMissingMultiFactorInfo = "No second factor identifier is provided." -/** @var kFIRAuthErrorMessageSecondFactorRequired - @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code. - */ private let FIRAuthErrorMessageInvalidMultiFactorSession = "The request does not contain a valid proof of first factor successful sign-in." -/** @var kFIRAuthErrorMessageSecondFactorRequired - @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code. - */ private let FIRAuthErrorMessageMultiFactorInfoNotFound = "The user does not have a second factor matching the identifier provided." -/** @var kFIRAuthErrorMessageSecondFactorRequired - @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code. - */ private let FIRAuthErrorMessageAdminRestrictedOperation = "This operation is restricted to administrators only." -/** @var kFIRAuthErrorMessageSecondFactorRequired - @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code. - */ private let FIRAuthErrorMessageUnverifiedEmail = "The operation requires a verified email." -/** @var kFIRAuthErrorMessageSecondFactorRequired - @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code. - */ private let FIRAuthErrorMessageSecondFactorAlreadyEnrolled = "The second factor is already enrolled on this account." -/** @var kFIRAuthErrorMessageSecondFactorRequired - @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code. - */ private let FIRAuthErrorMessageMaximumSecondFactorCountExceeded = "The maximum allowed number of second factors on a user has been exceeded." -/** @var kFIRAuthErrorMessageSecondFactorRequired - @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code. - */ private let FIRAuthErrorMessageUnsupportedFirstFactor = "Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor." -/** @var kFIRAuthErrorMessageSecondFactorRequired - @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code. - */ private let FIRAuthErrorMessageEmailChangeNeedsVerification = "Multi-factor users must always have a verified email." -/** @var kFIRAuthErrorMessageDynamicLinkNotActivated - @brief Error message constant describing @c FIRAuthErrorCodeDynamicLinkNotActivated errors. - */ -private let kFIRAuthErrorMessageDynamicLinkNotActivated = +private let kErrorDynamicLinkNotActivated = "Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions." -/** @var kFIRAuthErrorMessageRejectedCredential - @brief Error message constant describing @c FIRAuthErrorCodeRejectedCredential errors. - */ -private let kFIRAuthErrorMessageRejectedCredential = +private let kErrorRejectedCredential = "The request contains malformed or mismatching credentials." -/** @var kFIRAuthErrorMessageMissingClientIdentifier - @brief Error message constant describing @c FIRAuthErrorCodeMissingClientIdentifier errors. - */ -private let kFIRAuthErrorMessageMissingClientIdentifier = +private let kErrorMissingClientIdentifier = "The request does not contain a client identifier." -/** @var kFIRAuthErrorMessageMissingOrInvalidNonce - @brief Error message constant describing @c FIRAuthErrorCodeMissingOrInvalidNonce errors. - */ -private let kFIRAuthErrorMessageMissingOrInvalidNonce = +private let kErrorMissingOrInvalidNonce = "The request contains malformed or mismatched credentials." -/** @var kFIRAuthErrorMessageTenantIDMismatch. - @brief Message for @c FIRAuthErrorCodeTenantIDMismatch error code. - */ -private let kFIRAuthErrorMessageTenantIDMismatch = +private let kErrorTenantIDMismatch = "The provided user's tenant ID does not match the Auth instance's tenant ID." -/** @var kFIRAuthErrorMessageUnsupportedTenantOperation - @brief Message for @c FIRAuthErrorCodeUnsupportedTenantOperation error code. - */ -private let kFIRAuthErrorMessageUnsupportedTenantOperation = +private let kErrorUnsupportedTenantOperation = "This operation is not supported in a multi-tenant context." -/** @var kFIRAuthErrorMessageBlockingCloudFunctionReturnedError - @brief Message for @c FIRAuthErrorCodeBlockingCloudFunctionError error code. - */ -private let kFIRAuthErrorMessageBlockingCloudFunctionReturnedError = +private let kErrorBlockingCloudFunctionReturnedError = "Blocking cloud function returned an error." -private let kFIRAuthErrorMessageRecaptchaNotEnabled = +private let kErrorRecaptchaNotEnabled = "reCAPTCHA Enterprise is not enabled for this project." -private let kFIRAuthErrorMessageMissingRecaptchaToken = +private let kErrorMissingRecaptchaToken = "The backend request is missing the reCAPTCHA verification token." -private let kFIRAuthErrorMessageInvalidRecaptchaToken = +private let kErrorInvalidRecaptchaToken = "The reCAPTCHA verification token is invalid or has expired." -private let kFIRAuthErrorMessageInvalidRecaptchaAction = +private let kErrorInvalidRecaptchaAction = "The reCAPTCHA verification failed due to an invalid action." -private let kFIRAuthErrorMessageMissingClientType = +private let kErrorMissingClientType = "The request is missing a client type or the client type is invalid." -private let kFIRAuthErrorMessageMissingRecaptchaVersion = +private let kErrorMissingRecaptchaVersion = "The request is missing the reCAPTCHA version parameter." -private let kFIRAuthErrorMessageInvalidRecaptchaVersion = +private let kErrorInvalidRecaptchaVersion = "The request specifies an invalid version of reCAPTCHA." -private let kFIRAuthErrorMessageInvalidReqType = +private let kErrorInvalidReqType = "The request is not supported or is invalid." // TODO(chuanr, ObjC): point the link to GCIP doc once available. -private let kFIRAuthErrorMessageRecaptchaSDKNotLinked = +private let kErrorRecaptchaSDKNotLinked = "The reCAPTCHA SDK is not linked to your app. See " + "https://cloud.google.com/recaptcha-enterprise/docs/instrument-ios-apps" diff --git a/FirebaseAuth/Sources/Swift/Utilities/AuthInternalErrors.swift b/FirebaseAuth/Sources/Swift/Utilities/AuthInternalErrors.swift index 19a3b188c0a..51b1c51ba41 100644 --- a/FirebaseAuth/Sources/Swift/Utilities/AuthInternalErrors.swift +++ b/FirebaseAuth/Sources/Swift/Utilities/AuthInternalErrors.swift @@ -14,87 +14,83 @@ import Foundation -/** @var FIRAuthPublicErrorCodeFlag - @brief Bitmask value indicating the error represents a public error code when this bit is - zeroed. Error codes which don't contain this flag will be wrapped in an @c NSError whose - code is @c FIRAuthErrorCodeInternalError. - */ +/// Bitmask value indicating the error represents a public error code when this bit is +/// zeroed. Error codes which don't contain this flag will be wrapped in an `NSError` whose +/// code is `AuthErrorCodeInternalError`. let FIRAuthPublicErrorCodeFlag: Int = 1 << 20 -/** @var FIRAuthInternalErrorCode - @brief Error codes used internally by Firebase Auth. - @remarks All errors are generated using an internal error code. These errors are automatically - converted to the appropriate public version of the @c NSError by the methods in - @c FIRAuthErrorUtils - */ - enum SharedErrorCode { case `public`(AuthErrorCode) case `internal`(AuthInternalErrorCode) } +/// Error codes used internally by Firebase Auth. +/// +/// All errors are generated using an internal error code. These errors are automatically +/// converted to the appropriate public version of the `NSError` by the methods in AuthErrorUtils. enum AuthInternalErrorCode: Int { + /// Indicates a network error occurred (such as a timeout, interrupted connection, or + /// unreachable host.) + /// + /// These types of errors are often recoverable with a retry. + /// + /// See the `NSUnderlyingError` value in the `NSError.userInfo` dictionary for details about + /// the network error which occurred. case networkError = 17020 - /** @var FIRAuthInternalErrorCodeRPCRequestEncodingError - @brief Indicates an error encoding the RPC request. - @remarks This is typically due to some sort of unexpected input value. - - See the @c NSUnderlyingError value in the @c NSError.userInfo dictionary for details. - */ + /// Indicates an error encoding the RPC request. + /// + /// This is typically due to some sort of unexpected input value. + /// + /// See the `NSUnderlyingError` value in the `NSError.userInfo` dictionary for details. case RPCRequestEncodingError = 1 - /** @var FIRAuthInternalErrorCodeJSONSerializationError - @brief Indicates an error serializing an RPC request. - @remarks This is typically due to some sort of unexpected input value. - - If an @c NSJSONSerialization.isValidJSONObject: check fails, the error will contain no - @c NSUnderlyingError key in the @c NSError.userInfo dictionary. If an error was - encountered calling @c NSJSONSerialization.dataWithJSONObject:options:error:, the - resulting error will be associated with the @c NSUnderlyingError key in the - @c NSError.userInfo dictionary. - */ + /// Indicates an error serializing an RPC request. + /// + /// This is typically due to some sort of unexpected input value. + /// + /// If an `JSONSerialization.isValidJSONObject` check fails, the error will contain no + /// `NSUnderlyingError` key in the `NSError.userInfo` dictionary. If an error was + /// encountered calling `NSJSONSerialization.dataWithJSONObject`, the + /// resulting error will be associated with the `NSUnderlyingError` key in the + /// `NSError.userInfo` dictionary. case JSONSerializationError = 2 - /** @var FIRAuthInternalErrorCodeUnexpectedErrorResponse - @brief Indicates an HTTP error occurred and the data returned either couldn't be deserialized - or couldn't be decoded. - @remarks See the @c NSUnderlyingError value in the @c NSError.userInfo dictionary for details - about the HTTP error which occurred. - - If the response could be deserialized as JSON then the @c NSError.userInfo dictionary will - contain a value for the key @c FIRAuthErrorUserInfoDeserializedResponseKey which is the - deserialized response value. - - If the response could not be deserialized as JSON then the @c NSError.userInfo dictionary - will contain values for the @c NSUnderlyingErrorKey and @c FIRAuthErrorUserInfoDataKey - keys. - */ + /// Indicates an HTTP error occurred and the data returned either couldn't be deserialized + /// or couldn't be decoded. + /// + /// See the `NSUnderlyingError` value in the `NSError.userInfo` dictionary for details + /// about the HTTP error which occurred. + /// + /// If the response could be deserialized as JSON then the `NSError.userInfo` dictionary will + /// contain a value for the key `AuthErrorUserInfoDeserializedResponseKey` which is the + /// deserialized response value. + /// + /// If the response could not be deserialized as JSON then the `NSError.userInfo` dictionary + /// will contain values for the `NSUnderlyingErrorKey` and `AuthErrorUserInfoDataKey` keys. case unexpectedErrorResponse = 3 - /** @var FIRAuthInternalErrorCodeUnexpectedResponse - @brief Indicates the HTTP response indicated the request was a successes, but the response - contains something other than a JSON-encoded dictionary, or the data type of the response - indicated it is different from the type of response we expected. - @remarks See the @c NSUnderlyingError value in the @c NSError.userInfo dictionary. - If this key is present in the dictionary, it may contain an error from - @c NSJSONSerialization error (indicating the response received was of the wrong data - type). - - See the @c FIRAuthErrorUserInfoDeserializedResponseKey value in the @c NSError.userInfo - dictionary. If the response could be deserialized, it's deserialized representation will - be associated with this key. If the @c NSUnderlyingError value in the @c NSError.userInfo - dictionary is @c nil, this indicates the JSON didn't represent a dictionary. - */ + /// Indicates the HTTP response indicated the request was a successes, but the response + /// contains something other than a JSON-encoded dictionary, or the data type of the response + /// indicated it is different from the type of response we expected. + /// + /// See the `NSUnderlyingError` value in the `NSError.userInfo` dictionary. + /// If this key is present in the dictionary, it may contain an error from + /// `NSJSONSerialization` error (indicating the response received was of the wrong data type). + /// + /// See the `AuthErrorUserInfoDeserializedResponseKey` value in the `NSError.userInfo` + /// dictionary. If the response could be deserialized, it's deserialized representation will + /// be associated with this key. If the @c NSUnderlyingError value in the @c NSError.userInfo + /// dictionary is @c nil, this indicates the JSON didn't represent a dictionary. case unexpectedResponse = 4 - /** @var FIRAuthInternalErrorCodeRPCResponseDecodingError - @brief Indicates an error decoding the RPC response. - This is typically due to some sort of unexpected response value from the server. - @remarks See the @c NSUnderlyingError value in the @c NSError.userInfo dictionary for details. - - See the @c FIRErrorUserInfoDecodedResponseKey value in the @c NSError.userInfo dictionary. - The deserialized representation of the response will be associated with this key. - */ + /// Indicates an error decoding the RPC response. + /// + /// This is typically due to some sort of unexpected response value from the server. + /// + /// See the `NSUnderlyingError` value in the `NSError.userInfo` dictionary for details. + /// + /// See the `userInfoDeserializedResponseKey` value in the `NSError.userInfo` dictionary. + /// The deserialized representation of the response will be associated with this key. case RPCResponseDecodingError = 5 } diff --git a/FirebaseAuth/Sources/Swift/Utilities/AuthUIDelegate.swift b/FirebaseAuth/Sources/Swift/Utilities/AuthUIDelegate.swift index 856b69a949b..1b6b573995b 100644 --- a/FirebaseAuth/Sources/Swift/Utilities/AuthUIDelegate.swift +++ b/FirebaseAuth/Sources/Swift/Utilities/AuthUIDelegate.swift @@ -17,31 +17,26 @@ import Foundation import UIKit - /** @protocol AuthUIDelegate - @brief A protocol to handle user interface interactions for Firebase Auth. - This protocol is available on iOS, macOS Catalyst, and tvOS only. - */ + /// A protocol to handle user interface interactions for Firebase Auth. + /// + /// This protocol is available on iOS, macOS Catalyst, and tvOS only. @objc(FIRAuthUIDelegate) public protocol AuthUIDelegate: NSObjectProtocol { - /** @fn presentViewController:animated:completion: - @brief If implemented, this method will be invoked when Firebase Auth needs to display a view - controller. - @param viewControllerToPresent The view controller to be presented. - @param flag Decides whether the view controller presentation should be animated or not. - @param completion The block to execute after the presentation finishes. This block has no return - value and takes no parameters. - */ + /// If implemented, this method will be invoked when Firebase Auth needs to display a view + /// controller. + /// - Parameter viewControllerToPresent: The view controller to be presented. + /// - Parameter flag: Decides whether the view controller presentation should be animated. + /// - Parameter completion: The block to execute after the presentation finishes. + /// This block has no return value and takes no parameters. @objc(presentViewController:animated:completion:) func present(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)?) - /** @fn dismissViewControllerAnimated:completion: - @brief If implemented, this method will be invoked when Firebase Auth needs to display a view - controller. - @param flag Decides whether removing the view controller should be animated or not. - @param completion The block to execute after the presentation finishes. This block has no return - value and takes no parameters. - */ + /// If implemented, this method will be invoked when Firebase Auth needs to display a view + /// controller. + /// - Parameter flag: Decides whether removing the view controller should be animated or not. + /// - Parameter completion: The block to execute after the presentation finishes. + /// This block has no return value and takes no parameters. @objc(dismissViewControllerAnimated:completion:) func dismiss(animated flag: Bool, completion: (() -> Void)?) } diff --git a/FirebaseAuth/Sources/Swift/Utilities/AuthURLPresenter.swift b/FirebaseAuth/Sources/Swift/Utilities/AuthURLPresenter.swift index 784d097324a..20de31ca968 100644 --- a/FirebaseAuth/Sources/Swift/Utilities/AuthURLPresenter.swift +++ b/FirebaseAuth/Sources/Swift/Utilities/AuthURLPresenter.swift @@ -19,19 +19,16 @@ import UIKit import WebKit - /** @class AuthURLPresenter - @brief A Class responsible for presenting URL via SFSafariViewController or WKWebView. - */ + /// A Class responsible for presenting URL via SFSafariViewController or WKWebView. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class AuthURLPresenter: NSObject, SFSafariViewControllerDelegate, AuthWebViewControllerDelegate { - /** @fn - @brief Presents an URL to interact with user. - @param url The URL to present. - @param uiDelegate The UI delegate to present view controller. - @param completion A block to be called either synchronously if the presentation fails to start, - or asynchronously in future on an unspecified thread once the presentation finishes. - */ + /// Presents an URL to interact with user. + /// - Parameter url: The URL to present. + /// - Parameter uiDelegate: The UI delegate to present view controller. + /// - Parameter completion: A block to be called either synchronously if the presentation fails + /// to start, or asynchronously in future on an unspecified thread once the presentation + /// finishes. func present(_ url: URL, uiDelegate: AuthUIDelegate?, callbackMatcher: @escaping (URL?) -> Bool, @@ -74,11 +71,9 @@ } } - /** @fn canHandleURL: - @brief Determines if a URL was produced by the currently presented URL. - @param url The URL to handle. - @return Whether the URL could be handled or not. - */ + /// Determines if a URL was produced by the currently presented URL. + /// - Parameter url: The URL to handle. + /// - Returns: Whether the URL could be handled or not. func canHandle(url: URL) -> Bool { if isPresenting, let callbackMatcher = callbackMatcher, @@ -119,44 +114,33 @@ } } - /** @var_isPresenting - @brief Whether or not some web-based content is being presented. - Accesses to this property are serialized on the global Auth work queue - and thus this variable should not be read or written outside of the work queue. - */ + /// Whether or not some web-based content is being presented. + /// + /// Accesses to this property are serialized on the global Auth work queue + /// and thus this variable should not be read or written outside of the work queue. private var isPresenting: Bool = false - /** @var callbackMatcher - @brief The callback URL matcher for the current presentation, if one is active. - */ + /// The callback URL matcher for the current presentation, if one is active. private var callbackMatcher: ((URL) -> Bool)? - /** @var safariViewController - @brief The SFSafariViewController used for the current presentation, if any. - */ + /// The SFSafariViewController used for the current presentation, if any. private var safariViewController: SFSafariViewController? - /** @var webViewController - @brief The FIRAuthWebViewController used for the current presentation, if any. - */ + /// The `AuthWebViewController` used for the current presentation, if any. private var webViewController: AuthWebViewController? - /** @var uiDelegate - @brief The UIDelegate used to present the SFSafariViewController. - */ + /// The UIDelegate used to present the SFSafariViewController. var uiDelegate: AuthUIDelegate? - /** @var completion - @brief The completion handler for the current presentation, if one is active. - Accesses to this variable are serialized on the global Auth work queue - and thus this variable should not be read or written outside of the work queue. - @remarks This variable is also used as a flag to indicate a presentation is active. - */ + /// The completion handler for the current presentation, if one is active. + /// + /// Accesses to this variable are serialized on the global Auth work queue + /// and thus this variable should not be read or written outside of the work queue. + /// + /// This variable is also used as a flag to indicate a presentation is active. var completion: ((URL?, Error?) -> Void)? - /** @var fakeUIDelegate - @brief Test-only option to validate the calls to the uiDelegate. - */ + /// Test-only option to validate the calls to the uiDelegate. var fakeUIDelegate: AuthUIDelegate? // MARK: Private methods diff --git a/FirebaseAuth/Sources/Swift/Utilities/AuthWebUtils.swift b/FirebaseAuth/Sources/Swift/Utilities/AuthWebUtils.swift index 7814fc74cd7..47456070935 100644 --- a/FirebaseAuth/Sources/Swift/Utilities/AuthWebUtils.swift +++ b/FirebaseAuth/Sources/Swift/Utilities/AuthWebUtils.swift @@ -77,10 +77,8 @@ class AuthWebUtils: NSObject { return false } - /** @fn extractDomain:urlString - @brief Strips url of scheme and path string to extract domain name - @param urlString URL string for domain - */ + /// Strips url of scheme and path string to extract domain name + /// - Parameter urlString: URL string for domain static func extractDomain(urlString: String) -> String? { var domain = urlString diff --git a/FirebaseAuth/Sources/Swift/Utilities/AuthWebView.swift b/FirebaseAuth/Sources/Swift/Utilities/AuthWebView.swift index 474f020a152..8950052112e 100644 --- a/FirebaseAuth/Sources/Swift/Utilities/AuthWebView.swift +++ b/FirebaseAuth/Sources/Swift/Utilities/AuthWebView.swift @@ -17,9 +17,7 @@ import UIKit import WebKit - /** @class AuthWebView - @brief A class responsible for creating a WKWebView for use within Firebase Auth. - */ + /// A class responsible for creating a WKWebView for use within Firebase Auth. @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) class AuthWebView: UIView { lazy var webView: WKWebView = createWebView() diff --git a/FirebaseAuth/Sources/Swift/Utilities/AuthWebViewController.swift b/FirebaseAuth/Sources/Swift/Utilities/AuthWebViewController.swift index 6fb56a4060d..f476c0e06f5 100644 --- a/FirebaseAuth/Sources/Swift/Utilities/AuthWebViewController.swift +++ b/FirebaseAuth/Sources/Swift/Utilities/AuthWebViewController.swift @@ -18,38 +18,29 @@ import UIKit import WebKit - /** @protocol AuthWebViewControllerDelegate - @brief Defines a delegate for AuthWebViewController - */ + /// Defines a delegate for AuthWebViewController @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) protocol AuthWebViewControllerDelegate: AnyObject { - /** @fn webViewControllerDidCancel: - @brief Notifies the delegate that the web view controller is being cancelled by the user. - @param webViewController The web view controller in question. - */ + /// Notifies the delegate that the web view controller is being cancelled by the user. + /// - Parameter webViewController: The web view controller in question. func webViewControllerDidCancel(_ controller: AuthWebViewController) - /** @fn webViewController:canHandleURL: - @brief Determines if a URL should be handled by the delegate. - @param URL The URL to handle. - @return Whether the URL could be handled or not. - */ + /// Determines if a URL should be handled by the delegate. + /// - Parameter url: The URL to handle. + /// - Returns: Whether the URL could be handled or not. func webViewController(_ controller: AuthWebViewController, canHandle url: URL) -> Bool - /** @fn webViewController:didFailWithError: - @brief Notifies the delegate that the web view controller failed to load a page. - @param webViewController The web view controller in question. - @param error The error that has occurred. - */ + /// Notifies the delegate that the web view controller failed to load a page. + /// - Parameter webViewController: The web view controller in question. + /// - Parameter error: The error that has occurred. func webViewController(_ controller: AuthWebViewController, didFailWithError error: Error) - /** @fn presentURL:UIDelegate:callbackMatcher:completion: - @brief Presents an URL to interact with user. - @param url The URL to present. - @param uiDelegate The UI delegate to present view controller. - @param completion A block to be called either synchronously if the presentation fails to start, - or asynchronously in future on an unspecified thread once the presentation finishes. - */ + /// Presents an URL to interact with user. + /// - Parameter url: The URL to present. + /// - Parameter uiDelegate: The UI delegate to present view controller. + /// - Parameter completion: A block to be called either synchronously if the presentation fails + /// to start, or asynchronously in future on an unspecified thread once the presentation + /// finishes. func present(_ url: URL, uiDelegate: AuthUIDelegate?, callbackMatcher: @escaping (URL?) -> Bool, diff --git a/FirebaseAuth/Tests/Unit/AuthBackendRPCImplentationTests.swift b/FirebaseAuth/Tests/Unit/AuthBackendRPCImplentationTests.swift index dc43d57168b..8a425c82599 100644 --- a/FirebaseAuth/Tests/Unit/AuthBackendRPCImplentationTests.swift +++ b/FirebaseAuth/Tests/Unit/AuthBackendRPCImplentationTests.swift @@ -235,7 +235,7 @@ class AuthBackendRPCImplementationTests: RPCBaseTests { expected. We are expecting to receive an @c NSError with the code @c FIRAuthErrorCodeUnexpectedServerResponse with the decoded response in the @c NSError.userInfo dictionary associated with the key - @c FIRAuthErrorUserInfoDecodedResponseKey. + `userInfoDeserializedResponseKey`. */ func testNonDictionarySuccessResponse() async throws { // We are responding with a JSON-encoded string value representing an array - which is