diff options
| author | altaf-creator <dev@altafcreator.com> | 2025-11-16 19:08:29 +0800 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2025-11-16 19:08:29 +0800 |
| commit | 434aa8343fdcbb4d5002f934979913c099489bee (patch) | |
| tree | 55bab4ec5a6151be57797d34f61faf5ea744471b /frontend-old/node_modules/@firebase/auth/dist/web-extension-esm | |
| parent | 893c388d4e99442a36005e5971a87730623f946e (diff) | |
sdk, del
Diffstat (limited to 'frontend-old/node_modules/@firebase/auth/dist/web-extension-esm')
181 files changed, 0 insertions, 28662 deletions
diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/auth-web-extension-public.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/auth-web-extension-public.d.ts deleted file mode 100644 index c686db3..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/auth-web-extension-public.d.ts +++ /dev/null @@ -1,3210 +0,0 @@ -import { CompleteFn } from '@firebase/util'; -import { ErrorFactory } from '@firebase/util'; -import { ErrorFn } from '@firebase/util'; -import { FirebaseApp } from '@firebase/app'; -import { FirebaseError } from '@firebase/util'; -import { NextFn } from '@firebase/util'; -import { Observer } from '@firebase/util'; -import { Unsubscribe } from '@firebase/util'; - -/** - * A response from {@link checkActionCode}. - * - * @public - */ -declare interface ActionCodeInfo { - /** - * The data associated with the action code. - * - * @remarks - * For the {@link ActionCodeOperation}.PASSWORD_RESET, {@link ActionCodeOperation}.VERIFY_EMAIL, and - * {@link ActionCodeOperation}.RECOVER_EMAIL actions, this object contains an email field with the address - * the email was sent to. - * - * For the {@link ActionCodeOperation}.RECOVER_EMAIL action, which allows a user to undo an email address - * change, this object also contains a `previousEmail` field with the user account's current - * email address. After the action completes, the user's email address will revert to the value - * in the `email` field from the value in `previousEmail` field. - * - * For the {@link ActionCodeOperation}.VERIFY_AND_CHANGE_EMAIL action, which allows a user to verify the - * email before updating it, this object contains a `previousEmail` field with the user account's - * email address before updating. After the action completes, the user's email address will be - * updated to the value in the `email` field from the value in `previousEmail` field. - * - * For the {@link ActionCodeOperation}.REVERT_SECOND_FACTOR_ADDITION action, which allows a user to - * unenroll a newly added second factor, this object contains a `multiFactorInfo` field with - * the information about the second factor. For phone second factor, the `multiFactorInfo` - * is a {@link MultiFactorInfo} object, which contains the phone number. - */ - data: { - email?: string | null; - multiFactorInfo?: MultiFactorInfo | null; - previousEmail?: string | null; - }; - /** - * The type of operation that generated the action code. - */ - operation: (typeof ActionCodeOperation)[keyof typeof ActionCodeOperation]; -} - -/** - * An enumeration of the possible email action types. - * - * @public - */ -declare const ActionCodeOperation: { - /** The email link sign-in action. */ - readonly EMAIL_SIGNIN: "EMAIL_SIGNIN"; - /** The password reset action. */ - readonly PASSWORD_RESET: "PASSWORD_RESET"; - /** The email revocation action. */ - readonly RECOVER_EMAIL: "RECOVER_EMAIL"; - /** The revert second factor addition email action. */ - readonly REVERT_SECOND_FACTOR_ADDITION: "REVERT_SECOND_FACTOR_ADDITION"; - /** The revert second factor addition email action. */ - readonly VERIFY_AND_CHANGE_EMAIL: "VERIFY_AND_CHANGE_EMAIL"; - /** The email verification action. */ - readonly VERIFY_EMAIL: "VERIFY_EMAIL"; -}; - -/** - * An interface that defines the required continue/state URL with optional Android and iOS - * bundle identifiers. - * - * @public - */ -declare interface ActionCodeSettings { - /** - * Sets the Android package name. - * - * @remarks - * This will try to open the link in an Android app if it is installed. - */ - android?: { - installApp?: boolean; - minimumVersion?: string; - packageName: string; - }; - /** - * When set to true, the action code link will be be sent as a Universal Link or Android App - * Link and will be opened by the app if installed. - * - * @remarks - * In the false case, the code will be sent to the web widget first and then on continue will - * redirect to the app if installed. - * - * @defaultValue false - */ - handleCodeInApp?: boolean; - /** - * Sets the iOS bundle ID. - * - * @remarks - * This will try to open the link in an iOS app if it is installed. - */ - iOS?: { - bundleId: string; - }; - /** - * Sets the link continue/state URL. - * - * @remarks - * This has different meanings in different contexts: - * - When the link is handled in the web action widgets, this is the deep link in the - * `continueUrl` query parameter. - * - When the link is handled in the app directly, this is the `continueUrl` query parameter in - * the deep link of the Dynamic Link or Hosting link. - */ - url: string; - /** - * When multiple custom dynamic link domains are defined for a project, specify which one to use - * when the link is to be opened via a specified mobile app (for example, `example.page.link`). - * - * - * @defaultValue The first domain is automatically selected. - * - * @deprecated Firebase Dynamic Links is deprecated and will be shut down as early as August - * 2025. Instead, use {@link ActionCodeSettings.linkDomain} to set a custom domain for mobile - * links. Learn more in the {@link https://firebase.google.com/support/dynamic-links-faq | Dynamic Links deprecation FAQ}. - */ - dynamicLinkDomain?: string; - /** - * The optional custom Firebase Hosting domain to use when the link is to be opened via - * a specified mobile app. The domain must be configured in Firebase Hosting and owned - * by the project. This cannot be a default Hosting domain (`web.app` or `firebaseapp.com`). - * - * @defaultValue The default Hosting domain will be used (for example, `example.firebaseapp.com`). - */ - linkDomain?: string; -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * A utility class to parse email action URLs such as password reset, email verification, - * email link sign in, etc. - * - * @public - */ -export declare class ActionCodeURL { - /** - * The API key of the email action link. - */ - readonly apiKey: string; - /** - * The action code of the email action link. - */ - readonly code: string; - /** - * The continue URL of the email action link. Null if not provided. - */ - readonly continueUrl: string | null; - /** - * The language code of the email action link. Null if not provided. - */ - readonly languageCode: string | null; - /** - * The action performed by the email action link. It returns from one of the types from - * {@link ActionCodeInfo} - */ - readonly operation: string; - /** - * The tenant ID of the email action link. Null if the email action is from the parent project. - */ - readonly tenantId: string | null; - /* Excluded from this release type: __constructor */ - /** - * Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid, - * otherwise returns null. - * - * @param link - The email action link string. - * @returns The {@link ActionCodeURL} object, or null if the link is invalid. - * - * @public - */ - static parseLink(link: string): ActionCodeURL | null; -} - -/** - * A structure containing additional user information from a federated identity provider. - * - * @public - */ -declare interface AdditionalUserInfo { - /** - * Whether the user is new (created via sign-up) or existing (authenticated using sign-in). - */ - readonly isNewUser: boolean; - /** - * Map containing IDP-specific user data. - */ - readonly profile: Record<string, unknown> | null; - /** - * Identifier for the provider used to authenticate this user. - */ - readonly providerId: string | null; - /** - * The username if the provider is GitHub or Twitter. - */ - readonly username?: string | null; -} - -declare interface APIUserInfo { - localId?: string; - displayName?: string; - photoUrl?: string; - email?: string; - emailVerified?: boolean; - phoneNumber?: string; - lastLoginAt?: number; - createdAt?: number; - tenantId?: string; - passwordHash?: string; - providerUserInfo?: ProviderUserInfo[]; - mfaInfo?: MfaEnrollment[]; -} - -/** - * Applies a verification code sent to the user by email or other out-of-band mechanism. - * - * @param auth - The {@link Auth} instance. - * @param oobCode - A verification code sent to the user. - * - * @public - */ -export declare function applyActionCode(auth: Auth, oobCode: string): Promise<void>; - -declare type AppName = string; - -/** - * Interface representing Firebase Auth service. - * - * @remarks - * See {@link https://firebase.google.com/docs/auth/ | Firebase Authentication} for a full guide - * on how to use the Firebase Auth service. - * - * @public - */ -declare interface Auth { - /** The {@link @firebase/app#FirebaseApp} associated with the `Auth` service instance. */ - readonly app: FirebaseApp; - /** The name of the app associated with the `Auth` service instance. */ - readonly name: string; - /** The {@link Config} used to initialize this instance. */ - readonly config: Config; - /** - * Changes the type of persistence on the `Auth` instance. - * - * @remarks - * This will affect the currently saved Auth session and applies this type of persistence for - * future sign-in requests, including sign-in with redirect requests. - * - * This makes it easy for a user signing in to specify whether their session should be - * remembered or not. It also makes it easier to never persist the Auth state for applications - * that are shared by other users or have sensitive data. - * - * This method does not work in a Node.js environment. - * - * @example - * ```javascript - * auth.setPersistence(browserSessionPersistence); - * ``` - * - * @param persistence - The {@link Persistence} to use. - */ - setPersistence(persistence: Persistence): Promise<void>; - /** - * The {@link Auth} instance's language code. - * - * @remarks - * This is a readable/writable property. When set to null, the default Firebase Console language - * setting is applied. The language code will propagate to email action templates (password - * reset, email verification and email change revocation), SMS templates for phone authentication, - * reCAPTCHA verifier and OAuth popup/redirect operations provided the specified providers support - * localization with the language code specified. - */ - languageCode: string | null; - /** - * The {@link Auth} instance's tenant ID. - * - * @remarks - * This is a readable/writable property. When you set the tenant ID of an {@link Auth} instance, all - * future sign-in/sign-up operations will pass this tenant ID and sign in or sign up users to - * the specified tenant project. When set to null, users are signed in to the parent project. - * - * @example - * ```javascript - * // Set the tenant ID on Auth instance. - * auth.tenantId = 'TENANT_PROJECT_ID'; - * - * // All future sign-in request now include tenant ID. - * const result = await signInWithEmailAndPassword(auth, email, password); - * // result.user.tenantId should be 'TENANT_PROJECT_ID'. - * ``` - * - * @defaultValue null - */ - tenantId: string | null; - /** - * The {@link Auth} instance's settings. - * - * @remarks - * This is used to edit/read configuration related options such as app verification mode for - * phone authentication. - */ - readonly settings: AuthSettings; - /** - * Adds an observer for changes to the user's sign-in state. - * - * @remarks - * To keep the old behavior, see {@link Auth.onIdTokenChanged}. - * - * @param nextOrObserver - callback triggered on change. - * @param error - Deprecated. This callback is never triggered. Errors - * on signing in/out can be caught in promises returned from - * sign-in/sign-out functions. - * @param completed - Deprecated. This callback is never triggered. - */ - onAuthStateChanged(nextOrObserver: NextOrObserver<User | null>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe; - /** - * Adds a blocking callback that runs before an auth state change - * sets a new user. - * - * @param callback - callback triggered before new user value is set. - * If this throws, it blocks the user from being set. - * @param onAbort - callback triggered if a later `beforeAuthStateChanged()` - * callback throws, allowing you to undo any side effects. - */ - beforeAuthStateChanged(callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe; - /** - * Adds an observer for changes to the signed-in user's ID token. - * - * @remarks - * This includes sign-in, sign-out, and token refresh events. - * - * @param nextOrObserver - callback triggered on change. - * @param error - Deprecated. This callback is never triggered. Errors - * on signing in/out can be caught in promises returned from - * sign-in/sign-out functions. - * @param completed - Deprecated. This callback is never triggered. - */ - onIdTokenChanged(nextOrObserver: NextOrObserver<User | null>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe; - /** - * returns a promise that resolves immediately when the initial - * auth state is settled. When the promise resolves, the current user might be a valid user - * or `null` if the user signed out. - */ - authStateReady(): Promise<void>; - /** The currently signed-in user (or null). */ - readonly currentUser: User | null; - /** The current emulator configuration (or null). */ - readonly emulatorConfig: EmulatorConfig | null; - /** - * Asynchronously sets the provided user as {@link Auth.currentUser} on the {@link Auth} instance. - * - * @remarks - * A new instance copy of the user provided will be made and set as currentUser. - * - * This will trigger {@link Auth.onAuthStateChanged} and {@link Auth.onIdTokenChanged} listeners - * like other sign in methods. - * - * The operation fails with an error if the user to be updated belongs to a different Firebase - * project. - * - * @param user - The new {@link User}. - */ - updateCurrentUser(user: User | null): Promise<void>; - /** - * Sets the current language to the default device/browser preference. - */ - useDeviceLanguage(): void; - /** - * Signs out the current user. This does not automatically revoke the user's ID token. - * - * @remarks - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - */ - signOut(): Promise<void>; -} - -/** - * Interface that represents the credentials returned by an {@link AuthProvider}. - * - * @remarks - * Implementations specify the details about each auth provider's credential requirements. - * - * @public - */ -export declare class AuthCredential { - /** - * The authentication provider ID for the credential. - * - * @remarks - * For example, 'facebook.com', or 'google.com'. - */ - readonly providerId: string; - /** - * The authentication sign in method for the credential. - * - * @remarks - * For example, {@link SignInMethod}.EMAIL_PASSWORD, or - * {@link SignInMethod}.EMAIL_LINK. This corresponds to the sign-in method - * identifier as returned in {@link fetchSignInMethodsForEmail}. - */ - readonly signInMethod: string; - /* Excluded from this release type: __constructor */ - /** - * Returns a JSON-serializable representation of this object. - * - * @returns a JSON-serializable representation of this object. - */ - toJSON(): object; - /* Excluded from this release type: _getIdTokenResponse */ - /* Excluded from this release type: _linkToIdToken */ - /* Excluded from this release type: _getReauthenticationResolver */ -} - -/** - * Interface for an `Auth` error. - * - * @public - */ -declare interface AuthError extends FirebaseError { - /** Details about the Firebase Auth error. */ - readonly customData: { - /** The name of the Firebase App which triggered this error. */ - readonly appName: string; - /** The email address of the user's account, used for sign-in and linking. */ - readonly email?: string; - /** The phone number of the user's account, used for sign-in and linking. */ - readonly phoneNumber?: string; - /** - * The tenant ID being used for sign-in and linking. - * - * @remarks - * If you use {@link signInWithRedirect} to sign in, - * you have to set the tenant ID on the {@link Auth} instance again as the tenant ID is not persisted - * after redirection. - */ - readonly tenantId?: string; - }; -} - -/* Excluded from this release type: AuthErrorCode */ - -/** - * A map of potential `Auth` error codes, for easier comparison with errors - * thrown by the SDK. - * - * @remarks - * Note that you can't tree-shake individual keys - * in the map, so by using the map you might substantially increase your - * bundle size. - * - * @public - */ -export declare const AuthErrorCodes: { - readonly ADMIN_ONLY_OPERATION: "auth/admin-restricted-operation"; - readonly ARGUMENT_ERROR: "auth/argument-error"; - readonly APP_NOT_AUTHORIZED: "auth/app-not-authorized"; - readonly APP_NOT_INSTALLED: "auth/app-not-installed"; - readonly CAPTCHA_CHECK_FAILED: "auth/captcha-check-failed"; - readonly CODE_EXPIRED: "auth/code-expired"; - readonly CORDOVA_NOT_READY: "auth/cordova-not-ready"; - readonly CORS_UNSUPPORTED: "auth/cors-unsupported"; - readonly CREDENTIAL_ALREADY_IN_USE: "auth/credential-already-in-use"; - readonly CREDENTIAL_MISMATCH: "auth/custom-token-mismatch"; - readonly CREDENTIAL_TOO_OLD_LOGIN_AGAIN: "auth/requires-recent-login"; - readonly DEPENDENT_SDK_INIT_BEFORE_AUTH: "auth/dependent-sdk-initialized-before-auth"; - readonly DYNAMIC_LINK_NOT_ACTIVATED: "auth/dynamic-link-not-activated"; - readonly EMAIL_CHANGE_NEEDS_VERIFICATION: "auth/email-change-needs-verification"; - readonly EMAIL_EXISTS: "auth/email-already-in-use"; - readonly EMULATOR_CONFIG_FAILED: "auth/emulator-config-failed"; - readonly EXPIRED_OOB_CODE: "auth/expired-action-code"; - readonly EXPIRED_POPUP_REQUEST: "auth/cancelled-popup-request"; - readonly INTERNAL_ERROR: "auth/internal-error"; - readonly INVALID_API_KEY: "auth/invalid-api-key"; - readonly INVALID_APP_CREDENTIAL: "auth/invalid-app-credential"; - readonly INVALID_APP_ID: "auth/invalid-app-id"; - readonly INVALID_AUTH: "auth/invalid-user-token"; - readonly INVALID_AUTH_EVENT: "auth/invalid-auth-event"; - readonly INVALID_CERT_HASH: "auth/invalid-cert-hash"; - readonly INVALID_CODE: "auth/invalid-verification-code"; - readonly INVALID_CONTINUE_URI: "auth/invalid-continue-uri"; - readonly INVALID_CORDOVA_CONFIGURATION: "auth/invalid-cordova-configuration"; - readonly INVALID_CUSTOM_TOKEN: "auth/invalid-custom-token"; - readonly INVALID_DYNAMIC_LINK_DOMAIN: "auth/invalid-dynamic-link-domain"; - readonly INVALID_EMAIL: "auth/invalid-email"; - readonly INVALID_EMULATOR_SCHEME: "auth/invalid-emulator-scheme"; - readonly INVALID_IDP_RESPONSE: "auth/invalid-credential"; - readonly INVALID_LOGIN_CREDENTIALS: "auth/invalid-credential"; - readonly INVALID_MESSAGE_PAYLOAD: "auth/invalid-message-payload"; - readonly INVALID_MFA_SESSION: "auth/invalid-multi-factor-session"; - readonly INVALID_OAUTH_CLIENT_ID: "auth/invalid-oauth-client-id"; - readonly INVALID_OAUTH_PROVIDER: "auth/invalid-oauth-provider"; - readonly INVALID_OOB_CODE: "auth/invalid-action-code"; - readonly INVALID_ORIGIN: "auth/unauthorized-domain"; - readonly INVALID_PASSWORD: "auth/wrong-password"; - readonly INVALID_PERSISTENCE: "auth/invalid-persistence-type"; - readonly INVALID_PHONE_NUMBER: "auth/invalid-phone-number"; - readonly INVALID_PROVIDER_ID: "auth/invalid-provider-id"; - readonly INVALID_RECIPIENT_EMAIL: "auth/invalid-recipient-email"; - readonly INVALID_SENDER: "auth/invalid-sender"; - readonly INVALID_SESSION_INFO: "auth/invalid-verification-id"; - readonly INVALID_TENANT_ID: "auth/invalid-tenant-id"; - readonly MFA_INFO_NOT_FOUND: "auth/multi-factor-info-not-found"; - readonly MFA_REQUIRED: "auth/multi-factor-auth-required"; - readonly MISSING_ANDROID_PACKAGE_NAME: "auth/missing-android-pkg-name"; - readonly MISSING_APP_CREDENTIAL: "auth/missing-app-credential"; - readonly MISSING_AUTH_DOMAIN: "auth/auth-domain-config-required"; - readonly MISSING_CODE: "auth/missing-verification-code"; - readonly MISSING_CONTINUE_URI: "auth/missing-continue-uri"; - readonly MISSING_IFRAME_START: "auth/missing-iframe-start"; - readonly MISSING_IOS_BUNDLE_ID: "auth/missing-ios-bundle-id"; - readonly MISSING_OR_INVALID_NONCE: "auth/missing-or-invalid-nonce"; - readonly MISSING_MFA_INFO: "auth/missing-multi-factor-info"; - readonly MISSING_MFA_SESSION: "auth/missing-multi-factor-session"; - readonly MISSING_PHONE_NUMBER: "auth/missing-phone-number"; - readonly MISSING_PASSWORD: "auth/missing-password"; - readonly MISSING_SESSION_INFO: "auth/missing-verification-id"; - readonly MODULE_DESTROYED: "auth/app-deleted"; - readonly NEED_CONFIRMATION: "auth/account-exists-with-different-credential"; - readonly NETWORK_REQUEST_FAILED: "auth/network-request-failed"; - readonly NULL_USER: "auth/null-user"; - readonly NO_AUTH_EVENT: "auth/no-auth-event"; - readonly NO_SUCH_PROVIDER: "auth/no-such-provider"; - readonly OPERATION_NOT_ALLOWED: "auth/operation-not-allowed"; - readonly OPERATION_NOT_SUPPORTED: "auth/operation-not-supported-in-this-environment"; - readonly POPUP_BLOCKED: "auth/popup-blocked"; - readonly POPUP_CLOSED_BY_USER: "auth/popup-closed-by-user"; - readonly PROVIDER_ALREADY_LINKED: "auth/provider-already-linked"; - readonly QUOTA_EXCEEDED: "auth/quota-exceeded"; - readonly REDIRECT_CANCELLED_BY_USER: "auth/redirect-cancelled-by-user"; - readonly REDIRECT_OPERATION_PENDING: "auth/redirect-operation-pending"; - readonly REJECTED_CREDENTIAL: "auth/rejected-credential"; - readonly SECOND_FACTOR_ALREADY_ENROLLED: "auth/second-factor-already-in-use"; - readonly SECOND_FACTOR_LIMIT_EXCEEDED: "auth/maximum-second-factor-count-exceeded"; - readonly TENANT_ID_MISMATCH: "auth/tenant-id-mismatch"; - readonly TIMEOUT: "auth/timeout"; - readonly TOKEN_EXPIRED: "auth/user-token-expired"; - readonly TOO_MANY_ATTEMPTS_TRY_LATER: "auth/too-many-requests"; - readonly UNAUTHORIZED_DOMAIN: "auth/unauthorized-continue-uri"; - readonly UNSUPPORTED_FIRST_FACTOR: "auth/unsupported-first-factor"; - readonly UNSUPPORTED_PERSISTENCE: "auth/unsupported-persistence-type"; - readonly UNSUPPORTED_TENANT_OPERATION: "auth/unsupported-tenant-operation"; - readonly UNVERIFIED_EMAIL: "auth/unverified-email"; - readonly USER_CANCELLED: "auth/user-cancelled"; - readonly USER_DELETED: "auth/user-not-found"; - readonly USER_DISABLED: "auth/user-disabled"; - readonly USER_MISMATCH: "auth/user-mismatch"; - readonly USER_SIGNED_OUT: "auth/user-signed-out"; - readonly WEAK_PASSWORD: "auth/weak-password"; - readonly WEB_STORAGE_UNSUPPORTED: "auth/web-storage-unsupported"; - readonly ALREADY_INITIALIZED: "auth/already-initialized"; - readonly RECAPTCHA_NOT_ENABLED: "auth/recaptcha-not-enabled"; - readonly MISSING_RECAPTCHA_TOKEN: "auth/missing-recaptcha-token"; - readonly INVALID_RECAPTCHA_TOKEN: "auth/invalid-recaptcha-token"; - readonly INVALID_RECAPTCHA_ACTION: "auth/invalid-recaptcha-action"; - readonly MISSING_CLIENT_TYPE: "auth/missing-client-type"; - readonly MISSING_RECAPTCHA_VERSION: "auth/missing-recaptcha-version"; - readonly INVALID_RECAPTCHA_VERSION: "auth/invalid-recaptcha-version"; - readonly INVALID_REQ_TYPE: "auth/invalid-req-type"; - readonly INVALID_HOSTING_LINK_DOMAIN: "auth/invalid-hosting-link-domain"; -}; - -/** - * A mapping of error codes to error messages. - * - * @remarks - * - * While error messages are useful for debugging (providing verbose textual - * context around what went wrong), these strings take up a lot of space in the - * compiled code. When deploying code in production, using {@link prodErrorMap} - * will save you roughly 10k compressed/gzipped over {@link debugErrorMap}. You - * can select the error map during initialization: - * - * ```javascript - * initializeAuth(app, {errorMap: debugErrorMap}) - * ``` - * - * When initializing Auth, {@link prodErrorMap} is default. - * - * @public - */ -declare interface AuthErrorMap { -} - -/* Excluded from this release type: AuthErrorParams */ - -/* Excluded from this release type: AuthEvent */ - -/* Excluded from this release type: AuthEventConsumer */ - -declare interface AuthEventError extends Error { - code: string; - message: string; -} - -/* Excluded from this release type: AuthEventType */ - -/* Excluded from this release type: AuthInternal */ - -declare class AuthPopup { - readonly window: Window | null; - associatedEvent: string | null; - constructor(window: Window | null); - close(): void; -} - -/** - * Interface that represents an auth provider, used to facilitate creating {@link AuthCredential}. - * - * @public - */ -declare interface AuthProvider { - /** - * Provider for which credentials can be constructed. - */ - readonly providerId: string; -} - -/** - * Interface representing an {@link Auth} instance's settings. - * - * @remarks Currently used for enabling/disabling app verification for phone Auth testing. - * - * @public - */ -declare interface AuthSettings { - /** - * When set, this property disables app verification for the purpose of testing phone - * authentication. For this property to take effect, it needs to be set before rendering a - * reCAPTCHA app verifier. When this is disabled, a mock reCAPTCHA is rendered instead. This is - * useful for manual testing during development or for automated integration tests. - * - * In order to use this feature, you will need to - * {@link https://firebase.google.com/docs/auth/web/phone-auth#test-with-whitelisted-phone-numbers | whitelist your phone number} - * via the Firebase Console. - * - * The default value is false (app verification is enabled). - */ - appVerificationDisabledForTesting: boolean; -} - -/** - * MFA Info as returned by the API. - */ -declare interface BaseMfaEnrollment { - mfaEnrollmentId: string; - enrolledAt: number; - displayName?: string; -} - -/** - * Common code to all OAuth providers. This is separate from the - * {@link OAuthProvider} so that child providers (like - * {@link GoogleAuthProvider}) don't inherit the `credential` instance method. - * Instead, they rely on a static `credential` method. - */ -declare abstract class BaseOAuthProvider extends FederatedAuthProvider implements AuthProvider { - /* Excluded from this release type: scopes */ - /** - * Add an OAuth scope to the credential. - * - * @param scope - Provider OAuth scope to add. - */ - addScope(scope: string): AuthProvider; - /** - * Retrieve the current list of OAuth scopes. - */ - getScopes(): string[]; -} - -/** - * Adds a blocking callback that runs before an auth state change - * sets a new user. - * - * @param auth - The {@link Auth} instance. - * @param callback - callback triggered before new user value is set. - * If this throws, it blocks the user from being set. - * @param onAbort - callback triggered if a later `beforeAuthStateChanged()` - * callback throws, allowing you to undo any side effects. - */ -export declare function beforeAuthStateChanged(auth: Auth, callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe; - -/** - * Checks a verification code sent to the user by email or other out-of-band mechanism. - * - * @returns metadata about the code. - * - * @param auth - The {@link Auth} instance. - * @param oobCode - A verification code sent to the user. - * - * @public - */ -export declare function checkActionCode(auth: Auth, oobCode: string): Promise<ActionCodeInfo>; - -/* Excluded from this release type: ClientPlatform */ - -/** - * Interface representing the `Auth` config. - * - * @public - */ -declare interface Config { - /** - * The API Key used to communicate with the Firebase Auth backend. - */ - apiKey: string; - /** - * The host at which the Firebase Auth backend is running. - */ - apiHost: string; - /** - * The scheme used to communicate with the Firebase Auth backend. - */ - apiScheme: string; - /** - * The host at which the Secure Token API is running. - */ - tokenApiHost: string; - /** - * The SDK Client Version. - */ - sdkClientVersion: string; - /** - * The domain at which the web widgets are hosted (provided via Firebase Config). - */ - authDomain?: string; -} - -/* Excluded from this release type: ConfigInternal */ - -/** - * Completes the password reset process, given a confirmation code and new password. - * - * @param auth - The {@link Auth} instance. - * @param oobCode - A confirmation code sent to the user. - * @param newPassword - The new password. - * - * @public - */ -export declare function confirmPasswordReset(auth: Auth, oobCode: string, newPassword: string): Promise<void>; - -/** - * Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production - * Firebase Auth services. - * - * @remarks - * This must be called synchronously immediately following the first call to - * {@link initializeAuth}. Do not use with production credentials as emulator - * traffic is not encrypted. - * - * - * @example - * ```javascript - * connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true }); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param url - The URL at which the emulator is running (eg, 'http://localhost:9099'). - * @param options - Optional. `options.disableWarnings` defaults to `false`. Set it to - * `true` to disable the warning banner attached to the DOM. - * - * @public - */ -export declare function connectAuthEmulator(auth: Auth, url: string, options?: { - disableWarnings: boolean; -}): void; - -/** - * Creates a new user account associated with the specified email address and password. - * - * @remarks - * On successful creation of the user account, this user will also be signed in to your application. - * - * User account creation can fail if the account already exists or the password is invalid. - * - * This method is not supported on {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * Note: The email address acts as a unique identifier for the user and enables an email-based - * password reset. This function will create a new user account and set the initial user password. - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * @param password - The user's chosen password. - * - * @public - */ -export declare function createUserWithEmailAndPassword(auth: Auth, email: string, password: string): Promise<UserCredential>; - -/** - * Map of OAuth Custom Parameters. - * - * @public - */ -export declare type CustomParameters = Record<string, string>; - -/** - * A verbose error map with detailed descriptions for most error codes. - * - * See discussion at {@link AuthErrorMap} - * - * @public - */ -export declare const debugErrorMap: AuthErrorMap; - -/** - * Deletes and signs out the user. - * - * @remarks - * Important: this is a security-sensitive operation that requires the user to have recently - * signed in. If this requirement isn't met, ask the user to authenticate again and then call - * {@link reauthenticateWithCredential}. - * - * @param user - The user. - * - * @public - */ -export declare function deleteUser(user: User): Promise<void>; - -/** - * The dependencies that can be used to initialize an {@link Auth} instance. - * - * @remarks - * - * The modular SDK enables tree shaking by allowing explicit declarations of - * dependencies. For example, a web app does not need to include code that - * enables Cordova redirect sign in. That functionality is therefore split into - * {@link browserPopupRedirectResolver} and - * {@link cordovaPopupRedirectResolver}. The dependencies object is how Auth is - * configured to reduce bundle sizes. - * - * There are two ways to initialize an {@link Auth} instance: {@link getAuth} and - * {@link initializeAuth}. `getAuth` initializes everything using - * platform-specific configurations, while `initializeAuth` takes a - * `Dependencies` object directly, giving you more control over what is used. - * - * @public - */ -declare interface Dependencies { - /** - * Which {@link Persistence} to use. If this is an array, the first - * `Persistence` that the device supports is used. The SDK searches for an - * existing account in order and, if one is found in a secondary - * `Persistence`, the account is moved to the primary `Persistence`. - * - * If no persistence is provided, the SDK falls back on - * {@link inMemoryPersistence}. - */ - persistence?: Persistence | Persistence[]; - /** - * The {@link PopupRedirectResolver} to use. This value depends on the - * platform. Options are {@link browserPopupRedirectResolver} and - * {@link cordovaPopupRedirectResolver}. This field is optional if neither - * {@link signInWithPopup} or {@link signInWithRedirect} are being used. - */ - popupRedirectResolver?: PopupRedirectResolver; - /** - * Which {@link AuthErrorMap} to use. - */ - errorMap?: AuthErrorMap; -} - -/** - * Interface that represents the credentials returned by {@link EmailAuthProvider} for - * {@link ProviderId}.PASSWORD - * - * @remarks - * Covers both {@link SignInMethod}.EMAIL_PASSWORD and - * {@link SignInMethod}.EMAIL_LINK. - * - * @public - */ -export declare class EmailAuthCredential extends AuthCredential { - /* Excluded from this release type: _email */ - /* Excluded from this release type: _password */ - /* Excluded from this release type: _tenantId */ - /* Excluded from this release type: __constructor */ - /* Excluded from this release type: _fromEmailAndPassword */ - /* Excluded from this release type: _fromEmailAndCode */ - /** {@inheritdoc AuthCredential.toJSON} */ - toJSON(): object; - /** - * Static method to deserialize a JSON representation of an object into an {@link AuthCredential}. - * - * @param json - Either `object` or the stringified representation of the object. When string is - * provided, `JSON.parse` would be called first. - * - * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned. - */ - static fromJSON(json: object | string): EmailAuthCredential | null; - /* Excluded from this release type: _getIdTokenResponse */ - /* Excluded from this release type: _linkToIdToken */ - /* Excluded from this release type: _getReauthenticationResolver */ -} - -/** - * Provider for generating {@link EmailAuthCredential}. - * - * @public - */ -export declare class EmailAuthProvider implements AuthProvider { - /** - * Always set to {@link ProviderId}.PASSWORD, even for email link. - */ - static readonly PROVIDER_ID: 'password'; - /** - * Always set to {@link SignInMethod}.EMAIL_PASSWORD. - */ - static readonly EMAIL_PASSWORD_SIGN_IN_METHOD: 'password'; - /** - * Always set to {@link SignInMethod}.EMAIL_LINK. - */ - static readonly EMAIL_LINK_SIGN_IN_METHOD: 'emailLink'; - /** - * Always set to {@link ProviderId}.PASSWORD, even for email link. - */ - readonly providerId: "password"; - /** - * Initialize an {@link AuthCredential} using an email and password. - * - * @example - * ```javascript - * const authCredential = EmailAuthProvider.credential(email, password); - * const userCredential = await signInWithCredential(auth, authCredential); - * ``` - * - * @example - * ```javascript - * const userCredential = await signInWithEmailAndPassword(auth, email, password); - * ``` - * - * @param email - Email address. - * @param password - User account password. - * @returns The auth provider credential. - */ - static credential(email: string, password: string): EmailAuthCredential; - /** - * Initialize an {@link AuthCredential} using an email and an email link after a sign in with - * email link operation. - * - * @example - * ```javascript - * const authCredential = EmailAuthProvider.credentialWithLink(auth, email, emailLink); - * const userCredential = await signInWithCredential(auth, authCredential); - * ``` - * - * @example - * ```javascript - * await sendSignInLinkToEmail(auth, email); - * // Obtain emailLink from user. - * const userCredential = await signInWithEmailLink(auth, email, emailLink); - * ``` - * - * @param auth - The {@link Auth} instance used to verify the link. - * @param email - Email address. - * @param emailLink - Sign-in email link. - * @returns - The auth provider credential. - */ - static credentialWithLink(email: string, emailLink: string): EmailAuthCredential; -} - -/** - * Configuration of Firebase Authentication Emulator. - * @public - */ -declare interface EmulatorConfig { - /** - * The protocol used to communicate with the emulator ("http"/"https"). - */ - readonly protocol: string; - /** - * The hostname of the emulator, which may be a domain ("localhost"), IPv4 address ("127.0.0.1") - * or quoted IPv6 address ("[::1]"). - */ - readonly host: string; - /** - * The port of the emulator, or null if port isn't specified (i.e. protocol default). - */ - readonly port: number | null; - /** - * The emulator-specific options. - */ - readonly options: { - /** - * Whether the warning banner attached to the DOM was disabled. - */ - readonly disableWarnings: boolean; - }; -} - -declare const enum EnforcementState { - ENFORCE = "ENFORCE", - AUDIT = "AUDIT", - OFF = "OFF", - ENFORCEMENT_STATE_UNSPECIFIED = "ENFORCEMENT_STATE_UNSPECIFIED" -} - -/* Excluded from this release type: EventManager */ - -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.FACEBOOK. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new FacebookAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('user_birthday'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = FacebookAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new FacebookAuthProvider(); - * provider.addScope('user_birthday'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = FacebookAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * ``` - * - * @public - */ -export declare class FacebookAuthProvider extends BaseOAuthProvider { - /** Always set to {@link SignInMethod}.FACEBOOK. */ - static readonly FACEBOOK_SIGN_IN_METHOD: 'facebook.com'; - /** Always set to {@link ProviderId}.FACEBOOK. */ - static readonly PROVIDER_ID: 'facebook.com'; - constructor(); - /** - * Creates a credential for Facebook. - * - * @example - * ```javascript - * // `event` from the Facebook auth.authResponseChange callback. - * const credential = FacebookAuthProvider.credential(event.authResponse.accessToken); - * const result = await signInWithCredential(credential); - * ``` - * - * @param accessToken - Facebook access token. - */ - static credential(accessToken: string): OAuthCredential; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): OAuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): OAuthCredential | null; - private static credentialFromTaggedObject; -} - -/** - * An enum of factors that may be used for multifactor authentication. - * - * @public - */ -declare const FactorId: { - /** Phone as second factor */ - readonly PHONE: "phone"; - readonly TOTP: "totp"; -}; - -/** - * The base class for all Federated providers (OAuth (including OIDC), SAML). - * - * This class is not meant to be instantiated directly. - * - * @public - */ -declare abstract class FederatedAuthProvider implements AuthProvider { - readonly providerId: string; - /* Excluded from this release type: defaultLanguageCode */ - /* Excluded from this release type: customParameters */ - /** - * Constructor for generic OAuth providers. - * - * @param providerId - Provider for which credentials should be generated. - */ - constructor(providerId: string); - /** - * Set the language gode. - * - * @param languageCode - language code - */ - setDefaultLanguage(languageCode: string | null): void; - /** - * Sets the OAuth custom parameters to pass in an OAuth request for popup and redirect sign-in - * operations. - * - * @remarks - * For a detailed list, check the reserved required OAuth 2.0 parameters such as `client_id`, - * `redirect_uri`, `scope`, `response_type`, and `state` are not allowed and will be ignored. - * - * @param customOAuthParameters - The custom OAuth parameters to pass in the OAuth request. - */ - setCustomParameters(customOAuthParameters: CustomParameters): AuthProvider; - /** - * Retrieve the current list of {@link CustomParameters}. - */ - getCustomParameters(): CustomParameters; -} - -/** - * Gets the list of possible sign in methods for the given email address. This method returns an - * empty list when - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection} - * is enabled, irrespective of the number of authentication methods available for the given email. - * - * @remarks - * This is useful to differentiate methods of sign-in for the same provider, eg. - * {@link EmailAuthProvider} which has 2 methods of sign-in, - * {@link SignInMethod}.EMAIL_PASSWORD and - * {@link SignInMethod}.EMAIL_LINK. - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * - * Deprecated. Migrating off of this method is recommended as a security best-practice. - * Learn more in the Identity Platform documentation for - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}. - * @public - */ -export declare function fetchSignInMethodsForEmail(auth: Auth, email: string): Promise<string[]>; - -declare interface FinalizeMfaResponse { - idToken: string; - refreshToken: string; -} - -/* Excluded from this release type: GenericAuthErrorParams */ - -/** - * Extracts provider specific {@link AdditionalUserInfo} for the given credential. - * - * @param userCredential - The user credential. - * - * @public - */ -export declare function getAdditionalUserInfo(userCredential: UserCredential): AdditionalUserInfo | null; - -/** - * Returns the Auth instance associated with the provided {@link @firebase/app#FirebaseApp}. - * If no instance exists, initializes an Auth instance with platform-specific default dependencies. - * - * @param app - The Firebase App. - * - * @public - */ -export declare function getAuth(app?: FirebaseApp): Auth; - -/** - * Returns a JSON Web Token (JWT) used to identify the user to a Firebase service. - * - * @remarks - * Returns the current token if it has not expired or if it will not expire in the next five - * minutes. Otherwise, this will refresh the token and return a new one. - * - * @param user - The user. - * @param forceRefresh - Force refresh regardless of token expiration. - * - * @public - */ -export declare function getIdToken(user: User, forceRefresh?: boolean): Promise<string>; - -/** - * Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service. - * - * @remarks - * Returns the current token if it has not expired or if it will not expire in the next five - * minutes. Otherwise, this will refresh the token and return a new one. - * - * @param user - The user. - * @param forceRefresh - Force refresh regardless of token expiration. - * - * @public - */ -export declare function getIdTokenResult(user: User, forceRefresh?: boolean): Promise<IdTokenResult>; - -/** - * Provides a {@link MultiFactorResolver} suitable for completion of a - * multi-factor flow. - * - * @param auth - The {@link Auth} instance. - * @param error - The {@link MultiFactorError} raised during a sign-in, or - * reauthentication operation. - * - * @public - */ -export declare function getMultiFactorResolver(auth: Auth, error: MultiFactorError): MultiFactorResolver; - -declare interface GetRecaptchaConfigResponse { - recaptchaKey: string; - recaptchaEnforcementState: RecaptchaEnforcementProviderState[]; -} - -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GITHUB. - * - * @remarks - * GitHub requires an OAuth 2.0 redirect, so you can either handle the redirect directly, or use - * the {@link signInWithPopup} handler: - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new GithubAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('repo'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a GitHub Access Token. - * const credential = GithubAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new GithubAuthProvider(); - * provider.addScope('repo'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a GitHub Access Token. - * const credential = GithubAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * ``` - * @public - */ -export declare class GithubAuthProvider extends BaseOAuthProvider { - /** Always set to {@link SignInMethod}.GITHUB. */ - static readonly GITHUB_SIGN_IN_METHOD: 'github.com'; - /** Always set to {@link ProviderId}.GITHUB. */ - static readonly PROVIDER_ID: 'github.com'; - constructor(); - /** - * Creates a credential for GitHub. - * - * @param accessToken - GitHub access token. - */ - static credential(accessToken: string): OAuthCredential; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): OAuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): OAuthCredential | null; - private static credentialFromTaggedObject; -} - -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GOOGLE. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new GoogleAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('profile'); - * provider.addScope('email'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Google Access Token. - * const credential = GoogleAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new GoogleAuthProvider(); - * provider.addScope('profile'); - * provider.addScope('email'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Google Access Token. - * const credential = GoogleAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * ``` - * - * @public - */ -export declare class GoogleAuthProvider extends BaseOAuthProvider { - /** Always set to {@link SignInMethod}.GOOGLE. */ - static readonly GOOGLE_SIGN_IN_METHOD: 'google.com'; - /** Always set to {@link ProviderId}.GOOGLE. */ - static readonly PROVIDER_ID: 'google.com'; - constructor(); - /** - * Creates a credential for Google. At least one of ID token and access token is required. - * - * @example - * ```javascript - * // \`googleUser\` from the onsuccess Google Sign In callback. - * const credential = GoogleAuthProvider.credential(googleUser.getAuthResponse().id_token); - * const result = await signInWithCredential(credential); - * ``` - * - * @param idToken - Google ID token. - * @param accessToken - Google access token. - */ - static credential(idToken?: string | null, accessToken?: string | null): OAuthCredential; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): OAuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): OAuthCredential | null; - private static credentialFromTaggedObject; -} - -/** - * Raw encoded JWT - * - */ -declare type IdToken = string; - -/* Excluded from this release type: IdTokenMfaResponse */ - -/* Excluded from this release type: IdTokenResponse */ - -/* Excluded from this release type: IdTokenResponseKind */ - -/** - * Interface representing ID token result obtained from {@link User.getIdTokenResult}. - * - * @remarks - * `IdTokenResult` contains the ID token JWT string and other helper properties for getting different data - * associated with the token as well as all the decoded payload claims. - * - * Note that these claims are not to be trusted as they are parsed client side. Only server side - * verification can guarantee the integrity of the token claims. - * - * @public - */ -declare interface IdTokenResult { - /** - * The authentication time formatted as a UTC string. - * - * @remarks - * This is the time the user authenticated (signed in) and not the time the token was refreshed. - */ - authTime: string; - /** The ID token expiration time formatted as a UTC string. */ - expirationTime: string; - /** The ID token issuance time formatted as a UTC string. */ - issuedAtTime: string; - /** - * The sign-in provider through which the ID token was obtained (anonymous, custom, phone, - * password, etc). - * - * @remarks - * Note, this does not map to provider IDs. - */ - signInProvider: string | null; - /** - * The type of second factor associated with this session, provided the user was multi-factor - * authenticated (eg. phone, etc). - */ - signInSecondFactor: string | null; - /** The Firebase Auth ID token JWT string. */ - token: string; - /** - * The entire payload claims of the ID token including the standard reserved claims as well as - * the custom claims. - */ - claims: ParsedToken; -} - -/** - * An implementation of {@link Persistence} of type `LOCAL` using `indexedDB` - * for the underlying storage. - * - * @public - */ -export declare const indexedDBLocalPersistence: Persistence; - -/** - * Initializes an {@link Auth} instance with fine-grained control over - * {@link Dependencies}. - * - * @remarks - * - * This function allows more control over the {@link Auth} instance than - * {@link getAuth}. `getAuth` uses platform-specific defaults to supply - * the {@link Dependencies}. In general, `getAuth` is the easiest way to - * initialize Auth and works for most use cases. Use `initializeAuth` if you - * need control over which persistence layer is used, or to minimize bundle - * size if you're not using either `signInWithPopup` or `signInWithRedirect`. - * - * For example, if your app only uses anonymous accounts and you only want - * accounts saved for the current session, initialize `Auth` with: - * - * ```js - * const auth = initializeAuth(app, { - * persistence: browserSessionPersistence, - * popupRedirectResolver: undefined, - * }); - * ``` - * - * @public - */ -export declare function initializeAuth(app: FirebaseApp, deps?: Dependencies): Auth; - -/** - * Loads the reCAPTCHA configuration into the `Auth` instance. - * - * @remarks - * This will load the reCAPTCHA config, which indicates whether the reCAPTCHA - * verification flow should be triggered for each auth provider, into the - * current Auth session. - * - * If initializeRecaptchaConfig() is not invoked, the auth flow will always start - * without reCAPTCHA verification. If the provider is configured to require reCAPTCHA - * verification, the SDK will transparently load the reCAPTCHA config and restart the - * auth flows. - * - * Thus, by calling this optional method, you will reduce the latency of future auth flows. - * Loading the reCAPTCHA config early will also enhance the signal collected by reCAPTCHA. - * - * This method does not work in a Node.js environment. - * - * @example - * ```javascript - * initializeRecaptchaConfig(auth); - * ``` - * - * @param auth - The {@link Auth} instance. - * - * @public - */ -export declare function initializeRecaptchaConfig(auth: Auth): Promise<void>; - -/** - * An implementation of {@link Persistence} of type 'NONE'. - * - * @public - */ -export declare const inMemoryPersistence: Persistence; - -/** - * Checks if an incoming link is a sign-in with email link suitable for {@link signInWithEmailLink}. - * - * @param auth - The {@link Auth} instance. - * @param emailLink - The link sent to the user's email address. - * - * @public - */ -export declare function isSignInWithEmailLink(auth: Auth, emailLink: string): boolean; - -/** - * Links the user account with the given credentials. - * - * @remarks - * An {@link AuthProvider} can be used to generate the credential. - * - * @param user - The user. - * @param credential - The auth credential. - * - * @public - */ -export declare function linkWithCredential(user: User, credential: AuthCredential): Promise<UserCredential>; - -/** - * MfaEnrollment can be any subtype of BaseMfaEnrollment, currently only PhoneMfaEnrollment and TotpMfaEnrollment are supported. - */ -declare type MfaEnrollment = PhoneMfaEnrollment | TotpMfaEnrollment; - -/** - * The {@link MultiFactorUser} corresponding to the user. - * - * @remarks - * This is used to access all multi-factor properties and operations related to the user. - * - * @param user - The user. - * - * @public - */ -export declare function multiFactor(user: User): MultiFactorUser; - -/** - * The base class for asserting ownership of a second factor. - * - * @remarks - * This is used to facilitate enrollment of a second factor on an existing user or sign-in of a - * user who already verified the first factor. - * - * @public - */ -declare interface MultiFactorAssertion { - /** The identifier of the second factor. */ - readonly factorId: (typeof FactorId)[keyof typeof FactorId]; -} - -/** - * The error thrown when the user needs to provide a second factor to sign in successfully. - * - * @remarks - * The error code for this error is `auth/multi-factor-auth-required`. - * - * @example - * ```javascript - * let resolver; - * let multiFactorHints; - * - * signInWithEmailAndPassword(auth, email, password) - * .then((result) => { - * // User signed in. No 2nd factor challenge is needed. - * }) - * .catch((error) => { - * if (error.code == 'auth/multi-factor-auth-required') { - * resolver = getMultiFactorResolver(auth, error); - * multiFactorHints = resolver.hints; - * } else { - * // Handle other errors. - * } - * }); - * - * // Obtain a multiFactorAssertion by verifying the second factor. - * - * const userCredential = await resolver.resolveSignIn(multiFactorAssertion); - * ``` - * - * @public - */ -declare interface MultiFactorError extends AuthError { - /** Details about the MultiFactorError. */ - readonly customData: AuthError['customData'] & { - /** - * The type of operation (sign-in, linking, or re-authentication) that raised the error. - */ - readonly operationType: (typeof OperationType)[keyof typeof OperationType]; - }; -} - -/** - * A structure containing the information of a second factor entity. - * - * @public - */ -declare interface MultiFactorInfo { - /** The multi-factor enrollment ID. */ - readonly uid: string; - /** The user friendly name of the current second factor. */ - readonly displayName?: string | null; - /** The enrollment date of the second factor formatted as a UTC string. */ - readonly enrollmentTime: string; - /** The identifier of the second factor. */ - readonly factorId: (typeof FactorId)[keyof typeof FactorId]; -} - -/** - * The class used to facilitate recovery from {@link MultiFactorError} when a user needs to - * provide a second factor to sign in. - * - * @example - * ```javascript - * let resolver; - * let multiFactorHints; - * - * signInWithEmailAndPassword(auth, email, password) - * .then((result) => { - * // User signed in. No 2nd factor challenge is needed. - * }) - * .catch((error) => { - * if (error.code == 'auth/multi-factor-auth-required') { - * resolver = getMultiFactorResolver(auth, error); - * // Show UI to let user select second factor. - * multiFactorHints = resolver.hints; - * } else { - * // Handle other errors. - * } - * }); - * - * // The enrolled second factors that can be used to complete - * // sign-in are returned in the `MultiFactorResolver.hints` list. - * // UI needs to be presented to allow the user to select a second factor - * // from that list. - * - * const selectedHint = // ; selected from multiFactorHints - * const phoneAuthProvider = new PhoneAuthProvider(auth); - * const phoneInfoOptions = { - * multiFactorHint: selectedHint, - * session: resolver.session - * }; - * const verificationId = phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier); - * // Store `verificationId` and show UI to let user enter verification code. - * - * // UI to enter verification code and continue. - * // Continue button click handler - * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential); - * const userCredential = await resolver.resolveSignIn(multiFactorAssertion); - * ``` - * - * @public - */ -declare interface MultiFactorResolver { - /** - * The list of hints for the second factors needed to complete the sign-in for the current - * session. - */ - readonly hints: MultiFactorInfo[]; - /** - * The session identifier for the current sign-in flow, which can be used to complete the second - * factor sign-in. - */ - readonly session: MultiFactorSession; - /** - * A helper function to help users complete sign in with a second factor using an - * {@link MultiFactorAssertion} confirming the user successfully completed the second factor - * challenge. - * - * @example - * ```javascript - * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential); - * const userCredential = await resolver.resolveSignIn(multiFactorAssertion); - * ``` - * - * @param assertion - The multi-factor assertion to resolve sign-in with. - * @returns The promise that resolves with the user credential object. - */ - resolveSignIn(assertion: MultiFactorAssertion): Promise<UserCredential>; -} - -/** - * An interface defining the multi-factor session object used for enrolling a second factor on a - * user or helping sign in an enrolled user with a second factor. - * - * @public - */ -declare interface MultiFactorSession { -} - -/** - * An interface that defines the multi-factor related properties and operations pertaining - * to a {@link User}. - * - * @public - */ -declare interface MultiFactorUser { - /** Returns a list of the user's enrolled second factors. */ - readonly enrolledFactors: MultiFactorInfo[]; - /** - * Returns the session identifier for a second factor enrollment operation. This is used to - * identify the user trying to enroll a second factor. - * - * @example - * ```javascript - * const multiFactorUser = multiFactor(auth.currentUser); - * const multiFactorSession = await multiFactorUser.getSession(); - * - * // Send verification code. - * const phoneAuthProvider = new PhoneAuthProvider(auth); - * const phoneInfoOptions = { - * phoneNumber: phoneNumber, - * session: multiFactorSession - * }; - * const verificationId = await phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier); - * - * // Obtain verification code from user. - * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential); - * await multiFactorUser.enroll(multiFactorAssertion); - * ``` - * - * @returns The promise that resolves with the {@link MultiFactorSession}. - */ - getSession(): Promise<MultiFactorSession>; - /** - * - * Enrolls a second factor as identified by the {@link MultiFactorAssertion} for the - * user. - * - * @remarks - * On resolution, the user tokens are updated to reflect the change in the JWT payload. - * Accepts an additional display name parameter used to identify the second factor to the end - * user. Recent re-authentication is required for this operation to succeed. On successful - * enrollment, existing Firebase sessions (refresh tokens) are revoked. When a new factor is - * enrolled, an email notification is sent to the user’s email. - * - * @example - * ```javascript - * const multiFactorUser = multiFactor(auth.currentUser); - * const multiFactorSession = await multiFactorUser.getSession(); - * - * // Send verification code. - * const phoneAuthProvider = new PhoneAuthProvider(auth); - * const phoneInfoOptions = { - * phoneNumber: phoneNumber, - * session: multiFactorSession - * }; - * const verificationId = await phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier); - * - * // Obtain verification code from user. - * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential); - * await multiFactorUser.enroll(multiFactorAssertion); - * // Second factor enrolled. - * ``` - * - * @param assertion - The multi-factor assertion to enroll with. - * @param displayName - The display name of the second factor. - */ - enroll(assertion: MultiFactorAssertion, displayName?: string | null): Promise<void>; - /** - * Unenrolls the specified second factor. - * - * @remarks - * To specify the factor to remove, pass a {@link MultiFactorInfo} object (retrieved from - * {@link MultiFactorUser.enrolledFactors}) or the - * factor's UID string. Sessions are not revoked when the account is unenrolled. An email - * notification is likely to be sent to the user notifying them of the change. Recent - * re-authentication is required for this operation to succeed. When an existing factor is - * unenrolled, an email notification is sent to the user’s email. - * - * @example - * ```javascript - * const multiFactorUser = multiFactor(auth.currentUser); - * // Present user the option to choose which factor to unenroll. - * await multiFactorUser.unenroll(multiFactorUser.enrolledFactors[i]) - * ``` - * - * @param option - The multi-factor option to unenroll. - * @returns - A `Promise` which resolves when the unenroll operation is complete. - */ - unenroll(option: MultiFactorInfo | string): Promise<void>; -} - -declare type MutableUserInfo = { - -readonly [K in keyof UserInfo]: UserInfo[K]; -}; - -/** - * Type definition for an event callback. - * - * @privateRemarks TODO(avolkovi): should we consolidate with Subscribe<T> since we're changing the API anyway? - * - * @public - */ -declare type NextOrObserver<T> = NextFn<T | null> | Observer<T | null>; - -/** - * Represents the OAuth credentials returned by an {@link OAuthProvider}. - * - * @remarks - * Implementations specify the details about each auth provider's credential requirements. - * - * @public - */ -export declare class OAuthCredential extends AuthCredential { - /** - * The OAuth ID token associated with the credential if it belongs to an OIDC provider, - * such as `google.com`. - * @readonly - */ - idToken?: string; - /** - * The OAuth access token associated with the credential if it belongs to an - * {@link OAuthProvider}, such as `facebook.com`, `twitter.com`, etc. - * @readonly - */ - accessToken?: string; - /** - * The OAuth access token secret associated with the credential if it belongs to an OAuth 1.0 - * provider, such as `twitter.com`. - * @readonly - */ - secret?: string; - private nonce?; - private pendingToken; - /* Excluded from this release type: _fromParams */ - /** {@inheritdoc AuthCredential.toJSON} */ - toJSON(): object; - /** - * Static method to deserialize a JSON representation of an object into an - * {@link AuthCredential}. - * - * @param json - Input can be either Object or the stringified representation of the object. - * When string is provided, JSON.parse would be called first. - * - * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned. - */ - static fromJSON(json: string | object): OAuthCredential | null; - /* Excluded from this release type: _getIdTokenResponse */ - /* Excluded from this release type: _linkToIdToken */ - /* Excluded from this release type: _getReauthenticationResolver */ - private buildRequest; -} - -/** - * Defines the options for initializing an {@link OAuthCredential}. - * - * @remarks - * For ID tokens with nonce claim, the raw nonce has to also be provided. - * - * @public - */ -export declare interface OAuthCredentialOptions { - /** - * The OAuth ID token used to initialize the {@link OAuthCredential}. - */ - idToken?: string; - /** - * The OAuth access token used to initialize the {@link OAuthCredential}. - */ - accessToken?: string; - /** - * The raw nonce associated with the ID token. - * - * @remarks - * It is required when an ID token with a nonce field is provided. The SHA-256 hash of the - * raw nonce must match the nonce field in the ID token. - */ - rawNonce?: string; -} - -declare interface OAuthCredentialParams { - idToken?: string | null; - accessToken?: string | null; - oauthToken?: string; - secret?: string; - oauthTokenSecret?: string; - nonce?: string; - pendingToken?: string; - providerId: string; - signInMethod: string; -} - -/** - * Provider for generating generic {@link OAuthCredential}. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new OAuthProvider('google.com'); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('profile'); - * provider.addScope('email'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a OAuth Access Token for the provider. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new OAuthProvider('google.com'); - * provider.addScope('profile'); - * provider.addScope('email'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a OAuth Access Token for the provider. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * ``` - * @public - */ -export declare class OAuthProvider extends BaseOAuthProvider { - /** - * Creates an {@link OAuthCredential} from a JSON string or a plain object. - * @param json - A plain object or a JSON string - */ - static credentialFromJSON(json: object | string): OAuthCredential; - /** - * Creates a {@link OAuthCredential} from a generic OAuth provider's access token or ID token. - * - * @remarks - * The raw nonce is required when an ID token with a nonce field is provided. The SHA-256 hash of - * the raw nonce must match the nonce field in the ID token. - * - * @example - * ```javascript - * // `googleUser` from the onsuccess Google Sign In callback. - * // Initialize a generate OAuth provider with a `google.com` providerId. - * const provider = new OAuthProvider('google.com'); - * const credential = provider.credential({ - * idToken: googleUser.getAuthResponse().id_token, - * }); - * const result = await signInWithCredential(credential); - * ``` - * - * @param params - Either the options object containing the ID token, access token and raw nonce - * or the ID token string. - */ - credential(params: OAuthCredentialOptions): OAuthCredential; - /** An internal credential method that accepts more permissive options */ - private _credential; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): OAuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): OAuthCredential | null; - private static oauthCredentialFromTaggedObject; -} - -/** - * Adds an observer for changes to the user's sign-in state. - * - * @remarks - * To keep the old behavior, see {@link onIdTokenChanged}. - * - * @param auth - The {@link Auth} instance. - * @param nextOrObserver - callback triggered on change. - * @param error - Deprecated. This callback is never triggered. Errors - * on signing in/out can be caught in promises returned from - * sign-in/sign-out functions. - * @param completed - Deprecated. This callback is never triggered. - * - * @public - */ -export declare function onAuthStateChanged(auth: Auth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe; - -/** - * Adds an observer for changes to the signed-in user's ID token. - * - * @remarks - * This includes sign-in, sign-out, and token refresh events. - * This will not be triggered automatically upon ID token expiration. Use {@link User.getIdToken} to refresh the ID token. - * - * @param auth - The {@link Auth} instance. - * @param nextOrObserver - callback triggered on change. - * @param error - Deprecated. This callback is never triggered. Errors - * on signing in/out can be caught in promises returned from - * sign-in/sign-out functions. - * @param completed - Deprecated. This callback is never triggered. - * - * @public - */ -export declare function onIdTokenChanged(auth: Auth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe; - -/** - * Enumeration of supported operation types. - * - * @public - */ -declare const OperationType: { - /** Operation involving linking an additional provider to an already signed-in user. */ - readonly LINK: "link"; - /** Operation involving using a provider to reauthenticate an already signed-in user. */ - readonly REAUTHENTICATE: "reauthenticate"; - /** Operation involving signing in a user. */ - readonly SIGN_IN: "signIn"; -}; - -/** - * Parses the email action link string and returns an {@link ActionCodeURL} if - * the link is valid, otherwise returns null. - * - * @public - */ -export declare function parseActionCodeURL(link: string): ActionCodeURL | null; - -/** - * Interface representing a parsed ID token. - * - * @privateRemarks TODO(avolkovi): consolidate with parsed_token in implementation. - * - * @public - */ -declare interface ParsedToken { - /** Expiration time of the token. */ - 'exp'?: string; - /** UID of the user. */ - 'sub'?: string; - /** Time at which authentication was performed. */ - 'auth_time'?: string; - /** Issuance time of the token. */ - 'iat'?: string; - /** Firebase specific claims, containing the provider(s) used to authenticate the user. */ - 'firebase'?: { - 'sign_in_provider'?: string; - 'sign_in_second_factor'?: string; - 'identities'?: Record<string, string>; - }; - /** Map of any additional custom claims. */ - [key: string]: unknown; -} - -/** - * A structure specifying password policy requirements. - * - * @public - */ -declare interface PasswordPolicy { - /** - * Requirements enforced by this password policy. - */ - readonly customStrengthOptions: { - /** - * Minimum password length, or undefined if not configured. - */ - readonly minPasswordLength?: number; - /** - * Maximum password length, or undefined if not configured. - */ - readonly maxPasswordLength?: number; - /** - * Whether the password should contain a lowercase letter, or undefined if not configured. - */ - readonly containsLowercaseLetter?: boolean; - /** - * Whether the password should contain an uppercase letter, or undefined if not configured. - */ - readonly containsUppercaseLetter?: boolean; - /** - * Whether the password should contain a numeric character, or undefined if not configured. - */ - readonly containsNumericCharacter?: boolean; - /** - * Whether the password should contain a non-alphanumeric character, or undefined if not configured. - */ - readonly containsNonAlphanumericCharacter?: boolean; - }; - /** - * List of characters that are considered non-alphanumeric during validation. - */ - readonly allowedNonAlphanumericCharacters: string; - /** - * The enforcement state of the policy. Can be 'OFF' or 'ENFORCE'. - */ - readonly enforcementState: string; - /** - * Whether existing passwords must meet the policy. - */ - readonly forceUpgradeOnSignin: boolean; -} - -/* Excluded from this release type: PasswordPolicyCustomStrengthOptions */ - -/* Excluded from this release type: PasswordPolicyInternal */ - -/** - * A structure indicating which password policy requirements were met or violated and what the - * requirements are. - * - * @public - */ -declare interface PasswordValidationStatus { - /** - * Whether the password meets all requirements. - */ - readonly isValid: boolean; - /** - * Whether the password meets the minimum password length, or undefined if not required. - */ - readonly meetsMinPasswordLength?: boolean; - /** - * Whether the password meets the maximum password length, or undefined if not required. - */ - readonly meetsMaxPasswordLength?: boolean; - /** - * Whether the password contains a lowercase letter, or undefined if not required. - */ - readonly containsLowercaseLetter?: boolean; - /** - * Whether the password contains an uppercase letter, or undefined if not required. - */ - readonly containsUppercaseLetter?: boolean; - /** - * Whether the password contains a numeric character, or undefined if not required. - */ - readonly containsNumericCharacter?: boolean; - /** - * Whether the password contains a non-alphanumeric character, or undefined if not required. - */ - readonly containsNonAlphanumericCharacter?: boolean; - /** - * The policy used to validate the password. - */ - readonly passwordPolicy: PasswordPolicy; -} - -declare type PersistedBlob = Record<string, unknown>; - -/** - * An interface covering the possible persistence mechanism types. - * - * @public - */ -declare interface Persistence { - /** - * Type of Persistence. - * - 'SESSION' is used for temporary persistence such as `sessionStorage`. - * - 'LOCAL' is used for long term persistence such as `localStorage` or `IndexedDB`. - * - 'NONE' is used for in-memory, or no persistence. - * - 'COOKIE' is used for cookie persistence, useful for server-side rendering. - */ - readonly type: 'SESSION' | 'LOCAL' | 'NONE' | 'COOKIE'; -} - -declare interface PersistenceInternal extends Persistence { - type: PersistenceType; - _isAvailable(): Promise<boolean>; - _set(key: string, value: PersistenceValue): Promise<void>; - _get<T extends PersistenceValue>(key: string): Promise<T | null>; - _remove(key: string): Promise<void>; - _addListener(key: string, listener: StorageEventListener): void; - _removeListener(key: string, listener: StorageEventListener): void; - _shouldAllowMigration?: boolean; -} - -declare const enum PersistenceType { - SESSION = "SESSION", - LOCAL = "LOCAL", - NONE = "NONE", - COOKIE = "COOKIE" -} - -declare type PersistenceValue = PersistedBlob | string; - -/** - * Represents the credentials returned by {@link PhoneAuthProvider}. - * - * @public - */ -export declare class PhoneAuthCredential extends AuthCredential { - private readonly params; - private constructor(); - /* Excluded from this release type: _fromVerification */ - /* Excluded from this release type: _fromTokenResponse */ - /* Excluded from this release type: _getIdTokenResponse */ - /* Excluded from this release type: _linkToIdToken */ - /* Excluded from this release type: _getReauthenticationResolver */ - /* Excluded from this release type: _makeVerificationRequest */ - /** {@inheritdoc AuthCredential.toJSON} */ - toJSON(): object; - /** Generates a phone credential based on a plain object or a JSON string. */ - static fromJSON(json: object | string): PhoneAuthCredential | null; -} - -/** - * An MFA provided by SMS verification. - */ -declare interface PhoneMfaEnrollment extends BaseMfaEnrollment { - phoneInfo: string; -} - -/* Excluded from this release type: PhoneOrOauthTokenResponse */ - -/** - * A resolver used for handling DOM specific operations like {@link signInWithPopup} - * or {@link signInWithRedirect}. - * - * @public - */ -declare interface PopupRedirectResolver { -} - -/* Excluded from this release type: PopupRedirectResolverInternal */ - -/** - * A minimal error map with all verbose error messages stripped. - * - * See discussion at {@link AuthErrorMap} - * - * @public - */ -export declare const prodErrorMap: AuthErrorMap; - -/* Excluded from this release type: ProviderId */ - -declare interface ProviderUserInfo { - providerId: string; - rawId?: string; - email?: string; - displayName?: string; - photoUrl?: string; - phoneNumber?: string; -} - -/** - * Re-authenticates a user using a fresh credential. - * - * @remarks - * Use before operations such as {@link updatePassword} that require tokens from recent sign-in - * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error - * or a `TOKEN_EXPIRED` error. - * - * This method is not supported on any {@link User} signed in by {@link Auth} instances - * created with a {@link @firebase/app#FirebaseServerApp}. - * - * @param user - The user. - * @param credential - The auth credential. - * - * @public - */ -export declare function reauthenticateWithCredential(user: User, credential: AuthCredential): Promise<UserCredential>; - -declare class RecaptchaConfig { - /** - * The reCAPTCHA site key. - */ - siteKey: string; - /** - * The list of providers and their enablement status for reCAPTCHA Enterprise. - */ - recaptchaEnforcementState: RecaptchaEnforcementProviderState[]; - constructor(response: GetRecaptchaConfigResponse); - /** - * Returns the reCAPTCHA Enterprise enforcement state for the given provider. - * - * @param providerStr - The provider whose enforcement state is to be returned. - * @returns The reCAPTCHA Enterprise enforcement state for the given provider. - */ - getProviderEnforcementState(providerStr: string): EnforcementState | null; - /** - * Returns true if the reCAPTCHA Enterprise enforcement state for the provider is set to ENFORCE or AUDIT. - * - * @param providerStr - The provider whose enablement state is to be returned. - * @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider. - */ - isProviderEnabled(providerStr: string): boolean; - /** - * Returns true if reCAPTCHA Enterprise protection is enabled in at least one provider, otherwise - * returns false. - * - * @returns Whether or not reCAPTCHA Enterprise protection is enabled for at least one provider. - */ - isAnyProviderEnabled(): boolean; -} - -declare interface RecaptchaEnforcementProviderState { - provider: string; - enforcementState: string; -} - -/** - * Reloads user account data, if signed in. - * - * @param user - The user. - * - * @public - */ -export declare function reload(user: User): Promise<void>; - -/** - * Revokes the given access token. Currently only supports Apple OAuth access tokens. - * - * @param auth - The {@link Auth} instance. - * @param token - The Apple OAuth access token. - * - * @public - */ -export declare function revokeAccessToken(auth: Auth, token: string): Promise<void>; - -/** - * An {@link AuthProvider} for SAML. - * - * @public - */ -export declare class SAMLAuthProvider extends FederatedAuthProvider { - /** - * Constructor. The providerId must start with "saml." - * @param providerId - SAML provider ID. - */ - constructor(providerId: string); - /** - * Generates an {@link AuthCredential} from a {@link UserCredential} after a - * successful SAML flow completes. - * - * @remarks - * - * For example, to get an {@link AuthCredential}, you could write the - * following code: - * - * ```js - * const userCredential = await signInWithPopup(auth, samlProvider); - * const credential = SAMLAuthProvider.credentialFromResult(userCredential); - * ``` - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): AuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): AuthCredential | null; - /** - * Creates an {@link AuthCredential} from a JSON string or a plain object. - * @param json - A plain object or a JSON string - */ - static credentialFromJSON(json: string | object): AuthCredential; - private static samlCredentialFromTaggedObject; -} - -/** - * Sends a verification email to a user. - * - * @remarks - * The verification process is completed by calling {@link applyActionCode}. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendEmailVerification(user, actionCodeSettings); - * // Obtain code from the user. - * await applyActionCode(auth, code); - * ``` - * - * @param user - The user. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ -export declare function sendEmailVerification(user: User, actionCodeSettings?: ActionCodeSettings | null): Promise<void>; - -/** - * Sends a password reset email to the given email address. This method does not throw an error when - * there's no user account with the given email address and - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection} - * is enabled. - * - * @remarks - * To complete the password reset, call {@link confirmPasswordReset} with the code supplied in - * the email sent to the user, along with the new password specified by the user. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendPasswordResetEmail(auth, 'user@example.com', actionCodeSettings); - * // Obtain code from user. - * await confirmPasswordReset('user@example.com', code); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ -export declare function sendPasswordResetEmail(auth: Auth, email: string, actionCodeSettings?: ActionCodeSettings): Promise<void>; - -/** - * Sends a sign-in email link to the user with the specified email. - * - * @remarks - * The sign-in operation has to always be completed in the app unlike other out of band email - * actions (password reset and email verifications). This is because, at the end of the flow, - * the user is expected to be signed in and their Auth state persisted within the app. - * - * To complete sign in with the email link, call {@link signInWithEmailLink} with the email - * address and the email link supplied in the email sent to the user. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings); - * // Obtain emailLink from the user. - * if(isSignInWithEmailLink(auth, emailLink)) { - * await signInWithEmailLink(auth, 'user@example.com', emailLink); - * } - * ``` - * - * @param authInternal - The {@link Auth} instance. - * @param email - The user's email address. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ -export declare function sendSignInLinkToEmail(auth: Auth, email: string, actionCodeSettings: ActionCodeSettings): Promise<void>; - -/** - * Changes the type of persistence on the {@link Auth} instance for the currently saved - * `Auth` session and applies this type of persistence for future sign-in requests, including - * sign-in with redirect requests. - * - * @remarks - * This makes it easy for a user signing in to specify whether their session should be - * remembered or not. It also makes it easier to never persist the `Auth` state for applications - * that are shared by other users or have sensitive data. - * - * This method does not work in a Node.js environment or with {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * setPersistence(auth, browserSessionPersistence); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param persistence - The {@link Persistence} to use. - * @returns A `Promise` that resolves once the persistence change has completed - * - * @public - */ -export declare function setPersistence(auth: Auth, persistence: Persistence): Promise<void>; - -/** - * Asynchronously signs in as an anonymous user. - * - * @remarks - * If there is already an anonymous user signed in, that user will be returned; otherwise, a - * new anonymous user identity will be created and returned. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * - * @public - */ -export declare function signInAnonymously(auth: Auth): Promise<UserCredential>; - -/** - * Asynchronously signs in with the given credentials. - * - * @remarks - * An {@link AuthProvider} can be used to generate the credential. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * @param credential - The auth credential. - * - * @public - */ -export declare function signInWithCredential(auth: Auth, credential: AuthCredential): Promise<UserCredential>; - -/** - * Asynchronously signs in using a custom token. - * - * @remarks - * Custom tokens are used to integrate Firebase Auth with existing auth systems, and must - * be generated by an auth backend using the - * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#createcustomtoken | createCustomToken} - * method in the {@link https://firebase.google.com/docs/auth/admin | Admin SDK} . - * - * Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * @param customToken - The custom token to sign in with. - * - * @public - */ -export declare function signInWithCustomToken(auth: Auth, customToken: string): Promise<UserCredential>; - -/** - * Asynchronously signs in using an email and password. - * - * @remarks - * Fails with an error if the email address and password do not match. When - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection} - * is enabled, this method fails with "auth/invalid-credential" in case of an invalid - * email/password. - * - * This method is not supported on {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * Note: The user's password is NOT the password used to access the user's email account. The - * email address serves as a unique identifier for the user, and the password is used to access - * the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}. - * - * - * @param auth - The {@link Auth} instance. - * @param email - The users email address. - * @param password - The users password. - * - * @public - */ -export declare function signInWithEmailAndPassword(auth: Auth, email: string, password: string): Promise<UserCredential>; - -/** - * Asynchronously signs in using an email and sign-in email link. - * - * @remarks - * If no link is passed, the link is inferred from the current URL. - * - * Fails with an error if the email address is invalid or OTP in email link expires. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings); - * // Obtain emailLink from the user. - * if(isSignInWithEmailLink(auth, emailLink)) { - * await signInWithEmailLink(auth, 'user@example.com', emailLink); - * } - * ``` - * - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * @param emailLink - The link sent to the user's email address. - * - * @public - */ -export declare function signInWithEmailLink(auth: Auth, email: string, emailLink?: string): Promise<UserCredential>; - -/* Excluded from this release type: SignInWithIdpResponse */ - -/* Excluded from this release type: SignInWithPhoneNumberRequest */ - -/* Excluded from this release type: SignInWithPhoneNumberResponse */ - -/** - * Signs out the current user. - * - * @remarks - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * - * @public - */ -export declare function signOut(auth: Auth): Promise<void>; - -declare interface StartTotpMfaEnrollmentResponse { - totpSessionInfo: { - sharedSecretKey: string; - verificationCodeLength: number; - hashingAlgorithm: string; - periodSec: number; - sessionInfo: string; - finalizeEnrollmentTime: number; - }; -} - -declare interface StorageEventListener { - (value: PersistenceValue | null): void; -} - -/* Excluded from this release type: StsTokenManager */ - -/* Excluded from this release type: TaggedWithTokenResponse */ - -/** - * An MFA provided by TOTP (Time-based One Time Password). - */ -declare interface TotpMfaEnrollment extends BaseMfaEnrollment { -} - -/** - * The class for asserting ownership of a TOTP second factor. Provided by - * {@link TotpMultiFactorGenerator.assertionForEnrollment} and - * {@link TotpMultiFactorGenerator.assertionForSignIn}. - * - * @public - */ -declare interface TotpMultiFactorAssertion extends MultiFactorAssertion { -} - -/** - * Provider for generating a {@link TotpMultiFactorAssertion}. - * - * @public - */ -export declare class TotpMultiFactorGenerator { - /** - * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of - * the TOTP (time-based one-time password) second factor. - * This assertion is used to complete enrollment in TOTP second factor. - * - * @param secret A {@link TotpSecret} containing the shared secret key and other TOTP parameters. - * @param oneTimePassword One-time password from TOTP App. - * @returns A {@link TotpMultiFactorAssertion} which can be used with - * {@link MultiFactorUser.enroll}. - */ - static assertionForEnrollment(secret: TotpSecret, oneTimePassword: string): TotpMultiFactorAssertion; - /** - * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of the TOTP second factor. - * This assertion is used to complete signIn with TOTP as the second factor. - * - * @param enrollmentId identifies the enrolled TOTP second factor. - * @param oneTimePassword One-time password from TOTP App. - * @returns A {@link TotpMultiFactorAssertion} which can be used with - * {@link MultiFactorResolver.resolveSignIn}. - */ - static assertionForSignIn(enrollmentId: string, oneTimePassword: string): TotpMultiFactorAssertion; - /** - * Returns a promise to {@link TotpSecret} which contains the TOTP shared secret key and other parameters. - * 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 {@link MultiFactorSession} that the user is part of. - * @returns A promise to {@link TotpSecret}. - */ - static generateSecret(session: MultiFactorSession): Promise<TotpSecret>; - /** - * The identifier of the TOTP second factor: `totp`. - */ - static FACTOR_ID: 'totp'; -} - -/** - * Provider for generating a {@link TotpMultiFactorAssertion}. - * - * Stores the shared secret key and other parameters to generate time-based OTPs. - * Implements methods to retrieve the shared secret key and generate a QR code URL. - * @public - */ -export declare class TotpSecret { - private readonly sessionInfo; - private readonly auth; - /** - * Shared secret key/seed used for enrolling in TOTP MFA and generating OTPs. - */ - readonly secretKey: string; - /** - * Hashing algorithm used. - */ - readonly hashingAlgorithm: string; - /** - * Length of the one-time passwords to be generated. - */ - readonly codeLength: number; - /** - * The interval (in seconds) when the OTP codes should change. - */ - readonly codeIntervalSeconds: number; - /** - * The timestamp (UTC string) by which TOTP enrollment should be completed. - */ - readonly enrollmentCompletionDeadline: string; - private constructor(); - /* Excluded from this release type: _fromStartTotpMfaEnrollmentResponse */ - /* Excluded from this release type: _makeTotpVerificationInfo */ - /** - * Returns a QR code URL as described in - * https://github.com/google/google-authenticator/wiki/Key-Uri-Format - * This can be displayed to the user as a QR code to be scanned into a TOTP app like Google Authenticator. - * If the optional parameters are unspecified, an accountName of <userEmail> and issuer of <firebaseAppName> are used. - * - * @param accountName the name of the account/app along with a user identifier. - * @param issuer issuer of the TOTP (likely the app name). - * @returns A QR code URL string. - */ - generateQrCodeUrl(accountName?: string, issuer?: string): string; -} - -declare interface TotpVerificationInfo { - sessionInfo: string; - verificationCode: string; -} - -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.TWITTER. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new TwitterAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Twitter Access Token and Secret. - * const credential = TwitterAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * const secret = credential.secret; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new TwitterAuthProvider(); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Twitter Access Token and Secret. - * const credential = TwitterAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * const secret = credential.secret; - * ``` - * - * @public - */ -export declare class TwitterAuthProvider extends BaseOAuthProvider { - /** Always set to {@link SignInMethod}.TWITTER. */ - static readonly TWITTER_SIGN_IN_METHOD: 'twitter.com'; - /** Always set to {@link ProviderId}.TWITTER. */ - static readonly PROVIDER_ID: 'twitter.com'; - constructor(); - /** - * Creates a credential for Twitter. - * - * @param token - Twitter access token. - * @param secret - Twitter secret. - */ - static credential(token: string, secret: string): OAuthCredential; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): OAuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): OAuthCredential | null; - private static credentialFromTaggedObject; -} - -/** - * Unlinks a provider from a user account. - * - * @param user - The user. - * @param providerId - The provider to unlink. - * - * @public - */ -export declare function unlink(user: User, providerId: string): Promise<User>; - -/** - * Asynchronously sets the provided user as {@link Auth.currentUser} on the - * {@link Auth} instance. - * - * @remarks - * A new instance copy of the user provided will be made and set as currentUser. - * - * This will trigger {@link onAuthStateChanged} and {@link onIdTokenChanged} listeners - * like other sign in methods. - * - * The operation fails with an error if the user to be updated belongs to a different Firebase - * project. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * @param user - The new {@link User}. - * - * @public - */ -export declare function updateCurrentUser(auth: Auth, user: User | null): Promise<void>; - -/** - * Updates the user's email address. - * - * @remarks - * An email will be sent to the original email address (if it was set) that allows to revoke the - * email address change, in order to protect them from account hijacking. - * - * This method is not supported on any {@link User} signed in by {@link Auth} instances - * created with a {@link @firebase/app#FirebaseServerApp}. - * - * Important: this is a security sensitive operation that requires the user to have recently signed - * in. If this requirement isn't met, ask the user to authenticate again and then call - * {@link reauthenticateWithCredential}. - * - * @param user - The user. - * @param newEmail - The new email address. - * - * Throws "auth/operation-not-allowed" error when - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection} - * is enabled. - * Deprecated - Use {@link verifyBeforeUpdateEmail} instead. - * - * @public - */ -export declare function updateEmail(user: User, newEmail: string): Promise<void>; - -/** - * Updates the user's password. - * - * @remarks - * Important: this is a security sensitive operation that requires the user to have recently signed - * in. If this requirement isn't met, ask the user to authenticate again and then call - * {@link reauthenticateWithCredential}. - * - * @param user - The user. - * @param newPassword - The new password. - * - * @public - */ -export declare function updatePassword(user: User, newPassword: string): Promise<void>; - -/** - * Updates a user's profile data. - * - * @param user - The user. - * @param profile - The profile's `displayName` and `photoURL` to update. - * - * @public - */ -export declare function updateProfile(user: User, { displayName, photoURL: photoUrl }: { - displayName?: string | null; - photoURL?: string | null; -}): Promise<void>; - -/** - * Sets the current language to the default device/browser preference. - * - * @param auth - The {@link Auth} instance. - * - * @public - */ -export declare function useDeviceLanguage(auth: Auth): void; - -/** - * A user account. - * - * @public - */ -declare interface User extends UserInfo { - /** - * Whether the email has been verified with {@link sendEmailVerification} and - * {@link applyActionCode}. - */ - readonly emailVerified: boolean; - /** - * Whether the user is authenticated using the {@link ProviderId}.ANONYMOUS provider. - */ - readonly isAnonymous: boolean; - /** - * Additional metadata around user creation and sign-in times. - */ - readonly metadata: UserMetadata; - /** - * Additional per provider such as displayName and profile information. - */ - readonly providerData: UserInfo[]; - /** - * Refresh token used to reauthenticate the user. Avoid using this directly and prefer - * {@link User.getIdToken} to refresh the ID token instead. - */ - readonly refreshToken: string; - /** - * The user's tenant ID. - * - * @remarks - * This is a read-only property, which indicates the tenant ID - * used to sign in the user. This is null if the user is signed in from the parent - * project. - * - * @example - * ```javascript - * // Set the tenant ID on Auth instance. - * auth.tenantId = 'TENANT_PROJECT_ID'; - * - * // All future sign-in request now include tenant ID. - * const result = await signInWithEmailAndPassword(auth, email, password); - * // result.user.tenantId should be 'TENANT_PROJECT_ID'. - * ``` - */ - readonly tenantId: string | null; - /** - * Deletes and signs out the user. - * - * @remarks - * Important: this is a security-sensitive operation that requires the user to have recently - * signed in. If this requirement isn't met, ask the user to authenticate again and then call - * one of the reauthentication methods like {@link reauthenticateWithCredential}. - * - * This method is not supported on any {@link User} signed in by {@link Auth} instances - * created with a {@link @firebase/app#FirebaseServerApp}. - */ - delete(): Promise<void>; - /** - * Returns a JSON Web Token (JWT) used to identify the user to a Firebase service. - * - * @remarks - * Returns the current token if it has not expired or if it will not expire in the next five - * minutes. Otherwise, this will refresh the token and return a new one. - * - * @param forceRefresh - Force refresh regardless of token expiration. - */ - getIdToken(forceRefresh?: boolean): Promise<string>; - /** - * Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service. - * - * @remarks - * Returns the current token if it has not expired or if it will not expire in the next five - * minutes. Otherwise, this will refresh the token and return a new one. - * - * @param forceRefresh - Force refresh regardless of token expiration. - */ - getIdTokenResult(forceRefresh?: boolean): Promise<IdTokenResult>; - /** - * Refreshes the user, if signed in. - */ - reload(): Promise<void>; - /** - * Returns a JSON-serializable representation of this object. - * - * @returns A JSON-serializable representation of this object. - */ - toJSON(): object; -} - -/** - * A structure containing a {@link User}, the {@link OperationType}, and the provider ID. - * - * @remarks - * `operationType` could be {@link OperationType}.SIGN_IN for a sign-in operation, - * {@link OperationType}.LINK for a linking operation and {@link OperationType}.REAUTHENTICATE for - * a reauthentication operation. - * - * @public - */ -declare interface UserCredential { - /** - * The user authenticated by this credential. - */ - user: User; - /** - * The provider which was used to authenticate the user. - */ - providerId: string | null; - /** - * The type of operation which was used to authenticate the user (such as sign-in or link). - */ - operationType: (typeof OperationType)[keyof typeof OperationType]; -} - -/* Excluded from this release type: UserCredentialInternal */ - -/** - * User profile information, visible only to the Firebase project's apps. - * - * @public - */ -declare interface UserInfo { - /** - * The display name of the user. - */ - readonly displayName: string | null; - /** - * The email of the user. - */ - readonly email: string | null; - /** - * The phone number normalized based on the E.164 standard (e.g. +16505550101) for the - * user. - * - * @remarks - * This is null if the user has no phone credential linked to the account. - */ - readonly phoneNumber: string | null; - /** - * The profile photo URL of the user. - */ - readonly photoURL: string | null; - /** - * The provider used to authenticate the user. - */ - readonly providerId: string; - /** - * The user's unique ID, scoped to the project. - */ - readonly uid: string; -} - -/* Excluded from this release type: UserInternal */ - -/** - * Interface representing a user's metadata. - * - * @public - */ -declare interface UserMetadata { - /** Time the user was created. */ - readonly creationTime?: string; - /** Time the user last signed in. */ - readonly lastSignInTime?: string; -} - -declare class UserMetadata_2 implements UserMetadata { - private createdAt?; - private lastLoginAt?; - creationTime?: string; - lastSignInTime?: string; - constructor(createdAt?: (string | number) | undefined, lastLoginAt?: (string | number) | undefined); - private _initializeTime; - _copy(metadata: UserMetadata_2): void; - toJSON(): object; -} - -/** - * Validates the password against the password policy configured for the project or tenant. - * - * @remarks - * If no tenant ID is set on the `Auth` instance, then this method will use the password - * policy configured for the project. Otherwise, this method will use the policy configured - * for the tenant. If a password policy has not been configured, then the default policy - * configured for all projects will be used. - * - * If an auth flow fails because a submitted password does not meet the password policy - * requirements and this method has previously been called, then this method will use the - * most recent policy available when called again. - * - * @example - * ```javascript - * validatePassword(auth, 'some-password'); - * ``` - * - * @param auth The {@link Auth} instance. - * @param password The password to validate. - * - * @public - */ -export declare function validatePassword(auth: Auth, password: string): Promise<PasswordValidationStatus>; - -/** - * Sends a verification email to a new email address. - * - * @remarks - * The user's email will be updated to the new one after being verified. - * - * If you have a custom email action handler, you can complete the verification process by calling - * {@link applyActionCode}. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await verifyBeforeUpdateEmail(user, 'newemail@example.com', actionCodeSettings); - * // Obtain code from the user. - * await applyActionCode(auth, code); - * ``` - * - * @param user - The user. - * @param newEmail - The new email address to be verified before update. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ -export declare function verifyBeforeUpdateEmail(user: User, newEmail: string, actionCodeSettings?: ActionCodeSettings | null): Promise<void>; - -/** - * Checks a password reset code sent to the user by email or other out-of-band mechanism. - * - * @returns the user's email address if valid. - * - * @param auth - The {@link Auth} instance. - * @param code - A verification code sent to the user. - * - * @public - */ -export declare function verifyPasswordResetCode(auth: Auth, code: string): Promise<string>; - -export { } diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/auth-web-extension.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/auth-web-extension.d.ts deleted file mode 100644 index 5d403c3..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/auth-web-extension.d.ts +++ /dev/null @@ -1,3763 +0,0 @@ -import { CompleteFn } from '@firebase/util'; -import { ErrorFactory } from '@firebase/util'; -import { ErrorFn } from '@firebase/util'; -import { FirebaseApp } from '@firebase/app'; -import { FirebaseError } from '@firebase/util'; -import { NextFn } from '@firebase/util'; -import { Observer } from '@firebase/util'; -import { Unsubscribe } from '@firebase/util'; - -/** - * A response from {@link checkActionCode}. - * - * @public - */ -declare interface ActionCodeInfo { - /** - * The data associated with the action code. - * - * @remarks - * For the {@link ActionCodeOperation}.PASSWORD_RESET, {@link ActionCodeOperation}.VERIFY_EMAIL, and - * {@link ActionCodeOperation}.RECOVER_EMAIL actions, this object contains an email field with the address - * the email was sent to. - * - * For the {@link ActionCodeOperation}.RECOVER_EMAIL action, which allows a user to undo an email address - * change, this object also contains a `previousEmail` field with the user account's current - * email address. After the action completes, the user's email address will revert to the value - * in the `email` field from the value in `previousEmail` field. - * - * For the {@link ActionCodeOperation}.VERIFY_AND_CHANGE_EMAIL action, which allows a user to verify the - * email before updating it, this object contains a `previousEmail` field with the user account's - * email address before updating. After the action completes, the user's email address will be - * updated to the value in the `email` field from the value in `previousEmail` field. - * - * For the {@link ActionCodeOperation}.REVERT_SECOND_FACTOR_ADDITION action, which allows a user to - * unenroll a newly added second factor, this object contains a `multiFactorInfo` field with - * the information about the second factor. For phone second factor, the `multiFactorInfo` - * is a {@link MultiFactorInfo} object, which contains the phone number. - */ - data: { - email?: string | null; - multiFactorInfo?: MultiFactorInfo | null; - previousEmail?: string | null; - }; - /** - * The type of operation that generated the action code. - */ - operation: (typeof ActionCodeOperation)[keyof typeof ActionCodeOperation]; -} - -/** - * An enumeration of the possible email action types. - * - * @public - */ -declare const ActionCodeOperation: { - /** The email link sign-in action. */ - readonly EMAIL_SIGNIN: "EMAIL_SIGNIN"; - /** The password reset action. */ - readonly PASSWORD_RESET: "PASSWORD_RESET"; - /** The email revocation action. */ - readonly RECOVER_EMAIL: "RECOVER_EMAIL"; - /** The revert second factor addition email action. */ - readonly REVERT_SECOND_FACTOR_ADDITION: "REVERT_SECOND_FACTOR_ADDITION"; - /** The revert second factor addition email action. */ - readonly VERIFY_AND_CHANGE_EMAIL: "VERIFY_AND_CHANGE_EMAIL"; - /** The email verification action. */ - readonly VERIFY_EMAIL: "VERIFY_EMAIL"; -}; - -/** - * An interface that defines the required continue/state URL with optional Android and iOS - * bundle identifiers. - * - * @public - */ -declare interface ActionCodeSettings { - /** - * Sets the Android package name. - * - * @remarks - * This will try to open the link in an Android app if it is installed. - */ - android?: { - installApp?: boolean; - minimumVersion?: string; - packageName: string; - }; - /** - * When set to true, the action code link will be be sent as a Universal Link or Android App - * Link and will be opened by the app if installed. - * - * @remarks - * In the false case, the code will be sent to the web widget first and then on continue will - * redirect to the app if installed. - * - * @defaultValue false - */ - handleCodeInApp?: boolean; - /** - * Sets the iOS bundle ID. - * - * @remarks - * This will try to open the link in an iOS app if it is installed. - */ - iOS?: { - bundleId: string; - }; - /** - * Sets the link continue/state URL. - * - * @remarks - * This has different meanings in different contexts: - * - When the link is handled in the web action widgets, this is the deep link in the - * `continueUrl` query parameter. - * - When the link is handled in the app directly, this is the `continueUrl` query parameter in - * the deep link of the Dynamic Link or Hosting link. - */ - url: string; - /** - * When multiple custom dynamic link domains are defined for a project, specify which one to use - * when the link is to be opened via a specified mobile app (for example, `example.page.link`). - * - * - * @defaultValue The first domain is automatically selected. - * - * @deprecated Firebase Dynamic Links is deprecated and will be shut down as early as August - * 2025. Instead, use {@link ActionCodeSettings.linkDomain} to set a custom domain for mobile - * links. Learn more in the {@link https://firebase.google.com/support/dynamic-links-faq | Dynamic Links deprecation FAQ}. - */ - dynamicLinkDomain?: string; - /** - * The optional custom Firebase Hosting domain to use when the link is to be opened via - * a specified mobile app. The domain must be configured in Firebase Hosting and owned - * by the project. This cannot be a default Hosting domain (`web.app` or `firebaseapp.com`). - * - * @defaultValue The default Hosting domain will be used (for example, `example.firebaseapp.com`). - */ - linkDomain?: string; -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * A utility class to parse email action URLs such as password reset, email verification, - * email link sign in, etc. - * - * @public - */ -export declare class ActionCodeURL { - /** - * The API key of the email action link. - */ - readonly apiKey: string; - /** - * The action code of the email action link. - */ - readonly code: string; - /** - * The continue URL of the email action link. Null if not provided. - */ - readonly continueUrl: string | null; - /** - * The language code of the email action link. Null if not provided. - */ - readonly languageCode: string | null; - /** - * The action performed by the email action link. It returns from one of the types from - * {@link ActionCodeInfo} - */ - readonly operation: string; - /** - * The tenant ID of the email action link. Null if the email action is from the parent project. - */ - readonly tenantId: string | null; - /** - * @param actionLink - The link from which to extract the URL. - * @returns The {@link ActionCodeURL} object, or null if the link is invalid. - * - * @internal - */ - constructor(actionLink: string); - /** - * Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid, - * otherwise returns null. - * - * @param link - The email action link string. - * @returns The {@link ActionCodeURL} object, or null if the link is invalid. - * - * @public - */ - static parseLink(link: string): ActionCodeURL | null; -} - -/** - * A structure containing additional user information from a federated identity provider. - * - * @public - */ -declare interface AdditionalUserInfo { - /** - * Whether the user is new (created via sign-up) or existing (authenticated using sign-in). - */ - readonly isNewUser: boolean; - /** - * Map containing IDP-specific user data. - */ - readonly profile: Record<string, unknown> | null; - /** - * Identifier for the provider used to authenticate this user. - */ - readonly providerId: string | null; - /** - * The username if the provider is GitHub or Twitter. - */ - readonly username?: string | null; -} - -declare interface APIUserInfo { - localId?: string; - displayName?: string; - photoUrl?: string; - email?: string; - emailVerified?: boolean; - phoneNumber?: string; - lastLoginAt?: number; - createdAt?: number; - tenantId?: string; - passwordHash?: string; - providerUserInfo?: ProviderUserInfo[]; - mfaInfo?: MfaEnrollment[]; -} - -/** - * Applies a verification code sent to the user by email or other out-of-band mechanism. - * - * @param auth - The {@link Auth} instance. - * @param oobCode - A verification code sent to the user. - * - * @public - */ -export declare function applyActionCode(auth: Auth, oobCode: string): Promise<void>; - -declare type AppName = string; - -/** - * Interface representing Firebase Auth service. - * - * @remarks - * See {@link https://firebase.google.com/docs/auth/ | Firebase Authentication} for a full guide - * on how to use the Firebase Auth service. - * - * @public - */ -declare interface Auth { - /** The {@link @firebase/app#FirebaseApp} associated with the `Auth` service instance. */ - readonly app: FirebaseApp; - /** The name of the app associated with the `Auth` service instance. */ - readonly name: string; - /** The {@link Config} used to initialize this instance. */ - readonly config: Config; - /** - * Changes the type of persistence on the `Auth` instance. - * - * @remarks - * This will affect the currently saved Auth session and applies this type of persistence for - * future sign-in requests, including sign-in with redirect requests. - * - * This makes it easy for a user signing in to specify whether their session should be - * remembered or not. It also makes it easier to never persist the Auth state for applications - * that are shared by other users or have sensitive data. - * - * This method does not work in a Node.js environment. - * - * @example - * ```javascript - * auth.setPersistence(browserSessionPersistence); - * ``` - * - * @param persistence - The {@link Persistence} to use. - */ - setPersistence(persistence: Persistence): Promise<void>; - /** - * The {@link Auth} instance's language code. - * - * @remarks - * This is a readable/writable property. When set to null, the default Firebase Console language - * setting is applied. The language code will propagate to email action templates (password - * reset, email verification and email change revocation), SMS templates for phone authentication, - * reCAPTCHA verifier and OAuth popup/redirect operations provided the specified providers support - * localization with the language code specified. - */ - languageCode: string | null; - /** - * The {@link Auth} instance's tenant ID. - * - * @remarks - * This is a readable/writable property. When you set the tenant ID of an {@link Auth} instance, all - * future sign-in/sign-up operations will pass this tenant ID and sign in or sign up users to - * the specified tenant project. When set to null, users are signed in to the parent project. - * - * @example - * ```javascript - * // Set the tenant ID on Auth instance. - * auth.tenantId = 'TENANT_PROJECT_ID'; - * - * // All future sign-in request now include tenant ID. - * const result = await signInWithEmailAndPassword(auth, email, password); - * // result.user.tenantId should be 'TENANT_PROJECT_ID'. - * ``` - * - * @defaultValue null - */ - tenantId: string | null; - /** - * The {@link Auth} instance's settings. - * - * @remarks - * This is used to edit/read configuration related options such as app verification mode for - * phone authentication. - */ - readonly settings: AuthSettings; - /** - * Adds an observer for changes to the user's sign-in state. - * - * @remarks - * To keep the old behavior, see {@link Auth.onIdTokenChanged}. - * - * @param nextOrObserver - callback triggered on change. - * @param error - Deprecated. This callback is never triggered. Errors - * on signing in/out can be caught in promises returned from - * sign-in/sign-out functions. - * @param completed - Deprecated. This callback is never triggered. - */ - onAuthStateChanged(nextOrObserver: NextOrObserver<User | null>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe; - /** - * Adds a blocking callback that runs before an auth state change - * sets a new user. - * - * @param callback - callback triggered before new user value is set. - * If this throws, it blocks the user from being set. - * @param onAbort - callback triggered if a later `beforeAuthStateChanged()` - * callback throws, allowing you to undo any side effects. - */ - beforeAuthStateChanged(callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe; - /** - * Adds an observer for changes to the signed-in user's ID token. - * - * @remarks - * This includes sign-in, sign-out, and token refresh events. - * - * @param nextOrObserver - callback triggered on change. - * @param error - Deprecated. This callback is never triggered. Errors - * on signing in/out can be caught in promises returned from - * sign-in/sign-out functions. - * @param completed - Deprecated. This callback is never triggered. - */ - onIdTokenChanged(nextOrObserver: NextOrObserver<User | null>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe; - /** - * returns a promise that resolves immediately when the initial - * auth state is settled. When the promise resolves, the current user might be a valid user - * or `null` if the user signed out. - */ - authStateReady(): Promise<void>; - /** The currently signed-in user (or null). */ - readonly currentUser: User | null; - /** The current emulator configuration (or null). */ - readonly emulatorConfig: EmulatorConfig | null; - /** - * Asynchronously sets the provided user as {@link Auth.currentUser} on the {@link Auth} instance. - * - * @remarks - * A new instance copy of the user provided will be made and set as currentUser. - * - * This will trigger {@link Auth.onAuthStateChanged} and {@link Auth.onIdTokenChanged} listeners - * like other sign in methods. - * - * The operation fails with an error if the user to be updated belongs to a different Firebase - * project. - * - * @param user - The new {@link User}. - */ - updateCurrentUser(user: User | null): Promise<void>; - /** - * Sets the current language to the default device/browser preference. - */ - useDeviceLanguage(): void; - /** - * Signs out the current user. This does not automatically revoke the user's ID token. - * - * @remarks - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - */ - signOut(): Promise<void>; -} - -/** - * Interface that represents the credentials returned by an {@link AuthProvider}. - * - * @remarks - * Implementations specify the details about each auth provider's credential requirements. - * - * @public - */ -export declare class AuthCredential { - /** - * The authentication provider ID for the credential. - * - * @remarks - * For example, 'facebook.com', or 'google.com'. - */ - readonly providerId: string; - /** - * The authentication sign in method for the credential. - * - * @remarks - * For example, {@link SignInMethod}.EMAIL_PASSWORD, or - * {@link SignInMethod}.EMAIL_LINK. This corresponds to the sign-in method - * identifier as returned in {@link fetchSignInMethodsForEmail}. - */ - readonly signInMethod: string; - /** @internal */ - protected constructor( - /** - * The authentication provider ID for the credential. - * - * @remarks - * For example, 'facebook.com', or 'google.com'. - */ - providerId: string, - /** - * The authentication sign in method for the credential. - * - * @remarks - * For example, {@link SignInMethod}.EMAIL_PASSWORD, or - * {@link SignInMethod}.EMAIL_LINK. This corresponds to the sign-in method - * identifier as returned in {@link fetchSignInMethodsForEmail}. - */ - signInMethod: string); - /** - * Returns a JSON-serializable representation of this object. - * - * @returns a JSON-serializable representation of this object. - */ - toJSON(): object; - /** @internal */ - _getIdTokenResponse(_auth: AuthInternal): Promise<PhoneOrOauthTokenResponse>; - /** @internal */ - _linkToIdToken(_auth: AuthInternal, _idToken: string): Promise<IdTokenResponse>; - /** @internal */ - _getReauthenticationResolver(_auth: AuthInternal): Promise<IdTokenResponse>; -} - -/** - * Interface for an `Auth` error. - * - * @public - */ -declare interface AuthError extends FirebaseError { - /** Details about the Firebase Auth error. */ - readonly customData: { - /** The name of the Firebase App which triggered this error. */ - readonly appName: string; - /** The email address of the user's account, used for sign-in and linking. */ - readonly email?: string; - /** The phone number of the user's account, used for sign-in and linking. */ - readonly phoneNumber?: string; - /** - * The tenant ID being used for sign-in and linking. - * - * @remarks - * If you use {@link signInWithRedirect} to sign in, - * you have to set the tenant ID on the {@link Auth} instance again as the tenant ID is not persisted - * after redirection. - */ - readonly tenantId?: string; - }; -} - -/** - * Enumeration of Firebase Auth error codes. - * - * @internal - */ -declare const enum AuthErrorCode { - ADMIN_ONLY_OPERATION = "admin-restricted-operation", - ARGUMENT_ERROR = "argument-error", - APP_NOT_AUTHORIZED = "app-not-authorized", - APP_NOT_INSTALLED = "app-not-installed", - CAPTCHA_CHECK_FAILED = "captcha-check-failed", - CODE_EXPIRED = "code-expired", - CORDOVA_NOT_READY = "cordova-not-ready", - CORS_UNSUPPORTED = "cors-unsupported", - CREDENTIAL_ALREADY_IN_USE = "credential-already-in-use", - CREDENTIAL_MISMATCH = "custom-token-mismatch", - CREDENTIAL_TOO_OLD_LOGIN_AGAIN = "requires-recent-login", - DEPENDENT_SDK_INIT_BEFORE_AUTH = "dependent-sdk-initialized-before-auth", - DYNAMIC_LINK_NOT_ACTIVATED = "dynamic-link-not-activated", - EMAIL_CHANGE_NEEDS_VERIFICATION = "email-change-needs-verification", - EMAIL_EXISTS = "email-already-in-use", - EMULATOR_CONFIG_FAILED = "emulator-config-failed", - EXPIRED_OOB_CODE = "expired-action-code", - EXPIRED_POPUP_REQUEST = "cancelled-popup-request", - INTERNAL_ERROR = "internal-error", - INVALID_API_KEY = "invalid-api-key", - INVALID_APP_CREDENTIAL = "invalid-app-credential", - INVALID_APP_ID = "invalid-app-id", - INVALID_AUTH = "invalid-user-token", - INVALID_AUTH_EVENT = "invalid-auth-event", - INVALID_CERT_HASH = "invalid-cert-hash", - INVALID_CODE = "invalid-verification-code", - INVALID_CONTINUE_URI = "invalid-continue-uri", - INVALID_CORDOVA_CONFIGURATION = "invalid-cordova-configuration", - INVALID_CUSTOM_TOKEN = "invalid-custom-token", - INVALID_DYNAMIC_LINK_DOMAIN = "invalid-dynamic-link-domain", - INVALID_EMAIL = "invalid-email", - INVALID_EMULATOR_SCHEME = "invalid-emulator-scheme", - INVALID_CREDENTIAL = "invalid-credential", - INVALID_MESSAGE_PAYLOAD = "invalid-message-payload", - INVALID_MFA_SESSION = "invalid-multi-factor-session", - INVALID_OAUTH_CLIENT_ID = "invalid-oauth-client-id", - INVALID_OAUTH_PROVIDER = "invalid-oauth-provider", - INVALID_OOB_CODE = "invalid-action-code", - INVALID_ORIGIN = "unauthorized-domain", - INVALID_PASSWORD = "wrong-password", - INVALID_PERSISTENCE = "invalid-persistence-type", - INVALID_PHONE_NUMBER = "invalid-phone-number", - INVALID_PROVIDER_ID = "invalid-provider-id", - INVALID_RECIPIENT_EMAIL = "invalid-recipient-email", - INVALID_SENDER = "invalid-sender", - INVALID_SESSION_INFO = "invalid-verification-id", - INVALID_TENANT_ID = "invalid-tenant-id", - LOGIN_BLOCKED = "login-blocked", - MFA_INFO_NOT_FOUND = "multi-factor-info-not-found", - MFA_REQUIRED = "multi-factor-auth-required", - MISSING_ANDROID_PACKAGE_NAME = "missing-android-pkg-name", - MISSING_APP_CREDENTIAL = "missing-app-credential", - MISSING_AUTH_DOMAIN = "auth-domain-config-required", - MISSING_CODE = "missing-verification-code", - MISSING_CONTINUE_URI = "missing-continue-uri", - MISSING_IFRAME_START = "missing-iframe-start", - MISSING_IOS_BUNDLE_ID = "missing-ios-bundle-id", - MISSING_OR_INVALID_NONCE = "missing-or-invalid-nonce", - MISSING_MFA_INFO = "missing-multi-factor-info", - MISSING_MFA_SESSION = "missing-multi-factor-session", - MISSING_PHONE_NUMBER = "missing-phone-number", - MISSING_PASSWORD = "missing-password", - MISSING_SESSION_INFO = "missing-verification-id", - MODULE_DESTROYED = "app-deleted", - NEED_CONFIRMATION = "account-exists-with-different-credential", - NETWORK_REQUEST_FAILED = "network-request-failed", - NULL_USER = "null-user", - NO_AUTH_EVENT = "no-auth-event", - NO_SUCH_PROVIDER = "no-such-provider", - OPERATION_NOT_ALLOWED = "operation-not-allowed", - OPERATION_NOT_SUPPORTED = "operation-not-supported-in-this-environment", - POPUP_BLOCKED = "popup-blocked", - POPUP_CLOSED_BY_USER = "popup-closed-by-user", - PROVIDER_ALREADY_LINKED = "provider-already-linked", - QUOTA_EXCEEDED = "quota-exceeded", - REDIRECT_CANCELLED_BY_USER = "redirect-cancelled-by-user", - REDIRECT_OPERATION_PENDING = "redirect-operation-pending", - REJECTED_CREDENTIAL = "rejected-credential", - SECOND_FACTOR_ALREADY_ENROLLED = "second-factor-already-in-use", - SECOND_FACTOR_LIMIT_EXCEEDED = "maximum-second-factor-count-exceeded", - TENANT_ID_MISMATCH = "tenant-id-mismatch", - TIMEOUT = "timeout", - TOKEN_EXPIRED = "user-token-expired", - TOO_MANY_ATTEMPTS_TRY_LATER = "too-many-requests", - UNAUTHORIZED_DOMAIN = "unauthorized-continue-uri", - UNSUPPORTED_FIRST_FACTOR = "unsupported-first-factor", - UNSUPPORTED_PERSISTENCE = "unsupported-persistence-type", - UNSUPPORTED_TENANT_OPERATION = "unsupported-tenant-operation", - UNVERIFIED_EMAIL = "unverified-email", - USER_CANCELLED = "user-cancelled", - USER_DELETED = "user-not-found", - USER_DISABLED = "user-disabled", - USER_MISMATCH = "user-mismatch", - USER_SIGNED_OUT = "user-signed-out", - WEAK_PASSWORD = "weak-password", - WEB_STORAGE_UNSUPPORTED = "web-storage-unsupported", - ALREADY_INITIALIZED = "already-initialized", - RECAPTCHA_NOT_ENABLED = "recaptcha-not-enabled", - MISSING_RECAPTCHA_TOKEN = "missing-recaptcha-token", - INVALID_RECAPTCHA_TOKEN = "invalid-recaptcha-token", - INVALID_RECAPTCHA_ACTION = "invalid-recaptcha-action", - MISSING_CLIENT_TYPE = "missing-client-type", - MISSING_RECAPTCHA_VERSION = "missing-recaptcha-version", - INVALID_RECAPTCHA_VERSION = "invalid-recaptcha-version", - INVALID_REQ_TYPE = "invalid-req-type", - UNSUPPORTED_PASSWORD_POLICY_SCHEMA_VERSION = "unsupported-password-policy-schema-version", - PASSWORD_DOES_NOT_MEET_REQUIREMENTS = "password-does-not-meet-requirements", - INVALID_HOSTING_LINK_DOMAIN = "invalid-hosting-link-domain" -} - -/** - * A map of potential `Auth` error codes, for easier comparison with errors - * thrown by the SDK. - * - * @remarks - * Note that you can't tree-shake individual keys - * in the map, so by using the map you might substantially increase your - * bundle size. - * - * @public - */ -export declare const AuthErrorCodes: { - readonly ADMIN_ONLY_OPERATION: "auth/admin-restricted-operation"; - readonly ARGUMENT_ERROR: "auth/argument-error"; - readonly APP_NOT_AUTHORIZED: "auth/app-not-authorized"; - readonly APP_NOT_INSTALLED: "auth/app-not-installed"; - readonly CAPTCHA_CHECK_FAILED: "auth/captcha-check-failed"; - readonly CODE_EXPIRED: "auth/code-expired"; - readonly CORDOVA_NOT_READY: "auth/cordova-not-ready"; - readonly CORS_UNSUPPORTED: "auth/cors-unsupported"; - readonly CREDENTIAL_ALREADY_IN_USE: "auth/credential-already-in-use"; - readonly CREDENTIAL_MISMATCH: "auth/custom-token-mismatch"; - readonly CREDENTIAL_TOO_OLD_LOGIN_AGAIN: "auth/requires-recent-login"; - readonly DEPENDENT_SDK_INIT_BEFORE_AUTH: "auth/dependent-sdk-initialized-before-auth"; - readonly DYNAMIC_LINK_NOT_ACTIVATED: "auth/dynamic-link-not-activated"; - readonly EMAIL_CHANGE_NEEDS_VERIFICATION: "auth/email-change-needs-verification"; - readonly EMAIL_EXISTS: "auth/email-already-in-use"; - readonly EMULATOR_CONFIG_FAILED: "auth/emulator-config-failed"; - readonly EXPIRED_OOB_CODE: "auth/expired-action-code"; - readonly EXPIRED_POPUP_REQUEST: "auth/cancelled-popup-request"; - readonly INTERNAL_ERROR: "auth/internal-error"; - readonly INVALID_API_KEY: "auth/invalid-api-key"; - readonly INVALID_APP_CREDENTIAL: "auth/invalid-app-credential"; - readonly INVALID_APP_ID: "auth/invalid-app-id"; - readonly INVALID_AUTH: "auth/invalid-user-token"; - readonly INVALID_AUTH_EVENT: "auth/invalid-auth-event"; - readonly INVALID_CERT_HASH: "auth/invalid-cert-hash"; - readonly INVALID_CODE: "auth/invalid-verification-code"; - readonly INVALID_CONTINUE_URI: "auth/invalid-continue-uri"; - readonly INVALID_CORDOVA_CONFIGURATION: "auth/invalid-cordova-configuration"; - readonly INVALID_CUSTOM_TOKEN: "auth/invalid-custom-token"; - readonly INVALID_DYNAMIC_LINK_DOMAIN: "auth/invalid-dynamic-link-domain"; - readonly INVALID_EMAIL: "auth/invalid-email"; - readonly INVALID_EMULATOR_SCHEME: "auth/invalid-emulator-scheme"; - readonly INVALID_IDP_RESPONSE: "auth/invalid-credential"; - readonly INVALID_LOGIN_CREDENTIALS: "auth/invalid-credential"; - readonly INVALID_MESSAGE_PAYLOAD: "auth/invalid-message-payload"; - readonly INVALID_MFA_SESSION: "auth/invalid-multi-factor-session"; - readonly INVALID_OAUTH_CLIENT_ID: "auth/invalid-oauth-client-id"; - readonly INVALID_OAUTH_PROVIDER: "auth/invalid-oauth-provider"; - readonly INVALID_OOB_CODE: "auth/invalid-action-code"; - readonly INVALID_ORIGIN: "auth/unauthorized-domain"; - readonly INVALID_PASSWORD: "auth/wrong-password"; - readonly INVALID_PERSISTENCE: "auth/invalid-persistence-type"; - readonly INVALID_PHONE_NUMBER: "auth/invalid-phone-number"; - readonly INVALID_PROVIDER_ID: "auth/invalid-provider-id"; - readonly INVALID_RECIPIENT_EMAIL: "auth/invalid-recipient-email"; - readonly INVALID_SENDER: "auth/invalid-sender"; - readonly INVALID_SESSION_INFO: "auth/invalid-verification-id"; - readonly INVALID_TENANT_ID: "auth/invalid-tenant-id"; - readonly MFA_INFO_NOT_FOUND: "auth/multi-factor-info-not-found"; - readonly MFA_REQUIRED: "auth/multi-factor-auth-required"; - readonly MISSING_ANDROID_PACKAGE_NAME: "auth/missing-android-pkg-name"; - readonly MISSING_APP_CREDENTIAL: "auth/missing-app-credential"; - readonly MISSING_AUTH_DOMAIN: "auth/auth-domain-config-required"; - readonly MISSING_CODE: "auth/missing-verification-code"; - readonly MISSING_CONTINUE_URI: "auth/missing-continue-uri"; - readonly MISSING_IFRAME_START: "auth/missing-iframe-start"; - readonly MISSING_IOS_BUNDLE_ID: "auth/missing-ios-bundle-id"; - readonly MISSING_OR_INVALID_NONCE: "auth/missing-or-invalid-nonce"; - readonly MISSING_MFA_INFO: "auth/missing-multi-factor-info"; - readonly MISSING_MFA_SESSION: "auth/missing-multi-factor-session"; - readonly MISSING_PHONE_NUMBER: "auth/missing-phone-number"; - readonly MISSING_PASSWORD: "auth/missing-password"; - readonly MISSING_SESSION_INFO: "auth/missing-verification-id"; - readonly MODULE_DESTROYED: "auth/app-deleted"; - readonly NEED_CONFIRMATION: "auth/account-exists-with-different-credential"; - readonly NETWORK_REQUEST_FAILED: "auth/network-request-failed"; - readonly NULL_USER: "auth/null-user"; - readonly NO_AUTH_EVENT: "auth/no-auth-event"; - readonly NO_SUCH_PROVIDER: "auth/no-such-provider"; - readonly OPERATION_NOT_ALLOWED: "auth/operation-not-allowed"; - readonly OPERATION_NOT_SUPPORTED: "auth/operation-not-supported-in-this-environment"; - readonly POPUP_BLOCKED: "auth/popup-blocked"; - readonly POPUP_CLOSED_BY_USER: "auth/popup-closed-by-user"; - readonly PROVIDER_ALREADY_LINKED: "auth/provider-already-linked"; - readonly QUOTA_EXCEEDED: "auth/quota-exceeded"; - readonly REDIRECT_CANCELLED_BY_USER: "auth/redirect-cancelled-by-user"; - readonly REDIRECT_OPERATION_PENDING: "auth/redirect-operation-pending"; - readonly REJECTED_CREDENTIAL: "auth/rejected-credential"; - readonly SECOND_FACTOR_ALREADY_ENROLLED: "auth/second-factor-already-in-use"; - readonly SECOND_FACTOR_LIMIT_EXCEEDED: "auth/maximum-second-factor-count-exceeded"; - readonly TENANT_ID_MISMATCH: "auth/tenant-id-mismatch"; - readonly TIMEOUT: "auth/timeout"; - readonly TOKEN_EXPIRED: "auth/user-token-expired"; - readonly TOO_MANY_ATTEMPTS_TRY_LATER: "auth/too-many-requests"; - readonly UNAUTHORIZED_DOMAIN: "auth/unauthorized-continue-uri"; - readonly UNSUPPORTED_FIRST_FACTOR: "auth/unsupported-first-factor"; - readonly UNSUPPORTED_PERSISTENCE: "auth/unsupported-persistence-type"; - readonly UNSUPPORTED_TENANT_OPERATION: "auth/unsupported-tenant-operation"; - readonly UNVERIFIED_EMAIL: "auth/unverified-email"; - readonly USER_CANCELLED: "auth/user-cancelled"; - readonly USER_DELETED: "auth/user-not-found"; - readonly USER_DISABLED: "auth/user-disabled"; - readonly USER_MISMATCH: "auth/user-mismatch"; - readonly USER_SIGNED_OUT: "auth/user-signed-out"; - readonly WEAK_PASSWORD: "auth/weak-password"; - readonly WEB_STORAGE_UNSUPPORTED: "auth/web-storage-unsupported"; - readonly ALREADY_INITIALIZED: "auth/already-initialized"; - readonly RECAPTCHA_NOT_ENABLED: "auth/recaptcha-not-enabled"; - readonly MISSING_RECAPTCHA_TOKEN: "auth/missing-recaptcha-token"; - readonly INVALID_RECAPTCHA_TOKEN: "auth/invalid-recaptcha-token"; - readonly INVALID_RECAPTCHA_ACTION: "auth/invalid-recaptcha-action"; - readonly MISSING_CLIENT_TYPE: "auth/missing-client-type"; - readonly MISSING_RECAPTCHA_VERSION: "auth/missing-recaptcha-version"; - readonly INVALID_RECAPTCHA_VERSION: "auth/invalid-recaptcha-version"; - readonly INVALID_REQ_TYPE: "auth/invalid-req-type"; - readonly INVALID_HOSTING_LINK_DOMAIN: "auth/invalid-hosting-link-domain"; -}; - -/** - * A mapping of error codes to error messages. - * - * @remarks - * - * While error messages are useful for debugging (providing verbose textual - * context around what went wrong), these strings take up a lot of space in the - * compiled code. When deploying code in production, using {@link prodErrorMap} - * will save you roughly 10k compressed/gzipped over {@link debugErrorMap}. You - * can select the error map during initialization: - * - * ```javascript - * initializeAuth(app, {errorMap: debugErrorMap}) - * ``` - * - * When initializing Auth, {@link prodErrorMap} is default. - * - * @public - */ -declare interface AuthErrorMap { -} - -/** - * @internal - */ -declare interface AuthErrorParams extends GenericAuthErrorParams { - [AuthErrorCode.ARGUMENT_ERROR]: { - appName?: AppName; - }; - [AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH]: { - appName?: AppName; - }; - [AuthErrorCode.INTERNAL_ERROR]: { - appName?: AppName; - }; - [AuthErrorCode.LOGIN_BLOCKED]: { - appName?: AppName; - originalMessage?: string; - }; - [AuthErrorCode.OPERATION_NOT_SUPPORTED]: { - appName?: AppName; - }; - [AuthErrorCode.NO_AUTH_EVENT]: { - appName?: AppName; - }; - [AuthErrorCode.MFA_REQUIRED]: { - appName: AppName; - _serverResponse: IdTokenMfaResponse; - }; - [AuthErrorCode.INVALID_CORDOVA_CONFIGURATION]: { - appName: AppName; - missingPlugin?: string; - }; -} - -/** - * @internal - */ -declare interface AuthEvent { - type: AuthEventType; - eventId: string | null; - urlResponse: string | null; - sessionId: string | null; - postBody: string | null; - tenantId: string | null; - error?: AuthEventError; -} - -/** - * @internal - */ -declare interface AuthEventConsumer { - readonly filter: AuthEventType[]; - eventId: string | null; - onAuthEvent(event: AuthEvent): unknown; - onError(error: FirebaseError): unknown; -} - -declare interface AuthEventError extends Error { - code: string; - message: string; -} - -/** - * @internal - */ -declare const enum AuthEventType { - LINK_VIA_POPUP = "linkViaPopup", - LINK_VIA_REDIRECT = "linkViaRedirect", - REAUTH_VIA_POPUP = "reauthViaPopup", - REAUTH_VIA_REDIRECT = "reauthViaRedirect", - SIGN_IN_VIA_POPUP = "signInViaPopup", - SIGN_IN_VIA_REDIRECT = "signInViaRedirect", - UNKNOWN = "unknown", - VERIFY_APP = "verifyApp" -} - -/** - * UserInternal and AuthInternal reference each other, so both of them are included in the public typings. - * In order to exclude them, we mark them as internal explicitly. - * - * @internal - */ -declare interface AuthInternal extends Auth { - currentUser: User | null; - emulatorConfig: EmulatorConfig | null; - _agentRecaptchaConfig: RecaptchaConfig | null; - _tenantRecaptchaConfigs: Record<string, RecaptchaConfig>; - _projectPasswordPolicy: PasswordPolicy | null; - _tenantPasswordPolicies: Record<string, PasswordPolicy>; - _canInitEmulator: boolean; - _isInitialized: boolean; - _initializationPromise: Promise<void> | null; - _persistenceManagerAvailable: Promise<void>; - _updateCurrentUser(user: UserInternal | null): Promise<void>; - _onStorageEvent(): void; - _notifyListenersIfCurrent(user: UserInternal): void; - _persistUserIfCurrent(user: UserInternal): Promise<void>; - _setRedirectUser(user: UserInternal | null, popupRedirectResolver?: PopupRedirectResolver): Promise<void>; - _redirectUserForId(id: string): Promise<UserInternal | null>; - _popupRedirectResolver: PopupRedirectResolverInternal | null; - _key(): string; - _startProactiveRefresh(): void; - _stopProactiveRefresh(): void; - _getPersistenceType(): string; - _getPersistence(): PersistenceInternal; - _getRecaptchaConfig(): RecaptchaConfig | null; - _getPasswordPolicyInternal(): PasswordPolicyInternal | null; - _updatePasswordPolicy(): Promise<void>; - _logFramework(framework: string): void; - _getFrameworks(): readonly string[]; - _getAdditionalHeaders(): Promise<Record<string, string>>; - _getAppCheckToken(): Promise<string | undefined>; - readonly name: AppName; - readonly config: ConfigInternal; - languageCode: string | null; - tenantId: string | null; - readonly settings: AuthSettings; - _errorFactory: ErrorFactory<AuthErrorCode, AuthErrorParams>; - useDeviceLanguage(): void; - signOut(): Promise<void>; - validatePassword(password: string): Promise<PasswordValidationStatus>; - revokeAccessToken(token: string): Promise<void>; -} - -declare class AuthPopup { - readonly window: Window | null; - associatedEvent: string | null; - constructor(window: Window | null); - close(): void; -} - -/** - * Interface that represents an auth provider, used to facilitate creating {@link AuthCredential}. - * - * @public - */ -declare interface AuthProvider { - /** - * Provider for which credentials can be constructed. - */ - readonly providerId: string; -} - -/** - * Interface representing an {@link Auth} instance's settings. - * - * @remarks Currently used for enabling/disabling app verification for phone Auth testing. - * - * @public - */ -declare interface AuthSettings { - /** - * When set, this property disables app verification for the purpose of testing phone - * authentication. For this property to take effect, it needs to be set before rendering a - * reCAPTCHA app verifier. When this is disabled, a mock reCAPTCHA is rendered instead. This is - * useful for manual testing during development or for automated integration tests. - * - * In order to use this feature, you will need to - * {@link https://firebase.google.com/docs/auth/web/phone-auth#test-with-whitelisted-phone-numbers | whitelist your phone number} - * via the Firebase Console. - * - * The default value is false (app verification is enabled). - */ - appVerificationDisabledForTesting: boolean; -} - -/** - * MFA Info as returned by the API. - */ -declare interface BaseMfaEnrollment { - mfaEnrollmentId: string; - enrolledAt: number; - displayName?: string; -} - -/** - * Common code to all OAuth providers. This is separate from the - * {@link OAuthProvider} so that child providers (like - * {@link GoogleAuthProvider}) don't inherit the `credential` instance method. - * Instead, they rely on a static `credential` method. - */ -declare abstract class BaseOAuthProvider extends FederatedAuthProvider implements AuthProvider { - /** @internal */ - private scopes; - /** - * Add an OAuth scope to the credential. - * - * @param scope - Provider OAuth scope to add. - */ - addScope(scope: string): AuthProvider; - /** - * Retrieve the current list of OAuth scopes. - */ - getScopes(): string[]; -} - -/** - * Adds a blocking callback that runs before an auth state change - * sets a new user. - * - * @param auth - The {@link Auth} instance. - * @param callback - callback triggered before new user value is set. - * If this throws, it blocks the user from being set. - * @param onAbort - callback triggered if a later `beforeAuthStateChanged()` - * callback throws, allowing you to undo any side effects. - */ -export declare function beforeAuthStateChanged(auth: Auth, callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe; - -/** - * Checks a verification code sent to the user by email or other out-of-band mechanism. - * - * @returns metadata about the code. - * - * @param auth - The {@link Auth} instance. - * @param oobCode - A verification code sent to the user. - * - * @public - */ -export declare function checkActionCode(auth: Auth, oobCode: string): Promise<ActionCodeInfo>; - -/** - * @internal - */ -declare const enum ClientPlatform { - BROWSER = "Browser", - NODE = "Node", - REACT_NATIVE = "ReactNative", - CORDOVA = "Cordova", - WORKER = "Worker", - WEB_EXTENSION = "WebExtension" -} - -/** - * Interface representing the `Auth` config. - * - * @public - */ -declare interface Config { - /** - * The API Key used to communicate with the Firebase Auth backend. - */ - apiKey: string; - /** - * The host at which the Firebase Auth backend is running. - */ - apiHost: string; - /** - * The scheme used to communicate with the Firebase Auth backend. - */ - apiScheme: string; - /** - * The host at which the Secure Token API is running. - */ - tokenApiHost: string; - /** - * The SDK Client Version. - */ - sdkClientVersion: string; - /** - * The domain at which the web widgets are hosted (provided via Firebase Config). - */ - authDomain?: string; -} - -/** - * @internal - */ -declare interface ConfigInternal extends Config { - /** - * @readonly - */ - emulator?: { - url: string; - }; - /** - * @readonly - */ - clientPlatform: ClientPlatform; -} - -/** - * Completes the password reset process, given a confirmation code and new password. - * - * @param auth - The {@link Auth} instance. - * @param oobCode - A confirmation code sent to the user. - * @param newPassword - The new password. - * - * @public - */ -export declare function confirmPasswordReset(auth: Auth, oobCode: string, newPassword: string): Promise<void>; - -/** - * Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production - * Firebase Auth services. - * - * @remarks - * This must be called synchronously immediately following the first call to - * {@link initializeAuth}. Do not use with production credentials as emulator - * traffic is not encrypted. - * - * - * @example - * ```javascript - * connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true }); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param url - The URL at which the emulator is running (eg, 'http://localhost:9099'). - * @param options - Optional. `options.disableWarnings` defaults to `false`. Set it to - * `true` to disable the warning banner attached to the DOM. - * - * @public - */ -export declare function connectAuthEmulator(auth: Auth, url: string, options?: { - disableWarnings: boolean; -}): void; - -/** - * Creates a new user account associated with the specified email address and password. - * - * @remarks - * On successful creation of the user account, this user will also be signed in to your application. - * - * User account creation can fail if the account already exists or the password is invalid. - * - * This method is not supported on {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * Note: The email address acts as a unique identifier for the user and enables an email-based - * password reset. This function will create a new user account and set the initial user password. - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * @param password - The user's chosen password. - * - * @public - */ -export declare function createUserWithEmailAndPassword(auth: Auth, email: string, password: string): Promise<UserCredential>; - -/** - * Map of OAuth Custom Parameters. - * - * @public - */ -export declare type CustomParameters = Record<string, string>; - -/** - * A verbose error map with detailed descriptions for most error codes. - * - * See discussion at {@link AuthErrorMap} - * - * @public - */ -export declare const debugErrorMap: AuthErrorMap; - -/** - * Deletes and signs out the user. - * - * @remarks - * Important: this is a security-sensitive operation that requires the user to have recently - * signed in. If this requirement isn't met, ask the user to authenticate again and then call - * {@link reauthenticateWithCredential}. - * - * @param user - The user. - * - * @public - */ -export declare function deleteUser(user: User): Promise<void>; - -/** - * The dependencies that can be used to initialize an {@link Auth} instance. - * - * @remarks - * - * The modular SDK enables tree shaking by allowing explicit declarations of - * dependencies. For example, a web app does not need to include code that - * enables Cordova redirect sign in. That functionality is therefore split into - * {@link browserPopupRedirectResolver} and - * {@link cordovaPopupRedirectResolver}. The dependencies object is how Auth is - * configured to reduce bundle sizes. - * - * There are two ways to initialize an {@link Auth} instance: {@link getAuth} and - * {@link initializeAuth}. `getAuth` initializes everything using - * platform-specific configurations, while `initializeAuth` takes a - * `Dependencies` object directly, giving you more control over what is used. - * - * @public - */ -declare interface Dependencies { - /** - * Which {@link Persistence} to use. If this is an array, the first - * `Persistence` that the device supports is used. The SDK searches for an - * existing account in order and, if one is found in a secondary - * `Persistence`, the account is moved to the primary `Persistence`. - * - * If no persistence is provided, the SDK falls back on - * {@link inMemoryPersistence}. - */ - persistence?: Persistence | Persistence[]; - /** - * The {@link PopupRedirectResolver} to use. This value depends on the - * platform. Options are {@link browserPopupRedirectResolver} and - * {@link cordovaPopupRedirectResolver}. This field is optional if neither - * {@link signInWithPopup} or {@link signInWithRedirect} are being used. - */ - popupRedirectResolver?: PopupRedirectResolver; - /** - * Which {@link AuthErrorMap} to use. - */ - errorMap?: AuthErrorMap; -} - -/** - * Interface that represents the credentials returned by {@link EmailAuthProvider} for - * {@link ProviderId}.PASSWORD - * - * @remarks - * Covers both {@link SignInMethod}.EMAIL_PASSWORD and - * {@link SignInMethod}.EMAIL_LINK. - * - * @public - */ -export declare class EmailAuthCredential extends AuthCredential { - /** @internal */ - readonly _email: string; - /** @internal */ - readonly _password: string; - /** @internal */ - readonly _tenantId: string | null; - /** @internal */ - private constructor(); - /** @internal */ - static _fromEmailAndPassword(email: string, password: string): EmailAuthCredential; - /** @internal */ - static _fromEmailAndCode(email: string, oobCode: string, tenantId?: string | null): EmailAuthCredential; - /** {@inheritdoc AuthCredential.toJSON} */ - toJSON(): object; - /** - * Static method to deserialize a JSON representation of an object into an {@link AuthCredential}. - * - * @param json - Either `object` or the stringified representation of the object. When string is - * provided, `JSON.parse` would be called first. - * - * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned. - */ - static fromJSON(json: object | string): EmailAuthCredential | null; - /** @internal */ - _getIdTokenResponse(auth: AuthInternal): Promise<IdTokenResponse>; - /** @internal */ - _linkToIdToken(auth: AuthInternal, idToken: string): Promise<IdTokenResponse>; - /** @internal */ - _getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse>; -} - -/** - * Provider for generating {@link EmailAuthCredential}. - * - * @public - */ -export declare class EmailAuthProvider implements AuthProvider { - /** - * Always set to {@link ProviderId}.PASSWORD, even for email link. - */ - static readonly PROVIDER_ID: 'password'; - /** - * Always set to {@link SignInMethod}.EMAIL_PASSWORD. - */ - static readonly EMAIL_PASSWORD_SIGN_IN_METHOD: 'password'; - /** - * Always set to {@link SignInMethod}.EMAIL_LINK. - */ - static readonly EMAIL_LINK_SIGN_IN_METHOD: 'emailLink'; - /** - * Always set to {@link ProviderId}.PASSWORD, even for email link. - */ - readonly providerId: "password"; - /** - * Initialize an {@link AuthCredential} using an email and password. - * - * @example - * ```javascript - * const authCredential = EmailAuthProvider.credential(email, password); - * const userCredential = await signInWithCredential(auth, authCredential); - * ``` - * - * @example - * ```javascript - * const userCredential = await signInWithEmailAndPassword(auth, email, password); - * ``` - * - * @param email - Email address. - * @param password - User account password. - * @returns The auth provider credential. - */ - static credential(email: string, password: string): EmailAuthCredential; - /** - * Initialize an {@link AuthCredential} using an email and an email link after a sign in with - * email link operation. - * - * @example - * ```javascript - * const authCredential = EmailAuthProvider.credentialWithLink(auth, email, emailLink); - * const userCredential = await signInWithCredential(auth, authCredential); - * ``` - * - * @example - * ```javascript - * await sendSignInLinkToEmail(auth, email); - * // Obtain emailLink from user. - * const userCredential = await signInWithEmailLink(auth, email, emailLink); - * ``` - * - * @param auth - The {@link Auth} instance used to verify the link. - * @param email - Email address. - * @param emailLink - Sign-in email link. - * @returns - The auth provider credential. - */ - static credentialWithLink(email: string, emailLink: string): EmailAuthCredential; -} - -/** - * Configuration of Firebase Authentication Emulator. - * @public - */ -declare interface EmulatorConfig { - /** - * The protocol used to communicate with the emulator ("http"/"https"). - */ - readonly protocol: string; - /** - * The hostname of the emulator, which may be a domain ("localhost"), IPv4 address ("127.0.0.1") - * or quoted IPv6 address ("[::1]"). - */ - readonly host: string; - /** - * The port of the emulator, or null if port isn't specified (i.e. protocol default). - */ - readonly port: number | null; - /** - * The emulator-specific options. - */ - readonly options: { - /** - * Whether the warning banner attached to the DOM was disabled. - */ - readonly disableWarnings: boolean; - }; -} - -declare const enum EnforcementState { - ENFORCE = "ENFORCE", - AUDIT = "AUDIT", - OFF = "OFF", - ENFORCEMENT_STATE_UNSPECIFIED = "ENFORCEMENT_STATE_UNSPECIFIED" -} - -/** - * @internal - */ -declare interface EventManager { - registerConsumer(authEventConsumer: AuthEventConsumer): void; - unregisterConsumer(authEventConsumer: AuthEventConsumer): void; -} - -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.FACEBOOK. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new FacebookAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('user_birthday'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = FacebookAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new FacebookAuthProvider(); - * provider.addScope('user_birthday'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = FacebookAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * ``` - * - * @public - */ -export declare class FacebookAuthProvider extends BaseOAuthProvider { - /** Always set to {@link SignInMethod}.FACEBOOK. */ - static readonly FACEBOOK_SIGN_IN_METHOD: 'facebook.com'; - /** Always set to {@link ProviderId}.FACEBOOK. */ - static readonly PROVIDER_ID: 'facebook.com'; - constructor(); - /** - * Creates a credential for Facebook. - * - * @example - * ```javascript - * // `event` from the Facebook auth.authResponseChange callback. - * const credential = FacebookAuthProvider.credential(event.authResponse.accessToken); - * const result = await signInWithCredential(credential); - * ``` - * - * @param accessToken - Facebook access token. - */ - static credential(accessToken: string): OAuthCredential; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): OAuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): OAuthCredential | null; - private static credentialFromTaggedObject; -} - -/** - * An enum of factors that may be used for multifactor authentication. - * - * @public - */ -declare const FactorId: { - /** Phone as second factor */ - readonly PHONE: "phone"; - readonly TOTP: "totp"; -}; - -/** - * The base class for all Federated providers (OAuth (including OIDC), SAML). - * - * This class is not meant to be instantiated directly. - * - * @public - */ -declare abstract class FederatedAuthProvider implements AuthProvider { - readonly providerId: string; - /** @internal */ - defaultLanguageCode: string | null; - /** @internal */ - private customParameters; - /** - * Constructor for generic OAuth providers. - * - * @param providerId - Provider for which credentials should be generated. - */ - constructor(providerId: string); - /** - * Set the language gode. - * - * @param languageCode - language code - */ - setDefaultLanguage(languageCode: string | null): void; - /** - * Sets the OAuth custom parameters to pass in an OAuth request for popup and redirect sign-in - * operations. - * - * @remarks - * For a detailed list, check the reserved required OAuth 2.0 parameters such as `client_id`, - * `redirect_uri`, `scope`, `response_type`, and `state` are not allowed and will be ignored. - * - * @param customOAuthParameters - The custom OAuth parameters to pass in the OAuth request. - */ - setCustomParameters(customOAuthParameters: CustomParameters): AuthProvider; - /** - * Retrieve the current list of {@link CustomParameters}. - */ - getCustomParameters(): CustomParameters; -} - -/** - * Gets the list of possible sign in methods for the given email address. This method returns an - * empty list when - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection} - * is enabled, irrespective of the number of authentication methods available for the given email. - * - * @remarks - * This is useful to differentiate methods of sign-in for the same provider, eg. - * {@link EmailAuthProvider} which has 2 methods of sign-in, - * {@link SignInMethod}.EMAIL_PASSWORD and - * {@link SignInMethod}.EMAIL_LINK. - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * - * Deprecated. Migrating off of this method is recommended as a security best-practice. - * Learn more in the Identity Platform documentation for - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}. - * @public - */ -export declare function fetchSignInMethodsForEmail(auth: Auth, email: string): Promise<string[]>; - -declare interface FinalizeMfaResponse { - idToken: string; - refreshToken: string; -} - -/** - * @internal - */ -declare type GenericAuthErrorParams = { - [key in Exclude<AuthErrorCode, AuthErrorCode.ARGUMENT_ERROR | AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH | AuthErrorCode.INTERNAL_ERROR | AuthErrorCode.MFA_REQUIRED | AuthErrorCode.NO_AUTH_EVENT | AuthErrorCode.OPERATION_NOT_SUPPORTED>]: { - appName?: AppName; - email?: string; - phoneNumber?: string; - message?: string; - }; -}; - -/** - * Extracts provider specific {@link AdditionalUserInfo} for the given credential. - * - * @param userCredential - The user credential. - * - * @public - */ -export declare function getAdditionalUserInfo(userCredential: UserCredential): AdditionalUserInfo | null; - -/** - * Returns the Auth instance associated with the provided {@link @firebase/app#FirebaseApp}. - * If no instance exists, initializes an Auth instance with platform-specific default dependencies. - * - * @param app - The Firebase App. - * - * @public - */ -export declare function getAuth(app?: FirebaseApp): Auth; - -/** - * Returns a JSON Web Token (JWT) used to identify the user to a Firebase service. - * - * @remarks - * Returns the current token if it has not expired or if it will not expire in the next five - * minutes. Otherwise, this will refresh the token and return a new one. - * - * @param user - The user. - * @param forceRefresh - Force refresh regardless of token expiration. - * - * @public - */ -export declare function getIdToken(user: User, forceRefresh?: boolean): Promise<string>; - -/** - * Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service. - * - * @remarks - * Returns the current token if it has not expired or if it will not expire in the next five - * minutes. Otherwise, this will refresh the token and return a new one. - * - * @param user - The user. - * @param forceRefresh - Force refresh regardless of token expiration. - * - * @public - */ -export declare function getIdTokenResult(user: User, forceRefresh?: boolean): Promise<IdTokenResult>; - -/** - * Provides a {@link MultiFactorResolver} suitable for completion of a - * multi-factor flow. - * - * @param auth - The {@link Auth} instance. - * @param error - The {@link MultiFactorError} raised during a sign-in, or - * reauthentication operation. - * - * @public - */ -export declare function getMultiFactorResolver(auth: Auth, error: MultiFactorError): MultiFactorResolver; - -declare interface GetRecaptchaConfigResponse { - recaptchaKey: string; - recaptchaEnforcementState: RecaptchaEnforcementProviderState[]; -} - -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GITHUB. - * - * @remarks - * GitHub requires an OAuth 2.0 redirect, so you can either handle the redirect directly, or use - * the {@link signInWithPopup} handler: - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new GithubAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('repo'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a GitHub Access Token. - * const credential = GithubAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new GithubAuthProvider(); - * provider.addScope('repo'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a GitHub Access Token. - * const credential = GithubAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * ``` - * @public - */ -export declare class GithubAuthProvider extends BaseOAuthProvider { - /** Always set to {@link SignInMethod}.GITHUB. */ - static readonly GITHUB_SIGN_IN_METHOD: 'github.com'; - /** Always set to {@link ProviderId}.GITHUB. */ - static readonly PROVIDER_ID: 'github.com'; - constructor(); - /** - * Creates a credential for GitHub. - * - * @param accessToken - GitHub access token. - */ - static credential(accessToken: string): OAuthCredential; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): OAuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): OAuthCredential | null; - private static credentialFromTaggedObject; -} - -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GOOGLE. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new GoogleAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('profile'); - * provider.addScope('email'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Google Access Token. - * const credential = GoogleAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new GoogleAuthProvider(); - * provider.addScope('profile'); - * provider.addScope('email'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Google Access Token. - * const credential = GoogleAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * ``` - * - * @public - */ -export declare class GoogleAuthProvider extends BaseOAuthProvider { - /** Always set to {@link SignInMethod}.GOOGLE. */ - static readonly GOOGLE_SIGN_IN_METHOD: 'google.com'; - /** Always set to {@link ProviderId}.GOOGLE. */ - static readonly PROVIDER_ID: 'google.com'; - constructor(); - /** - * Creates a credential for Google. At least one of ID token and access token is required. - * - * @example - * ```javascript - * // \`googleUser\` from the onsuccess Google Sign In callback. - * const credential = GoogleAuthProvider.credential(googleUser.getAuthResponse().id_token); - * const result = await signInWithCredential(credential); - * ``` - * - * @param idToken - Google ID token. - * @param accessToken - Google access token. - */ - static credential(idToken?: string | null, accessToken?: string | null): OAuthCredential; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): OAuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): OAuthCredential | null; - private static credentialFromTaggedObject; -} - -/** - * Raw encoded JWT - * - */ -declare type IdToken = string; - -/** - * @internal - */ -declare interface IdTokenMfaResponse extends IdTokenResponse { - mfaPendingCredential?: string; - mfaInfo?: MfaEnrollment[]; -} - -/** - * IdToken as returned by the API - * - * @internal - */ -declare interface IdTokenResponse { - localId: string; - idToken?: IdToken; - refreshToken?: string; - expiresIn?: string; - providerId?: string; - displayName?: string | null; - isNewUser?: boolean; - kind?: IdTokenResponseKind; - photoUrl?: string | null; - rawUserInfo?: string; - screenName?: string | null; -} - -/** - * The possible types of the `IdTokenResponse` - * - * @internal - */ -declare const enum IdTokenResponseKind { - CreateAuthUri = "identitytoolkit#CreateAuthUriResponse", - DeleteAccount = "identitytoolkit#DeleteAccountResponse", - DownloadAccount = "identitytoolkit#DownloadAccountResponse", - EmailLinkSignin = "identitytoolkit#EmailLinkSigninResponse", - GetAccountInfo = "identitytoolkit#GetAccountInfoResponse", - GetOobConfirmationCode = "identitytoolkit#GetOobConfirmationCodeResponse", - GetRecaptchaParam = "identitytoolkit#GetRecaptchaParamResponse", - ResetPassword = "identitytoolkit#ResetPasswordResponse", - SetAccountInfo = "identitytoolkit#SetAccountInfoResponse", - SignupNewUser = "identitytoolkit#SignupNewUserResponse", - UploadAccount = "identitytoolkit#UploadAccountResponse", - VerifyAssertion = "identitytoolkit#VerifyAssertionResponse", - VerifyCustomToken = "identitytoolkit#VerifyCustomTokenResponse", - VerifyPassword = "identitytoolkit#VerifyPasswordResponse" -} - -/** - * Interface representing ID token result obtained from {@link User.getIdTokenResult}. - * - * @remarks - * `IdTokenResult` contains the ID token JWT string and other helper properties for getting different data - * associated with the token as well as all the decoded payload claims. - * - * Note that these claims are not to be trusted as they are parsed client side. Only server side - * verification can guarantee the integrity of the token claims. - * - * @public - */ -declare interface IdTokenResult { - /** - * The authentication time formatted as a UTC string. - * - * @remarks - * This is the time the user authenticated (signed in) and not the time the token was refreshed. - */ - authTime: string; - /** The ID token expiration time formatted as a UTC string. */ - expirationTime: string; - /** The ID token issuance time formatted as a UTC string. */ - issuedAtTime: string; - /** - * The sign-in provider through which the ID token was obtained (anonymous, custom, phone, - * password, etc). - * - * @remarks - * Note, this does not map to provider IDs. - */ - signInProvider: string | null; - /** - * The type of second factor associated with this session, provided the user was multi-factor - * authenticated (eg. phone, etc). - */ - signInSecondFactor: string | null; - /** The Firebase Auth ID token JWT string. */ - token: string; - /** - * The entire payload claims of the ID token including the standard reserved claims as well as - * the custom claims. - */ - claims: ParsedToken; -} - -/** - * An implementation of {@link Persistence} of type `LOCAL` using `indexedDB` - * for the underlying storage. - * - * @public - */ -export declare const indexedDBLocalPersistence: Persistence; - -/** - * Initializes an {@link Auth} instance with fine-grained control over - * {@link Dependencies}. - * - * @remarks - * - * This function allows more control over the {@link Auth} instance than - * {@link getAuth}. `getAuth` uses platform-specific defaults to supply - * the {@link Dependencies}. In general, `getAuth` is the easiest way to - * initialize Auth and works for most use cases. Use `initializeAuth` if you - * need control over which persistence layer is used, or to minimize bundle - * size if you're not using either `signInWithPopup` or `signInWithRedirect`. - * - * For example, if your app only uses anonymous accounts and you only want - * accounts saved for the current session, initialize `Auth` with: - * - * ```js - * const auth = initializeAuth(app, { - * persistence: browserSessionPersistence, - * popupRedirectResolver: undefined, - * }); - * ``` - * - * @public - */ -export declare function initializeAuth(app: FirebaseApp, deps?: Dependencies): Auth; - -/** - * Loads the reCAPTCHA configuration into the `Auth` instance. - * - * @remarks - * This will load the reCAPTCHA config, which indicates whether the reCAPTCHA - * verification flow should be triggered for each auth provider, into the - * current Auth session. - * - * If initializeRecaptchaConfig() is not invoked, the auth flow will always start - * without reCAPTCHA verification. If the provider is configured to require reCAPTCHA - * verification, the SDK will transparently load the reCAPTCHA config and restart the - * auth flows. - * - * Thus, by calling this optional method, you will reduce the latency of future auth flows. - * Loading the reCAPTCHA config early will also enhance the signal collected by reCAPTCHA. - * - * This method does not work in a Node.js environment. - * - * @example - * ```javascript - * initializeRecaptchaConfig(auth); - * ``` - * - * @param auth - The {@link Auth} instance. - * - * @public - */ -export declare function initializeRecaptchaConfig(auth: Auth): Promise<void>; - -/** - * An implementation of {@link Persistence} of type 'NONE'. - * - * @public - */ -export declare const inMemoryPersistence: Persistence; - -/** - * Checks if an incoming link is a sign-in with email link suitable for {@link signInWithEmailLink}. - * - * @param auth - The {@link Auth} instance. - * @param emailLink - The link sent to the user's email address. - * - * @public - */ -export declare function isSignInWithEmailLink(auth: Auth, emailLink: string): boolean; - -/** - * Links the user account with the given credentials. - * - * @remarks - * An {@link AuthProvider} can be used to generate the credential. - * - * @param user - The user. - * @param credential - The auth credential. - * - * @public - */ -export declare function linkWithCredential(user: User, credential: AuthCredential): Promise<UserCredential>; - -/** - * MfaEnrollment can be any subtype of BaseMfaEnrollment, currently only PhoneMfaEnrollment and TotpMfaEnrollment are supported. - */ -declare type MfaEnrollment = PhoneMfaEnrollment | TotpMfaEnrollment; - -/** - * The {@link MultiFactorUser} corresponding to the user. - * - * @remarks - * This is used to access all multi-factor properties and operations related to the user. - * - * @param user - The user. - * - * @public - */ -export declare function multiFactor(user: User): MultiFactorUser; - -/** - * The base class for asserting ownership of a second factor. - * - * @remarks - * This is used to facilitate enrollment of a second factor on an existing user or sign-in of a - * user who already verified the first factor. - * - * @public - */ -declare interface MultiFactorAssertion { - /** The identifier of the second factor. */ - readonly factorId: (typeof FactorId)[keyof typeof FactorId]; -} - -/** - * The error thrown when the user needs to provide a second factor to sign in successfully. - * - * @remarks - * The error code for this error is `auth/multi-factor-auth-required`. - * - * @example - * ```javascript - * let resolver; - * let multiFactorHints; - * - * signInWithEmailAndPassword(auth, email, password) - * .then((result) => { - * // User signed in. No 2nd factor challenge is needed. - * }) - * .catch((error) => { - * if (error.code == 'auth/multi-factor-auth-required') { - * resolver = getMultiFactorResolver(auth, error); - * multiFactorHints = resolver.hints; - * } else { - * // Handle other errors. - * } - * }); - * - * // Obtain a multiFactorAssertion by verifying the second factor. - * - * const userCredential = await resolver.resolveSignIn(multiFactorAssertion); - * ``` - * - * @public - */ -declare interface MultiFactorError extends AuthError { - /** Details about the MultiFactorError. */ - readonly customData: AuthError['customData'] & { - /** - * The type of operation (sign-in, linking, or re-authentication) that raised the error. - */ - readonly operationType: (typeof OperationType)[keyof typeof OperationType]; - }; -} - -/** - * A structure containing the information of a second factor entity. - * - * @public - */ -declare interface MultiFactorInfo { - /** The multi-factor enrollment ID. */ - readonly uid: string; - /** The user friendly name of the current second factor. */ - readonly displayName?: string | null; - /** The enrollment date of the second factor formatted as a UTC string. */ - readonly enrollmentTime: string; - /** The identifier of the second factor. */ - readonly factorId: (typeof FactorId)[keyof typeof FactorId]; -} - -/** - * The class used to facilitate recovery from {@link MultiFactorError} when a user needs to - * provide a second factor to sign in. - * - * @example - * ```javascript - * let resolver; - * let multiFactorHints; - * - * signInWithEmailAndPassword(auth, email, password) - * .then((result) => { - * // User signed in. No 2nd factor challenge is needed. - * }) - * .catch((error) => { - * if (error.code == 'auth/multi-factor-auth-required') { - * resolver = getMultiFactorResolver(auth, error); - * // Show UI to let user select second factor. - * multiFactorHints = resolver.hints; - * } else { - * // Handle other errors. - * } - * }); - * - * // The enrolled second factors that can be used to complete - * // sign-in are returned in the `MultiFactorResolver.hints` list. - * // UI needs to be presented to allow the user to select a second factor - * // from that list. - * - * const selectedHint = // ; selected from multiFactorHints - * const phoneAuthProvider = new PhoneAuthProvider(auth); - * const phoneInfoOptions = { - * multiFactorHint: selectedHint, - * session: resolver.session - * }; - * const verificationId = phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier); - * // Store `verificationId` and show UI to let user enter verification code. - * - * // UI to enter verification code and continue. - * // Continue button click handler - * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential); - * const userCredential = await resolver.resolveSignIn(multiFactorAssertion); - * ``` - * - * @public - */ -declare interface MultiFactorResolver { - /** - * The list of hints for the second factors needed to complete the sign-in for the current - * session. - */ - readonly hints: MultiFactorInfo[]; - /** - * The session identifier for the current sign-in flow, which can be used to complete the second - * factor sign-in. - */ - readonly session: MultiFactorSession; - /** - * A helper function to help users complete sign in with a second factor using an - * {@link MultiFactorAssertion} confirming the user successfully completed the second factor - * challenge. - * - * @example - * ```javascript - * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential); - * const userCredential = await resolver.resolveSignIn(multiFactorAssertion); - * ``` - * - * @param assertion - The multi-factor assertion to resolve sign-in with. - * @returns The promise that resolves with the user credential object. - */ - resolveSignIn(assertion: MultiFactorAssertion): Promise<UserCredential>; -} - -/** - * An interface defining the multi-factor session object used for enrolling a second factor on a - * user or helping sign in an enrolled user with a second factor. - * - * @public - */ -declare interface MultiFactorSession { -} - -/** - * An interface that defines the multi-factor related properties and operations pertaining - * to a {@link User}. - * - * @public - */ -declare interface MultiFactorUser { - /** Returns a list of the user's enrolled second factors. */ - readonly enrolledFactors: MultiFactorInfo[]; - /** - * Returns the session identifier for a second factor enrollment operation. This is used to - * identify the user trying to enroll a second factor. - * - * @example - * ```javascript - * const multiFactorUser = multiFactor(auth.currentUser); - * const multiFactorSession = await multiFactorUser.getSession(); - * - * // Send verification code. - * const phoneAuthProvider = new PhoneAuthProvider(auth); - * const phoneInfoOptions = { - * phoneNumber: phoneNumber, - * session: multiFactorSession - * }; - * const verificationId = await phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier); - * - * // Obtain verification code from user. - * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential); - * await multiFactorUser.enroll(multiFactorAssertion); - * ``` - * - * @returns The promise that resolves with the {@link MultiFactorSession}. - */ - getSession(): Promise<MultiFactorSession>; - /** - * - * Enrolls a second factor as identified by the {@link MultiFactorAssertion} for the - * user. - * - * @remarks - * On resolution, the user tokens are updated to reflect the change in the JWT payload. - * Accepts an additional display name parameter used to identify the second factor to the end - * user. Recent re-authentication is required for this operation to succeed. On successful - * enrollment, existing Firebase sessions (refresh tokens) are revoked. When a new factor is - * enrolled, an email notification is sent to the user’s email. - * - * @example - * ```javascript - * const multiFactorUser = multiFactor(auth.currentUser); - * const multiFactorSession = await multiFactorUser.getSession(); - * - * // Send verification code. - * const phoneAuthProvider = new PhoneAuthProvider(auth); - * const phoneInfoOptions = { - * phoneNumber: phoneNumber, - * session: multiFactorSession - * }; - * const verificationId = await phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier); - * - * // Obtain verification code from user. - * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential); - * await multiFactorUser.enroll(multiFactorAssertion); - * // Second factor enrolled. - * ``` - * - * @param assertion - The multi-factor assertion to enroll with. - * @param displayName - The display name of the second factor. - */ - enroll(assertion: MultiFactorAssertion, displayName?: string | null): Promise<void>; - /** - * Unenrolls the specified second factor. - * - * @remarks - * To specify the factor to remove, pass a {@link MultiFactorInfo} object (retrieved from - * {@link MultiFactorUser.enrolledFactors}) or the - * factor's UID string. Sessions are not revoked when the account is unenrolled. An email - * notification is likely to be sent to the user notifying them of the change. Recent - * re-authentication is required for this operation to succeed. When an existing factor is - * unenrolled, an email notification is sent to the user’s email. - * - * @example - * ```javascript - * const multiFactorUser = multiFactor(auth.currentUser); - * // Present user the option to choose which factor to unenroll. - * await multiFactorUser.unenroll(multiFactorUser.enrolledFactors[i]) - * ``` - * - * @param option - The multi-factor option to unenroll. - * @returns - A `Promise` which resolves when the unenroll operation is complete. - */ - unenroll(option: MultiFactorInfo | string): Promise<void>; -} - -declare type MutableUserInfo = { - -readonly [K in keyof UserInfo]: UserInfo[K]; -}; - -/** - * Type definition for an event callback. - * - * @privateRemarks TODO(avolkovi): should we consolidate with Subscribe<T> since we're changing the API anyway? - * - * @public - */ -declare type NextOrObserver<T> = NextFn<T | null> | Observer<T | null>; - -/** - * Represents the OAuth credentials returned by an {@link OAuthProvider}. - * - * @remarks - * Implementations specify the details about each auth provider's credential requirements. - * - * @public - */ -export declare class OAuthCredential extends AuthCredential { - /** - * The OAuth ID token associated with the credential if it belongs to an OIDC provider, - * such as `google.com`. - * @readonly - */ - idToken?: string; - /** - * The OAuth access token associated with the credential if it belongs to an - * {@link OAuthProvider}, such as `facebook.com`, `twitter.com`, etc. - * @readonly - */ - accessToken?: string; - /** - * The OAuth access token secret associated with the credential if it belongs to an OAuth 1.0 - * provider, such as `twitter.com`. - * @readonly - */ - secret?: string; - private nonce?; - private pendingToken; - /** @internal */ - static _fromParams(params: OAuthCredentialParams): OAuthCredential; - /** {@inheritdoc AuthCredential.toJSON} */ - toJSON(): object; - /** - * Static method to deserialize a JSON representation of an object into an - * {@link AuthCredential}. - * - * @param json - Input can be either Object or the stringified representation of the object. - * When string is provided, JSON.parse would be called first. - * - * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned. - */ - static fromJSON(json: string | object): OAuthCredential | null; - /** @internal */ - _getIdTokenResponse(auth: AuthInternal): Promise<IdTokenResponse>; - /** @internal */ - _linkToIdToken(auth: AuthInternal, idToken: string): Promise<IdTokenResponse>; - /** @internal */ - _getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse>; - private buildRequest; -} - -/** - * Defines the options for initializing an {@link OAuthCredential}. - * - * @remarks - * For ID tokens with nonce claim, the raw nonce has to also be provided. - * - * @public - */ -export declare interface OAuthCredentialOptions { - /** - * The OAuth ID token used to initialize the {@link OAuthCredential}. - */ - idToken?: string; - /** - * The OAuth access token used to initialize the {@link OAuthCredential}. - */ - accessToken?: string; - /** - * The raw nonce associated with the ID token. - * - * @remarks - * It is required when an ID token with a nonce field is provided. The SHA-256 hash of the - * raw nonce must match the nonce field in the ID token. - */ - rawNonce?: string; -} - -declare interface OAuthCredentialParams { - idToken?: string | null; - accessToken?: string | null; - oauthToken?: string; - secret?: string; - oauthTokenSecret?: string; - nonce?: string; - pendingToken?: string; - providerId: string; - signInMethod: string; -} - -/** - * Provider for generating generic {@link OAuthCredential}. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new OAuthProvider('google.com'); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('profile'); - * provider.addScope('email'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a OAuth Access Token for the provider. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new OAuthProvider('google.com'); - * provider.addScope('profile'); - * provider.addScope('email'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a OAuth Access Token for the provider. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * ``` - * @public - */ -export declare class OAuthProvider extends BaseOAuthProvider { - /** - * Creates an {@link OAuthCredential} from a JSON string or a plain object. - * @param json - A plain object or a JSON string - */ - static credentialFromJSON(json: object | string): OAuthCredential; - /** - * Creates a {@link OAuthCredential} from a generic OAuth provider's access token or ID token. - * - * @remarks - * The raw nonce is required when an ID token with a nonce field is provided. The SHA-256 hash of - * the raw nonce must match the nonce field in the ID token. - * - * @example - * ```javascript - * // `googleUser` from the onsuccess Google Sign In callback. - * // Initialize a generate OAuth provider with a `google.com` providerId. - * const provider = new OAuthProvider('google.com'); - * const credential = provider.credential({ - * idToken: googleUser.getAuthResponse().id_token, - * }); - * const result = await signInWithCredential(credential); - * ``` - * - * @param params - Either the options object containing the ID token, access token and raw nonce - * or the ID token string. - */ - credential(params: OAuthCredentialOptions): OAuthCredential; - /** An internal credential method that accepts more permissive options */ - private _credential; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): OAuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): OAuthCredential | null; - private static oauthCredentialFromTaggedObject; -} - -/** - * Adds an observer for changes to the user's sign-in state. - * - * @remarks - * To keep the old behavior, see {@link onIdTokenChanged}. - * - * @param auth - The {@link Auth} instance. - * @param nextOrObserver - callback triggered on change. - * @param error - Deprecated. This callback is never triggered. Errors - * on signing in/out can be caught in promises returned from - * sign-in/sign-out functions. - * @param completed - Deprecated. This callback is never triggered. - * - * @public - */ -export declare function onAuthStateChanged(auth: Auth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe; - -/** - * Adds an observer for changes to the signed-in user's ID token. - * - * @remarks - * This includes sign-in, sign-out, and token refresh events. - * This will not be triggered automatically upon ID token expiration. Use {@link User.getIdToken} to refresh the ID token. - * - * @param auth - The {@link Auth} instance. - * @param nextOrObserver - callback triggered on change. - * @param error - Deprecated. This callback is never triggered. Errors - * on signing in/out can be caught in promises returned from - * sign-in/sign-out functions. - * @param completed - Deprecated. This callback is never triggered. - * - * @public - */ -export declare function onIdTokenChanged(auth: Auth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe; - -/** - * Enumeration of supported operation types. - * - * @public - */ -declare const OperationType: { - /** Operation involving linking an additional provider to an already signed-in user. */ - readonly LINK: "link"; - /** Operation involving using a provider to reauthenticate an already signed-in user. */ - readonly REAUTHENTICATE: "reauthenticate"; - /** Operation involving signing in a user. */ - readonly SIGN_IN: "signIn"; -}; - -/** - * Parses the email action link string and returns an {@link ActionCodeURL} if - * the link is valid, otherwise returns null. - * - * @public - */ -export declare function parseActionCodeURL(link: string): ActionCodeURL | null; - -/** - * Interface representing a parsed ID token. - * - * @privateRemarks TODO(avolkovi): consolidate with parsed_token in implementation. - * - * @public - */ -declare interface ParsedToken { - /** Expiration time of the token. */ - 'exp'?: string; - /** UID of the user. */ - 'sub'?: string; - /** Time at which authentication was performed. */ - 'auth_time'?: string; - /** Issuance time of the token. */ - 'iat'?: string; - /** Firebase specific claims, containing the provider(s) used to authenticate the user. */ - 'firebase'?: { - 'sign_in_provider'?: string; - 'sign_in_second_factor'?: string; - 'identities'?: Record<string, string>; - }; - /** Map of any additional custom claims. */ - [key: string]: unknown; -} - -/** - * A structure specifying password policy requirements. - * - * @public - */ -declare interface PasswordPolicy { - /** - * Requirements enforced by this password policy. - */ - readonly customStrengthOptions: { - /** - * Minimum password length, or undefined if not configured. - */ - readonly minPasswordLength?: number; - /** - * Maximum password length, or undefined if not configured. - */ - readonly maxPasswordLength?: number; - /** - * Whether the password should contain a lowercase letter, or undefined if not configured. - */ - readonly containsLowercaseLetter?: boolean; - /** - * Whether the password should contain an uppercase letter, or undefined if not configured. - */ - readonly containsUppercaseLetter?: boolean; - /** - * Whether the password should contain a numeric character, or undefined if not configured. - */ - readonly containsNumericCharacter?: boolean; - /** - * Whether the password should contain a non-alphanumeric character, or undefined if not configured. - */ - readonly containsNonAlphanumericCharacter?: boolean; - }; - /** - * List of characters that are considered non-alphanumeric during validation. - */ - readonly allowedNonAlphanumericCharacters: string; - /** - * The enforcement state of the policy. Can be 'OFF' or 'ENFORCE'. - */ - readonly enforcementState: string; - /** - * Whether existing passwords must meet the policy. - */ - readonly forceUpgradeOnSignin: boolean; -} - -/** - * Internal typing of the password policy custom strength options that is modifiable. This - * allows us to construct the strength options before storing them in the policy. - * - * @internal - */ -declare interface PasswordPolicyCustomStrengthOptions { - /** - * Minimum password length. - */ - minPasswordLength?: number; - /** - * Maximum password length. - */ - maxPasswordLength?: number; - /** - * Whether the password should contain a lowercase letter. - */ - containsLowercaseLetter?: boolean; - /** - * Whether the password should contain an uppercase letter. - */ - containsUppercaseLetter?: boolean; - /** - * Whether the password should contain a numeric character. - */ - containsNumericCharacter?: boolean; - /** - * Whether the password should contain a non-alphanumeric character. - */ - containsNonAlphanumericCharacter?: boolean; -} - -/** - * Internal typing of password policy that includes the schema version and methods for - * validating that a password meets the policy. The developer does not need access to - * these properties and methods, so they are excluded from the public typing. - * - * @internal - */ -declare interface PasswordPolicyInternal extends PasswordPolicy { - /** - * Requirements enforced by the password policy. - */ - readonly customStrengthOptions: PasswordPolicyCustomStrengthOptions; - /** - * Schema version of the password policy. - */ - readonly schemaVersion: number; - /** - * Validates the password against the policy. - * @param password Password to validate. - */ - validatePassword(password: string): PasswordValidationStatus; -} - -/** - * A structure indicating which password policy requirements were met or violated and what the - * requirements are. - * - * @public - */ -declare interface PasswordValidationStatus { - /** - * Whether the password meets all requirements. - */ - readonly isValid: boolean; - /** - * Whether the password meets the minimum password length, or undefined if not required. - */ - readonly meetsMinPasswordLength?: boolean; - /** - * Whether the password meets the maximum password length, or undefined if not required. - */ - readonly meetsMaxPasswordLength?: boolean; - /** - * Whether the password contains a lowercase letter, or undefined if not required. - */ - readonly containsLowercaseLetter?: boolean; - /** - * Whether the password contains an uppercase letter, or undefined if not required. - */ - readonly containsUppercaseLetter?: boolean; - /** - * Whether the password contains a numeric character, or undefined if not required. - */ - readonly containsNumericCharacter?: boolean; - /** - * Whether the password contains a non-alphanumeric character, or undefined if not required. - */ - readonly containsNonAlphanumericCharacter?: boolean; - /** - * The policy used to validate the password. - */ - readonly passwordPolicy: PasswordPolicy; -} - -declare type PersistedBlob = Record<string, unknown>; - -/** - * An interface covering the possible persistence mechanism types. - * - * @public - */ -declare interface Persistence { - /** - * Type of Persistence. - * - 'SESSION' is used for temporary persistence such as `sessionStorage`. - * - 'LOCAL' is used for long term persistence such as `localStorage` or `IndexedDB`. - * - 'NONE' is used for in-memory, or no persistence. - * - 'COOKIE' is used for cookie persistence, useful for server-side rendering. - */ - readonly type: 'SESSION' | 'LOCAL' | 'NONE' | 'COOKIE'; -} - -declare interface PersistenceInternal extends Persistence { - type: PersistenceType; - _isAvailable(): Promise<boolean>; - _set(key: string, value: PersistenceValue): Promise<void>; - _get<T extends PersistenceValue>(key: string): Promise<T | null>; - _remove(key: string): Promise<void>; - _addListener(key: string, listener: StorageEventListener): void; - _removeListener(key: string, listener: StorageEventListener): void; - _shouldAllowMigration?: boolean; -} - -declare const enum PersistenceType { - SESSION = "SESSION", - LOCAL = "LOCAL", - NONE = "NONE", - COOKIE = "COOKIE" -} - -declare type PersistenceValue = PersistedBlob | string; - -/** - * Represents the credentials returned by {@link PhoneAuthProvider}. - * - * @public - */ -export declare class PhoneAuthCredential extends AuthCredential { - private readonly params; - private constructor(); - /** @internal */ - static _fromVerification(verificationId: string, verificationCode: string): PhoneAuthCredential; - /** @internal */ - static _fromTokenResponse(phoneNumber: string, temporaryProof: string): PhoneAuthCredential; - /** @internal */ - _getIdTokenResponse(auth: AuthInternal): Promise<PhoneOrOauthTokenResponse>; - /** @internal */ - _linkToIdToken(auth: AuthInternal, idToken: string): Promise<IdTokenResponse>; - /** @internal */ - _getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse>; - /** @internal */ - _makeVerificationRequest(): SignInWithPhoneNumberRequest; - /** {@inheritdoc AuthCredential.toJSON} */ - toJSON(): object; - /** Generates a phone credential based on a plain object or a JSON string. */ - static fromJSON(json: object | string): PhoneAuthCredential | null; -} - -/** - * An MFA provided by SMS verification. - */ -declare interface PhoneMfaEnrollment extends BaseMfaEnrollment { - phoneInfo: string; -} - -/** - * @internal - */ -declare type PhoneOrOauthTokenResponse = SignInWithPhoneNumberResponse | SignInWithIdpResponse | IdTokenResponse; - -/** - * A resolver used for handling DOM specific operations like {@link signInWithPopup} - * or {@link signInWithRedirect}. - * - * @public - */ -declare interface PopupRedirectResolver { -} - -/** - * We need to mark this interface as internal explicitly to exclude it in the public typings, because - * it references AuthInternal which has a circular dependency with UserInternal. - * - * @internal - */ -declare interface PopupRedirectResolverInternal extends PopupRedirectResolver { - _shouldInitProactively: boolean; - _initialize(auth: AuthInternal): Promise<EventManager>; - _openPopup(auth: AuthInternal, provider: AuthProvider, authType: AuthEventType, eventId?: string): Promise<AuthPopup>; - _openRedirect(auth: AuthInternal, provider: AuthProvider, authType: AuthEventType, eventId?: string): Promise<void | never>; - _isIframeWebStorageSupported(auth: AuthInternal, cb: (support: boolean) => unknown): void; - _redirectPersistence: Persistence; - _originValidation(auth: Auth): Promise<void>; - _completeRedirectFn: (auth: Auth, resolver: PopupRedirectResolver, bypassAuthState: boolean) => Promise<UserCredential | null>; - _overrideRedirectResult: (auth: AuthInternal, resultGetter: () => Promise<UserCredentialInternal | null>) => void; -} - -/** - * A minimal error map with all verbose error messages stripped. - * - * See discussion at {@link AuthErrorMap} - * - * @public - */ -export declare const prodErrorMap: AuthErrorMap; - -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Enumeration of supported providers. - * @internal - */ -declare const enum ProviderId { - /** @internal */ - ANONYMOUS = "anonymous", - /** @internal */ - CUSTOM = "custom", - /** Facebook provider ID */ - FACEBOOK = "facebook.com", - /** @internal */ - FIREBASE = "firebase", - /** GitHub provider ID */ - GITHUB = "github.com", - /** Google provider ID */ - GOOGLE = "google.com", - /** Password provider */ - PASSWORD = "password", - /** Phone provider */ - PHONE = "phone", - /** Twitter provider ID */ - TWITTER = "twitter.com" -} - -declare interface ProviderUserInfo { - providerId: string; - rawId?: string; - email?: string; - displayName?: string; - photoUrl?: string; - phoneNumber?: string; -} - -/** - * Re-authenticates a user using a fresh credential. - * - * @remarks - * Use before operations such as {@link updatePassword} that require tokens from recent sign-in - * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error - * or a `TOKEN_EXPIRED` error. - * - * This method is not supported on any {@link User} signed in by {@link Auth} instances - * created with a {@link @firebase/app#FirebaseServerApp}. - * - * @param user - The user. - * @param credential - The auth credential. - * - * @public - */ -export declare function reauthenticateWithCredential(user: User, credential: AuthCredential): Promise<UserCredential>; - -declare class RecaptchaConfig { - /** - * The reCAPTCHA site key. - */ - siteKey: string; - /** - * The list of providers and their enablement status for reCAPTCHA Enterprise. - */ - recaptchaEnforcementState: RecaptchaEnforcementProviderState[]; - constructor(response: GetRecaptchaConfigResponse); - /** - * Returns the reCAPTCHA Enterprise enforcement state for the given provider. - * - * @param providerStr - The provider whose enforcement state is to be returned. - * @returns The reCAPTCHA Enterprise enforcement state for the given provider. - */ - getProviderEnforcementState(providerStr: string): EnforcementState | null; - /** - * Returns true if the reCAPTCHA Enterprise enforcement state for the provider is set to ENFORCE or AUDIT. - * - * @param providerStr - The provider whose enablement state is to be returned. - * @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider. - */ - isProviderEnabled(providerStr: string): boolean; - /** - * Returns true if reCAPTCHA Enterprise protection is enabled in at least one provider, otherwise - * returns false. - * - * @returns Whether or not reCAPTCHA Enterprise protection is enabled for at least one provider. - */ - isAnyProviderEnabled(): boolean; -} - -declare interface RecaptchaEnforcementProviderState { - provider: string; - enforcementState: string; -} - -/** - * Reloads user account data, if signed in. - * - * @param user - The user. - * - * @public - */ -export declare function reload(user: User): Promise<void>; - -/** - * Revokes the given access token. Currently only supports Apple OAuth access tokens. - * - * @param auth - The {@link Auth} instance. - * @param token - The Apple OAuth access token. - * - * @public - */ -export declare function revokeAccessToken(auth: Auth, token: string): Promise<void>; - -/** - * An {@link AuthProvider} for SAML. - * - * @public - */ -export declare class SAMLAuthProvider extends FederatedAuthProvider { - /** - * Constructor. The providerId must start with "saml." - * @param providerId - SAML provider ID. - */ - constructor(providerId: string); - /** - * Generates an {@link AuthCredential} from a {@link UserCredential} after a - * successful SAML flow completes. - * - * @remarks - * - * For example, to get an {@link AuthCredential}, you could write the - * following code: - * - * ```js - * const userCredential = await signInWithPopup(auth, samlProvider); - * const credential = SAMLAuthProvider.credentialFromResult(userCredential); - * ``` - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): AuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): AuthCredential | null; - /** - * Creates an {@link AuthCredential} from a JSON string or a plain object. - * @param json - A plain object or a JSON string - */ - static credentialFromJSON(json: string | object): AuthCredential; - private static samlCredentialFromTaggedObject; -} - -/** - * Sends a verification email to a user. - * - * @remarks - * The verification process is completed by calling {@link applyActionCode}. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendEmailVerification(user, actionCodeSettings); - * // Obtain code from the user. - * await applyActionCode(auth, code); - * ``` - * - * @param user - The user. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ -export declare function sendEmailVerification(user: User, actionCodeSettings?: ActionCodeSettings | null): Promise<void>; - -/** - * Sends a password reset email to the given email address. This method does not throw an error when - * there's no user account with the given email address and - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection} - * is enabled. - * - * @remarks - * To complete the password reset, call {@link confirmPasswordReset} with the code supplied in - * the email sent to the user, along with the new password specified by the user. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendPasswordResetEmail(auth, 'user@example.com', actionCodeSettings); - * // Obtain code from user. - * await confirmPasswordReset('user@example.com', code); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ -export declare function sendPasswordResetEmail(auth: Auth, email: string, actionCodeSettings?: ActionCodeSettings): Promise<void>; - -/** - * Sends a sign-in email link to the user with the specified email. - * - * @remarks - * The sign-in operation has to always be completed in the app unlike other out of band email - * actions (password reset and email verifications). This is because, at the end of the flow, - * the user is expected to be signed in and their Auth state persisted within the app. - * - * To complete sign in with the email link, call {@link signInWithEmailLink} with the email - * address and the email link supplied in the email sent to the user. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings); - * // Obtain emailLink from the user. - * if(isSignInWithEmailLink(auth, emailLink)) { - * await signInWithEmailLink(auth, 'user@example.com', emailLink); - * } - * ``` - * - * @param authInternal - The {@link Auth} instance. - * @param email - The user's email address. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ -export declare function sendSignInLinkToEmail(auth: Auth, email: string, actionCodeSettings: ActionCodeSettings): Promise<void>; - -/** - * Changes the type of persistence on the {@link Auth} instance for the currently saved - * `Auth` session and applies this type of persistence for future sign-in requests, including - * sign-in with redirect requests. - * - * @remarks - * This makes it easy for a user signing in to specify whether their session should be - * remembered or not. It also makes it easier to never persist the `Auth` state for applications - * that are shared by other users or have sensitive data. - * - * This method does not work in a Node.js environment or with {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * setPersistence(auth, browserSessionPersistence); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param persistence - The {@link Persistence} to use. - * @returns A `Promise` that resolves once the persistence change has completed - * - * @public - */ -export declare function setPersistence(auth: Auth, persistence: Persistence): Promise<void>; - -/** - * Asynchronously signs in as an anonymous user. - * - * @remarks - * If there is already an anonymous user signed in, that user will be returned; otherwise, a - * new anonymous user identity will be created and returned. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * - * @public - */ -export declare function signInAnonymously(auth: Auth): Promise<UserCredential>; - -/** - * Asynchronously signs in with the given credentials. - * - * @remarks - * An {@link AuthProvider} can be used to generate the credential. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * @param credential - The auth credential. - * - * @public - */ -export declare function signInWithCredential(auth: Auth, credential: AuthCredential): Promise<UserCredential>; - -/** - * Asynchronously signs in using a custom token. - * - * @remarks - * Custom tokens are used to integrate Firebase Auth with existing auth systems, and must - * be generated by an auth backend using the - * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#createcustomtoken | createCustomToken} - * method in the {@link https://firebase.google.com/docs/auth/admin | Admin SDK} . - * - * Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * @param customToken - The custom token to sign in with. - * - * @public - */ -export declare function signInWithCustomToken(auth: Auth, customToken: string): Promise<UserCredential>; - -/** - * Asynchronously signs in using an email and password. - * - * @remarks - * Fails with an error if the email address and password do not match. When - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection} - * is enabled, this method fails with "auth/invalid-credential" in case of an invalid - * email/password. - * - * This method is not supported on {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * Note: The user's password is NOT the password used to access the user's email account. The - * email address serves as a unique identifier for the user, and the password is used to access - * the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}. - * - * - * @param auth - The {@link Auth} instance. - * @param email - The users email address. - * @param password - The users password. - * - * @public - */ -export declare function signInWithEmailAndPassword(auth: Auth, email: string, password: string): Promise<UserCredential>; - -/** - * Asynchronously signs in using an email and sign-in email link. - * - * @remarks - * If no link is passed, the link is inferred from the current URL. - * - * Fails with an error if the email address is invalid or OTP in email link expires. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings); - * // Obtain emailLink from the user. - * if(isSignInWithEmailLink(auth, emailLink)) { - * await signInWithEmailLink(auth, 'user@example.com', emailLink); - * } - * ``` - * - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * @param emailLink - The link sent to the user's email address. - * - * @public - */ -export declare function signInWithEmailLink(auth: Auth, email: string, emailLink?: string): Promise<UserCredential>; - -/** - * @internal - */ -declare interface SignInWithIdpResponse extends IdTokenResponse { - oauthAccessToken?: string; - oauthTokenSecret?: string; - nonce?: string; - oauthIdToken?: string; - pendingToken?: string; -} - -/** - * @internal - */ -declare interface SignInWithPhoneNumberRequest { - temporaryProof?: string; - phoneNumber?: string; - sessionInfo?: string; - code?: string; - tenantId?: string; -} - -/** - * @internal - */ -declare interface SignInWithPhoneNumberResponse extends IdTokenResponse { - temporaryProof?: string; - phoneNumber?: string; -} - -/** - * Signs out the current user. - * - * @remarks - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * - * @public - */ -export declare function signOut(auth: Auth): Promise<void>; - -declare interface StartTotpMfaEnrollmentResponse { - totpSessionInfo: { - sharedSecretKey: string; - verificationCodeLength: number; - hashingAlgorithm: string; - periodSec: number; - sessionInfo: string; - finalizeEnrollmentTime: number; - }; -} - -declare interface StorageEventListener { - (value: PersistenceValue | null): void; -} - -/** - * We need to mark this class as internal explicitly to exclude it in the public typings, because - * it references AuthInternal which has a circular dependency with UserInternal. - * - * @internal - */ -declare class StsTokenManager { - refreshToken: string | null; - accessToken: string | null; - expirationTime: number | null; - get isExpired(): boolean; - updateFromServerResponse(response: IdTokenResponse | FinalizeMfaResponse): void; - updateFromIdToken(idToken: string): void; - getToken(auth: AuthInternal, forceRefresh?: boolean): Promise<string | null>; - clearRefreshToken(): void; - private refresh; - private updateTokensAndExpiration; - static fromJSON(appName: string, object: PersistedBlob): StsTokenManager; - toJSON(): object; - _assign(stsTokenManager: StsTokenManager): void; - _clone(): StsTokenManager; - _performRefresh(): never; -} - -/** - * @internal - */ -declare interface TaggedWithTokenResponse { - _tokenResponse?: PhoneOrOauthTokenResponse; -} - -/** - * An MFA provided by TOTP (Time-based One Time Password). - */ -declare interface TotpMfaEnrollment extends BaseMfaEnrollment { -} - -/** - * The class for asserting ownership of a TOTP second factor. Provided by - * {@link TotpMultiFactorGenerator.assertionForEnrollment} and - * {@link TotpMultiFactorGenerator.assertionForSignIn}. - * - * @public - */ -declare interface TotpMultiFactorAssertion extends MultiFactorAssertion { -} - -/** - * Provider for generating a {@link TotpMultiFactorAssertion}. - * - * @public - */ -export declare class TotpMultiFactorGenerator { - /** - * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of - * the TOTP (time-based one-time password) second factor. - * This assertion is used to complete enrollment in TOTP second factor. - * - * @param secret A {@link TotpSecret} containing the shared secret key and other TOTP parameters. - * @param oneTimePassword One-time password from TOTP App. - * @returns A {@link TotpMultiFactorAssertion} which can be used with - * {@link MultiFactorUser.enroll}. - */ - static assertionForEnrollment(secret: TotpSecret, oneTimePassword: string): TotpMultiFactorAssertion; - /** - * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of the TOTP second factor. - * This assertion is used to complete signIn with TOTP as the second factor. - * - * @param enrollmentId identifies the enrolled TOTP second factor. - * @param oneTimePassword One-time password from TOTP App. - * @returns A {@link TotpMultiFactorAssertion} which can be used with - * {@link MultiFactorResolver.resolveSignIn}. - */ - static assertionForSignIn(enrollmentId: string, oneTimePassword: string): TotpMultiFactorAssertion; - /** - * Returns a promise to {@link TotpSecret} which contains the TOTP shared secret key and other parameters. - * 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 {@link MultiFactorSession} that the user is part of. - * @returns A promise to {@link TotpSecret}. - */ - static generateSecret(session: MultiFactorSession): Promise<TotpSecret>; - /** - * The identifier of the TOTP second factor: `totp`. - */ - static FACTOR_ID: 'totp'; -} - -/** - * Provider for generating a {@link TotpMultiFactorAssertion}. - * - * Stores the shared secret key and other parameters to generate time-based OTPs. - * Implements methods to retrieve the shared secret key and generate a QR code URL. - * @public - */ -export declare class TotpSecret { - private readonly sessionInfo; - private readonly auth; - /** - * Shared secret key/seed used for enrolling in TOTP MFA and generating OTPs. - */ - readonly secretKey: string; - /** - * Hashing algorithm used. - */ - readonly hashingAlgorithm: string; - /** - * Length of the one-time passwords to be generated. - */ - readonly codeLength: number; - /** - * The interval (in seconds) when the OTP codes should change. - */ - readonly codeIntervalSeconds: number; - /** - * The timestamp (UTC string) by which TOTP enrollment should be completed. - */ - readonly enrollmentCompletionDeadline: string; - private constructor(); - /** @internal */ - static _fromStartTotpMfaEnrollmentResponse(response: StartTotpMfaEnrollmentResponse, auth: AuthInternal): TotpSecret; - /** @internal */ - _makeTotpVerificationInfo(otp: string): TotpVerificationInfo; - /** - * Returns a QR code URL as described in - * https://github.com/google/google-authenticator/wiki/Key-Uri-Format - * This can be displayed to the user as a QR code to be scanned into a TOTP app like Google Authenticator. - * If the optional parameters are unspecified, an accountName of <userEmail> and issuer of <firebaseAppName> are used. - * - * @param accountName the name of the account/app along with a user identifier. - * @param issuer issuer of the TOTP (likely the app name). - * @returns A QR code URL string. - */ - generateQrCodeUrl(accountName?: string, issuer?: string): string; -} - -declare interface TotpVerificationInfo { - sessionInfo: string; - verificationCode: string; -} - -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.TWITTER. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new TwitterAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Twitter Access Token and Secret. - * const credential = TwitterAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * const secret = credential.secret; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new TwitterAuthProvider(); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Twitter Access Token and Secret. - * const credential = TwitterAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * const secret = credential.secret; - * ``` - * - * @public - */ -export declare class TwitterAuthProvider extends BaseOAuthProvider { - /** Always set to {@link SignInMethod}.TWITTER. */ - static readonly TWITTER_SIGN_IN_METHOD: 'twitter.com'; - /** Always set to {@link ProviderId}.TWITTER. */ - static readonly PROVIDER_ID: 'twitter.com'; - constructor(); - /** - * Creates a credential for Twitter. - * - * @param token - Twitter access token. - * @param secret - Twitter secret. - */ - static credential(token: string, secret: string): OAuthCredential; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): OAuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): OAuthCredential | null; - private static credentialFromTaggedObject; -} - -/** - * Unlinks a provider from a user account. - * - * @param user - The user. - * @param providerId - The provider to unlink. - * - * @public - */ -export declare function unlink(user: User, providerId: string): Promise<User>; - -/** - * Asynchronously sets the provided user as {@link Auth.currentUser} on the - * {@link Auth} instance. - * - * @remarks - * A new instance copy of the user provided will be made and set as currentUser. - * - * This will trigger {@link onAuthStateChanged} and {@link onIdTokenChanged} listeners - * like other sign in methods. - * - * The operation fails with an error if the user to be updated belongs to a different Firebase - * project. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * @param user - The new {@link User}. - * - * @public - */ -export declare function updateCurrentUser(auth: Auth, user: User | null): Promise<void>; - -/** - * Updates the user's email address. - * - * @remarks - * An email will be sent to the original email address (if it was set) that allows to revoke the - * email address change, in order to protect them from account hijacking. - * - * This method is not supported on any {@link User} signed in by {@link Auth} instances - * created with a {@link @firebase/app#FirebaseServerApp}. - * - * Important: this is a security sensitive operation that requires the user to have recently signed - * in. If this requirement isn't met, ask the user to authenticate again and then call - * {@link reauthenticateWithCredential}. - * - * @param user - The user. - * @param newEmail - The new email address. - * - * Throws "auth/operation-not-allowed" error when - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection} - * is enabled. - * Deprecated - Use {@link verifyBeforeUpdateEmail} instead. - * - * @public - */ -export declare function updateEmail(user: User, newEmail: string): Promise<void>; - -/** - * Updates the user's password. - * - * @remarks - * Important: this is a security sensitive operation that requires the user to have recently signed - * in. If this requirement isn't met, ask the user to authenticate again and then call - * {@link reauthenticateWithCredential}. - * - * @param user - The user. - * @param newPassword - The new password. - * - * @public - */ -export declare function updatePassword(user: User, newPassword: string): Promise<void>; - -/** - * Updates a user's profile data. - * - * @param user - The user. - * @param profile - The profile's `displayName` and `photoURL` to update. - * - * @public - */ -export declare function updateProfile(user: User, { displayName, photoURL: photoUrl }: { - displayName?: string | null; - photoURL?: string | null; -}): Promise<void>; - -/** - * Sets the current language to the default device/browser preference. - * - * @param auth - The {@link Auth} instance. - * - * @public - */ -export declare function useDeviceLanguage(auth: Auth): void; - -/** - * A user account. - * - * @public - */ -declare interface User extends UserInfo { - /** - * Whether the email has been verified with {@link sendEmailVerification} and - * {@link applyActionCode}. - */ - readonly emailVerified: boolean; - /** - * Whether the user is authenticated using the {@link ProviderId}.ANONYMOUS provider. - */ - readonly isAnonymous: boolean; - /** - * Additional metadata around user creation and sign-in times. - */ - readonly metadata: UserMetadata; - /** - * Additional per provider such as displayName and profile information. - */ - readonly providerData: UserInfo[]; - /** - * Refresh token used to reauthenticate the user. Avoid using this directly and prefer - * {@link User.getIdToken} to refresh the ID token instead. - */ - readonly refreshToken: string; - /** - * The user's tenant ID. - * - * @remarks - * This is a read-only property, which indicates the tenant ID - * used to sign in the user. This is null if the user is signed in from the parent - * project. - * - * @example - * ```javascript - * // Set the tenant ID on Auth instance. - * auth.tenantId = 'TENANT_PROJECT_ID'; - * - * // All future sign-in request now include tenant ID. - * const result = await signInWithEmailAndPassword(auth, email, password); - * // result.user.tenantId should be 'TENANT_PROJECT_ID'. - * ``` - */ - readonly tenantId: string | null; - /** - * Deletes and signs out the user. - * - * @remarks - * Important: this is a security-sensitive operation that requires the user to have recently - * signed in. If this requirement isn't met, ask the user to authenticate again and then call - * one of the reauthentication methods like {@link reauthenticateWithCredential}. - * - * This method is not supported on any {@link User} signed in by {@link Auth} instances - * created with a {@link @firebase/app#FirebaseServerApp}. - */ - delete(): Promise<void>; - /** - * Returns a JSON Web Token (JWT) used to identify the user to a Firebase service. - * - * @remarks - * Returns the current token if it has not expired or if it will not expire in the next five - * minutes. Otherwise, this will refresh the token and return a new one. - * - * @param forceRefresh - Force refresh regardless of token expiration. - */ - getIdToken(forceRefresh?: boolean): Promise<string>; - /** - * Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service. - * - * @remarks - * Returns the current token if it has not expired or if it will not expire in the next five - * minutes. Otherwise, this will refresh the token and return a new one. - * - * @param forceRefresh - Force refresh regardless of token expiration. - */ - getIdTokenResult(forceRefresh?: boolean): Promise<IdTokenResult>; - /** - * Refreshes the user, if signed in. - */ - reload(): Promise<void>; - /** - * Returns a JSON-serializable representation of this object. - * - * @returns A JSON-serializable representation of this object. - */ - toJSON(): object; -} - -/** - * A structure containing a {@link User}, the {@link OperationType}, and the provider ID. - * - * @remarks - * `operationType` could be {@link OperationType}.SIGN_IN for a sign-in operation, - * {@link OperationType}.LINK for a linking operation and {@link OperationType}.REAUTHENTICATE for - * a reauthentication operation. - * - * @public - */ -declare interface UserCredential { - /** - * The user authenticated by this credential. - */ - user: User; - /** - * The provider which was used to authenticate the user. - */ - providerId: string | null; - /** - * The type of operation which was used to authenticate the user (such as sign-in or link). - */ - operationType: (typeof OperationType)[keyof typeof OperationType]; -} - -/** - * @internal - */ -declare interface UserCredentialInternal extends UserCredential, TaggedWithTokenResponse { - user: UserInternal; -} - -/** - * User profile information, visible only to the Firebase project's apps. - * - * @public - */ -declare interface UserInfo { - /** - * The display name of the user. - */ - readonly displayName: string | null; - /** - * The email of the user. - */ - readonly email: string | null; - /** - * The phone number normalized based on the E.164 standard (e.g. +16505550101) for the - * user. - * - * @remarks - * This is null if the user has no phone credential linked to the account. - */ - readonly phoneNumber: string | null; - /** - * The profile photo URL of the user. - */ - readonly photoURL: string | null; - /** - * The provider used to authenticate the user. - */ - readonly providerId: string; - /** - * The user's unique ID, scoped to the project. - */ - readonly uid: string; -} - -/** - * UserInternal and AuthInternal reference each other, so both of them are included in the public typings. - * In order to exclude them, we mark them as internal explicitly. - * - * @internal - */ -declare interface UserInternal extends User { - displayName: string | null; - email: string | null; - phoneNumber: string | null; - photoURL: string | null; - auth: AuthInternal; - providerId: ProviderId.FIREBASE; - refreshToken: string; - emailVerified: boolean; - tenantId: string | null; - providerData: MutableUserInfo[]; - metadata: UserMetadata_2; - stsTokenManager: StsTokenManager; - _redirectEventId?: string; - _updateTokensIfNecessary(response: IdTokenResponse | FinalizeMfaResponse, reload?: boolean): Promise<void>; - _assign(user: UserInternal): void; - _clone(auth: AuthInternal): UserInternal; - _onReload: (cb: NextFn<APIUserInfo>) => void; - _notifyReloadListener: NextFn<APIUserInfo>; - _startProactiveRefresh: () => void; - _stopProactiveRefresh: () => void; - getIdToken(forceRefresh?: boolean): Promise<string>; - getIdTokenResult(forceRefresh?: boolean): Promise<IdTokenResult>; - reload(): Promise<void>; - delete(): Promise<void>; - toJSON(): PersistedBlob; -} - -/** - * Interface representing a user's metadata. - * - * @public - */ -declare interface UserMetadata { - /** Time the user was created. */ - readonly creationTime?: string; - /** Time the user last signed in. */ - readonly lastSignInTime?: string; -} - -declare class UserMetadata_2 implements UserMetadata { - private createdAt?; - private lastLoginAt?; - creationTime?: string; - lastSignInTime?: string; - constructor(createdAt?: (string | number) | undefined, lastLoginAt?: (string | number) | undefined); - private _initializeTime; - _copy(metadata: UserMetadata_2): void; - toJSON(): object; -} - -/** - * Validates the password against the password policy configured for the project or tenant. - * - * @remarks - * If no tenant ID is set on the `Auth` instance, then this method will use the password - * policy configured for the project. Otherwise, this method will use the policy configured - * for the tenant. If a password policy has not been configured, then the default policy - * configured for all projects will be used. - * - * If an auth flow fails because a submitted password does not meet the password policy - * requirements and this method has previously been called, then this method will use the - * most recent policy available when called again. - * - * @example - * ```javascript - * validatePassword(auth, 'some-password'); - * ``` - * - * @param auth The {@link Auth} instance. - * @param password The password to validate. - * - * @public - */ -export declare function validatePassword(auth: Auth, password: string): Promise<PasswordValidationStatus>; - -/** - * Sends a verification email to a new email address. - * - * @remarks - * The user's email will be updated to the new one after being verified. - * - * If you have a custom email action handler, you can complete the verification process by calling - * {@link applyActionCode}. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await verifyBeforeUpdateEmail(user, 'newemail@example.com', actionCodeSettings); - * // Obtain code from the user. - * await applyActionCode(auth, code); - * ``` - * - * @param user - The user. - * @param newEmail - The new email address to be verified before update. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ -export declare function verifyBeforeUpdateEmail(user: User, newEmail: string, actionCodeSettings?: ActionCodeSettings | null): Promise<void>; - -/** - * Checks a password reset code sent to the user by email or other out-of-band mechanism. - * - * @returns the user's email address if valid. - * - * @param auth - The {@link Auth} instance. - * @param code - A verification code sent to the user. - * - * @public - */ -export declare function verifyPasswordResetCode(auth: Auth, code: string): Promise<string>; - -export { } diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.cordova.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.cordova.d.ts deleted file mode 100644 index b2d5130..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.cordova.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * This is the file that people using Cordova will actually import. You - * should only include this file if you have something specific about your - * implementation that mandates having a separate entrypoint. Otherwise you can - * just use index.ts - */ -import { FirebaseApp } from '@firebase/app'; -import { Auth } from './src/model/public_types'; -export * from './index.shared'; -export { indexedDBLocalPersistence } from './src/platform_browser/persistence/indexed_db'; -export { browserLocalPersistence } from './src/platform_browser/persistence/local_storage'; -export { browserSessionPersistence } from './src/platform_browser/persistence/session_storage'; -export { getRedirectResult } from './src/platform_browser/strategies/redirect'; -export { cordovaPopupRedirectResolver } from './src/platform_cordova/popup_redirect/popup_redirect'; -export { signInWithRedirect, reauthenticateWithRedirect, linkWithRedirect } from './src/platform_cordova/strategies/redirect'; -export declare function getAuth(app?: FirebaseApp): Auth; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.d.ts deleted file mode 100644 index 2a03211..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Firebase Authentication - * - * @packageDocumentation - */ -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export * from './src/model/public_types'; -export { FactorId, ProviderId, SignInMethod, OperationType, ActionCodeOperation } from './src/model/enum_maps'; -export * from './src'; -import { browserLocalPersistence } from './src/platform_browser/persistence/local_storage'; -import { browserCookiePersistence } from './src/platform_browser/persistence/cookie_storage'; -import { browserSessionPersistence } from './src/platform_browser/persistence/session_storage'; -import { indexedDBLocalPersistence } from './src/platform_browser/persistence/indexed_db'; -import { PhoneAuthProvider } from './src/platform_browser/providers/phone'; -import { signInWithPhoneNumber, linkWithPhoneNumber, reauthenticateWithPhoneNumber, updatePhoneNumber } from './src/platform_browser/strategies/phone'; -import { signInWithPopup, linkWithPopup, reauthenticateWithPopup } from './src/platform_browser/strategies/popup'; -import { signInWithRedirect, linkWithRedirect, reauthenticateWithRedirect, getRedirectResult } from './src/platform_browser/strategies/redirect'; -import { RecaptchaVerifier } from './src/platform_browser/recaptcha/recaptcha_verifier'; -import { browserPopupRedirectResolver } from './src/platform_browser/popup_redirect'; -import { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions/phone'; -import { TotpMultiFactorGenerator, TotpSecret } from './src/mfa/assertions/totp'; -import { getAuth } from './src/platform_browser'; -export { browserLocalPersistence, browserCookiePersistence, browserSessionPersistence, indexedDBLocalPersistence, PhoneAuthProvider, signInWithPhoneNumber, linkWithPhoneNumber, reauthenticateWithPhoneNumber, updatePhoneNumber, signInWithPopup, linkWithPopup, reauthenticateWithPopup, signInWithRedirect, linkWithRedirect, reauthenticateWithRedirect, getRedirectResult, RecaptchaVerifier, browserPopupRedirectResolver, PhoneMultiFactorGenerator, TotpMultiFactorGenerator, TotpSecret, getAuth }; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.doc.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.doc.d.ts deleted file mode 100644 index 893ac2c..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.doc.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Firebase Authentication - * - * @packageDocumentation - */ -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export * from './index'; -export { cordovaPopupRedirectResolver } from './index.cordova'; -export { getReactNativePersistence } from './index.rn'; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.js b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.js deleted file mode 100644 index 5383e92..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.js +++ /dev/null @@ -1,49 +0,0 @@ -import { r as registerAuth, i as initializeAuth, a as indexedDBLocalPersistence, c as connectAuthEmulator } from './register-7993b7af.js'; -export { Y as ActionCodeURL, m as AuthCredential, A as AuthErrorCodes, E as EmailAuthCredential, q as EmailAuthProvider, F as FacebookAuthProvider, t as GithubAuthProvider, G as GoogleAuthProvider, O as OAuthCredential, w as OAuthProvider, P as PhoneAuthCredential, S as SAMLAuthProvider, T as TotpMultiFactorGenerator, b as TotpSecret, x as TwitterAuthProvider, J as applyActionCode, e as beforeAuthStateChanged, K as checkActionCode, I as confirmPasswordReset, c as connectAuthEmulator, M as createUserWithEmailAndPassword, l as debugErrorMap, k as deleteUser, V as fetchSignInMethodsForEmail, a4 as getAdditionalUserInfo, a1 as getIdToken, a2 as getIdTokenResult, a6 as getMultiFactorResolver, n as inMemoryPersistence, a as indexedDBLocalPersistence, i as initializeAuth, d as initializeRecaptchaConfig, R as isSignInWithEmailLink, B as linkWithCredential, a7 as multiFactor, f as onAuthStateChanged, o as onIdTokenChanged, Z as parseActionCodeURL, p as prodErrorMap, C as reauthenticateWithCredential, a5 as reload, j as revokeAccessToken, W as sendEmailVerification, H as sendPasswordResetEmail, Q as sendSignInLinkToEmail, s as setPersistence, y as signInAnonymously, z as signInWithCredential, D as signInWithCustomToken, N as signInWithEmailAndPassword, U as signInWithEmailLink, h as signOut, a3 as unlink, g as updateCurrentUser, $ as updateEmail, a0 as updatePassword, _ as updateProfile, u as useDeviceLanguage, v as validatePassword, X as verifyBeforeUpdateEmail, L as verifyPasswordResetCode } from './register-7993b7af.js'; -import { _getProvider, getApp } from '@firebase/app'; -import { getDefaultEmulatorHost } from '@firebase/util'; -import '@firebase/component'; -import '@firebase/logger'; - -/** - * @license - * Copyright 2023 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Returns the Auth instance associated with the provided {@link @firebase/app#FirebaseApp}. - * If no instance exists, initializes an Auth instance with platform-specific default dependencies. - * - * @param app - The Firebase App. - * - * @public - */ -function getAuth(app = getApp()) { - const provider = _getProvider(app, 'auth'); - if (provider.isInitialized()) { - return provider.getImmediate(); - } - const auth = initializeAuth(app, { - persistence: [indexedDBLocalPersistence] - }); - const authEmulatorHost = getDefaultEmulatorHost('auth'); - if (authEmulatorHost) { - connectAuthEmulator(auth, `http://${authEmulatorHost}`); - } - return auth; -} -registerAuth("WebExtension" /* ClientPlatform.WEB_EXTENSION */); - -export { getAuth }; -//# sourceMappingURL=index.js.map diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.js.map b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.js.map deleted file mode 100644 index fc44fac..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sources":["../../index.web-extension.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Core functionality shared by all clients\nexport * from './src';\n\nimport { ClientPlatform } from './src/core/util/version';\n\nimport { indexedDBLocalPersistence } from './src/platform_browser/persistence/indexed_db';\n\nimport {\n TotpMultiFactorGenerator,\n TotpSecret\n} from './src/mfa/assertions/totp';\nimport { FirebaseApp, getApp, _getProvider } from '@firebase/app';\nimport { Auth, connectAuthEmulator, initializeAuth } from './index.shared';\nimport { getDefaultEmulatorHost } from '@firebase/util';\nimport { registerAuth } from './src/core/auth/register';\n\n/**\n * Returns the Auth instance associated with the provided {@link @firebase/app#FirebaseApp}.\n * If no instance exists, initializes an Auth instance with platform-specific default dependencies.\n *\n * @param app - The Firebase App.\n *\n * @public\n */\nfunction getAuth(app: FirebaseApp = getApp()): Auth {\n const provider = _getProvider(app, 'auth');\n\n if (provider.isInitialized()) {\n return provider.getImmediate();\n }\n\n const auth = initializeAuth(app, {\n persistence: [indexedDBLocalPersistence]\n });\n\n const authEmulatorHost = getDefaultEmulatorHost('auth');\n if (authEmulatorHost) {\n connectAuthEmulator(auth, `http://${authEmulatorHost}`);\n }\n\n return auth;\n}\n\nregisterAuth(ClientPlatform.WEB_EXTENSION);\n\nexport {\n indexedDBLocalPersistence,\n TotpMultiFactorGenerator,\n TotpSecret,\n getAuth\n};\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;AAkBH;;;;;;;AAOG;AACH,SAAS,OAAO,CAAC,GAAmB,GAAA,MAAM,EAAE,EAAA;IAC1C,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AAE3C,IAAA,IAAI,QAAQ,CAAC,aAAa,EAAE,EAAE;AAC5B,QAAA,OAAO,QAAQ,CAAC,YAAY,EAAE,CAAC;KAChC;AAED,IAAA,MAAM,IAAI,GAAG,cAAc,CAAC,GAAG,EAAE;QAC/B,WAAW,EAAE,CAAC,yBAAyB,CAAC;AACzC,KAAA,CAAC,CAAC;AAEH,IAAA,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IACxD,IAAI,gBAAgB,EAAE;AACpB,QAAA,mBAAmB,CAAC,IAAI,EAAE,UAAU,gBAAgB,CAAA,CAAE,CAAC,CAAC;KACzD;AAED,IAAA,OAAO,IAAI,CAAC;AACd,CAAC;AAED,YAAY,mDAA8B;;;;"}
\ No newline at end of file diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.node.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.node.d.ts deleted file mode 100644 index 71e82e0..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.node.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export * from './index'; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.rn.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.rn.d.ts deleted file mode 100644 index a970ebf..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.rn.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * This is the file that people using React Native will actually import. You - * should only include this file if you have something specific about your - * implementation that mandates having a separate entrypoint. Otherwise you can - * just use index.ts - */ -import { FirebaseApp } from '@firebase/app'; -import { Auth, Dependencies } from './src/model/public_types'; -export * from './index.shared'; -export { PhoneAuthProvider } from './src/platform_browser/providers/phone'; -export { signInWithPhoneNumber, linkWithPhoneNumber, reauthenticateWithPhoneNumber, updatePhoneNumber } from './src/platform_browser/strategies/phone'; -export { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions/phone'; -export { TotpMultiFactorGenerator, TotpSecret } from './src/mfa/assertions/totp'; -export { getReactNativePersistence } from './src/platform_react_native/persistence/react_native'; -export declare function getAuth(app?: FirebaseApp): Auth; -/** - * Wrapper around base `initializeAuth()` for RN users only, which - * shows the warning message if no persistence is provided. - * Double-checked potential collision with `export * from './index.shared'` - * as `./index.shared` also exports `initializeAuth()`, and the final - * bundle does correctly export only this `initializeAuth()` function - * and not the one from index.shared. - */ -export declare function initializeAuth(app: FirebaseApp, deps?: Dependencies): Auth; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.shared.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.shared.d.ts deleted file mode 100644 index 6a0f743..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.shared.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export * from './src/model/public_types'; -export { FactorId, ProviderId, SignInMethod, OperationType, ActionCodeOperation } from './src/model/enum_maps'; -export * from './src'; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.web-extension.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.web-extension.d.ts deleted file mode 100644 index baf92ed..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.web-extension.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @license - * Copyright 2023 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export * from './src'; -import { indexedDBLocalPersistence } from './src/platform_browser/persistence/indexed_db'; -import { TotpMultiFactorGenerator, TotpSecret } from './src/mfa/assertions/totp'; -import { FirebaseApp } from '@firebase/app'; -import { Auth } from './index.shared'; -/** - * Returns the Auth instance associated with the provided {@link @firebase/app#FirebaseApp}. - * If no instance exists, initializes an Auth instance with platform-specific default dependencies. - * - * @param app - The Firebase App. - * - * @public - */ -declare function getAuth(app?: FirebaseApp): Auth; -export { indexedDBLocalPersistence, TotpMultiFactorGenerator, TotpSecret, getAuth }; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.webworker.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.webworker.d.ts deleted file mode 100644 index 278d8e5..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/index.webworker.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { FirebaseApp } from '@firebase/app'; -import { Auth } from './src/model/public_types'; -export * from './index.shared'; -export { indexedDBLocalPersistence } from './src/platform_browser/persistence/indexed_db'; -export declare function getAuth(app?: FirebaseApp): Auth; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/internal.js b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/internal.js deleted file mode 100644 index af53e4b..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/internal.js +++ /dev/null @@ -1,3466 +0,0 @@ -import { a8 as STORAGE_AVAILABLE_KEY, a9 as _isMobileBrowser, aa as _isIE10, ab as Delay, ac as _window, ad as _assert, ae as isV2, af as _createError, ag as _recaptchaV2ScriptUrl, ah as _loadJS, ai as MockReCaptcha, aj as _generateCallbackName, ak as _castAuth, al as _isHttpOrHttps, am as _isWorker, an as getRecaptchaParams, ao as _serverAppCurrentUserOperationNotSupportedError, z as signInWithCredential, ap as _assertLinkedStatus, B as linkWithCredential, C as reauthenticateWithCredential, aq as _initializeRecaptchaConfig, ar as FAKE_TOKEN, as as startEnrollPhoneMfa, at as handleRecaptchaFlow, au as startSignInPhoneMfa, av as sendPhoneVerificationCode, aw as _link$1, P as PhoneAuthCredential, ax as _getInstance, ay as _signInWithCredential, az as _reauthenticate, m as AuthCredential, aA as signInWithIdp, aB as _fail, aC as debugAssert, aD as _assertInstanceOf, aE as _generateEventId, aF as FederatedAuthProvider, aG as _persistenceKeyName, aH as _performApiRequest, aI as _getCurrentUrl, aJ as _gapiScriptUrl, aK as _emulatorUrl, aL as _isChromeIOS, aM as _isFirefox, aN as _isIOSStandalone, aO as BaseOAuthProvider, aP as _setWindowLocation, aQ as _isSafari, aR as _isIOS, aS as MultiFactorAssertionImpl, aT as finalizeEnrollPhoneMfa, aU as finalizeSignInPhoneMfa, r as registerAuth, i as initializeAuth, a as indexedDBLocalPersistence, e as beforeAuthStateChanged, o as onIdTokenChanged, c as connectAuthEmulator, aV as _setExternalJSProvider, aW as _isAndroid, aX as _isIOS7Or8 } from './register-7993b7af.js'; -export { Y as ActionCodeURL, m as AuthCredential, A as AuthErrorCodes, aZ as AuthImpl, E as EmailAuthCredential, q as EmailAuthProvider, F as FacebookAuthProvider, a$ as FetchProvider, t as GithubAuthProvider, G as GoogleAuthProvider, O as OAuthCredential, w as OAuthProvider, P as PhoneAuthCredential, b0 as SAMLAuthCredential, S as SAMLAuthProvider, T as TotpMultiFactorGenerator, b as TotpSecret, x as TwitterAuthProvider, aY as UserImpl, ad as _assert, ak as _castAuth, aB as _fail, aE as _generateEventId, a_ as _getClientVersion, ax as _getInstance, aG as _persistenceKeyName, J as applyActionCode, e as beforeAuthStateChanged, K as checkActionCode, I as confirmPasswordReset, c as connectAuthEmulator, M as createUserWithEmailAndPassword, l as debugErrorMap, k as deleteUser, V as fetchSignInMethodsForEmail, a4 as getAdditionalUserInfo, a1 as getIdToken, a2 as getIdTokenResult, a6 as getMultiFactorResolver, n as inMemoryPersistence, a as indexedDBLocalPersistence, i as initializeAuth, d as initializeRecaptchaConfig, R as isSignInWithEmailLink, B as linkWithCredential, a7 as multiFactor, f as onAuthStateChanged, o as onIdTokenChanged, Z as parseActionCodeURL, p as prodErrorMap, C as reauthenticateWithCredential, a5 as reload, j as revokeAccessToken, W as sendEmailVerification, H as sendPasswordResetEmail, Q as sendSignInLinkToEmail, s as setPersistence, y as signInAnonymously, z as signInWithCredential, D as signInWithCustomToken, N as signInWithEmailAndPassword, U as signInWithEmailLink, h as signOut, a3 as unlink, g as updateCurrentUser, $ as updateEmail, a0 as updatePassword, _ as updateProfile, u as useDeviceLanguage, v as validatePassword, X as verifyBeforeUpdateEmail, L as verifyPasswordResetCode } from './register-7993b7af.js'; -import { querystring, getModularInstance, getUA, isEmpty, getExperimentalSetting, getDefaultEmulatorHost, querystringDecode } from '@firebase/util'; -import { _isFirebaseServerApp, SDK_VERSION, _getProvider, getApp } from '@firebase/app'; -import '@firebase/component'; -import '@firebase/logger'; - -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * An enum of factors that may be used for multifactor authentication. - * - * @public - */ -const FactorId = { - /** Phone as second factor */ - PHONE: 'phone', - TOTP: 'totp' -}; -/** - * Enumeration of supported providers. - * - * @public - */ -const ProviderId = { - /** Facebook provider ID */ - FACEBOOK: 'facebook.com', - /** GitHub provider ID */ - GITHUB: 'github.com', - /** Google provider ID */ - GOOGLE: 'google.com', - /** Password provider */ - PASSWORD: 'password', - /** Phone provider */ - PHONE: 'phone', - /** Twitter provider ID */ - TWITTER: 'twitter.com' -}; -/** - * Enumeration of supported sign-in methods. - * - * @public - */ -const SignInMethod = { - /** Email link sign in method */ - EMAIL_LINK: 'emailLink', - /** Email/password sign in method */ - EMAIL_PASSWORD: 'password', - /** Facebook sign in method */ - FACEBOOK: 'facebook.com', - /** GitHub sign in method */ - GITHUB: 'github.com', - /** Google sign in method */ - GOOGLE: 'google.com', - /** Phone sign in method */ - PHONE: 'phone', - /** Twitter sign in method */ - TWITTER: 'twitter.com' -}; -/** - * Enumeration of supported operation types. - * - * @public - */ -const OperationType = { - /** Operation involving linking an additional provider to an already signed-in user. */ - LINK: 'link', - /** Operation involving using a provider to reauthenticate an already signed-in user. */ - REAUTHENTICATE: 'reauthenticate', - /** Operation involving signing in a user. */ - SIGN_IN: 'signIn' -}; -/** - * An enumeration of the possible email action types. - * - * @public - */ -const ActionCodeOperation = { - /** The email link sign-in action. */ - EMAIL_SIGNIN: 'EMAIL_SIGNIN', - /** The password reset action. */ - PASSWORD_RESET: 'PASSWORD_RESET', - /** The email revocation action. */ - RECOVER_EMAIL: 'RECOVER_EMAIL', - /** The revert second factor addition email action. */ - REVERT_SECOND_FACTOR_ADDITION: 'REVERT_SECOND_FACTOR_ADDITION', - /** The revert second factor addition email action. */ - VERIFY_AND_CHANGE_EMAIL: 'VERIFY_AND_CHANGE_EMAIL', - /** The email verification action. */ - VERIFY_EMAIL: 'VERIFY_EMAIL' -}; - -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// There are two different browser persistence types: local and session. -// Both have the same implementation but use a different underlying storage -// object. -class BrowserPersistenceClass { - constructor(storageRetriever, type) { - this.storageRetriever = storageRetriever; - this.type = type; - } - _isAvailable() { - try { - if (!this.storage) { - return Promise.resolve(false); - } - this.storage.setItem(STORAGE_AVAILABLE_KEY, '1'); - this.storage.removeItem(STORAGE_AVAILABLE_KEY); - return Promise.resolve(true); - } - catch { - return Promise.resolve(false); - } - } - _set(key, value) { - this.storage.setItem(key, JSON.stringify(value)); - return Promise.resolve(); - } - _get(key) { - const json = this.storage.getItem(key); - return Promise.resolve(json ? JSON.parse(json) : null); - } - _remove(key) { - this.storage.removeItem(key); - return Promise.resolve(); - } - get storage() { - return this.storageRetriever(); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// The polling period in case events are not supported -const _POLLING_INTERVAL_MS = 1000; -// The IE 10 localStorage cross tab synchronization delay in milliseconds -const IE10_LOCAL_STORAGE_SYNC_DELAY = 10; -class BrowserLocalPersistence extends BrowserPersistenceClass { - constructor() { - super(() => window.localStorage, "LOCAL" /* PersistenceType.LOCAL */); - this.boundEventHandler = (event, poll) => this.onStorageEvent(event, poll); - this.listeners = {}; - this.localCache = {}; - // setTimeout return value is platform specific - // eslint-disable-next-line @typescript-eslint/no-explicit-any - this.pollTimer = null; - // Whether to use polling instead of depending on window events - this.fallbackToPolling = _isMobileBrowser(); - this._shouldAllowMigration = true; - } - forAllChangedKeys(cb) { - // Check all keys with listeners on them. - for (const key of Object.keys(this.listeners)) { - // Get value from localStorage. - const newValue = this.storage.getItem(key); - const oldValue = this.localCache[key]; - // If local map value does not match, trigger listener with storage event. - // Differentiate this simulated event from the real storage event. - if (newValue !== oldValue) { - cb(key, oldValue, newValue); - } - } - } - onStorageEvent(event, poll = false) { - // Key would be null in some situations, like when localStorage is cleared - if (!event.key) { - this.forAllChangedKeys((key, _oldValue, newValue) => { - this.notifyListeners(key, newValue); - }); - return; - } - const key = event.key; - // Check the mechanism how this event was detected. - // The first event will dictate the mechanism to be used. - if (poll) { - // Environment detects storage changes via polling. - // Remove storage event listener to prevent possible event duplication. - this.detachListener(); - } - else { - // Environment detects storage changes via storage event listener. - // Remove polling listener to prevent possible event duplication. - this.stopPolling(); - } - const triggerListeners = () => { - // Keep local map up to date in case storage event is triggered before - // poll. - const storedValue = this.storage.getItem(key); - if (!poll && this.localCache[key] === storedValue) { - // Real storage event which has already been detected, do nothing. - // This seems to trigger in some IE browsers for some reason. - return; - } - this.notifyListeners(key, storedValue); - }; - const storedValue = this.storage.getItem(key); - if (_isIE10() && - storedValue !== event.newValue && - event.newValue !== event.oldValue) { - // IE 10 has this weird bug where a storage event would trigger with the - // correct key, oldValue and newValue but localStorage.getItem(key) does - // not yield the updated value until a few milliseconds. This ensures - // this recovers from that situation. - setTimeout(triggerListeners, IE10_LOCAL_STORAGE_SYNC_DELAY); - } - else { - triggerListeners(); - } - } - notifyListeners(key, value) { - this.localCache[key] = value; - const listeners = this.listeners[key]; - if (listeners) { - for (const listener of Array.from(listeners)) { - listener(value ? JSON.parse(value) : value); - } - } - } - startPolling() { - this.stopPolling(); - this.pollTimer = setInterval(() => { - this.forAllChangedKeys((key, oldValue, newValue) => { - this.onStorageEvent(new StorageEvent('storage', { - key, - oldValue, - newValue - }), - /* poll */ true); - }); - }, _POLLING_INTERVAL_MS); - } - stopPolling() { - if (this.pollTimer) { - clearInterval(this.pollTimer); - this.pollTimer = null; - } - } - attachListener() { - window.addEventListener('storage', this.boundEventHandler); - } - detachListener() { - window.removeEventListener('storage', this.boundEventHandler); - } - _addListener(key, listener) { - if (Object.keys(this.listeners).length === 0) { - // Whether browser can detect storage event when it had already been pushed to the background. - // This may happen in some mobile browsers. A localStorage change in the foreground window - // will not be detected in the background window via the storage event. - // This was detected in iOS 7.x mobile browsers - if (this.fallbackToPolling) { - this.startPolling(); - } - else { - this.attachListener(); - } - } - if (!this.listeners[key]) { - this.listeners[key] = new Set(); - // Populate the cache to avoid spuriously triggering on first poll. - this.localCache[key] = this.storage.getItem(key); - } - this.listeners[key].add(listener); - } - _removeListener(key, listener) { - if (this.listeners[key]) { - this.listeners[key].delete(listener); - if (this.listeners[key].size === 0) { - delete this.listeners[key]; - } - } - if (Object.keys(this.listeners).length === 0) { - this.detachListener(); - this.stopPolling(); - } - } - // Update local cache on base operations: - async _set(key, value) { - await super._set(key, value); - this.localCache[key] = JSON.stringify(value); - } - async _get(key) { - const value = await super._get(key); - this.localCache[key] = JSON.stringify(value); - return value; - } - async _remove(key) { - await super._remove(key); - delete this.localCache[key]; - } -} -BrowserLocalPersistence.type = 'LOCAL'; -/** - * An implementation of {@link Persistence} of type `LOCAL` using `localStorage` - * for the underlying storage. - * - * @public - */ -const browserLocalPersistence = BrowserLocalPersistence; - -/** - * @license - * Copyright 2025 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const POLLING_INTERVAL_MS = 1000; -// Pull a cookie value from document.cookie -function getDocumentCookie(name) { - const escapedName = name.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&'); - const matcher = RegExp(`${escapedName}=([^;]+)`); - return document.cookie.match(matcher)?.[1] ?? null; -} -// Produce a sanitized cookie name from the persistence key -function getCookieName(key) { - // __HOST- doesn't work in localhost https://issues.chromium.org/issues/40196122 but it has - // desirable security properties, so lets use a different cookie name while in dev-mode. - // Already checked isSecureContext in _isAvailable, so if it's http we're hitting local. - const isDevMode = window.location.protocol === 'http:'; - return `${isDevMode ? '__dev_' : '__HOST-'}FIREBASE_${key.split(':')[3]}`; -} -class CookiePersistence { - constructor() { - this.type = "COOKIE" /* PersistenceType.COOKIE */; - this.listenerUnsubscribes = new Map(); - } - // used to get the URL to the backend to proxy to - _getFinalTarget(originalUrl) { - if (typeof window === undefined) { - return originalUrl; - } - const url = new URL(`${window.location.origin}/__cookies__`); - url.searchParams.set('finalTarget', originalUrl); - return url; - } - // To be a usable persistence method in a chain browserCookiePersistence ensures that - // prerequisites have been met, namely that we're in a secureContext, navigator and document are - // available and cookies are enabled. Not all UAs support these method, so fallback accordingly. - async _isAvailable() { - if (typeof isSecureContext === 'boolean' && !isSecureContext) { - return false; - } - if (typeof navigator === 'undefined' || typeof document === 'undefined') { - return false; - } - return navigator.cookieEnabled ?? true; - } - // Set should be a noop as we expect middleware to handle this - async _set(_key, _value) { - return; - } - // Attempt to get the cookie from cookieStore, fallback to document.cookie - async _get(key) { - if (!this._isAvailable()) { - return null; - } - const name = getCookieName(key); - if (window.cookieStore) { - const cookie = await window.cookieStore.get(name); - return cookie?.value; - } - return getDocumentCookie(name); - } - // Log out by overriding the idToken with a sentinel value of "" - async _remove(key) { - if (!this._isAvailable()) { - return; - } - // To make sure we don't hit signout over and over again, only do this operation if we need to - // with the logout sentinel value of "" this can cause race conditions. Unnecessary set-cookie - // headers will reduce CDN hit rates too. - const existingValue = await this._get(key); - if (!existingValue) { - return; - } - const name = getCookieName(key); - document.cookie = `${name}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;Priority=High`; - await fetch(`/__cookies__`, { method: 'DELETE' }).catch(() => undefined); - } - // Listen for cookie changes, both cookieStore and fallback to polling document.cookie - _addListener(key, listener) { - if (!this._isAvailable()) { - return; - } - const name = getCookieName(key); - if (window.cookieStore) { - const cb = ((event) => { - const changedCookie = event.changed.find(change => change.name === name); - if (changedCookie) { - listener(changedCookie.value); - } - const deletedCookie = event.deleted.find(change => change.name === name); - if (deletedCookie) { - listener(null); - } - }); - const unsubscribe = () => window.cookieStore.removeEventListener('change', cb); - this.listenerUnsubscribes.set(listener, unsubscribe); - return window.cookieStore.addEventListener('change', cb); - } - let lastValue = getDocumentCookie(name); - const interval = setInterval(() => { - const currentValue = getDocumentCookie(name); - if (currentValue !== lastValue) { - listener(currentValue); - lastValue = currentValue; - } - }, POLLING_INTERVAL_MS); - const unsubscribe = () => clearInterval(interval); - this.listenerUnsubscribes.set(listener, unsubscribe); - } - _removeListener(_key, listener) { - const unsubscribe = this.listenerUnsubscribes.get(listener); - if (!unsubscribe) { - return; - } - unsubscribe(); - this.listenerUnsubscribes.delete(listener); - } -} -CookiePersistence.type = 'COOKIE'; -/** - * An implementation of {@link Persistence} of type `COOKIE`, for use on the client side in - * applications leveraging hybrid rendering and middleware. - * - * @remarks This persistence method requires companion middleware to function, such as that provided - * by {@link https://firebaseopensource.com/projects/firebaseextended/reactfire/ | ReactFire} for - * NextJS. - * @beta - */ -const browserCookiePersistence = CookiePersistence; - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -class BrowserSessionPersistence extends BrowserPersistenceClass { - constructor() { - super(() => window.sessionStorage, "SESSION" /* PersistenceType.SESSION */); - } - _addListener(_key, _listener) { - // Listeners are not supported for session storage since it cannot be shared across windows - return; - } - _removeListener(_key, _listener) { - // Listeners are not supported for session storage since it cannot be shared across windows - return; - } -} -BrowserSessionPersistence.type = 'SESSION'; -/** - * An implementation of {@link Persistence} of `SESSION` using `sessionStorage` - * for the underlying storage. - * - * @public - */ -const browserSessionPersistence = BrowserSessionPersistence; - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// ReCaptcha will load using the same callback, so the callback function needs -// to be kept around -const _JSLOAD_CALLBACK = _generateCallbackName('rcb'); -const NETWORK_TIMEOUT_DELAY = new Delay(30000, 60000); -/** - * Loader for the GReCaptcha library. There should only ever be one of this. - */ -class ReCaptchaLoaderImpl { - constructor() { - this.hostLanguage = ''; - this.counter = 0; - /** - * Check for `render()` method. `window.grecaptcha` will exist if the Enterprise - * version of the ReCAPTCHA script was loaded by someone else (e.g. App Check) but - * `window.grecaptcha.render()` will not. Another load will add it. - */ - this.librarySeparatelyLoaded = !!_window().grecaptcha?.render; - } - load(auth, hl = '') { - _assert(isHostLanguageValid(hl), auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - if (this.shouldResolveImmediately(hl) && isV2(_window().grecaptcha)) { - return Promise.resolve(_window().grecaptcha); - } - return new Promise((resolve, reject) => { - const networkTimeout = _window().setTimeout(() => { - reject(_createError(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */)); - }, NETWORK_TIMEOUT_DELAY.get()); - _window()[_JSLOAD_CALLBACK] = () => { - _window().clearTimeout(networkTimeout); - delete _window()[_JSLOAD_CALLBACK]; - const recaptcha = _window().grecaptcha; - if (!recaptcha || !isV2(recaptcha)) { - reject(_createError(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */)); - return; - } - // Wrap the recaptcha render function so that we know if the developer has - // called it separately - const render = recaptcha.render; - recaptcha.render = (container, params) => { - const widgetId = render(container, params); - this.counter++; - return widgetId; - }; - this.hostLanguage = hl; - resolve(recaptcha); - }; - const url = `${_recaptchaV2ScriptUrl()}?${querystring({ - onload: _JSLOAD_CALLBACK, - render: 'explicit', - hl - })}`; - _loadJS(url).catch(() => { - clearTimeout(networkTimeout); - reject(_createError(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */)); - }); - }); - } - clearedOneInstance() { - this.counter--; - } - shouldResolveImmediately(hl) { - // We can resolve immediately if: - // • grecaptcha is already defined AND ( - // 1. the requested language codes are the same OR - // 2. there exists already a ReCaptcha on the page - // 3. the library was already loaded by the app - // In cases (2) and (3), we _can't_ reload as it would break the recaptchas - // that are already in the page - return (!!_window().grecaptcha?.render && - (hl === this.hostLanguage || - this.counter > 0 || - this.librarySeparatelyLoaded)); - } -} -function isHostLanguageValid(hl) { - return hl.length <= 6 && /^\s*[a-zA-Z0-9\-]*\s*$/.test(hl); -} -class MockReCaptchaLoaderImpl { - async load(auth) { - return new MockReCaptcha(auth); - } - clearedOneInstance() { } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const RECAPTCHA_VERIFIER_TYPE = 'recaptcha'; -const DEFAULT_PARAMS = { - theme: 'light', - type: 'image' -}; -/** - * An {@link https://www.google.com/recaptcha/ | reCAPTCHA}-based application verifier. - * - * @remarks - * `RecaptchaVerifier` does not work in a Node.js environment. - * - * @public - */ -class RecaptchaVerifier { - /** - * @param authExtern - The corresponding Firebase {@link Auth} instance. - * - * @param containerOrId - The reCAPTCHA container parameter. - * - * @remarks - * This has different meaning depending on whether the reCAPTCHA is hidden or visible. For a - * visible reCAPTCHA the container must be empty. If a string is used, it has to correspond to - * an element ID. The corresponding element must also must be in the DOM at the time of - * initialization. - * - * @param parameters - The optional reCAPTCHA parameters. - * - * @remarks - * Check the reCAPTCHA docs for a comprehensive list. All parameters are accepted except for - * the sitekey. Firebase Auth backend provisions a reCAPTCHA for each project and will - * configure this upon rendering. For an invisible reCAPTCHA, a size key must have the value - * 'invisible'. - */ - constructor(authExtern, containerOrId, parameters = { - ...DEFAULT_PARAMS - }) { - this.parameters = parameters; - /** - * The application verifier type. - * - * @remarks - * For a reCAPTCHA verifier, this is 'recaptcha'. - */ - this.type = RECAPTCHA_VERIFIER_TYPE; - this.destroyed = false; - this.widgetId = null; - this.tokenChangeListeners = new Set(); - this.renderPromise = null; - this.recaptcha = null; - this.auth = _castAuth(authExtern); - this.isInvisible = this.parameters.size === 'invisible'; - _assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */); - const container = typeof containerOrId === 'string' - ? document.getElementById(containerOrId) - : containerOrId; - _assert(container, this.auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - this.container = container; - this.parameters.callback = this.makeTokenCallback(this.parameters.callback); - this._recaptchaLoader = this.auth.settings.appVerificationDisabledForTesting - ? new MockReCaptchaLoaderImpl() - : new ReCaptchaLoaderImpl(); - this.validateStartingState(); - // TODO: Figure out if sdk version is needed - } - /** - * Waits for the user to solve the reCAPTCHA and resolves with the reCAPTCHA token. - * - * @returns A Promise for the reCAPTCHA token. - */ - async verify() { - this.assertNotDestroyed(); - const id = await this.render(); - const recaptcha = this.getAssertedRecaptcha(); - const response = recaptcha.getResponse(id); - if (response) { - return response; - } - return new Promise(resolve => { - const tokenChange = (token) => { - if (!token) { - return; // Ignore token expirations. - } - this.tokenChangeListeners.delete(tokenChange); - resolve(token); - }; - this.tokenChangeListeners.add(tokenChange); - if (this.isInvisible) { - recaptcha.execute(id); - } - }); - } - /** - * Renders the reCAPTCHA widget on the page. - * - * @returns A Promise that resolves with the reCAPTCHA widget ID. - */ - render() { - try { - this.assertNotDestroyed(); - } - catch (e) { - // This method returns a promise. Since it's not async (we want to return the - // _same_ promise if rendering is still occurring), the API surface should - // reject with the error rather than just throw - return Promise.reject(e); - } - if (this.renderPromise) { - return this.renderPromise; - } - this.renderPromise = this.makeRenderPromise().catch(e => { - this.renderPromise = null; - throw e; - }); - return this.renderPromise; - } - /** @internal */ - _reset() { - this.assertNotDestroyed(); - if (this.widgetId !== null) { - this.getAssertedRecaptcha().reset(this.widgetId); - } - } - /** - * Clears the reCAPTCHA widget from the page and destroys the instance. - */ - clear() { - this.assertNotDestroyed(); - this.destroyed = true; - this._recaptchaLoader.clearedOneInstance(); - if (!this.isInvisible) { - this.container.childNodes.forEach(node => { - this.container.removeChild(node); - }); - } - } - validateStartingState() { - _assert(!this.parameters.sitekey, this.auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - _assert(this.isInvisible || !this.container.hasChildNodes(), this.auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - _assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */); - } - makeTokenCallback(existing) { - return token => { - this.tokenChangeListeners.forEach(listener => listener(token)); - if (typeof existing === 'function') { - existing(token); - } - else if (typeof existing === 'string') { - const globalFunc = _window()[existing]; - if (typeof globalFunc === 'function') { - globalFunc(token); - } - } - }; - } - assertNotDestroyed() { - _assert(!this.destroyed, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - } - async makeRenderPromise() { - await this.init(); - if (!this.widgetId) { - let container = this.container; - if (!this.isInvisible) { - const guaranteedEmpty = document.createElement('div'); - container.appendChild(guaranteedEmpty); - container = guaranteedEmpty; - } - this.widgetId = this.getAssertedRecaptcha().render(container, this.parameters); - } - return this.widgetId; - } - async init() { - _assert(_isHttpOrHttps() && !_isWorker(), this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - await domReady(); - this.recaptcha = await this._recaptchaLoader.load(this.auth, this.auth.languageCode || undefined); - const siteKey = await getRecaptchaParams(this.auth); - _assert(siteKey, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - this.parameters.sitekey = siteKey; - } - getAssertedRecaptcha() { - _assert(this.recaptcha, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - return this.recaptcha; - } -} -function domReady() { - let resolver = null; - return new Promise(resolve => { - if (document.readyState === 'complete') { - resolve(); - return; - } - // Document not ready, wait for load before resolving. - // Save resolver, so we can remove listener in case it was externally - // cancelled. - resolver = () => resolve(); - window.addEventListener('load', resolver); - }).catch(e => { - if (resolver) { - window.removeEventListener('load', resolver); - } - throw e; - }); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -class ConfirmationResultImpl { - constructor(verificationId, onConfirmation) { - this.verificationId = verificationId; - this.onConfirmation = onConfirmation; - } - confirm(verificationCode) { - const authCredential = PhoneAuthCredential._fromVerification(this.verificationId, verificationCode); - return this.onConfirmation(authCredential); - } -} -/** - * Asynchronously signs in using a phone number. - * - * @remarks - * This method sends a code via SMS to the given - * phone number, and returns a {@link ConfirmationResult}. After the user - * provides the code sent to their phone, call {@link ConfirmationResult.confirm} - * with the code to sign the user in. - * - * For abuse prevention, this method requires a {@link ApplicationVerifier}. - * This SDK includes an implementation based on reCAPTCHA v2, {@link RecaptchaVerifier}. - * This function can work on other platforms that do not support the - * {@link RecaptchaVerifier} (like React Native), but you need to use a - * third-party {@link ApplicationVerifier} implementation. - * - * If you've enabled project-level reCAPTCHA Enterprise bot protection in - * Enforce mode, you can omit the {@link ApplicationVerifier}. - * - * This method does not work in a Node.js environment or with {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * // 'recaptcha-container' is the ID of an element in the DOM. - * const applicationVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container'); - * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier); - * // Obtain a verificationCode from the user. - * const credential = await confirmationResult.confirm(verificationCode); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101). - * @param appVerifier - The {@link ApplicationVerifier}. - * - * @public - */ -async function signInWithPhoneNumber(auth, phoneNumber, appVerifier) { - if (_isFirebaseServerApp(auth.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth)); - } - const authInternal = _castAuth(auth); - const verificationId = await _verifyPhoneNumber(authInternal, phoneNumber, getModularInstance(appVerifier)); - return new ConfirmationResultImpl(verificationId, cred => signInWithCredential(authInternal, cred)); -} -/** - * Links the user account with the given phone number. - * - * @remarks - * This method does not work in a Node.js environment. - * - * @param user - The user. - * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101). - * @param appVerifier - The {@link ApplicationVerifier}. - * - * @public - */ -async function linkWithPhoneNumber(user, phoneNumber, appVerifier) { - const userInternal = getModularInstance(user); - await _assertLinkedStatus(false, userInternal, "phone" /* ProviderId.PHONE */); - const verificationId = await _verifyPhoneNumber(userInternal.auth, phoneNumber, getModularInstance(appVerifier)); - return new ConfirmationResultImpl(verificationId, cred => linkWithCredential(userInternal, cred)); -} -/** - * Re-authenticates a user using a fresh phone credential. - * - * @remarks - * Use before operations such as {@link updatePassword} that require tokens from recent sign-in attempts. - * - * This method does not work in a Node.js environment or on any {@link User} signed in by - * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}. - * - * @param user - The user. - * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101). - * @param appVerifier - The {@link ApplicationVerifier}. - * - * @public - */ -async function reauthenticateWithPhoneNumber(user, phoneNumber, appVerifier) { - const userInternal = getModularInstance(user); - if (_isFirebaseServerApp(userInternal.auth.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth)); - } - const verificationId = await _verifyPhoneNumber(userInternal.auth, phoneNumber, getModularInstance(appVerifier)); - return new ConfirmationResultImpl(verificationId, cred => reauthenticateWithCredential(userInternal, cred)); -} -/** - * Returns a verification ID to be used in conjunction with the SMS code that is sent. - * - */ -async function _verifyPhoneNumber(auth, options, verifier) { - if (!auth._getRecaptchaConfig()) { - try { - await _initializeRecaptchaConfig(auth); - } - catch (error) { - // If an error occurs while fetching the config, there is no way to know the enablement state - // of Phone provider, so we proceed with recaptcha V2 verification. - // The error is likely "recaptchaKey undefined", as reCAPTCHA Enterprise is not - // enabled for any provider. - console.log('Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.'); - } - } - try { - let phoneInfoOptions; - if (typeof options === 'string') { - phoneInfoOptions = { - phoneNumber: options - }; - } - else { - phoneInfoOptions = options; - } - if ('session' in phoneInfoOptions) { - const session = phoneInfoOptions.session; - if ('phoneNumber' in phoneInfoOptions) { - _assert(session.type === "enroll" /* MultiFactorSessionType.ENROLL */, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - const startPhoneMfaEnrollmentRequest = { - idToken: session.credential, - phoneEnrollmentInfo: { - phoneNumber: phoneInfoOptions.phoneNumber, - clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */ - } - }; - const startEnrollPhoneMfaActionCallback = async (authInstance, request) => { - // If reCAPTCHA Enterprise token is FAKE_TOKEN, fetch reCAPTCHA v2 token and inject into request. - if (request.phoneEnrollmentInfo.captchaResponse === FAKE_TOKEN) { - _assert(verifier?.type === RECAPTCHA_VERIFIER_TYPE, authInstance, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - const requestWithRecaptchaV2 = await injectRecaptchaV2Token(authInstance, request, verifier); - return startEnrollPhoneMfa(authInstance, requestWithRecaptchaV2); - } - return startEnrollPhoneMfa(authInstance, request); - }; - const startPhoneMfaEnrollmentResponse = handleRecaptchaFlow(auth, startPhoneMfaEnrollmentRequest, "mfaSmsEnrollment" /* RecaptchaActionName.MFA_SMS_ENROLLMENT */, startEnrollPhoneMfaActionCallback, "PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */); - const response = await startPhoneMfaEnrollmentResponse.catch(error => { - return Promise.reject(error); - }); - return response.phoneSessionInfo.sessionInfo; - } - else { - _assert(session.type === "signin" /* MultiFactorSessionType.SIGN_IN */, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - const mfaEnrollmentId = phoneInfoOptions.multiFactorHint?.uid || - phoneInfoOptions.multiFactorUid; - _assert(mfaEnrollmentId, auth, "missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */); - const startPhoneMfaSignInRequest = { - mfaPendingCredential: session.credential, - mfaEnrollmentId, - phoneSignInInfo: { - clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */ - } - }; - const startSignInPhoneMfaActionCallback = async (authInstance, request) => { - // If reCAPTCHA Enterprise token is FAKE_TOKEN, fetch reCAPTCHA v2 token and inject into request. - if (request.phoneSignInInfo.captchaResponse === FAKE_TOKEN) { - _assert(verifier?.type === RECAPTCHA_VERIFIER_TYPE, authInstance, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - const requestWithRecaptchaV2 = await injectRecaptchaV2Token(authInstance, request, verifier); - return startSignInPhoneMfa(authInstance, requestWithRecaptchaV2); - } - return startSignInPhoneMfa(authInstance, request); - }; - const startPhoneMfaSignInResponse = handleRecaptchaFlow(auth, startPhoneMfaSignInRequest, "mfaSmsSignIn" /* RecaptchaActionName.MFA_SMS_SIGNIN */, startSignInPhoneMfaActionCallback, "PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */); - const response = await startPhoneMfaSignInResponse.catch(error => { - return Promise.reject(error); - }); - return response.phoneResponseInfo.sessionInfo; - } - } - else { - const sendPhoneVerificationCodeRequest = { - phoneNumber: phoneInfoOptions.phoneNumber, - clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */ - }; - const sendPhoneVerificationCodeActionCallback = async (authInstance, request) => { - // If reCAPTCHA Enterprise token is FAKE_TOKEN, fetch reCAPTCHA v2 token and inject into request. - if (request.captchaResponse === FAKE_TOKEN) { - _assert(verifier?.type === RECAPTCHA_VERIFIER_TYPE, authInstance, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - const requestWithRecaptchaV2 = await injectRecaptchaV2Token(authInstance, request, verifier); - return sendPhoneVerificationCode(authInstance, requestWithRecaptchaV2); - } - return sendPhoneVerificationCode(authInstance, request); - }; - const sendPhoneVerificationCodeResponse = handleRecaptchaFlow(auth, sendPhoneVerificationCodeRequest, "sendVerificationCode" /* RecaptchaActionName.SEND_VERIFICATION_CODE */, sendPhoneVerificationCodeActionCallback, "PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */); - const response = await sendPhoneVerificationCodeResponse.catch(error => { - return Promise.reject(error); - }); - return response.sessionInfo; - } - } - finally { - verifier?._reset(); - } -} -/** - * Updates the user's phone number. - * - * @remarks - * This method does not work in a Node.js environment or on any {@link User} signed in by - * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ``` - * // 'recaptcha-container' is the ID of an element in the DOM. - * const applicationVerifier = new RecaptchaVerifier('recaptcha-container'); - * const provider = new PhoneAuthProvider(auth); - * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier); - * // Obtain the verificationCode from the user. - * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * await updatePhoneNumber(user, phoneCredential); - * ``` - * - * @param user - The user. - * @param credential - A credential authenticating the new phone number. - * - * @public - */ -async function updatePhoneNumber(user, credential) { - const userInternal = getModularInstance(user); - if (_isFirebaseServerApp(userInternal.auth.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth)); - } - await _link$1(userInternal, credential); -} -// Helper function that fetches and injects a reCAPTCHA v2 token into the request. -async function injectRecaptchaV2Token(auth, request, recaptchaV2Verifier) { - _assert(recaptchaV2Verifier.type === RECAPTCHA_VERIFIER_TYPE, auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - const recaptchaV2Token = await recaptchaV2Verifier.verify(); - _assert(typeof recaptchaV2Token === 'string', auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - const newRequest = { ...request }; - if ('phoneEnrollmentInfo' in newRequest) { - const phoneNumber = newRequest.phoneEnrollmentInfo.phoneNumber; - const captchaResponse = newRequest.phoneEnrollmentInfo.captchaResponse; - const clientType = newRequest - .phoneEnrollmentInfo.clientType; - const recaptchaVersion = newRequest.phoneEnrollmentInfo.recaptchaVersion; - Object.assign(newRequest, { - 'phoneEnrollmentInfo': { - phoneNumber, - recaptchaToken: recaptchaV2Token, - captchaResponse, - clientType, - recaptchaVersion - } - }); - return newRequest; - } - else if ('phoneSignInInfo' in newRequest) { - const captchaResponse = newRequest.phoneSignInInfo.captchaResponse; - const clientType = newRequest - .phoneSignInInfo.clientType; - const recaptchaVersion = newRequest.phoneSignInInfo.recaptchaVersion; - Object.assign(newRequest, { - 'phoneSignInInfo': { - recaptchaToken: recaptchaV2Token, - captchaResponse, - clientType, - recaptchaVersion - } - }); - return newRequest; - } - else { - Object.assign(newRequest, { 'recaptchaToken': recaptchaV2Token }); - return newRequest; - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Provider for generating an {@link PhoneAuthCredential}. - * - * @remarks - * `PhoneAuthProvider` does not work in a Node.js environment. - * - * @example - * ```javascript - * // 'recaptcha-container' is the ID of an element in the DOM. - * const applicationVerifier = new RecaptchaVerifier('recaptcha-container'); - * const provider = new PhoneAuthProvider(auth); - * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier); - * // Obtain the verificationCode from the user. - * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const userCredential = await signInWithCredential(auth, phoneCredential); - * ``` - * - * @public - */ -class PhoneAuthProvider { - /** - * @param auth - The Firebase {@link Auth} instance in which sign-ins should occur. - * - */ - constructor(auth) { - /** Always set to {@link ProviderId}.PHONE. */ - this.providerId = PhoneAuthProvider.PROVIDER_ID; - this.auth = _castAuth(auth); - } - /** - * - * Starts a phone number authentication flow by sending a verification code to the given phone - * number. - * - * @example - * ```javascript - * const provider = new PhoneAuthProvider(auth); - * const verificationId = await provider.verifyPhoneNumber(phoneNumber, applicationVerifier); - * // Obtain verificationCode from the user. - * const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const userCredential = await signInWithCredential(auth, authCredential); - * ``` - * - * @example - * An alternative flow is provided using the `signInWithPhoneNumber` method. - * ```javascript - * const confirmationResult = signInWithPhoneNumber(auth, phoneNumber, applicationVerifier); - * // Obtain verificationCode from the user. - * const userCredential = confirmationResult.confirm(verificationCode); - * ``` - * - * @param phoneInfoOptions - The user's {@link PhoneInfoOptions}. The phone number should be in - * E.164 format (e.g. +16505550101). - * @param applicationVerifier - An {@link ApplicationVerifier}, which prevents - * requests from unauthorized clients. This SDK includes an implementation - * based on reCAPTCHA v2, {@link RecaptchaVerifier}. If you've enabled - * reCAPTCHA Enterprise bot protection in Enforce mode, this parameter is - * optional; in all other configurations, the parameter is required. - * - * @returns A Promise for a verification ID that can be passed to - * {@link PhoneAuthProvider.credential} to identify this flow. - */ - verifyPhoneNumber(phoneOptions, applicationVerifier) { - return _verifyPhoneNumber(this.auth, phoneOptions, getModularInstance(applicationVerifier)); - } - /** - * Creates a phone auth credential, given the verification ID from - * {@link PhoneAuthProvider.verifyPhoneNumber} and the code that was sent to the user's - * mobile device. - * - * @example - * ```javascript - * const provider = new PhoneAuthProvider(auth); - * const verificationId = provider.verifyPhoneNumber(phoneNumber, applicationVerifier); - * // Obtain verificationCode from the user. - * const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const userCredential = signInWithCredential(auth, authCredential); - * ``` - * - * @example - * An alternative flow is provided using the `signInWithPhoneNumber` method. - * ```javascript - * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier); - * // Obtain verificationCode from the user. - * const userCredential = await confirmationResult.confirm(verificationCode); - * ``` - * - * @param verificationId - The verification ID returned from {@link PhoneAuthProvider.verifyPhoneNumber}. - * @param verificationCode - The verification code sent to the user's mobile device. - * - * @returns The auth provider credential. - */ - static credential(verificationId, verificationCode) { - return PhoneAuthCredential._fromVerification(verificationId, verificationCode); - } - /** - * Generates an {@link AuthCredential} from a {@link UserCredential}. - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential) { - const credential = userCredential; - return PhoneAuthProvider.credentialFromTaggedObject(credential); - } - /** - * Returns an {@link AuthCredential} when passed an error. - * - * @remarks - * - * This method works for errors like - * `auth/account-exists-with-different-credentials`. This is useful for - * recovering when attempting to set a user's phone number but the number - * in question is already tied to another account. For example, the following - * code tries to update the current user's phone number, and if that - * fails, links the user with the account associated with that number: - * - * ```js - * const provider = new PhoneAuthProvider(auth); - * const verificationId = await provider.verifyPhoneNumber(number, verifier); - * try { - * const code = ''; // Prompt the user for the verification code - * await updatePhoneNumber( - * auth.currentUser, - * PhoneAuthProvider.credential(verificationId, code)); - * } catch (e) { - * if ((e as FirebaseError)?.code === 'auth/account-exists-with-different-credential') { - * const cred = PhoneAuthProvider.credentialFromError(e); - * await linkWithCredential(auth.currentUser, cred); - * } - * } - * - * // At this point, auth.currentUser.phoneNumber === number. - * ``` - * - * @param error - The error to generate a credential from. - */ - static credentialFromError(error) { - return PhoneAuthProvider.credentialFromTaggedObject((error.customData || {})); - } - static credentialFromTaggedObject({ _tokenResponse: tokenResponse }) { - if (!tokenResponse) { - return null; - } - const { phoneNumber, temporaryProof } = tokenResponse; - if (phoneNumber && temporaryProof) { - return PhoneAuthCredential._fromTokenResponse(phoneNumber, temporaryProof); - } - return null; - } -} -/** Always set to {@link ProviderId}.PHONE. */ -PhoneAuthProvider.PROVIDER_ID = "phone" /* ProviderId.PHONE */; -/** Always set to {@link SignInMethod}.PHONE. */ -PhoneAuthProvider.PHONE_SIGN_IN_METHOD = "phone" /* SignInMethod.PHONE */; - -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Chooses a popup/redirect resolver to use. This prefers the override (which - * is directly passed in), and falls back to the property set on the auth - * object. If neither are available, this function errors w/ an argument error. - */ -function _withDefaultResolver(auth, resolverOverride) { - if (resolverOverride) { - return _getInstance(resolverOverride); - } - _assert(auth._popupRedirectResolver, auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - return auth._popupRedirectResolver; -} - -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -class IdpCredential extends AuthCredential { - constructor(params) { - super("custom" /* ProviderId.CUSTOM */, "custom" /* ProviderId.CUSTOM */); - this.params = params; - } - _getIdTokenResponse(auth) { - return signInWithIdp(auth, this._buildIdpRequest()); - } - _linkToIdToken(auth, idToken) { - return signInWithIdp(auth, this._buildIdpRequest(idToken)); - } - _getReauthenticationResolver(auth) { - return signInWithIdp(auth, this._buildIdpRequest()); - } - _buildIdpRequest(idToken) { - const request = { - requestUri: this.params.requestUri, - sessionId: this.params.sessionId, - postBody: this.params.postBody, - tenantId: this.params.tenantId, - pendingToken: this.params.pendingToken, - returnSecureToken: true, - returnIdpCredential: true - }; - if (idToken) { - request.idToken = idToken; - } - return request; - } -} -function _signIn(params) { - return _signInWithCredential(params.auth, new IdpCredential(params), params.bypassAuthState); -} -function _reauth(params) { - const { auth, user } = params; - _assert(user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - return _reauthenticate(user, new IdpCredential(params), params.bypassAuthState); -} -async function _link(params) { - const { auth, user } = params; - _assert(user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - return _link$1(user, new IdpCredential(params), params.bypassAuthState); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Popup event manager. Handles the popup's entire lifecycle; listens to auth - * events - */ -class AbstractPopupRedirectOperation { - constructor(auth, filter, resolver, user, bypassAuthState = false) { - this.auth = auth; - this.resolver = resolver; - this.user = user; - this.bypassAuthState = bypassAuthState; - this.pendingPromise = null; - this.eventManager = null; - this.filter = Array.isArray(filter) ? filter : [filter]; - } - execute() { - return new Promise(async (resolve, reject) => { - this.pendingPromise = { resolve, reject }; - try { - this.eventManager = await this.resolver._initialize(this.auth); - await this.onExecution(); - this.eventManager.registerConsumer(this); - } - catch (e) { - this.reject(e); - } - }); - } - async onAuthEvent(event) { - const { urlResponse, sessionId, postBody, tenantId, error, type } = event; - if (error) { - this.reject(error); - return; - } - const params = { - auth: this.auth, - requestUri: urlResponse, - sessionId: sessionId, - tenantId: tenantId || undefined, - postBody: postBody || undefined, - user: this.user, - bypassAuthState: this.bypassAuthState - }; - try { - this.resolve(await this.getIdpTask(type)(params)); - } - catch (e) { - this.reject(e); - } - } - onError(error) { - this.reject(error); - } - getIdpTask(type) { - switch (type) { - case "signInViaPopup" /* AuthEventType.SIGN_IN_VIA_POPUP */: - case "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */: - return _signIn; - case "linkViaPopup" /* AuthEventType.LINK_VIA_POPUP */: - case "linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */: - return _link; - case "reauthViaPopup" /* AuthEventType.REAUTH_VIA_POPUP */: - case "reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */: - return _reauth; - default: - _fail(this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - } - } - resolve(cred) { - debugAssert(this.pendingPromise, 'Pending promise was never set'); - this.pendingPromise.resolve(cred); - this.unregisterAndCleanUp(); - } - reject(error) { - debugAssert(this.pendingPromise, 'Pending promise was never set'); - this.pendingPromise.reject(error); - this.unregisterAndCleanUp(); - } - unregisterAndCleanUp() { - if (this.eventManager) { - this.eventManager.unregisterConsumer(this); - } - this.pendingPromise = null; - this.cleanUp(); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const _POLL_WINDOW_CLOSE_TIMEOUT = new Delay(2000, 10000); -/** - * Authenticates a Firebase client using a popup-based OAuth authentication flow. - * - * @remarks - * If succeeds, returns the signed in user along with the provider's credential. If sign in was - * unsuccessful, returns an error object containing additional information about the error. - * - * This method does not work in a Node.js environment or with {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new FacebookAuthProvider(); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * ``` - * - * @param auth - The {@link Auth} instance. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ -async function signInWithPopup(auth, provider, resolver) { - if (_isFirebaseServerApp(auth.app)) { - return Promise.reject(_createError(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */)); - } - const authInternal = _castAuth(auth); - _assertInstanceOf(auth, provider, FederatedAuthProvider); - const resolverInternal = _withDefaultResolver(authInternal, resolver); - const action = new PopupOperation(authInternal, "signInViaPopup" /* AuthEventType.SIGN_IN_VIA_POPUP */, provider, resolverInternal); - return action.executeNotNull(); -} -/** - * Reauthenticates the current user with the specified {@link OAuthProvider} using a pop-up based - * OAuth flow. - * - * @remarks - * If the reauthentication is successful, the returned result will contain the user and the - * provider's credential. - * - * This method does not work in a Node.js environment or on any {@link User} signed in by - * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new FacebookAuthProvider(); - * const result = await signInWithPopup(auth, provider); - * // Reauthenticate using a popup. - * await reauthenticateWithPopup(result.user, provider); - * ``` - * - * @param user - The user. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ -async function reauthenticateWithPopup(user, provider, resolver) { - const userInternal = getModularInstance(user); - if (_isFirebaseServerApp(userInternal.auth.app)) { - return Promise.reject(_createError(userInternal.auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */)); - } - _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider); - const resolverInternal = _withDefaultResolver(userInternal.auth, resolver); - const action = new PopupOperation(userInternal.auth, "reauthViaPopup" /* AuthEventType.REAUTH_VIA_POPUP */, provider, resolverInternal, userInternal); - return action.executeNotNull(); -} -/** - * Links the authenticated provider to the user account using a pop-up based OAuth flow. - * - * @remarks - * If the linking is successful, the returned result will contain the user and the provider's credential. - * - * This method does not work in a Node.js environment. - * - * @example - * ```javascript - * // Sign in using some other provider. - * const result = await signInWithEmailAndPassword(auth, email, password); - * // Link using a popup. - * const provider = new FacebookAuthProvider(); - * await linkWithPopup(result.user, provider); - * ``` - * - * @param user - The user. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ -async function linkWithPopup(user, provider, resolver) { - const userInternal = getModularInstance(user); - _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider); - const resolverInternal = _withDefaultResolver(userInternal.auth, resolver); - const action = new PopupOperation(userInternal.auth, "linkViaPopup" /* AuthEventType.LINK_VIA_POPUP */, provider, resolverInternal, userInternal); - return action.executeNotNull(); -} -/** - * Popup event manager. Handles the popup's entire lifecycle; listens to auth - * events - * - */ -class PopupOperation extends AbstractPopupRedirectOperation { - constructor(auth, filter, provider, resolver, user) { - super(auth, filter, resolver, user); - this.provider = provider; - this.authWindow = null; - this.pollId = null; - if (PopupOperation.currentPopupAction) { - PopupOperation.currentPopupAction.cancel(); - } - PopupOperation.currentPopupAction = this; - } - async executeNotNull() { - const result = await this.execute(); - _assert(result, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - return result; - } - async onExecution() { - debugAssert(this.filter.length === 1, 'Popup operations only handle one event'); - const eventId = _generateEventId(); - this.authWindow = await this.resolver._openPopup(this.auth, this.provider, this.filter[0], // There's always one, see constructor - eventId); - this.authWindow.associatedEvent = eventId; - // Check for web storage support and origin validation _after_ the popup is - // loaded. These operations are slow (~1 second or so) Rather than - // waiting on them before opening the window, optimistically open the popup - // and check for storage support at the same time. If storage support is - // not available, this will cause the whole thing to reject properly. It - // will also close the popup, but since the promise has already rejected, - // the popup closed by user poll will reject into the void. - this.resolver._originValidation(this.auth).catch(e => { - this.reject(e); - }); - this.resolver._isIframeWebStorageSupported(this.auth, isSupported => { - if (!isSupported) { - this.reject(_createError(this.auth, "web-storage-unsupported" /* AuthErrorCode.WEB_STORAGE_UNSUPPORTED */)); - } - }); - // Handle user closure. Notice this does *not* use await - this.pollUserCancellation(); - } - get eventId() { - return this.authWindow?.associatedEvent || null; - } - cancel() { - this.reject(_createError(this.auth, "cancelled-popup-request" /* AuthErrorCode.EXPIRED_POPUP_REQUEST */)); - } - cleanUp() { - if (this.authWindow) { - this.authWindow.close(); - } - if (this.pollId) { - window.clearTimeout(this.pollId); - } - this.authWindow = null; - this.pollId = null; - PopupOperation.currentPopupAction = null; - } - pollUserCancellation() { - const poll = () => { - if (this.authWindow?.window?.closed) { - // Make sure that there is sufficient time for whatever action to - // complete. The window could have closed but the sign in network - // call could still be in flight. This is specifically true for - // Firefox or if the opener is in an iframe, in which case the oauth - // helper closes the popup. - this.pollId = window.setTimeout(() => { - this.pollId = null; - this.reject(_createError(this.auth, "popup-closed-by-user" /* AuthErrorCode.POPUP_CLOSED_BY_USER */)); - }, 8000 /* _Timeout.AUTH_EVENT */); - return; - } - this.pollId = window.setTimeout(poll, _POLL_WINDOW_CLOSE_TIMEOUT.get()); - }; - poll(); - } -} -// Only one popup is ever shown at once. The lifecycle of the current popup -// can be managed / cancelled by the constructor. -PopupOperation.currentPopupAction = null; - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const PENDING_REDIRECT_KEY = 'pendingRedirect'; -// We only get one redirect outcome for any one auth, so just store it -// in here. -const redirectOutcomeMap = new Map(); -class RedirectAction extends AbstractPopupRedirectOperation { - constructor(auth, resolver, bypassAuthState = false) { - super(auth, [ - "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */, - "linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */, - "reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */, - "unknown" /* AuthEventType.UNKNOWN */ - ], resolver, undefined, bypassAuthState); - this.eventId = null; - } - /** - * Override the execute function; if we already have a redirect result, then - * just return it. - */ - async execute() { - let readyOutcome = redirectOutcomeMap.get(this.auth._key()); - if (!readyOutcome) { - try { - const hasPendingRedirect = await _getAndClearPendingRedirectStatus(this.resolver, this.auth); - const result = hasPendingRedirect ? await super.execute() : null; - readyOutcome = () => Promise.resolve(result); - } - catch (e) { - readyOutcome = () => Promise.reject(e); - } - redirectOutcomeMap.set(this.auth._key(), readyOutcome); - } - // If we're not bypassing auth state, the ready outcome should be set to - // null. - if (!this.bypassAuthState) { - redirectOutcomeMap.set(this.auth._key(), () => Promise.resolve(null)); - } - return readyOutcome(); - } - async onAuthEvent(event) { - if (event.type === "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */) { - return super.onAuthEvent(event); - } - else if (event.type === "unknown" /* AuthEventType.UNKNOWN */) { - // This is a sentinel value indicating there's no pending redirect - this.resolve(null); - return; - } - if (event.eventId) { - const user = await this.auth._redirectUserForId(event.eventId); - if (user) { - this.user = user; - return super.onAuthEvent(event); - } - else { - this.resolve(null); - } - } - } - async onExecution() { } - cleanUp() { } -} -async function _getAndClearPendingRedirectStatus(resolver, auth) { - const key = pendingRedirectKey(auth); - const persistence = resolverPersistence(resolver); - if (!(await persistence._isAvailable())) { - return false; - } - const hasPendingRedirect = (await persistence._get(key)) === 'true'; - await persistence._remove(key); - return hasPendingRedirect; -} -async function _setPendingRedirectStatus(resolver, auth) { - return resolverPersistence(resolver)._set(pendingRedirectKey(auth), 'true'); -} -function _clearRedirectOutcomes() { - redirectOutcomeMap.clear(); -} -function _overrideRedirectResult(auth, result) { - redirectOutcomeMap.set(auth._key(), result); -} -function resolverPersistence(resolver) { - return _getInstance(resolver._redirectPersistence); -} -function pendingRedirectKey(auth) { - return _persistenceKeyName(PENDING_REDIRECT_KEY, auth.config.apiKey, auth.name); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Authenticates a Firebase client using a full-page redirect flow. - * - * @remarks - * To handle the results and errors for this operation, refer to {@link getRedirectResult}. - * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices - * | best practices} when using {@link signInWithRedirect}. - * - * This method does not work in a Node.js environment or with {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new FacebookAuthProvider(); - * // You can add additional scopes to the provider: - * provider.addScope('user_birthday'); - * // Start a sign in process for an unauthenticated user. - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * } - * // As this API can be used for sign-in, linking and reauthentication, - * // check the operationType to determine what triggered this redirect - * // operation. - * const operationType = result.operationType; - * ``` - * - * @param auth - The {@link Auth} instance. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ -function signInWithRedirect(auth, provider, resolver) { - return _signInWithRedirect(auth, provider, resolver); -} -async function _signInWithRedirect(auth, provider, resolver) { - if (_isFirebaseServerApp(auth.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth)); - } - const authInternal = _castAuth(auth); - _assertInstanceOf(auth, provider, FederatedAuthProvider); - // Wait for auth initialization to complete, this will process pending redirects and clear the - // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new - // redirect and creating a PENDING_REDIRECT_KEY entry. - await authInternal._initializationPromise; - const resolverInternal = _withDefaultResolver(authInternal, resolver); - await _setPendingRedirectStatus(resolverInternal, authInternal); - return resolverInternal._openRedirect(authInternal, provider, "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */); -} -/** - * Reauthenticates the current user with the specified {@link OAuthProvider} using a full-page redirect flow. - * @remarks - * To handle the results and errors for this operation, refer to {@link getRedirectResult}. - * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices - * | best practices} when using {@link reauthenticateWithRedirect}. - * - * This method does not work in a Node.js environment or with {@link Auth} instances - * created with a {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new FacebookAuthProvider(); - * const result = await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * // Reauthenticate using a redirect. - * await reauthenticateWithRedirect(result.user, provider); - * // This will again trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * ``` - * - * @param user - The user. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ -function reauthenticateWithRedirect(user, provider, resolver) { - return _reauthenticateWithRedirect(user, provider, resolver); -} -async function _reauthenticateWithRedirect(user, provider, resolver) { - const userInternal = getModularInstance(user); - _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider); - if (_isFirebaseServerApp(userInternal.auth.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth)); - } - // Wait for auth initialization to complete, this will process pending redirects and clear the - // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new - // redirect and creating a PENDING_REDIRECT_KEY entry. - await userInternal.auth._initializationPromise; - // Allow the resolver to error before persisting the redirect user - const resolverInternal = _withDefaultResolver(userInternal.auth, resolver); - await _setPendingRedirectStatus(resolverInternal, userInternal.auth); - const eventId = await prepareUserForRedirect(userInternal); - return resolverInternal._openRedirect(userInternal.auth, provider, "reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */, eventId); -} -/** - * Links the {@link OAuthProvider} to the user account using a full-page redirect flow. - * @remarks - * To handle the results and errors for this operation, refer to {@link getRedirectResult}. - * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices - * | best practices} when using {@link linkWithRedirect}. - * - * This method does not work in a Node.js environment or with {@link Auth} instances - * created with a {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * // Sign in using some other provider. - * const result = await signInWithEmailAndPassword(auth, email, password); - * // Link using a redirect. - * const provider = new FacebookAuthProvider(); - * await linkWithRedirect(result.user, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * ``` - * - * @param user - The user. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ -function linkWithRedirect(user, provider, resolver) { - return _linkWithRedirect(user, provider, resolver); -} -async function _linkWithRedirect(user, provider, resolver) { - const userInternal = getModularInstance(user); - _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider); - // Wait for auth initialization to complete, this will process pending redirects and clear the - // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new - // redirect and creating a PENDING_REDIRECT_KEY entry. - await userInternal.auth._initializationPromise; - // Allow the resolver to error before persisting the redirect user - const resolverInternal = _withDefaultResolver(userInternal.auth, resolver); - await _assertLinkedStatus(false, userInternal, provider.providerId); - await _setPendingRedirectStatus(resolverInternal, userInternal.auth); - const eventId = await prepareUserForRedirect(userInternal); - return resolverInternal._openRedirect(userInternal.auth, provider, "linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */, eventId); -} -/** - * Returns a {@link UserCredential} from the redirect-based sign-in flow. - * - * @remarks - * If sign-in succeeded, returns the signed in user. If sign-in was unsuccessful, fails with an - * error. If no redirect operation was called, returns `null`. - * - * This method does not work in a Node.js environment or with {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new FacebookAuthProvider(); - * // You can add additional scopes to the provider: - * provider.addScope('user_birthday'); - * // Start a sign in process for an unauthenticated user. - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * } - * // As this API can be used for sign-in, linking and reauthentication, - * // check the operationType to determine what triggered this redirect - * // operation. - * const operationType = result.operationType; - * ``` - * - * @param auth - The {@link Auth} instance. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ -async function getRedirectResult(auth, resolver) { - await _castAuth(auth)._initializationPromise; - return _getRedirectResult(auth, resolver, false); -} -async function _getRedirectResult(auth, resolverExtern, bypassAuthState = false) { - if (_isFirebaseServerApp(auth.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth)); - } - const authInternal = _castAuth(auth); - const resolver = _withDefaultResolver(authInternal, resolverExtern); - const action = new RedirectAction(authInternal, resolver, bypassAuthState); - const result = await action.execute(); - if (result && !bypassAuthState) { - delete result.user._redirectEventId; - await authInternal._persistUserIfCurrent(result.user); - await authInternal._setRedirectUser(null, resolverExtern); - } - return result; -} -async function prepareUserForRedirect(user) { - const eventId = _generateEventId(`${user.uid}:::`); - user._redirectEventId = eventId; - await user.auth._setRedirectUser(user); - await user.auth._persistUserIfCurrent(user); - return eventId; -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// The amount of time to store the UIDs of seen events; this is -// set to 10 min by default -const EVENT_DUPLICATION_CACHE_DURATION_MS = 10 * 60 * 1000; -class AuthEventManager { - constructor(auth) { - this.auth = auth; - this.cachedEventUids = new Set(); - this.consumers = new Set(); - this.queuedRedirectEvent = null; - this.hasHandledPotentialRedirect = false; - this.lastProcessedEventTime = Date.now(); - } - registerConsumer(authEventConsumer) { - this.consumers.add(authEventConsumer); - if (this.queuedRedirectEvent && - this.isEventForConsumer(this.queuedRedirectEvent, authEventConsumer)) { - this.sendToConsumer(this.queuedRedirectEvent, authEventConsumer); - this.saveEventToCache(this.queuedRedirectEvent); - this.queuedRedirectEvent = null; - } - } - unregisterConsumer(authEventConsumer) { - this.consumers.delete(authEventConsumer); - } - onEvent(event) { - // Check if the event has already been handled - if (this.hasEventBeenHandled(event)) { - return false; - } - let handled = false; - this.consumers.forEach(consumer => { - if (this.isEventForConsumer(event, consumer)) { - handled = true; - this.sendToConsumer(event, consumer); - this.saveEventToCache(event); - } - }); - if (this.hasHandledPotentialRedirect || !isRedirectEvent(event)) { - // If we've already seen a redirect before, or this is a popup event, - // bail now - return handled; - } - this.hasHandledPotentialRedirect = true; - // If the redirect wasn't handled, hang on to it - if (!handled) { - this.queuedRedirectEvent = event; - handled = true; - } - return handled; - } - sendToConsumer(event, consumer) { - if (event.error && !isNullRedirectEvent(event)) { - const code = event.error.code?.split('auth/')[1] || - "internal-error" /* AuthErrorCode.INTERNAL_ERROR */; - consumer.onError(_createError(this.auth, code)); - } - else { - consumer.onAuthEvent(event); - } - } - isEventForConsumer(event, consumer) { - const eventIdMatches = consumer.eventId === null || - (!!event.eventId && event.eventId === consumer.eventId); - return consumer.filter.includes(event.type) && eventIdMatches; - } - hasEventBeenHandled(event) { - if (Date.now() - this.lastProcessedEventTime >= - EVENT_DUPLICATION_CACHE_DURATION_MS) { - this.cachedEventUids.clear(); - } - return this.cachedEventUids.has(eventUid(event)); - } - saveEventToCache(event) { - this.cachedEventUids.add(eventUid(event)); - this.lastProcessedEventTime = Date.now(); - } -} -function eventUid(e) { - return [e.type, e.eventId, e.sessionId, e.tenantId].filter(v => v).join('-'); -} -function isNullRedirectEvent({ type, error }) { - return (type === "unknown" /* AuthEventType.UNKNOWN */ && - error?.code === `auth/${"no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */}`); -} -function isRedirectEvent(event) { - switch (event.type) { - case "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */: - case "linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */: - case "reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */: - return true; - case "unknown" /* AuthEventType.UNKNOWN */: - return isNullRedirectEvent(event); - default: - return false; - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function _getProjectConfig(auth, request = {}) { - return _performApiRequest(auth, "GET" /* HttpMethod.GET */, "/v1/projects" /* Endpoint.GET_PROJECT_CONFIG */, request); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const IP_ADDRESS_REGEX = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/; -const HTTP_REGEX = /^https?/; -async function _validateOrigin$1(auth) { - // Skip origin validation if we are in an emulated environment - if (auth.config.emulator) { - return; - } - const { authorizedDomains } = await _getProjectConfig(auth); - for (const domain of authorizedDomains) { - try { - if (matchDomain(domain)) { - return; - } - } - catch { - // Do nothing if there's a URL error; just continue searching - } - } - // In the old SDK, this error also provides helpful messages. - _fail(auth, "unauthorized-domain" /* AuthErrorCode.INVALID_ORIGIN */); -} -function matchDomain(expected) { - const currentUrl = _getCurrentUrl(); - const { protocol, hostname } = new URL(currentUrl); - if (expected.startsWith('chrome-extension://')) { - const ceUrl = new URL(expected); - if (ceUrl.hostname === '' && hostname === '') { - // For some reason we're not parsing chrome URLs properly - return (protocol === 'chrome-extension:' && - expected.replace('chrome-extension://', '') === - currentUrl.replace('chrome-extension://', '')); - } - return protocol === 'chrome-extension:' && ceUrl.hostname === hostname; - } - if (!HTTP_REGEX.test(protocol)) { - return false; - } - if (IP_ADDRESS_REGEX.test(expected)) { - // The domain has to be exactly equal to the pattern, as an IP domain will - // only contain the IP, no extra character. - return hostname === expected; - } - // Dots in pattern should be escaped. - const escapedDomainPattern = expected.replace(/\./g, '\\.'); - // Non ip address domains. - // domain.com = *.domain.com OR domain.com - const re = new RegExp('^(.+\\.' + escapedDomainPattern + '|' + escapedDomainPattern + ')$', 'i'); - return re.test(hostname); -} - -/** - * @license - * Copyright 2020 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const NETWORK_TIMEOUT = new Delay(30000, 60000); -/** - * Reset unloaded GApi modules. If gapi.load fails due to a network error, - * it will stop working after a retrial. This is a hack to fix this issue. - */ -function resetUnloadedGapiModules() { - // Clear last failed gapi.load state to force next gapi.load to first - // load the failed gapi.iframes module. - // Get gapix.beacon context. - const beacon = _window().___jsl; - // Get current hint. - if (beacon?.H) { - // Get gapi hint. - for (const hint of Object.keys(beacon.H)) { - // Requested modules. - beacon.H[hint].r = beacon.H[hint].r || []; - // Loaded modules. - beacon.H[hint].L = beacon.H[hint].L || []; - // Set requested modules to a copy of the loaded modules. - beacon.H[hint].r = [...beacon.H[hint].L]; - // Clear pending callbacks. - if (beacon.CP) { - for (let i = 0; i < beacon.CP.length; i++) { - // Remove all failed pending callbacks. - beacon.CP[i] = null; - } - } - } - } -} -function loadGapi(auth) { - return new Promise((resolve, reject) => { - // Function to run when gapi.load is ready. - function loadGapiIframe() { - // The developer may have tried to previously run gapi.load and failed. - // Run this to fix that. - resetUnloadedGapiModules(); - gapi.load('gapi.iframes', { - callback: () => { - resolve(gapi.iframes.getContext()); - }, - ontimeout: () => { - // The above reset may be sufficient, but having this reset after - // failure ensures that if the developer calls gapi.load after the - // connection is re-established and before another attempt to embed - // the iframe, it would work and would not be broken because of our - // failed attempt. - // Timeout when gapi.iframes.Iframe not loaded. - resetUnloadedGapiModules(); - reject(_createError(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */)); - }, - timeout: NETWORK_TIMEOUT.get() - }); - } - if (_window().gapi?.iframes?.Iframe) { - // If gapi.iframes.Iframe available, resolve. - resolve(gapi.iframes.getContext()); - } - else if (!!_window().gapi?.load) { - // Gapi loader ready, load gapi.iframes. - loadGapiIframe(); - } - else { - // Create a new iframe callback when this is called so as not to overwrite - // any previous defined callback. This happens if this method is called - // multiple times in parallel and could result in the later callback - // overwriting the previous one. This would end up with a iframe - // timeout. - const cbName = _generateCallbackName('iframefcb'); - // GApi loader not available, dynamically load platform.js. - _window()[cbName] = () => { - // GApi loader should be ready. - if (!!gapi.load) { - loadGapiIframe(); - } - else { - // Gapi loader failed, throw error. - reject(_createError(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */)); - } - }; - // Load GApi loader. - return _loadJS(`${_gapiScriptUrl()}?onload=${cbName}`) - .catch(e => reject(e)); - } - }).catch(error => { - // Reset cached promise to allow for retrial. - cachedGApiLoader = null; - throw error; - }); -} -let cachedGApiLoader = null; -function _loadGapi(auth) { - cachedGApiLoader = cachedGApiLoader || loadGapi(auth); - return cachedGApiLoader; -} - -/** - * @license - * Copyright 2020 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const PING_TIMEOUT = new Delay(5000, 15000); -const IFRAME_PATH = '__/auth/iframe'; -const EMULATED_IFRAME_PATH = 'emulator/auth/iframe'; -const IFRAME_ATTRIBUTES = { - style: { - position: 'absolute', - top: '-100px', - width: '1px', - height: '1px' - }, - 'aria-hidden': 'true', - tabindex: '-1' -}; -// Map from apiHost to endpoint ID for passing into iframe. In current SDK, apiHost can be set to -// anything (not from a list of endpoints with IDs as in legacy), so this is the closest we can get. -const EID_FROM_APIHOST = new Map([ - ["identitytoolkit.googleapis.com" /* DefaultConfig.API_HOST */, 'p'], // production - ['staging-identitytoolkit.sandbox.googleapis.com', 's'], // staging - ['test-identitytoolkit.sandbox.googleapis.com', 't'] // test -]); -function getIframeUrl(auth) { - const config = auth.config; - _assert(config.authDomain, auth, "auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */); - const url = config.emulator - ? _emulatorUrl(config, EMULATED_IFRAME_PATH) - : `https://${auth.config.authDomain}/${IFRAME_PATH}`; - const params = { - apiKey: config.apiKey, - appName: auth.name, - v: SDK_VERSION - }; - const eid = EID_FROM_APIHOST.get(auth.config.apiHost); - if (eid) { - params.eid = eid; - } - const frameworks = auth._getFrameworks(); - if (frameworks.length) { - params.fw = frameworks.join(','); - } - return `${url}?${querystring(params).slice(1)}`; -} -async function _openIframe(auth) { - const context = await _loadGapi(auth); - const gapi = _window().gapi; - _assert(gapi, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - return context.open({ - where: document.body, - url: getIframeUrl(auth), - messageHandlersFilter: gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER, - attributes: IFRAME_ATTRIBUTES, - dontclear: true - }, (iframe) => new Promise(async (resolve, reject) => { - await iframe.restyle({ - // Prevent iframe from closing on mouse out. - setHideOnLeave: false - }); - const networkError = _createError(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */); - // Confirm iframe is correctly loaded. - // To fallback on failure, set a timeout. - const networkErrorTimer = _window().setTimeout(() => { - reject(networkError); - }, PING_TIMEOUT.get()); - // Clear timer and resolve pending iframe ready promise. - function clearTimerAndResolve() { - _window().clearTimeout(networkErrorTimer); - resolve(iframe); - } - // This returns an IThenable. However the reject part does not call - // when the iframe is not loaded. - iframe.ping(clearTimerAndResolve).then(clearTimerAndResolve, () => { - reject(networkError); - }); - })); -} - -/** - * @license - * Copyright 2020 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const BASE_POPUP_OPTIONS = { - location: 'yes', - resizable: 'yes', - statusbar: 'yes', - toolbar: 'no' -}; -const DEFAULT_WIDTH = 500; -const DEFAULT_HEIGHT = 600; -const TARGET_BLANK = '_blank'; -const FIREFOX_EMPTY_URL = 'http://localhost'; -class AuthPopup { - constructor(window) { - this.window = window; - this.associatedEvent = null; - } - close() { - if (this.window) { - try { - this.window.close(); - } - catch (e) { } - } - } -} -function _open(auth, url, name, width = DEFAULT_WIDTH, height = DEFAULT_HEIGHT) { - const top = Math.max((window.screen.availHeight - height) / 2, 0).toString(); - const left = Math.max((window.screen.availWidth - width) / 2, 0).toString(); - let target = ''; - const options = { - ...BASE_POPUP_OPTIONS, - width: width.toString(), - height: height.toString(), - top, - left - }; - // Chrome iOS 7 and 8 is returning an undefined popup win when target is - // specified, even though the popup is not necessarily blocked. - const ua = getUA().toLowerCase(); - if (name) { - target = _isChromeIOS(ua) ? TARGET_BLANK : name; - } - if (_isFirefox(ua)) { - // Firefox complains when invalid URLs are popped out. Hacky way to bypass. - url = url || FIREFOX_EMPTY_URL; - // Firefox disables by default scrolling on popup windows, which can create - // issues when the user has many Google accounts, for instance. - options.scrollbars = 'yes'; - } - const optionsString = Object.entries(options).reduce((accum, [key, value]) => `${accum}${key}=${value},`, ''); - if (_isIOSStandalone(ua) && target !== '_self') { - openAsNewWindowIOS(url || '', target); - return new AuthPopup(null); - } - // about:blank getting sanitized causing browsers like IE/Edge to display - // brief error message before redirecting to handler. - const newWin = window.open(url || '', target, optionsString); - _assert(newWin, auth, "popup-blocked" /* AuthErrorCode.POPUP_BLOCKED */); - // Flaky on IE edge, encapsulate with a try and catch. - try { - newWin.focus(); - } - catch (e) { } - return new AuthPopup(newWin); -} -function openAsNewWindowIOS(url, target) { - const el = document.createElement('a'); - el.href = url; - el.target = target; - const click = document.createEvent('MouseEvent'); - click.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 1, null); - el.dispatchEvent(click); -} - -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * URL for Authentication widget which will initiate the OAuth handshake - * - * @internal - */ -const WIDGET_PATH = '__/auth/handler'; -/** - * URL for emulated environment - * - * @internal - */ -const EMULATOR_WIDGET_PATH = 'emulator/auth/handler'; -/** - * Fragment name for the App Check token that gets passed to the widget - * - * @internal - */ -const FIREBASE_APP_CHECK_FRAGMENT_ID = encodeURIComponent('fac'); -async function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additionalParams) { - _assert(auth.config.authDomain, auth, "auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */); - _assert(auth.config.apiKey, auth, "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */); - const params = { - apiKey: auth.config.apiKey, - appName: auth.name, - authType, - redirectUrl, - v: SDK_VERSION, - eventId - }; - if (provider instanceof FederatedAuthProvider) { - provider.setDefaultLanguage(auth.languageCode); - params.providerId = provider.providerId || ''; - if (!isEmpty(provider.getCustomParameters())) { - params.customParameters = JSON.stringify(provider.getCustomParameters()); - } - // TODO set additionalParams from the provider as well? - for (const [key, value] of Object.entries(additionalParams || {})) { - params[key] = value; - } - } - if (provider instanceof BaseOAuthProvider) { - const scopes = provider.getScopes().filter(scope => scope !== ''); - if (scopes.length > 0) { - params.scopes = scopes.join(','); - } - } - if (auth.tenantId) { - params.tid = auth.tenantId; - } - // TODO: maybe set eid as endpointId - // TODO: maybe set fw as Frameworks.join(",") - const paramsDict = params; - for (const key of Object.keys(paramsDict)) { - if (paramsDict[key] === undefined) { - delete paramsDict[key]; - } - } - // Sets the App Check token to pass to the widget - const appCheckToken = await auth._getAppCheckToken(); - const appCheckTokenFragment = appCheckToken - ? `#${FIREBASE_APP_CHECK_FRAGMENT_ID}=${encodeURIComponent(appCheckToken)}` - : ''; - // Start at index 1 to skip the leading '&' in the query string - return `${getHandlerBase(auth)}?${querystring(paramsDict).slice(1)}${appCheckTokenFragment}`; -} -function getHandlerBase({ config }) { - if (!config.emulator) { - return `https://${config.authDomain}/${WIDGET_PATH}`; - } - return _emulatorUrl(config, EMULATOR_WIDGET_PATH); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * The special web storage event - * - */ -const WEB_STORAGE_SUPPORT_KEY = 'webStorageSupport'; -class BrowserPopupRedirectResolver { - constructor() { - this.eventManagers = {}; - this.iframes = {}; - this.originValidationPromises = {}; - this._redirectPersistence = browserSessionPersistence; - this._completeRedirectFn = _getRedirectResult; - this._overrideRedirectResult = _overrideRedirectResult; - } - // Wrapping in async even though we don't await anywhere in order - // to make sure errors are raised as promise rejections - async _openPopup(auth, provider, authType, eventId) { - debugAssert(this.eventManagers[auth._key()]?.manager, '_initialize() not called before _openPopup()'); - const url = await _getRedirectUrl(auth, provider, authType, _getCurrentUrl(), eventId); - return _open(auth, url, _generateEventId()); - } - async _openRedirect(auth, provider, authType, eventId) { - await this._originValidation(auth); - const url = await _getRedirectUrl(auth, provider, authType, _getCurrentUrl(), eventId); - _setWindowLocation(url); - return new Promise(() => { }); - } - _initialize(auth) { - const key = auth._key(); - if (this.eventManagers[key]) { - const { manager, promise } = this.eventManagers[key]; - if (manager) { - return Promise.resolve(manager); - } - else { - debugAssert(promise, 'If manager is not set, promise should be'); - return promise; - } - } - const promise = this.initAndGetManager(auth); - this.eventManagers[key] = { promise }; - // If the promise is rejected, the key should be removed so that the - // operation can be retried later. - promise.catch(() => { - delete this.eventManagers[key]; - }); - return promise; - } - async initAndGetManager(auth) { - const iframe = await _openIframe(auth); - const manager = new AuthEventManager(auth); - iframe.register('authEvent', (iframeEvent) => { - _assert(iframeEvent?.authEvent, auth, "invalid-auth-event" /* AuthErrorCode.INVALID_AUTH_EVENT */); - // TODO: Consider splitting redirect and popup events earlier on - const handled = manager.onEvent(iframeEvent.authEvent); - return { status: handled ? "ACK" /* GapiOutcome.ACK */ : "ERROR" /* GapiOutcome.ERROR */ }; - }, gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER); - this.eventManagers[auth._key()] = { manager }; - this.iframes[auth._key()] = iframe; - return manager; - } - _isIframeWebStorageSupported(auth, cb) { - const iframe = this.iframes[auth._key()]; - iframe.send(WEB_STORAGE_SUPPORT_KEY, { type: WEB_STORAGE_SUPPORT_KEY }, result => { - const isSupported = result?.[0]?.[WEB_STORAGE_SUPPORT_KEY]; - if (isSupported !== undefined) { - cb(!!isSupported); - } - _fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - }, gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER); - } - _originValidation(auth) { - const key = auth._key(); - if (!this.originValidationPromises[key]) { - this.originValidationPromises[key] = _validateOrigin$1(auth); - } - return this.originValidationPromises[key]; - } - get _shouldInitProactively() { - // Mobile browsers and Safari need to optimistically initialize - return _isMobileBrowser() || _isSafari() || _isIOS(); - } -} -/** - * An implementation of {@link PopupRedirectResolver} suitable for browser - * based applications. - * - * @remarks - * This method does not work in a Node.js environment. - * - * @public - */ -const browserPopupRedirectResolver = BrowserPopupRedirectResolver; - -/** - * {@inheritdoc PhoneMultiFactorAssertion} - * - * @public - */ -class PhoneMultiFactorAssertionImpl extends MultiFactorAssertionImpl { - constructor(credential) { - super("phone" /* FactorId.PHONE */); - this.credential = credential; - } - /** @internal */ - static _fromCredential(credential) { - return new PhoneMultiFactorAssertionImpl(credential); - } - /** @internal */ - _finalizeEnroll(auth, idToken, displayName) { - return finalizeEnrollPhoneMfa(auth, { - idToken, - displayName, - phoneVerificationInfo: this.credential._makeVerificationRequest() - }); - } - /** @internal */ - _finalizeSignIn(auth, mfaPendingCredential) { - return finalizeSignInPhoneMfa(auth, { - mfaPendingCredential, - phoneVerificationInfo: this.credential._makeVerificationRequest() - }); - } -} -/** - * Provider for generating a {@link PhoneMultiFactorAssertion}. - * - * @public - */ -class PhoneMultiFactorGenerator { - constructor() { } - /** - * Provides a {@link PhoneMultiFactorAssertion} to confirm ownership of the phone second factor. - * - * @remarks - * This method does not work in a Node.js environment. - * - * @param phoneAuthCredential - A credential provided by {@link PhoneAuthProvider.credential}. - * @returns A {@link PhoneMultiFactorAssertion} which can be used with - * {@link MultiFactorResolver.resolveSignIn} - */ - static assertion(credential) { - return PhoneMultiFactorAssertionImpl._fromCredential(credential); - } -} -/** - * The identifier of the phone second factor: `phone`. - */ -PhoneMultiFactorGenerator.FACTOR_ID = 'phone'; - -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const DEFAULT_ID_TOKEN_MAX_AGE = 5 * 60; -const authIdTokenMaxAge = getExperimentalSetting('authIdTokenMaxAge') || DEFAULT_ID_TOKEN_MAX_AGE; -let lastPostedIdToken = null; -const mintCookieFactory = (url) => async (user) => { - const idTokenResult = user && (await user.getIdTokenResult()); - const idTokenAge = idTokenResult && - (new Date().getTime() - Date.parse(idTokenResult.issuedAtTime)) / 1000; - if (idTokenAge && idTokenAge > authIdTokenMaxAge) { - return; - } - // Specifically trip null => undefined when logged out, to delete any existing cookie - const idToken = idTokenResult?.token; - if (lastPostedIdToken === idToken) { - return; - } - lastPostedIdToken = idToken; - await fetch(url, { - method: idToken ? 'POST' : 'DELETE', - headers: idToken - ? { - 'Authorization': `Bearer ${idToken}` - } - : {} - }); -}; -/** - * Returns the Auth instance associated with the provided {@link @firebase/app#FirebaseApp}. - * If no instance exists, initializes an Auth instance with platform-specific default dependencies. - * - * @param app - The Firebase App. - * - * @public - */ -function getAuth(app = getApp()) { - const provider = _getProvider(app, 'auth'); - if (provider.isInitialized()) { - return provider.getImmediate(); - } - const auth = initializeAuth(app, { - popupRedirectResolver: browserPopupRedirectResolver, - persistence: [ - indexedDBLocalPersistence, - browserLocalPersistence, - browserSessionPersistence - ] - }); - const authTokenSyncPath = getExperimentalSetting('authTokenSyncURL'); - // Only do the Cookie exchange in a secure context - if (authTokenSyncPath && - typeof isSecureContext === 'boolean' && - isSecureContext) { - // Don't allow urls (XSS possibility), only paths on the same domain - const authTokenSyncUrl = new URL(authTokenSyncPath, location.origin); - if (location.origin === authTokenSyncUrl.origin) { - const mintCookie = mintCookieFactory(authTokenSyncUrl.toString()); - beforeAuthStateChanged(auth, mintCookie, () => mintCookie(auth.currentUser)); - onIdTokenChanged(auth, user => mintCookie(user)); - } - } - const authEmulatorHost = getDefaultEmulatorHost('auth'); - if (authEmulatorHost) { - connectAuthEmulator(auth, `http://${authEmulatorHost}`); - } - return auth; -} -function getScriptParentElement() { - return document.getElementsByTagName('head')?.[0] ?? document; -} -_setExternalJSProvider({ - loadJS(url) { - // TODO: consider adding timeout support & cancellation - return new Promise((resolve, reject) => { - const el = document.createElement('script'); - el.setAttribute('src', url); - el.onload = resolve; - el.onerror = e => { - const error = _createError("internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - error.customData = e; - reject(error); - }; - el.type = 'text/javascript'; - el.charset = 'UTF-8'; - getScriptParentElement().appendChild(el); - }); - }, - gapiScript: 'https://apis.google.com/js/api.js', - recaptchaV2Script: 'https://www.google.com/recaptcha/api.js', - recaptchaEnterpriseScript: 'https://www.google.com/recaptcha/enterprise.js?render=' -}); -registerAuth("Browser" /* ClientPlatform.BROWSER */); - -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function _cordovaWindow() { - return window; -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * How long to wait after the app comes back into focus before concluding that - * the user closed the sign in tab. - */ -const REDIRECT_TIMEOUT_MS = 2000; -/** - * Generates the URL for the OAuth handler. - */ -async function _generateHandlerUrl(auth, event, provider) { - // Get the cordova plugins - const { BuildInfo } = _cordovaWindow(); - debugAssert(event.sessionId, 'AuthEvent did not contain a session ID'); - const sessionDigest = await computeSha256(event.sessionId); - const additionalParams = {}; - if (_isIOS()) { - // iOS app identifier - additionalParams['ibi'] = BuildInfo.packageName; - } - else if (_isAndroid()) { - // Android app identifier - additionalParams['apn'] = BuildInfo.packageName; - } - else { - _fail(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */); - } - // Add the display name if available - if (BuildInfo.displayName) { - additionalParams['appDisplayName'] = BuildInfo.displayName; - } - // Attached the hashed session ID - additionalParams['sessionId'] = sessionDigest; - return _getRedirectUrl(auth, provider, event.type, undefined, event.eventId ?? undefined, additionalParams); -} -/** - * Validates that this app is valid for this project configuration - */ -async function _validateOrigin(auth) { - const { BuildInfo } = _cordovaWindow(); - const request = {}; - if (_isIOS()) { - request.iosBundleId = BuildInfo.packageName; - } - else if (_isAndroid()) { - request.androidPackageName = BuildInfo.packageName; - } - else { - _fail(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */); - } - // Will fail automatically if package name is not authorized - await _getProjectConfig(auth, request); -} -function _performRedirect(handlerUrl) { - // Get the cordova plugins - const { cordova } = _cordovaWindow(); - return new Promise(resolve => { - cordova.plugins.browsertab.isAvailable(browserTabIsAvailable => { - let iabRef = null; - if (browserTabIsAvailable) { - cordova.plugins.browsertab.openUrl(handlerUrl); - } - else { - // TODO: Return the inappbrowser ref that's returned from the open call - iabRef = cordova.InAppBrowser.open(handlerUrl, _isIOS7Or8() ? '_blank' : '_system', 'location=yes'); - } - resolve(iabRef); - }); - }); -} -/** - * This function waits for app activity to be seen before resolving. It does - * this by attaching listeners to various dom events. Once the app is determined - * to be visible, this promise resolves. AFTER that resolution, the listeners - * are detached and any browser tabs left open will be closed. - */ -async function _waitForAppResume(auth, eventListener, iabRef) { - // Get the cordova plugins - const { cordova } = _cordovaWindow(); - let cleanup = () => { }; - try { - await new Promise((resolve, reject) => { - let onCloseTimer = null; - // DEFINE ALL THE CALLBACKS ===== - function authEventSeen() { - // Auth event was detected. Resolve this promise and close the extra - // window if it's still open. - resolve(); - const closeBrowserTab = cordova.plugins.browsertab?.close; - if (typeof closeBrowserTab === 'function') { - closeBrowserTab(); - } - // Close inappbrowser embedded webview in iOS7 and 8 case if still - // open. - if (typeof iabRef?.close === 'function') { - iabRef.close(); - } - } - function resumed() { - if (onCloseTimer) { - // This code already ran; do not rerun. - return; - } - onCloseTimer = window.setTimeout(() => { - // Wait two seconds after resume then reject. - reject(_createError(auth, "redirect-cancelled-by-user" /* AuthErrorCode.REDIRECT_CANCELLED_BY_USER */)); - }, REDIRECT_TIMEOUT_MS); - } - function visibilityChanged() { - if (document?.visibilityState === 'visible') { - resumed(); - } - } - // ATTACH ALL THE LISTENERS ===== - // Listen for the auth event - eventListener.addPassiveListener(authEventSeen); - // Listen for resume and visibility events - document.addEventListener('resume', resumed, false); - if (_isAndroid()) { - document.addEventListener('visibilitychange', visibilityChanged, false); - } - // SETUP THE CLEANUP FUNCTION ===== - cleanup = () => { - eventListener.removePassiveListener(authEventSeen); - document.removeEventListener('resume', resumed, false); - document.removeEventListener('visibilitychange', visibilityChanged, false); - if (onCloseTimer) { - window.clearTimeout(onCloseTimer); - } - }; - }); - } - finally { - cleanup(); - } -} -/** - * Checks the configuration of the Cordova environment. This has no side effect - * if the configuration is correct; otherwise it throws an error with the - * missing plugin. - */ -function _checkCordovaConfiguration(auth) { - const win = _cordovaWindow(); - // Check all dependencies installed. - // https://github.com/nordnet/cordova-universal-links-plugin - // Note that cordova-universal-links-plugin has been abandoned. - // A fork with latest fixes is available at: - // https://www.npmjs.com/package/cordova-universal-links-plugin-fix - _assert(typeof win?.universalLinks?.subscribe === 'function', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, { - missingPlugin: 'cordova-universal-links-plugin-fix' - }); - // https://www.npmjs.com/package/cordova-plugin-buildinfo - _assert(typeof win?.BuildInfo?.packageName !== 'undefined', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, { - missingPlugin: 'cordova-plugin-buildInfo' - }); - // https://github.com/google/cordova-plugin-browsertab - _assert(typeof win?.cordova?.plugins?.browsertab?.openUrl === 'function', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, { - missingPlugin: 'cordova-plugin-browsertab' - }); - _assert(typeof win?.cordova?.plugins?.browsertab?.isAvailable === 'function', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, { - missingPlugin: 'cordova-plugin-browsertab' - }); - // https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/ - _assert(typeof win?.cordova?.InAppBrowser?.open === 'function', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, { - missingPlugin: 'cordova-plugin-inappbrowser' - }); -} -/** - * Computes the SHA-256 of a session ID. The SubtleCrypto interface is only - * available in "secure" contexts, which covers Cordova (which is served on a file - * protocol). - */ -async function computeSha256(sessionId) { - const bytes = stringToArrayBuffer(sessionId); - // TODO: For IE11 crypto has a different name and this operation comes back - // as an object, not a promise. This is the old proposed standard that - // is used by IE11: - // https://www.w3.org/TR/2013/WD-WebCryptoAPI-20130108/#cryptooperation-interface - const buf = await crypto.subtle.digest('SHA-256', bytes); - const arr = Array.from(new Uint8Array(buf)); - return arr.map(num => num.toString(16).padStart(2, '0')).join(''); -} -function stringToArrayBuffer(str) { - // This function is only meant to deal with an ASCII charset and makes - // certain simplifying assumptions. - debugAssert(/[0-9a-zA-Z]+/.test(str), 'Can only convert alpha-numeric strings'); - if (typeof TextEncoder !== 'undefined') { - return new TextEncoder().encode(str); - } - const buff = new ArrayBuffer(str.length); - const view = new Uint8Array(buff); - for (let i = 0; i < str.length; i++) { - view[i] = str.charCodeAt(i); - } - return view; -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const SESSION_ID_LENGTH = 20; -/** Custom AuthEventManager that adds passive listeners to events */ -class CordovaAuthEventManager extends AuthEventManager { - constructor() { - super(...arguments); - this.passiveListeners = new Set(); - this.initPromise = new Promise(resolve => { - this.resolveInitialized = resolve; - }); - } - addPassiveListener(cb) { - this.passiveListeners.add(cb); - } - removePassiveListener(cb) { - this.passiveListeners.delete(cb); - } - // In a Cordova environment, this manager can live through multiple redirect - // operations - resetRedirect() { - this.queuedRedirectEvent = null; - this.hasHandledPotentialRedirect = false; - } - /** Override the onEvent method */ - onEvent(event) { - this.resolveInitialized(); - this.passiveListeners.forEach(cb => cb(event)); - return super.onEvent(event); - } - async initialized() { - await this.initPromise; - } -} -/** - * Generates a (partial) {@link AuthEvent}. - */ -function _generateNewEvent(auth, type, eventId = null) { - return { - type, - eventId, - urlResponse: null, - sessionId: generateSessionId(), - postBody: null, - tenantId: auth.tenantId, - error: _createError(auth, "no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */) - }; -} -function _savePartialEvent(auth, event) { - return storage()._set(persistenceKey(auth), event); -} -async function _getAndRemoveEvent(auth) { - const event = (await storage()._get(persistenceKey(auth))); - if (event) { - await storage()._remove(persistenceKey(auth)); - } - return event; -} -function _eventFromPartialAndUrl(partialEvent, url) { - // Parse the deep link within the dynamic link URL. - const callbackUrl = _getDeepLinkFromCallback(url); - // Confirm it is actually a callback URL. - // Currently the universal link will be of this format: - // https://<AUTH_DOMAIN>/__/auth/callback<OAUTH_RESPONSE> - // This is a fake URL but is not intended to take the user anywhere - // and just redirect to the app. - if (callbackUrl.includes('/__/auth/callback')) { - // Check if there is an error in the URL. - // This mechanism is also used to pass errors back to the app: - // https://<AUTH_DOMAIN>/__/auth/callback?firebaseError=<STRINGIFIED_ERROR> - const params = searchParamsOrEmpty(callbackUrl); - // Get the error object corresponding to the stringified error if found. - const errorObject = params['firebaseError'] - ? parseJsonOrNull(decodeURIComponent(params['firebaseError'])) - : null; - const code = errorObject?.['code']?.split('auth/')?.[1]; - const error = code ? _createError(code) : null; - if (error) { - return { - type: partialEvent.type, - eventId: partialEvent.eventId, - tenantId: partialEvent.tenantId, - error, - urlResponse: null, - sessionId: null, - postBody: null - }; - } - else { - return { - type: partialEvent.type, - eventId: partialEvent.eventId, - tenantId: partialEvent.tenantId, - sessionId: partialEvent.sessionId, - urlResponse: callbackUrl, - postBody: null - }; - } - } - return null; -} -function generateSessionId() { - const chars = []; - const allowedChars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; - for (let i = 0; i < SESSION_ID_LENGTH; i++) { - const idx = Math.floor(Math.random() * allowedChars.length); - chars.push(allowedChars.charAt(idx)); - } - return chars.join(''); -} -function storage() { - return _getInstance(browserLocalPersistence); -} -function persistenceKey(auth) { - return _persistenceKeyName("authEvent" /* KeyName.AUTH_EVENT */, auth.config.apiKey, auth.name); -} -function parseJsonOrNull(json) { - try { - return JSON.parse(json); - } - catch (e) { - return null; - } -} -// Exported for testing -function _getDeepLinkFromCallback(url) { - const params = searchParamsOrEmpty(url); - const link = params['link'] ? decodeURIComponent(params['link']) : undefined; - // Double link case (automatic redirect) - const doubleDeepLink = searchParamsOrEmpty(link)['link']; - // iOS custom scheme links. - const iOSDeepLink = params['deep_link_id'] - ? decodeURIComponent(params['deep_link_id']) - : undefined; - const iOSDoubleDeepLink = searchParamsOrEmpty(iOSDeepLink)['link']; - return iOSDoubleDeepLink || iOSDeepLink || doubleDeepLink || link || url; -} -/** - * Optimistically tries to get search params from a string, or else returns an - * empty search params object. - */ -function searchParamsOrEmpty(url) { - if (!url?.includes('?')) { - return {}; - } - const [_, ...rest] = url.split('?'); - return querystringDecode(rest.join('?')); -} - -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * How long to wait for the initial auth event before concluding no - * redirect pending - */ -const INITIAL_EVENT_TIMEOUT_MS = 500; -class CordovaPopupRedirectResolver { - constructor() { - this._redirectPersistence = browserSessionPersistence; - this._shouldInitProactively = true; // This is lightweight for Cordova - this.eventManagers = new Map(); - this.originValidationPromises = {}; - this._completeRedirectFn = _getRedirectResult; - this._overrideRedirectResult = _overrideRedirectResult; - } - async _initialize(auth) { - const key = auth._key(); - let manager = this.eventManagers.get(key); - if (!manager) { - manager = new CordovaAuthEventManager(auth); - this.eventManagers.set(key, manager); - this.attachCallbackListeners(auth, manager); - } - return manager; - } - _openPopup(auth) { - _fail(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */); - } - async _openRedirect(auth, provider, authType, eventId) { - _checkCordovaConfiguration(auth); - const manager = await this._initialize(auth); - await manager.initialized(); - // Reset the persisted redirect states. This does not matter on Web where - // the redirect always blows away application state entirely. On Cordova, - // the app maintains control flow through the redirect. - manager.resetRedirect(); - _clearRedirectOutcomes(); - await this._originValidation(auth); - const event = _generateNewEvent(auth, authType, eventId); - await _savePartialEvent(auth, event); - const url = await _generateHandlerUrl(auth, event, provider); - const iabRef = await _performRedirect(url); - return _waitForAppResume(auth, manager, iabRef); - } - _isIframeWebStorageSupported(_auth, _cb) { - throw new Error('Method not implemented.'); - } - _originValidation(auth) { - const key = auth._key(); - if (!this.originValidationPromises[key]) { - this.originValidationPromises[key] = _validateOrigin(auth); - } - return this.originValidationPromises[key]; - } - attachCallbackListeners(auth, manager) { - // Get the global plugins - const { universalLinks, handleOpenURL, BuildInfo } = _cordovaWindow(); - const noEventTimeout = setTimeout(async () => { - // We didn't see that initial event. Clear any pending object and - // dispatch no event - await _getAndRemoveEvent(auth); - manager.onEvent(generateNoEvent()); - }, INITIAL_EVENT_TIMEOUT_MS); - const universalLinksCb = async (eventData) => { - // We have an event so we can clear the no event timeout - clearTimeout(noEventTimeout); - const partialEvent = await _getAndRemoveEvent(auth); - let finalEvent = null; - if (partialEvent && eventData?.['url']) { - finalEvent = _eventFromPartialAndUrl(partialEvent, eventData['url']); - } - // If finalEvent is never filled, trigger with no event - manager.onEvent(finalEvent || generateNoEvent()); - }; - // Universal links subscriber doesn't exist for iOS, so we need to check - if (typeof universalLinks !== 'undefined' && - typeof universalLinks.subscribe === 'function') { - universalLinks.subscribe(null, universalLinksCb); - } - // iOS 7 or 8 custom URL schemes. - // This is also the current default behavior for iOS 9+. - // For this to work, cordova-plugin-customurlscheme needs to be installed. - // https://github.com/EddyVerbruggen/Custom-URL-scheme - // Do not overwrite the existing developer's URL handler. - const existingHandleOpenURL = handleOpenURL; - const packagePrefix = `${BuildInfo.packageName.toLowerCase()}://`; - _cordovaWindow().handleOpenURL = async (url) => { - if (url.toLowerCase().startsWith(packagePrefix)) { - // We want this intentionally to float - // eslint-disable-next-line @typescript-eslint/no-floating-promises - universalLinksCb({ url }); - } - // Call the developer's handler if it is present. - if (typeof existingHandleOpenURL === 'function') { - try { - existingHandleOpenURL(url); - } - catch (e) { - // This is a developer error. Don't stop the flow of the SDK. - console.error(e); - } - } - }; - } -} -/** - * An implementation of {@link PopupRedirectResolver} suitable for Cordova - * based applications. - * - * @public - */ -const cordovaPopupRedirectResolver = CordovaPopupRedirectResolver; -function generateNoEvent() { - return { - type: "unknown" /* AuthEventType.UNKNOWN */, - eventId: null, - sessionId: null, - urlResponse: null, - postBody: null, - tenantId: null, - error: _createError("no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */) - }; -} - -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// This function should only be called by frameworks (e.g. FirebaseUI-web) to log their usage. -// It is not intended for direct use by developer apps. NO jsdoc here to intentionally leave it out -// of autogenerated documentation pages to reduce accidental misuse. -function addFrameworkForLogging(auth, framework) { - _castAuth(auth)._logFramework(framework); -} - -export { ActionCodeOperation, AuthPopup, FactorId, OperationType, PhoneAuthProvider, PhoneMultiFactorGenerator, ProviderId, RecaptchaVerifier, SignInMethod, _getRedirectResult, _overrideRedirectResult, addFrameworkForLogging, browserCookiePersistence, browserLocalPersistence, browserPopupRedirectResolver, browserSessionPersistence, cordovaPopupRedirectResolver, getAuth, getRedirectResult, linkWithPhoneNumber, linkWithPopup, linkWithRedirect, reauthenticateWithPhoneNumber, reauthenticateWithPopup, reauthenticateWithRedirect, signInWithPhoneNumber, signInWithPopup, signInWithRedirect, updatePhoneNumber }; -//# sourceMappingURL=internal.js.map diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/internal.js.map b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/internal.js.map deleted file mode 100644 index c7db381..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/internal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"internal.js","sources":["../../src/model/enum_maps.ts","../../src/platform_browser/persistence/browser.ts","../../src/platform_browser/persistence/local_storage.ts","../../src/platform_browser/persistence/cookie_storage.ts","../../src/platform_browser/persistence/session_storage.ts","../../src/platform_browser/recaptcha/recaptcha_loader.ts","../../src/platform_browser/recaptcha/recaptcha_verifier.ts","../../src/platform_browser/strategies/phone.ts","../../src/platform_browser/providers/phone.ts","../../src/core/util/resolver.ts","../../src/core/strategies/idp.ts","../../src/core/strategies/abstract_popup_redirect_operation.ts","../../src/platform_browser/strategies/popup.ts","../../src/core/strategies/redirect.ts","../../src/platform_browser/strategies/redirect.ts","../../src/core/auth/auth_event_manager.ts","../../src/api/project_config/get_project_config.ts","../../src/core/util/validate_origin.ts","../../src/platform_browser/iframe/gapi.ts","../../src/platform_browser/iframe/iframe.ts","../../src/platform_browser/util/popup.ts","../../src/core/util/handler.ts","../../src/platform_browser/popup_redirect.ts","../../src/platform_browser/mfa/assertions/phone.ts","../../src/platform_browser/index.ts","../../src/platform_cordova/plugins.ts","../../src/platform_cordova/popup_redirect/utils.ts","../../src/platform_cordova/popup_redirect/events.ts","../../src/platform_cordova/popup_redirect/popup_redirect.ts","../../internal/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * An enum of factors that may be used for multifactor authentication.\n *\n * @public\n */\nexport const FactorId = {\n /** Phone as second factor */\n PHONE: 'phone',\n TOTP: 'totp'\n} as const;\n\n/**\n * Enumeration of supported providers.\n *\n * @public\n */\nexport const ProviderId = {\n /** Facebook provider ID */\n FACEBOOK: 'facebook.com',\n /** GitHub provider ID */\n GITHUB: 'github.com',\n /** Google provider ID */\n GOOGLE: 'google.com',\n /** Password provider */\n PASSWORD: 'password',\n /** Phone provider */\n PHONE: 'phone',\n /** Twitter provider ID */\n TWITTER: 'twitter.com'\n} as const;\n\n/**\n * Enumeration of supported sign-in methods.\n *\n * @public\n */\nexport const SignInMethod = {\n /** Email link sign in method */\n EMAIL_LINK: 'emailLink',\n /** Email/password sign in method */\n EMAIL_PASSWORD: 'password',\n /** Facebook sign in method */\n FACEBOOK: 'facebook.com',\n /** GitHub sign in method */\n GITHUB: 'github.com',\n /** Google sign in method */\n GOOGLE: 'google.com',\n /** Phone sign in method */\n PHONE: 'phone',\n /** Twitter sign in method */\n TWITTER: 'twitter.com'\n} as const;\n\n/**\n * Enumeration of supported operation types.\n *\n * @public\n */\nexport const OperationType = {\n /** Operation involving linking an additional provider to an already signed-in user. */\n LINK: 'link',\n /** Operation involving using a provider to reauthenticate an already signed-in user. */\n REAUTHENTICATE: 'reauthenticate',\n /** Operation involving signing in a user. */\n SIGN_IN: 'signIn'\n} as const;\n\n/**\n * An enumeration of the possible email action types.\n *\n * @public\n */\nexport const ActionCodeOperation = {\n /** The email link sign-in action. */\n EMAIL_SIGNIN: 'EMAIL_SIGNIN',\n /** The password reset action. */\n PASSWORD_RESET: 'PASSWORD_RESET',\n /** The email revocation action. */\n RECOVER_EMAIL: 'RECOVER_EMAIL',\n /** The revert second factor addition email action. */\n REVERT_SECOND_FACTOR_ADDITION: 'REVERT_SECOND_FACTOR_ADDITION',\n /** The revert second factor addition email action. */\n VERIFY_AND_CHANGE_EMAIL: 'VERIFY_AND_CHANGE_EMAIL',\n /** The email verification action. */\n VERIFY_EMAIL: 'VERIFY_EMAIL'\n} as const;\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n PersistenceValue,\n STORAGE_AVAILABLE_KEY,\n PersistenceType\n} from '../../core/persistence';\n\n// There are two different browser persistence types: local and session.\n// Both have the same implementation but use a different underlying storage\n// object.\n\nexport abstract class BrowserPersistenceClass {\n protected constructor(\n protected readonly storageRetriever: () => Storage,\n readonly type: PersistenceType\n ) {}\n\n _isAvailable(): Promise<boolean> {\n try {\n if (!this.storage) {\n return Promise.resolve(false);\n }\n this.storage.setItem(STORAGE_AVAILABLE_KEY, '1');\n this.storage.removeItem(STORAGE_AVAILABLE_KEY);\n return Promise.resolve(true);\n } catch {\n return Promise.resolve(false);\n }\n }\n\n _set(key: string, value: PersistenceValue): Promise<void> {\n this.storage.setItem(key, JSON.stringify(value));\n return Promise.resolve();\n }\n\n _get<T extends PersistenceValue>(key: string): Promise<T | null> {\n const json = this.storage.getItem(key);\n return Promise.resolve(json ? JSON.parse(json) : null);\n }\n\n _remove(key: string): Promise<void> {\n this.storage.removeItem(key);\n return Promise.resolve();\n }\n\n protected get storage(): Storage {\n return this.storageRetriever();\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Persistence } from '../../model/public_types';\n\nimport { _isMobileBrowser, _isIE10 } from '../../core/util/browser';\nimport {\n PersistenceInternal as InternalPersistence,\n PersistenceType,\n PersistenceValue,\n StorageEventListener\n} from '../../core/persistence';\nimport { BrowserPersistenceClass } from './browser';\n\n// The polling period in case events are not supported\nexport const _POLLING_INTERVAL_MS = 1000;\n\n// The IE 10 localStorage cross tab synchronization delay in milliseconds\nconst IE10_LOCAL_STORAGE_SYNC_DELAY = 10;\n\nclass BrowserLocalPersistence\n extends BrowserPersistenceClass\n implements InternalPersistence\n{\n static type: 'LOCAL' = 'LOCAL';\n\n constructor() {\n super(() => window.localStorage, PersistenceType.LOCAL);\n }\n\n private readonly boundEventHandler = (\n event: StorageEvent,\n poll?: boolean\n ): void => this.onStorageEvent(event, poll);\n private readonly listeners: Record<string, Set<StorageEventListener>> = {};\n private readonly localCache: Record<string, string | null> = {};\n // setTimeout return value is platform specific\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private pollTimer: any | null = null;\n\n // Whether to use polling instead of depending on window events\n private readonly fallbackToPolling = _isMobileBrowser();\n readonly _shouldAllowMigration = true;\n\n private forAllChangedKeys(\n cb: (key: string, oldValue: string | null, newValue: string | null) => void\n ): void {\n // Check all keys with listeners on them.\n for (const key of Object.keys(this.listeners)) {\n // Get value from localStorage.\n const newValue = this.storage.getItem(key);\n const oldValue = this.localCache[key];\n // If local map value does not match, trigger listener with storage event.\n // Differentiate this simulated event from the real storage event.\n if (newValue !== oldValue) {\n cb(key, oldValue, newValue);\n }\n }\n }\n\n private onStorageEvent(event: StorageEvent, poll = false): void {\n // Key would be null in some situations, like when localStorage is cleared\n if (!event.key) {\n this.forAllChangedKeys(\n (key: string, _oldValue: string | null, newValue: string | null) => {\n this.notifyListeners(key, newValue);\n }\n );\n return;\n }\n\n const key = event.key;\n\n // Check the mechanism how this event was detected.\n // The first event will dictate the mechanism to be used.\n if (poll) {\n // Environment detects storage changes via polling.\n // Remove storage event listener to prevent possible event duplication.\n this.detachListener();\n } else {\n // Environment detects storage changes via storage event listener.\n // Remove polling listener to prevent possible event duplication.\n this.stopPolling();\n }\n\n const triggerListeners = (): void => {\n // Keep local map up to date in case storage event is triggered before\n // poll.\n const storedValue = this.storage.getItem(key);\n if (!poll && this.localCache[key] === storedValue) {\n // Real storage event which has already been detected, do nothing.\n // This seems to trigger in some IE browsers for some reason.\n return;\n }\n this.notifyListeners(key, storedValue);\n };\n\n const storedValue = this.storage.getItem(key);\n if (\n _isIE10() &&\n storedValue !== event.newValue &&\n event.newValue !== event.oldValue\n ) {\n // IE 10 has this weird bug where a storage event would trigger with the\n // correct key, oldValue and newValue but localStorage.getItem(key) does\n // not yield the updated value until a few milliseconds. This ensures\n // this recovers from that situation.\n setTimeout(triggerListeners, IE10_LOCAL_STORAGE_SYNC_DELAY);\n } else {\n triggerListeners();\n }\n }\n\n private notifyListeners(key: string, value: string | null): void {\n this.localCache[key] = value;\n const listeners = this.listeners[key];\n if (listeners) {\n for (const listener of Array.from(listeners)) {\n listener(value ? JSON.parse(value) : value);\n }\n }\n }\n\n private startPolling(): void {\n this.stopPolling();\n\n this.pollTimer = setInterval(() => {\n this.forAllChangedKeys(\n (key: string, oldValue: string | null, newValue: string | null) => {\n this.onStorageEvent(\n new StorageEvent('storage', {\n key,\n oldValue,\n newValue\n }),\n /* poll */ true\n );\n }\n );\n }, _POLLING_INTERVAL_MS);\n }\n\n private stopPolling(): void {\n if (this.pollTimer) {\n clearInterval(this.pollTimer);\n this.pollTimer = null;\n }\n }\n\n private attachListener(): void {\n window.addEventListener('storage', this.boundEventHandler);\n }\n\n private detachListener(): void {\n window.removeEventListener('storage', this.boundEventHandler);\n }\n\n _addListener(key: string, listener: StorageEventListener): void {\n if (Object.keys(this.listeners).length === 0) {\n // Whether browser can detect storage event when it had already been pushed to the background.\n // This may happen in some mobile browsers. A localStorage change in the foreground window\n // will not be detected in the background window via the storage event.\n // This was detected in iOS 7.x mobile browsers\n if (this.fallbackToPolling) {\n this.startPolling();\n } else {\n this.attachListener();\n }\n }\n if (!this.listeners[key]) {\n this.listeners[key] = new Set();\n // Populate the cache to avoid spuriously triggering on first poll.\n this.localCache[key] = this.storage.getItem(key);\n }\n this.listeners[key].add(listener);\n }\n\n _removeListener(key: string, listener: StorageEventListener): void {\n if (this.listeners[key]) {\n this.listeners[key].delete(listener);\n\n if (this.listeners[key].size === 0) {\n delete this.listeners[key];\n }\n }\n\n if (Object.keys(this.listeners).length === 0) {\n this.detachListener();\n this.stopPolling();\n }\n }\n\n // Update local cache on base operations:\n\n async _set(key: string, value: PersistenceValue): Promise<void> {\n await super._set(key, value);\n this.localCache[key] = JSON.stringify(value);\n }\n\n async _get<T extends PersistenceValue>(key: string): Promise<T | null> {\n const value = await super._get<T>(key);\n this.localCache[key] = JSON.stringify(value);\n return value;\n }\n\n async _remove(key: string): Promise<void> {\n await super._remove(key);\n delete this.localCache[key];\n }\n}\n\n/**\n * An implementation of {@link Persistence} of type `LOCAL` using `localStorage`\n * for the underlying storage.\n *\n * @public\n */\nexport const browserLocalPersistence: Persistence = BrowserLocalPersistence;\n","/**\n * @license\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Persistence } from '../../model/public_types';\nimport type { CookieChangeEvent } from 'cookie-store';\n\nconst POLLING_INTERVAL_MS = 1_000;\n\nimport {\n PersistenceInternal,\n PersistenceType,\n PersistenceValue,\n StorageEventListener\n} from '../../core/persistence';\n\n// Pull a cookie value from document.cookie\nfunction getDocumentCookie(name: string): string | null {\n const escapedName = name.replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&');\n const matcher = RegExp(`${escapedName}=([^;]+)`);\n return document.cookie.match(matcher)?.[1] ?? null;\n}\n\n// Produce a sanitized cookie name from the persistence key\nfunction getCookieName(key: string): string {\n // __HOST- doesn't work in localhost https://issues.chromium.org/issues/40196122 but it has\n // desirable security properties, so lets use a different cookie name while in dev-mode.\n // Already checked isSecureContext in _isAvailable, so if it's http we're hitting local.\n const isDevMode = window.location.protocol === 'http:';\n return `${isDevMode ? '__dev_' : '__HOST-'}FIREBASE_${key.split(':')[3]}`;\n}\n\nexport class CookiePersistence implements PersistenceInternal {\n static type: 'COOKIE' = 'COOKIE';\n readonly type = PersistenceType.COOKIE;\n listenerUnsubscribes: Map<StorageEventListener, () => void> = new Map();\n\n // used to get the URL to the backend to proxy to\n _getFinalTarget(originalUrl: string): URL | string {\n if (typeof window === undefined) {\n return originalUrl;\n }\n const url = new URL(`${window.location.origin}/__cookies__`);\n url.searchParams.set('finalTarget', originalUrl);\n return url;\n }\n\n // To be a usable persistence method in a chain browserCookiePersistence ensures that\n // prerequisites have been met, namely that we're in a secureContext, navigator and document are\n // available and cookies are enabled. Not all UAs support these method, so fallback accordingly.\n async _isAvailable(): Promise<boolean> {\n if (typeof isSecureContext === 'boolean' && !isSecureContext) {\n return false;\n }\n if (typeof navigator === 'undefined' || typeof document === 'undefined') {\n return false;\n }\n return navigator.cookieEnabled ?? true;\n }\n\n // Set should be a noop as we expect middleware to handle this\n async _set(_key: string, _value: PersistenceValue): Promise<void> {\n return;\n }\n\n // Attempt to get the cookie from cookieStore, fallback to document.cookie\n async _get<T extends PersistenceValue>(key: string): Promise<T | null> {\n if (!this._isAvailable()) {\n return null;\n }\n const name = getCookieName(key);\n if (window.cookieStore) {\n const cookie = await window.cookieStore.get(name);\n return cookie?.value as T;\n }\n return getDocumentCookie(name) as T;\n }\n\n // Log out by overriding the idToken with a sentinel value of \"\"\n async _remove(key: string): Promise<void> {\n if (!this._isAvailable()) {\n return;\n }\n // To make sure we don't hit signout over and over again, only do this operation if we need to\n // with the logout sentinel value of \"\" this can cause race conditions. Unnecessary set-cookie\n // headers will reduce CDN hit rates too.\n const existingValue = await this._get(key);\n if (!existingValue) {\n return;\n }\n const name = getCookieName(key);\n document.cookie = `${name}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;Priority=High`;\n await fetch(`/__cookies__`, { method: 'DELETE' }).catch(() => undefined);\n }\n\n // Listen for cookie changes, both cookieStore and fallback to polling document.cookie\n _addListener(key: string, listener: StorageEventListener): void {\n if (!this._isAvailable()) {\n return;\n }\n const name = getCookieName(key);\n if (window.cookieStore) {\n const cb = ((event: CookieChangeEvent): void => {\n const changedCookie = event.changed.find(\n change => change.name === name\n );\n if (changedCookie) {\n listener(changedCookie.value as PersistenceValue);\n }\n const deletedCookie = event.deleted.find(\n change => change.name === name\n );\n if (deletedCookie) {\n listener(null);\n }\n }) as EventListener;\n const unsubscribe = (): void =>\n window.cookieStore.removeEventListener('change', cb);\n this.listenerUnsubscribes.set(listener, unsubscribe);\n return window.cookieStore.addEventListener('change', cb as EventListener);\n }\n let lastValue = getDocumentCookie(name);\n const interval = setInterval(() => {\n const currentValue = getDocumentCookie(name);\n if (currentValue !== lastValue) {\n listener(currentValue as PersistenceValue | null);\n lastValue = currentValue;\n }\n }, POLLING_INTERVAL_MS);\n const unsubscribe = (): void => clearInterval(interval);\n this.listenerUnsubscribes.set(listener, unsubscribe);\n }\n\n _removeListener(_key: string, listener: StorageEventListener): void {\n const unsubscribe = this.listenerUnsubscribes.get(listener);\n if (!unsubscribe) {\n return;\n }\n unsubscribe();\n this.listenerUnsubscribes.delete(listener);\n }\n}\n\n/**\n * An implementation of {@link Persistence} of type `COOKIE`, for use on the client side in\n * applications leveraging hybrid rendering and middleware.\n *\n * @remarks This persistence method requires companion middleware to function, such as that provided\n * by {@link https://firebaseopensource.com/projects/firebaseextended/reactfire/ | ReactFire} for\n * NextJS.\n * @beta\n */\nexport const browserCookiePersistence: Persistence = CookiePersistence;\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Persistence } from '../../model/public_types';\n\nimport {\n PersistenceInternal as InternalPersistence,\n PersistenceType,\n StorageEventListener\n} from '../../core/persistence';\nimport { BrowserPersistenceClass } from './browser';\n\nclass BrowserSessionPersistence\n extends BrowserPersistenceClass\n implements InternalPersistence\n{\n static type: 'SESSION' = 'SESSION';\n\n constructor() {\n super(() => window.sessionStorage, PersistenceType.SESSION);\n }\n\n _addListener(_key: string, _listener: StorageEventListener): void {\n // Listeners are not supported for session storage since it cannot be shared across windows\n return;\n }\n\n _removeListener(_key: string, _listener: StorageEventListener): void {\n // Listeners are not supported for session storage since it cannot be shared across windows\n return;\n }\n}\n\n/**\n * An implementation of {@link Persistence} of `SESSION` using `sessionStorage`\n * for the underlying storage.\n *\n * @public\n */\nexport const browserSessionPersistence: Persistence = BrowserSessionPersistence;\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { querystring } from '@firebase/util';\n\nimport { AuthErrorCode } from '../../core/errors';\nimport { _assert, _createError } from '../../core/util/assert';\nimport { Delay } from '../../core/util/delay';\nimport { AuthInternal } from '../../model/auth';\nimport { _window } from '../auth_window';\nimport * as jsHelpers from '../load_js';\nimport { Recaptcha, isV2 } from './recaptcha';\nimport { MockReCaptcha } from './recaptcha_mock';\n\n// ReCaptcha will load using the same callback, so the callback function needs\n// to be kept around\nexport const _JSLOAD_CALLBACK = jsHelpers._generateCallbackName('rcb');\nconst NETWORK_TIMEOUT_DELAY = new Delay(30000, 60000);\n\n/**\n * We need to mark this interface as internal explicitly to exclude it in the public typings, because\n * it references AuthInternal which has a circular dependency with UserInternal.\n *\n * @internal\n */\nexport interface ReCaptchaLoader {\n load(auth: AuthInternal, hl?: string): Promise<Recaptcha>;\n clearedOneInstance(): void;\n}\n\n/**\n * Loader for the GReCaptcha library. There should only ever be one of this.\n */\nexport class ReCaptchaLoaderImpl implements ReCaptchaLoader {\n private hostLanguage = '';\n private counter = 0;\n /**\n * Check for `render()` method. `window.grecaptcha` will exist if the Enterprise\n * version of the ReCAPTCHA script was loaded by someone else (e.g. App Check) but\n * `window.grecaptcha.render()` will not. Another load will add it.\n */\n private readonly librarySeparatelyLoaded = !!_window().grecaptcha?.render;\n\n load(auth: AuthInternal, hl = ''): Promise<Recaptcha> {\n _assert(isHostLanguageValid(hl), auth, AuthErrorCode.ARGUMENT_ERROR);\n\n if (this.shouldResolveImmediately(hl) && isV2(_window().grecaptcha)) {\n return Promise.resolve(_window().grecaptcha! as Recaptcha);\n }\n return new Promise<Recaptcha>((resolve, reject) => {\n const networkTimeout = _window().setTimeout(() => {\n reject(_createError(auth, AuthErrorCode.NETWORK_REQUEST_FAILED));\n }, NETWORK_TIMEOUT_DELAY.get());\n\n _window()[_JSLOAD_CALLBACK] = () => {\n _window().clearTimeout(networkTimeout);\n delete _window()[_JSLOAD_CALLBACK];\n\n const recaptcha = _window().grecaptcha as Recaptcha;\n\n if (!recaptcha || !isV2(recaptcha)) {\n reject(_createError(auth, AuthErrorCode.INTERNAL_ERROR));\n return;\n }\n\n // Wrap the recaptcha render function so that we know if the developer has\n // called it separately\n const render = recaptcha.render;\n recaptcha.render = (container, params) => {\n const widgetId = render(container, params);\n this.counter++;\n return widgetId;\n };\n\n this.hostLanguage = hl;\n resolve(recaptcha);\n };\n\n const url = `${jsHelpers._recaptchaV2ScriptUrl()}?${querystring({\n onload: _JSLOAD_CALLBACK,\n render: 'explicit',\n hl\n })}`;\n\n jsHelpers._loadJS(url).catch(() => {\n clearTimeout(networkTimeout);\n reject(_createError(auth, AuthErrorCode.INTERNAL_ERROR));\n });\n });\n }\n\n clearedOneInstance(): void {\n this.counter--;\n }\n\n private shouldResolveImmediately(hl: string): boolean {\n // We can resolve immediately if:\n // • grecaptcha is already defined AND (\n // 1. the requested language codes are the same OR\n // 2. there exists already a ReCaptcha on the page\n // 3. the library was already loaded by the app\n // In cases (2) and (3), we _can't_ reload as it would break the recaptchas\n // that are already in the page\n return (\n !!_window().grecaptcha?.render &&\n (hl === this.hostLanguage ||\n this.counter > 0 ||\n this.librarySeparatelyLoaded)\n );\n }\n}\n\nfunction isHostLanguageValid(hl: string): boolean {\n return hl.length <= 6 && /^\\s*[a-zA-Z0-9\\-]*\\s*$/.test(hl);\n}\n\nexport class MockReCaptchaLoaderImpl implements ReCaptchaLoader {\n async load(auth: AuthInternal): Promise<Recaptcha> {\n return new MockReCaptcha(auth);\n }\n\n clearedOneInstance(): void {}\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Auth, RecaptchaParameters } from '../../model/public_types';\nimport { getRecaptchaParams } from '../../api/authentication/recaptcha';\nimport { _castAuth } from '../../core/auth/auth_impl';\nimport { AuthErrorCode } from '../../core/errors';\nimport { _assert } from '../../core/util/assert';\nimport { _isHttpOrHttps } from '../../core/util/location';\nimport { ApplicationVerifierInternal } from '../../model/application_verifier';\nimport { AuthInternal } from '../../model/auth';\nimport { _window } from '../auth_window';\nimport { _isWorker } from '../util/worker';\nimport { Recaptcha } from './recaptcha';\nimport {\n MockReCaptchaLoaderImpl,\n ReCaptchaLoader,\n ReCaptchaLoaderImpl\n} from './recaptcha_loader';\n\nexport const RECAPTCHA_VERIFIER_TYPE = 'recaptcha';\n\nconst DEFAULT_PARAMS: RecaptchaParameters = {\n theme: 'light',\n type: 'image'\n};\n\ntype TokenCallback = (token: string) => void;\n\n/**\n * An {@link https://www.google.com/recaptcha/ | reCAPTCHA}-based application verifier.\n *\n * @remarks\n * `RecaptchaVerifier` does not work in a Node.js environment.\n *\n * @public\n */\nexport class RecaptchaVerifier implements ApplicationVerifierInternal {\n /**\n * The application verifier type.\n *\n * @remarks\n * For a reCAPTCHA verifier, this is 'recaptcha'.\n */\n readonly type = RECAPTCHA_VERIFIER_TYPE;\n private destroyed = false;\n private widgetId: number | null = null;\n private readonly container: HTMLElement;\n private readonly isInvisible: boolean;\n private readonly tokenChangeListeners = new Set<TokenCallback>();\n private renderPromise: Promise<number> | null = null;\n private readonly auth: AuthInternal;\n\n /** @internal */\n readonly _recaptchaLoader: ReCaptchaLoader;\n private recaptcha: Recaptcha | null = null;\n\n /**\n * @param authExtern - The corresponding Firebase {@link Auth} instance.\n *\n * @param containerOrId - The reCAPTCHA container parameter.\n *\n * @remarks\n * This has different meaning depending on whether the reCAPTCHA is hidden or visible. For a\n * visible reCAPTCHA the container must be empty. If a string is used, it has to correspond to\n * an element ID. The corresponding element must also must be in the DOM at the time of\n * initialization.\n *\n * @param parameters - The optional reCAPTCHA parameters.\n *\n * @remarks\n * Check the reCAPTCHA docs for a comprehensive list. All parameters are accepted except for\n * the sitekey. Firebase Auth backend provisions a reCAPTCHA for each project and will\n * configure this upon rendering. For an invisible reCAPTCHA, a size key must have the value\n * 'invisible'.\n */\n constructor(\n authExtern: Auth,\n containerOrId: HTMLElement | string,\n private readonly parameters: RecaptchaParameters = {\n ...DEFAULT_PARAMS\n }\n ) {\n this.auth = _castAuth(authExtern);\n this.isInvisible = this.parameters.size === 'invisible';\n _assert(\n typeof document !== 'undefined',\n this.auth,\n AuthErrorCode.OPERATION_NOT_SUPPORTED\n );\n const container =\n typeof containerOrId === 'string'\n ? document.getElementById(containerOrId)\n : containerOrId;\n _assert(container, this.auth, AuthErrorCode.ARGUMENT_ERROR);\n\n this.container = container;\n this.parameters.callback = this.makeTokenCallback(this.parameters.callback);\n\n this._recaptchaLoader = this.auth.settings.appVerificationDisabledForTesting\n ? new MockReCaptchaLoaderImpl()\n : new ReCaptchaLoaderImpl();\n\n this.validateStartingState();\n // TODO: Figure out if sdk version is needed\n }\n\n /**\n * Waits for the user to solve the reCAPTCHA and resolves with the reCAPTCHA token.\n *\n * @returns A Promise for the reCAPTCHA token.\n */\n async verify(): Promise<string> {\n this.assertNotDestroyed();\n const id = await this.render();\n const recaptcha = this.getAssertedRecaptcha();\n\n const response = recaptcha.getResponse(id);\n if (response) {\n return response;\n }\n\n return new Promise<string>(resolve => {\n const tokenChange = (token: string): void => {\n if (!token) {\n return; // Ignore token expirations.\n }\n this.tokenChangeListeners.delete(tokenChange);\n resolve(token);\n };\n\n this.tokenChangeListeners.add(tokenChange);\n if (this.isInvisible) {\n recaptcha.execute(id);\n }\n });\n }\n\n /**\n * Renders the reCAPTCHA widget on the page.\n *\n * @returns A Promise that resolves with the reCAPTCHA widget ID.\n */\n render(): Promise<number> {\n try {\n this.assertNotDestroyed();\n } catch (e) {\n // This method returns a promise. Since it's not async (we want to return the\n // _same_ promise if rendering is still occurring), the API surface should\n // reject with the error rather than just throw\n return Promise.reject(e);\n }\n\n if (this.renderPromise) {\n return this.renderPromise;\n }\n\n this.renderPromise = this.makeRenderPromise().catch(e => {\n this.renderPromise = null;\n throw e;\n });\n\n return this.renderPromise;\n }\n\n /** @internal */\n _reset(): void {\n this.assertNotDestroyed();\n if (this.widgetId !== null) {\n this.getAssertedRecaptcha().reset(this.widgetId);\n }\n }\n\n /**\n * Clears the reCAPTCHA widget from the page and destroys the instance.\n */\n clear(): void {\n this.assertNotDestroyed();\n this.destroyed = true;\n this._recaptchaLoader.clearedOneInstance();\n if (!this.isInvisible) {\n this.container.childNodes.forEach(node => {\n this.container.removeChild(node);\n });\n }\n }\n\n private validateStartingState(): void {\n _assert(!this.parameters.sitekey, this.auth, AuthErrorCode.ARGUMENT_ERROR);\n _assert(\n this.isInvisible || !this.container.hasChildNodes(),\n this.auth,\n AuthErrorCode.ARGUMENT_ERROR\n );\n _assert(\n typeof document !== 'undefined',\n this.auth,\n AuthErrorCode.OPERATION_NOT_SUPPORTED\n );\n }\n\n private makeTokenCallback(\n existing: TokenCallback | string | undefined\n ): TokenCallback {\n return token => {\n this.tokenChangeListeners.forEach(listener => listener(token));\n if (typeof existing === 'function') {\n existing(token);\n } else if (typeof existing === 'string') {\n const globalFunc = _window()[existing];\n if (typeof globalFunc === 'function') {\n globalFunc(token);\n }\n }\n };\n }\n\n private assertNotDestroyed(): void {\n _assert(!this.destroyed, this.auth, AuthErrorCode.INTERNAL_ERROR);\n }\n\n private async makeRenderPromise(): Promise<number> {\n await this.init();\n if (!this.widgetId) {\n let container = this.container;\n if (!this.isInvisible) {\n const guaranteedEmpty = document.createElement('div');\n container.appendChild(guaranteedEmpty);\n container = guaranteedEmpty;\n }\n\n this.widgetId = this.getAssertedRecaptcha().render(\n container,\n this.parameters\n );\n }\n\n return this.widgetId;\n }\n\n private async init(): Promise<void> {\n _assert(\n _isHttpOrHttps() && !_isWorker(),\n this.auth,\n AuthErrorCode.INTERNAL_ERROR\n );\n\n await domReady();\n this.recaptcha = await this._recaptchaLoader.load(\n this.auth,\n this.auth.languageCode || undefined\n );\n\n const siteKey = await getRecaptchaParams(this.auth);\n _assert(siteKey, this.auth, AuthErrorCode.INTERNAL_ERROR);\n this.parameters.sitekey = siteKey;\n }\n\n private getAssertedRecaptcha(): Recaptcha {\n _assert(this.recaptcha, this.auth, AuthErrorCode.INTERNAL_ERROR);\n return this.recaptcha;\n }\n}\n\nfunction domReady(): Promise<void> {\n let resolver: (() => void) | null = null;\n return new Promise<void>(resolve => {\n if (document.readyState === 'complete') {\n resolve();\n return;\n }\n\n // Document not ready, wait for load before resolving.\n // Save resolver, so we can remove listener in case it was externally\n // cancelled.\n resolver = () => resolve();\n window.addEventListener('load', resolver);\n }).catch(e => {\n if (resolver) {\n window.removeEventListener('load', resolver);\n }\n\n throw e;\n });\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ApplicationVerifier,\n Auth,\n ConfirmationResult,\n PhoneInfoOptions,\n User,\n UserCredential\n} from '../../model/public_types';\n\nimport {\n startEnrollPhoneMfa,\n StartPhoneMfaEnrollmentRequest,\n StartPhoneMfaEnrollmentResponse\n} from '../../api/account_management/mfa';\nimport {\n startSignInPhoneMfa,\n StartPhoneMfaSignInRequest,\n StartPhoneMfaSignInResponse\n} from '../../api/authentication/mfa';\nimport {\n sendPhoneVerificationCode,\n SendPhoneVerificationCodeRequest,\n SendPhoneVerificationCodeResponse\n} from '../../api/authentication/sms';\nimport {\n RecaptchaActionName,\n RecaptchaClientType,\n RecaptchaAuthProvider\n} from '../../api';\nimport { ApplicationVerifierInternal } from '../../model/application_verifier';\nimport { PhoneAuthCredential } from '../../core/credentials/phone';\nimport { AuthErrorCode } from '../../core/errors';\nimport { _assertLinkedStatus, _link } from '../../core/user/link_unlink';\nimport {\n _assert,\n _serverAppCurrentUserOperationNotSupportedError\n} from '../../core/util/assert';\nimport { AuthInternal } from '../../model/auth';\nimport {\n linkWithCredential,\n reauthenticateWithCredential,\n signInWithCredential\n} from '../../core/strategies/credential';\nimport {\n MultiFactorSessionImpl,\n MultiFactorSessionType\n} from '../../mfa/mfa_session';\nimport { UserInternal } from '../../model/user';\nimport { RECAPTCHA_VERIFIER_TYPE } from '../recaptcha/recaptcha_verifier';\nimport { _castAuth } from '../../core/auth/auth_impl';\nimport { getModularInstance } from '@firebase/util';\nimport { ProviderId } from '../../model/enums';\nimport {\n FAKE_TOKEN,\n handleRecaptchaFlow,\n _initializeRecaptchaConfig\n} from '../recaptcha/recaptcha_enterprise_verifier';\nimport { _isFirebaseServerApp } from '@firebase/app';\n\ninterface OnConfirmationCallback {\n (credential: PhoneAuthCredential): Promise<UserCredential>;\n}\n\nclass ConfirmationResultImpl implements ConfirmationResult {\n constructor(\n readonly verificationId: string,\n private readonly onConfirmation: OnConfirmationCallback\n ) {}\n\n confirm(verificationCode: string): Promise<UserCredential> {\n const authCredential = PhoneAuthCredential._fromVerification(\n this.verificationId,\n verificationCode\n );\n return this.onConfirmation(authCredential);\n }\n}\n\n/**\n * Asynchronously signs in using a phone number.\n *\n * @remarks\n * This method sends a code via SMS to the given\n * phone number, and returns a {@link ConfirmationResult}. After the user\n * provides the code sent to their phone, call {@link ConfirmationResult.confirm}\n * with the code to sign the user in.\n *\n * For abuse prevention, this method requires a {@link ApplicationVerifier}.\n * This SDK includes an implementation based on reCAPTCHA v2, {@link RecaptchaVerifier}.\n * This function can work on other platforms that do not support the\n * {@link RecaptchaVerifier} (like React Native), but you need to use a\n * third-party {@link ApplicationVerifier} implementation.\n *\n * If you've enabled project-level reCAPTCHA Enterprise bot protection in\n * Enforce mode, you can omit the {@link ApplicationVerifier}.\n *\n * This method does not work in a Node.js environment or with {@link Auth} instances created with a\n * {@link @firebase/app#FirebaseServerApp}.\n *\n * @example\n * ```javascript\n * // 'recaptcha-container' is the ID of an element in the DOM.\n * const applicationVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container');\n * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);\n * // Obtain a verificationCode from the user.\n * const credential = await confirmationResult.confirm(verificationCode);\n * ```\n *\n * @param auth - The {@link Auth} instance.\n * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).\n * @param appVerifier - The {@link ApplicationVerifier}.\n *\n * @public\n */\nexport async function signInWithPhoneNumber(\n auth: Auth,\n phoneNumber: string,\n appVerifier?: ApplicationVerifier\n): Promise<ConfirmationResult> {\n if (_isFirebaseServerApp(auth.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(auth)\n );\n }\n const authInternal = _castAuth(auth);\n const verificationId = await _verifyPhoneNumber(\n authInternal,\n phoneNumber,\n getModularInstance(appVerifier as ApplicationVerifierInternal)\n );\n return new ConfirmationResultImpl(verificationId, cred =>\n signInWithCredential(authInternal, cred)\n );\n}\n\n/**\n * Links the user account with the given phone number.\n *\n * @remarks\n * This method does not work in a Node.js environment.\n *\n * @param user - The user.\n * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).\n * @param appVerifier - The {@link ApplicationVerifier}.\n *\n * @public\n */\nexport async function linkWithPhoneNumber(\n user: User,\n phoneNumber: string,\n appVerifier?: ApplicationVerifier\n): Promise<ConfirmationResult> {\n const userInternal = getModularInstance(user) as UserInternal;\n await _assertLinkedStatus(false, userInternal, ProviderId.PHONE);\n const verificationId = await _verifyPhoneNumber(\n userInternal.auth,\n phoneNumber,\n getModularInstance(appVerifier as ApplicationVerifierInternal)\n );\n return new ConfirmationResultImpl(verificationId, cred =>\n linkWithCredential(userInternal, cred)\n );\n}\n\n/**\n * Re-authenticates a user using a fresh phone credential.\n *\n * @remarks\n * Use before operations such as {@link updatePassword} that require tokens from recent sign-in attempts.\n *\n * This method does not work in a Node.js environment or on any {@link User} signed in by\n * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.\n *\n * @param user - The user.\n * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).\n * @param appVerifier - The {@link ApplicationVerifier}.\n *\n * @public\n */\nexport async function reauthenticateWithPhoneNumber(\n user: User,\n phoneNumber: string,\n appVerifier?: ApplicationVerifier\n): Promise<ConfirmationResult> {\n const userInternal = getModularInstance(user) as UserInternal;\n if (_isFirebaseServerApp(userInternal.auth.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(userInternal.auth)\n );\n }\n const verificationId = await _verifyPhoneNumber(\n userInternal.auth,\n phoneNumber,\n getModularInstance(appVerifier as ApplicationVerifierInternal)\n );\n return new ConfirmationResultImpl(verificationId, cred =>\n reauthenticateWithCredential(userInternal, cred)\n );\n}\n\ntype PhoneApiCaller<TRequest, TResponse> = (\n auth: AuthInternal,\n request: TRequest\n) => Promise<TResponse>;\n\n/**\n * Returns a verification ID to be used in conjunction with the SMS code that is sent.\n *\n */\nexport async function _verifyPhoneNumber(\n auth: AuthInternal,\n options: PhoneInfoOptions | string,\n verifier?: ApplicationVerifierInternal\n): Promise<string> {\n if (!auth._getRecaptchaConfig()) {\n try {\n await _initializeRecaptchaConfig(auth);\n } catch (error) {\n // If an error occurs while fetching the config, there is no way to know the enablement state\n // of Phone provider, so we proceed with recaptcha V2 verification.\n // The error is likely \"recaptchaKey undefined\", as reCAPTCHA Enterprise is not\n // enabled for any provider.\n console.log(\n 'Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.'\n );\n }\n }\n\n try {\n let phoneInfoOptions: PhoneInfoOptions;\n\n if (typeof options === 'string') {\n phoneInfoOptions = {\n phoneNumber: options\n };\n } else {\n phoneInfoOptions = options;\n }\n\n if ('session' in phoneInfoOptions) {\n const session = phoneInfoOptions.session as MultiFactorSessionImpl;\n\n if ('phoneNumber' in phoneInfoOptions) {\n _assert(\n session.type === MultiFactorSessionType.ENROLL,\n auth,\n AuthErrorCode.INTERNAL_ERROR\n );\n\n const startPhoneMfaEnrollmentRequest: StartPhoneMfaEnrollmentRequest = {\n idToken: session.credential,\n phoneEnrollmentInfo: {\n phoneNumber: phoneInfoOptions.phoneNumber,\n clientType: RecaptchaClientType.WEB\n }\n };\n\n const startEnrollPhoneMfaActionCallback: PhoneApiCaller<\n StartPhoneMfaEnrollmentRequest,\n StartPhoneMfaEnrollmentResponse\n > = async (\n authInstance: AuthInternal,\n request: StartPhoneMfaEnrollmentRequest\n ) => {\n // If reCAPTCHA Enterprise token is FAKE_TOKEN, fetch reCAPTCHA v2 token and inject into request.\n if (request.phoneEnrollmentInfo.captchaResponse === FAKE_TOKEN) {\n _assert(\n verifier?.type === RECAPTCHA_VERIFIER_TYPE,\n authInstance,\n AuthErrorCode.ARGUMENT_ERROR\n );\n\n const requestWithRecaptchaV2 = await injectRecaptchaV2Token(\n authInstance,\n request,\n verifier\n );\n return startEnrollPhoneMfa(authInstance, requestWithRecaptchaV2);\n }\n return startEnrollPhoneMfa(authInstance, request);\n };\n\n const startPhoneMfaEnrollmentResponse: Promise<StartPhoneMfaEnrollmentResponse> =\n handleRecaptchaFlow(\n auth,\n startPhoneMfaEnrollmentRequest,\n RecaptchaActionName.MFA_SMS_ENROLLMENT,\n startEnrollPhoneMfaActionCallback,\n RecaptchaAuthProvider.PHONE_PROVIDER\n );\n\n const response = await startPhoneMfaEnrollmentResponse.catch(error => {\n return Promise.reject(error);\n });\n\n return response.phoneSessionInfo.sessionInfo;\n } else {\n _assert(\n session.type === MultiFactorSessionType.SIGN_IN,\n auth,\n AuthErrorCode.INTERNAL_ERROR\n );\n const mfaEnrollmentId =\n phoneInfoOptions.multiFactorHint?.uid ||\n phoneInfoOptions.multiFactorUid;\n _assert(mfaEnrollmentId, auth, AuthErrorCode.MISSING_MFA_INFO);\n\n const startPhoneMfaSignInRequest: StartPhoneMfaSignInRequest = {\n mfaPendingCredential: session.credential,\n mfaEnrollmentId,\n phoneSignInInfo: {\n clientType: RecaptchaClientType.WEB\n }\n };\n\n const startSignInPhoneMfaActionCallback: PhoneApiCaller<\n StartPhoneMfaSignInRequest,\n StartPhoneMfaSignInResponse\n > = async (\n authInstance: AuthInternal,\n request: StartPhoneMfaSignInRequest\n ) => {\n // If reCAPTCHA Enterprise token is FAKE_TOKEN, fetch reCAPTCHA v2 token and inject into request.\n if (request.phoneSignInInfo.captchaResponse === FAKE_TOKEN) {\n _assert(\n verifier?.type === RECAPTCHA_VERIFIER_TYPE,\n authInstance,\n AuthErrorCode.ARGUMENT_ERROR\n );\n\n const requestWithRecaptchaV2 = await injectRecaptchaV2Token(\n authInstance,\n request,\n verifier\n );\n return startSignInPhoneMfa(authInstance, requestWithRecaptchaV2);\n }\n return startSignInPhoneMfa(authInstance, request);\n };\n\n const startPhoneMfaSignInResponse: Promise<StartPhoneMfaSignInResponse> =\n handleRecaptchaFlow(\n auth,\n startPhoneMfaSignInRequest,\n RecaptchaActionName.MFA_SMS_SIGNIN,\n startSignInPhoneMfaActionCallback,\n RecaptchaAuthProvider.PHONE_PROVIDER\n );\n\n const response = await startPhoneMfaSignInResponse.catch(error => {\n return Promise.reject(error);\n });\n\n return response.phoneResponseInfo.sessionInfo;\n }\n } else {\n const sendPhoneVerificationCodeRequest: SendPhoneVerificationCodeRequest =\n {\n phoneNumber: phoneInfoOptions.phoneNumber,\n clientType: RecaptchaClientType.WEB\n };\n\n const sendPhoneVerificationCodeActionCallback: PhoneApiCaller<\n SendPhoneVerificationCodeRequest,\n SendPhoneVerificationCodeResponse\n > = async (\n authInstance: AuthInternal,\n request: SendPhoneVerificationCodeRequest\n ) => {\n // If reCAPTCHA Enterprise token is FAKE_TOKEN, fetch reCAPTCHA v2 token and inject into request.\n if (request.captchaResponse === FAKE_TOKEN) {\n _assert(\n verifier?.type === RECAPTCHA_VERIFIER_TYPE,\n authInstance,\n AuthErrorCode.ARGUMENT_ERROR\n );\n\n const requestWithRecaptchaV2 = await injectRecaptchaV2Token(\n authInstance,\n request,\n verifier\n );\n return sendPhoneVerificationCode(\n authInstance,\n requestWithRecaptchaV2\n );\n }\n return sendPhoneVerificationCode(authInstance, request);\n };\n\n const sendPhoneVerificationCodeResponse: Promise<SendPhoneVerificationCodeResponse> =\n handleRecaptchaFlow(\n auth,\n sendPhoneVerificationCodeRequest,\n RecaptchaActionName.SEND_VERIFICATION_CODE,\n sendPhoneVerificationCodeActionCallback,\n RecaptchaAuthProvider.PHONE_PROVIDER\n );\n\n const response = await sendPhoneVerificationCodeResponse.catch(error => {\n return Promise.reject(error);\n });\n\n return response.sessionInfo;\n }\n } finally {\n verifier?._reset();\n }\n}\n\n/**\n * Updates the user's phone number.\n *\n * @remarks\n * This method does not work in a Node.js environment or on any {@link User} signed in by\n * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.\n *\n * @example\n * ```\n * // 'recaptcha-container' is the ID of an element in the DOM.\n * const applicationVerifier = new RecaptchaVerifier('recaptcha-container');\n * const provider = new PhoneAuthProvider(auth);\n * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier);\n * // Obtain the verificationCode from the user.\n * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode);\n * await updatePhoneNumber(user, phoneCredential);\n * ```\n *\n * @param user - The user.\n * @param credential - A credential authenticating the new phone number.\n *\n * @public\n */\nexport async function updatePhoneNumber(\n user: User,\n credential: PhoneAuthCredential\n): Promise<void> {\n const userInternal = getModularInstance(user) as UserInternal;\n if (_isFirebaseServerApp(userInternal.auth.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(userInternal.auth)\n );\n }\n await _link(userInternal, credential);\n}\n\n// Helper function that fetches and injects a reCAPTCHA v2 token into the request.\nexport async function injectRecaptchaV2Token<T extends object>(\n auth: AuthInternal,\n request: T,\n recaptchaV2Verifier: ApplicationVerifierInternal\n): Promise<T> {\n _assert(\n recaptchaV2Verifier.type === RECAPTCHA_VERIFIER_TYPE,\n auth,\n AuthErrorCode.ARGUMENT_ERROR\n );\n\n const recaptchaV2Token = await recaptchaV2Verifier.verify();\n\n _assert(\n typeof recaptchaV2Token === 'string',\n auth,\n AuthErrorCode.ARGUMENT_ERROR\n );\n\n const newRequest = { ...request };\n\n if ('phoneEnrollmentInfo' in newRequest) {\n const phoneNumber = (\n newRequest as unknown as StartPhoneMfaEnrollmentRequest\n ).phoneEnrollmentInfo.phoneNumber;\n const captchaResponse = (\n newRequest as unknown as StartPhoneMfaEnrollmentRequest\n ).phoneEnrollmentInfo.captchaResponse;\n const clientType = (newRequest as unknown as StartPhoneMfaEnrollmentRequest)\n .phoneEnrollmentInfo.clientType;\n const recaptchaVersion = (\n newRequest as unknown as StartPhoneMfaEnrollmentRequest\n ).phoneEnrollmentInfo.recaptchaVersion;\n\n Object.assign(newRequest, {\n 'phoneEnrollmentInfo': {\n phoneNumber,\n recaptchaToken: recaptchaV2Token,\n captchaResponse,\n clientType,\n recaptchaVersion\n }\n });\n\n return newRequest;\n } else if ('phoneSignInInfo' in newRequest) {\n const captchaResponse = (\n newRequest as unknown as StartPhoneMfaSignInRequest\n ).phoneSignInInfo.captchaResponse;\n const clientType = (newRequest as unknown as StartPhoneMfaSignInRequest)\n .phoneSignInInfo.clientType;\n const recaptchaVersion = (\n newRequest as unknown as StartPhoneMfaSignInRequest\n ).phoneSignInInfo.recaptchaVersion;\n\n Object.assign(newRequest, {\n 'phoneSignInInfo': {\n recaptchaToken: recaptchaV2Token,\n captchaResponse,\n clientType,\n recaptchaVersion\n }\n });\n\n return newRequest;\n } else {\n Object.assign(newRequest, { 'recaptchaToken': recaptchaV2Token });\n return newRequest;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Auth,\n PhoneInfoOptions,\n ApplicationVerifier,\n UserCredential\n} from '../../model/public_types';\n\nimport { SignInWithPhoneNumberResponse } from '../../api/authentication/sms';\nimport { ApplicationVerifierInternal as ApplicationVerifierInternal } from '../../model/application_verifier';\nimport { AuthInternal as AuthInternal } from '../../model/auth';\nimport { UserCredentialInternal as UserCredentialInternal } from '../../model/user';\nimport { PhoneAuthCredential } from '../../core/credentials/phone';\nimport { _verifyPhoneNumber } from '../strategies/phone';\nimport { _castAuth } from '../../core/auth/auth_impl';\nimport { AuthCredential } from '../../core';\nimport { FirebaseError, getModularInstance } from '@firebase/util';\nimport { TaggedWithTokenResponse } from '../../model/id_token';\nimport { ProviderId, SignInMethod } from '../../model/enums';\n\n/**\n * Provider for generating an {@link PhoneAuthCredential}.\n *\n * @remarks\n * `PhoneAuthProvider` does not work in a Node.js environment.\n *\n * @example\n * ```javascript\n * // 'recaptcha-container' is the ID of an element in the DOM.\n * const applicationVerifier = new RecaptchaVerifier('recaptcha-container');\n * const provider = new PhoneAuthProvider(auth);\n * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier);\n * // Obtain the verificationCode from the user.\n * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode);\n * const userCredential = await signInWithCredential(auth, phoneCredential);\n * ```\n *\n * @public\n */\nexport class PhoneAuthProvider {\n /** Always set to {@link ProviderId}.PHONE. */\n static readonly PROVIDER_ID: 'phone' = ProviderId.PHONE;\n /** Always set to {@link SignInMethod}.PHONE. */\n static readonly PHONE_SIGN_IN_METHOD: 'phone' = SignInMethod.PHONE;\n\n /** Always set to {@link ProviderId}.PHONE. */\n readonly providerId = PhoneAuthProvider.PROVIDER_ID;\n private readonly auth: AuthInternal;\n\n /**\n * @param auth - The Firebase {@link Auth} instance in which sign-ins should occur.\n *\n */\n constructor(auth: Auth) {\n this.auth = _castAuth(auth);\n }\n\n /**\n *\n * Starts a phone number authentication flow by sending a verification code to the given phone\n * number.\n *\n * @example\n * ```javascript\n * const provider = new PhoneAuthProvider(auth);\n * const verificationId = await provider.verifyPhoneNumber(phoneNumber, applicationVerifier);\n * // Obtain verificationCode from the user.\n * const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode);\n * const userCredential = await signInWithCredential(auth, authCredential);\n * ```\n *\n * @example\n * An alternative flow is provided using the `signInWithPhoneNumber` method.\n * ```javascript\n * const confirmationResult = signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);\n * // Obtain verificationCode from the user.\n * const userCredential = confirmationResult.confirm(verificationCode);\n * ```\n *\n * @param phoneInfoOptions - The user's {@link PhoneInfoOptions}. The phone number should be in\n * E.164 format (e.g. +16505550101).\n * @param applicationVerifier - An {@link ApplicationVerifier}, which prevents\n * requests from unauthorized clients. This SDK includes an implementation\n * based on reCAPTCHA v2, {@link RecaptchaVerifier}. If you've enabled\n * reCAPTCHA Enterprise bot protection in Enforce mode, this parameter is\n * optional; in all other configurations, the parameter is required.\n *\n * @returns A Promise for a verification ID that can be passed to\n * {@link PhoneAuthProvider.credential} to identify this flow.\n */\n verifyPhoneNumber(\n phoneOptions: PhoneInfoOptions | string,\n applicationVerifier?: ApplicationVerifier\n ): Promise<string> {\n return _verifyPhoneNumber(\n this.auth,\n phoneOptions,\n getModularInstance(applicationVerifier as ApplicationVerifierInternal)\n );\n }\n\n /**\n * Creates a phone auth credential, given the verification ID from\n * {@link PhoneAuthProvider.verifyPhoneNumber} and the code that was sent to the user's\n * mobile device.\n *\n * @example\n * ```javascript\n * const provider = new PhoneAuthProvider(auth);\n * const verificationId = provider.verifyPhoneNumber(phoneNumber, applicationVerifier);\n * // Obtain verificationCode from the user.\n * const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode);\n * const userCredential = signInWithCredential(auth, authCredential);\n * ```\n *\n * @example\n * An alternative flow is provided using the `signInWithPhoneNumber` method.\n * ```javascript\n * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);\n * // Obtain verificationCode from the user.\n * const userCredential = await confirmationResult.confirm(verificationCode);\n * ```\n *\n * @param verificationId - The verification ID returned from {@link PhoneAuthProvider.verifyPhoneNumber}.\n * @param verificationCode - The verification code sent to the user's mobile device.\n *\n * @returns The auth provider credential.\n */\n static credential(\n verificationId: string,\n verificationCode: string\n ): PhoneAuthCredential {\n return PhoneAuthCredential._fromVerification(\n verificationId,\n verificationCode\n );\n }\n\n /**\n * Generates an {@link AuthCredential} from a {@link UserCredential}.\n * @param userCredential - The user credential.\n */\n static credentialFromResult(\n userCredential: UserCredential\n ): AuthCredential | null {\n const credential = userCredential as UserCredentialInternal;\n return PhoneAuthProvider.credentialFromTaggedObject(credential);\n }\n\n /**\n * Returns an {@link AuthCredential} when passed an error.\n *\n * @remarks\n *\n * This method works for errors like\n * `auth/account-exists-with-different-credentials`. This is useful for\n * recovering when attempting to set a user's phone number but the number\n * in question is already tied to another account. For example, the following\n * code tries to update the current user's phone number, and if that\n * fails, links the user with the account associated with that number:\n *\n * ```js\n * const provider = new PhoneAuthProvider(auth);\n * const verificationId = await provider.verifyPhoneNumber(number, verifier);\n * try {\n * const code = ''; // Prompt the user for the verification code\n * await updatePhoneNumber(\n * auth.currentUser,\n * PhoneAuthProvider.credential(verificationId, code));\n * } catch (e) {\n * if ((e as FirebaseError)?.code === 'auth/account-exists-with-different-credential') {\n * const cred = PhoneAuthProvider.credentialFromError(e);\n * await linkWithCredential(auth.currentUser, cred);\n * }\n * }\n *\n * // At this point, auth.currentUser.phoneNumber === number.\n * ```\n *\n * @param error - The error to generate a credential from.\n */\n static credentialFromError(error: FirebaseError): AuthCredential | null {\n return PhoneAuthProvider.credentialFromTaggedObject(\n (error.customData || {}) as TaggedWithTokenResponse\n );\n }\n\n private static credentialFromTaggedObject({\n _tokenResponse: tokenResponse\n }: TaggedWithTokenResponse): AuthCredential | null {\n if (!tokenResponse) {\n return null;\n }\n const { phoneNumber, temporaryProof } =\n tokenResponse as SignInWithPhoneNumberResponse;\n if (phoneNumber && temporaryProof) {\n return PhoneAuthCredential._fromTokenResponse(\n phoneNumber,\n temporaryProof\n );\n }\n return null;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { PopupRedirectResolver } from '../../model/public_types';\nimport { AuthInternal } from '../../model/auth';\nimport { PopupRedirectResolverInternal } from '../../model/popup_redirect';\nimport { AuthErrorCode } from '../errors';\nimport { _assert } from './assert';\nimport { _getInstance } from './instantiator';\n\n/**\n * Chooses a popup/redirect resolver to use. This prefers the override (which\n * is directly passed in), and falls back to the property set on the auth\n * object. If neither are available, this function errors w/ an argument error.\n */\nexport function _withDefaultResolver(\n auth: AuthInternal,\n resolverOverride: PopupRedirectResolver | undefined\n): PopupRedirectResolverInternal {\n if (resolverOverride) {\n return _getInstance(resolverOverride);\n }\n\n _assert(auth._popupRedirectResolver, auth, AuthErrorCode.ARGUMENT_ERROR);\n\n return auth._popupRedirectResolver;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n signInWithIdp,\n SignInWithIdpRequest\n} from '../../api/authentication/idp';\nimport { PhoneOrOauthTokenResponse } from '../../api/authentication/mfa';\nimport { AuthInternal } from '../../model/auth';\nimport { IdTokenResponse } from '../../model/id_token';\nimport { UserInternal, UserCredentialInternal } from '../../model/user';\nimport { AuthCredential } from '../credentials';\nimport { _link as _linkUser } from '../user/link_unlink';\nimport { _reauthenticate } from '../user/reauthenticate';\nimport { _assert } from '../util/assert';\nimport { _signInWithCredential } from './credential';\nimport { AuthErrorCode } from '../errors';\nimport { ProviderId } from '../../model/enums';\n\nexport interface IdpTaskParams {\n auth: AuthInternal;\n requestUri: string;\n sessionId?: string;\n tenantId?: string;\n postBody?: string;\n pendingToken?: string;\n user?: UserInternal;\n bypassAuthState?: boolean;\n}\n\nexport type IdpTask = (\n params: IdpTaskParams\n) => Promise<UserCredentialInternal>;\n\nclass IdpCredential extends AuthCredential {\n constructor(readonly params: IdpTaskParams) {\n super(ProviderId.CUSTOM, ProviderId.CUSTOM);\n }\n\n _getIdTokenResponse(auth: AuthInternal): Promise<PhoneOrOauthTokenResponse> {\n return signInWithIdp(auth, this._buildIdpRequest());\n }\n\n _linkToIdToken(\n auth: AuthInternal,\n idToken: string\n ): Promise<IdTokenResponse> {\n return signInWithIdp(auth, this._buildIdpRequest(idToken));\n }\n\n _getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse> {\n return signInWithIdp(auth, this._buildIdpRequest());\n }\n\n private _buildIdpRequest(idToken?: string): SignInWithIdpRequest {\n const request: SignInWithIdpRequest = {\n requestUri: this.params.requestUri,\n sessionId: this.params.sessionId,\n postBody: this.params.postBody,\n tenantId: this.params.tenantId,\n pendingToken: this.params.pendingToken,\n returnSecureToken: true,\n returnIdpCredential: true\n };\n\n if (idToken) {\n request.idToken = idToken;\n }\n\n return request;\n }\n}\n\nexport function _signIn(\n params: IdpTaskParams\n): Promise<UserCredentialInternal> {\n return _signInWithCredential(\n params.auth,\n new IdpCredential(params),\n params.bypassAuthState\n ) as Promise<UserCredentialInternal>;\n}\n\nexport function _reauth(\n params: IdpTaskParams\n): Promise<UserCredentialInternal> {\n const { auth, user } = params;\n _assert(user, auth, AuthErrorCode.INTERNAL_ERROR);\n return _reauthenticate(\n user,\n new IdpCredential(params),\n params.bypassAuthState\n );\n}\n\nexport async function _link(\n params: IdpTaskParams\n): Promise<UserCredentialInternal> {\n const { auth, user } = params;\n _assert(user, auth, AuthErrorCode.INTERNAL_ERROR);\n return _linkUser(user, new IdpCredential(params), params.bypassAuthState);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseError } from '@firebase/util';\n\nimport {\n AuthEvent,\n AuthEventConsumer,\n AuthEventType,\n EventManager,\n PopupRedirectResolverInternal\n} from '../../model/popup_redirect';\nimport { UserInternal, UserCredentialInternal } from '../../model/user';\nimport { AuthErrorCode } from '../errors';\nimport { debugAssert, _fail } from '../util/assert';\nimport {\n _link,\n _reauth,\n _signIn,\n IdpTask,\n IdpTaskParams\n} from '../strategies/idp';\nimport { AuthInternal } from '../../model/auth';\n\ninterface PendingPromise {\n resolve: (cred: UserCredentialInternal | null) => void;\n reject: (error: Error) => void;\n}\n\n/**\n * Popup event manager. Handles the popup's entire lifecycle; listens to auth\n * events\n */\nexport abstract class AbstractPopupRedirectOperation\n implements AuthEventConsumer\n{\n private pendingPromise: PendingPromise | null = null;\n private eventManager: EventManager | null = null;\n readonly filter: AuthEventType[];\n\n abstract eventId: string | null;\n\n constructor(\n protected readonly auth: AuthInternal,\n filter: AuthEventType | AuthEventType[],\n protected readonly resolver: PopupRedirectResolverInternal,\n protected user?: UserInternal,\n protected readonly bypassAuthState = false\n ) {\n this.filter = Array.isArray(filter) ? filter : [filter];\n }\n\n abstract onExecution(): Promise<void>;\n\n execute(): Promise<UserCredentialInternal | null> {\n return new Promise<UserCredentialInternal | null>(\n async (resolve, reject) => {\n this.pendingPromise = { resolve, reject };\n\n try {\n this.eventManager = await this.resolver._initialize(this.auth);\n await this.onExecution();\n this.eventManager.registerConsumer(this);\n } catch (e) {\n this.reject(e as Error);\n }\n }\n );\n }\n\n async onAuthEvent(event: AuthEvent): Promise<void> {\n const { urlResponse, sessionId, postBody, tenantId, error, type } = event;\n if (error) {\n this.reject(error);\n return;\n }\n\n const params: IdpTaskParams = {\n auth: this.auth,\n requestUri: urlResponse!,\n sessionId: sessionId!,\n tenantId: tenantId || undefined,\n postBody: postBody || undefined,\n user: this.user,\n bypassAuthState: this.bypassAuthState\n };\n\n try {\n this.resolve(await this.getIdpTask(type)(params));\n } catch (e) {\n this.reject(e as Error);\n }\n }\n\n onError(error: FirebaseError): void {\n this.reject(error);\n }\n\n private getIdpTask(type: AuthEventType): IdpTask {\n switch (type) {\n case AuthEventType.SIGN_IN_VIA_POPUP:\n case AuthEventType.SIGN_IN_VIA_REDIRECT:\n return _signIn;\n case AuthEventType.LINK_VIA_POPUP:\n case AuthEventType.LINK_VIA_REDIRECT:\n return _link;\n case AuthEventType.REAUTH_VIA_POPUP:\n case AuthEventType.REAUTH_VIA_REDIRECT:\n return _reauth;\n default:\n _fail(this.auth, AuthErrorCode.INTERNAL_ERROR);\n }\n }\n\n protected resolve(cred: UserCredentialInternal | null): void {\n debugAssert(this.pendingPromise, 'Pending promise was never set');\n this.pendingPromise.resolve(cred);\n this.unregisterAndCleanUp();\n }\n\n protected reject(error: Error): void {\n debugAssert(this.pendingPromise, 'Pending promise was never set');\n this.pendingPromise.reject(error);\n this.unregisterAndCleanUp();\n }\n\n private unregisterAndCleanUp(): void {\n if (this.eventManager) {\n this.eventManager.unregisterConsumer(this);\n }\n\n this.pendingPromise = null;\n this.cleanUp();\n }\n\n abstract cleanUp(): void;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Auth,\n AuthProvider,\n PopupRedirectResolver,\n User,\n UserCredential\n} from '../../model/public_types';\n\nimport { _castAuth } from '../../core/auth/auth_impl';\nimport { AuthErrorCode } from '../../core/errors';\nimport {\n _assert,\n debugAssert,\n _createError,\n _assertInstanceOf\n} from '../../core/util/assert';\nimport { Delay } from '../../core/util/delay';\nimport { _generateEventId } from '../../core/util/event_id';\nimport { AuthInternal } from '../../model/auth';\nimport {\n AuthEventType,\n PopupRedirectResolverInternal\n} from '../../model/popup_redirect';\nimport { UserInternal } from '../../model/user';\nimport { _withDefaultResolver } from '../../core/util/resolver';\nimport { AuthPopup } from '../util/popup';\nimport { AbstractPopupRedirectOperation } from '../../core/strategies/abstract_popup_redirect_operation';\nimport { FederatedAuthProvider } from '../../core/providers/federated';\nimport { getModularInstance } from '@firebase/util';\nimport { _isFirebaseServerApp } from '@firebase/app';\n\n/*\n * The event timeout is the same on mobile and desktop, no need for Delay. Set this to 8s since\n * blocking functions can take upto 7s to complete sign in, as documented in:\n * https://cloud.google.com/identity-platform/docs/blocking-functions#understanding_blocking_functions\n * https://firebase.google.com/docs/auth/extend-with-blocking-functions#understanding_blocking_functions\n */\nexport const enum _Timeout {\n AUTH_EVENT = 8000\n}\nexport const _POLL_WINDOW_CLOSE_TIMEOUT = new Delay(2000, 10000);\n\n/**\n * Authenticates a Firebase client using a popup-based OAuth authentication flow.\n *\n * @remarks\n * If succeeds, returns the signed in user along with the provider's credential. If sign in was\n * unsuccessful, returns an error object containing additional information about the error.\n *\n * This method does not work in a Node.js environment or with {@link Auth} instances created with a\n * {@link @firebase/app#FirebaseServerApp}.\n *\n * @example\n * ```javascript\n * // Sign in using a popup.\n * const provider = new FacebookAuthProvider();\n * const result = await signInWithPopup(auth, provider);\n *\n * // The signed-in user info.\n * const user = result.user;\n * // This gives you a Facebook Access Token.\n * const credential = provider.credentialFromResult(auth, result);\n * const token = credential.accessToken;\n * ```\n *\n * @param auth - The {@link Auth} instance.\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\n *\n * @public\n */\nexport async function signInWithPopup(\n auth: Auth,\n provider: AuthProvider,\n resolver?: PopupRedirectResolver\n): Promise<UserCredential> {\n if (_isFirebaseServerApp(auth.app)) {\n return Promise.reject(\n _createError(auth, AuthErrorCode.OPERATION_NOT_SUPPORTED)\n );\n }\n const authInternal = _castAuth(auth);\n _assertInstanceOf(auth, provider, FederatedAuthProvider);\n const resolverInternal = _withDefaultResolver(authInternal, resolver);\n const action = new PopupOperation(\n authInternal,\n AuthEventType.SIGN_IN_VIA_POPUP,\n provider,\n resolverInternal\n );\n return action.executeNotNull();\n}\n\n/**\n * Reauthenticates the current user with the specified {@link OAuthProvider} using a pop-up based\n * OAuth flow.\n *\n * @remarks\n * If the reauthentication is successful, the returned result will contain the user and the\n * provider's credential.\n *\n * This method does not work in a Node.js environment or on any {@link User} signed in by\n * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.\n *\n * @example\n * ```javascript\n * // Sign in using a popup.\n * const provider = new FacebookAuthProvider();\n * const result = await signInWithPopup(auth, provider);\n * // Reauthenticate using a popup.\n * await reauthenticateWithPopup(result.user, provider);\n * ```\n *\n * @param user - The user.\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\n *\n * @public\n */\nexport async function reauthenticateWithPopup(\n user: User,\n provider: AuthProvider,\n resolver?: PopupRedirectResolver\n): Promise<UserCredential> {\n const userInternal = getModularInstance(user) as UserInternal;\n if (_isFirebaseServerApp(userInternal.auth.app)) {\n return Promise.reject(\n _createError(userInternal.auth, AuthErrorCode.OPERATION_NOT_SUPPORTED)\n );\n }\n _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);\n const resolverInternal = _withDefaultResolver(userInternal.auth, resolver);\n const action = new PopupOperation(\n userInternal.auth,\n AuthEventType.REAUTH_VIA_POPUP,\n provider,\n resolverInternal,\n userInternal\n );\n return action.executeNotNull();\n}\n\n/**\n * Links the authenticated provider to the user account using a pop-up based OAuth flow.\n *\n * @remarks\n * If the linking is successful, the returned result will contain the user and the provider's credential.\n *\n * This method does not work in a Node.js environment.\n *\n * @example\n * ```javascript\n * // Sign in using some other provider.\n * const result = await signInWithEmailAndPassword(auth, email, password);\n * // Link using a popup.\n * const provider = new FacebookAuthProvider();\n * await linkWithPopup(result.user, provider);\n * ```\n *\n * @param user - The user.\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\n *\n * @public\n */\nexport async function linkWithPopup(\n user: User,\n provider: AuthProvider,\n resolver?: PopupRedirectResolver\n): Promise<UserCredential> {\n const userInternal = getModularInstance(user) as UserInternal;\n _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);\n const resolverInternal = _withDefaultResolver(userInternal.auth, resolver);\n\n const action = new PopupOperation(\n userInternal.auth,\n AuthEventType.LINK_VIA_POPUP,\n provider,\n resolverInternal,\n userInternal\n );\n return action.executeNotNull();\n}\n\n/**\n * Popup event manager. Handles the popup's entire lifecycle; listens to auth\n * events\n *\n */\nclass PopupOperation extends AbstractPopupRedirectOperation {\n // Only one popup is ever shown at once. The lifecycle of the current popup\n // can be managed / cancelled by the constructor.\n private static currentPopupAction: PopupOperation | null = null;\n private authWindow: AuthPopup | null = null;\n private pollId: number | null = null;\n\n constructor(\n auth: AuthInternal,\n filter: AuthEventType,\n private readonly provider: AuthProvider,\n resolver: PopupRedirectResolverInternal,\n user?: UserInternal\n ) {\n super(auth, filter, resolver, user);\n if (PopupOperation.currentPopupAction) {\n PopupOperation.currentPopupAction.cancel();\n }\n\n PopupOperation.currentPopupAction = this;\n }\n\n async executeNotNull(): Promise<UserCredential> {\n const result = await this.execute();\n _assert(result, this.auth, AuthErrorCode.INTERNAL_ERROR);\n return result;\n }\n\n async onExecution(): Promise<void> {\n debugAssert(\n this.filter.length === 1,\n 'Popup operations only handle one event'\n );\n const eventId = _generateEventId();\n this.authWindow = await this.resolver._openPopup(\n this.auth,\n this.provider,\n this.filter[0], // There's always one, see constructor\n eventId\n );\n this.authWindow.associatedEvent = eventId;\n\n // Check for web storage support and origin validation _after_ the popup is\n // loaded. These operations are slow (~1 second or so) Rather than\n // waiting on them before opening the window, optimistically open the popup\n // and check for storage support at the same time. If storage support is\n // not available, this will cause the whole thing to reject properly. It\n // will also close the popup, but since the promise has already rejected,\n // the popup closed by user poll will reject into the void.\n this.resolver._originValidation(this.auth).catch(e => {\n this.reject(e);\n });\n\n this.resolver._isIframeWebStorageSupported(this.auth, isSupported => {\n if (!isSupported) {\n this.reject(\n _createError(this.auth, AuthErrorCode.WEB_STORAGE_UNSUPPORTED)\n );\n }\n });\n\n // Handle user closure. Notice this does *not* use await\n this.pollUserCancellation();\n }\n\n get eventId(): string | null {\n return this.authWindow?.associatedEvent || null;\n }\n\n cancel(): void {\n this.reject(_createError(this.auth, AuthErrorCode.EXPIRED_POPUP_REQUEST));\n }\n\n cleanUp(): void {\n if (this.authWindow) {\n this.authWindow.close();\n }\n\n if (this.pollId) {\n window.clearTimeout(this.pollId);\n }\n\n this.authWindow = null;\n this.pollId = null;\n PopupOperation.currentPopupAction = null;\n }\n\n private pollUserCancellation(): void {\n const poll = (): void => {\n if (this.authWindow?.window?.closed) {\n // Make sure that there is sufficient time for whatever action to\n // complete. The window could have closed but the sign in network\n // call could still be in flight. This is specifically true for\n // Firefox or if the opener is in an iframe, in which case the oauth\n // helper closes the popup.\n this.pollId = window.setTimeout(() => {\n this.pollId = null;\n this.reject(\n _createError(this.auth, AuthErrorCode.POPUP_CLOSED_BY_USER)\n );\n }, _Timeout.AUTH_EVENT);\n return;\n }\n\n this.pollId = window.setTimeout(poll, _POLL_WINDOW_CLOSE_TIMEOUT.get());\n };\n\n poll();\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AuthInternal } from '../../model/auth';\nimport {\n AuthEvent,\n AuthEventType,\n PopupRedirectResolverInternal\n} from '../../model/popup_redirect';\nimport { UserCredentialInternal } from '../../model/user';\nimport { PersistenceInternal } from '../persistence';\nimport { _persistenceKeyName } from '../persistence/persistence_user_manager';\nimport { _getInstance } from '../util/instantiator';\nimport { AbstractPopupRedirectOperation } from './abstract_popup_redirect_operation';\n\nconst PENDING_REDIRECT_KEY = 'pendingRedirect';\n\n// We only get one redirect outcome for any one auth, so just store it\n// in here.\nconst redirectOutcomeMap: Map<\n string,\n () => Promise<UserCredentialInternal | null>\n> = new Map();\n\nexport class RedirectAction extends AbstractPopupRedirectOperation {\n eventId = null;\n\n constructor(\n auth: AuthInternal,\n resolver: PopupRedirectResolverInternal,\n bypassAuthState = false\n ) {\n super(\n auth,\n [\n AuthEventType.SIGN_IN_VIA_REDIRECT,\n AuthEventType.LINK_VIA_REDIRECT,\n AuthEventType.REAUTH_VIA_REDIRECT,\n AuthEventType.UNKNOWN\n ],\n resolver,\n undefined,\n bypassAuthState\n );\n }\n\n /**\n * Override the execute function; if we already have a redirect result, then\n * just return it.\n */\n async execute(): Promise<UserCredentialInternal | null> {\n let readyOutcome = redirectOutcomeMap.get(this.auth._key());\n if (!readyOutcome) {\n try {\n const hasPendingRedirect = await _getAndClearPendingRedirectStatus(\n this.resolver,\n this.auth\n );\n const result = hasPendingRedirect ? await super.execute() : null;\n readyOutcome = () => Promise.resolve(result);\n } catch (e) {\n readyOutcome = () => Promise.reject(e);\n }\n\n redirectOutcomeMap.set(this.auth._key(), readyOutcome);\n }\n\n // If we're not bypassing auth state, the ready outcome should be set to\n // null.\n if (!this.bypassAuthState) {\n redirectOutcomeMap.set(this.auth._key(), () => Promise.resolve(null));\n }\n\n return readyOutcome();\n }\n\n async onAuthEvent(event: AuthEvent): Promise<void> {\n if (event.type === AuthEventType.SIGN_IN_VIA_REDIRECT) {\n return super.onAuthEvent(event);\n } else if (event.type === AuthEventType.UNKNOWN) {\n // This is a sentinel value indicating there's no pending redirect\n this.resolve(null);\n return;\n }\n\n if (event.eventId) {\n const user = await this.auth._redirectUserForId(event.eventId);\n if (user) {\n this.user = user;\n return super.onAuthEvent(event);\n } else {\n this.resolve(null);\n }\n }\n }\n\n async onExecution(): Promise<void> {}\n\n cleanUp(): void {}\n}\n\nexport async function _getAndClearPendingRedirectStatus(\n resolver: PopupRedirectResolverInternal,\n auth: AuthInternal\n): Promise<boolean> {\n const key = pendingRedirectKey(auth);\n const persistence = resolverPersistence(resolver);\n if (!(await persistence._isAvailable())) {\n return false;\n }\n const hasPendingRedirect = (await persistence._get(key)) === 'true';\n await persistence._remove(key);\n return hasPendingRedirect;\n}\n\nexport async function _setPendingRedirectStatus(\n resolver: PopupRedirectResolverInternal,\n auth: AuthInternal\n): Promise<void> {\n return resolverPersistence(resolver)._set(pendingRedirectKey(auth), 'true');\n}\n\nexport function _clearRedirectOutcomes(): void {\n redirectOutcomeMap.clear();\n}\n\nexport function _overrideRedirectResult(\n auth: AuthInternal,\n result: () => Promise<UserCredentialInternal | null>\n): void {\n redirectOutcomeMap.set(auth._key(), result);\n}\n\nfunction resolverPersistence(\n resolver: PopupRedirectResolverInternal\n): PersistenceInternal {\n return _getInstance(resolver._redirectPersistence);\n}\n\nfunction pendingRedirectKey(auth: AuthInternal): string {\n return _persistenceKeyName(\n PENDING_REDIRECT_KEY,\n auth.config.apiKey,\n auth.name\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Auth,\n AuthProvider,\n PopupRedirectResolver,\n User,\n UserCredential\n} from '../../model/public_types';\n\nimport { _castAuth } from '../../core/auth/auth_impl';\nimport { _assertLinkedStatus } from '../../core/user/link_unlink';\nimport {\n _assertInstanceOf,\n _serverAppCurrentUserOperationNotSupportedError\n} from '../../core/util/assert';\nimport { _generateEventId } from '../../core/util/event_id';\nimport { AuthEventType } from '../../model/popup_redirect';\nimport { UserInternal } from '../../model/user';\nimport { _withDefaultResolver } from '../../core/util/resolver';\nimport {\n RedirectAction,\n _setPendingRedirectStatus\n} from '../../core/strategies/redirect';\nimport { FederatedAuthProvider } from '../../core/providers/federated';\nimport { getModularInstance } from '@firebase/util';\nimport { _isFirebaseServerApp } from '@firebase/app';\n\n/**\n * Authenticates a Firebase client using a full-page redirect flow.\n *\n * @remarks\n * To handle the results and errors for this operation, refer to {@link getRedirectResult}.\n * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices\n * | best practices} when using {@link signInWithRedirect}.\n *\n * This method does not work in a Node.js environment or with {@link Auth} instances created with a\n * {@link @firebase/app#FirebaseServerApp}.\n *\n * @example\n * ```javascript\n * // Sign in using a redirect.\n * const provider = new FacebookAuthProvider();\n * // You can add additional scopes to the provider:\n * provider.addScope('user_birthday');\n * // Start a sign in process for an unauthenticated user.\n * await signInWithRedirect(auth, provider);\n * // This will trigger a full page redirect away from your app\n *\n * // After returning from the redirect when your app initializes you can obtain the result\n * const result = await getRedirectResult(auth);\n * if (result) {\n * // This is the signed-in user\n * const user = result.user;\n * // This gives you a Facebook Access Token.\n * const credential = provider.credentialFromResult(auth, result);\n * const token = credential.accessToken;\n * }\n * // As this API can be used for sign-in, linking and reauthentication,\n * // check the operationType to determine what triggered this redirect\n * // operation.\n * const operationType = result.operationType;\n * ```\n *\n * @param auth - The {@link Auth} instance.\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\n *\n * @public\n */\nexport function signInWithRedirect(\n auth: Auth,\n provider: AuthProvider,\n resolver?: PopupRedirectResolver\n): Promise<never> {\n return _signInWithRedirect(auth, provider, resolver) as Promise<never>;\n}\n\nexport async function _signInWithRedirect(\n auth: Auth,\n provider: AuthProvider,\n resolver?: PopupRedirectResolver\n): Promise<void | never> {\n if (_isFirebaseServerApp(auth.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(auth)\n );\n }\n const authInternal = _castAuth(auth);\n _assertInstanceOf(auth, provider, FederatedAuthProvider);\n // Wait for auth initialization to complete, this will process pending redirects and clear the\n // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new\n // redirect and creating a PENDING_REDIRECT_KEY entry.\n await authInternal._initializationPromise;\n const resolverInternal = _withDefaultResolver(authInternal, resolver);\n await _setPendingRedirectStatus(resolverInternal, authInternal);\n\n return resolverInternal._openRedirect(\n authInternal,\n provider,\n AuthEventType.SIGN_IN_VIA_REDIRECT\n );\n}\n\n/**\n * Reauthenticates the current user with the specified {@link OAuthProvider} using a full-page redirect flow.\n * @remarks\n * To handle the results and errors for this operation, refer to {@link getRedirectResult}.\n * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices\n * | best practices} when using {@link reauthenticateWithRedirect}.\n *\n * This method does not work in a Node.js environment or with {@link Auth} instances\n * created with a {@link @firebase/app#FirebaseServerApp}.\n *\n * @example\n * ```javascript\n * // Sign in using a redirect.\n * const provider = new FacebookAuthProvider();\n * const result = await signInWithRedirect(auth, provider);\n * // This will trigger a full page redirect away from your app\n *\n * // After returning from the redirect when your app initializes you can obtain the result\n * const result = await getRedirectResult(auth);\n * // Reauthenticate using a redirect.\n * await reauthenticateWithRedirect(result.user, provider);\n * // This will again trigger a full page redirect away from your app\n *\n * // After returning from the redirect when your app initializes you can obtain the result\n * const result = await getRedirectResult(auth);\n * ```\n *\n * @param user - The user.\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\n *\n * @public\n */\nexport function reauthenticateWithRedirect(\n user: User,\n provider: AuthProvider,\n resolver?: PopupRedirectResolver\n): Promise<never> {\n return _reauthenticateWithRedirect(\n user,\n provider,\n resolver\n ) as Promise<never>;\n}\nexport async function _reauthenticateWithRedirect(\n user: User,\n provider: AuthProvider,\n resolver?: PopupRedirectResolver\n): Promise<void | never> {\n const userInternal = getModularInstance(user) as UserInternal;\n _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);\n if (_isFirebaseServerApp(userInternal.auth.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(userInternal.auth)\n );\n }\n // Wait for auth initialization to complete, this will process pending redirects and clear the\n // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new\n // redirect and creating a PENDING_REDIRECT_KEY entry.\n await userInternal.auth._initializationPromise;\n // Allow the resolver to error before persisting the redirect user\n const resolverInternal = _withDefaultResolver(userInternal.auth, resolver);\n await _setPendingRedirectStatus(resolverInternal, userInternal.auth);\n\n const eventId = await prepareUserForRedirect(userInternal);\n return resolverInternal._openRedirect(\n userInternal.auth,\n provider,\n AuthEventType.REAUTH_VIA_REDIRECT,\n eventId\n );\n}\n\n/**\n * Links the {@link OAuthProvider} to the user account using a full-page redirect flow.\n * @remarks\n * To handle the results and errors for this operation, refer to {@link getRedirectResult}.\n * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices\n * | best practices} when using {@link linkWithRedirect}.\n *\n * This method does not work in a Node.js environment or with {@link Auth} instances\n * created with a {@link @firebase/app#FirebaseServerApp}.\n *\n * @example\n * ```javascript\n * // Sign in using some other provider.\n * const result = await signInWithEmailAndPassword(auth, email, password);\n * // Link using a redirect.\n * const provider = new FacebookAuthProvider();\n * await linkWithRedirect(result.user, provider);\n * // This will trigger a full page redirect away from your app\n *\n * // After returning from the redirect when your app initializes you can obtain the result\n * const result = await getRedirectResult(auth);\n * ```\n *\n * @param user - The user.\n * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.\n * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\n *\n * @public\n */\nexport function linkWithRedirect(\n user: User,\n provider: AuthProvider,\n resolver?: PopupRedirectResolver\n): Promise<never> {\n return _linkWithRedirect(user, provider, resolver) as Promise<never>;\n}\nexport async function _linkWithRedirect(\n user: User,\n provider: AuthProvider,\n resolver?: PopupRedirectResolver\n): Promise<void | never> {\n const userInternal = getModularInstance(user) as UserInternal;\n _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);\n // Wait for auth initialization to complete, this will process pending redirects and clear the\n // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new\n // redirect and creating a PENDING_REDIRECT_KEY entry.\n await userInternal.auth._initializationPromise;\n // Allow the resolver to error before persisting the redirect user\n const resolverInternal = _withDefaultResolver(userInternal.auth, resolver);\n await _assertLinkedStatus(false, userInternal, provider.providerId);\n await _setPendingRedirectStatus(resolverInternal, userInternal.auth);\n\n const eventId = await prepareUserForRedirect(userInternal);\n return resolverInternal._openRedirect(\n userInternal.auth,\n provider,\n AuthEventType.LINK_VIA_REDIRECT,\n eventId\n );\n}\n\n/**\n * Returns a {@link UserCredential} from the redirect-based sign-in flow.\n *\n * @remarks\n * If sign-in succeeded, returns the signed in user. If sign-in was unsuccessful, fails with an\n * error. If no redirect operation was called, returns `null`.\n *\n * This method does not work in a Node.js environment or with {@link Auth} instances created with a\n * {@link @firebase/app#FirebaseServerApp}.\n *\n * @example\n * ```javascript\n * // Sign in using a redirect.\n * const provider = new FacebookAuthProvider();\n * // You can add additional scopes to the provider:\n * provider.addScope('user_birthday');\n * // Start a sign in process for an unauthenticated user.\n * await signInWithRedirect(auth, provider);\n * // This will trigger a full page redirect away from your app\n *\n * // After returning from the redirect when your app initializes you can obtain the result\n * const result = await getRedirectResult(auth);\n * if (result) {\n * // This is the signed-in user\n * const user = result.user;\n * // This gives you a Facebook Access Token.\n * const credential = provider.credentialFromResult(auth, result);\n * const token = credential.accessToken;\n * }\n * // As this API can be used for sign-in, linking and reauthentication,\n * // check the operationType to determine what triggered this redirect\n * // operation.\n * const operationType = result.operationType;\n * ```\n *\n * @param auth - The {@link Auth} instance.\n * @param resolver - An instance of {@link PopupRedirectResolver}, optional\n * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.\n *\n * @public\n */\nexport async function getRedirectResult(\n auth: Auth,\n resolver?: PopupRedirectResolver\n): Promise<UserCredential | null> {\n await _castAuth(auth)._initializationPromise;\n return _getRedirectResult(auth, resolver, false);\n}\n\nexport async function _getRedirectResult(\n auth: Auth,\n resolverExtern?: PopupRedirectResolver,\n bypassAuthState = false\n): Promise<UserCredential | null> {\n if (_isFirebaseServerApp(auth.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(auth)\n );\n }\n const authInternal = _castAuth(auth);\n const resolver = _withDefaultResolver(authInternal, resolverExtern);\n const action = new RedirectAction(authInternal, resolver, bypassAuthState);\n const result = await action.execute();\n\n if (result && !bypassAuthState) {\n delete result.user._redirectEventId;\n await authInternal._persistUserIfCurrent(result.user as UserInternal);\n await authInternal._setRedirectUser(null, resolverExtern);\n }\n\n return result;\n}\n\nasync function prepareUserForRedirect(user: UserInternal): Promise<string> {\n const eventId = _generateEventId(`${user.uid}:::`);\n user._redirectEventId = eventId;\n await user.auth._setRedirectUser(user);\n await user.auth._persistUserIfCurrent(user);\n return eventId;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n AuthEvent,\n AuthEventConsumer,\n AuthEventType,\n EventManager\n} from '../../model/popup_redirect';\nimport { AuthErrorCode } from '../errors';\nimport { AuthInternal } from '../../model/auth';\nimport { _createError } from '../util/assert';\n\n// The amount of time to store the UIDs of seen events; this is\n// set to 10 min by default\nconst EVENT_DUPLICATION_CACHE_DURATION_MS = 10 * 60 * 1000;\n\nexport class AuthEventManager implements EventManager {\n private readonly cachedEventUids: Set<string> = new Set();\n private readonly consumers: Set<AuthEventConsumer> = new Set();\n protected queuedRedirectEvent: AuthEvent | null = null;\n protected hasHandledPotentialRedirect = false;\n private lastProcessedEventTime = Date.now();\n\n constructor(private readonly auth: AuthInternal) {}\n\n registerConsumer(authEventConsumer: AuthEventConsumer): void {\n this.consumers.add(authEventConsumer);\n\n if (\n this.queuedRedirectEvent &&\n this.isEventForConsumer(this.queuedRedirectEvent, authEventConsumer)\n ) {\n this.sendToConsumer(this.queuedRedirectEvent, authEventConsumer);\n this.saveEventToCache(this.queuedRedirectEvent);\n this.queuedRedirectEvent = null;\n }\n }\n\n unregisterConsumer(authEventConsumer: AuthEventConsumer): void {\n this.consumers.delete(authEventConsumer);\n }\n\n onEvent(event: AuthEvent): boolean {\n // Check if the event has already been handled\n if (this.hasEventBeenHandled(event)) {\n return false;\n }\n\n let handled = false;\n this.consumers.forEach(consumer => {\n if (this.isEventForConsumer(event, consumer)) {\n handled = true;\n this.sendToConsumer(event, consumer);\n this.saveEventToCache(event);\n }\n });\n\n if (this.hasHandledPotentialRedirect || !isRedirectEvent(event)) {\n // If we've already seen a redirect before, or this is a popup event,\n // bail now\n return handled;\n }\n\n this.hasHandledPotentialRedirect = true;\n\n // If the redirect wasn't handled, hang on to it\n if (!handled) {\n this.queuedRedirectEvent = event;\n handled = true;\n }\n\n return handled;\n }\n\n private sendToConsumer(event: AuthEvent, consumer: AuthEventConsumer): void {\n if (event.error && !isNullRedirectEvent(event)) {\n const code =\n (event.error.code?.split('auth/')[1] as AuthErrorCode) ||\n AuthErrorCode.INTERNAL_ERROR;\n consumer.onError(_createError(this.auth, code));\n } else {\n consumer.onAuthEvent(event);\n }\n }\n\n private isEventForConsumer(\n event: AuthEvent,\n consumer: AuthEventConsumer\n ): boolean {\n const eventIdMatches =\n consumer.eventId === null ||\n (!!event.eventId && event.eventId === consumer.eventId);\n return consumer.filter.includes(event.type) && eventIdMatches;\n }\n\n private hasEventBeenHandled(event: AuthEvent): boolean {\n if (\n Date.now() - this.lastProcessedEventTime >=\n EVENT_DUPLICATION_CACHE_DURATION_MS\n ) {\n this.cachedEventUids.clear();\n }\n\n return this.cachedEventUids.has(eventUid(event));\n }\n\n private saveEventToCache(event: AuthEvent): void {\n this.cachedEventUids.add(eventUid(event));\n this.lastProcessedEventTime = Date.now();\n }\n}\n\nfunction eventUid(e: AuthEvent): string {\n return [e.type, e.eventId, e.sessionId, e.tenantId].filter(v => v).join('-');\n}\n\nfunction isNullRedirectEvent({ type, error }: AuthEvent): boolean {\n return (\n type === AuthEventType.UNKNOWN &&\n error?.code === `auth/${AuthErrorCode.NO_AUTH_EVENT}`\n );\n}\n\nfunction isRedirectEvent(event: AuthEvent): boolean {\n switch (event.type) {\n case AuthEventType.SIGN_IN_VIA_REDIRECT:\n case AuthEventType.LINK_VIA_REDIRECT:\n case AuthEventType.REAUTH_VIA_REDIRECT:\n return true;\n case AuthEventType.UNKNOWN:\n return isNullRedirectEvent(event);\n default:\n return false;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _performApiRequest, Endpoint, HttpMethod } from '../index';\nimport { Auth } from '../../model/public_types';\n\nexport interface GetProjectConfigRequest {\n androidPackageName?: string;\n iosBundleId?: string;\n}\n\nexport interface GetProjectConfigResponse {\n authorizedDomains: string[];\n}\n\nexport async function _getProjectConfig(\n auth: Auth,\n request: GetProjectConfigRequest = {}\n): Promise<GetProjectConfigResponse> {\n return _performApiRequest<GetProjectConfigRequest, GetProjectConfigResponse>(\n auth,\n HttpMethod.GET,\n Endpoint.GET_PROJECT_CONFIG,\n request\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _getProjectConfig } from '../../api/project_config/get_project_config';\nimport { AuthInternal } from '../../model/auth';\nimport { AuthErrorCode } from '../errors';\nimport { _fail } from './assert';\nimport { _getCurrentUrl } from './location';\n\nconst IP_ADDRESS_REGEX = /^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/;\nconst HTTP_REGEX = /^https?/;\n\nexport async function _validateOrigin(auth: AuthInternal): Promise<void> {\n // Skip origin validation if we are in an emulated environment\n if (auth.config.emulator) {\n return;\n }\n\n const { authorizedDomains } = await _getProjectConfig(auth);\n\n for (const domain of authorizedDomains) {\n try {\n if (matchDomain(domain)) {\n return;\n }\n } catch {\n // Do nothing if there's a URL error; just continue searching\n }\n }\n\n // In the old SDK, this error also provides helpful messages.\n _fail(auth, AuthErrorCode.INVALID_ORIGIN);\n}\n\nfunction matchDomain(expected: string): boolean {\n const currentUrl = _getCurrentUrl();\n const { protocol, hostname } = new URL(currentUrl);\n if (expected.startsWith('chrome-extension://')) {\n const ceUrl = new URL(expected);\n\n if (ceUrl.hostname === '' && hostname === '') {\n // For some reason we're not parsing chrome URLs properly\n return (\n protocol === 'chrome-extension:' &&\n expected.replace('chrome-extension://', '') ===\n currentUrl.replace('chrome-extension://', '')\n );\n }\n\n return protocol === 'chrome-extension:' && ceUrl.hostname === hostname;\n }\n\n if (!HTTP_REGEX.test(protocol)) {\n return false;\n }\n\n if (IP_ADDRESS_REGEX.test(expected)) {\n // The domain has to be exactly equal to the pattern, as an IP domain will\n // only contain the IP, no extra character.\n return hostname === expected;\n }\n\n // Dots in pattern should be escaped.\n const escapedDomainPattern = expected.replace(/\\./g, '\\\\.');\n // Non ip address domains.\n // domain.com = *.domain.com OR domain.com\n const re = new RegExp(\n '^(.+\\\\.' + escapedDomainPattern + '|' + escapedDomainPattern + ')$',\n 'i'\n );\n return re.test(hostname);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AuthErrorCode } from '../../core/errors';\nimport { _createError } from '../../core/util/assert';\nimport { Delay } from '../../core/util/delay';\nimport { AuthInternal } from '../../model/auth';\nimport { _window } from '../auth_window';\nimport * as js from '../load_js';\n\nconst NETWORK_TIMEOUT = new Delay(30000, 60000);\n\n/**\n * Reset unloaded GApi modules. If gapi.load fails due to a network error,\n * it will stop working after a retrial. This is a hack to fix this issue.\n */\nfunction resetUnloadedGapiModules(): void {\n // Clear last failed gapi.load state to force next gapi.load to first\n // load the failed gapi.iframes module.\n // Get gapix.beacon context.\n const beacon = _window().___jsl;\n // Get current hint.\n if (beacon?.H) {\n // Get gapi hint.\n for (const hint of Object.keys(beacon.H)) {\n // Requested modules.\n beacon.H[hint].r = beacon.H[hint].r || [];\n // Loaded modules.\n beacon.H[hint].L = beacon.H[hint].L || [];\n // Set requested modules to a copy of the loaded modules.\n beacon.H[hint].r = [...beacon.H[hint].L];\n // Clear pending callbacks.\n if (beacon.CP) {\n for (let i = 0; i < beacon.CP.length; i++) {\n // Remove all failed pending callbacks.\n beacon.CP[i] = null;\n }\n }\n }\n }\n}\n\nfunction loadGapi(auth: AuthInternal): Promise<gapi.iframes.Context> {\n return new Promise<gapi.iframes.Context>((resolve, reject) => {\n // Function to run when gapi.load is ready.\n function loadGapiIframe(): void {\n // The developer may have tried to previously run gapi.load and failed.\n // Run this to fix that.\n resetUnloadedGapiModules();\n gapi.load('gapi.iframes', {\n callback: () => {\n resolve(gapi.iframes.getContext());\n },\n ontimeout: () => {\n // The above reset may be sufficient, but having this reset after\n // failure ensures that if the developer calls gapi.load after the\n // connection is re-established and before another attempt to embed\n // the iframe, it would work and would not be broken because of our\n // failed attempt.\n // Timeout when gapi.iframes.Iframe not loaded.\n resetUnloadedGapiModules();\n reject(_createError(auth, AuthErrorCode.NETWORK_REQUEST_FAILED));\n },\n timeout: NETWORK_TIMEOUT.get()\n });\n }\n\n if (_window().gapi?.iframes?.Iframe) {\n // If gapi.iframes.Iframe available, resolve.\n resolve(gapi.iframes.getContext());\n } else if (!!_window().gapi?.load) {\n // Gapi loader ready, load gapi.iframes.\n loadGapiIframe();\n } else {\n // Create a new iframe callback when this is called so as not to overwrite\n // any previous defined callback. This happens if this method is called\n // multiple times in parallel and could result in the later callback\n // overwriting the previous one. This would end up with a iframe\n // timeout.\n const cbName = js._generateCallbackName('iframefcb');\n // GApi loader not available, dynamically load platform.js.\n _window()[cbName] = () => {\n // GApi loader should be ready.\n if (!!gapi.load) {\n loadGapiIframe();\n } else {\n // Gapi loader failed, throw error.\n reject(_createError(auth, AuthErrorCode.NETWORK_REQUEST_FAILED));\n }\n };\n // Load GApi loader.\n return js\n ._loadJS(`${js._gapiScriptUrl()}?onload=${cbName}`)\n .catch(e => reject(e));\n }\n }).catch(error => {\n // Reset cached promise to allow for retrial.\n cachedGApiLoader = null;\n throw error;\n });\n}\n\nlet cachedGApiLoader: Promise<gapi.iframes.Context> | null = null;\nexport function _loadGapi(auth: AuthInternal): Promise<gapi.iframes.Context> {\n cachedGApiLoader = cachedGApiLoader || loadGapi(auth);\n return cachedGApiLoader;\n}\n\nexport function _resetLoader(): void {\n cachedGApiLoader = null;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SDK_VERSION } from '@firebase/app';\nimport { querystring } from '@firebase/util';\nimport { DefaultConfig } from '../../../internal';\n\nimport { AuthErrorCode } from '../../core/errors';\nimport { _assert, _createError } from '../../core/util/assert';\nimport { Delay } from '../../core/util/delay';\nimport { _emulatorUrl } from '../../core/util/emulator';\nimport { AuthInternal } from '../../model/auth';\nimport { _window } from '../auth_window';\nimport * as gapiLoader from './gapi';\n\nconst PING_TIMEOUT = new Delay(5000, 15000);\nconst IFRAME_PATH = '__/auth/iframe';\nconst EMULATED_IFRAME_PATH = 'emulator/auth/iframe';\n\nconst IFRAME_ATTRIBUTES = {\n style: {\n position: 'absolute',\n top: '-100px',\n width: '1px',\n height: '1px'\n },\n 'aria-hidden': 'true',\n tabindex: '-1'\n};\n\n// Map from apiHost to endpoint ID for passing into iframe. In current SDK, apiHost can be set to\n// anything (not from a list of endpoints with IDs as in legacy), so this is the closest we can get.\nconst EID_FROM_APIHOST = new Map([\n [DefaultConfig.API_HOST, 'p'], // production\n ['staging-identitytoolkit.sandbox.googleapis.com', 's'], // staging\n ['test-identitytoolkit.sandbox.googleapis.com', 't'] // test\n]);\n\nfunction getIframeUrl(auth: AuthInternal): string {\n const config = auth.config;\n _assert(config.authDomain, auth, AuthErrorCode.MISSING_AUTH_DOMAIN);\n const url = config.emulator\n ? _emulatorUrl(config, EMULATED_IFRAME_PATH)\n : `https://${auth.config.authDomain}/${IFRAME_PATH}`;\n\n const params: Record<string, string> = {\n apiKey: config.apiKey,\n appName: auth.name,\n v: SDK_VERSION\n };\n const eid = EID_FROM_APIHOST.get(auth.config.apiHost);\n if (eid) {\n params.eid = eid;\n }\n const frameworks = auth._getFrameworks();\n if (frameworks.length) {\n params.fw = frameworks.join(',');\n }\n return `${url}?${querystring(params).slice(1)}`;\n}\n\nexport async function _openIframe(\n auth: AuthInternal\n): Promise<gapi.iframes.Iframe> {\n const context = await gapiLoader._loadGapi(auth);\n const gapi = _window().gapi;\n _assert(gapi, auth, AuthErrorCode.INTERNAL_ERROR);\n return context.open(\n {\n where: document.body,\n url: getIframeUrl(auth),\n messageHandlersFilter: gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER,\n attributes: IFRAME_ATTRIBUTES,\n dontclear: true\n },\n (iframe: gapi.iframes.Iframe) =>\n new Promise(async (resolve, reject) => {\n await iframe.restyle({\n // Prevent iframe from closing on mouse out.\n setHideOnLeave: false\n });\n\n const networkError = _createError(\n auth,\n AuthErrorCode.NETWORK_REQUEST_FAILED\n );\n // Confirm iframe is correctly loaded.\n // To fallback on failure, set a timeout.\n const networkErrorTimer = _window().setTimeout(() => {\n reject(networkError);\n }, PING_TIMEOUT.get());\n // Clear timer and resolve pending iframe ready promise.\n function clearTimerAndResolve(): void {\n _window().clearTimeout(networkErrorTimer);\n resolve(iframe);\n }\n // This returns an IThenable. However the reject part does not call\n // when the iframe is not loaded.\n iframe.ping(clearTimerAndResolve).then(clearTimerAndResolve, () => {\n reject(networkError);\n });\n })\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getUA } from '@firebase/util';\n\nimport { AuthErrorCode } from '../../core/errors';\nimport { _assert } from '../../core/util/assert';\nimport {\n _isChromeIOS,\n _isFirefox,\n _isIOSStandalone\n} from '../../core/util/browser';\nimport { AuthInternal } from '../../model/auth';\n\nconst BASE_POPUP_OPTIONS = {\n location: 'yes',\n resizable: 'yes',\n statusbar: 'yes',\n toolbar: 'no'\n};\n\nconst DEFAULT_WIDTH = 500;\nconst DEFAULT_HEIGHT = 600;\nconst TARGET_BLANK = '_blank';\n\nconst FIREFOX_EMPTY_URL = 'http://localhost';\n\nexport class AuthPopup {\n associatedEvent: string | null = null;\n\n constructor(readonly window: Window | null) {}\n\n close(): void {\n if (this.window) {\n try {\n this.window.close();\n } catch (e) {}\n }\n }\n}\n\nexport function _open(\n auth: AuthInternal,\n url?: string,\n name?: string,\n width = DEFAULT_WIDTH,\n height = DEFAULT_HEIGHT\n): AuthPopup {\n const top = Math.max((window.screen.availHeight - height) / 2, 0).toString();\n const left = Math.max((window.screen.availWidth - width) / 2, 0).toString();\n let target = '';\n\n const options: { [key: string]: string } = {\n ...BASE_POPUP_OPTIONS,\n width: width.toString(),\n height: height.toString(),\n top,\n left\n };\n\n // Chrome iOS 7 and 8 is returning an undefined popup win when target is\n // specified, even though the popup is not necessarily blocked.\n const ua = getUA().toLowerCase();\n\n if (name) {\n target = _isChromeIOS(ua) ? TARGET_BLANK : name;\n }\n\n if (_isFirefox(ua)) {\n // Firefox complains when invalid URLs are popped out. Hacky way to bypass.\n url = url || FIREFOX_EMPTY_URL;\n // Firefox disables by default scrolling on popup windows, which can create\n // issues when the user has many Google accounts, for instance.\n options.scrollbars = 'yes';\n }\n\n const optionsString = Object.entries(options).reduce(\n (accum, [key, value]) => `${accum}${key}=${value},`,\n ''\n );\n\n if (_isIOSStandalone(ua) && target !== '_self') {\n openAsNewWindowIOS(url || '', target);\n return new AuthPopup(null);\n }\n\n // about:blank getting sanitized causing browsers like IE/Edge to display\n // brief error message before redirecting to handler.\n const newWin = window.open(url || '', target, optionsString);\n _assert(newWin, auth, AuthErrorCode.POPUP_BLOCKED);\n\n // Flaky on IE edge, encapsulate with a try and catch.\n try {\n newWin.focus();\n } catch (e) {}\n\n return new AuthPopup(newWin);\n}\n\nfunction openAsNewWindowIOS(url: string, target: string): void {\n const el = document.createElement('a');\n el.href = url;\n el.target = target;\n const click = document.createEvent('MouseEvent');\n click.initMouseEvent(\n 'click',\n true,\n true,\n window,\n 1,\n 0,\n 0,\n 0,\n 0,\n false,\n false,\n false,\n false,\n 1,\n null\n );\n el.dispatchEvent(click);\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SDK_VERSION } from '@firebase/app';\nimport { AuthProvider } from '../../model/public_types';\nimport { ApiKey, AppName, AuthInternal } from '../../model/auth';\nimport { AuthEventType } from '../../model/popup_redirect';\nimport { AuthErrorCode } from '../errors';\nimport { _assert } from './assert';\nimport { isEmpty, querystring } from '@firebase/util';\nimport { _emulatorUrl } from './emulator';\nimport { FederatedAuthProvider } from '../providers/federated';\nimport { BaseOAuthProvider } from '../providers/oauth';\n\n/**\n * URL for Authentication widget which will initiate the OAuth handshake\n *\n * @internal\n */\nconst WIDGET_PATH = '__/auth/handler';\n\n/**\n * URL for emulated environment\n *\n * @internal\n */\nconst EMULATOR_WIDGET_PATH = 'emulator/auth/handler';\n\n/**\n * Fragment name for the App Check token that gets passed to the widget\n *\n * @internal\n */\nconst FIREBASE_APP_CHECK_FRAGMENT_ID = encodeURIComponent('fac');\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\ntype WidgetParams = {\n apiKey: ApiKey;\n appName: AppName;\n authType: AuthEventType;\n redirectUrl?: string;\n v: string;\n providerId?: string;\n scopes?: string;\n customParameters?: string;\n eventId?: string;\n tid?: string;\n} & { [key: string]: string | undefined };\n\nexport async function _getRedirectUrl(\n auth: AuthInternal,\n provider: AuthProvider,\n authType: AuthEventType,\n redirectUrl?: string,\n eventId?: string,\n additionalParams?: Record<string, string>\n): Promise<string> {\n _assert(auth.config.authDomain, auth, AuthErrorCode.MISSING_AUTH_DOMAIN);\n _assert(auth.config.apiKey, auth, AuthErrorCode.INVALID_API_KEY);\n\n const params: WidgetParams = {\n apiKey: auth.config.apiKey,\n appName: auth.name,\n authType,\n redirectUrl,\n v: SDK_VERSION,\n eventId\n };\n\n if (provider instanceof FederatedAuthProvider) {\n provider.setDefaultLanguage(auth.languageCode);\n params.providerId = provider.providerId || '';\n if (!isEmpty(provider.getCustomParameters())) {\n params.customParameters = JSON.stringify(provider.getCustomParameters());\n }\n\n // TODO set additionalParams from the provider as well?\n for (const [key, value] of Object.entries(additionalParams || {})) {\n params[key] = value;\n }\n }\n\n if (provider instanceof BaseOAuthProvider) {\n const scopes = provider.getScopes().filter(scope => scope !== '');\n if (scopes.length > 0) {\n params.scopes = scopes.join(',');\n }\n }\n\n if (auth.tenantId) {\n params.tid = auth.tenantId;\n }\n\n // TODO: maybe set eid as endpointId\n // TODO: maybe set fw as Frameworks.join(\",\")\n\n const paramsDict = params as Record<string, string | number>;\n for (const key of Object.keys(paramsDict)) {\n if (paramsDict[key] === undefined) {\n delete paramsDict[key];\n }\n }\n\n // Sets the App Check token to pass to the widget\n const appCheckToken = await auth._getAppCheckToken();\n const appCheckTokenFragment = appCheckToken\n ? `#${FIREBASE_APP_CHECK_FRAGMENT_ID}=${encodeURIComponent(appCheckToken)}`\n : '';\n\n // Start at index 1 to skip the leading '&' in the query string\n return `${getHandlerBase(auth)}?${querystring(paramsDict).slice(\n 1\n )}${appCheckTokenFragment}`;\n}\n\nfunction getHandlerBase({ config }: AuthInternal): string {\n if (!config.emulator) {\n return `https://${config.authDomain}/${WIDGET_PATH}`;\n }\n\n return _emulatorUrl(config, EMULATOR_WIDGET_PATH);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AuthProvider, PopupRedirectResolver } from '../model/public_types';\n\nimport { AuthEventManager } from '../core/auth/auth_event_manager';\nimport { AuthErrorCode } from '../core/errors';\nimport { _assert, debugAssert, _fail } from '../core/util/assert';\nimport { _generateEventId } from '../core/util/event_id';\nimport { _getCurrentUrl } from '../core/util/location';\nimport { _validateOrigin } from '../core/util/validate_origin';\nimport { AuthInternal } from '../model/auth';\nimport {\n AuthEventType,\n EventManager,\n GapiAuthEvent,\n GapiOutcome,\n PopupRedirectResolverInternal\n} from '../model/popup_redirect';\nimport { _setWindowLocation } from './auth_window';\nimport { _openIframe } from './iframe/iframe';\nimport { browserSessionPersistence } from './persistence/session_storage';\nimport { _open, AuthPopup } from './util/popup';\nimport { _getRedirectResult } from './strategies/redirect';\nimport { _getRedirectUrl } from '../core/util/handler';\nimport { _isIOS, _isMobileBrowser, _isSafari } from '../core/util/browser';\nimport { _overrideRedirectResult } from '../core/strategies/redirect';\n\n/**\n * The special web storage event\n *\n */\nconst WEB_STORAGE_SUPPORT_KEY = 'webStorageSupport';\n\ninterface WebStorageSupportMessage extends gapi.iframes.Message {\n [index: number]: Record<string, boolean>;\n}\n\ninterface ManagerOrPromise {\n manager?: EventManager;\n promise?: Promise<EventManager>;\n}\n\nclass BrowserPopupRedirectResolver implements PopupRedirectResolverInternal {\n private readonly eventManagers: Record<string, ManagerOrPromise> = {};\n private readonly iframes: Record<string, gapi.iframes.Iframe> = {};\n private readonly originValidationPromises: Record<string, Promise<void>> = {};\n\n readonly _redirectPersistence = browserSessionPersistence;\n\n // Wrapping in async even though we don't await anywhere in order\n // to make sure errors are raised as promise rejections\n async _openPopup(\n auth: AuthInternal,\n provider: AuthProvider,\n authType: AuthEventType,\n eventId?: string\n ): Promise<AuthPopup> {\n debugAssert(\n this.eventManagers[auth._key()]?.manager,\n '_initialize() not called before _openPopup()'\n );\n\n const url = await _getRedirectUrl(\n auth,\n provider,\n authType,\n _getCurrentUrl(),\n eventId\n );\n return _open(auth, url, _generateEventId());\n }\n\n async _openRedirect(\n auth: AuthInternal,\n provider: AuthProvider,\n authType: AuthEventType,\n eventId?: string\n ): Promise<never> {\n await this._originValidation(auth);\n const url = await _getRedirectUrl(\n auth,\n provider,\n authType,\n _getCurrentUrl(),\n eventId\n );\n _setWindowLocation(url);\n return new Promise(() => {});\n }\n\n _initialize(auth: AuthInternal): Promise<EventManager> {\n const key = auth._key();\n if (this.eventManagers[key]) {\n const { manager, promise } = this.eventManagers[key];\n if (manager) {\n return Promise.resolve(manager);\n } else {\n debugAssert(promise, 'If manager is not set, promise should be');\n return promise;\n }\n }\n\n const promise = this.initAndGetManager(auth);\n this.eventManagers[key] = { promise };\n\n // If the promise is rejected, the key should be removed so that the\n // operation can be retried later.\n promise.catch(() => {\n delete this.eventManagers[key];\n });\n\n return promise;\n }\n\n private async initAndGetManager(auth: AuthInternal): Promise<EventManager> {\n const iframe = await _openIframe(auth);\n const manager = new AuthEventManager(auth);\n iframe.register<GapiAuthEvent>(\n 'authEvent',\n (iframeEvent: GapiAuthEvent | null) => {\n _assert(iframeEvent?.authEvent, auth, AuthErrorCode.INVALID_AUTH_EVENT);\n // TODO: Consider splitting redirect and popup events earlier on\n\n const handled = manager.onEvent(iframeEvent.authEvent);\n return { status: handled ? GapiOutcome.ACK : GapiOutcome.ERROR };\n },\n gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER\n );\n\n this.eventManagers[auth._key()] = { manager };\n this.iframes[auth._key()] = iframe;\n return manager;\n }\n\n _isIframeWebStorageSupported(\n auth: AuthInternal,\n cb: (supported: boolean) => unknown\n ): void {\n const iframe = this.iframes[auth._key()];\n iframe.send<gapi.iframes.Message, WebStorageSupportMessage>(\n WEB_STORAGE_SUPPORT_KEY,\n { type: WEB_STORAGE_SUPPORT_KEY },\n result => {\n const isSupported = result?.[0]?.[WEB_STORAGE_SUPPORT_KEY];\n if (isSupported !== undefined) {\n cb(!!isSupported);\n }\n\n _fail(auth, AuthErrorCode.INTERNAL_ERROR);\n },\n gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER\n );\n }\n\n _originValidation(auth: AuthInternal): Promise<void> {\n const key = auth._key();\n if (!this.originValidationPromises[key]) {\n this.originValidationPromises[key] = _validateOrigin(auth);\n }\n\n return this.originValidationPromises[key];\n }\n\n get _shouldInitProactively(): boolean {\n // Mobile browsers and Safari need to optimistically initialize\n return _isMobileBrowser() || _isSafari() || _isIOS();\n }\n\n _completeRedirectFn = _getRedirectResult;\n\n _overrideRedirectResult = _overrideRedirectResult;\n}\n\n/**\n * An implementation of {@link PopupRedirectResolver} suitable for browser\n * based applications.\n *\n * @remarks\n * This method does not work in a Node.js environment.\n *\n * @public\n */\nexport const browserPopupRedirectResolver: PopupRedirectResolver =\n BrowserPopupRedirectResolver;\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n FactorId,\n PhoneMultiFactorAssertion\n} from '../../../model/public_types';\n\nimport { MultiFactorAssertionImpl } from '../../../mfa/mfa_assertion';\nimport { AuthInternal } from '../../../model/auth';\nimport { finalizeEnrollPhoneMfa } from '../../../api/account_management/mfa';\nimport { PhoneAuthCredential } from '../../../core/credentials/phone';\nimport {\n finalizeSignInPhoneMfa,\n FinalizeMfaResponse\n} from '../../../api/authentication/mfa';\n\n/**\n * {@inheritdoc PhoneMultiFactorAssertion}\n *\n * @public\n */\nexport class PhoneMultiFactorAssertionImpl\n extends MultiFactorAssertionImpl\n implements PhoneMultiFactorAssertion\n{\n private constructor(private readonly credential: PhoneAuthCredential) {\n super(FactorId.PHONE);\n }\n\n /** @internal */\n static _fromCredential(\n credential: PhoneAuthCredential\n ): PhoneMultiFactorAssertionImpl {\n return new PhoneMultiFactorAssertionImpl(credential);\n }\n\n /** @internal */\n _finalizeEnroll(\n auth: AuthInternal,\n idToken: string,\n displayName?: string | null\n ): Promise<FinalizeMfaResponse> {\n return finalizeEnrollPhoneMfa(auth, {\n idToken,\n displayName,\n phoneVerificationInfo: this.credential._makeVerificationRequest()\n });\n }\n\n /** @internal */\n _finalizeSignIn(\n auth: AuthInternal,\n mfaPendingCredential: string\n ): Promise<FinalizeMfaResponse> {\n return finalizeSignInPhoneMfa(auth, {\n mfaPendingCredential,\n phoneVerificationInfo: this.credential._makeVerificationRequest()\n });\n }\n}\n\n/**\n * Provider for generating a {@link PhoneMultiFactorAssertion}.\n *\n * @public\n */\nexport class PhoneMultiFactorGenerator {\n private constructor() {}\n\n /**\n * Provides a {@link PhoneMultiFactorAssertion} to confirm ownership of the phone second factor.\n *\n * @remarks\n * This method does not work in a Node.js environment.\n *\n * @param phoneAuthCredential - A credential provided by {@link PhoneAuthProvider.credential}.\n * @returns A {@link PhoneMultiFactorAssertion} which can be used with\n * {@link MultiFactorResolver.resolveSignIn}\n */\n static assertion(credential: PhoneAuthCredential): PhoneMultiFactorAssertion {\n return PhoneMultiFactorAssertionImpl._fromCredential(credential);\n }\n\n /**\n * The identifier of the phone second factor: `phone`.\n */\n static FACTOR_ID = 'phone';\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseApp, getApp, _getProvider } from '@firebase/app';\n\nimport {\n initializeAuth,\n beforeAuthStateChanged,\n onIdTokenChanged,\n connectAuthEmulator\n} from '..';\nimport { registerAuth } from '../core/auth/register';\nimport { ClientPlatform } from '../core/util/version';\nimport { browserLocalPersistence } from './persistence/local_storage';\nimport { browserSessionPersistence } from './persistence/session_storage';\nimport { indexedDBLocalPersistence } from './persistence/indexed_db';\nimport { browserPopupRedirectResolver } from './popup_redirect';\nimport { Auth, User } from '../model/public_types';\nimport { getDefaultEmulatorHost, getExperimentalSetting } from '@firebase/util';\nimport { _setExternalJSProvider } from './load_js';\nimport { _createError } from '../core/util/assert';\nimport { AuthErrorCode } from '../core/errors';\n\nconst DEFAULT_ID_TOKEN_MAX_AGE = 5 * 60;\nconst authIdTokenMaxAge =\n getExperimentalSetting('authIdTokenMaxAge') || DEFAULT_ID_TOKEN_MAX_AGE;\n\nlet lastPostedIdToken: string | undefined | null = null;\n\nconst mintCookieFactory = (url: string) => async (user: User | null) => {\n const idTokenResult = user && (await user.getIdTokenResult());\n const idTokenAge =\n idTokenResult &&\n (new Date().getTime() - Date.parse(idTokenResult.issuedAtTime)) / 1_000;\n if (idTokenAge && idTokenAge > authIdTokenMaxAge) {\n return;\n }\n // Specifically trip null => undefined when logged out, to delete any existing cookie\n const idToken = idTokenResult?.token;\n if (lastPostedIdToken === idToken) {\n return;\n }\n lastPostedIdToken = idToken;\n await fetch(url, {\n method: idToken ? 'POST' : 'DELETE',\n headers: idToken\n ? {\n 'Authorization': `Bearer ${idToken}`\n }\n : {}\n });\n};\n\n/**\n * Returns the Auth instance associated with the provided {@link @firebase/app#FirebaseApp}.\n * If no instance exists, initializes an Auth instance with platform-specific default dependencies.\n *\n * @param app - The Firebase App.\n *\n * @public\n */\nexport function getAuth(app: FirebaseApp = getApp()): Auth {\n const provider = _getProvider(app, 'auth');\n\n if (provider.isInitialized()) {\n return provider.getImmediate();\n }\n\n const auth = initializeAuth(app, {\n popupRedirectResolver: browserPopupRedirectResolver,\n persistence: [\n indexedDBLocalPersistence,\n browserLocalPersistence,\n browserSessionPersistence\n ]\n });\n\n const authTokenSyncPath = getExperimentalSetting('authTokenSyncURL');\n // Only do the Cookie exchange in a secure context\n if (\n authTokenSyncPath &&\n typeof isSecureContext === 'boolean' &&\n isSecureContext\n ) {\n // Don't allow urls (XSS possibility), only paths on the same domain\n const authTokenSyncUrl = new URL(authTokenSyncPath, location.origin);\n if (location.origin === authTokenSyncUrl.origin) {\n const mintCookie = mintCookieFactory(authTokenSyncUrl.toString());\n beforeAuthStateChanged(auth, mintCookie, () =>\n mintCookie(auth.currentUser)\n );\n onIdTokenChanged(auth, user => mintCookie(user));\n }\n }\n\n const authEmulatorHost = getDefaultEmulatorHost('auth');\n if (authEmulatorHost) {\n connectAuthEmulator(auth, `http://${authEmulatorHost}`);\n }\n\n return auth;\n}\n\nfunction getScriptParentElement(): HTMLDocument | HTMLHeadElement {\n return document.getElementsByTagName('head')?.[0] ?? document;\n}\n\n_setExternalJSProvider({\n loadJS(url: string): Promise<Event> {\n // TODO: consider adding timeout support & cancellation\n return new Promise((resolve, reject) => {\n const el = document.createElement('script');\n el.setAttribute('src', url);\n el.onload = resolve;\n el.onerror = e => {\n const error = _createError(AuthErrorCode.INTERNAL_ERROR);\n error.customData = e as unknown as Record<string, unknown>;\n reject(error);\n };\n el.type = 'text/javascript';\n el.charset = 'UTF-8';\n getScriptParentElement().appendChild(el);\n });\n },\n\n gapiScript: 'https://apis.google.com/js/api.js',\n recaptchaV2Script: 'https://www.google.com/recaptcha/api.js',\n recaptchaEnterpriseScript:\n 'https://www.google.com/recaptcha/enterprise.js?render='\n});\n\nregisterAuth(ClientPlatform.BROWSER);\n","/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface CordovaWindow extends Window {\n cordova: {\n plugins: {\n browsertab: {\n isAvailable(cb: (available: boolean) => void): void;\n openUrl(url: string): void;\n close(): void;\n };\n };\n\n InAppBrowser: {\n open(url: string, target: string, options: string): InAppBrowserRef;\n };\n };\n\n universalLinks: {\n subscribe(\n n: null,\n cb: (event: Record<string, string> | null) => void\n ): void;\n };\n\n BuildInfo: {\n readonly packageName: string;\n readonly displayName: string;\n };\n\n handleOpenURL(url: string): void;\n}\n\nexport interface InAppBrowserRef {\n close?: () => void;\n}\n\nexport function _cordovaWindow(): CordovaWindow {\n return window as unknown as CordovaWindow;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AuthProvider } from '../../model/public_types';\nimport { AuthErrorCode } from '../../core/errors';\nimport {\n debugAssert,\n _assert,\n _createError,\n _fail\n} from '../../core/util/assert';\nimport { _isAndroid, _isIOS, _isIOS7Or8 } from '../../core/util/browser';\nimport { _getRedirectUrl } from '../../core/util/handler';\nimport { AuthInternal } from '../../model/auth';\nimport { AuthEvent } from '../../model/popup_redirect';\nimport { InAppBrowserRef, _cordovaWindow } from '../plugins';\nimport {\n GetProjectConfigRequest,\n _getProjectConfig\n} from '../../api/project_config/get_project_config';\n\n/**\n * How long to wait after the app comes back into focus before concluding that\n * the user closed the sign in tab.\n */\nconst REDIRECT_TIMEOUT_MS = 2000;\n\n/**\n * Generates the URL for the OAuth handler.\n */\nexport async function _generateHandlerUrl(\n auth: AuthInternal,\n event: AuthEvent,\n provider: AuthProvider\n): Promise<string> {\n // Get the cordova plugins\n const { BuildInfo } = _cordovaWindow();\n debugAssert(event.sessionId, 'AuthEvent did not contain a session ID');\n const sessionDigest = await computeSha256(event.sessionId);\n\n const additionalParams: Record<string, string> = {};\n if (_isIOS()) {\n // iOS app identifier\n additionalParams['ibi'] = BuildInfo.packageName;\n } else if (_isAndroid()) {\n // Android app identifier\n additionalParams['apn'] = BuildInfo.packageName;\n } else {\n _fail(auth, AuthErrorCode.OPERATION_NOT_SUPPORTED);\n }\n\n // Add the display name if available\n if (BuildInfo.displayName) {\n additionalParams['appDisplayName'] = BuildInfo.displayName;\n }\n\n // Attached the hashed session ID\n additionalParams['sessionId'] = sessionDigest;\n return _getRedirectUrl(\n auth,\n provider,\n event.type,\n undefined,\n event.eventId ?? undefined,\n additionalParams\n );\n}\n\n/**\n * Validates that this app is valid for this project configuration\n */\nexport async function _validateOrigin(auth: AuthInternal): Promise<void> {\n const { BuildInfo } = _cordovaWindow();\n const request: GetProjectConfigRequest = {};\n if (_isIOS()) {\n request.iosBundleId = BuildInfo.packageName;\n } else if (_isAndroid()) {\n request.androidPackageName = BuildInfo.packageName;\n } else {\n _fail(auth, AuthErrorCode.OPERATION_NOT_SUPPORTED);\n }\n\n // Will fail automatically if package name is not authorized\n await _getProjectConfig(auth, request);\n}\n\nexport function _performRedirect(\n handlerUrl: string\n): Promise<InAppBrowserRef | null> {\n // Get the cordova plugins\n const { cordova } = _cordovaWindow();\n\n return new Promise(resolve => {\n cordova.plugins.browsertab.isAvailable(browserTabIsAvailable => {\n let iabRef: InAppBrowserRef | null = null;\n if (browserTabIsAvailable) {\n cordova.plugins.browsertab.openUrl(handlerUrl);\n } else {\n // TODO: Return the inappbrowser ref that's returned from the open call\n iabRef = cordova.InAppBrowser.open(\n handlerUrl,\n _isIOS7Or8() ? '_blank' : '_system',\n 'location=yes'\n );\n }\n resolve(iabRef);\n });\n });\n}\n\n// Thin interface wrapper to avoid circular dependency with ./events module\ninterface PassiveAuthEventListener {\n addPassiveListener(cb: () => void): void;\n removePassiveListener(cb: () => void): void;\n}\n\n/**\n * This function waits for app activity to be seen before resolving. It does\n * this by attaching listeners to various dom events. Once the app is determined\n * to be visible, this promise resolves. AFTER that resolution, the listeners\n * are detached and any browser tabs left open will be closed.\n */\nexport async function _waitForAppResume(\n auth: AuthInternal,\n eventListener: PassiveAuthEventListener,\n iabRef: InAppBrowserRef | null\n): Promise<void> {\n // Get the cordova plugins\n const { cordova } = _cordovaWindow();\n\n let cleanup = (): void => {};\n try {\n await new Promise<void>((resolve, reject) => {\n let onCloseTimer: number | null = null;\n\n // DEFINE ALL THE CALLBACKS =====\n function authEventSeen(): void {\n // Auth event was detected. Resolve this promise and close the extra\n // window if it's still open.\n resolve();\n const closeBrowserTab = cordova.plugins.browsertab?.close;\n if (typeof closeBrowserTab === 'function') {\n closeBrowserTab();\n }\n // Close inappbrowser embedded webview in iOS7 and 8 case if still\n // open.\n if (typeof iabRef?.close === 'function') {\n iabRef.close();\n }\n }\n\n function resumed(): void {\n if (onCloseTimer) {\n // This code already ran; do not rerun.\n return;\n }\n\n onCloseTimer = window.setTimeout(() => {\n // Wait two seconds after resume then reject.\n reject(_createError(auth, AuthErrorCode.REDIRECT_CANCELLED_BY_USER));\n }, REDIRECT_TIMEOUT_MS);\n }\n\n function visibilityChanged(): void {\n if (document?.visibilityState === 'visible') {\n resumed();\n }\n }\n\n // ATTACH ALL THE LISTENERS =====\n // Listen for the auth event\n eventListener.addPassiveListener(authEventSeen);\n\n // Listen for resume and visibility events\n document.addEventListener('resume', resumed, false);\n if (_isAndroid()) {\n document.addEventListener('visibilitychange', visibilityChanged, false);\n }\n\n // SETUP THE CLEANUP FUNCTION =====\n cleanup = () => {\n eventListener.removePassiveListener(authEventSeen);\n document.removeEventListener('resume', resumed, false);\n document.removeEventListener(\n 'visibilitychange',\n visibilityChanged,\n false\n );\n if (onCloseTimer) {\n window.clearTimeout(onCloseTimer);\n }\n };\n });\n } finally {\n cleanup();\n }\n}\n\n/**\n * Checks the configuration of the Cordova environment. This has no side effect\n * if the configuration is correct; otherwise it throws an error with the\n * missing plugin.\n */\nexport function _checkCordovaConfiguration(auth: AuthInternal): void {\n const win = _cordovaWindow();\n // Check all dependencies installed.\n // https://github.com/nordnet/cordova-universal-links-plugin\n // Note that cordova-universal-links-plugin has been abandoned.\n // A fork with latest fixes is available at:\n // https://www.npmjs.com/package/cordova-universal-links-plugin-fix\n _assert(\n typeof win?.universalLinks?.subscribe === 'function',\n auth,\n AuthErrorCode.INVALID_CORDOVA_CONFIGURATION,\n {\n missingPlugin: 'cordova-universal-links-plugin-fix'\n }\n );\n\n // https://www.npmjs.com/package/cordova-plugin-buildinfo\n _assert(\n typeof win?.BuildInfo?.packageName !== 'undefined',\n auth,\n AuthErrorCode.INVALID_CORDOVA_CONFIGURATION,\n {\n missingPlugin: 'cordova-plugin-buildInfo'\n }\n );\n\n // https://github.com/google/cordova-plugin-browsertab\n _assert(\n typeof win?.cordova?.plugins?.browsertab?.openUrl === 'function',\n auth,\n AuthErrorCode.INVALID_CORDOVA_CONFIGURATION,\n {\n missingPlugin: 'cordova-plugin-browsertab'\n }\n );\n _assert(\n typeof win?.cordova?.plugins?.browsertab?.isAvailable === 'function',\n auth,\n AuthErrorCode.INVALID_CORDOVA_CONFIGURATION,\n {\n missingPlugin: 'cordova-plugin-browsertab'\n }\n );\n\n // https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/\n _assert(\n typeof win?.cordova?.InAppBrowser?.open === 'function',\n auth,\n AuthErrorCode.INVALID_CORDOVA_CONFIGURATION,\n {\n missingPlugin: 'cordova-plugin-inappbrowser'\n }\n );\n}\n\n/**\n * Computes the SHA-256 of a session ID. The SubtleCrypto interface is only\n * available in \"secure\" contexts, which covers Cordova (which is served on a file\n * protocol).\n */\nasync function computeSha256(sessionId: string): Promise<string> {\n const bytes = stringToArrayBuffer(sessionId);\n\n // TODO: For IE11 crypto has a different name and this operation comes back\n // as an object, not a promise. This is the old proposed standard that\n // is used by IE11:\n // https://www.w3.org/TR/2013/WD-WebCryptoAPI-20130108/#cryptooperation-interface\n const buf = await crypto.subtle.digest('SHA-256', bytes);\n const arr = Array.from(new Uint8Array(buf));\n return arr.map(num => num.toString(16).padStart(2, '0')).join('');\n}\n\nfunction stringToArrayBuffer(str: string): Uint8Array {\n // This function is only meant to deal with an ASCII charset and makes\n // certain simplifying assumptions.\n debugAssert(\n /[0-9a-zA-Z]+/.test(str),\n 'Can only convert alpha-numeric strings'\n );\n if (typeof TextEncoder !== 'undefined') {\n return new TextEncoder().encode(str);\n }\n\n const buff = new ArrayBuffer(str.length);\n const view = new Uint8Array(buff);\n for (let i = 0; i < str.length; i++) {\n view[i] = str.charCodeAt(i);\n }\n return view;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { querystringDecode } from '@firebase/util';\nimport { AuthEventManager } from '../../core/auth/auth_event_manager';\nimport { AuthErrorCode } from '../../core/errors';\nimport { PersistedBlob, PersistenceInternal } from '../../core/persistence';\nimport {\n KeyName,\n _persistenceKeyName\n} from '../../core/persistence/persistence_user_manager';\nimport { _createError } from '../../core/util/assert';\nimport { _getInstance } from '../../core/util/instantiator';\nimport { AuthInternal } from '../../model/auth';\nimport { AuthEvent, AuthEventType } from '../../model/popup_redirect';\nimport { browserLocalPersistence } from '../../platform_browser/persistence/local_storage';\n\nconst SESSION_ID_LENGTH = 20;\n\n/** Custom AuthEventManager that adds passive listeners to events */\nexport class CordovaAuthEventManager extends AuthEventManager {\n private readonly passiveListeners = new Set<(e: AuthEvent) => void>();\n private resolveInitialized!: () => void;\n private initPromise = new Promise<void>(resolve => {\n this.resolveInitialized = resolve;\n });\n\n addPassiveListener(cb: (e: AuthEvent) => void): void {\n this.passiveListeners.add(cb);\n }\n\n removePassiveListener(cb: (e: AuthEvent) => void): void {\n this.passiveListeners.delete(cb);\n }\n\n // In a Cordova environment, this manager can live through multiple redirect\n // operations\n resetRedirect(): void {\n this.queuedRedirectEvent = null;\n this.hasHandledPotentialRedirect = false;\n }\n\n /** Override the onEvent method */\n onEvent(event: AuthEvent): boolean {\n this.resolveInitialized();\n this.passiveListeners.forEach(cb => cb(event));\n return super.onEvent(event);\n }\n\n async initialized(): Promise<void> {\n await this.initPromise;\n }\n}\n\n/**\n * Generates a (partial) {@link AuthEvent}.\n */\nexport function _generateNewEvent(\n auth: AuthInternal,\n type: AuthEventType,\n eventId: string | null = null\n): AuthEvent {\n return {\n type,\n eventId,\n urlResponse: null,\n sessionId: generateSessionId(),\n postBody: null,\n tenantId: auth.tenantId,\n error: _createError(auth, AuthErrorCode.NO_AUTH_EVENT)\n };\n}\n\nexport function _savePartialEvent(\n auth: AuthInternal,\n event: AuthEvent\n): Promise<void> {\n return storage()._set(persistenceKey(auth), event as object as PersistedBlob);\n}\n\nexport async function _getAndRemoveEvent(\n auth: AuthInternal\n): Promise<AuthEvent | null> {\n const event = (await storage()._get(\n persistenceKey(auth)\n )) as AuthEvent | null;\n if (event) {\n await storage()._remove(persistenceKey(auth));\n }\n return event;\n}\n\nexport function _eventFromPartialAndUrl(\n partialEvent: AuthEvent,\n url: string\n): AuthEvent | null {\n // Parse the deep link within the dynamic link URL.\n const callbackUrl = _getDeepLinkFromCallback(url);\n // Confirm it is actually a callback URL.\n // Currently the universal link will be of this format:\n // https://<AUTH_DOMAIN>/__/auth/callback<OAUTH_RESPONSE>\n // This is a fake URL but is not intended to take the user anywhere\n // and just redirect to the app.\n if (callbackUrl.includes('/__/auth/callback')) {\n // Check if there is an error in the URL.\n // This mechanism is also used to pass errors back to the app:\n // https://<AUTH_DOMAIN>/__/auth/callback?firebaseError=<STRINGIFIED_ERROR>\n const params = searchParamsOrEmpty(callbackUrl);\n // Get the error object corresponding to the stringified error if found.\n const errorObject = params['firebaseError']\n ? parseJsonOrNull(decodeURIComponent(params['firebaseError']))\n : null;\n const code = errorObject?.['code']?.split('auth/')?.[1];\n const error = code ? _createError(code) : null;\n if (error) {\n return {\n type: partialEvent.type,\n eventId: partialEvent.eventId,\n tenantId: partialEvent.tenantId,\n error,\n urlResponse: null,\n sessionId: null,\n postBody: null\n };\n } else {\n return {\n type: partialEvent.type,\n eventId: partialEvent.eventId,\n tenantId: partialEvent.tenantId,\n sessionId: partialEvent.sessionId,\n urlResponse: callbackUrl,\n postBody: null\n };\n }\n }\n\n return null;\n}\n\nfunction generateSessionId(): string {\n const chars = [];\n const allowedChars =\n '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n for (let i = 0; i < SESSION_ID_LENGTH; i++) {\n const idx = Math.floor(Math.random() * allowedChars.length);\n chars.push(allowedChars.charAt(idx));\n }\n return chars.join('');\n}\n\nfunction storage(): PersistenceInternal {\n return _getInstance(browserLocalPersistence);\n}\n\nfunction persistenceKey(auth: AuthInternal): string {\n return _persistenceKeyName(KeyName.AUTH_EVENT, auth.config.apiKey, auth.name);\n}\n\nfunction parseJsonOrNull(json: string): ReturnType<typeof JSON.parse> | null {\n try {\n return JSON.parse(json);\n } catch (e) {\n return null;\n }\n}\n\n// Exported for testing\nexport function _getDeepLinkFromCallback(url: string): string {\n const params = searchParamsOrEmpty(url);\n const link = params['link'] ? decodeURIComponent(params['link']) : undefined;\n // Double link case (automatic redirect)\n const doubleDeepLink = searchParamsOrEmpty(link)['link'];\n // iOS custom scheme links.\n const iOSDeepLink = params['deep_link_id']\n ? decodeURIComponent(params['deep_link_id'])\n : undefined;\n const iOSDoubleDeepLink = searchParamsOrEmpty(iOSDeepLink)['link'];\n return iOSDoubleDeepLink || iOSDeepLink || doubleDeepLink || link || url;\n}\n\n/**\n * Optimistically tries to get search params from a string, or else returns an\n * empty search params object.\n */\nfunction searchParamsOrEmpty(url: string | undefined): Record<string, string> {\n if (!url?.includes('?')) {\n return {};\n }\n\n const [_, ...rest] = url.split('?');\n return querystringDecode(rest.join('?')) as Record<string, string>;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AuthProvider, PopupRedirectResolver } from '../../model/public_types';\nimport { browserSessionPersistence } from '../../platform_browser/persistence/session_storage';\nimport { AuthInternal } from '../../model/auth';\nimport {\n AuthEvent,\n AuthEventType,\n PopupRedirectResolverInternal\n} from '../../model/popup_redirect';\nimport { AuthPopup } from '../../platform_browser/util/popup';\nimport { _createError, _fail } from '../../core/util/assert';\nimport { AuthErrorCode } from '../../core/errors';\nimport {\n _checkCordovaConfiguration,\n _generateHandlerUrl,\n _performRedirect,\n _validateOrigin,\n _waitForAppResume\n} from './utils';\nimport {\n CordovaAuthEventManager,\n _eventFromPartialAndUrl,\n _generateNewEvent,\n _getAndRemoveEvent,\n _savePartialEvent\n} from './events';\nimport { AuthEventManager } from '../../core/auth/auth_event_manager';\nimport { _getRedirectResult } from '../../platform_browser/strategies/redirect';\nimport {\n _clearRedirectOutcomes,\n _overrideRedirectResult\n} from '../../core/strategies/redirect';\nimport { _cordovaWindow } from '../plugins';\n\n/**\n * How long to wait for the initial auth event before concluding no\n * redirect pending\n */\nconst INITIAL_EVENT_TIMEOUT_MS = 500;\n\nclass CordovaPopupRedirectResolver implements PopupRedirectResolverInternal {\n readonly _redirectPersistence = browserSessionPersistence;\n readonly _shouldInitProactively = true; // This is lightweight for Cordova\n private readonly eventManagers = new Map<string, CordovaAuthEventManager>();\n private readonly originValidationPromises: Record<string, Promise<void>> = {};\n\n _completeRedirectFn = _getRedirectResult;\n _overrideRedirectResult = _overrideRedirectResult;\n\n async _initialize(auth: AuthInternal): Promise<CordovaAuthEventManager> {\n const key = auth._key();\n let manager = this.eventManagers.get(key);\n if (!manager) {\n manager = new CordovaAuthEventManager(auth);\n this.eventManagers.set(key, manager);\n this.attachCallbackListeners(auth, manager);\n }\n return manager;\n }\n\n _openPopup(auth: AuthInternal): Promise<AuthPopup> {\n _fail(auth, AuthErrorCode.OPERATION_NOT_SUPPORTED);\n }\n\n async _openRedirect(\n auth: AuthInternal,\n provider: AuthProvider,\n authType: AuthEventType,\n eventId?: string\n ): Promise<void> {\n _checkCordovaConfiguration(auth);\n const manager = await this._initialize(auth);\n await manager.initialized();\n\n // Reset the persisted redirect states. This does not matter on Web where\n // the redirect always blows away application state entirely. On Cordova,\n // the app maintains control flow through the redirect.\n manager.resetRedirect();\n _clearRedirectOutcomes();\n\n await this._originValidation(auth);\n\n const event = _generateNewEvent(auth, authType, eventId);\n await _savePartialEvent(auth, event);\n const url = await _generateHandlerUrl(auth, event, provider);\n const iabRef = await _performRedirect(url);\n return _waitForAppResume(auth, manager, iabRef);\n }\n\n _isIframeWebStorageSupported(\n _auth: AuthInternal,\n _cb: (support: boolean) => unknown\n ): void {\n throw new Error('Method not implemented.');\n }\n\n _originValidation(auth: AuthInternal): Promise<void> {\n const key = auth._key();\n if (!this.originValidationPromises[key]) {\n this.originValidationPromises[key] = _validateOrigin(auth);\n }\n\n return this.originValidationPromises[key];\n }\n\n private attachCallbackListeners(\n auth: AuthInternal,\n manager: AuthEventManager\n ): void {\n // Get the global plugins\n const { universalLinks, handleOpenURL, BuildInfo } = _cordovaWindow();\n\n const noEventTimeout = setTimeout(async () => {\n // We didn't see that initial event. Clear any pending object and\n // dispatch no event\n await _getAndRemoveEvent(auth);\n manager.onEvent(generateNoEvent());\n }, INITIAL_EVENT_TIMEOUT_MS);\n\n const universalLinksCb = async (\n eventData: Record<string, string> | null\n ): Promise<void> => {\n // We have an event so we can clear the no event timeout\n clearTimeout(noEventTimeout);\n\n const partialEvent = await _getAndRemoveEvent(auth);\n let finalEvent: AuthEvent | null = null;\n if (partialEvent && eventData?.['url']) {\n finalEvent = _eventFromPartialAndUrl(partialEvent, eventData['url']);\n }\n\n // If finalEvent is never filled, trigger with no event\n manager.onEvent(finalEvent || generateNoEvent());\n };\n\n // Universal links subscriber doesn't exist for iOS, so we need to check\n if (\n typeof universalLinks !== 'undefined' &&\n typeof universalLinks.subscribe === 'function'\n ) {\n universalLinks.subscribe(null, universalLinksCb);\n }\n\n // iOS 7 or 8 custom URL schemes.\n // This is also the current default behavior for iOS 9+.\n // For this to work, cordova-plugin-customurlscheme needs to be installed.\n // https://github.com/EddyVerbruggen/Custom-URL-scheme\n // Do not overwrite the existing developer's URL handler.\n const existingHandleOpenURL = handleOpenURL;\n const packagePrefix = `${BuildInfo.packageName.toLowerCase()}://`;\n _cordovaWindow().handleOpenURL = async url => {\n if (url.toLowerCase().startsWith(packagePrefix)) {\n // We want this intentionally to float\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n universalLinksCb({ url });\n }\n // Call the developer's handler if it is present.\n if (typeof existingHandleOpenURL === 'function') {\n try {\n existingHandleOpenURL(url);\n } catch (e) {\n // This is a developer error. Don't stop the flow of the SDK.\n console.error(e);\n }\n }\n };\n }\n}\n\n/**\n * An implementation of {@link PopupRedirectResolver} suitable for Cordova\n * based applications.\n *\n * @public\n */\nexport const cordovaPopupRedirectResolver: PopupRedirectResolver =\n CordovaPopupRedirectResolver;\n\nfunction generateNoEvent(): AuthEvent {\n return {\n type: AuthEventType.UNKNOWN,\n eventId: null,\n sessionId: null,\n urlResponse: null,\n postBody: null,\n tenantId: null,\n error: _createError(AuthErrorCode.NO_AUTH_EVENT)\n };\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _castAuth } from '../src/core/auth/auth_impl';\nimport { Auth } from '../src/model/public_types';\n\n/**\n * This interface is intended only for use by @firebase/auth-compat, do not use directly\n */\nexport * from '../index';\n\nexport { SignInWithIdpResponse } from '../src/api/authentication/idp';\nexport { AuthErrorCode } from '../src/core/errors';\nexport { PersistenceInternal } from '../src/core/persistence';\nexport { _persistenceKeyName } from '../src/core/persistence/persistence_user_manager';\nexport { UserImpl } from '../src/core/user/user_impl';\nexport { _getInstance } from '../src/core/util/instantiator';\nexport {\n PopupRedirectResolverInternal,\n EventManager,\n AuthEventType\n} from '../src/model/popup_redirect';\nexport { UserCredentialInternal, UserParameters } from '../src/model/user';\nexport { AuthInternal, ConfigInternal } from '../src/model/auth';\nexport { DefaultConfig, AuthImpl, _castAuth } from '../src/core/auth/auth_impl';\n\nexport { ClientPlatform, _getClientVersion } from '../src/core/util/version';\n\nexport { _generateEventId } from '../src/core/util/event_id';\nexport { TaggedWithTokenResponse } from '../src/model/id_token';\nexport { _fail, _assert } from '../src/core/util/assert';\nexport { AuthPopup } from '../src/platform_browser/util/popup';\nexport { _getRedirectResult } from '../src/platform_browser/strategies/redirect';\nexport { _overrideRedirectResult } from '../src/core/strategies/redirect';\nexport { cordovaPopupRedirectResolver } from '../src/platform_cordova/popup_redirect/popup_redirect';\nexport { FetchProvider } from '../src/core/util/fetch_provider';\nexport { SAMLAuthCredential } from '../src/core/credentials/saml';\n\n// This function should only be called by frameworks (e.g. FirebaseUI-web) to log their usage.\n// It is not intended for direct use by developer apps. NO jsdoc here to intentionally leave it out\n// of autogenerated documentation pages to reduce accidental misuse.\nexport function addFrameworkForLogging(auth: Auth, framework: string): void {\n _castAuth(auth)._logFramework(framework);\n}\n"],"names":["jsHelpers._generateCallbackName","jsHelpers._recaptchaV2ScriptUrl","jsHelpers._loadJS","_link","_linkUser","_validateOrigin","js._generateCallbackName","js\n ._loadJS","js._gapiScriptUrl","gapiLoader._loadGapi"],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;AAEH;;;;AAIG;AACU,MAAA,QAAQ,GAAG;;AAEtB,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,IAAI,EAAE,MAAM;EACH;AAEX;;;;AAIG;AACU,MAAA,UAAU,GAAG;;AAExB,IAAA,QAAQ,EAAE,cAAc;;AAExB,IAAA,MAAM,EAAE,YAAY;;AAEpB,IAAA,MAAM,EAAE,YAAY;;AAEpB,IAAA,QAAQ,EAAE,UAAU;;AAEpB,IAAA,KAAK,EAAE,OAAO;;AAEd,IAAA,OAAO,EAAE,aAAa;EACb;AAEX;;;;AAIG;AACU,MAAA,YAAY,GAAG;;AAE1B,IAAA,UAAU,EAAE,WAAW;;AAEvB,IAAA,cAAc,EAAE,UAAU;;AAE1B,IAAA,QAAQ,EAAE,cAAc;;AAExB,IAAA,MAAM,EAAE,YAAY;;AAEpB,IAAA,MAAM,EAAE,YAAY;;AAEpB,IAAA,KAAK,EAAE,OAAO;;AAEd,IAAA,OAAO,EAAE,aAAa;EACb;AAEX;;;;AAIG;AACU,MAAA,aAAa,GAAG;;AAE3B,IAAA,IAAI,EAAE,MAAM;;AAEZ,IAAA,cAAc,EAAE,gBAAgB;;AAEhC,IAAA,OAAO,EAAE,QAAQ;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,cAAc,CAAC,SAAS,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;SAClD;;;;;;QAOD,MAAM,qBAAqB,GAAG,aAAa,CAAC;QAC5C,MAAM,aAAa,GAAG,CAAA,EAAG,SAAS,CAAC,WAAW,CAAC,WAAW,EAAE,CAAA,GAAA,CAAK,CAAC;QAClE,cAAc,EAAE,CAAC,aAAa,GAAG,OAAM,GAAG,KAAG;YAC3C,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;;;AAG/C,gBAAA,gBAAgB,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;aAC3B;;AAED,YAAA,IAAI,OAAO,qBAAqB,KAAK,UAAU,EAAE;AAC/C,gBAAA,IAAI;oBACF,qBAAqB,CAAC,GAAG,CAAC,CAAC;iBAC5B;gBAAC,OAAO,CAAC,EAAE;;AAEV,oBAAA,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBAClB;aACF;AACH,SAAC,CAAC;KACH;AACF,CAAA;AAED;;;;;AAKG;AACI,MAAM,4BAA4B,GACvC,6BAA6B;AAE/B,SAAS,eAAe,GAAA;IACtB,OAAO;AACL,QAAA,IAAI,EAAuB,SAAA;AAC3B,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,SAAS,EAAE,IAAI;AACf,QAAA,WAAW,EAAE,IAAI;AACjB,QAAA,QAAQ,EAAE,IAAI;AACd,QAAA,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,YAAY,CAA6B,eAAA,mCAAA;KACjD,CAAC;AACJ;;AC5MA;;;;;;;;;;;;;;;AAeG;AAqCH;AACA;AACA;AACgB,SAAA,sBAAsB,CAAC,IAAU,EAAE,SAAiB,EAAA;IAClE,SAAS,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;AAC3C;;;;"}
\ No newline at end of file diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/internal/index.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/internal/index.d.ts deleted file mode 100644 index b683c49..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/internal/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth } from '../src/model/public_types'; -/** - * This interface is intended only for use by @firebase/auth-compat, do not use directly - */ -export * from '../index'; -export { SignInWithIdpResponse } from '../src/api/authentication/idp'; -export { AuthErrorCode } from '../src/core/errors'; -export { PersistenceInternal } from '../src/core/persistence'; -export { _persistenceKeyName } from '../src/core/persistence/persistence_user_manager'; -export { UserImpl } from '../src/core/user/user_impl'; -export { _getInstance } from '../src/core/util/instantiator'; -export { PopupRedirectResolverInternal, EventManager, AuthEventType } from '../src/model/popup_redirect'; -export { UserCredentialInternal, UserParameters } from '../src/model/user'; -export { AuthInternal, ConfigInternal } from '../src/model/auth'; -export { DefaultConfig, AuthImpl, _castAuth } from '../src/core/auth/auth_impl'; -export { ClientPlatform, _getClientVersion } from '../src/core/util/version'; -export { _generateEventId } from '../src/core/util/event_id'; -export { TaggedWithTokenResponse } from '../src/model/id_token'; -export { _fail, _assert } from '../src/core/util/assert'; -export { AuthPopup } from '../src/platform_browser/util/popup'; -export { _getRedirectResult } from '../src/platform_browser/strategies/redirect'; -export { _overrideRedirectResult } from '../src/core/strategies/redirect'; -export { cordovaPopupRedirectResolver } from '../src/platform_cordova/popup_redirect/popup_redirect'; -export { FetchProvider } from '../src/core/util/fetch_provider'; -export { SAMLAuthCredential } from '../src/core/credentials/saml'; -export declare function addFrameworkForLogging(auth: Auth, framework: string): void; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/package.json b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/package.json deleted file mode 100644 index 7c34deb..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/package.json +++ /dev/null @@ -1 +0,0 @@ -{"type":"module"}
\ No newline at end of file diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/register-7993b7af.js b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/register-7993b7af.js deleted file mode 100644 index 26ba556..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/register-7993b7af.js +++ /dev/null @@ -1,8255 +0,0 @@ -import { ErrorFactory, isBrowserExtension, isMobileCordova, isReactNative, FirebaseError, querystring, isCloudflareWorker, isCloudWorkstation, getModularInstance, base64Decode, getUA, isIE, createSubscribe, deepEqual, pingServer, updateEmulatorBanner, querystringDecode, extractQuerystring } from '@firebase/util'; -import { SDK_VERSION, _isFirebaseServerApp, _getProvider, _registerComponent, registerVersion } from '@firebase/app'; -import { Component } from '@firebase/component'; -import { Logger, LogLevel } from '@firebase/logger'; - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function _debugErrorMap() { - return { - ["admin-restricted-operation" /* AuthErrorCode.ADMIN_ONLY_OPERATION */]: 'This operation is restricted to administrators only.', - ["argument-error" /* AuthErrorCode.ARGUMENT_ERROR */]: '', - ["app-not-authorized" /* AuthErrorCode.APP_NOT_AUTHORIZED */]: "This app, identified by the domain where it's hosted, is not " + - 'authorized to use Firebase Authentication with the provided API key. ' + - 'Review your key configuration in the Google API console.', - ["app-not-installed" /* AuthErrorCode.APP_NOT_INSTALLED */]: 'The requested mobile application corresponding to the identifier (' + - 'Android package name or iOS bundle ID) provided is not installed on ' + - 'this device.', - ["captcha-check-failed" /* AuthErrorCode.CAPTCHA_CHECK_FAILED */]: 'The reCAPTCHA response token provided is either invalid, expired, ' + - 'already used or the domain associated with it does not match the list ' + - 'of whitelisted domains.', - ["code-expired" /* AuthErrorCode.CODE_EXPIRED */]: 'The SMS code has expired. Please re-send the verification code to try ' + - 'again.', - ["cordova-not-ready" /* AuthErrorCode.CORDOVA_NOT_READY */]: 'Cordova framework is not ready.', - ["cors-unsupported" /* AuthErrorCode.CORS_UNSUPPORTED */]: 'This browser is not supported.', - ["credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */]: 'This credential is already associated with a different user account.', - ["custom-token-mismatch" /* AuthErrorCode.CREDENTIAL_MISMATCH */]: 'The custom token corresponds to a different audience.', - ["requires-recent-login" /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */]: 'This operation is sensitive and requires recent authentication. Log in ' + - 'again before retrying this request.', - ["dependent-sdk-initialized-before-auth" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */]: 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' + - 'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' + - 'starting any other Firebase SDK.', - ["dynamic-link-not-activated" /* AuthErrorCode.DYNAMIC_LINK_NOT_ACTIVATED */]: 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' + - 'conditions.', - ["email-change-needs-verification" /* AuthErrorCode.EMAIL_CHANGE_NEEDS_VERIFICATION */]: 'Multi-factor users must always have a verified email.', - ["email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */]: 'The email address is already in use by another account.', - ["emulator-config-failed" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */]: 'Auth instance has already been used to make a network call. Auth can ' + - 'no longer be configured to use the emulator. Try calling ' + - '"connectAuthEmulator()" sooner.', - ["expired-action-code" /* AuthErrorCode.EXPIRED_OOB_CODE */]: 'The action code has expired.', - ["cancelled-popup-request" /* AuthErrorCode.EXPIRED_POPUP_REQUEST */]: 'This operation has been cancelled due to another conflicting popup being opened.', - ["internal-error" /* AuthErrorCode.INTERNAL_ERROR */]: 'An internal AuthError has occurred.', - ["invalid-app-credential" /* AuthErrorCode.INVALID_APP_CREDENTIAL */]: 'The phone verification request contains an invalid application verifier.' + - ' The reCAPTCHA token response is either invalid or expired.', - ["invalid-app-id" /* AuthErrorCode.INVALID_APP_ID */]: 'The mobile app identifier is not registered for the current project.', - ["invalid-user-token" /* AuthErrorCode.INVALID_AUTH */]: "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 isn't for " + - 'the project associated with this API key.', - ["invalid-auth-event" /* AuthErrorCode.INVALID_AUTH_EVENT */]: 'An internal AuthError has occurred.', - ["invalid-verification-code" /* AuthErrorCode.INVALID_CODE */]: 'The SMS verification code used to create the phone auth credential is ' + - 'invalid. Please resend the verification code sms and be sure to use the ' + - 'verification code provided by the user.', - ["invalid-continue-uri" /* AuthErrorCode.INVALID_CONTINUE_URI */]: 'The continue URL provided in the request is invalid.', - ["invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */]: 'The following Cordova plugins must be installed to enable OAuth sign-in: ' + - 'cordova-plugin-buildinfo, cordova-universal-links-plugin, ' + - 'cordova-plugin-browsertab, cordova-plugin-inappbrowser and ' + - 'cordova-plugin-customurlscheme.', - ["invalid-custom-token" /* AuthErrorCode.INVALID_CUSTOM_TOKEN */]: 'The custom token format is incorrect. Please check the documentation.', - ["invalid-dynamic-link-domain" /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */]: 'The provided dynamic link domain is not configured or authorized for the current project.', - ["invalid-email" /* AuthErrorCode.INVALID_EMAIL */]: 'The email address is badly formatted.', - ["invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */]: 'Emulator URL must start with a valid scheme (http:// or https://).', - ["invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */]: 'Your API key is invalid, please check you have copied it correctly.', - ["invalid-cert-hash" /* AuthErrorCode.INVALID_CERT_HASH */]: 'The SHA-1 certificate hash provided is invalid.', - ["invalid-credential" /* AuthErrorCode.INVALID_CREDENTIAL */]: 'The supplied auth credential is incorrect, malformed or has expired.', - ["invalid-message-payload" /* AuthErrorCode.INVALID_MESSAGE_PAYLOAD */]: '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.', - ["invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */]: 'The request does not contain a valid proof of first factor successful sign-in.', - ["invalid-oauth-provider" /* AuthErrorCode.INVALID_OAUTH_PROVIDER */]: 'EmailAuthProvider is not supported for this operation. This operation ' + - 'only supports OAuth providers.', - ["invalid-oauth-client-id" /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */]: 'The OAuth client ID provided is either invalid or does not match the ' + - 'specified API key.', - ["unauthorized-domain" /* AuthErrorCode.INVALID_ORIGIN */]: 'This domain is not authorized for OAuth operations for your Firebase ' + - 'project. Edit the list of authorized domains from the Firebase console.', - ["invalid-action-code" /* AuthErrorCode.INVALID_OOB_CODE */]: 'The action code is invalid. This can happen if the code is malformed, ' + - 'expired, or has already been used.', - ["wrong-password" /* AuthErrorCode.INVALID_PASSWORD */]: 'The password is invalid or the user does not have a password.', - ["invalid-persistence-type" /* AuthErrorCode.INVALID_PERSISTENCE */]: 'The specified persistence type is invalid. It can only be local, session or none.', - ["invalid-phone-number" /* AuthErrorCode.INVALID_PHONE_NUMBER */]: '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].', - ["invalid-provider-id" /* AuthErrorCode.INVALID_PROVIDER_ID */]: 'The specified provider ID is invalid.', - ["invalid-recipient-email" /* AuthErrorCode.INVALID_RECIPIENT_EMAIL */]: 'The email corresponding to this action failed to send as the provided ' + - 'recipient email address is invalid.', - ["invalid-sender" /* AuthErrorCode.INVALID_SENDER */]: 'The email template corresponding to this action contains an invalid sender email or name. ' + - 'Please fix by going to the Auth email templates section in the Firebase Console.', - ["invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */]: 'The verification ID used to create the phone auth credential is invalid.', - ["invalid-tenant-id" /* AuthErrorCode.INVALID_TENANT_ID */]: "The Auth instance's tenant ID is invalid.", - ["login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */]: 'Login blocked by user-provided method: {$originalMessage}', - ["missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */]: 'An Android Package Name must be provided if the Android App is required to be installed.', - ["auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */]: 'Be sure to include authDomain when calling firebase.initializeApp(), ' + - 'by following the instructions in the Firebase console.', - ["missing-app-credential" /* AuthErrorCode.MISSING_APP_CREDENTIAL */]: 'The phone verification request is missing an application verifier ' + - 'assertion. A reCAPTCHA response token needs to be provided.', - ["missing-verification-code" /* AuthErrorCode.MISSING_CODE */]: 'The phone auth credential was created with an empty SMS verification code.', - ["missing-continue-uri" /* AuthErrorCode.MISSING_CONTINUE_URI */]: 'A continue URL must be provided in the request.', - ["missing-iframe-start" /* AuthErrorCode.MISSING_IFRAME_START */]: 'An internal AuthError has occurred.', - ["missing-ios-bundle-id" /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */]: 'An iOS Bundle ID must be provided if an App Store ID is provided.', - ["missing-or-invalid-nonce" /* AuthErrorCode.MISSING_OR_INVALID_NONCE */]: 'The request does not contain a valid nonce. This can occur if the ' + - 'SHA-256 hash of the provided raw nonce does not match the hashed nonce ' + - 'in the ID token payload.', - ["missing-password" /* AuthErrorCode.MISSING_PASSWORD */]: 'A non-empty password must be provided', - ["missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */]: 'No second factor identifier is provided.', - ["missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */]: 'The request is missing proof of first factor successful sign-in.', - ["missing-phone-number" /* AuthErrorCode.MISSING_PHONE_NUMBER */]: 'To send verification codes, provide a phone number for the recipient.', - ["missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */]: 'The phone auth credential was created with an empty verification ID.', - ["app-deleted" /* AuthErrorCode.MODULE_DESTROYED */]: 'This instance of FirebaseApp has been deleted.', - ["multi-factor-info-not-found" /* AuthErrorCode.MFA_INFO_NOT_FOUND */]: 'The user does not have a second factor matching the identifier provided.', - ["multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */]: 'Proof of ownership of a second factor is required to complete sign-in.', - ["account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */]: 'An account already exists with the same email address but different ' + - 'sign-in credentials. Sign in using a provider associated with this ' + - 'email address.', - ["network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */]: 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.', - ["no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */]: 'An internal AuthError has occurred.', - ["no-such-provider" /* AuthErrorCode.NO_SUCH_PROVIDER */]: 'User was not linked to an account with the given provider.', - ["null-user" /* AuthErrorCode.NULL_USER */]: 'A null user object was provided as the argument for an operation which ' + - 'requires a non-null user object.', - ["operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */]: '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.', - ["operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */]: 'This operation is not supported in the environment this application is ' + - 'running on. "location.protocol" must be http, https or chrome-extension' + - ' and web storage must be enabled.', - ["popup-blocked" /* AuthErrorCode.POPUP_BLOCKED */]: 'Unable to establish a connection with the popup. It may have been blocked by the browser.', - ["popup-closed-by-user" /* AuthErrorCode.POPUP_CLOSED_BY_USER */]: 'The popup has been closed by the user before finalizing the operation.', - ["provider-already-linked" /* AuthErrorCode.PROVIDER_ALREADY_LINKED */]: 'User can only be linked to one identity for the given provider.', - ["quota-exceeded" /* AuthErrorCode.QUOTA_EXCEEDED */]: "The project's quota for this operation has been exceeded.", - ["redirect-cancelled-by-user" /* AuthErrorCode.REDIRECT_CANCELLED_BY_USER */]: 'The redirect operation has been cancelled by the user before finalizing.', - ["redirect-operation-pending" /* AuthErrorCode.REDIRECT_OPERATION_PENDING */]: 'A redirect sign-in operation is already pending.', - ["rejected-credential" /* AuthErrorCode.REJECTED_CREDENTIAL */]: 'The request contains malformed or mismatching credentials.', - ["second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */]: 'The second factor is already enrolled on this account.', - ["maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */]: 'The maximum allowed number of second factors on a user has been exceeded.', - ["tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */]: "The provided tenant ID does not match the Auth instance's tenant ID", - ["timeout" /* AuthErrorCode.TIMEOUT */]: 'The operation has timed out.', - ["user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */]: "The user's credential is no longer valid. The user must sign in again.", - ["too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */]: 'We have blocked all requests from this device due to unusual activity. ' + - 'Try again later.', - ["unauthorized-continue-uri" /* AuthErrorCode.UNAUTHORIZED_DOMAIN */]: 'The domain of the continue URL is not whitelisted. Please whitelist ' + - 'the domain in the Firebase console.', - ["unsupported-first-factor" /* AuthErrorCode.UNSUPPORTED_FIRST_FACTOR */]: 'Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.', - ["unsupported-persistence-type" /* AuthErrorCode.UNSUPPORTED_PERSISTENCE */]: 'The current environment does not support the specified persistence type.', - ["unsupported-tenant-operation" /* AuthErrorCode.UNSUPPORTED_TENANT_OPERATION */]: 'This operation is not supported in a multi-tenant context.', - ["unverified-email" /* AuthErrorCode.UNVERIFIED_EMAIL */]: 'The operation requires a verified email.', - ["user-cancelled" /* AuthErrorCode.USER_CANCELLED */]: 'The user did not grant your application the permissions it requested.', - ["user-not-found" /* AuthErrorCode.USER_DELETED */]: 'There is no user record corresponding to this identifier. The user may ' + - 'have been deleted.', - ["user-disabled" /* AuthErrorCode.USER_DISABLED */]: 'The user account has been disabled by an administrator.', - ["user-mismatch" /* AuthErrorCode.USER_MISMATCH */]: 'The supplied credentials do not correspond to the previously signed in user.', - ["user-signed-out" /* AuthErrorCode.USER_SIGNED_OUT */]: '', - ["weak-password" /* AuthErrorCode.WEAK_PASSWORD */]: 'The password must be 6 characters long or more.', - ["web-storage-unsupported" /* AuthErrorCode.WEB_STORAGE_UNSUPPORTED */]: 'This browser is not supported or 3rd party cookies and data may be disabled.', - ["already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */]: 'initializeAuth() has already been called with ' + - 'different options. To avoid this error, call initializeAuth() with the ' + - 'same options as when it was originally called, or call getAuth() to return the' + - ' already initialized instance.', - ["missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */]: 'The reCAPTCHA token is missing when sending request to the backend.', - ["invalid-recaptcha-token" /* AuthErrorCode.INVALID_RECAPTCHA_TOKEN */]: 'The reCAPTCHA token is invalid when sending request to the backend.', - ["invalid-recaptcha-action" /* AuthErrorCode.INVALID_RECAPTCHA_ACTION */]: 'The reCAPTCHA action is invalid when sending request to the backend.', - ["recaptcha-not-enabled" /* AuthErrorCode.RECAPTCHA_NOT_ENABLED */]: 'reCAPTCHA Enterprise integration is not enabled for this project.', - ["missing-client-type" /* AuthErrorCode.MISSING_CLIENT_TYPE */]: 'The reCAPTCHA client type is missing when sending request to the backend.', - ["missing-recaptcha-version" /* AuthErrorCode.MISSING_RECAPTCHA_VERSION */]: 'The reCAPTCHA version is missing when sending request to the backend.', - ["invalid-req-type" /* AuthErrorCode.INVALID_REQ_TYPE */]: 'Invalid request parameters.', - ["invalid-recaptcha-version" /* AuthErrorCode.INVALID_RECAPTCHA_VERSION */]: 'The reCAPTCHA version is invalid when sending request to the backend.', - ["unsupported-password-policy-schema-version" /* AuthErrorCode.UNSUPPORTED_PASSWORD_POLICY_SCHEMA_VERSION */]: 'The password policy received from the backend uses a schema version that is not supported by this version of the Firebase SDK.', - ["password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */]: 'The password does not meet the requirements.', - ["invalid-hosting-link-domain" /* AuthErrorCode.INVALID_HOSTING_LINK_DOMAIN */]: 'The provided Hosting link domain is not configured in Firebase Hosting or is not owned by ' + - 'the current project. This cannot be a default Hosting domain (`web.app` or `firebaseapp.com`).' - }; -} -function _prodErrorMap() { - // We will include this one message in the prod error map since by the very - // nature of this error, developers will never be able to see the message - // using the debugErrorMap (which is installed during auth initialization). - return { - ["dependent-sdk-initialized-before-auth" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */]: 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' + - 'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' + - 'starting any other Firebase SDK.' - }; -} -/** - * A verbose error map with detailed descriptions for most error codes. - * - * See discussion at {@link AuthErrorMap} - * - * @public - */ -const debugErrorMap = _debugErrorMap; -/** - * A minimal error map with all verbose error messages stripped. - * - * See discussion at {@link AuthErrorMap} - * - * @public - */ -const prodErrorMap = _prodErrorMap; -const _DEFAULT_AUTH_ERROR_FACTORY = new ErrorFactory('auth', 'Firebase', _prodErrorMap()); -/** - * A map of potential `Auth` error codes, for easier comparison with errors - * thrown by the SDK. - * - * @remarks - * Note that you can't tree-shake individual keys - * in the map, so by using the map you might substantially increase your - * bundle size. - * - * @public - */ -const AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY = { - ADMIN_ONLY_OPERATION: 'auth/admin-restricted-operation', - ARGUMENT_ERROR: 'auth/argument-error', - APP_NOT_AUTHORIZED: 'auth/app-not-authorized', - APP_NOT_INSTALLED: 'auth/app-not-installed', - CAPTCHA_CHECK_FAILED: 'auth/captcha-check-failed', - CODE_EXPIRED: 'auth/code-expired', - CORDOVA_NOT_READY: 'auth/cordova-not-ready', - CORS_UNSUPPORTED: 'auth/cors-unsupported', - CREDENTIAL_ALREADY_IN_USE: 'auth/credential-already-in-use', - CREDENTIAL_MISMATCH: 'auth/custom-token-mismatch', - CREDENTIAL_TOO_OLD_LOGIN_AGAIN: 'auth/requires-recent-login', - DEPENDENT_SDK_INIT_BEFORE_AUTH: 'auth/dependent-sdk-initialized-before-auth', - DYNAMIC_LINK_NOT_ACTIVATED: 'auth/dynamic-link-not-activated', - EMAIL_CHANGE_NEEDS_VERIFICATION: 'auth/email-change-needs-verification', - EMAIL_EXISTS: 'auth/email-already-in-use', - EMULATOR_CONFIG_FAILED: 'auth/emulator-config-failed', - EXPIRED_OOB_CODE: 'auth/expired-action-code', - EXPIRED_POPUP_REQUEST: 'auth/cancelled-popup-request', - INTERNAL_ERROR: 'auth/internal-error', - INVALID_API_KEY: 'auth/invalid-api-key', - INVALID_APP_CREDENTIAL: 'auth/invalid-app-credential', - INVALID_APP_ID: 'auth/invalid-app-id', - INVALID_AUTH: 'auth/invalid-user-token', - INVALID_AUTH_EVENT: 'auth/invalid-auth-event', - INVALID_CERT_HASH: 'auth/invalid-cert-hash', - INVALID_CODE: 'auth/invalid-verification-code', - INVALID_CONTINUE_URI: 'auth/invalid-continue-uri', - INVALID_CORDOVA_CONFIGURATION: 'auth/invalid-cordova-configuration', - INVALID_CUSTOM_TOKEN: 'auth/invalid-custom-token', - INVALID_DYNAMIC_LINK_DOMAIN: 'auth/invalid-dynamic-link-domain', - INVALID_EMAIL: 'auth/invalid-email', - INVALID_EMULATOR_SCHEME: 'auth/invalid-emulator-scheme', - INVALID_IDP_RESPONSE: 'auth/invalid-credential', - INVALID_LOGIN_CREDENTIALS: 'auth/invalid-credential', - INVALID_MESSAGE_PAYLOAD: 'auth/invalid-message-payload', - INVALID_MFA_SESSION: 'auth/invalid-multi-factor-session', - INVALID_OAUTH_CLIENT_ID: 'auth/invalid-oauth-client-id', - INVALID_OAUTH_PROVIDER: 'auth/invalid-oauth-provider', - INVALID_OOB_CODE: 'auth/invalid-action-code', - INVALID_ORIGIN: 'auth/unauthorized-domain', - INVALID_PASSWORD: 'auth/wrong-password', - INVALID_PERSISTENCE: 'auth/invalid-persistence-type', - INVALID_PHONE_NUMBER: 'auth/invalid-phone-number', - INVALID_PROVIDER_ID: 'auth/invalid-provider-id', - INVALID_RECIPIENT_EMAIL: 'auth/invalid-recipient-email', - INVALID_SENDER: 'auth/invalid-sender', - INVALID_SESSION_INFO: 'auth/invalid-verification-id', - INVALID_TENANT_ID: 'auth/invalid-tenant-id', - MFA_INFO_NOT_FOUND: 'auth/multi-factor-info-not-found', - MFA_REQUIRED: 'auth/multi-factor-auth-required', - MISSING_ANDROID_PACKAGE_NAME: 'auth/missing-android-pkg-name', - MISSING_APP_CREDENTIAL: 'auth/missing-app-credential', - MISSING_AUTH_DOMAIN: 'auth/auth-domain-config-required', - MISSING_CODE: 'auth/missing-verification-code', - MISSING_CONTINUE_URI: 'auth/missing-continue-uri', - MISSING_IFRAME_START: 'auth/missing-iframe-start', - MISSING_IOS_BUNDLE_ID: 'auth/missing-ios-bundle-id', - MISSING_OR_INVALID_NONCE: 'auth/missing-or-invalid-nonce', - MISSING_MFA_INFO: 'auth/missing-multi-factor-info', - MISSING_MFA_SESSION: 'auth/missing-multi-factor-session', - MISSING_PHONE_NUMBER: 'auth/missing-phone-number', - MISSING_PASSWORD: 'auth/missing-password', - MISSING_SESSION_INFO: 'auth/missing-verification-id', - MODULE_DESTROYED: 'auth/app-deleted', - NEED_CONFIRMATION: 'auth/account-exists-with-different-credential', - NETWORK_REQUEST_FAILED: 'auth/network-request-failed', - NULL_USER: 'auth/null-user', - NO_AUTH_EVENT: 'auth/no-auth-event', - NO_SUCH_PROVIDER: 'auth/no-such-provider', - OPERATION_NOT_ALLOWED: 'auth/operation-not-allowed', - OPERATION_NOT_SUPPORTED: 'auth/operation-not-supported-in-this-environment', - POPUP_BLOCKED: 'auth/popup-blocked', - POPUP_CLOSED_BY_USER: 'auth/popup-closed-by-user', - PROVIDER_ALREADY_LINKED: 'auth/provider-already-linked', - QUOTA_EXCEEDED: 'auth/quota-exceeded', - REDIRECT_CANCELLED_BY_USER: 'auth/redirect-cancelled-by-user', - REDIRECT_OPERATION_PENDING: 'auth/redirect-operation-pending', - REJECTED_CREDENTIAL: 'auth/rejected-credential', - SECOND_FACTOR_ALREADY_ENROLLED: 'auth/second-factor-already-in-use', - SECOND_FACTOR_LIMIT_EXCEEDED: 'auth/maximum-second-factor-count-exceeded', - TENANT_ID_MISMATCH: 'auth/tenant-id-mismatch', - TIMEOUT: 'auth/timeout', - TOKEN_EXPIRED: 'auth/user-token-expired', - TOO_MANY_ATTEMPTS_TRY_LATER: 'auth/too-many-requests', - UNAUTHORIZED_DOMAIN: 'auth/unauthorized-continue-uri', - UNSUPPORTED_FIRST_FACTOR: 'auth/unsupported-first-factor', - UNSUPPORTED_PERSISTENCE: 'auth/unsupported-persistence-type', - UNSUPPORTED_TENANT_OPERATION: 'auth/unsupported-tenant-operation', - UNVERIFIED_EMAIL: 'auth/unverified-email', - USER_CANCELLED: 'auth/user-cancelled', - USER_DELETED: 'auth/user-not-found', - USER_DISABLED: 'auth/user-disabled', - USER_MISMATCH: 'auth/user-mismatch', - USER_SIGNED_OUT: 'auth/user-signed-out', - WEAK_PASSWORD: 'auth/weak-password', - WEB_STORAGE_UNSUPPORTED: 'auth/web-storage-unsupported', - ALREADY_INITIALIZED: 'auth/already-initialized', - RECAPTCHA_NOT_ENABLED: 'auth/recaptcha-not-enabled', - MISSING_RECAPTCHA_TOKEN: 'auth/missing-recaptcha-token', - INVALID_RECAPTCHA_TOKEN: 'auth/invalid-recaptcha-token', - INVALID_RECAPTCHA_ACTION: 'auth/invalid-recaptcha-action', - MISSING_CLIENT_TYPE: 'auth/missing-client-type', - MISSING_RECAPTCHA_VERSION: 'auth/missing-recaptcha-version', - INVALID_RECAPTCHA_VERSION: 'auth/invalid-recaptcha-version', - INVALID_REQ_TYPE: 'auth/invalid-req-type', - INVALID_HOSTING_LINK_DOMAIN: 'auth/invalid-hosting-link-domain' -}; - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const logClient = new Logger('@firebase/auth'); -function _logWarn(msg, ...args) { - if (logClient.logLevel <= LogLevel.WARN) { - logClient.warn(`Auth (${SDK_VERSION}): ${msg}`, ...args); - } -} -function _logError(msg, ...args) { - if (logClient.logLevel <= LogLevel.ERROR) { - logClient.error(`Auth (${SDK_VERSION}): ${msg}`, ...args); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function _fail(authOrCode, ...rest) { - throw createErrorInternal(authOrCode, ...rest); -} -function _createError(authOrCode, ...rest) { - return createErrorInternal(authOrCode, ...rest); -} -function _errorWithCustomMessage(auth, code, message) { - const errorMap = { - ...prodErrorMap(), - [code]: message - }; - const factory = new ErrorFactory('auth', 'Firebase', errorMap); - return factory.create(code, { - appName: auth.name - }); -} -function _serverAppCurrentUserOperationNotSupportedError(auth) { - return _errorWithCustomMessage(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */, 'Operations that alter the current user are not supported in conjunction with FirebaseServerApp'); -} -function _assertInstanceOf(auth, object, instance) { - const constructorInstance = instance; - if (!(object instanceof constructorInstance)) { - if (constructorInstance.name !== object.constructor.name) { - _fail(auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - } - throw _errorWithCustomMessage(auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, `Type of ${object.constructor.name} does not match expected instance.` + - `Did you pass a reference from a different Auth SDK?`); - } -} -function createErrorInternal(authOrCode, ...rest) { - if (typeof authOrCode !== 'string') { - const code = rest[0]; - const fullParams = [...rest.slice(1)]; - if (fullParams[0]) { - fullParams[0].appName = authOrCode.name; - } - return authOrCode._errorFactory.create(code, ...fullParams); - } - return _DEFAULT_AUTH_ERROR_FACTORY.create(authOrCode, ...rest); -} -function _assert(assertion, authOrCode, ...rest) { - if (!assertion) { - throw createErrorInternal(authOrCode, ...rest); - } -} -/** - * Unconditionally fails, throwing an internal error with the given message. - * - * @param failure type of failure encountered - * @throws Error - */ -function debugFail(failure) { - // Log the failure in addition to throw an exception, just in case the - // exception is swallowed. - const message = `INTERNAL ASSERTION FAILED: ` + failure; - _logError(message); - // NOTE: We don't use FirebaseError here because these are internal failures - // that cannot be handled by the user. (Also it would create a circular - // dependency between the error and assert modules which doesn't work.) - throw new Error(message); -} -/** - * Fails if the given assertion condition is false, throwing an Error with the - * given message if it did. - * - * @param assertion - * @param message - */ -function debugAssert(assertion, message) { - if (!assertion) { - debugFail(message); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function _getCurrentUrl() { - return (typeof self !== 'undefined' && self.location?.href) || ''; -} -function _isHttpOrHttps() { - return _getCurrentScheme() === 'http:' || _getCurrentScheme() === 'https:'; -} -function _getCurrentScheme() { - return (typeof self !== 'undefined' && self.location?.protocol) || null; -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Determine whether the browser is working online - */ -function _isOnline() { - if (typeof navigator !== 'undefined' && - navigator && - 'onLine' in navigator && - typeof navigator.onLine === 'boolean' && - // Apply only for traditional web apps and Chrome extensions. - // This is especially true for Cordova apps which have unreliable - // navigator.onLine behavior unless cordova-plugin-network-information is - // installed which overwrites the native navigator.onLine value and - // defines navigator.connection. - (_isHttpOrHttps() || isBrowserExtension() || 'connection' in navigator)) { - return navigator.onLine; - } - // If we can't determine the state, assume it is online. - return true; -} -function _getUserLanguage() { - if (typeof navigator === 'undefined') { - return null; - } - const navigatorLanguage = navigator; - return ( - // Most reliable, but only supported in Chrome/Firefox. - (navigatorLanguage.languages && navigatorLanguage.languages[0]) || - // Supported in most browsers, but returns the language of the browser - // UI, not the language set in browser settings. - navigatorLanguage.language || - // Couldn't determine language. - null); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * A structure to help pick between a range of long and short delay durations - * depending on the current environment. In general, the long delay is used for - * mobile environments whereas short delays are used for desktop environments. - */ -class Delay { - constructor(shortDelay, longDelay) { - this.shortDelay = shortDelay; - this.longDelay = longDelay; - // Internal error when improperly initialized. - debugAssert(longDelay > shortDelay, 'Short delay should be less than long delay!'); - this.isMobile = isMobileCordova() || isReactNative(); - } - get() { - if (!_isOnline()) { - // Pick the shorter timeout. - return Math.min(5000 /* DelayMin.OFFLINE */, this.shortDelay); - } - // If running in a mobile environment, return the long delay, otherwise - // return the short delay. - // This could be improved in the future to dynamically change based on other - // variables instead of just reading the current environment. - return this.isMobile ? this.longDelay : this.shortDelay; - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function _emulatorUrl(config, path) { - debugAssert(config.emulator, 'Emulator should always be set here'); - const { url } = config.emulator; - if (!path) { - return url; - } - return `${url}${path.startsWith('/') ? path.slice(1) : path}`; -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -class FetchProvider { - static initialize(fetchImpl, headersImpl, responseImpl) { - this.fetchImpl = fetchImpl; - if (headersImpl) { - this.headersImpl = headersImpl; - } - if (responseImpl) { - this.responseImpl = responseImpl; - } - } - static fetch() { - if (this.fetchImpl) { - return this.fetchImpl; - } - if (typeof self !== 'undefined' && 'fetch' in self) { - return self.fetch; - } - if (typeof globalThis !== 'undefined' && globalThis.fetch) { - return globalThis.fetch; - } - if (typeof fetch !== 'undefined') { - return fetch; - } - debugFail('Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'); - } - static headers() { - if (this.headersImpl) { - return this.headersImpl; - } - if (typeof self !== 'undefined' && 'Headers' in self) { - return self.Headers; - } - if (typeof globalThis !== 'undefined' && globalThis.Headers) { - return globalThis.Headers; - } - if (typeof Headers !== 'undefined') { - return Headers; - } - debugFail('Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'); - } - static response() { - if (this.responseImpl) { - return this.responseImpl; - } - if (typeof self !== 'undefined' && 'Response' in self) { - return self.Response; - } - if (typeof globalThis !== 'undefined' && globalThis.Response) { - return globalThis.Response; - } - if (typeof Response !== 'undefined') { - return Response; - } - debugFail('Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Map from errors returned by the server to errors to developer visible errors - */ -const SERVER_ERROR_MAP = { - // Custom token errors. - ["CREDENTIAL_MISMATCH" /* ServerError.CREDENTIAL_MISMATCH */]: "custom-token-mismatch" /* AuthErrorCode.CREDENTIAL_MISMATCH */, - // This can only happen if the SDK sends a bad request. - ["MISSING_CUSTOM_TOKEN" /* ServerError.MISSING_CUSTOM_TOKEN */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, - // Create Auth URI errors. - ["INVALID_IDENTIFIER" /* ServerError.INVALID_IDENTIFIER */]: "invalid-email" /* AuthErrorCode.INVALID_EMAIL */, - // This can only happen if the SDK sends a bad request. - ["MISSING_CONTINUE_URI" /* ServerError.MISSING_CONTINUE_URI */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, - // Sign in with email and password errors (some apply to sign up too). - ["INVALID_PASSWORD" /* ServerError.INVALID_PASSWORD */]: "wrong-password" /* AuthErrorCode.INVALID_PASSWORD */, - // This can only happen if the SDK sends a bad request. - ["MISSING_PASSWORD" /* ServerError.MISSING_PASSWORD */]: "missing-password" /* AuthErrorCode.MISSING_PASSWORD */, - // Thrown if Email Enumeration Protection is enabled in the project and the email or password is - // invalid. - ["INVALID_LOGIN_CREDENTIALS" /* ServerError.INVALID_LOGIN_CREDENTIALS */]: "invalid-credential" /* AuthErrorCode.INVALID_CREDENTIAL */, - // Sign up with email and password errors. - ["EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */]: "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */, - ["PASSWORD_LOGIN_DISABLED" /* ServerError.PASSWORD_LOGIN_DISABLED */]: "operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */, - // Verify assertion for sign in with credential errors: - ["INVALID_IDP_RESPONSE" /* ServerError.INVALID_IDP_RESPONSE */]: "invalid-credential" /* AuthErrorCode.INVALID_CREDENTIAL */, - ["INVALID_PENDING_TOKEN" /* ServerError.INVALID_PENDING_TOKEN */]: "invalid-credential" /* AuthErrorCode.INVALID_CREDENTIAL */, - ["FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */]: "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */, - // This can only happen if the SDK sends a bad request. - ["MISSING_REQ_TYPE" /* ServerError.MISSING_REQ_TYPE */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, - // Send Password reset email errors: - ["EMAIL_NOT_FOUND" /* ServerError.EMAIL_NOT_FOUND */]: "user-not-found" /* AuthErrorCode.USER_DELETED */, - ["RESET_PASSWORD_EXCEED_LIMIT" /* ServerError.RESET_PASSWORD_EXCEED_LIMIT */]: "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */, - ["EXPIRED_OOB_CODE" /* ServerError.EXPIRED_OOB_CODE */]: "expired-action-code" /* AuthErrorCode.EXPIRED_OOB_CODE */, - ["INVALID_OOB_CODE" /* ServerError.INVALID_OOB_CODE */]: "invalid-action-code" /* AuthErrorCode.INVALID_OOB_CODE */, - // This can only happen if the SDK sends a bad request. - ["MISSING_OOB_CODE" /* ServerError.MISSING_OOB_CODE */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, - // Operations that require ID token in request: - ["CREDENTIAL_TOO_OLD_LOGIN_AGAIN" /* ServerError.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */]: "requires-recent-login" /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */, - ["INVALID_ID_TOKEN" /* ServerError.INVALID_ID_TOKEN */]: "invalid-user-token" /* AuthErrorCode.INVALID_AUTH */, - ["TOKEN_EXPIRED" /* ServerError.TOKEN_EXPIRED */]: "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */, - ["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */]: "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */, - // Other errors. - ["TOO_MANY_ATTEMPTS_TRY_LATER" /* ServerError.TOO_MANY_ATTEMPTS_TRY_LATER */]: "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */, - ["PASSWORD_DOES_NOT_MEET_REQUIREMENTS" /* ServerError.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */]: "password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */, - // Phone Auth related errors. - ["INVALID_CODE" /* ServerError.INVALID_CODE */]: "invalid-verification-code" /* AuthErrorCode.INVALID_CODE */, - ["INVALID_SESSION_INFO" /* ServerError.INVALID_SESSION_INFO */]: "invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */, - ["INVALID_TEMPORARY_PROOF" /* ServerError.INVALID_TEMPORARY_PROOF */]: "invalid-credential" /* AuthErrorCode.INVALID_CREDENTIAL */, - ["MISSING_SESSION_INFO" /* ServerError.MISSING_SESSION_INFO */]: "missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */, - ["SESSION_EXPIRED" /* ServerError.SESSION_EXPIRED */]: "code-expired" /* AuthErrorCode.CODE_EXPIRED */, - // Other action code errors when additional settings passed. - // MISSING_CONTINUE_URI is getting mapped to INTERNAL_ERROR above. - // This is OK as this error will be caught by client side validation. - ["MISSING_ANDROID_PACKAGE_NAME" /* ServerError.MISSING_ANDROID_PACKAGE_NAME */]: "missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */, - ["UNAUTHORIZED_DOMAIN" /* ServerError.UNAUTHORIZED_DOMAIN */]: "unauthorized-continue-uri" /* AuthErrorCode.UNAUTHORIZED_DOMAIN */, - // getProjectConfig errors when clientId is passed. - ["INVALID_OAUTH_CLIENT_ID" /* ServerError.INVALID_OAUTH_CLIENT_ID */]: "invalid-oauth-client-id" /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */, - // User actions (sign-up or deletion) disabled errors. - ["ADMIN_ONLY_OPERATION" /* ServerError.ADMIN_ONLY_OPERATION */]: "admin-restricted-operation" /* AuthErrorCode.ADMIN_ONLY_OPERATION */, - // Multi factor related errors. - ["INVALID_MFA_PENDING_CREDENTIAL" /* ServerError.INVALID_MFA_PENDING_CREDENTIAL */]: "invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */, - ["MFA_ENROLLMENT_NOT_FOUND" /* ServerError.MFA_ENROLLMENT_NOT_FOUND */]: "multi-factor-info-not-found" /* AuthErrorCode.MFA_INFO_NOT_FOUND */, - ["MISSING_MFA_ENROLLMENT_ID" /* ServerError.MISSING_MFA_ENROLLMENT_ID */]: "missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */, - ["MISSING_MFA_PENDING_CREDENTIAL" /* ServerError.MISSING_MFA_PENDING_CREDENTIAL */]: "missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */, - ["SECOND_FACTOR_EXISTS" /* ServerError.SECOND_FACTOR_EXISTS */]: "second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */, - ["SECOND_FACTOR_LIMIT_EXCEEDED" /* ServerError.SECOND_FACTOR_LIMIT_EXCEEDED */]: "maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */, - // Blocking functions related errors. - ["BLOCKING_FUNCTION_ERROR_RESPONSE" /* ServerError.BLOCKING_FUNCTION_ERROR_RESPONSE */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, - // Recaptcha related errors. - ["RECAPTCHA_NOT_ENABLED" /* ServerError.RECAPTCHA_NOT_ENABLED */]: "recaptcha-not-enabled" /* AuthErrorCode.RECAPTCHA_NOT_ENABLED */, - ["MISSING_RECAPTCHA_TOKEN" /* ServerError.MISSING_RECAPTCHA_TOKEN */]: "missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */, - ["INVALID_RECAPTCHA_TOKEN" /* ServerError.INVALID_RECAPTCHA_TOKEN */]: "invalid-recaptcha-token" /* AuthErrorCode.INVALID_RECAPTCHA_TOKEN */, - ["INVALID_RECAPTCHA_ACTION" /* ServerError.INVALID_RECAPTCHA_ACTION */]: "invalid-recaptcha-action" /* AuthErrorCode.INVALID_RECAPTCHA_ACTION */, - ["MISSING_CLIENT_TYPE" /* ServerError.MISSING_CLIENT_TYPE */]: "missing-client-type" /* AuthErrorCode.MISSING_CLIENT_TYPE */, - ["MISSING_RECAPTCHA_VERSION" /* ServerError.MISSING_RECAPTCHA_VERSION */]: "missing-recaptcha-version" /* AuthErrorCode.MISSING_RECAPTCHA_VERSION */, - ["INVALID_RECAPTCHA_VERSION" /* ServerError.INVALID_RECAPTCHA_VERSION */]: "invalid-recaptcha-version" /* AuthErrorCode.INVALID_RECAPTCHA_VERSION */, - ["INVALID_REQ_TYPE" /* ServerError.INVALID_REQ_TYPE */]: "invalid-req-type" /* AuthErrorCode.INVALID_REQ_TYPE */ -}; - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const CookieAuthProxiedEndpoints = [ - "/v1/accounts:signInWithCustomToken" /* Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN */, - "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, - "/v1/accounts:signInWithIdp" /* Endpoint.SIGN_IN_WITH_IDP */, - "/v1/accounts:signInWithPassword" /* Endpoint.SIGN_IN_WITH_PASSWORD */, - "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, - "/v1/token" /* Endpoint.TOKEN */ -]; -const DEFAULT_API_TIMEOUT_MS = new Delay(30000, 60000); -function _addTidIfNecessary(auth, request) { - if (auth.tenantId && !request.tenantId) { - return { - ...request, - tenantId: auth.tenantId - }; - } - return request; -} -async function _performApiRequest(auth, method, path, request, customErrorMap = {}) { - return _performFetchWithErrorHandling(auth, customErrorMap, async () => { - let body = {}; - let params = {}; - if (request) { - if (method === "GET" /* HttpMethod.GET */) { - params = request; - } - else { - body = { - body: JSON.stringify(request) - }; - } - } - const query = querystring({ - key: auth.config.apiKey, - ...params - }).slice(1); - const headers = await auth._getAdditionalHeaders(); - headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/json'; - if (auth.languageCode) { - headers["X-Firebase-Locale" /* HttpHeader.X_FIREBASE_LOCALE */] = auth.languageCode; - } - const fetchArgs = { - method, - headers, - ...body - }; - /* Security-conscious server-side frameworks tend to have built in mitigations for referrer - problems". See the Cloudflare GitHub issue #487: Error: The 'referrerPolicy' field on - 'RequestInitializerDict' is not implemented." - https://github.com/cloudflare/next-on-pages/issues/487 */ - if (!isCloudflareWorker()) { - fetchArgs.referrerPolicy = 'no-referrer'; - } - if (auth.emulatorConfig && isCloudWorkstation(auth.emulatorConfig.host)) { - fetchArgs.credentials = 'include'; - } - return FetchProvider.fetch()(await _getFinalTarget(auth, auth.config.apiHost, path, query), fetchArgs); - }); -} -async function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) { - auth._canInitEmulator = false; - const errorMap = { ...SERVER_ERROR_MAP, ...customErrorMap }; - try { - const networkTimeout = new NetworkTimeout(auth); - const response = await Promise.race([ - fetchFn(), - networkTimeout.promise - ]); - // If we've reached this point, the fetch succeeded and the networkTimeout - // didn't throw; clear the network timeout delay so that Node won't hang - networkTimeout.clearNetworkTimeout(); - const json = await response.json(); - if ('needConfirmation' in json) { - throw _makeTaggedError(auth, "account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */, json); - } - if (response.ok && !('errorMessage' in json)) { - return json; - } - else { - const errorMessage = response.ok ? json.errorMessage : json.error.message; - const [serverErrorCode, serverErrorMessage] = errorMessage.split(' : '); - if (serverErrorCode === "FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */) { - throw _makeTaggedError(auth, "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */, json); - } - else if (serverErrorCode === "EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */) { - throw _makeTaggedError(auth, "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */, json); - } - else if (serverErrorCode === "USER_DISABLED" /* ServerError.USER_DISABLED */) { - throw _makeTaggedError(auth, "user-disabled" /* AuthErrorCode.USER_DISABLED */, json); - } - const authError = errorMap[serverErrorCode] || - serverErrorCode - .toLowerCase() - .replace(/[_\s]+/g, '-'); - if (serverErrorMessage) { - throw _errorWithCustomMessage(auth, authError, serverErrorMessage); - } - else { - _fail(auth, authError); - } - } - } - catch (e) { - if (e instanceof FirebaseError) { - throw e; - } - // Changing this to a different error code will log user out when there is a network error - // because we treat any error other than NETWORK_REQUEST_FAILED as token is invalid. - // https://github.com/firebase/firebase-js-sdk/blob/4fbc73610d70be4e0852e7de63a39cb7897e8546/packages/auth/src/core/auth/auth_impl.ts#L309-L316 - _fail(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */, { 'message': String(e) }); - } -} -async function _performSignInRequest(auth, method, path, request, customErrorMap = {}) { - const serverResponse = await _performApiRequest(auth, method, path, request, customErrorMap); - if ('mfaPendingCredential' in serverResponse) { - _fail(auth, "multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */, { - _serverResponse: serverResponse - }); - } - return serverResponse; -} -async function _getFinalTarget(auth, host, path, query) { - const base = `${host}${path}?${query}`; - const authInternal = auth; - const finalTarget = authInternal.config.emulator - ? _emulatorUrl(auth.config, base) - : `${auth.config.apiScheme}://${base}`; - // Cookie auth works by MiTMing the signIn and token endpoints from the developer's backend, - // saving the idToken and refreshToken into cookies, and then redacting the refreshToken - // from the response - if (CookieAuthProxiedEndpoints.includes(path)) { - // Persistence manager is async, we need to await it. We can't just wait for auth initialized - // here since auth initialization calls this function. - await authInternal._persistenceManagerAvailable; - if (authInternal._getPersistenceType() === "COOKIE" /* PersistenceType.COOKIE */) { - const cookiePersistence = authInternal._getPersistence(); - return cookiePersistence._getFinalTarget(finalTarget).toString(); - } - } - return finalTarget; -} -function _parseEnforcementState(enforcementStateStr) { - switch (enforcementStateStr) { - case 'ENFORCE': - return "ENFORCE" /* EnforcementState.ENFORCE */; - case 'AUDIT': - return "AUDIT" /* EnforcementState.AUDIT */; - case 'OFF': - return "OFF" /* EnforcementState.OFF */; - default: - return "ENFORCEMENT_STATE_UNSPECIFIED" /* EnforcementState.ENFORCEMENT_STATE_UNSPECIFIED */; - } -} -class NetworkTimeout { - clearNetworkTimeout() { - clearTimeout(this.timer); - } - constructor(auth) { - this.auth = auth; - // Node timers and browser timers are fundamentally incompatible, but we - // don't care about the value here - // eslint-disable-next-line @typescript-eslint/no-explicit-any - this.timer = null; - this.promise = new Promise((_, reject) => { - this.timer = setTimeout(() => { - return reject(_createError(this.auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */)); - }, DEFAULT_API_TIMEOUT_MS.get()); - }); - } -} -function _makeTaggedError(auth, code, response) { - const errorParams = { - appName: auth.name - }; - if (response.email) { - errorParams.email = response.email; - } - if (response.phoneNumber) { - errorParams.phoneNumber = response.phoneNumber; - } - const error = _createError(auth, code, errorParams); - // We know customData is defined on error because errorParams is defined - error.customData._tokenResponse = response; - return error; -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function isV2(grecaptcha) { - return (grecaptcha !== undefined && - grecaptcha.getResponse !== undefined); -} -function isEnterprise(grecaptcha) { - return (grecaptcha !== undefined && - grecaptcha.enterprise !== undefined); -} -class RecaptchaConfig { - constructor(response) { - /** - * The reCAPTCHA site key. - */ - this.siteKey = ''; - /** - * The list of providers and their enablement status for reCAPTCHA Enterprise. - */ - this.recaptchaEnforcementState = []; - if (response.recaptchaKey === undefined) { - throw new Error('recaptchaKey undefined'); - } - // Example response.recaptchaKey: "projects/proj123/keys/sitekey123" - this.siteKey = response.recaptchaKey.split('/')[3]; - this.recaptchaEnforcementState = response.recaptchaEnforcementState; - } - /** - * Returns the reCAPTCHA Enterprise enforcement state for the given provider. - * - * @param providerStr - The provider whose enforcement state is to be returned. - * @returns The reCAPTCHA Enterprise enforcement state for the given provider. - */ - getProviderEnforcementState(providerStr) { - if (!this.recaptchaEnforcementState || - this.recaptchaEnforcementState.length === 0) { - return null; - } - for (const recaptchaEnforcementState of this.recaptchaEnforcementState) { - if (recaptchaEnforcementState.provider && - recaptchaEnforcementState.provider === providerStr) { - return _parseEnforcementState(recaptchaEnforcementState.enforcementState); - } - } - return null; - } - /** - * Returns true if the reCAPTCHA Enterprise enforcement state for the provider is set to ENFORCE or AUDIT. - * - * @param providerStr - The provider whose enablement state is to be returned. - * @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider. - */ - isProviderEnabled(providerStr) { - return (this.getProviderEnforcementState(providerStr) === - "ENFORCE" /* EnforcementState.ENFORCE */ || - this.getProviderEnforcementState(providerStr) === "AUDIT" /* EnforcementState.AUDIT */); - } - /** - * Returns true if reCAPTCHA Enterprise protection is enabled in at least one provider, otherwise - * returns false. - * - * @returns Whether or not reCAPTCHA Enterprise protection is enabled for at least one provider. - */ - isAnyProviderEnabled() { - return (this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */) || - this.isProviderEnabled("PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */)); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function getRecaptchaParams(auth) { - return ((await _performApiRequest(auth, "GET" /* HttpMethod.GET */, "/v1/recaptchaParams" /* Endpoint.GET_RECAPTCHA_PARAM */)).recaptchaSiteKey || ''); -} -async function getRecaptchaConfig(auth, request) { - return _performApiRequest(auth, "GET" /* HttpMethod.GET */, "/v2/recaptchaConfig" /* Endpoint.GET_RECAPTCHA_CONFIG */, _addTidIfNecessary(auth, request)); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function deleteAccount(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:delete" /* Endpoint.DELETE_ACCOUNT */, request); -} -async function deleteLinkedAccounts(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request); -} -async function getAccountInfo(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:lookup" /* Endpoint.GET_ACCOUNT_INFO */, request); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function utcTimestampToDateString(utcTimestamp) { - if (!utcTimestamp) { - return undefined; - } - try { - // Convert to date object. - const date = new Date(Number(utcTimestamp)); - // Test date is valid. - if (!isNaN(date.getTime())) { - // Convert to UTC date string. - return date.toUTCString(); - } - } - catch (e) { - // Do nothing. undefined will be returned. - } - return undefined; -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Returns a JSON Web Token (JWT) used to identify the user to a Firebase service. - * - * @remarks - * Returns the current token if it has not expired or if it will not expire in the next five - * minutes. Otherwise, this will refresh the token and return a new one. - * - * @param user - The user. - * @param forceRefresh - Force refresh regardless of token expiration. - * - * @public - */ -function getIdToken(user, forceRefresh = false) { - return getModularInstance(user).getIdToken(forceRefresh); -} -/** - * Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service. - * - * @remarks - * Returns the current token if it has not expired or if it will not expire in the next five - * minutes. Otherwise, this will refresh the token and return a new one. - * - * @param user - The user. - * @param forceRefresh - Force refresh regardless of token expiration. - * - * @public - */ -async function getIdTokenResult(user, forceRefresh = false) { - const userInternal = getModularInstance(user); - const token = await userInternal.getIdToken(forceRefresh); - const claims = _parseToken(token); - _assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - const firebase = typeof claims.firebase === 'object' ? claims.firebase : undefined; - const signInProvider = firebase?.['sign_in_provider']; - return { - claims, - token, - authTime: utcTimestampToDateString(secondsStringToMilliseconds(claims.auth_time)), - issuedAtTime: utcTimestampToDateString(secondsStringToMilliseconds(claims.iat)), - expirationTime: utcTimestampToDateString(secondsStringToMilliseconds(claims.exp)), - signInProvider: signInProvider || null, - signInSecondFactor: firebase?.['sign_in_second_factor'] || null - }; -} -function secondsStringToMilliseconds(seconds) { - return Number(seconds) * 1000; -} -function _parseToken(token) { - const [algorithm, payload, signature] = token.split('.'); - if (algorithm === undefined || - payload === undefined || - signature === undefined) { - _logError('JWT malformed, contained fewer than 3 sections'); - return null; - } - try { - const decoded = base64Decode(payload); - if (!decoded) { - _logError('Failed to decode base64 JWT payload'); - return null; - } - return JSON.parse(decoded); - } - catch (e) { - _logError('Caught error parsing JWT payload as JSON', e?.toString()); - return null; - } -} -/** - * Extract expiresIn TTL from a token by subtracting the expiration from the issuance. - */ -function _tokenExpiresIn(token) { - const parsedToken = _parseToken(token); - _assert(parsedToken, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - _assert(typeof parsedToken.exp !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - _assert(typeof parsedToken.iat !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - return Number(parsedToken.exp) - Number(parsedToken.iat); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function _logoutIfInvalidated(user, promise, bypassAuthState = false) { - if (bypassAuthState) { - return promise; - } - try { - return await promise; - } - catch (e) { - if (e instanceof FirebaseError && isUserInvalidated(e)) { - if (user.auth.currentUser === user) { - await user.auth.signOut(); - } - } - throw e; - } -} -function isUserInvalidated({ code }) { - return (code === `auth/${"user-disabled" /* AuthErrorCode.USER_DISABLED */}` || - code === `auth/${"user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */}`); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -class ProactiveRefresh { - constructor(user) { - this.user = user; - this.isRunning = false; - // Node timers and browser timers return fundamentally different types. - // We don't actually care what the value is but TS won't accept unknown and - // we can't cast properly in both environments. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - this.timerId = null; - this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */; - } - _start() { - if (this.isRunning) { - return; - } - this.isRunning = true; - this.schedule(); - } - _stop() { - if (!this.isRunning) { - return; - } - this.isRunning = false; - if (this.timerId !== null) { - clearTimeout(this.timerId); - } - } - getInterval(wasError) { - if (wasError) { - const interval = this.errorBackoff; - this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* Duration.RETRY_BACKOFF_MAX */); - return interval; - } - else { - // Reset the error backoff - this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */; - const expTime = this.user.stsTokenManager.expirationTime ?? 0; - const interval = expTime - Date.now() - 300000 /* Duration.OFFSET */; - return Math.max(0, interval); - } - } - schedule(wasError = false) { - if (!this.isRunning) { - // Just in case... - return; - } - const interval = this.getInterval(wasError); - this.timerId = setTimeout(async () => { - await this.iteration(); - }, interval); - } - async iteration() { - try { - await this.user.getIdToken(true); - } - catch (e) { - // Only retry on network errors - if (e?.code === - `auth/${"network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */}`) { - this.schedule(/* wasError */ true); - } - return; - } - this.schedule(); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -class UserMetadata { - constructor(createdAt, lastLoginAt) { - this.createdAt = createdAt; - this.lastLoginAt = lastLoginAt; - this._initializeTime(); - } - _initializeTime() { - this.lastSignInTime = utcTimestampToDateString(this.lastLoginAt); - this.creationTime = utcTimestampToDateString(this.createdAt); - } - _copy(metadata) { - this.createdAt = metadata.createdAt; - this.lastLoginAt = metadata.lastLoginAt; - this._initializeTime(); - } - toJSON() { - return { - createdAt: this.createdAt, - lastLoginAt: this.lastLoginAt - }; - } -} - -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function _reloadWithoutSaving(user) { - const auth = user.auth; - const idToken = await user.getIdToken(); - const response = await _logoutIfInvalidated(user, getAccountInfo(auth, { idToken })); - _assert(response?.users.length, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - const coreAccount = response.users[0]; - user._notifyReloadListener(coreAccount); - const newProviderData = coreAccount.providerUserInfo?.length - ? extractProviderData(coreAccount.providerUserInfo) - : []; - const providerData = mergeProviderData(user.providerData, newProviderData); - // Preserves the non-nonymous status of the stored user, even if no more - // credentials (federated or email/password) are linked to the user. If - // the user was previously anonymous, then use provider data to update. - // On the other hand, if it was not anonymous before, it should never be - // considered anonymous now. - const oldIsAnonymous = user.isAnonymous; - const newIsAnonymous = !(user.email && coreAccount.passwordHash) && !providerData?.length; - const isAnonymous = !oldIsAnonymous ? false : newIsAnonymous; - const updates = { - uid: coreAccount.localId, - displayName: coreAccount.displayName || null, - photoURL: coreAccount.photoUrl || null, - email: coreAccount.email || null, - emailVerified: coreAccount.emailVerified || false, - phoneNumber: coreAccount.phoneNumber || null, - tenantId: coreAccount.tenantId || null, - providerData, - metadata: new UserMetadata(coreAccount.createdAt, coreAccount.lastLoginAt), - isAnonymous - }; - Object.assign(user, updates); -} -/** - * Reloads user account data, if signed in. - * - * @param user - The user. - * - * @public - */ -async function reload(user) { - const userInternal = getModularInstance(user); - await _reloadWithoutSaving(userInternal); - // Even though the current user hasn't changed, update - // current user will trigger a persistence update w/ the - // new info. - await userInternal.auth._persistUserIfCurrent(userInternal); - userInternal.auth._notifyListenersIfCurrent(userInternal); -} -function mergeProviderData(original, newData) { - const deduped = original.filter(o => !newData.some(n => n.providerId === o.providerId)); - return [...deduped, ...newData]; -} -function extractProviderData(providers) { - return providers.map(({ providerId, ...provider }) => { - return { - providerId, - uid: provider.rawId || '', - displayName: provider.displayName || null, - email: provider.email || null, - phoneNumber: provider.phoneNumber || null, - photoURL: provider.photoUrl || null - }; - }); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function requestStsToken(auth, refreshToken) { - const response = await _performFetchWithErrorHandling(auth, {}, async () => { - const body = querystring({ - 'grant_type': 'refresh_token', - 'refresh_token': refreshToken - }).slice(1); - const { tokenApiHost, apiKey } = auth.config; - const url = await _getFinalTarget(auth, tokenApiHost, "/v1/token" /* Endpoint.TOKEN */, `key=${apiKey}`); - const headers = await auth._getAdditionalHeaders(); - headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/x-www-form-urlencoded'; - const options = { - method: "POST" /* HttpMethod.POST */, - headers, - body - }; - if (auth.emulatorConfig && - isCloudWorkstation(auth.emulatorConfig.host)) { - options.credentials = 'include'; - } - return FetchProvider.fetch()(url, options); - }); - // The response comes back in snake_case. Convert to camel: - return { - accessToken: response.access_token, - expiresIn: response.expires_in, - refreshToken: response.refresh_token - }; -} -async function revokeToken(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts:revokeToken" /* Endpoint.REVOKE_TOKEN */, _addTidIfNecessary(auth, request)); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * We need to mark this class as internal explicitly to exclude it in the public typings, because - * it references AuthInternal which has a circular dependency with UserInternal. - * - * @internal - */ -class StsTokenManager { - constructor() { - this.refreshToken = null; - this.accessToken = null; - this.expirationTime = null; - } - get isExpired() { - return (!this.expirationTime || - Date.now() > this.expirationTime - 30000 /* Buffer.TOKEN_REFRESH */); - } - updateFromServerResponse(response) { - _assert(response.idToken, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - _assert(typeof response.idToken !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - _assert(typeof response.refreshToken !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - const expiresIn = 'expiresIn' in response && typeof response.expiresIn !== 'undefined' - ? Number(response.expiresIn) - : _tokenExpiresIn(response.idToken); - this.updateTokensAndExpiration(response.idToken, response.refreshToken, expiresIn); - } - updateFromIdToken(idToken) { - _assert(idToken.length !== 0, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - const expiresIn = _tokenExpiresIn(idToken); - this.updateTokensAndExpiration(idToken, null, expiresIn); - } - async getToken(auth, forceRefresh = false) { - if (!forceRefresh && this.accessToken && !this.isExpired) { - return this.accessToken; - } - _assert(this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */); - if (this.refreshToken) { - await this.refresh(auth, this.refreshToken); - return this.accessToken; - } - return null; - } - clearRefreshToken() { - this.refreshToken = null; - } - async refresh(auth, oldToken) { - const { accessToken, refreshToken, expiresIn } = await requestStsToken(auth, oldToken); - this.updateTokensAndExpiration(accessToken, refreshToken, Number(expiresIn)); - } - updateTokensAndExpiration(accessToken, refreshToken, expiresInSec) { - this.refreshToken = refreshToken || null; - this.accessToken = accessToken || null; - this.expirationTime = Date.now() + expiresInSec * 1000; - } - static fromJSON(appName, object) { - const { refreshToken, accessToken, expirationTime } = object; - const manager = new StsTokenManager(); - if (refreshToken) { - _assert(typeof refreshToken === 'string', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, { - appName - }); - manager.refreshToken = refreshToken; - } - if (accessToken) { - _assert(typeof accessToken === 'string', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, { - appName - }); - manager.accessToken = accessToken; - } - if (expirationTime) { - _assert(typeof expirationTime === 'number', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, { - appName - }); - manager.expirationTime = expirationTime; - } - return manager; - } - toJSON() { - return { - refreshToken: this.refreshToken, - accessToken: this.accessToken, - expirationTime: this.expirationTime - }; - } - _assign(stsTokenManager) { - this.accessToken = stsTokenManager.accessToken; - this.refreshToken = stsTokenManager.refreshToken; - this.expirationTime = stsTokenManager.expirationTime; - } - _clone() { - return Object.assign(new StsTokenManager(), this.toJSON()); - } - _performRefresh() { - return debugFail('not implemented'); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function assertStringOrUndefined(assertion, appName) { - _assert(typeof assertion === 'string' || typeof assertion === 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, { appName }); -} -class UserImpl { - constructor({ uid, auth, stsTokenManager, ...opt }) { - // For the user object, provider is always Firebase. - this.providerId = "firebase" /* ProviderId.FIREBASE */; - this.proactiveRefresh = new ProactiveRefresh(this); - this.reloadUserInfo = null; - this.reloadListener = null; - this.uid = uid; - this.auth = auth; - this.stsTokenManager = stsTokenManager; - this.accessToken = stsTokenManager.accessToken; - this.displayName = opt.displayName || null; - this.email = opt.email || null; - this.emailVerified = opt.emailVerified || false; - this.phoneNumber = opt.phoneNumber || null; - this.photoURL = opt.photoURL || null; - this.isAnonymous = opt.isAnonymous || false; - this.tenantId = opt.tenantId || null; - this.providerData = opt.providerData ? [...opt.providerData] : []; - this.metadata = new UserMetadata(opt.createdAt || undefined, opt.lastLoginAt || undefined); - } - async getIdToken(forceRefresh) { - const accessToken = await _logoutIfInvalidated(this, this.stsTokenManager.getToken(this.auth, forceRefresh)); - _assert(accessToken, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - if (this.accessToken !== accessToken) { - this.accessToken = accessToken; - await this.auth._persistUserIfCurrent(this); - this.auth._notifyListenersIfCurrent(this); - } - return accessToken; - } - getIdTokenResult(forceRefresh) { - return getIdTokenResult(this, forceRefresh); - } - reload() { - return reload(this); - } - _assign(user) { - if (this === user) { - return; - } - _assert(this.uid === user.uid, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - this.displayName = user.displayName; - this.photoURL = user.photoURL; - this.email = user.email; - this.emailVerified = user.emailVerified; - this.phoneNumber = user.phoneNumber; - this.isAnonymous = user.isAnonymous; - this.tenantId = user.tenantId; - this.providerData = user.providerData.map(userInfo => ({ ...userInfo })); - this.metadata._copy(user.metadata); - this.stsTokenManager._assign(user.stsTokenManager); - } - _clone(auth) { - const newUser = new UserImpl({ - ...this, - auth, - stsTokenManager: this.stsTokenManager._clone() - }); - newUser.metadata._copy(this.metadata); - return newUser; - } - _onReload(callback) { - // There should only ever be one listener, and that is a single instance of MultiFactorUser - _assert(!this.reloadListener, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - this.reloadListener = callback; - if (this.reloadUserInfo) { - this._notifyReloadListener(this.reloadUserInfo); - this.reloadUserInfo = null; - } - } - _notifyReloadListener(userInfo) { - if (this.reloadListener) { - this.reloadListener(userInfo); - } - else { - // If no listener is subscribed yet, save the result so it's available when they do subscribe - this.reloadUserInfo = userInfo; - } - } - _startProactiveRefresh() { - this.proactiveRefresh._start(); - } - _stopProactiveRefresh() { - this.proactiveRefresh._stop(); - } - async _updateTokensIfNecessary(response, reload = false) { - let tokensRefreshed = false; - if (response.idToken && - response.idToken !== this.stsTokenManager.accessToken) { - this.stsTokenManager.updateFromServerResponse(response); - tokensRefreshed = true; - } - if (reload) { - await _reloadWithoutSaving(this); - } - await this.auth._persistUserIfCurrent(this); - if (tokensRefreshed) { - this.auth._notifyListenersIfCurrent(this); - } - } - async delete() { - if (_isFirebaseServerApp(this.auth.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this.auth)); - } - const idToken = await this.getIdToken(); - await _logoutIfInvalidated(this, deleteAccount(this.auth, { idToken })); - this.stsTokenManager.clearRefreshToken(); - // TODO: Determine if cancellable-promises are necessary to use in this class so that delete() - // cancels pending actions... - return this.auth.signOut(); - } - toJSON() { - return { - uid: this.uid, - email: this.email || undefined, - emailVerified: this.emailVerified, - displayName: this.displayName || undefined, - isAnonymous: this.isAnonymous, - photoURL: this.photoURL || undefined, - phoneNumber: this.phoneNumber || undefined, - tenantId: this.tenantId || undefined, - providerData: this.providerData.map(userInfo => ({ ...userInfo })), - stsTokenManager: this.stsTokenManager.toJSON(), - // Redirect event ID must be maintained in case there is a pending - // redirect event. - _redirectEventId: this._redirectEventId, - ...this.metadata.toJSON(), - // Required for compatibility with the legacy SDK (go/firebase-auth-sdk-persistence-parsing): - apiKey: this.auth.config.apiKey, - appName: this.auth.name - // Missing authDomain will be tolerated by the legacy SDK. - // stsTokenManager.apiKey isn't actually required (despite the legacy SDK persisting it). - }; - } - get refreshToken() { - return this.stsTokenManager.refreshToken || ''; - } - static _fromJSON(auth, object) { - const displayName = object.displayName ?? undefined; - const email = object.email ?? undefined; - const phoneNumber = object.phoneNumber ?? undefined; - const photoURL = object.photoURL ?? undefined; - const tenantId = object.tenantId ?? undefined; - const _redirectEventId = object._redirectEventId ?? undefined; - const createdAt = object.createdAt ?? undefined; - const lastLoginAt = object.lastLoginAt ?? undefined; - const { uid, emailVerified, isAnonymous, providerData, stsTokenManager: plainObjectTokenManager } = object; - _assert(uid && plainObjectTokenManager, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - const stsTokenManager = StsTokenManager.fromJSON(this.name, plainObjectTokenManager); - _assert(typeof uid === 'string', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - assertStringOrUndefined(displayName, auth.name); - assertStringOrUndefined(email, auth.name); - _assert(typeof emailVerified === 'boolean', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - _assert(typeof isAnonymous === 'boolean', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - assertStringOrUndefined(phoneNumber, auth.name); - assertStringOrUndefined(photoURL, auth.name); - assertStringOrUndefined(tenantId, auth.name); - assertStringOrUndefined(_redirectEventId, auth.name); - assertStringOrUndefined(createdAt, auth.name); - assertStringOrUndefined(lastLoginAt, auth.name); - const user = new UserImpl({ - uid, - auth, - email, - emailVerified, - displayName, - isAnonymous, - photoURL, - phoneNumber, - tenantId, - stsTokenManager, - createdAt, - lastLoginAt - }); - if (providerData && Array.isArray(providerData)) { - user.providerData = providerData.map(userInfo => ({ ...userInfo })); - } - if (_redirectEventId) { - user._redirectEventId = _redirectEventId; - } - return user; - } - /** - * Initialize a User from an idToken server response - * @param auth - * @param idTokenResponse - */ - static async _fromIdTokenResponse(auth, idTokenResponse, isAnonymous = false) { - const stsTokenManager = new StsTokenManager(); - stsTokenManager.updateFromServerResponse(idTokenResponse); - // Initialize the Firebase Auth user. - const user = new UserImpl({ - uid: idTokenResponse.localId, - auth, - stsTokenManager, - isAnonymous - }); - // Updates the user info and data and resolves with a user instance. - await _reloadWithoutSaving(user); - return user; - } - /** - * Initialize a User from an idToken server response - * @param auth - * @param idTokenResponse - */ - static async _fromGetAccountInfoResponse(auth, response, idToken) { - const coreAccount = response.users[0]; - _assert(coreAccount.localId !== undefined, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - const providerData = coreAccount.providerUserInfo !== undefined - ? extractProviderData(coreAccount.providerUserInfo) - : []; - const isAnonymous = !(coreAccount.email && coreAccount.passwordHash) && !providerData?.length; - const stsTokenManager = new StsTokenManager(); - stsTokenManager.updateFromIdToken(idToken); - // Initialize the Firebase Auth user. - const user = new UserImpl({ - uid: coreAccount.localId, - auth, - stsTokenManager, - isAnonymous - }); - // update the user with data from the GetAccountInfo response. - const updates = { - uid: coreAccount.localId, - displayName: coreAccount.displayName || null, - photoURL: coreAccount.photoUrl || null, - email: coreAccount.email || null, - emailVerified: coreAccount.emailVerified || false, - phoneNumber: coreAccount.phoneNumber || null, - tenantId: coreAccount.tenantId || null, - providerData, - metadata: new UserMetadata(coreAccount.createdAt, coreAccount.lastLoginAt), - isAnonymous: !(coreAccount.email && coreAccount.passwordHash) && - !providerData?.length - }; - Object.assign(user, updates); - return user; - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const instanceCache = new Map(); -function _getInstance(cls) { - debugAssert(cls instanceof Function, 'Expected a class definition'); - let instance = instanceCache.get(cls); - if (instance) { - debugAssert(instance instanceof cls, 'Instance stored in cache mismatched with class'); - return instance; - } - instance = new cls(); - instanceCache.set(cls, instance); - return instance; -} - -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -class InMemoryPersistence { - constructor() { - this.type = "NONE" /* PersistenceType.NONE */; - this.storage = {}; - } - async _isAvailable() { - return true; - } - async _set(key, value) { - this.storage[key] = value; - } - async _get(key) { - const value = this.storage[key]; - return value === undefined ? null : value; - } - async _remove(key) { - delete this.storage[key]; - } - _addListener(_key, _listener) { - // Listeners are not supported for in-memory storage since it cannot be shared across windows/workers - return; - } - _removeListener(_key, _listener) { - // Listeners are not supported for in-memory storage since it cannot be shared across windows/workers - return; - } -} -InMemoryPersistence.type = 'NONE'; -/** - * An implementation of {@link Persistence} of type 'NONE'. - * - * @public - */ -const inMemoryPersistence = InMemoryPersistence; - -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function _persistenceKeyName(key, apiKey, appName) { - return `${"firebase" /* Namespace.PERSISTENCE */}:${key}:${apiKey}:${appName}`; -} -class PersistenceUserManager { - constructor(persistence, auth, userKey) { - this.persistence = persistence; - this.auth = auth; - this.userKey = userKey; - const { config, name } = this.auth; - this.fullUserKey = _persistenceKeyName(this.userKey, config.apiKey, name); - this.fullPersistenceKey = _persistenceKeyName("persistence" /* KeyName.PERSISTENCE_USER */, config.apiKey, name); - this.boundEventHandler = auth._onStorageEvent.bind(auth); - this.persistence._addListener(this.fullUserKey, this.boundEventHandler); - } - setCurrentUser(user) { - return this.persistence._set(this.fullUserKey, user.toJSON()); - } - async getCurrentUser() { - const blob = await this.persistence._get(this.fullUserKey); - if (!blob) { - return null; - } - if (typeof blob === 'string') { - const response = await getAccountInfo(this.auth, { idToken: blob }).catch(() => undefined); - if (!response) { - return null; - } - return UserImpl._fromGetAccountInfoResponse(this.auth, response, blob); - } - return UserImpl._fromJSON(this.auth, blob); - } - removeCurrentUser() { - return this.persistence._remove(this.fullUserKey); - } - savePersistenceForRedirect() { - return this.persistence._set(this.fullPersistenceKey, this.persistence.type); - } - async setPersistence(newPersistence) { - if (this.persistence === newPersistence) { - return; - } - const currentUser = await this.getCurrentUser(); - await this.removeCurrentUser(); - this.persistence = newPersistence; - if (currentUser) { - return this.setCurrentUser(currentUser); - } - } - delete() { - this.persistence._removeListener(this.fullUserKey, this.boundEventHandler); - } - static async create(auth, persistenceHierarchy, userKey = "authUser" /* KeyName.AUTH_USER */) { - if (!persistenceHierarchy.length) { - return new PersistenceUserManager(_getInstance(inMemoryPersistence), auth, userKey); - } - // Eliminate any persistences that are not available - const availablePersistences = (await Promise.all(persistenceHierarchy.map(async (persistence) => { - if (await persistence._isAvailable()) { - return persistence; - } - return undefined; - }))).filter(persistence => persistence); - // Fall back to the first persistence listed, or in memory if none available - let selectedPersistence = availablePersistences[0] || - _getInstance(inMemoryPersistence); - const key = _persistenceKeyName(userKey, auth.config.apiKey, auth.name); - // Pull out the existing user, setting the chosen persistence to that - // persistence if the user exists. - let userToMigrate = null; - // Note, here we check for a user in _all_ persistences, not just the - // ones deemed available. If we can migrate a user out of a broken - // persistence, we will (but only if that persistence supports migration). - for (const persistence of persistenceHierarchy) { - try { - const blob = await persistence._get(key); - if (blob) { - let user; - if (typeof blob === 'string') { - const response = await getAccountInfo(auth, { - idToken: blob - }).catch(() => undefined); - if (!response) { - break; - } - user = await UserImpl._fromGetAccountInfoResponse(auth, response, blob); - } - else { - user = UserImpl._fromJSON(auth, blob); // throws for unparsable blob (wrong format) - } - if (persistence !== selectedPersistence) { - userToMigrate = user; - } - selectedPersistence = persistence; - break; - } - } - catch { } - } - // If we find the user in a persistence that does support migration, use - // that migration path (of only persistences that support migration) - const migrationHierarchy = availablePersistences.filter(p => p._shouldAllowMigration); - // If the persistence does _not_ allow migration, just finish off here - if (!selectedPersistence._shouldAllowMigration || - !migrationHierarchy.length) { - return new PersistenceUserManager(selectedPersistence, auth, userKey); - } - selectedPersistence = migrationHierarchy[0]; - if (userToMigrate) { - // This normally shouldn't throw since chosenPersistence.isAvailable() is true, but if it does - // we'll just let it bubble to surface the error. - await selectedPersistence._set(key, userToMigrate.toJSON()); - } - // Attempt to clear the key in other persistences but ignore errors. This helps prevent issues - // such as users getting stuck with a previous account after signing out and refreshing the tab. - await Promise.all(persistenceHierarchy.map(async (persistence) => { - if (persistence !== selectedPersistence) { - try { - await persistence._remove(key); - } - catch { } - } - })); - return new PersistenceUserManager(selectedPersistence, auth, userKey); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Determine the browser for the purposes of reporting usage to the API - */ -function _getBrowserName(userAgent) { - const ua = userAgent.toLowerCase(); - if (ua.includes('opera/') || ua.includes('opr/') || ua.includes('opios/')) { - return "Opera" /* BrowserName.OPERA */; - } - else if (_isIEMobile(ua)) { - // Windows phone IEMobile browser. - return "IEMobile" /* BrowserName.IEMOBILE */; - } - else if (ua.includes('msie') || ua.includes('trident/')) { - return "IE" /* BrowserName.IE */; - } - else if (ua.includes('edge/')) { - return "Edge" /* BrowserName.EDGE */; - } - else if (_isFirefox(ua)) { - return "Firefox" /* BrowserName.FIREFOX */; - } - else if (ua.includes('silk/')) { - return "Silk" /* BrowserName.SILK */; - } - else if (_isBlackBerry(ua)) { - // Blackberry browser. - return "Blackberry" /* BrowserName.BLACKBERRY */; - } - else if (_isWebOS(ua)) { - // WebOS default browser. - return "Webos" /* BrowserName.WEBOS */; - } - else if (_isSafari(ua)) { - return "Safari" /* BrowserName.SAFARI */; - } - else if ((ua.includes('chrome/') || _isChromeIOS(ua)) && - !ua.includes('edge/')) { - return "Chrome" /* BrowserName.CHROME */; - } - else if (_isAndroid(ua)) { - // Android stock browser. - return "Android" /* BrowserName.ANDROID */; - } - else { - // Most modern browsers have name/version at end of user agent string. - const re = /([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/; - const matches = userAgent.match(re); - if (matches?.length === 2) { - return matches[1]; - } - } - return "Other" /* BrowserName.OTHER */; -} -function _isFirefox(ua = getUA()) { - return /firefox\//i.test(ua); -} -function _isSafari(userAgent = getUA()) { - const ua = userAgent.toLowerCase(); - return (ua.includes('safari/') && - !ua.includes('chrome/') && - !ua.includes('crios/') && - !ua.includes('android')); -} -function _isChromeIOS(ua = getUA()) { - return /crios\//i.test(ua); -} -function _isIEMobile(ua = getUA()) { - return /iemobile/i.test(ua); -} -function _isAndroid(ua = getUA()) { - return /android/i.test(ua); -} -function _isBlackBerry(ua = getUA()) { - return /blackberry/i.test(ua); -} -function _isWebOS(ua = getUA()) { - return /webos/i.test(ua); -} -function _isIOS(ua = getUA()) { - return (/iphone|ipad|ipod/i.test(ua) || - (/macintosh/i.test(ua) && /mobile/i.test(ua))); -} -function _isIOS7Or8(ua = getUA()) { - return (/(iPad|iPhone|iPod).*OS 7_\d/i.test(ua) || - /(iPad|iPhone|iPod).*OS 8_\d/i.test(ua)); -} -function _isIOSStandalone(ua = getUA()) { - return _isIOS(ua) && !!window.navigator?.standalone; -} -function _isIE10() { - return isIE() && document.documentMode === 10; -} -function _isMobileBrowser(ua = getUA()) { - // TODO: implement getBrowserName equivalent for OS. - return (_isIOS(ua) || - _isAndroid(ua) || - _isWebOS(ua) || - _isBlackBerry(ua) || - /windows phone/i.test(ua) || - _isIEMobile(ua)); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * Determine the SDK version string - */ -function _getClientVersion(clientPlatform, frameworks = []) { - let reportedPlatform; - switch (clientPlatform) { - case "Browser" /* ClientPlatform.BROWSER */: - // In a browser environment, report the browser name. - reportedPlatform = _getBrowserName(getUA()); - break; - case "Worker" /* ClientPlatform.WORKER */: - // Technically a worker runs from a browser but we need to differentiate a - // worker from a browser. - // For example: Chrome-Worker/JsCore/4.9.1/FirebaseCore-web. - reportedPlatform = `${_getBrowserName(getUA())}-${clientPlatform}`; - break; - default: - reportedPlatform = clientPlatform; - } - const reportedFrameworks = frameworks.length - ? frameworks.join(',') - : 'FirebaseCore-web'; /* default value if no other framework is used */ - return `${reportedPlatform}/${"JsCore" /* ClientImplementation.CORE */}/${SDK_VERSION}/${reportedFrameworks}`; -} - -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -class AuthMiddlewareQueue { - constructor(auth) { - this.auth = auth; - this.queue = []; - } - pushCallback(callback, onAbort) { - // The callback could be sync or async. Wrap it into a - // function that is always async. - const wrappedCallback = (user) => new Promise((resolve, reject) => { - try { - const result = callback(user); - // Either resolve with existing promise or wrap a non-promise - // return value into a promise. - resolve(result); - } - catch (e) { - // Sync callback throws. - reject(e); - } - }); - // Attach the onAbort if present - wrappedCallback.onAbort = onAbort; - this.queue.push(wrappedCallback); - const index = this.queue.length - 1; - return () => { - // Unsubscribe. Replace with no-op. Do not remove from array, or it will disturb - // indexing of other elements. - this.queue[index] = () => Promise.resolve(); - }; - } - async runMiddleware(nextUser) { - if (this.auth.currentUser === nextUser) { - return; - } - // While running the middleware, build a temporary stack of onAbort - // callbacks to call if one middleware callback rejects. - const onAbortStack = []; - try { - for (const beforeStateCallback of this.queue) { - await beforeStateCallback(nextUser); - // Only push the onAbort if the callback succeeds - if (beforeStateCallback.onAbort) { - onAbortStack.push(beforeStateCallback.onAbort); - } - } - } - catch (e) { - // Run all onAbort, with separate try/catch to ignore any errors and - // continue - onAbortStack.reverse(); - for (const onAbort of onAbortStack) { - try { - onAbort(); - } - catch (_) { - /* swallow error */ - } - } - throw this.auth._errorFactory.create("login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */, { - originalMessage: e?.message - }); - } - } -} - -/** - * @license - * Copyright 2023 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Fetches the password policy for the currently set tenant or the project if no tenant is set. - * - * @param auth Auth object. - * @param request Password policy request. - * @returns Password policy response. - */ -async function _getPasswordPolicy(auth, request = {}) { - return _performApiRequest(auth, "GET" /* HttpMethod.GET */, "/v2/passwordPolicy" /* Endpoint.GET_PASSWORD_POLICY */, _addTidIfNecessary(auth, request)); -} - -/** - * @license - * Copyright 2023 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Minimum min password length enforced by the backend, even if no minimum length is set. -const MINIMUM_MIN_PASSWORD_LENGTH = 6; -/** - * Stores password policy requirements and provides password validation against the policy. - * - * @internal - */ -class PasswordPolicyImpl { - constructor(response) { - // Only include custom strength options defined in the response. - const responseOptions = response.customStrengthOptions; - this.customStrengthOptions = {}; - // TODO: Remove once the backend is updated to include the minimum min password length instead of undefined when there is no minimum length set. - this.customStrengthOptions.minPasswordLength = - responseOptions.minPasswordLength ?? MINIMUM_MIN_PASSWORD_LENGTH; - if (responseOptions.maxPasswordLength) { - this.customStrengthOptions.maxPasswordLength = - responseOptions.maxPasswordLength; - } - if (responseOptions.containsLowercaseCharacter !== undefined) { - this.customStrengthOptions.containsLowercaseLetter = - responseOptions.containsLowercaseCharacter; - } - if (responseOptions.containsUppercaseCharacter !== undefined) { - this.customStrengthOptions.containsUppercaseLetter = - responseOptions.containsUppercaseCharacter; - } - if (responseOptions.containsNumericCharacter !== undefined) { - this.customStrengthOptions.containsNumericCharacter = - responseOptions.containsNumericCharacter; - } - if (responseOptions.containsNonAlphanumericCharacter !== undefined) { - this.customStrengthOptions.containsNonAlphanumericCharacter = - responseOptions.containsNonAlphanumericCharacter; - } - this.enforcementState = response.enforcementState; - if (this.enforcementState === 'ENFORCEMENT_STATE_UNSPECIFIED') { - this.enforcementState = 'OFF'; - } - // Use an empty string if no non-alphanumeric characters are specified in the response. - this.allowedNonAlphanumericCharacters = - response.allowedNonAlphanumericCharacters?.join('') ?? ''; - this.forceUpgradeOnSignin = response.forceUpgradeOnSignin ?? false; - this.schemaVersion = response.schemaVersion; - } - validatePassword(password) { - const status = { - isValid: true, - passwordPolicy: this - }; - // Check the password length and character options. - this.validatePasswordLengthOptions(password, status); - this.validatePasswordCharacterOptions(password, status); - // Combine the status into single isValid property. - status.isValid && (status.isValid = status.meetsMinPasswordLength ?? true); - status.isValid && (status.isValid = status.meetsMaxPasswordLength ?? true); - status.isValid && (status.isValid = status.containsLowercaseLetter ?? true); - status.isValid && (status.isValid = status.containsUppercaseLetter ?? true); - status.isValid && (status.isValid = status.containsNumericCharacter ?? true); - status.isValid && (status.isValid = status.containsNonAlphanumericCharacter ?? true); - return status; - } - /** - * Validates that the password meets the length options for the policy. - * - * @param password Password to validate. - * @param status Validation status. - */ - validatePasswordLengthOptions(password, status) { - const minPasswordLength = this.customStrengthOptions.minPasswordLength; - const maxPasswordLength = this.customStrengthOptions.maxPasswordLength; - if (minPasswordLength) { - status.meetsMinPasswordLength = password.length >= minPasswordLength; - } - if (maxPasswordLength) { - status.meetsMaxPasswordLength = password.length <= maxPasswordLength; - } - } - /** - * Validates that the password meets the character options for the policy. - * - * @param password Password to validate. - * @param status Validation status. - */ - validatePasswordCharacterOptions(password, status) { - // Assign statuses for requirements even if the password is an empty string. - this.updatePasswordCharacterOptionsStatuses(status, - /* containsLowercaseCharacter= */ false, - /* containsUppercaseCharacter= */ false, - /* containsNumericCharacter= */ false, - /* containsNonAlphanumericCharacter= */ false); - let passwordChar; - for (let i = 0; i < password.length; i++) { - passwordChar = password.charAt(i); - this.updatePasswordCharacterOptionsStatuses(status, - /* containsLowercaseCharacter= */ passwordChar >= 'a' && - passwordChar <= 'z', - /* containsUppercaseCharacter= */ passwordChar >= 'A' && - passwordChar <= 'Z', - /* containsNumericCharacter= */ passwordChar >= '0' && - passwordChar <= '9', - /* containsNonAlphanumericCharacter= */ this.allowedNonAlphanumericCharacters.includes(passwordChar)); - } - } - /** - * Updates the running validation status with the statuses for the character options. - * Expected to be called each time a character is processed to update each option status - * based on the current character. - * - * @param status Validation status. - * @param containsLowercaseCharacter Whether the character is a lowercase letter. - * @param containsUppercaseCharacter Whether the character is an uppercase letter. - * @param containsNumericCharacter Whether the character is a numeric character. - * @param containsNonAlphanumericCharacter Whether the character is a non-alphanumeric character. - */ - updatePasswordCharacterOptionsStatuses(status, containsLowercaseCharacter, containsUppercaseCharacter, containsNumericCharacter, containsNonAlphanumericCharacter) { - if (this.customStrengthOptions.containsLowercaseLetter) { - status.containsLowercaseLetter || (status.containsLowercaseLetter = containsLowercaseCharacter); - } - if (this.customStrengthOptions.containsUppercaseLetter) { - status.containsUppercaseLetter || (status.containsUppercaseLetter = containsUppercaseCharacter); - } - if (this.customStrengthOptions.containsNumericCharacter) { - status.containsNumericCharacter || (status.containsNumericCharacter = containsNumericCharacter); - } - if (this.customStrengthOptions.containsNonAlphanumericCharacter) { - status.containsNonAlphanumericCharacter || (status.containsNonAlphanumericCharacter = containsNonAlphanumericCharacter); - } - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -class AuthImpl { - constructor(app, heartbeatServiceProvider, appCheckServiceProvider, config) { - this.app = app; - this.heartbeatServiceProvider = heartbeatServiceProvider; - this.appCheckServiceProvider = appCheckServiceProvider; - this.config = config; - this.currentUser = null; - this.emulatorConfig = null; - this.operations = Promise.resolve(); - this.authStateSubscription = new Subscription(this); - this.idTokenSubscription = new Subscription(this); - this.beforeStateQueue = new AuthMiddlewareQueue(this); - this.redirectUser = null; - this.isProactiveRefreshEnabled = false; - this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION = 1; - // Any network calls will set this to true and prevent subsequent emulator - // initialization - this._canInitEmulator = true; - this._isInitialized = false; - this._deleted = false; - this._initializationPromise = null; - this._popupRedirectResolver = null; - this._errorFactory = _DEFAULT_AUTH_ERROR_FACTORY; - this._agentRecaptchaConfig = null; - this._tenantRecaptchaConfigs = {}; - this._projectPasswordPolicy = null; - this._tenantPasswordPolicies = {}; - this._resolvePersistenceManagerAvailable = undefined; - // Tracks the last notified UID for state change listeners to prevent - // repeated calls to the callbacks. Undefined means it's never been - // called, whereas null means it's been called with a signed out user - this.lastNotifiedUid = undefined; - this.languageCode = null; - this.tenantId = null; - this.settings = { appVerificationDisabledForTesting: false }; - this.frameworks = []; - this.name = app.name; - this.clientVersion = config.sdkClientVersion; - // TODO(jamesdaniels) explore less hacky way to do this, cookie authentication needs - // persistenceMananger to be available. see _getFinalTarget for more context - this._persistenceManagerAvailable = new Promise(resolve => (this._resolvePersistenceManagerAvailable = resolve)); - } - _initializeWithPersistence(persistenceHierarchy, popupRedirectResolver) { - if (popupRedirectResolver) { - this._popupRedirectResolver = _getInstance(popupRedirectResolver); - } - // Have to check for app deletion throughout initialization (after each - // promise resolution) - this._initializationPromise = this.queue(async () => { - if (this._deleted) { - return; - } - this.persistenceManager = await PersistenceUserManager.create(this, persistenceHierarchy); - this._resolvePersistenceManagerAvailable?.(); - if (this._deleted) { - return; - } - // Initialize the resolver early if necessary (only applicable to web: - // this will cause the iframe to load immediately in certain cases) - if (this._popupRedirectResolver?._shouldInitProactively) { - // If this fails, don't halt auth loading - try { - await this._popupRedirectResolver._initialize(this); - } - catch (e) { - /* Ignore the error */ - } - } - await this.initializeCurrentUser(popupRedirectResolver); - this.lastNotifiedUid = this.currentUser?.uid || null; - if (this._deleted) { - return; - } - this._isInitialized = true; - }); - return this._initializationPromise; - } - /** - * If the persistence is changed in another window, the user manager will let us know - */ - async _onStorageEvent() { - if (this._deleted) { - return; - } - const user = await this.assertedPersistence.getCurrentUser(); - if (!this.currentUser && !user) { - // No change, do nothing (was signed out and remained signed out). - return; - } - // If the same user is to be synchronized. - if (this.currentUser && user && this.currentUser.uid === user.uid) { - // Data update, simply copy data changes. - this._currentUser._assign(user); - // If tokens changed from previous user tokens, this will trigger - // notifyAuthListeners_. - await this.currentUser.getIdToken(); - return; - } - // Update current Auth state. Either a new login or logout. - // Skip blocking callbacks, they should not apply to a change in another tab. - await this._updateCurrentUser(user, /* skipBeforeStateCallbacks */ true); - } - async initializeCurrentUserFromIdToken(idToken) { - try { - const response = await getAccountInfo(this, { idToken }); - const user = await UserImpl._fromGetAccountInfoResponse(this, response, idToken); - await this.directlySetCurrentUser(user); - } - catch (err) { - console.warn('FirebaseServerApp could not login user with provided authIdToken: ', err); - await this.directlySetCurrentUser(null); - } - } - async initializeCurrentUser(popupRedirectResolver) { - if (_isFirebaseServerApp(this.app)) { - const idToken = this.app.settings.authIdToken; - if (idToken) { - // Start the auth operation in the next tick to allow a moment for the customer's app to - // attach an emulator, if desired. - return new Promise(resolve => { - setTimeout(() => this.initializeCurrentUserFromIdToken(idToken).then(resolve, resolve)); - }); - } - else { - return this.directlySetCurrentUser(null); - } - } - // First check to see if we have a pending redirect event. - const previouslyStoredUser = (await this.assertedPersistence.getCurrentUser()); - let futureCurrentUser = previouslyStoredUser; - let needsTocheckMiddleware = false; - if (popupRedirectResolver && this.config.authDomain) { - await this.getOrInitRedirectPersistenceManager(); - const redirectUserEventId = this.redirectUser?._redirectEventId; - const storedUserEventId = futureCurrentUser?._redirectEventId; - const result = await this.tryRedirectSignIn(popupRedirectResolver); - // If the stored user (i.e. the old "currentUser") has a redirectId that - // matches the redirect user, then we want to initially sign in with the - // new user object from result. - // TODO(samgho): More thoroughly test all of this - if ((!redirectUserEventId || redirectUserEventId === storedUserEventId) && - result?.user) { - futureCurrentUser = result.user; - needsTocheckMiddleware = true; - } - } - // If no user in persistence, there is no current user. Set to null. - if (!futureCurrentUser) { - return this.directlySetCurrentUser(null); - } - if (!futureCurrentUser._redirectEventId) { - // This isn't a redirect link operation, we can reload and bail. - // First though, ensure that we check the middleware is happy. - if (needsTocheckMiddleware) { - try { - await this.beforeStateQueue.runMiddleware(futureCurrentUser); - } - catch (e) { - futureCurrentUser = previouslyStoredUser; - // We know this is available since the bit is only set when the - // resolver is available - this._popupRedirectResolver._overrideRedirectResult(this, () => Promise.reject(e)); - } - } - if (futureCurrentUser) { - return this.reloadAndSetCurrentUserOrClear(futureCurrentUser); - } - else { - return this.directlySetCurrentUser(null); - } - } - _assert(this._popupRedirectResolver, this, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - await this.getOrInitRedirectPersistenceManager(); - // If the redirect user's event ID matches the current user's event ID, - // DO NOT reload the current user, otherwise they'll be cleared from storage. - // This is important for the reauthenticateWithRedirect() flow. - if (this.redirectUser && - this.redirectUser._redirectEventId === futureCurrentUser._redirectEventId) { - return this.directlySetCurrentUser(futureCurrentUser); - } - return this.reloadAndSetCurrentUserOrClear(futureCurrentUser); - } - async tryRedirectSignIn(redirectResolver) { - // The redirect user needs to be checked (and signed in if available) - // during auth initialization. All of the normal sign in and link/reauth - // flows call back into auth and push things onto the promise queue. We - // need to await the result of the redirect sign in *inside the promise - // queue*. This presents a problem: we run into deadlock. See: - // ┌> [Initialization] ─────┐ - // ┌> [<other queue tasks>] │ - // └─ [getRedirectResult] <─┘ - // where [] are tasks on the queue and arrows denote awaits - // Initialization will never complete because it's waiting on something - // that's waiting for initialization to complete! - // - // Instead, this method calls getRedirectResult() (stored in - // _completeRedirectFn) with an optional parameter that instructs all of - // the underlying auth operations to skip anything that mutates auth state. - let result = null; - try { - // We know this._popupRedirectResolver is set since redirectResolver - // is passed in. The _completeRedirectFn expects the unwrapped extern. - result = await this._popupRedirectResolver._completeRedirectFn(this, redirectResolver, true); - } - catch (e) { - // Swallow any errors here; the code can retrieve them in - // getRedirectResult(). - await this._setRedirectUser(null); - } - return result; - } - async reloadAndSetCurrentUserOrClear(user) { - try { - await _reloadWithoutSaving(user); - } - catch (e) { - if (e?.code !== - `auth/${"network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */}`) { - // Something's wrong with the user's token. Log them out and remove - // them from storage - return this.directlySetCurrentUser(null); - } - } - return this.directlySetCurrentUser(user); - } - useDeviceLanguage() { - this.languageCode = _getUserLanguage(); - } - async _delete() { - this._deleted = true; - } - async updateCurrentUser(userExtern) { - if (_isFirebaseServerApp(this.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this)); - } - // The public updateCurrentUser method needs to make a copy of the user, - // and also check that the project matches - const user = userExtern - ? getModularInstance(userExtern) - : null; - if (user) { - _assert(user.auth.config.apiKey === this.config.apiKey, this, "invalid-user-token" /* AuthErrorCode.INVALID_AUTH */); - } - return this._updateCurrentUser(user && user._clone(this)); - } - async _updateCurrentUser(user, skipBeforeStateCallbacks = false) { - if (this._deleted) { - return; - } - if (user) { - _assert(this.tenantId === user.tenantId, this, "tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */); - } - if (!skipBeforeStateCallbacks) { - await this.beforeStateQueue.runMiddleware(user); - } - return this.queue(async () => { - await this.directlySetCurrentUser(user); - this.notifyAuthListeners(); - }); - } - async signOut() { - if (_isFirebaseServerApp(this.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this)); - } - // Run first, to block _setRedirectUser() if any callbacks fail. - await this.beforeStateQueue.runMiddleware(null); - // Clear the redirect user when signOut is called - if (this.redirectPersistenceManager || this._popupRedirectResolver) { - await this._setRedirectUser(null); - } - // Prevent callbacks from being called again in _updateCurrentUser, as - // they were already called in the first line. - return this._updateCurrentUser(null, /* skipBeforeStateCallbacks */ true); - } - setPersistence(persistence) { - if (_isFirebaseServerApp(this.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this)); - } - return this.queue(async () => { - await this.assertedPersistence.setPersistence(_getInstance(persistence)); - }); - } - _getRecaptchaConfig() { - if (this.tenantId == null) { - return this._agentRecaptchaConfig; - } - else { - return this._tenantRecaptchaConfigs[this.tenantId]; - } - } - async validatePassword(password) { - if (!this._getPasswordPolicyInternal()) { - await this._updatePasswordPolicy(); - } - // Password policy will be defined after fetching. - const passwordPolicy = this._getPasswordPolicyInternal(); - // Check that the policy schema version is supported by the SDK. - // TODO: Update this logic to use a max supported policy schema version once we have multiple schema versions. - if (passwordPolicy.schemaVersion !== - this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION) { - return Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version" /* AuthErrorCode.UNSUPPORTED_PASSWORD_POLICY_SCHEMA_VERSION */, {})); - } - return passwordPolicy.validatePassword(password); - } - _getPasswordPolicyInternal() { - if (this.tenantId === null) { - return this._projectPasswordPolicy; - } - else { - return this._tenantPasswordPolicies[this.tenantId]; - } - } - async _updatePasswordPolicy() { - const response = await _getPasswordPolicy(this); - const passwordPolicy = new PasswordPolicyImpl(response); - if (this.tenantId === null) { - this._projectPasswordPolicy = passwordPolicy; - } - else { - this._tenantPasswordPolicies[this.tenantId] = passwordPolicy; - } - } - _getPersistenceType() { - return this.assertedPersistence.persistence.type; - } - _getPersistence() { - return this.assertedPersistence.persistence; - } - _updateErrorMap(errorMap) { - this._errorFactory = new ErrorFactory('auth', 'Firebase', errorMap()); - } - onAuthStateChanged(nextOrObserver, error, completed) { - return this.registerStateListener(this.authStateSubscription, nextOrObserver, error, completed); - } - beforeAuthStateChanged(callback, onAbort) { - return this.beforeStateQueue.pushCallback(callback, onAbort); - } - onIdTokenChanged(nextOrObserver, error, completed) { - return this.registerStateListener(this.idTokenSubscription, nextOrObserver, error, completed); - } - authStateReady() { - return new Promise((resolve, reject) => { - if (this.currentUser) { - resolve(); - } - else { - const unsubscribe = this.onAuthStateChanged(() => { - unsubscribe(); - resolve(); - }, reject); - } - }); - } - /** - * Revokes the given access token. Currently only supports Apple OAuth access tokens. - */ - async revokeAccessToken(token) { - if (this.currentUser) { - const idToken = await this.currentUser.getIdToken(); - // Generalize this to accept other providers once supported. - const request = { - providerId: 'apple.com', - tokenType: "ACCESS_TOKEN" /* TokenType.ACCESS_TOKEN */, - token, - idToken - }; - if (this.tenantId != null) { - request.tenantId = this.tenantId; - } - await revokeToken(this, request); - } - } - toJSON() { - return { - apiKey: this.config.apiKey, - authDomain: this.config.authDomain, - appName: this.name, - currentUser: this._currentUser?.toJSON() - }; - } - async _setRedirectUser(user, popupRedirectResolver) { - const redirectManager = await this.getOrInitRedirectPersistenceManager(popupRedirectResolver); - return user === null - ? redirectManager.removeCurrentUser() - : redirectManager.setCurrentUser(user); - } - async getOrInitRedirectPersistenceManager(popupRedirectResolver) { - if (!this.redirectPersistenceManager) { - const resolver = (popupRedirectResolver && _getInstance(popupRedirectResolver)) || - this._popupRedirectResolver; - _assert(resolver, this, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - this.redirectPersistenceManager = await PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], "redirectUser" /* KeyName.REDIRECT_USER */); - this.redirectUser = - await this.redirectPersistenceManager.getCurrentUser(); - } - return this.redirectPersistenceManager; - } - async _redirectUserForId(id) { - // Make sure we've cleared any pending persistence actions if we're not in - // the initializer - if (this._isInitialized) { - await this.queue(async () => { }); - } - if (this._currentUser?._redirectEventId === id) { - return this._currentUser; - } - if (this.redirectUser?._redirectEventId === id) { - return this.redirectUser; - } - return null; - } - async _persistUserIfCurrent(user) { - if (user === this.currentUser) { - return this.queue(async () => this.directlySetCurrentUser(user)); - } - } - /** Notifies listeners only if the user is current */ - _notifyListenersIfCurrent(user) { - if (user === this.currentUser) { - this.notifyAuthListeners(); - } - } - _key() { - return `${this.config.authDomain}:${this.config.apiKey}:${this.name}`; - } - _startProactiveRefresh() { - this.isProactiveRefreshEnabled = true; - if (this.currentUser) { - this._currentUser._startProactiveRefresh(); - } - } - _stopProactiveRefresh() { - this.isProactiveRefreshEnabled = false; - if (this.currentUser) { - this._currentUser._stopProactiveRefresh(); - } - } - /** Returns the current user cast as the internal type */ - get _currentUser() { - return this.currentUser; - } - notifyAuthListeners() { - if (!this._isInitialized) { - return; - } - this.idTokenSubscription.next(this.currentUser); - const currentUid = this.currentUser?.uid ?? null; - if (this.lastNotifiedUid !== currentUid) { - this.lastNotifiedUid = currentUid; - this.authStateSubscription.next(this.currentUser); - } - } - registerStateListener(subscription, nextOrObserver, error, completed) { - if (this._deleted) { - return () => { }; - } - const cb = typeof nextOrObserver === 'function' - ? nextOrObserver - : nextOrObserver.next.bind(nextOrObserver); - let isUnsubscribed = false; - const promise = this._isInitialized - ? Promise.resolve() - : this._initializationPromise; - _assert(promise, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - // The callback needs to be called asynchronously per the spec. - // eslint-disable-next-line @typescript-eslint/no-floating-promises - promise.then(() => { - if (isUnsubscribed) { - return; - } - cb(this.currentUser); - }); - if (typeof nextOrObserver === 'function') { - const unsubscribe = subscription.addObserver(nextOrObserver, error, completed); - return () => { - isUnsubscribed = true; - unsubscribe(); - }; - } - else { - const unsubscribe = subscription.addObserver(nextOrObserver); - return () => { - isUnsubscribed = true; - unsubscribe(); - }; - } - } - /** - * Unprotected (from race conditions) method to set the current user. This - * should only be called from within a queued callback. This is necessary - * because the queue shouldn't rely on another queued callback. - */ - async directlySetCurrentUser(user) { - if (this.currentUser && this.currentUser !== user) { - this._currentUser._stopProactiveRefresh(); - } - if (user && this.isProactiveRefreshEnabled) { - user._startProactiveRefresh(); - } - this.currentUser = user; - if (user) { - await this.assertedPersistence.setCurrentUser(user); - } - else { - await this.assertedPersistence.removeCurrentUser(); - } - } - queue(action) { - // In case something errors, the callback still should be called in order - // to keep the promise chain alive - this.operations = this.operations.then(action, action); - return this.operations; - } - get assertedPersistence() { - _assert(this.persistenceManager, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - return this.persistenceManager; - } - _logFramework(framework) { - if (!framework || this.frameworks.includes(framework)) { - return; - } - this.frameworks.push(framework); - // Sort alphabetically so that "FirebaseCore-web,FirebaseUI-web" and - // "FirebaseUI-web,FirebaseCore-web" aren't viewed as different. - this.frameworks.sort(); - this.clientVersion = _getClientVersion(this.config.clientPlatform, this._getFrameworks()); - } - _getFrameworks() { - return this.frameworks; - } - async _getAdditionalHeaders() { - // Additional headers on every request - const headers = { - ["X-Client-Version" /* HttpHeader.X_CLIENT_VERSION */]: this.clientVersion - }; - if (this.app.options.appId) { - headers["X-Firebase-gmpid" /* HttpHeader.X_FIREBASE_GMPID */] = this.app.options.appId; - } - // If the heartbeat service exists, add the heartbeat string - const heartbeatsHeader = await this.heartbeatServiceProvider - .getImmediate({ - optional: true - }) - ?.getHeartbeatsHeader(); - if (heartbeatsHeader) { - headers["X-Firebase-Client" /* HttpHeader.X_FIREBASE_CLIENT */] = heartbeatsHeader; - } - // If the App Check service exists, add the App Check token in the headers - const appCheckToken = await this._getAppCheckToken(); - if (appCheckToken) { - headers["X-Firebase-AppCheck" /* HttpHeader.X_FIREBASE_APP_CHECK */] = appCheckToken; - } - return headers; - } - async _getAppCheckToken() { - if (_isFirebaseServerApp(this.app) && this.app.settings.appCheckToken) { - return this.app.settings.appCheckToken; - } - const appCheckTokenResult = await this.appCheckServiceProvider - .getImmediate({ optional: true }) - ?.getToken(); - if (appCheckTokenResult?.error) { - // Context: appCheck.getToken() will never throw even if an error happened. - // In the error case, a dummy token will be returned along with an error field describing - // the error. In general, we shouldn't care about the error condition and just use - // the token (actual or dummy) to send requests. - _logWarn(`Error while retrieving App Check token: ${appCheckTokenResult.error}`); - } - return appCheckTokenResult?.token; - } -} -/** - * Method to be used to cast down to our private implementation of Auth. - * It will also handle unwrapping from the compat type if necessary - * - * @param auth Auth object passed in from developer - */ -function _castAuth(auth) { - return getModularInstance(auth); -} -/** Helper class to wrap subscriber logic */ -class Subscription { - constructor(auth) { - this.auth = auth; - this.observer = null; - this.addObserver = createSubscribe(observer => (this.observer = observer)); - } - get next() { - _assert(this.observer, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - return this.observer.next.bind(this.observer); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -let externalJSProvider = { - async loadJS() { - throw new Error('Unable to load external scripts'); - }, - recaptchaV2Script: '', - recaptchaEnterpriseScript: '', - gapiScript: '' -}; -function _setExternalJSProvider(p) { - externalJSProvider = p; -} -function _loadJS(url) { - return externalJSProvider.loadJS(url); -} -function _recaptchaV2ScriptUrl() { - return externalJSProvider.recaptchaV2Script; -} -function _recaptchaEnterpriseScriptUrl() { - return externalJSProvider.recaptchaEnterpriseScript; -} -function _gapiScriptUrl() { - return externalJSProvider.gapiScript; -} -function _generateCallbackName(prefix) { - return `__${prefix}${Math.floor(Math.random() * 1000000)}`; -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const _SOLVE_TIME_MS = 500; -const _EXPIRATION_TIME_MS = 60000; -const _WIDGET_ID_START = 1000000000000; -class MockReCaptcha { - constructor(auth) { - this.auth = auth; - this.counter = _WIDGET_ID_START; - this._widgets = new Map(); - } - render(container, parameters) { - const id = this.counter; - this._widgets.set(id, new MockWidget(container, this.auth.name, parameters || {})); - this.counter++; - return id; - } - reset(optWidgetId) { - const id = optWidgetId || _WIDGET_ID_START; - void this._widgets.get(id)?.delete(); - this._widgets.delete(id); - } - getResponse(optWidgetId) { - const id = optWidgetId || _WIDGET_ID_START; - return this._widgets.get(id)?.getResponse() || ''; - } - async execute(optWidgetId) { - const id = optWidgetId || _WIDGET_ID_START; - void this._widgets.get(id)?.execute(); - return ''; - } -} -class MockGreCAPTCHATopLevel { - constructor() { - this.enterprise = new MockGreCAPTCHA(); - } - ready(callback) { - callback(); - } - execute( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - _siteKey, _options) { - return Promise.resolve('token'); - } - render( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - _container, _parameters) { - return ''; - } -} -class MockGreCAPTCHA { - ready(callback) { - callback(); - } - execute( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - _siteKey, _options) { - return Promise.resolve('token'); - } - render( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - _container, _parameters) { - return ''; - } -} -class MockWidget { - constructor(containerOrId, appName, params) { - this.params = params; - this.timerId = null; - this.deleted = false; - this.responseToken = null; - this.clickHandler = () => { - this.execute(); - }; - const container = typeof containerOrId === 'string' - ? document.getElementById(containerOrId) - : containerOrId; - _assert(container, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, { appName }); - this.container = container; - this.isVisible = this.params.size !== 'invisible'; - if (this.isVisible) { - this.execute(); - } - else { - this.container.addEventListener('click', this.clickHandler); - } - } - getResponse() { - this.checkIfDeleted(); - return this.responseToken; - } - delete() { - this.checkIfDeleted(); - this.deleted = true; - if (this.timerId) { - clearTimeout(this.timerId); - this.timerId = null; - } - this.container.removeEventListener('click', this.clickHandler); - } - execute() { - this.checkIfDeleted(); - if (this.timerId) { - return; - } - this.timerId = window.setTimeout(() => { - this.responseToken = generateRandomAlphaNumericString(50); - const { callback, 'expired-callback': expiredCallback } = this.params; - if (callback) { - try { - callback(this.responseToken); - } - catch (e) { } - } - this.timerId = window.setTimeout(() => { - this.timerId = null; - this.responseToken = null; - if (expiredCallback) { - try { - expiredCallback(); - } - catch (e) { } - } - if (this.isVisible) { - this.execute(); - } - }, _EXPIRATION_TIME_MS); - }, _SOLVE_TIME_MS); - } - checkIfDeleted() { - if (this.deleted) { - throw new Error('reCAPTCHA mock was already deleted!'); - } - } -} -function generateRandomAlphaNumericString(len) { - const chars = []; - const allowedChars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; - for (let i = 0; i < len; i++) { - chars.push(allowedChars.charAt(Math.floor(Math.random() * allowedChars.length))); - } - return chars.join(''); -} - -/* eslint-disable @typescript-eslint/no-require-imports */ -const RECAPTCHA_ENTERPRISE_VERIFIER_TYPE = 'recaptcha-enterprise'; -const FAKE_TOKEN = 'NO_RECAPTCHA'; -class RecaptchaEnterpriseVerifier { - /** - * - * @param authExtern - The corresponding Firebase {@link Auth} instance. - * - */ - constructor(authExtern) { - /** - * Identifies the type of application verifier (e.g. "recaptcha-enterprise"). - */ - this.type = RECAPTCHA_ENTERPRISE_VERIFIER_TYPE; - this.auth = _castAuth(authExtern); - } - /** - * Executes the verification process. - * - * @returns A Promise for a token that can be used to assert the validity of a request. - */ - async verify(action = 'verify', forceRefresh = false) { - async function retrieveSiteKey(auth) { - if (!forceRefresh) { - if (auth.tenantId == null && auth._agentRecaptchaConfig != null) { - return auth._agentRecaptchaConfig.siteKey; - } - if (auth.tenantId != null && - auth._tenantRecaptchaConfigs[auth.tenantId] !== undefined) { - return auth._tenantRecaptchaConfigs[auth.tenantId].siteKey; - } - } - return new Promise(async (resolve, reject) => { - getRecaptchaConfig(auth, { - clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */, - version: "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */ - }) - .then(response => { - if (response.recaptchaKey === undefined) { - reject(new Error('recaptcha Enterprise site key undefined')); - } - else { - const config = new RecaptchaConfig(response); - if (auth.tenantId == null) { - auth._agentRecaptchaConfig = config; - } - else { - auth._tenantRecaptchaConfigs[auth.tenantId] = config; - } - return resolve(config.siteKey); - } - }) - .catch(error => { - reject(error); - }); - }); - } - function retrieveRecaptchaToken(siteKey, resolve, reject) { - const grecaptcha = window.grecaptcha; - if (isEnterprise(grecaptcha)) { - grecaptcha.enterprise.ready(() => { - grecaptcha.enterprise - .execute(siteKey, { action }) - .then(token => { - resolve(token); - }) - .catch(() => { - resolve(FAKE_TOKEN); - }); - }); - } - else { - reject(Error('No reCAPTCHA enterprise script loaded.')); - } - } - // Returns Promise for a mock token when appVerificationDisabledForTesting is true. - if (this.auth.settings.appVerificationDisabledForTesting) { - const mockRecaptcha = new MockGreCAPTCHATopLevel(); - return mockRecaptcha.execute('siteKey', { action: 'verify' }); - } - return new Promise((resolve, reject) => { - retrieveSiteKey(this.auth) - .then(siteKey => { - if (!forceRefresh && isEnterprise(window.grecaptcha)) { - retrieveRecaptchaToken(siteKey, resolve, reject); - } - else { - if (typeof window === 'undefined') { - reject(new Error('RecaptchaVerifier is only supported in browser')); - return; - } - let url = _recaptchaEnterpriseScriptUrl(); - if (url.length !== 0) { - url += siteKey; - } - _loadJS(url) - .then(() => { - retrieveRecaptchaToken(siteKey, resolve, reject); - }) - .catch(error => { - reject(error); - }); - } - }) - .catch(error => { - reject(error); - }); - }); - } -} -async function injectRecaptchaFields(auth, request, action, isCaptchaResp = false, isFakeToken = false) { - const verifier = new RecaptchaEnterpriseVerifier(auth); - let captchaResponse; - if (isFakeToken) { - captchaResponse = FAKE_TOKEN; - } - else { - try { - captchaResponse = await verifier.verify(action); - } - catch (error) { - captchaResponse = await verifier.verify(action, true); - } - } - const newRequest = { ...request }; - if (action === "mfaSmsEnrollment" /* RecaptchaActionName.MFA_SMS_ENROLLMENT */ || - action === "mfaSmsSignIn" /* RecaptchaActionName.MFA_SMS_SIGNIN */) { - if ('phoneEnrollmentInfo' in newRequest) { - const phoneNumber = newRequest.phoneEnrollmentInfo.phoneNumber; - const recaptchaToken = newRequest.phoneEnrollmentInfo.recaptchaToken; - Object.assign(newRequest, { - 'phoneEnrollmentInfo': { - phoneNumber, - recaptchaToken, - captchaResponse, - 'clientType': "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */, - 'recaptchaVersion': "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */ - } - }); - } - else if ('phoneSignInInfo' in newRequest) { - const recaptchaToken = newRequest.phoneSignInInfo.recaptchaToken; - Object.assign(newRequest, { - 'phoneSignInInfo': { - recaptchaToken, - captchaResponse, - 'clientType': "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */, - 'recaptchaVersion': "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */ - } - }); - } - return newRequest; - } - if (!isCaptchaResp) { - Object.assign(newRequest, { captchaResponse }); - } - else { - Object.assign(newRequest, { 'captchaResp': captchaResponse }); - } - Object.assign(newRequest, { 'clientType': "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */ }); - Object.assign(newRequest, { - 'recaptchaVersion': "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */ - }); - return newRequest; -} -async function handleRecaptchaFlow(authInstance, request, actionName, actionMethod, recaptchaAuthProvider) { - if (recaptchaAuthProvider === "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */) { - if (authInstance - ._getRecaptchaConfig() - ?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */)) { - const requestWithRecaptcha = await injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */); - return actionMethod(authInstance, requestWithRecaptcha); - } - else { - return actionMethod(authInstance, request).catch(async (error) => { - if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) { - console.log(`${actionName} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`); - const requestWithRecaptcha = await injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */); - return actionMethod(authInstance, requestWithRecaptcha); - } - else { - return Promise.reject(error); - } - }); - } - } - else if (recaptchaAuthProvider === "PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */) { - if (authInstance - ._getRecaptchaConfig() - ?.isProviderEnabled("PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */)) { - const requestWithRecaptcha = await injectRecaptchaFields(authInstance, request, actionName); - return actionMethod(authInstance, requestWithRecaptcha).catch(async (error) => { - if (authInstance - ._getRecaptchaConfig() - ?.getProviderEnforcementState("PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */) === "AUDIT" /* EnforcementState.AUDIT */) { - // AUDIT mode - if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}` || - error.code === `auth/${"invalid-app-credential" /* AuthErrorCode.INVALID_APP_CREDENTIAL */}`) { - console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${actionName} flow.`); - // reCAPTCHA Enterprise token is missing or reCAPTCHA Enterprise token - // check fails. - // Fallback to reCAPTCHA v2 flow. - const requestWithRecaptchaFields = await injectRecaptchaFields(authInstance, request, actionName, false, // isCaptchaResp - true // isFakeToken - ); - // This will call the PhoneApiCaller to fetch and inject reCAPTCHA v2 token. - return actionMethod(authInstance, requestWithRecaptchaFields); - } - } - // ENFORCE mode or AUDIT mode with any other error. - return Promise.reject(error); - }); - } - else { - // Do reCAPTCHA v2 flow. - const requestWithRecaptchaFields = await injectRecaptchaFields(authInstance, request, actionName, false, // isCaptchaResp - true // isFakeToken - ); - // This will call the PhoneApiCaller to fetch and inject v2 token. - return actionMethod(authInstance, requestWithRecaptchaFields); - } - } - else { - return Promise.reject(recaptchaAuthProvider + ' provider is not supported.'); - } -} -async function _initializeRecaptchaConfig(auth) { - const authInternal = _castAuth(auth); - const response = await getRecaptchaConfig(authInternal, { - clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */, - version: "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */ - }); - const config = new RecaptchaConfig(response); - if (authInternal.tenantId == null) { - authInternal._agentRecaptchaConfig = config; - } - else { - authInternal._tenantRecaptchaConfigs[authInternal.tenantId] = config; - } - if (config.isAnyProviderEnabled()) { - const verifier = new RecaptchaEnterpriseVerifier(authInternal); - void verifier.verify(); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Initializes an {@link Auth} instance with fine-grained control over - * {@link Dependencies}. - * - * @remarks - * - * This function allows more control over the {@link Auth} instance than - * {@link getAuth}. `getAuth` uses platform-specific defaults to supply - * the {@link Dependencies}. In general, `getAuth` is the easiest way to - * initialize Auth and works for most use cases. Use `initializeAuth` if you - * need control over which persistence layer is used, or to minimize bundle - * size if you're not using either `signInWithPopup` or `signInWithRedirect`. - * - * For example, if your app only uses anonymous accounts and you only want - * accounts saved for the current session, initialize `Auth` with: - * - * ```js - * const auth = initializeAuth(app, { - * persistence: browserSessionPersistence, - * popupRedirectResolver: undefined, - * }); - * ``` - * - * @public - */ -function initializeAuth(app, deps) { - const provider = _getProvider(app, 'auth'); - if (provider.isInitialized()) { - const auth = provider.getImmediate(); - const initialOptions = provider.getOptions(); - if (deepEqual(initialOptions, deps ?? {})) { - return auth; - } - else { - _fail(auth, "already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */); - } - } - const auth = provider.initialize({ options: deps }); - return auth; -} -function _initializeAuthInstance(auth, deps) { - const persistence = deps?.persistence || []; - const hierarchy = (Array.isArray(persistence) ? persistence : [persistence]).map(_getInstance); - if (deps?.errorMap) { - auth._updateErrorMap(deps.errorMap); - } - // This promise is intended to float; auth initialization happens in the - // background, meanwhile the auth object may be used by the app. - // eslint-disable-next-line @typescript-eslint/no-floating-promises - auth._initializeWithPersistence(hierarchy, deps?.popupRedirectResolver); -} - -/** - * Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production - * Firebase Auth services. - * - * @remarks - * This must be called synchronously immediately following the first call to - * {@link initializeAuth}. Do not use with production credentials as emulator - * traffic is not encrypted. - * - * - * @example - * ```javascript - * connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true }); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param url - The URL at which the emulator is running (eg, 'http://localhost:9099'). - * @param options - Optional. `options.disableWarnings` defaults to `false`. Set it to - * `true` to disable the warning banner attached to the DOM. - * - * @public - */ -function connectAuthEmulator(auth, url, options) { - const authInternal = _castAuth(auth); - _assert(/^https?:\/\//.test(url), authInternal, "invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */); - const disableWarnings = !!options?.disableWarnings; - const protocol = extractProtocol(url); - const { host, port } = extractHostAndPort(url); - const portStr = port === null ? '' : `:${port}`; - // Always replace path with "/" (even if input url had no path at all, or had a different one). - const emulator = { url: `${protocol}//${host}${portStr}/` }; - const emulatorConfig = Object.freeze({ - host, - port, - protocol: protocol.replace(':', ''), - options: Object.freeze({ disableWarnings }) - }); - // There are a few scenarios to guard against if the Auth instance has already started: - if (!authInternal._canInitEmulator) { - // Applications may not initialize the emulator for the first time if Auth has already started - // to make network requests. - _assert(authInternal.config.emulator && authInternal.emulatorConfig, authInternal, "emulator-config-failed" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */); - // Applications may not alter the configuration of the emulator (aka pass a different config) - // once Auth has started to make network requests. - _assert(deepEqual(emulator, authInternal.config.emulator) && - deepEqual(emulatorConfig, authInternal.emulatorConfig), authInternal, "emulator-config-failed" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */); - // It's valid, however, to invoke connectAuthEmulator() after Auth has started making - // connections, so long as the config matches the existing config. This results in a no-op. - return; - } - authInternal.config.emulator = emulator; - authInternal.emulatorConfig = emulatorConfig; - authInternal.settings.appVerificationDisabledForTesting = true; - // Workaround to get cookies in Firebase Studio - if (isCloudWorkstation(host)) { - void pingServer(`${protocol}//${host}${portStr}`); - updateEmulatorBanner('Auth', true); - } - else if (!disableWarnings) { - emitEmulatorWarning(); - } -} -function extractProtocol(url) { - const protocolEnd = url.indexOf(':'); - return protocolEnd < 0 ? '' : url.substr(0, protocolEnd + 1); -} -function extractHostAndPort(url) { - const protocol = extractProtocol(url); - const authority = /(\/\/)?([^?#/]+)/.exec(url.substr(protocol.length)); // Between // and /, ? or #. - if (!authority) { - return { host: '', port: null }; - } - const hostAndPort = authority[2].split('@').pop() || ''; // Strip out "username:password@". - const bracketedIPv6 = /^(\[[^\]]+\])(:|$)/.exec(hostAndPort); - if (bracketedIPv6) { - const host = bracketedIPv6[1]; - return { host, port: parsePort(hostAndPort.substr(host.length + 1)) }; - } - else { - const [host, port] = hostAndPort.split(':'); - return { host, port: parsePort(port) }; - } -} -function parsePort(portStr) { - if (!portStr) { - return null; - } - const port = Number(portStr); - if (isNaN(port)) { - return null; - } - return port; -} -function emitEmulatorWarning() { - function attachBanner() { - const el = document.createElement('p'); - const sty = el.style; - el.innerText = - 'Running in emulator mode. Do not use with production credentials.'; - sty.position = 'fixed'; - sty.width = '100%'; - sty.backgroundColor = '#ffffff'; - sty.border = '.1em solid #000000'; - sty.color = '#b50000'; - sty.bottom = '0px'; - sty.left = '0px'; - sty.margin = '0px'; - sty.zIndex = '10000'; - sty.textAlign = 'center'; - el.classList.add('firebase-emulator-warning'); - document.body.appendChild(el); - } - if (typeof console !== 'undefined' && typeof console.info === 'function') { - console.info('WARNING: You are using the Auth Emulator,' + - ' which is intended for local testing only. Do not use with' + - ' production credentials.'); - } - if (typeof window !== 'undefined' && typeof document !== 'undefined') { - if (document.readyState === 'loading') { - window.addEventListener('DOMContentLoaded', attachBanner); - } - else { - attachBanner(); - } - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Interface that represents the credentials returned by an {@link AuthProvider}. - * - * @remarks - * Implementations specify the details about each auth provider's credential requirements. - * - * @public - */ -class AuthCredential { - /** @internal */ - constructor( - /** - * The authentication provider ID for the credential. - * - * @remarks - * For example, 'facebook.com', or 'google.com'. - */ - providerId, - /** - * The authentication sign in method for the credential. - * - * @remarks - * For example, {@link SignInMethod}.EMAIL_PASSWORD, or - * {@link SignInMethod}.EMAIL_LINK. This corresponds to the sign-in method - * identifier as returned in {@link fetchSignInMethodsForEmail}. - */ - signInMethod) { - this.providerId = providerId; - this.signInMethod = signInMethod; - } - /** - * Returns a JSON-serializable representation of this object. - * - * @returns a JSON-serializable representation of this object. - */ - toJSON() { - return debugFail('not implemented'); - } - /** @internal */ - _getIdTokenResponse(_auth) { - return debugFail('not implemented'); - } - /** @internal */ - _linkToIdToken(_auth, _idToken) { - return debugFail('not implemented'); - } - /** @internal */ - _getReauthenticationResolver(_auth) { - return debugFail('not implemented'); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function resetPassword(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:resetPassword" /* Endpoint.RESET_PASSWORD */, _addTidIfNecessary(auth, request)); -} -async function updateEmailPassword(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request); -} -// Used for linking an email/password account to an existing idToken. Uses the same request/response -// format as updateEmailPassword. -async function linkEmailPassword(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signUp" /* Endpoint.SIGN_UP */, request); -} -async function applyActionCode$1(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request)); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function signInWithPassword(auth, request) { - return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPassword" /* Endpoint.SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request)); -} -async function sendOobCode(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:sendOobCode" /* Endpoint.SEND_OOB_CODE */, _addTidIfNecessary(auth, request)); -} -async function sendEmailVerification$1(auth, request) { - return sendOobCode(auth, request); -} -async function sendPasswordResetEmail$1(auth, request) { - return sendOobCode(auth, request); -} -async function sendSignInLinkToEmail$1(auth, request) { - return sendOobCode(auth, request); -} -async function verifyAndChangeEmail(auth, request) { - return sendOobCode(auth, request); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function signInWithEmailLink$1(auth, request) { - return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request)); -} -async function signInWithEmailLinkForLinking(auth, request) { - return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request)); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Interface that represents the credentials returned by {@link EmailAuthProvider} for - * {@link ProviderId}.PASSWORD - * - * @remarks - * Covers both {@link SignInMethod}.EMAIL_PASSWORD and - * {@link SignInMethod}.EMAIL_LINK. - * - * @public - */ -class EmailAuthCredential extends AuthCredential { - /** @internal */ - constructor( - /** @internal */ - _email, - /** @internal */ - _password, signInMethod, - /** @internal */ - _tenantId = null) { - super("password" /* ProviderId.PASSWORD */, signInMethod); - this._email = _email; - this._password = _password; - this._tenantId = _tenantId; - } - /** @internal */ - static _fromEmailAndPassword(email, password) { - return new EmailAuthCredential(email, password, "password" /* SignInMethod.EMAIL_PASSWORD */); - } - /** @internal */ - static _fromEmailAndCode(email, oobCode, tenantId = null) { - return new EmailAuthCredential(email, oobCode, "emailLink" /* SignInMethod.EMAIL_LINK */, tenantId); - } - /** {@inheritdoc AuthCredential.toJSON} */ - toJSON() { - return { - email: this._email, - password: this._password, - signInMethod: this.signInMethod, - tenantId: this._tenantId - }; - } - /** - * Static method to deserialize a JSON representation of an object into an {@link AuthCredential}. - * - * @param json - Either `object` or the stringified representation of the object. When string is - * provided, `JSON.parse` would be called first. - * - * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned. - */ - static fromJSON(json) { - const obj = typeof json === 'string' ? JSON.parse(json) : json; - if (obj?.email && obj?.password) { - if (obj.signInMethod === "password" /* SignInMethod.EMAIL_PASSWORD */) { - return this._fromEmailAndPassword(obj.email, obj.password); - } - else if (obj.signInMethod === "emailLink" /* SignInMethod.EMAIL_LINK */) { - return this._fromEmailAndCode(obj.email, obj.password, obj.tenantId); - } - } - return null; - } - /** @internal */ - async _getIdTokenResponse(auth) { - switch (this.signInMethod) { - case "password" /* SignInMethod.EMAIL_PASSWORD */: - const request = { - returnSecureToken: true, - email: this._email, - password: this._password, - clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */ - }; - return handleRecaptchaFlow(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */, signInWithPassword, "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */); - case "emailLink" /* SignInMethod.EMAIL_LINK */: - return signInWithEmailLink$1(auth, { - email: this._email, - oobCode: this._password - }); - default: - _fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - } - } - /** @internal */ - async _linkToIdToken(auth, idToken) { - switch (this.signInMethod) { - case "password" /* SignInMethod.EMAIL_PASSWORD */: - const request = { - idToken, - returnSecureToken: true, - email: this._email, - password: this._password, - clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */ - }; - return handleRecaptchaFlow(auth, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, linkEmailPassword, "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */); - case "emailLink" /* SignInMethod.EMAIL_LINK */: - return signInWithEmailLinkForLinking(auth, { - idToken, - email: this._email, - oobCode: this._password - }); - default: - _fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - } - } - /** @internal */ - _getReauthenticationResolver(auth) { - return this._getIdTokenResponse(auth); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function signInWithIdp(auth, request) { - return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithIdp" /* Endpoint.SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request)); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const IDP_REQUEST_URI$1 = 'http://localhost'; -/** - * Represents the OAuth credentials returned by an {@link OAuthProvider}. - * - * @remarks - * Implementations specify the details about each auth provider's credential requirements. - * - * @public - */ -class OAuthCredential extends AuthCredential { - constructor() { - super(...arguments); - this.pendingToken = null; - } - /** @internal */ - static _fromParams(params) { - const cred = new OAuthCredential(params.providerId, params.signInMethod); - if (params.idToken || params.accessToken) { - // OAuth 2 and either ID token or access token. - if (params.idToken) { - cred.idToken = params.idToken; - } - if (params.accessToken) { - cred.accessToken = params.accessToken; - } - // Add nonce if available and no pendingToken is present. - if (params.nonce && !params.pendingToken) { - cred.nonce = params.nonce; - } - if (params.pendingToken) { - cred.pendingToken = params.pendingToken; - } - } - else if (params.oauthToken && params.oauthTokenSecret) { - // OAuth 1 and OAuth token with token secret - cred.accessToken = params.oauthToken; - cred.secret = params.oauthTokenSecret; - } - else { - _fail("argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - } - return cred; - } - /** {@inheritdoc AuthCredential.toJSON} */ - toJSON() { - return { - idToken: this.idToken, - accessToken: this.accessToken, - secret: this.secret, - nonce: this.nonce, - pendingToken: this.pendingToken, - providerId: this.providerId, - signInMethod: this.signInMethod - }; - } - /** - * Static method to deserialize a JSON representation of an object into an - * {@link AuthCredential}. - * - * @param json - Input can be either Object or the stringified representation of the object. - * When string is provided, JSON.parse would be called first. - * - * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned. - */ - static fromJSON(json) { - const obj = typeof json === 'string' ? JSON.parse(json) : json; - const { providerId, signInMethod, ...rest } = obj; - if (!providerId || !signInMethod) { - return null; - } - const cred = new OAuthCredential(providerId, signInMethod); - cred.idToken = rest.idToken || undefined; - cred.accessToken = rest.accessToken || undefined; - cred.secret = rest.secret; - cred.nonce = rest.nonce; - cred.pendingToken = rest.pendingToken || null; - return cred; - } - /** @internal */ - _getIdTokenResponse(auth) { - const request = this.buildRequest(); - return signInWithIdp(auth, request); - } - /** @internal */ - _linkToIdToken(auth, idToken) { - const request = this.buildRequest(); - request.idToken = idToken; - return signInWithIdp(auth, request); - } - /** @internal */ - _getReauthenticationResolver(auth) { - const request = this.buildRequest(); - request.autoCreate = false; - return signInWithIdp(auth, request); - } - buildRequest() { - const request = { - requestUri: IDP_REQUEST_URI$1, - returnSecureToken: true - }; - if (this.pendingToken) { - request.pendingToken = this.pendingToken; - } - else { - const postBody = {}; - if (this.idToken) { - postBody['id_token'] = this.idToken; - } - if (this.accessToken) { - postBody['access_token'] = this.accessToken; - } - if (this.secret) { - postBody['oauth_token_secret'] = this.secret; - } - postBody['providerId'] = this.providerId; - if (this.nonce && !this.pendingToken) { - postBody['nonce'] = this.nonce; - } - request.postBody = querystring(postBody); - } - return request; - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function sendPhoneVerificationCode(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:sendVerificationCode" /* Endpoint.SEND_VERIFICATION_CODE */, _addTidIfNecessary(auth, request)); -} -async function signInWithPhoneNumber(auth, request) { - return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request)); -} -async function linkWithPhoneNumber(auth, request) { - const response = await _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request)); - if (response.temporaryProof) { - throw _makeTaggedError(auth, "account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */, response); - } - return response; -} -const VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_ = { - ["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */]: "user-not-found" /* AuthErrorCode.USER_DELETED */ -}; -async function verifyPhoneNumberForExisting(auth, request) { - const apiRequest = { - ...request, - operation: 'REAUTH' - }; - return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, apiRequest), VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Represents the credentials returned by {@link PhoneAuthProvider}. - * - * @public - */ -class PhoneAuthCredential extends AuthCredential { - constructor(params) { - super("phone" /* ProviderId.PHONE */, "phone" /* SignInMethod.PHONE */); - this.params = params; - } - /** @internal */ - static _fromVerification(verificationId, verificationCode) { - return new PhoneAuthCredential({ verificationId, verificationCode }); - } - /** @internal */ - static _fromTokenResponse(phoneNumber, temporaryProof) { - return new PhoneAuthCredential({ phoneNumber, temporaryProof }); - } - /** @internal */ - _getIdTokenResponse(auth) { - return signInWithPhoneNumber(auth, this._makeVerificationRequest()); - } - /** @internal */ - _linkToIdToken(auth, idToken) { - return linkWithPhoneNumber(auth, { - idToken, - ...this._makeVerificationRequest() - }); - } - /** @internal */ - _getReauthenticationResolver(auth) { - return verifyPhoneNumberForExisting(auth, this._makeVerificationRequest()); - } - /** @internal */ - _makeVerificationRequest() { - const { temporaryProof, phoneNumber, verificationId, verificationCode } = this.params; - if (temporaryProof && phoneNumber) { - return { temporaryProof, phoneNumber }; - } - return { - sessionInfo: verificationId, - code: verificationCode - }; - } - /** {@inheritdoc AuthCredential.toJSON} */ - toJSON() { - const obj = { - providerId: this.providerId - }; - if (this.params.phoneNumber) { - obj.phoneNumber = this.params.phoneNumber; - } - if (this.params.temporaryProof) { - obj.temporaryProof = this.params.temporaryProof; - } - if (this.params.verificationCode) { - obj.verificationCode = this.params.verificationCode; - } - if (this.params.verificationId) { - obj.verificationId = this.params.verificationId; - } - return obj; - } - /** Generates a phone credential based on a plain object or a JSON string. */ - static fromJSON(json) { - if (typeof json === 'string') { - json = JSON.parse(json); - } - const { verificationId, verificationCode, phoneNumber, temporaryProof } = json; - if (!verificationCode && - !verificationId && - !phoneNumber && - !temporaryProof) { - return null; - } - return new PhoneAuthCredential({ - verificationId, - verificationCode, - phoneNumber, - temporaryProof - }); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Maps the mode string in action code URL to Action Code Info operation. - * - * @param mode - */ -function parseMode(mode) { - switch (mode) { - case 'recoverEmail': - return "RECOVER_EMAIL" /* ActionCodeOperation.RECOVER_EMAIL */; - case 'resetPassword': - return "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */; - case 'signIn': - return "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */; - case 'verifyEmail': - return "VERIFY_EMAIL" /* ActionCodeOperation.VERIFY_EMAIL */; - case 'verifyAndChangeEmail': - return "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */; - case 'revertSecondFactorAddition': - return "REVERT_SECOND_FACTOR_ADDITION" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */; - default: - return null; - } -} -/** - * Helper to parse FDL links - * - * @param url - */ -function parseDeepLink(url) { - const link = querystringDecode(extractQuerystring(url))['link']; - // Double link case (automatic redirect). - const doubleDeepLink = link - ? querystringDecode(extractQuerystring(link))['deep_link_id'] - : null; - // iOS custom scheme links. - const iOSDeepLink = querystringDecode(extractQuerystring(url))['deep_link_id']; - const iOSDoubleDeepLink = iOSDeepLink - ? querystringDecode(extractQuerystring(iOSDeepLink))['link'] - : null; - return iOSDoubleDeepLink || iOSDeepLink || doubleDeepLink || link || url; -} -/** - * A utility class to parse email action URLs such as password reset, email verification, - * email link sign in, etc. - * - * @public - */ -class ActionCodeURL { - /** - * @param actionLink - The link from which to extract the URL. - * @returns The {@link ActionCodeURL} object, or null if the link is invalid. - * - * @internal - */ - constructor(actionLink) { - const searchParams = querystringDecode(extractQuerystring(actionLink)); - const apiKey = searchParams["apiKey" /* QueryField.API_KEY */] ?? null; - const code = searchParams["oobCode" /* QueryField.CODE */] ?? null; - const operation = parseMode(searchParams["mode" /* QueryField.MODE */] ?? null); - // Validate API key, code and mode. - _assert(apiKey && code && operation, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - this.apiKey = apiKey; - this.operation = operation; - this.code = code; - this.continueUrl = searchParams["continueUrl" /* QueryField.CONTINUE_URL */] ?? null; - this.languageCode = searchParams["lang" /* QueryField.LANGUAGE_CODE */] ?? null; - this.tenantId = searchParams["tenantId" /* QueryField.TENANT_ID */] ?? null; - } - /** - * Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid, - * otherwise returns null. - * - * @param link - The email action link string. - * @returns The {@link ActionCodeURL} object, or null if the link is invalid. - * - * @public - */ - static parseLink(link) { - const actionLink = parseDeepLink(link); - try { - return new ActionCodeURL(actionLink); - } - catch { - return null; - } - } -} -/** - * Parses the email action link string and returns an {@link ActionCodeURL} if - * the link is valid, otherwise returns null. - * - * @public - */ -function parseActionCodeURL(link) { - return ActionCodeURL.parseLink(link); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Provider for generating {@link EmailAuthCredential}. - * - * @public - */ -class EmailAuthProvider { - constructor() { - /** - * Always set to {@link ProviderId}.PASSWORD, even for email link. - */ - this.providerId = EmailAuthProvider.PROVIDER_ID; - } - /** - * Initialize an {@link AuthCredential} using an email and password. - * - * @example - * ```javascript - * const authCredential = EmailAuthProvider.credential(email, password); - * const userCredential = await signInWithCredential(auth, authCredential); - * ``` - * - * @example - * ```javascript - * const userCredential = await signInWithEmailAndPassword(auth, email, password); - * ``` - * - * @param email - Email address. - * @param password - User account password. - * @returns The auth provider credential. - */ - static credential(email, password) { - return EmailAuthCredential._fromEmailAndPassword(email, password); - } - /** - * Initialize an {@link AuthCredential} using an email and an email link after a sign in with - * email link operation. - * - * @example - * ```javascript - * const authCredential = EmailAuthProvider.credentialWithLink(auth, email, emailLink); - * const userCredential = await signInWithCredential(auth, authCredential); - * ``` - * - * @example - * ```javascript - * await sendSignInLinkToEmail(auth, email); - * // Obtain emailLink from user. - * const userCredential = await signInWithEmailLink(auth, email, emailLink); - * ``` - * - * @param auth - The {@link Auth} instance used to verify the link. - * @param email - Email address. - * @param emailLink - Sign-in email link. - * @returns - The auth provider credential. - */ - static credentialWithLink(email, emailLink) { - const actionCodeUrl = ActionCodeURL.parseLink(emailLink); - _assert(actionCodeUrl, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - return EmailAuthCredential._fromEmailAndCode(email, actionCodeUrl.code, actionCodeUrl.tenantId); - } -} -/** - * Always set to {@link ProviderId}.PASSWORD, even for email link. - */ -EmailAuthProvider.PROVIDER_ID = "password" /* ProviderId.PASSWORD */; -/** - * Always set to {@link SignInMethod}.EMAIL_PASSWORD. - */ -EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = "password" /* SignInMethod.EMAIL_PASSWORD */; -/** - * Always set to {@link SignInMethod}.EMAIL_LINK. - */ -EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = "emailLink" /* SignInMethod.EMAIL_LINK */; - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * The base class for all Federated providers (OAuth (including OIDC), SAML). - * - * This class is not meant to be instantiated directly. - * - * @public - */ -class FederatedAuthProvider { - /** - * Constructor for generic OAuth providers. - * - * @param providerId - Provider for which credentials should be generated. - */ - constructor(providerId) { - this.providerId = providerId; - /** @internal */ - this.defaultLanguageCode = null; - /** @internal */ - this.customParameters = {}; - } - /** - * Set the language gode. - * - * @param languageCode - language code - */ - setDefaultLanguage(languageCode) { - this.defaultLanguageCode = languageCode; - } - /** - * Sets the OAuth custom parameters to pass in an OAuth request for popup and redirect sign-in - * operations. - * - * @remarks - * For a detailed list, check the reserved required OAuth 2.0 parameters such as `client_id`, - * `redirect_uri`, `scope`, `response_type`, and `state` are not allowed and will be ignored. - * - * @param customOAuthParameters - The custom OAuth parameters to pass in the OAuth request. - */ - setCustomParameters(customOAuthParameters) { - this.customParameters = customOAuthParameters; - return this; - } - /** - * Retrieve the current list of {@link CustomParameters}. - */ - getCustomParameters() { - return this.customParameters; - } -} - -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Common code to all OAuth providers. This is separate from the - * {@link OAuthProvider} so that child providers (like - * {@link GoogleAuthProvider}) don't inherit the `credential` instance method. - * Instead, they rely on a static `credential` method. - */ -class BaseOAuthProvider extends FederatedAuthProvider { - constructor() { - super(...arguments); - /** @internal */ - this.scopes = []; - } - /** - * Add an OAuth scope to the credential. - * - * @param scope - Provider OAuth scope to add. - */ - addScope(scope) { - // If not already added, add scope to list. - if (!this.scopes.includes(scope)) { - this.scopes.push(scope); - } - return this; - } - /** - * Retrieve the current list of OAuth scopes. - */ - getScopes() { - return [...this.scopes]; - } -} -/** - * Provider for generating generic {@link OAuthCredential}. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new OAuthProvider('google.com'); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('profile'); - * provider.addScope('email'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a OAuth Access Token for the provider. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new OAuthProvider('google.com'); - * provider.addScope('profile'); - * provider.addScope('email'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a OAuth Access Token for the provider. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * ``` - * @public - */ -class OAuthProvider extends BaseOAuthProvider { - /** - * Creates an {@link OAuthCredential} from a JSON string or a plain object. - * @param json - A plain object or a JSON string - */ - static credentialFromJSON(json) { - const obj = typeof json === 'string' ? JSON.parse(json) : json; - _assert('providerId' in obj && 'signInMethod' in obj, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - return OAuthCredential._fromParams(obj); - } - /** - * Creates a {@link OAuthCredential} from a generic OAuth provider's access token or ID token. - * - * @remarks - * The raw nonce is required when an ID token with a nonce field is provided. The SHA-256 hash of - * the raw nonce must match the nonce field in the ID token. - * - * @example - * ```javascript - * // `googleUser` from the onsuccess Google Sign In callback. - * // Initialize a generate OAuth provider with a `google.com` providerId. - * const provider = new OAuthProvider('google.com'); - * const credential = provider.credential({ - * idToken: googleUser.getAuthResponse().id_token, - * }); - * const result = await signInWithCredential(credential); - * ``` - * - * @param params - Either the options object containing the ID token, access token and raw nonce - * or the ID token string. - */ - credential(params) { - return this._credential({ ...params, nonce: params.rawNonce }); - } - /** An internal credential method that accepts more permissive options */ - _credential(params) { - _assert(params.idToken || params.accessToken, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - // For OAuthCredential, sign in method is same as providerId. - return OAuthCredential._fromParams({ - ...params, - providerId: this.providerId, - signInMethod: this.providerId - }); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential) { - return OAuthProvider.oauthCredentialFromTaggedObject(userCredential); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error) { - return OAuthProvider.oauthCredentialFromTaggedObject((error.customData || {})); - } - static oauthCredentialFromTaggedObject({ _tokenResponse: tokenResponse }) { - if (!tokenResponse) { - return null; - } - const { oauthIdToken, oauthAccessToken, oauthTokenSecret, pendingToken, nonce, providerId } = tokenResponse; - if (!oauthAccessToken && - !oauthTokenSecret && - !oauthIdToken && - !pendingToken) { - return null; - } - if (!providerId) { - return null; - } - try { - return new OAuthProvider(providerId)._credential({ - idToken: oauthIdToken, - accessToken: oauthAccessToken, - nonce, - pendingToken - }); - } - catch (e) { - return null; - } - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.FACEBOOK. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new FacebookAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('user_birthday'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = FacebookAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new FacebookAuthProvider(); - * provider.addScope('user_birthday'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = FacebookAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * ``` - * - * @public - */ -class FacebookAuthProvider extends BaseOAuthProvider { - constructor() { - super("facebook.com" /* ProviderId.FACEBOOK */); - } - /** - * Creates a credential for Facebook. - * - * @example - * ```javascript - * // `event` from the Facebook auth.authResponseChange callback. - * const credential = FacebookAuthProvider.credential(event.authResponse.accessToken); - * const result = await signInWithCredential(credential); - * ``` - * - * @param accessToken - Facebook access token. - */ - static credential(accessToken) { - return OAuthCredential._fromParams({ - providerId: FacebookAuthProvider.PROVIDER_ID, - signInMethod: FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD, - accessToken - }); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential) { - return FacebookAuthProvider.credentialFromTaggedObject(userCredential); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error) { - return FacebookAuthProvider.credentialFromTaggedObject((error.customData || {})); - } - static credentialFromTaggedObject({ _tokenResponse: tokenResponse }) { - if (!tokenResponse || !('oauthAccessToken' in tokenResponse)) { - return null; - } - if (!tokenResponse.oauthAccessToken) { - return null; - } - try { - return FacebookAuthProvider.credential(tokenResponse.oauthAccessToken); - } - catch { - return null; - } - } -} -/** Always set to {@link SignInMethod}.FACEBOOK. */ -FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = "facebook.com" /* SignInMethod.FACEBOOK */; -/** Always set to {@link ProviderId}.FACEBOOK. */ -FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* ProviderId.FACEBOOK */; - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GOOGLE. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new GoogleAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('profile'); - * provider.addScope('email'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Google Access Token. - * const credential = GoogleAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new GoogleAuthProvider(); - * provider.addScope('profile'); - * provider.addScope('email'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Google Access Token. - * const credential = GoogleAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * ``` - * - * @public - */ -class GoogleAuthProvider extends BaseOAuthProvider { - constructor() { - super("google.com" /* ProviderId.GOOGLE */); - this.addScope('profile'); - } - /** - * Creates a credential for Google. At least one of ID token and access token is required. - * - * @example - * ```javascript - * // \`googleUser\` from the onsuccess Google Sign In callback. - * const credential = GoogleAuthProvider.credential(googleUser.getAuthResponse().id_token); - * const result = await signInWithCredential(credential); - * ``` - * - * @param idToken - Google ID token. - * @param accessToken - Google access token. - */ - static credential(idToken, accessToken) { - return OAuthCredential._fromParams({ - providerId: GoogleAuthProvider.PROVIDER_ID, - signInMethod: GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD, - idToken, - accessToken - }); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential) { - return GoogleAuthProvider.credentialFromTaggedObject(userCredential); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error) { - return GoogleAuthProvider.credentialFromTaggedObject((error.customData || {})); - } - static credentialFromTaggedObject({ _tokenResponse: tokenResponse }) { - if (!tokenResponse) { - return null; - } - const { oauthIdToken, oauthAccessToken } = tokenResponse; - if (!oauthIdToken && !oauthAccessToken) { - // This could be an oauth 1 credential or a phone credential - return null; - } - try { - return GoogleAuthProvider.credential(oauthIdToken, oauthAccessToken); - } - catch { - return null; - } - } -} -/** Always set to {@link SignInMethod}.GOOGLE. */ -GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = "google.com" /* SignInMethod.GOOGLE */; -/** Always set to {@link ProviderId}.GOOGLE. */ -GoogleAuthProvider.PROVIDER_ID = "google.com" /* ProviderId.GOOGLE */; - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GITHUB. - * - * @remarks - * GitHub requires an OAuth 2.0 redirect, so you can either handle the redirect directly, or use - * the {@link signInWithPopup} handler: - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new GithubAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('repo'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a GitHub Access Token. - * const credential = GithubAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new GithubAuthProvider(); - * provider.addScope('repo'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a GitHub Access Token. - * const credential = GithubAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * ``` - * @public - */ -class GithubAuthProvider extends BaseOAuthProvider { - constructor() { - super("github.com" /* ProviderId.GITHUB */); - } - /** - * Creates a credential for GitHub. - * - * @param accessToken - GitHub access token. - */ - static credential(accessToken) { - return OAuthCredential._fromParams({ - providerId: GithubAuthProvider.PROVIDER_ID, - signInMethod: GithubAuthProvider.GITHUB_SIGN_IN_METHOD, - accessToken - }); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential) { - return GithubAuthProvider.credentialFromTaggedObject(userCredential); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error) { - return GithubAuthProvider.credentialFromTaggedObject((error.customData || {})); - } - static credentialFromTaggedObject({ _tokenResponse: tokenResponse }) { - if (!tokenResponse || !('oauthAccessToken' in tokenResponse)) { - return null; - } - if (!tokenResponse.oauthAccessToken) { - return null; - } - try { - return GithubAuthProvider.credential(tokenResponse.oauthAccessToken); - } - catch { - return null; - } - } -} -/** Always set to {@link SignInMethod}.GITHUB. */ -GithubAuthProvider.GITHUB_SIGN_IN_METHOD = "github.com" /* SignInMethod.GITHUB */; -/** Always set to {@link ProviderId}.GITHUB. */ -GithubAuthProvider.PROVIDER_ID = "github.com" /* ProviderId.GITHUB */; - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const IDP_REQUEST_URI = 'http://localhost'; -/** - * @public - */ -class SAMLAuthCredential extends AuthCredential { - /** @internal */ - constructor(providerId, pendingToken) { - super(providerId, providerId); - this.pendingToken = pendingToken; - } - /** @internal */ - _getIdTokenResponse(auth) { - const request = this.buildRequest(); - return signInWithIdp(auth, request); - } - /** @internal */ - _linkToIdToken(auth, idToken) { - const request = this.buildRequest(); - request.idToken = idToken; - return signInWithIdp(auth, request); - } - /** @internal */ - _getReauthenticationResolver(auth) { - const request = this.buildRequest(); - request.autoCreate = false; - return signInWithIdp(auth, request); - } - /** {@inheritdoc AuthCredential.toJSON} */ - toJSON() { - return { - signInMethod: this.signInMethod, - providerId: this.providerId, - pendingToken: this.pendingToken - }; - } - /** - * Static method to deserialize a JSON representation of an object into an - * {@link AuthCredential}. - * - * @param json - Input can be either Object or the stringified representation of the object. - * When string is provided, JSON.parse would be called first. - * - * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned. - */ - static fromJSON(json) { - const obj = typeof json === 'string' ? JSON.parse(json) : json; - const { providerId, signInMethod, pendingToken } = obj; - if (!providerId || - !signInMethod || - !pendingToken || - providerId !== signInMethod) { - return null; - } - return new SAMLAuthCredential(providerId, pendingToken); - } - /** - * Helper static method to avoid exposing the constructor to end users. - * - * @internal - */ - static _create(providerId, pendingToken) { - return new SAMLAuthCredential(providerId, pendingToken); - } - buildRequest() { - return { - requestUri: IDP_REQUEST_URI, - returnSecureToken: true, - pendingToken: this.pendingToken - }; - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const SAML_PROVIDER_PREFIX = 'saml.'; -/** - * An {@link AuthProvider} for SAML. - * - * @public - */ -class SAMLAuthProvider extends FederatedAuthProvider { - /** - * Constructor. The providerId must start with "saml." - * @param providerId - SAML provider ID. - */ - constructor(providerId) { - _assert(providerId.startsWith(SAML_PROVIDER_PREFIX), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - super(providerId); - } - /** - * Generates an {@link AuthCredential} from a {@link UserCredential} after a - * successful SAML flow completes. - * - * @remarks - * - * For example, to get an {@link AuthCredential}, you could write the - * following code: - * - * ```js - * const userCredential = await signInWithPopup(auth, samlProvider); - * const credential = SAMLAuthProvider.credentialFromResult(userCredential); - * ``` - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential) { - return SAMLAuthProvider.samlCredentialFromTaggedObject(userCredential); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error) { - return SAMLAuthProvider.samlCredentialFromTaggedObject((error.customData || {})); - } - /** - * Creates an {@link AuthCredential} from a JSON string or a plain object. - * @param json - A plain object or a JSON string - */ - static credentialFromJSON(json) { - const credential = SAMLAuthCredential.fromJSON(json); - _assert(credential, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - return credential; - } - static samlCredentialFromTaggedObject({ _tokenResponse: tokenResponse }) { - if (!tokenResponse) { - return null; - } - const { pendingToken, providerId } = tokenResponse; - if (!pendingToken || !providerId) { - return null; - } - try { - return SAMLAuthCredential._create(providerId, pendingToken); - } - catch (e) { - return null; - } - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.TWITTER. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new TwitterAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Twitter Access Token and Secret. - * const credential = TwitterAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * const secret = credential.secret; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new TwitterAuthProvider(); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Twitter Access Token and Secret. - * const credential = TwitterAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * const secret = credential.secret; - * ``` - * - * @public - */ -class TwitterAuthProvider extends BaseOAuthProvider { - constructor() { - super("twitter.com" /* ProviderId.TWITTER */); - } - /** - * Creates a credential for Twitter. - * - * @param token - Twitter access token. - * @param secret - Twitter secret. - */ - static credential(token, secret) { - return OAuthCredential._fromParams({ - providerId: TwitterAuthProvider.PROVIDER_ID, - signInMethod: TwitterAuthProvider.TWITTER_SIGN_IN_METHOD, - oauthToken: token, - oauthTokenSecret: secret - }); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential) { - return TwitterAuthProvider.credentialFromTaggedObject(userCredential); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error) { - return TwitterAuthProvider.credentialFromTaggedObject((error.customData || {})); - } - static credentialFromTaggedObject({ _tokenResponse: tokenResponse }) { - if (!tokenResponse) { - return null; - } - const { oauthAccessToken, oauthTokenSecret } = tokenResponse; - if (!oauthAccessToken || !oauthTokenSecret) { - return null; - } - try { - return TwitterAuthProvider.credential(oauthAccessToken, oauthTokenSecret); - } - catch { - return null; - } - } -} -/** Always set to {@link SignInMethod}.TWITTER. */ -TwitterAuthProvider.TWITTER_SIGN_IN_METHOD = "twitter.com" /* SignInMethod.TWITTER */; -/** Always set to {@link ProviderId}.TWITTER. */ -TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* ProviderId.TWITTER */; - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function signUp(auth, request) { - return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signUp" /* Endpoint.SIGN_UP */, _addTidIfNecessary(auth, request)); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -class UserCredentialImpl { - constructor(params) { - this.user = params.user; - this.providerId = params.providerId; - this._tokenResponse = params._tokenResponse; - this.operationType = params.operationType; - } - static async _fromIdTokenResponse(auth, operationType, idTokenResponse, isAnonymous = false) { - const user = await UserImpl._fromIdTokenResponse(auth, idTokenResponse, isAnonymous); - const providerId = providerIdForResponse(idTokenResponse); - const userCred = new UserCredentialImpl({ - user, - providerId, - _tokenResponse: idTokenResponse, - operationType - }); - return userCred; - } - static async _forOperation(user, operationType, response) { - await user._updateTokensIfNecessary(response, /* reload */ true); - const providerId = providerIdForResponse(response); - return new UserCredentialImpl({ - user, - providerId, - _tokenResponse: response, - operationType - }); - } -} -function providerIdForResponse(response) { - if (response.providerId) { - return response.providerId; - } - if ('phoneNumber' in response) { - return "phone" /* ProviderId.PHONE */; - } - return null; -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Asynchronously signs in as an anonymous user. - * - * @remarks - * If there is already an anonymous user signed in, that user will be returned; otherwise, a - * new anonymous user identity will be created and returned. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * - * @public - */ -async function signInAnonymously(auth) { - if (_isFirebaseServerApp(auth.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth)); - } - const authInternal = _castAuth(auth); - await authInternal._initializationPromise; - if (authInternal.currentUser?.isAnonymous) { - // If an anonymous user is already signed in, no need to sign them in again. - return new UserCredentialImpl({ - user: authInternal.currentUser, - providerId: null, - operationType: "signIn" /* OperationType.SIGN_IN */ - }); - } - const response = await signUp(authInternal, { - returnSecureToken: true - }); - const userCredential = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response, true); - await authInternal._updateCurrentUser(userCredential.user); - return userCredential; -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -class MultiFactorError extends FirebaseError { - constructor(auth, error, operationType, user) { - super(error.code, error.message); - this.operationType = operationType; - this.user = user; - // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work - Object.setPrototypeOf(this, MultiFactorError.prototype); - this.customData = { - appName: auth.name, - tenantId: auth.tenantId ?? undefined, - _serverResponse: error.customData._serverResponse, - operationType - }; - } - static _fromErrorAndOperation(auth, error, operationType, user) { - return new MultiFactorError(auth, error, operationType, user); - } -} -function _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user) { - const idTokenProvider = operationType === "reauthenticate" /* OperationType.REAUTHENTICATE */ - ? credential._getReauthenticationResolver(auth) - : credential._getIdTokenResponse(auth); - return idTokenProvider.catch(error => { - if (error.code === `auth/${"multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */}`) { - throw MultiFactorError._fromErrorAndOperation(auth, error, operationType, user); - } - throw error; - }); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Takes a set of UserInfo provider data and converts it to a set of names - */ -function providerDataAsNames(providerData) { - return new Set(providerData - .map(({ providerId }) => providerId) - .filter(pid => !!pid)); -} - -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Unlinks a provider from a user account. - * - * @param user - The user. - * @param providerId - The provider to unlink. - * - * @public - */ -async function unlink(user, providerId) { - const userInternal = getModularInstance(user); - await _assertLinkedStatus(true, userInternal, providerId); - const { providerUserInfo } = await deleteLinkedAccounts(userInternal.auth, { - idToken: await userInternal.getIdToken(), - deleteProvider: [providerId] - }); - const providersLeft = providerDataAsNames(providerUserInfo || []); - userInternal.providerData = userInternal.providerData.filter(pd => providersLeft.has(pd.providerId)); - if (!providersLeft.has("phone" /* ProviderId.PHONE */)) { - userInternal.phoneNumber = null; - } - await userInternal.auth._persistUserIfCurrent(userInternal); - return userInternal; -} -async function _link(user, credential, bypassAuthState = false) { - const response = await _logoutIfInvalidated(user, credential._linkToIdToken(user.auth, await user.getIdToken()), bypassAuthState); - return UserCredentialImpl._forOperation(user, "link" /* OperationType.LINK */, response); -} -async function _assertLinkedStatus(expected, user, provider) { - await _reloadWithoutSaving(user); - const providerIds = providerDataAsNames(user.providerData); - const code = expected === false - ? "provider-already-linked" /* AuthErrorCode.PROVIDER_ALREADY_LINKED */ - : "no-such-provider" /* AuthErrorCode.NO_SUCH_PROVIDER */; - _assert(providerIds.has(provider) === expected, user.auth, code); -} - -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function _reauthenticate(user, credential, bypassAuthState = false) { - const { auth } = user; - if (_isFirebaseServerApp(auth.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth)); - } - const operationType = "reauthenticate" /* OperationType.REAUTHENTICATE */; - try { - const response = await _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState); - _assert(response.idToken, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - const parsed = _parseToken(response.idToken); - _assert(parsed, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - const { sub: localId } = parsed; - _assert(user.uid === localId, auth, "user-mismatch" /* AuthErrorCode.USER_MISMATCH */); - return UserCredentialImpl._forOperation(user, operationType, response); - } - catch (e) { - // Convert user deleted error into user mismatch - if (e?.code === `auth/${"user-not-found" /* AuthErrorCode.USER_DELETED */}`) { - _fail(auth, "user-mismatch" /* AuthErrorCode.USER_MISMATCH */); - } - throw e; - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function _signInWithCredential(auth, credential, bypassAuthState = false) { - if (_isFirebaseServerApp(auth.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth)); - } - const operationType = "signIn" /* OperationType.SIGN_IN */; - const response = await _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential); - const userCredential = await UserCredentialImpl._fromIdTokenResponse(auth, operationType, response); - if (!bypassAuthState) { - await auth._updateCurrentUser(userCredential.user); - } - return userCredential; -} -/** - * Asynchronously signs in with the given credentials. - * - * @remarks - * An {@link AuthProvider} can be used to generate the credential. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * @param credential - The auth credential. - * - * @public - */ -async function signInWithCredential(auth, credential) { - return _signInWithCredential(_castAuth(auth), credential); -} -/** - * Links the user account with the given credentials. - * - * @remarks - * An {@link AuthProvider} can be used to generate the credential. - * - * @param user - The user. - * @param credential - The auth credential. - * - * @public - */ -async function linkWithCredential(user, credential) { - const userInternal = getModularInstance(user); - await _assertLinkedStatus(false, userInternal, credential.providerId); - return _link(userInternal, credential); -} -/** - * Re-authenticates a user using a fresh credential. - * - * @remarks - * Use before operations such as {@link updatePassword} that require tokens from recent sign-in - * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error - * or a `TOKEN_EXPIRED` error. - * - * This method is not supported on any {@link User} signed in by {@link Auth} instances - * created with a {@link @firebase/app#FirebaseServerApp}. - * - * @param user - The user. - * @param credential - The auth credential. - * - * @public - */ -async function reauthenticateWithCredential(user, credential) { - return _reauthenticate(getModularInstance(user), credential); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function signInWithCustomToken$1(auth, request) { - return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithCustomToken" /* Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN */, _addTidIfNecessary(auth, request)); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Asynchronously signs in using a custom token. - * - * @remarks - * Custom tokens are used to integrate Firebase Auth with existing auth systems, and must - * be generated by an auth backend using the - * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#createcustomtoken | createCustomToken} - * method in the {@link https://firebase.google.com/docs/auth/admin | Admin SDK} . - * - * Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * @param customToken - The custom token to sign in with. - * - * @public - */ -async function signInWithCustomToken(auth, customToken) { - if (_isFirebaseServerApp(auth.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth)); - } - const authInternal = _castAuth(auth); - const response = await signInWithCustomToken$1(authInternal, { - token: customToken, - returnSecureToken: true - }); - const cred = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response); - await authInternal._updateCurrentUser(cred.user); - return cred; -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -class MultiFactorInfoImpl { - constructor(factorId, response) { - this.factorId = factorId; - this.uid = response.mfaEnrollmentId; - this.enrollmentTime = new Date(response.enrolledAt).toUTCString(); - this.displayName = response.displayName; - } - static _fromServerResponse(auth, enrollment) { - if ('phoneInfo' in enrollment) { - return PhoneMultiFactorInfoImpl._fromServerResponse(auth, enrollment); - } - else if ('totpInfo' in enrollment) { - return TotpMultiFactorInfoImpl._fromServerResponse(auth, enrollment); - } - return _fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - } -} -class PhoneMultiFactorInfoImpl extends MultiFactorInfoImpl { - constructor(response) { - super("phone" /* FactorId.PHONE */, response); - this.phoneNumber = response.phoneInfo; - } - static _fromServerResponse(_auth, enrollment) { - return new PhoneMultiFactorInfoImpl(enrollment); - } -} -class TotpMultiFactorInfoImpl extends MultiFactorInfoImpl { - constructor(response) { - super("totp" /* FactorId.TOTP */, response); - } - static _fromServerResponse(_auth, enrollment) { - return new TotpMultiFactorInfoImpl(enrollment); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function _setActionCodeSettingsOnRequest(auth, request, actionCodeSettings) { - _assert(actionCodeSettings.url?.length > 0, auth, "invalid-continue-uri" /* AuthErrorCode.INVALID_CONTINUE_URI */); - _assert(typeof actionCodeSettings.dynamicLinkDomain === 'undefined' || - actionCodeSettings.dynamicLinkDomain.length > 0, auth, "invalid-dynamic-link-domain" /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */); - _assert(typeof actionCodeSettings.linkDomain === 'undefined' || - actionCodeSettings.linkDomain.length > 0, auth, "invalid-hosting-link-domain" /* AuthErrorCode.INVALID_HOSTING_LINK_DOMAIN */); - request.continueUrl = actionCodeSettings.url; - request.dynamicLinkDomain = actionCodeSettings.dynamicLinkDomain; - request.linkDomain = actionCodeSettings.linkDomain; - request.canHandleCodeInApp = actionCodeSettings.handleCodeInApp; - if (actionCodeSettings.iOS) { - _assert(actionCodeSettings.iOS.bundleId.length > 0, auth, "missing-ios-bundle-id" /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */); - request.iOSBundleId = actionCodeSettings.iOS.bundleId; - } - if (actionCodeSettings.android) { - _assert(actionCodeSettings.android.packageName.length > 0, auth, "missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */); - request.androidInstallApp = actionCodeSettings.android.installApp; - request.androidMinimumVersionCode = - actionCodeSettings.android.minimumVersion; - request.androidPackageName = actionCodeSettings.android.packageName; - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Updates the password policy cached in the {@link Auth} instance if a policy is already - * cached for the project or tenant. - * - * @remarks - * We only fetch the password policy if the password did not meet policy requirements and - * there is an existing policy cached. A developer must call validatePassword at least - * once for the cache to be automatically updated. - * - * @param auth - The {@link Auth} instance. - * - * @private - */ -async function recachePasswordPolicy(auth) { - const authInternal = _castAuth(auth); - if (authInternal._getPasswordPolicyInternal()) { - await authInternal._updatePasswordPolicy(); - } -} -/** - * Sends a password reset email to the given email address. This method does not throw an error when - * there's no user account with the given email address and - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection} - * is enabled. - * - * @remarks - * To complete the password reset, call {@link confirmPasswordReset} with the code supplied in - * the email sent to the user, along with the new password specified by the user. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendPasswordResetEmail(auth, 'user@example.com', actionCodeSettings); - * // Obtain code from user. - * await confirmPasswordReset('user@example.com', code); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ -async function sendPasswordResetEmail(auth, email, actionCodeSettings) { - const authInternal = _castAuth(auth); - const request = { - requestType: "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */, - email, - clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */ - }; - if (actionCodeSettings) { - _setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings); - } - await handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendPasswordResetEmail$1, "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */); -} -/** - * Completes the password reset process, given a confirmation code and new password. - * - * @param auth - The {@link Auth} instance. - * @param oobCode - A confirmation code sent to the user. - * @param newPassword - The new password. - * - * @public - */ -async function confirmPasswordReset(auth, oobCode, newPassword) { - await resetPassword(getModularInstance(auth), { - oobCode, - newPassword - }) - .catch(async (error) => { - if (error.code === - `auth/${"password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */}`) { - void recachePasswordPolicy(auth); - } - throw error; - }); - // Do not return the email. -} -/** - * Applies a verification code sent to the user by email or other out-of-band mechanism. - * - * @param auth - The {@link Auth} instance. - * @param oobCode - A verification code sent to the user. - * - * @public - */ -async function applyActionCode(auth, oobCode) { - await applyActionCode$1(getModularInstance(auth), { oobCode }); -} -/** - * Checks a verification code sent to the user by email or other out-of-band mechanism. - * - * @returns metadata about the code. - * - * @param auth - The {@link Auth} instance. - * @param oobCode - A verification code sent to the user. - * - * @public - */ -async function checkActionCode(auth, oobCode) { - const authModular = getModularInstance(auth); - const response = await resetPassword(authModular, { oobCode }); - // Email could be empty only if the request type is EMAIL_SIGNIN or - // VERIFY_AND_CHANGE_EMAIL. - // New email should not be empty if the request type is - // VERIFY_AND_CHANGE_EMAIL. - // Multi-factor info could not be empty if the request type is - // REVERT_SECOND_FACTOR_ADDITION. - const operation = response.requestType; - _assert(operation, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - switch (operation) { - case "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */: - break; - case "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */: - _assert(response.newEmail, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - break; - case "REVERT_SECOND_FACTOR_ADDITION" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */: - _assert(response.mfaInfo, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - // fall through - default: - _assert(response.email, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - } - // The multi-factor info for revert second factor addition - let multiFactorInfo = null; - if (response.mfaInfo) { - multiFactorInfo = MultiFactorInfoImpl._fromServerResponse(_castAuth(authModular), response.mfaInfo); - } - return { - data: { - email: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */ - ? response.newEmail - : response.email) || null, - previousEmail: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */ - ? response.email - : response.newEmail) || null, - multiFactorInfo - }, - operation - }; -} -/** - * Checks a password reset code sent to the user by email or other out-of-band mechanism. - * - * @returns the user's email address if valid. - * - * @param auth - The {@link Auth} instance. - * @param code - A verification code sent to the user. - * - * @public - */ -async function verifyPasswordResetCode(auth, code) { - const { data } = await checkActionCode(getModularInstance(auth), code); - // Email should always be present since a code was sent to it - return data.email; -} -/** - * Creates a new user account associated with the specified email address and password. - * - * @remarks - * On successful creation of the user account, this user will also be signed in to your application. - * - * User account creation can fail if the account already exists or the password is invalid. - * - * This method is not supported on {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * Note: The email address acts as a unique identifier for the user and enables an email-based - * password reset. This function will create a new user account and set the initial user password. - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * @param password - The user's chosen password. - * - * @public - */ -async function createUserWithEmailAndPassword(auth, email, password) { - if (_isFirebaseServerApp(auth.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth)); - } - const authInternal = _castAuth(auth); - const request = { - returnSecureToken: true, - email, - password, - clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */ - }; - const signUpResponse = handleRecaptchaFlow(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, signUp, "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */); - const response = await signUpResponse.catch(error => { - if (error.code === `auth/${"password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */}`) { - void recachePasswordPolicy(auth); - } - throw error; - }); - const userCredential = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response); - await authInternal._updateCurrentUser(userCredential.user); - return userCredential; -} -/** - * Asynchronously signs in using an email and password. - * - * @remarks - * Fails with an error if the email address and password do not match. When - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection} - * is enabled, this method fails with "auth/invalid-credential" in case of an invalid - * email/password. - * - * This method is not supported on {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * Note: The user's password is NOT the password used to access the user's email account. The - * email address serves as a unique identifier for the user, and the password is used to access - * the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}. - * - * - * @param auth - The {@link Auth} instance. - * @param email - The users email address. - * @param password - The users password. - * - * @public - */ -function signInWithEmailAndPassword(auth, email, password) { - if (_isFirebaseServerApp(auth.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth)); - } - return signInWithCredential(getModularInstance(auth), EmailAuthProvider.credential(email, password)).catch(async (error) => { - if (error.code === `auth/${"password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */}`) { - void recachePasswordPolicy(auth); - } - throw error; - }); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Sends a sign-in email link to the user with the specified email. - * - * @remarks - * The sign-in operation has to always be completed in the app unlike other out of band email - * actions (password reset and email verifications). This is because, at the end of the flow, - * the user is expected to be signed in and their Auth state persisted within the app. - * - * To complete sign in with the email link, call {@link signInWithEmailLink} with the email - * address and the email link supplied in the email sent to the user. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings); - * // Obtain emailLink from the user. - * if(isSignInWithEmailLink(auth, emailLink)) { - * await signInWithEmailLink(auth, 'user@example.com', emailLink); - * } - * ``` - * - * @param authInternal - The {@link Auth} instance. - * @param email - The user's email address. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ -async function sendSignInLinkToEmail(auth, email, actionCodeSettings) { - const authInternal = _castAuth(auth); - const request = { - requestType: "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */, - email, - clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */ - }; - function setActionCodeSettings(request, actionCodeSettings) { - _assert(actionCodeSettings.handleCodeInApp, authInternal, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - if (actionCodeSettings) { - _setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings); - } - } - setActionCodeSettings(request, actionCodeSettings); - await handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendSignInLinkToEmail$1, "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */); -} -/** - * Checks if an incoming link is a sign-in with email link suitable for {@link signInWithEmailLink}. - * - * @param auth - The {@link Auth} instance. - * @param emailLink - The link sent to the user's email address. - * - * @public - */ -function isSignInWithEmailLink(auth, emailLink) { - const actionCodeUrl = ActionCodeURL.parseLink(emailLink); - return actionCodeUrl?.operation === "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */; -} -/** - * Asynchronously signs in using an email and sign-in email link. - * - * @remarks - * If no link is passed, the link is inferred from the current URL. - * - * Fails with an error if the email address is invalid or OTP in email link expires. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings); - * // Obtain emailLink from the user. - * if(isSignInWithEmailLink(auth, emailLink)) { - * await signInWithEmailLink(auth, 'user@example.com', emailLink); - * } - * ``` - * - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * @param emailLink - The link sent to the user's email address. - * - * @public - */ -async function signInWithEmailLink(auth, email, emailLink) { - if (_isFirebaseServerApp(auth.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth)); - } - const authModular = getModularInstance(auth); - const credential = EmailAuthProvider.credentialWithLink(email, emailLink || _getCurrentUrl()); - // Check if the tenant ID in the email link matches the tenant ID on Auth - // instance. - _assert(credential._tenantId === (authModular.tenantId || null), authModular, "tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */); - return signInWithCredential(authModular, credential); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function createAuthUri(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:createAuthUri" /* Endpoint.CREATE_AUTH_URI */, _addTidIfNecessary(auth, request)); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Gets the list of possible sign in methods for the given email address. This method returns an - * empty list when - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection} - * is enabled, irrespective of the number of authentication methods available for the given email. - * - * @remarks - * This is useful to differentiate methods of sign-in for the same provider, eg. - * {@link EmailAuthProvider} which has 2 methods of sign-in, - * {@link SignInMethod}.EMAIL_PASSWORD and - * {@link SignInMethod}.EMAIL_LINK. - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * - * Deprecated. Migrating off of this method is recommended as a security best-practice. - * Learn more in the Identity Platform documentation for - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}. - * @public - */ -async function fetchSignInMethodsForEmail(auth, email) { - // createAuthUri returns an error if continue URI is not http or https. - // For environments like Cordova, Chrome extensions, native frameworks, file - // systems, etc, use http://localhost as continue URL. - const continueUri = _isHttpOrHttps() ? _getCurrentUrl() : 'http://localhost'; - const request = { - identifier: email, - continueUri - }; - const { signinMethods } = await createAuthUri(getModularInstance(auth), request); - return signinMethods || []; -} -/** - * Sends a verification email to a user. - * - * @remarks - * The verification process is completed by calling {@link applyActionCode}. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendEmailVerification(user, actionCodeSettings); - * // Obtain code from the user. - * await applyActionCode(auth, code); - * ``` - * - * @param user - The user. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ -async function sendEmailVerification(user, actionCodeSettings) { - const userInternal = getModularInstance(user); - const idToken = await user.getIdToken(); - const request = { - requestType: "VERIFY_EMAIL" /* ActionCodeOperation.VERIFY_EMAIL */, - idToken - }; - if (actionCodeSettings) { - _setActionCodeSettingsOnRequest(userInternal.auth, request, actionCodeSettings); - } - const { email } = await sendEmailVerification$1(userInternal.auth, request); - if (email !== user.email) { - await user.reload(); - } -} -/** - * Sends a verification email to a new email address. - * - * @remarks - * The user's email will be updated to the new one after being verified. - * - * If you have a custom email action handler, you can complete the verification process by calling - * {@link applyActionCode}. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await verifyBeforeUpdateEmail(user, 'newemail@example.com', actionCodeSettings); - * // Obtain code from the user. - * await applyActionCode(auth, code); - * ``` - * - * @param user - The user. - * @param newEmail - The new email address to be verified before update. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ -async function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) { - const userInternal = getModularInstance(user); - const idToken = await user.getIdToken(); - const request = { - requestType: "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */, - idToken, - newEmail - }; - if (actionCodeSettings) { - _setActionCodeSettingsOnRequest(userInternal.auth, request, actionCodeSettings); - } - const { email } = await verifyAndChangeEmail(userInternal.auth, request); - if (email !== user.email) { - // If the local copy of the email on user is outdated, reload the - // user. - await user.reload(); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -async function updateProfile$1(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Updates a user's profile data. - * - * @param user - The user. - * @param profile - The profile's `displayName` and `photoURL` to update. - * - * @public - */ -async function updateProfile(user, { displayName, photoURL: photoUrl }) { - if (displayName === undefined && photoUrl === undefined) { - return; - } - const userInternal = getModularInstance(user); - const idToken = await userInternal.getIdToken(); - const profileRequest = { - idToken, - displayName, - photoUrl, - returnSecureToken: true - }; - const response = await _logoutIfInvalidated(userInternal, updateProfile$1(userInternal.auth, profileRequest)); - userInternal.displayName = response.displayName || null; - userInternal.photoURL = response.photoUrl || null; - // Update the password provider as well - const passwordProvider = userInternal.providerData.find(({ providerId }) => providerId === "password" /* ProviderId.PASSWORD */); - if (passwordProvider) { - passwordProvider.displayName = userInternal.displayName; - passwordProvider.photoURL = userInternal.photoURL; - } - await userInternal._updateTokensIfNecessary(response); -} -/** - * Updates the user's email address. - * - * @remarks - * An email will be sent to the original email address (if it was set) that allows to revoke the - * email address change, in order to protect them from account hijacking. - * - * This method is not supported on any {@link User} signed in by {@link Auth} instances - * created with a {@link @firebase/app#FirebaseServerApp}. - * - * Important: this is a security sensitive operation that requires the user to have recently signed - * in. If this requirement isn't met, ask the user to authenticate again and then call - * {@link reauthenticateWithCredential}. - * - * @param user - The user. - * @param newEmail - The new email address. - * - * Throws "auth/operation-not-allowed" error when - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection} - * is enabled. - * Deprecated - Use {@link verifyBeforeUpdateEmail} instead. - * - * @public - */ -function updateEmail(user, newEmail) { - const userInternal = getModularInstance(user); - if (_isFirebaseServerApp(userInternal.auth.app)) { - return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth)); - } - return updateEmailOrPassword(userInternal, newEmail, null); -} -/** - * Updates the user's password. - * - * @remarks - * Important: this is a security sensitive operation that requires the user to have recently signed - * in. If this requirement isn't met, ask the user to authenticate again and then call - * {@link reauthenticateWithCredential}. - * - * @param user - The user. - * @param newPassword - The new password. - * - * @public - */ -function updatePassword(user, newPassword) { - return updateEmailOrPassword(getModularInstance(user), null, newPassword); -} -async function updateEmailOrPassword(user, email, password) { - const { auth } = user; - const idToken = await user.getIdToken(); - const request = { - idToken, - returnSecureToken: true - }; - if (email) { - request.email = email; - } - if (password) { - request.password = password; - } - const response = await _logoutIfInvalidated(user, updateEmailPassword(auth, request)); - await user._updateTokensIfNecessary(response, /* reload */ true); -} - -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Parse the `AdditionalUserInfo` from the ID token response. - * - */ -function _fromIdTokenResponse(idTokenResponse) { - if (!idTokenResponse) { - return null; - } - const { providerId } = idTokenResponse; - const profile = idTokenResponse.rawUserInfo - ? JSON.parse(idTokenResponse.rawUserInfo) - : {}; - const isNewUser = idTokenResponse.isNewUser || - idTokenResponse.kind === "identitytoolkit#SignupNewUserResponse" /* IdTokenResponseKind.SignupNewUser */; - if (!providerId && idTokenResponse?.idToken) { - const signInProvider = _parseToken(idTokenResponse.idToken)?.firebase?.['sign_in_provider']; - if (signInProvider) { - const filteredProviderId = signInProvider !== "anonymous" /* ProviderId.ANONYMOUS */ && - signInProvider !== "custom" /* ProviderId.CUSTOM */ - ? signInProvider - : null; - // Uses generic class in accordance with the legacy SDK. - return new GenericAdditionalUserInfo(isNewUser, filteredProviderId); - } - } - if (!providerId) { - return null; - } - switch (providerId) { - case "facebook.com" /* ProviderId.FACEBOOK */: - return new FacebookAdditionalUserInfo(isNewUser, profile); - case "github.com" /* ProviderId.GITHUB */: - return new GithubAdditionalUserInfo(isNewUser, profile); - case "google.com" /* ProviderId.GOOGLE */: - return new GoogleAdditionalUserInfo(isNewUser, profile); - case "twitter.com" /* ProviderId.TWITTER */: - return new TwitterAdditionalUserInfo(isNewUser, profile, idTokenResponse.screenName || null); - case "custom" /* ProviderId.CUSTOM */: - case "anonymous" /* ProviderId.ANONYMOUS */: - return new GenericAdditionalUserInfo(isNewUser, null); - default: - return new GenericAdditionalUserInfo(isNewUser, providerId, profile); - } -} -class GenericAdditionalUserInfo { - constructor(isNewUser, providerId, profile = {}) { - this.isNewUser = isNewUser; - this.providerId = providerId; - this.profile = profile; - } -} -class FederatedAdditionalUserInfoWithUsername extends GenericAdditionalUserInfo { - constructor(isNewUser, providerId, profile, username) { - super(isNewUser, providerId, profile); - this.username = username; - } -} -class FacebookAdditionalUserInfo extends GenericAdditionalUserInfo { - constructor(isNewUser, profile) { - super(isNewUser, "facebook.com" /* ProviderId.FACEBOOK */, profile); - } -} -class GithubAdditionalUserInfo extends FederatedAdditionalUserInfoWithUsername { - constructor(isNewUser, profile) { - super(isNewUser, "github.com" /* ProviderId.GITHUB */, profile, typeof profile?.login === 'string' ? profile?.login : null); - } -} -class GoogleAdditionalUserInfo extends GenericAdditionalUserInfo { - constructor(isNewUser, profile) { - super(isNewUser, "google.com" /* ProviderId.GOOGLE */, profile); - } -} -class TwitterAdditionalUserInfo extends FederatedAdditionalUserInfoWithUsername { - constructor(isNewUser, profile, screenName) { - super(isNewUser, "twitter.com" /* ProviderId.TWITTER */, profile, screenName); - } -} -/** - * Extracts provider specific {@link AdditionalUserInfo} for the given credential. - * - * @param userCredential - The user credential. - * - * @public - */ -function getAdditionalUserInfo(userCredential) { - const { user, _tokenResponse } = userCredential; - if (user.isAnonymous && !_tokenResponse) { - // Handle the special case where signInAnonymously() gets called twice. - // No network call is made so there's nothing to actually fill this in - return { - providerId: null, - isNewUser: false, - profile: null - }; - } - return _fromIdTokenResponse(_tokenResponse); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Non-optional auth methods. -/** - * Changes the type of persistence on the {@link Auth} instance for the currently saved - * `Auth` session and applies this type of persistence for future sign-in requests, including - * sign-in with redirect requests. - * - * @remarks - * This makes it easy for a user signing in to specify whether their session should be - * remembered or not. It also makes it easier to never persist the `Auth` state for applications - * that are shared by other users or have sensitive data. - * - * This method does not work in a Node.js environment or with {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * setPersistence(auth, browserSessionPersistence); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param persistence - The {@link Persistence} to use. - * @returns A `Promise` that resolves once the persistence change has completed - * - * @public - */ -function setPersistence(auth, persistence) { - return getModularInstance(auth).setPersistence(persistence); -} -/** - * Loads the reCAPTCHA configuration into the `Auth` instance. - * - * @remarks - * This will load the reCAPTCHA config, which indicates whether the reCAPTCHA - * verification flow should be triggered for each auth provider, into the - * current Auth session. - * - * If initializeRecaptchaConfig() is not invoked, the auth flow will always start - * without reCAPTCHA verification. If the provider is configured to require reCAPTCHA - * verification, the SDK will transparently load the reCAPTCHA config and restart the - * auth flows. - * - * Thus, by calling this optional method, you will reduce the latency of future auth flows. - * Loading the reCAPTCHA config early will also enhance the signal collected by reCAPTCHA. - * - * This method does not work in a Node.js environment. - * - * @example - * ```javascript - * initializeRecaptchaConfig(auth); - * ``` - * - * @param auth - The {@link Auth} instance. - * - * @public - */ -function initializeRecaptchaConfig(auth) { - return _initializeRecaptchaConfig(auth); -} -/** - * Validates the password against the password policy configured for the project or tenant. - * - * @remarks - * If no tenant ID is set on the `Auth` instance, then this method will use the password - * policy configured for the project. Otherwise, this method will use the policy configured - * for the tenant. If a password policy has not been configured, then the default policy - * configured for all projects will be used. - * - * If an auth flow fails because a submitted password does not meet the password policy - * requirements and this method has previously been called, then this method will use the - * most recent policy available when called again. - * - * @example - * ```javascript - * validatePassword(auth, 'some-password'); - * ``` - * - * @param auth The {@link Auth} instance. - * @param password The password to validate. - * - * @public - */ -async function validatePassword(auth, password) { - const authInternal = _castAuth(auth); - return authInternal.validatePassword(password); -} -/** - * Adds an observer for changes to the signed-in user's ID token. - * - * @remarks - * This includes sign-in, sign-out, and token refresh events. - * This will not be triggered automatically upon ID token expiration. Use {@link User.getIdToken} to refresh the ID token. - * - * @param auth - The {@link Auth} instance. - * @param nextOrObserver - callback triggered on change. - * @param error - Deprecated. This callback is never triggered. Errors - * on signing in/out can be caught in promises returned from - * sign-in/sign-out functions. - * @param completed - Deprecated. This callback is never triggered. - * - * @public - */ -function onIdTokenChanged(auth, nextOrObserver, error, completed) { - return getModularInstance(auth).onIdTokenChanged(nextOrObserver, error, completed); -} -/** - * Adds a blocking callback that runs before an auth state change - * sets a new user. - * - * @param auth - The {@link Auth} instance. - * @param callback - callback triggered before new user value is set. - * If this throws, it blocks the user from being set. - * @param onAbort - callback triggered if a later `beforeAuthStateChanged()` - * callback throws, allowing you to undo any side effects. - */ -function beforeAuthStateChanged(auth, callback, onAbort) { - return getModularInstance(auth).beforeAuthStateChanged(callback, onAbort); -} -/** - * Adds an observer for changes to the user's sign-in state. - * - * @remarks - * To keep the old behavior, see {@link onIdTokenChanged}. - * - * @param auth - The {@link Auth} instance. - * @param nextOrObserver - callback triggered on change. - * @param error - Deprecated. This callback is never triggered. Errors - * on signing in/out can be caught in promises returned from - * sign-in/sign-out functions. - * @param completed - Deprecated. This callback is never triggered. - * - * @public - */ -function onAuthStateChanged(auth, nextOrObserver, error, completed) { - return getModularInstance(auth).onAuthStateChanged(nextOrObserver, error, completed); -} -/** - * Sets the current language to the default device/browser preference. - * - * @param auth - The {@link Auth} instance. - * - * @public - */ -function useDeviceLanguage(auth) { - getModularInstance(auth).useDeviceLanguage(); -} -/** - * Asynchronously sets the provided user as {@link Auth.currentUser} on the - * {@link Auth} instance. - * - * @remarks - * A new instance copy of the user provided will be made and set as currentUser. - * - * This will trigger {@link onAuthStateChanged} and {@link onIdTokenChanged} listeners - * like other sign in methods. - * - * The operation fails with an error if the user to be updated belongs to a different Firebase - * project. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * @param user - The new {@link User}. - * - * @public - */ -function updateCurrentUser(auth, user) { - return getModularInstance(auth).updateCurrentUser(user); -} -/** - * Signs out the current user. - * - * @remarks - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * - * @public - */ -function signOut(auth) { - return getModularInstance(auth).signOut(); -} -/** - * Revokes the given access token. Currently only supports Apple OAuth access tokens. - * - * @param auth - The {@link Auth} instance. - * @param token - The Apple OAuth access token. - * - * @public - */ -function revokeAccessToken(auth, token) { - const authInternal = _castAuth(auth); - return authInternal.revokeAccessToken(token); -} -/** - * Deletes and signs out the user. - * - * @remarks - * Important: this is a security-sensitive operation that requires the user to have recently - * signed in. If this requirement isn't met, ask the user to authenticate again and then call - * {@link reauthenticateWithCredential}. - * - * @param user - The user. - * - * @public - */ -async function deleteUser(user) { - return getModularInstance(user).delete(); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -class MultiFactorSessionImpl { - constructor(type, credential, user) { - this.type = type; - this.credential = credential; - this.user = user; - } - static _fromIdtoken(idToken, user) { - return new MultiFactorSessionImpl("enroll" /* MultiFactorSessionType.ENROLL */, idToken, user); - } - static _fromMfaPendingCredential(mfaPendingCredential) { - return new MultiFactorSessionImpl("signin" /* MultiFactorSessionType.SIGN_IN */, mfaPendingCredential); - } - toJSON() { - const key = this.type === "enroll" /* MultiFactorSessionType.ENROLL */ - ? 'idToken' - : 'pendingCredential'; - return { - multiFactorSession: { - [key]: this.credential - } - }; - } - static fromJSON(obj) { - if (obj?.multiFactorSession) { - if (obj.multiFactorSession?.pendingCredential) { - return MultiFactorSessionImpl._fromMfaPendingCredential(obj.multiFactorSession.pendingCredential); - } - else if (obj.multiFactorSession?.idToken) { - return MultiFactorSessionImpl._fromIdtoken(obj.multiFactorSession.idToken); - } - } - return null; - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -class MultiFactorResolverImpl { - constructor(session, hints, signInResolver) { - this.session = session; - this.hints = hints; - this.signInResolver = signInResolver; - } - /** @internal */ - static _fromError(authExtern, error) { - const auth = _castAuth(authExtern); - const serverResponse = error.customData._serverResponse; - const hints = (serverResponse.mfaInfo || []).map(enrollment => MultiFactorInfoImpl._fromServerResponse(auth, enrollment)); - _assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - const session = MultiFactorSessionImpl._fromMfaPendingCredential(serverResponse.mfaPendingCredential); - return new MultiFactorResolverImpl(session, hints, async (assertion) => { - const mfaResponse = await assertion._process(auth, session); - // Clear out the unneeded fields from the old login response - delete serverResponse.mfaInfo; - delete serverResponse.mfaPendingCredential; - // Use in the new token & refresh token in the old response - const idTokenResponse = { - ...serverResponse, - idToken: mfaResponse.idToken, - refreshToken: mfaResponse.refreshToken - }; - // TODO: we should collapse this switch statement into UserCredentialImpl._forOperation and have it support the SIGN_IN case - switch (error.operationType) { - case "signIn" /* OperationType.SIGN_IN */: - const userCredential = await UserCredentialImpl._fromIdTokenResponse(auth, error.operationType, idTokenResponse); - await auth._updateCurrentUser(userCredential.user); - return userCredential; - case "reauthenticate" /* OperationType.REAUTHENTICATE */: - _assert(error.user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - return UserCredentialImpl._forOperation(error.user, error.operationType, idTokenResponse); - default: - _fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - } - }); - } - async resolveSignIn(assertionExtern) { - const assertion = assertionExtern; - return this.signInResolver(assertion); - } -} -/** - * Provides a {@link MultiFactorResolver} suitable for completion of a - * multi-factor flow. - * - * @param auth - The {@link Auth} instance. - * @param error - The {@link MultiFactorError} raised during a sign-in, or - * reauthentication operation. - * - * @public - */ -function getMultiFactorResolver(auth, error) { - const authModular = getModularInstance(auth); - const errorInternal = error; - _assert(error.customData.operationType, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - _assert(errorInternal.customData._serverResponse?.mfaPendingCredential, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - return MultiFactorResolverImpl._fromError(authModular, errorInternal); -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function startEnrollPhoneMfa(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:start" /* Endpoint.START_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request)); -} -function finalizeEnrollPhoneMfa(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:finalize" /* Endpoint.FINALIZE_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request)); -} -function startEnrollTotpMfa(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:start" /* Endpoint.START_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request)); -} -function finalizeEnrollTotpMfa(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:finalize" /* Endpoint.FINALIZE_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request)); -} -function withdrawMfa(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:withdraw" /* Endpoint.WITHDRAW_MFA */, _addTidIfNecessary(auth, request)); -} - -class MultiFactorUserImpl { - constructor(user) { - this.user = user; - this.enrolledFactors = []; - user._onReload(userInfo => { - if (userInfo.mfaInfo) { - this.enrolledFactors = userInfo.mfaInfo.map(enrollment => MultiFactorInfoImpl._fromServerResponse(user.auth, enrollment)); - } - }); - } - static _fromUser(user) { - return new MultiFactorUserImpl(user); - } - async getSession() { - return MultiFactorSessionImpl._fromIdtoken(await this.user.getIdToken(), this.user); - } - async enroll(assertionExtern, displayName) { - const assertion = assertionExtern; - const session = (await this.getSession()); - const finalizeMfaResponse = await _logoutIfInvalidated(this.user, assertion._process(this.user.auth, session, displayName)); - // New tokens will be issued after enrollment of the new second factors. - // They need to be updated on the user. - await this.user._updateTokensIfNecessary(finalizeMfaResponse); - // The user needs to be reloaded to get the new multi-factor information - // from server. USER_RELOADED event will be triggered and `enrolledFactors` - // will be updated. - return this.user.reload(); - } - async unenroll(infoOrUid) { - const mfaEnrollmentId = typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid; - const idToken = await this.user.getIdToken(); - try { - const idTokenResponse = await _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, { - idToken, - mfaEnrollmentId - })); - // Remove the second factor from the user's list. - this.enrolledFactors = this.enrolledFactors.filter(({ uid }) => uid !== mfaEnrollmentId); - // Depending on whether the backend decided to revoke the user's session, - // the tokenResponse may be empty. If the tokens were not updated (and they - // are now invalid), reloading the user will discover this and invalidate - // the user's state accordingly. - await this.user._updateTokensIfNecessary(idTokenResponse); - await this.user.reload(); - } - catch (e) { - throw e; - } - } -} -const multiFactorUserCache = new WeakMap(); -/** - * The {@link MultiFactorUser} corresponding to the user. - * - * @remarks - * This is used to access all multi-factor properties and operations related to the user. - * - * @param user - The user. - * - * @public - */ -function multiFactor(user) { - const userModular = getModularInstance(user); - if (!multiFactorUserCache.has(userModular)) { - multiFactorUserCache.set(userModular, MultiFactorUserImpl._fromUser(userModular)); - } - return multiFactorUserCache.get(userModular); -} - -const STORAGE_AVAILABLE_KEY = '__sak'; - -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Shim for Promise.allSettled, note the slightly different format of `fulfilled` vs `status`. - * - * @param promises - Array of promises to wait on. - */ -function _allSettled(promises) { - return Promise.all(promises.map(async (promise) => { - try { - const value = await promise; - return { - fulfilled: true, - value - }; - } - catch (reason) { - return { - fulfilled: false, - reason - }; - } - })); -} - -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Interface class for receiving messages. - * - */ -class Receiver { - constructor(eventTarget) { - this.eventTarget = eventTarget; - this.handlersMap = {}; - this.boundEventHandler = this.handleEvent.bind(this); - } - /** - * Obtain an instance of a Receiver for a given event target, if none exists it will be created. - * - * @param eventTarget - An event target (such as window or self) through which the underlying - * messages will be received. - */ - static _getInstance(eventTarget) { - // The results are stored in an array since objects can't be keys for other - // objects. In addition, setting a unique property on an event target as a - // hash map key may not be allowed due to CORS restrictions. - const existingInstance = this.receivers.find(receiver => receiver.isListeningto(eventTarget)); - if (existingInstance) { - return existingInstance; - } - const newInstance = new Receiver(eventTarget); - this.receivers.push(newInstance); - return newInstance; - } - isListeningto(eventTarget) { - return this.eventTarget === eventTarget; - } - /** - * Fans out a MessageEvent to the appropriate listeners. - * - * @remarks - * Sends an {@link Status.ACK} upon receipt and a {@link Status.DONE} once all handlers have - * finished processing. - * - * @param event - The MessageEvent. - * - */ - async handleEvent(event) { - const messageEvent = event; - const { eventId, eventType, data } = messageEvent.data; - const handlers = this.handlersMap[eventType]; - if (!handlers?.size) { - return; - } - messageEvent.ports[0].postMessage({ - status: "ack" /* _Status.ACK */, - eventId, - eventType - }); - const promises = Array.from(handlers).map(async (handler) => handler(messageEvent.origin, data)); - const response = await _allSettled(promises); - messageEvent.ports[0].postMessage({ - status: "done" /* _Status.DONE */, - eventId, - eventType, - response - }); - } - /** - * Subscribe an event handler for a particular event. - * - * @param eventType - Event name to subscribe to. - * @param eventHandler - The event handler which should receive the events. - * - */ - _subscribe(eventType, eventHandler) { - if (Object.keys(this.handlersMap).length === 0) { - this.eventTarget.addEventListener('message', this.boundEventHandler); - } - if (!this.handlersMap[eventType]) { - this.handlersMap[eventType] = new Set(); - } - this.handlersMap[eventType].add(eventHandler); - } - /** - * Unsubscribe an event handler from a particular event. - * - * @param eventType - Event name to unsubscribe from. - * @param eventHandler - Optional event handler, if none provided, unsubscribe all handlers on this event. - * - */ - _unsubscribe(eventType, eventHandler) { - if (this.handlersMap[eventType] && eventHandler) { - this.handlersMap[eventType].delete(eventHandler); - } - if (!eventHandler || this.handlersMap[eventType].size === 0) { - delete this.handlersMap[eventType]; - } - if (Object.keys(this.handlersMap).length === 0) { - this.eventTarget.removeEventListener('message', this.boundEventHandler); - } - } -} -Receiver.receivers = []; - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function _generateEventId(prefix = '', digits = 10) { - let random = ''; - for (let i = 0; i < digits; i++) { - random += Math.floor(Math.random() * 10); - } - return prefix + random; -} - -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Interface for sending messages and waiting for a completion response. - * - */ -class Sender { - constructor(target) { - this.target = target; - this.handlers = new Set(); - } - /** - * Unsubscribe the handler and remove it from our tracking Set. - * - * @param handler - The handler to unsubscribe. - */ - removeMessageHandler(handler) { - if (handler.messageChannel) { - handler.messageChannel.port1.removeEventListener('message', handler.onMessage); - handler.messageChannel.port1.close(); - } - this.handlers.delete(handler); - } - /** - * Send a message to the Receiver located at {@link target}. - * - * @remarks - * We'll first wait a bit for an ACK , if we get one we will wait significantly longer until the - * receiver has had a chance to fully process the event. - * - * @param eventType - Type of event to send. - * @param data - The payload of the event. - * @param timeout - Timeout for waiting on an ACK from the receiver. - * - * @returns An array of settled promises from all the handlers that were listening on the receiver. - */ - async _send(eventType, data, timeout = 50 /* _TimeoutDuration.ACK */) { - const messageChannel = typeof MessageChannel !== 'undefined' ? new MessageChannel() : null; - if (!messageChannel) { - throw new Error("connection_unavailable" /* _MessageError.CONNECTION_UNAVAILABLE */); - } - // Node timers and browser timers return fundamentally different types. - // We don't actually care what the value is but TS won't accept unknown and - // we can't cast properly in both environments. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - let completionTimer; - let handler; - return new Promise((resolve, reject) => { - const eventId = _generateEventId('', 20); - messageChannel.port1.start(); - const ackTimer = setTimeout(() => { - reject(new Error("unsupported_event" /* _MessageError.UNSUPPORTED_EVENT */)); - }, timeout); - handler = { - messageChannel, - onMessage(event) { - const messageEvent = event; - if (messageEvent.data.eventId !== eventId) { - return; - } - switch (messageEvent.data.status) { - case "ack" /* _Status.ACK */: - // The receiver should ACK first. - clearTimeout(ackTimer); - completionTimer = setTimeout(() => { - reject(new Error("timeout" /* _MessageError.TIMEOUT */)); - }, 3000 /* _TimeoutDuration.COMPLETION */); - break; - case "done" /* _Status.DONE */: - // Once the receiver's handlers are finished we will get the results. - clearTimeout(completionTimer); - resolve(messageEvent.data.response); - break; - default: - clearTimeout(ackTimer); - clearTimeout(completionTimer); - reject(new Error("invalid_response" /* _MessageError.INVALID_RESPONSE */)); - break; - } - } - }; - this.handlers.add(handler); - messageChannel.port1.addEventListener('message', handler.onMessage); - this.target.postMessage({ - eventType, - eventId, - data - }, [messageChannel.port2]); - }).finally(() => { - if (handler) { - this.removeMessageHandler(handler); - } - }); - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Lazy accessor for window, since the compat layer won't tree shake this out, - * we need to make sure not to mess with window unless we have to - */ -function _window() { - return window; -} -function _setWindowLocation(url) { - _window().location.href = url; -} - -/** - * @license - * Copyright 2020 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function _isWorker() { - return (typeof _window()['WorkerGlobalScope'] !== 'undefined' && - typeof _window()['importScripts'] === 'function'); -} -async function _getActiveServiceWorker() { - if (!navigator?.serviceWorker) { - return null; - } - try { - const registration = await navigator.serviceWorker.ready; - return registration.active; - } - catch { - return null; - } -} -function _getServiceWorkerController() { - return navigator?.serviceWorker?.controller || null; -} -function _getWorkerGlobalScope() { - return _isWorker() ? self : null; -} - -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const DB_NAME = 'firebaseLocalStorageDb'; -const DB_VERSION = 1; -const DB_OBJECTSTORE_NAME = 'firebaseLocalStorage'; -const DB_DATA_KEYPATH = 'fbase_key'; -/** - * Promise wrapper for IDBRequest - * - * Unfortunately we can't cleanly extend Promise<T> since promises are not callable in ES6 - * - */ -class DBPromise { - constructor(request) { - this.request = request; - } - toPromise() { - return new Promise((resolve, reject) => { - this.request.addEventListener('success', () => { - resolve(this.request.result); - }); - this.request.addEventListener('error', () => { - reject(this.request.error); - }); - }); - } -} -function getObjectStore(db, isReadWrite) { - return db - .transaction([DB_OBJECTSTORE_NAME], isReadWrite ? 'readwrite' : 'readonly') - .objectStore(DB_OBJECTSTORE_NAME); -} -function _deleteDatabase() { - const request = indexedDB.deleteDatabase(DB_NAME); - return new DBPromise(request).toPromise(); -} -function _openDatabase() { - const request = indexedDB.open(DB_NAME, DB_VERSION); - return new Promise((resolve, reject) => { - request.addEventListener('error', () => { - reject(request.error); - }); - request.addEventListener('upgradeneeded', () => { - const db = request.result; - try { - db.createObjectStore(DB_OBJECTSTORE_NAME, { keyPath: DB_DATA_KEYPATH }); - } - catch (e) { - reject(e); - } - }); - request.addEventListener('success', async () => { - const db = request.result; - // Strange bug that occurs in Firefox when multiple tabs are opened at the - // same time. The only way to recover seems to be deleting the database - // and re-initializing it. - // https://github.com/firebase/firebase-js-sdk/issues/634 - if (!db.objectStoreNames.contains(DB_OBJECTSTORE_NAME)) { - // Need to close the database or else you get a `blocked` event - db.close(); - await _deleteDatabase(); - resolve(await _openDatabase()); - } - else { - resolve(db); - } - }); - }); -} -async function _putObject(db, key, value) { - const request = getObjectStore(db, true).put({ - [DB_DATA_KEYPATH]: key, - value - }); - return new DBPromise(request).toPromise(); -} -async function getObject(db, key) { - const request = getObjectStore(db, false).get(key); - const data = await new DBPromise(request).toPromise(); - return data === undefined ? null : data.value; -} -function _deleteObject(db, key) { - const request = getObjectStore(db, true).delete(key); - return new DBPromise(request).toPromise(); -} -const _POLLING_INTERVAL_MS = 800; -const _TRANSACTION_RETRY_COUNT = 3; -class IndexedDBLocalPersistence { - constructor() { - this.type = "LOCAL" /* PersistenceType.LOCAL */; - this._shouldAllowMigration = true; - this.listeners = {}; - this.localCache = {}; - // setTimeout return value is platform specific - // eslint-disable-next-line @typescript-eslint/no-explicit-any - this.pollTimer = null; - this.pendingWrites = 0; - this.receiver = null; - this.sender = null; - this.serviceWorkerReceiverAvailable = false; - this.activeServiceWorker = null; - // Fire & forget the service worker registration as it may never resolve - this._workerInitializationPromise = - this.initializeServiceWorkerMessaging().then(() => { }, () => { }); - } - async _openDb() { - if (this.db) { - return this.db; - } - this.db = await _openDatabase(); - return this.db; - } - async _withRetries(op) { - let numAttempts = 0; - while (true) { - try { - const db = await this._openDb(); - return await op(db); - } - catch (e) { - if (numAttempts++ > _TRANSACTION_RETRY_COUNT) { - throw e; - } - if (this.db) { - this.db.close(); - this.db = undefined; - } - // TODO: consider adding exponential backoff - } - } - } - /** - * IndexedDB events do not propagate from the main window to the worker context. We rely on a - * postMessage interface to send these events to the worker ourselves. - */ - async initializeServiceWorkerMessaging() { - return _isWorker() ? this.initializeReceiver() : this.initializeSender(); - } - /** - * As the worker we should listen to events from the main window. - */ - async initializeReceiver() { - this.receiver = Receiver._getInstance(_getWorkerGlobalScope()); - // Refresh from persistence if we receive a KeyChanged message. - this.receiver._subscribe("keyChanged" /* _EventType.KEY_CHANGED */, async (_origin, data) => { - const keys = await this._poll(); - return { - keyProcessed: keys.includes(data.key) - }; - }); - // Let the sender know that we are listening so they give us more timeout. - this.receiver._subscribe("ping" /* _EventType.PING */, async (_origin, _data) => { - return ["keyChanged" /* _EventType.KEY_CHANGED */]; - }); - } - /** - * As the main window, we should let the worker know when keys change (set and remove). - * - * @remarks - * {@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/ready | ServiceWorkerContainer.ready} - * may not resolve. - */ - async initializeSender() { - // Check to see if there's an active service worker. - this.activeServiceWorker = await _getActiveServiceWorker(); - if (!this.activeServiceWorker) { - return; - } - this.sender = new Sender(this.activeServiceWorker); - // Ping the service worker to check what events they can handle. - const results = await this.sender._send("ping" /* _EventType.PING */, {}, 800 /* _TimeoutDuration.LONG_ACK */); - if (!results) { - return; - } - if (results[0]?.fulfilled && - results[0]?.value.includes("keyChanged" /* _EventType.KEY_CHANGED */)) { - this.serviceWorkerReceiverAvailable = true; - } - } - /** - * Let the worker know about a changed key, the exact key doesn't technically matter since the - * worker will just trigger a full sync anyway. - * - * @remarks - * For now, we only support one service worker per page. - * - * @param key - Storage key which changed. - */ - async notifyServiceWorker(key) { - if (!this.sender || - !this.activeServiceWorker || - _getServiceWorkerController() !== this.activeServiceWorker) { - return; - } - try { - await this.sender._send("keyChanged" /* _EventType.KEY_CHANGED */, { key }, - // Use long timeout if receiver has previously responded to a ping from us. - this.serviceWorkerReceiverAvailable - ? 800 /* _TimeoutDuration.LONG_ACK */ - : 50 /* _TimeoutDuration.ACK */); - } - catch { - // This is a best effort approach. Ignore errors. - } - } - async _isAvailable() { - try { - if (!indexedDB) { - return false; - } - const db = await _openDatabase(); - await _putObject(db, STORAGE_AVAILABLE_KEY, '1'); - await _deleteObject(db, STORAGE_AVAILABLE_KEY); - return true; - } - catch { } - return false; - } - async _withPendingWrite(write) { - this.pendingWrites++; - try { - await write(); - } - finally { - this.pendingWrites--; - } - } - async _set(key, value) { - return this._withPendingWrite(async () => { - await this._withRetries((db) => _putObject(db, key, value)); - this.localCache[key] = value; - return this.notifyServiceWorker(key); - }); - } - async _get(key) { - const obj = (await this._withRetries((db) => getObject(db, key))); - this.localCache[key] = obj; - return obj; - } - async _remove(key) { - return this._withPendingWrite(async () => { - await this._withRetries((db) => _deleteObject(db, key)); - delete this.localCache[key]; - return this.notifyServiceWorker(key); - }); - } - async _poll() { - // TODO: check if we need to fallback if getAll is not supported - const result = await this._withRetries((db) => { - const getAllRequest = getObjectStore(db, false).getAll(); - return new DBPromise(getAllRequest).toPromise(); - }); - if (!result) { - return []; - } - // If we have pending writes in progress abort, we'll get picked up on the next poll - if (this.pendingWrites !== 0) { - return []; - } - const keys = []; - const keysInResult = new Set(); - if (result.length !== 0) { - for (const { fbase_key: key, value } of result) { - keysInResult.add(key); - if (JSON.stringify(this.localCache[key]) !== JSON.stringify(value)) { - this.notifyListeners(key, value); - keys.push(key); - } - } - } - for (const localKey of Object.keys(this.localCache)) { - if (this.localCache[localKey] && !keysInResult.has(localKey)) { - // Deleted - this.notifyListeners(localKey, null); - keys.push(localKey); - } - } - return keys; - } - notifyListeners(key, newValue) { - this.localCache[key] = newValue; - const listeners = this.listeners[key]; - if (listeners) { - for (const listener of Array.from(listeners)) { - listener(newValue); - } - } - } - startPolling() { - this.stopPolling(); - this.pollTimer = setInterval(async () => this._poll(), _POLLING_INTERVAL_MS); - } - stopPolling() { - if (this.pollTimer) { - clearInterval(this.pollTimer); - this.pollTimer = null; - } - } - _addListener(key, listener) { - if (Object.keys(this.listeners).length === 0) { - this.startPolling(); - } - if (!this.listeners[key]) { - this.listeners[key] = new Set(); - // Populate the cache to avoid spuriously triggering on first poll. - void this._get(key); // This can happen in the background async and we can return immediately. - } - this.listeners[key].add(listener); - } - _removeListener(key, listener) { - if (this.listeners[key]) { - this.listeners[key].delete(listener); - if (this.listeners[key].size === 0) { - delete this.listeners[key]; - } - } - if (Object.keys(this.listeners).length === 0) { - this.stopPolling(); - } - } -} -IndexedDBLocalPersistence.type = 'LOCAL'; -/** - * An implementation of {@link Persistence} of type `LOCAL` using `indexedDB` - * for the underlying storage. - * - * @public - */ -const indexedDBLocalPersistence = IndexedDBLocalPersistence; - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function startSignInPhoneMfa(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaSignIn:start" /* Endpoint.START_MFA_SIGN_IN */, _addTidIfNecessary(auth, request)); -} -function finalizeSignInPhoneMfa(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaSignIn:finalize" /* Endpoint.FINALIZE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request)); -} -function finalizeSignInTotpMfa(auth, request) { - return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaSignIn:finalize" /* Endpoint.FINALIZE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request)); -} - -class MultiFactorAssertionImpl { - constructor(factorId) { - this.factorId = factorId; - } - _process(auth, session, displayName) { - switch (session.type) { - case "enroll" /* MultiFactorSessionType.ENROLL */: - return this._finalizeEnroll(auth, session.credential, displayName); - case "signin" /* MultiFactorSessionType.SIGN_IN */: - return this._finalizeSignIn(auth, session.credential); - default: - return debugFail('unexpected MultiFactorSessionType'); - } - } -} - -/** - * Provider for generating a {@link TotpMultiFactorAssertion}. - * - * @public - */ -class TotpMultiFactorGenerator { - /** - * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of - * the TOTP (time-based one-time password) second factor. - * This assertion is used to complete enrollment in TOTP second factor. - * - * @param secret A {@link TotpSecret} containing the shared secret key and other TOTP parameters. - * @param oneTimePassword One-time password from TOTP App. - * @returns A {@link TotpMultiFactorAssertion} which can be used with - * {@link MultiFactorUser.enroll}. - */ - static assertionForEnrollment(secret, oneTimePassword) { - return TotpMultiFactorAssertionImpl._fromSecret(secret, oneTimePassword); - } - /** - * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of the TOTP second factor. - * This assertion is used to complete signIn with TOTP as the second factor. - * - * @param enrollmentId identifies the enrolled TOTP second factor. - * @param oneTimePassword One-time password from TOTP App. - * @returns A {@link TotpMultiFactorAssertion} which can be used with - * {@link MultiFactorResolver.resolveSignIn}. - */ - static assertionForSignIn(enrollmentId, oneTimePassword) { - return TotpMultiFactorAssertionImpl._fromEnrollmentId(enrollmentId, oneTimePassword); - } - /** - * Returns a promise to {@link TotpSecret} which contains the TOTP shared secret key and other parameters. - * 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 {@link MultiFactorSession} that the user is part of. - * @returns A promise to {@link TotpSecret}. - */ - static async generateSecret(session) { - const mfaSession = session; - _assert(typeof mfaSession.user?.auth !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */); - const response = await startEnrollTotpMfa(mfaSession.user.auth, { - idToken: mfaSession.credential, - totpEnrollmentInfo: {} - }); - return TotpSecret._fromStartTotpMfaEnrollmentResponse(response, mfaSession.user.auth); - } -} -/** - * The identifier of the TOTP second factor: `totp`. - */ -TotpMultiFactorGenerator.FACTOR_ID = "totp" /* FactorId.TOTP */; -class TotpMultiFactorAssertionImpl extends MultiFactorAssertionImpl { - constructor(otp, enrollmentId, secret) { - super("totp" /* FactorId.TOTP */); - this.otp = otp; - this.enrollmentId = enrollmentId; - this.secret = secret; - } - /** @internal */ - static _fromSecret(secret, otp) { - return new TotpMultiFactorAssertionImpl(otp, undefined, secret); - } - /** @internal */ - static _fromEnrollmentId(enrollmentId, otp) { - return new TotpMultiFactorAssertionImpl(otp, enrollmentId); - } - /** @internal */ - async _finalizeEnroll(auth, idToken, displayName) { - _assert(typeof this.secret !== 'undefined', auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - return finalizeEnrollTotpMfa(auth, { - idToken, - displayName, - totpVerificationInfo: this.secret._makeTotpVerificationInfo(this.otp) - }); - } - /** @internal */ - async _finalizeSignIn(auth, mfaPendingCredential) { - _assert(this.enrollmentId !== undefined && this.otp !== undefined, auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */); - const totpVerificationInfo = { verificationCode: this.otp }; - return finalizeSignInTotpMfa(auth, { - mfaPendingCredential, - mfaEnrollmentId: this.enrollmentId, - totpVerificationInfo - }); - } -} -/** - * Provider for generating a {@link TotpMultiFactorAssertion}. - * - * Stores the shared secret key and other parameters to generate time-based OTPs. - * Implements methods to retrieve the shared secret key and generate a QR code URL. - * @public - */ -class TotpSecret { - // The public members are declared outside the constructor so the docs can be generated. - constructor(secretKey, hashingAlgorithm, codeLength, codeIntervalSeconds, enrollmentCompletionDeadline, sessionInfo, auth) { - this.sessionInfo = sessionInfo; - this.auth = auth; - this.secretKey = secretKey; - this.hashingAlgorithm = hashingAlgorithm; - this.codeLength = codeLength; - this.codeIntervalSeconds = codeIntervalSeconds; - this.enrollmentCompletionDeadline = enrollmentCompletionDeadline; - } - /** @internal */ - static _fromStartTotpMfaEnrollmentResponse(response, auth) { - return new TotpSecret(response.totpSessionInfo.sharedSecretKey, response.totpSessionInfo.hashingAlgorithm, response.totpSessionInfo.verificationCodeLength, response.totpSessionInfo.periodSec, new Date(response.totpSessionInfo.finalizeEnrollmentTime).toUTCString(), response.totpSessionInfo.sessionInfo, auth); - } - /** @internal */ - _makeTotpVerificationInfo(otp) { - return { sessionInfo: this.sessionInfo, verificationCode: otp }; - } - /** - * Returns a QR code URL as described in - * https://github.com/google/google-authenticator/wiki/Key-Uri-Format - * This can be displayed to the user as a QR code to be scanned into a TOTP app like Google Authenticator. - * If the optional parameters are unspecified, an accountName of <userEmail> and issuer of <firebaseAppName> are used. - * - * @param accountName the name of the account/app along with a user identifier. - * @param issuer issuer of the TOTP (likely the app name). - * @returns A QR code URL string. - */ - generateQrCodeUrl(accountName, issuer) { - let useDefaults = false; - if (_isEmptyString(accountName) || _isEmptyString(issuer)) { - useDefaults = true; - } - if (useDefaults) { - if (_isEmptyString(accountName)) { - accountName = this.auth.currentUser?.email || 'unknownuser'; - } - if (_isEmptyString(issuer)) { - issuer = this.auth.name; - } - } - return `otpauth://totp/${issuer}:${accountName}?secret=${this.secretKey}&issuer=${issuer}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`; - } -} -/** @internal */ -function _isEmptyString(input) { - return typeof input === 'undefined' || input?.length === 0; -} - -var name = "@firebase/auth"; -var version = "1.11.1"; - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -class AuthInterop { - constructor(auth) { - this.auth = auth; - this.internalListeners = new Map(); - } - getUid() { - this.assertAuthConfigured(); - return this.auth.currentUser?.uid || null; - } - async getToken(forceRefresh) { - this.assertAuthConfigured(); - await this.auth._initializationPromise; - if (!this.auth.currentUser) { - return null; - } - const accessToken = await this.auth.currentUser.getIdToken(forceRefresh); - return { accessToken }; - } - addAuthTokenListener(listener) { - this.assertAuthConfigured(); - if (this.internalListeners.has(listener)) { - return; - } - const unsubscribe = this.auth.onIdTokenChanged(user => { - listener(user?.stsTokenManager.accessToken || null); - }); - this.internalListeners.set(listener, unsubscribe); - this.updateProactiveRefresh(); - } - removeAuthTokenListener(listener) { - this.assertAuthConfigured(); - const unsubscribe = this.internalListeners.get(listener); - if (!unsubscribe) { - return; - } - this.internalListeners.delete(listener); - unsubscribe(); - this.updateProactiveRefresh(); - } - assertAuthConfigured() { - _assert(this.auth._initializationPromise, "dependent-sdk-initialized-before-auth" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */); - } - updateProactiveRefresh() { - if (this.internalListeners.size > 0) { - this.auth._startProactiveRefresh(); - } - else { - this.auth._stopProactiveRefresh(); - } - } -} - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function getVersionForPlatform(clientPlatform) { - switch (clientPlatform) { - case "Node" /* ClientPlatform.NODE */: - return 'node'; - case "ReactNative" /* ClientPlatform.REACT_NATIVE */: - return 'rn'; - case "Worker" /* ClientPlatform.WORKER */: - return 'webworker'; - case "Cordova" /* ClientPlatform.CORDOVA */: - return 'cordova'; - case "WebExtension" /* ClientPlatform.WEB_EXTENSION */: - return 'web-extension'; - default: - return undefined; - } -} -/** @internal */ -function registerAuth(clientPlatform) { - _registerComponent(new Component("auth" /* _ComponentName.AUTH */, (container, { options: deps }) => { - const app = container.getProvider('app').getImmediate(); - const heartbeatServiceProvider = container.getProvider('heartbeat'); - const appCheckServiceProvider = container.getProvider('app-check-internal'); - const { apiKey, authDomain } = app.options; - _assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */, { appName: app.name }); - const config = { - apiKey, - authDomain, - clientPlatform, - apiHost: "identitytoolkit.googleapis.com" /* DefaultConfig.API_HOST */, - tokenApiHost: "securetoken.googleapis.com" /* DefaultConfig.TOKEN_API_HOST */, - apiScheme: "https" /* DefaultConfig.API_SCHEME */, - sdkClientVersion: _getClientVersion(clientPlatform) - }; - const authInstance = new AuthImpl(app, heartbeatServiceProvider, appCheckServiceProvider, config); - _initializeAuthInstance(authInstance, deps); - return authInstance; - }, "PUBLIC" /* ComponentType.PUBLIC */) - /** - * Auth can only be initialized by explicitly calling getAuth() or initializeAuth() - * For why we do this, See go/firebase-next-auth-init - */ - .setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */) - /** - * Because all firebase products that depend on auth depend on auth-internal directly, - * we need to initialize auth-internal after auth is initialized to make it available to other firebase products. - */ - .setInstanceCreatedCallback((container, _instanceIdentifier, _instance) => { - const authInternalProvider = container.getProvider("auth-internal" /* _ComponentName.AUTH_INTERNAL */); - authInternalProvider.initialize(); - })); - _registerComponent(new Component("auth-internal" /* _ComponentName.AUTH_INTERNAL */, container => { - const auth = _castAuth(container.getProvider("auth" /* _ComponentName.AUTH */).getImmediate()); - return (auth => new AuthInterop(auth))(auth); - }, "PRIVATE" /* ComponentType.PRIVATE */).setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */)); - registerVersion(name, version, getVersionForPlatform(clientPlatform)); - // BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation - registerVersion(name, version, 'esm2020'); -} - -export { updateEmail as $, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as A, linkWithCredential as B, reauthenticateWithCredential as C, signInWithCustomToken as D, EmailAuthCredential as E, FacebookAuthProvider as F, GoogleAuthProvider as G, sendPasswordResetEmail as H, confirmPasswordReset as I, applyActionCode as J, checkActionCode as K, verifyPasswordResetCode as L, createUserWithEmailAndPassword as M, signInWithEmailAndPassword as N, OAuthCredential as O, PhoneAuthCredential as P, sendSignInLinkToEmail as Q, isSignInWithEmailLink as R, SAMLAuthProvider as S, TotpMultiFactorGenerator as T, signInWithEmailLink as U, fetchSignInMethodsForEmail as V, sendEmailVerification as W, verifyBeforeUpdateEmail as X, ActionCodeURL as Y, parseActionCodeURL as Z, updateProfile as _, indexedDBLocalPersistence as a, FetchProvider as a$, updatePassword as a0, getIdToken as a1, getIdTokenResult as a2, unlink as a3, getAdditionalUserInfo as a4, reload as a5, getMultiFactorResolver as a6, multiFactor as a7, STORAGE_AVAILABLE_KEY as a8, _isMobileBrowser as a9, signInWithIdp as aA, _fail as aB, debugAssert as aC, _assertInstanceOf as aD, _generateEventId as aE, FederatedAuthProvider as aF, _persistenceKeyName as aG, _performApiRequest as aH, _getCurrentUrl as aI, _gapiScriptUrl as aJ, _emulatorUrl as aK, _isChromeIOS as aL, _isFirefox as aM, _isIOSStandalone as aN, BaseOAuthProvider as aO, _setWindowLocation as aP, _isSafari as aQ, _isIOS as aR, MultiFactorAssertionImpl as aS, finalizeEnrollPhoneMfa as aT, finalizeSignInPhoneMfa as aU, _setExternalJSProvider as aV, _isAndroid as aW, _isIOS7Or8 as aX, UserImpl as aY, AuthImpl as aZ, _getClientVersion as a_, _isIE10 as aa, Delay as ab, _window as ac, _assert as ad, isV2 as ae, _createError as af, _recaptchaV2ScriptUrl as ag, _loadJS as ah, MockReCaptcha as ai, _generateCallbackName as aj, _castAuth as ak, _isHttpOrHttps as al, _isWorker as am, getRecaptchaParams as an, _serverAppCurrentUserOperationNotSupportedError as ao, _assertLinkedStatus as ap, _initializeRecaptchaConfig as aq, FAKE_TOKEN as ar, startEnrollPhoneMfa as as, handleRecaptchaFlow as at, startSignInPhoneMfa as au, sendPhoneVerificationCode as av, _link as aw, _getInstance as ax, _signInWithCredential as ay, _reauthenticate as az, TotpSecret as b, SAMLAuthCredential as b0, connectAuthEmulator as c, initializeRecaptchaConfig as d, beforeAuthStateChanged as e, onAuthStateChanged as f, updateCurrentUser as g, signOut as h, initializeAuth as i, revokeAccessToken as j, deleteUser as k, debugErrorMap as l, AuthCredential as m, inMemoryPersistence as n, onIdTokenChanged as o, prodErrorMap as p, EmailAuthProvider as q, registerAuth as r, setPersistence as s, GithubAuthProvider as t, useDeviceLanguage as u, validatePassword as v, OAuthProvider as w, TwitterAuthProvider as x, signInAnonymously as y, signInWithCredential as z }; -//# sourceMappingURL=register-7993b7af.js.map diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/register-7993b7af.js.map b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/register-7993b7af.js.map deleted file mode 100644 index 09c13b1..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/register-7993b7af.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"register-7993b7af.js","sources":["../../src/core/errors.ts","../../src/core/util/log.ts","../../src/core/util/assert.ts","../../src/core/util/location.ts","../../src/core/util/navigator.ts","../../src/core/util/delay.ts","../../src/core/util/emulator.ts","../../src/core/util/fetch_provider.ts","../../src/api/errors.ts","../../src/api/index.ts","../../src/platform_browser/recaptcha/recaptcha.ts","../../src/api/authentication/recaptcha.ts","../../src/api/account_management/account.ts","../../src/core/util/time.ts","../../src/core/user/id_token_result.ts","../../src/core/user/invalidation.ts","../../src/core/user/proactive_refresh.ts","../../src/core/user/user_metadata.ts","../../src/core/user/reload.ts","../../src/api/authentication/token.ts","../../src/core/user/token_manager.ts","../../src/core/user/user_impl.ts","../../src/core/util/instantiator.ts","../../src/core/persistence/in_memory.ts","../../src/core/persistence/persistence_user_manager.ts","../../src/core/util/browser.ts","../../src/core/util/version.ts","../../src/core/auth/middleware.ts","../../src/api/password_policy/get_password_policy.ts","../../src/core/auth/password_policy_impl.ts","../../src/core/auth/auth_impl.ts","../../src/platform_browser/load_js.ts","../../src/platform_browser/recaptcha/recaptcha_mock.ts","../../src/platform_browser/recaptcha/recaptcha_enterprise_verifier.ts","../../src/core/auth/initialize.ts","../../src/core/auth/emulator.ts","../../src/core/credentials/auth_credential.ts","../../src/api/account_management/email_and_password.ts","../../src/api/authentication/email_and_password.ts","../../src/api/authentication/email_link.ts","../../src/core/credentials/email.ts","../../src/api/authentication/idp.ts","../../src/core/credentials/oauth.ts","../../src/api/authentication/sms.ts","../../src/core/credentials/phone.ts","../../src/core/action_code_url.ts","../../src/core/providers/email.ts","../../src/core/providers/federated.ts","../../src/core/providers/oauth.ts","../../src/core/providers/facebook.ts","../../src/core/providers/google.ts","../../src/core/providers/github.ts","../../src/core/credentials/saml.ts","../../src/core/providers/saml.ts","../../src/core/providers/twitter.ts","../../src/api/authentication/sign_up.ts","../../src/core/user/user_credential_impl.ts","../../src/core/strategies/anonymous.ts","../../src/mfa/mfa_error.ts","../../src/core/util/providers.ts","../../src/core/user/link_unlink.ts","../../src/core/user/reauthenticate.ts","../../src/core/strategies/credential.ts","../../src/api/authentication/custom_token.ts","../../src/core/strategies/custom_token.ts","../../src/mfa/mfa_info.ts","../../src/core/strategies/action_code_settings.ts","../../src/core/strategies/email_and_password.ts","../../src/core/strategies/email_link.ts","../../src/api/authentication/create_auth_uri.ts","../../src/core/strategies/email.ts","../../src/api/account_management/profile.ts","../../src/core/user/account_info.ts","../../src/core/user/additional_user_info.ts","../../src/core/index.ts","../../src/mfa/mfa_session.ts","../../src/mfa/mfa_resolver.ts","../../src/api/account_management/mfa.ts","../../src/mfa/mfa_user.ts","../../src/core/persistence/index.ts","../../src/platform_browser/messagechannel/promise.ts","../../src/platform_browser/messagechannel/receiver.ts","../../src/core/util/event_id.ts","../../src/platform_browser/messagechannel/sender.ts","../../src/platform_browser/auth_window.ts","../../src/platform_browser/util/worker.ts","../../src/platform_browser/persistence/indexed_db.ts","../../src/api/authentication/mfa.ts","../../src/mfa/mfa_assertion.ts","../../src/mfa/assertions/totp.ts","../../src/core/auth/firebase_internal.ts","../../src/core/auth/register.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AuthErrorMap, User } from '../model/public_types';\nimport { ErrorFactory, ErrorMap } from '@firebase/util';\n\nimport { IdTokenMfaResponse } from '../api/authentication/mfa';\nimport { AppName } from '../model/auth';\nimport { AuthCredential } from './credentials';\n\n/**\n * Enumeration of Firebase Auth error codes.\n *\n * @internal\n */\nexport const enum AuthErrorCode {\n ADMIN_ONLY_OPERATION = 'admin-restricted-operation',\n ARGUMENT_ERROR = 'argument-error',\n APP_NOT_AUTHORIZED = 'app-not-authorized',\n APP_NOT_INSTALLED = 'app-not-installed',\n CAPTCHA_CHECK_FAILED = 'captcha-check-failed',\n CODE_EXPIRED = 'code-expired',\n CORDOVA_NOT_READY = 'cordova-not-ready',\n CORS_UNSUPPORTED = 'cors-unsupported',\n CREDENTIAL_ALREADY_IN_USE = 'credential-already-in-use',\n CREDENTIAL_MISMATCH = 'custom-token-mismatch',\n CREDENTIAL_TOO_OLD_LOGIN_AGAIN = 'requires-recent-login',\n DEPENDENT_SDK_INIT_BEFORE_AUTH = 'dependent-sdk-initialized-before-auth',\n DYNAMIC_LINK_NOT_ACTIVATED = 'dynamic-link-not-activated',\n EMAIL_CHANGE_NEEDS_VERIFICATION = 'email-change-needs-verification',\n EMAIL_EXISTS = 'email-already-in-use',\n EMULATOR_CONFIG_FAILED = 'emulator-config-failed',\n EXPIRED_OOB_CODE = 'expired-action-code',\n EXPIRED_POPUP_REQUEST = 'cancelled-popup-request',\n INTERNAL_ERROR = 'internal-error',\n INVALID_API_KEY = 'invalid-api-key',\n INVALID_APP_CREDENTIAL = 'invalid-app-credential',\n INVALID_APP_ID = 'invalid-app-id',\n INVALID_AUTH = 'invalid-user-token',\n INVALID_AUTH_EVENT = 'invalid-auth-event',\n INVALID_CERT_HASH = 'invalid-cert-hash',\n INVALID_CODE = 'invalid-verification-code',\n INVALID_CONTINUE_URI = 'invalid-continue-uri',\n INVALID_CORDOVA_CONFIGURATION = 'invalid-cordova-configuration',\n INVALID_CUSTOM_TOKEN = 'invalid-custom-token',\n INVALID_DYNAMIC_LINK_DOMAIN = 'invalid-dynamic-link-domain',\n INVALID_EMAIL = 'invalid-email',\n INVALID_EMULATOR_SCHEME = 'invalid-emulator-scheme',\n INVALID_CREDENTIAL = 'invalid-credential',\n INVALID_MESSAGE_PAYLOAD = 'invalid-message-payload',\n INVALID_MFA_SESSION = 'invalid-multi-factor-session',\n INVALID_OAUTH_CLIENT_ID = 'invalid-oauth-client-id',\n INVALID_OAUTH_PROVIDER = 'invalid-oauth-provider',\n INVALID_OOB_CODE = 'invalid-action-code',\n INVALID_ORIGIN = 'unauthorized-domain',\n INVALID_PASSWORD = 'wrong-password',\n INVALID_PERSISTENCE = 'invalid-persistence-type',\n INVALID_PHONE_NUMBER = 'invalid-phone-number',\n INVALID_PROVIDER_ID = 'invalid-provider-id',\n INVALID_RECIPIENT_EMAIL = 'invalid-recipient-email',\n INVALID_SENDER = 'invalid-sender',\n INVALID_SESSION_INFO = 'invalid-verification-id',\n INVALID_TENANT_ID = 'invalid-tenant-id',\n LOGIN_BLOCKED = 'login-blocked',\n MFA_INFO_NOT_FOUND = 'multi-factor-info-not-found',\n MFA_REQUIRED = 'multi-factor-auth-required',\n MISSING_ANDROID_PACKAGE_NAME = 'missing-android-pkg-name',\n MISSING_APP_CREDENTIAL = 'missing-app-credential',\n MISSING_AUTH_DOMAIN = 'auth-domain-config-required',\n MISSING_CODE = 'missing-verification-code',\n MISSING_CONTINUE_URI = 'missing-continue-uri',\n MISSING_IFRAME_START = 'missing-iframe-start',\n MISSING_IOS_BUNDLE_ID = 'missing-ios-bundle-id',\n MISSING_OR_INVALID_NONCE = 'missing-or-invalid-nonce',\n MISSING_MFA_INFO = 'missing-multi-factor-info',\n MISSING_MFA_SESSION = 'missing-multi-factor-session',\n MISSING_PHONE_NUMBER = 'missing-phone-number',\n MISSING_PASSWORD = 'missing-password',\n MISSING_SESSION_INFO = 'missing-verification-id',\n MODULE_DESTROYED = 'app-deleted',\n NEED_CONFIRMATION = 'account-exists-with-different-credential',\n NETWORK_REQUEST_FAILED = 'network-request-failed',\n NULL_USER = 'null-user',\n NO_AUTH_EVENT = 'no-auth-event',\n NO_SUCH_PROVIDER = 'no-such-provider',\n OPERATION_NOT_ALLOWED = 'operation-not-allowed',\n OPERATION_NOT_SUPPORTED = 'operation-not-supported-in-this-environment',\n POPUP_BLOCKED = 'popup-blocked',\n POPUP_CLOSED_BY_USER = 'popup-closed-by-user',\n PROVIDER_ALREADY_LINKED = 'provider-already-linked',\n QUOTA_EXCEEDED = 'quota-exceeded',\n REDIRECT_CANCELLED_BY_USER = 'redirect-cancelled-by-user',\n REDIRECT_OPERATION_PENDING = 'redirect-operation-pending',\n REJECTED_CREDENTIAL = 'rejected-credential',\n SECOND_FACTOR_ALREADY_ENROLLED = 'second-factor-already-in-use',\n SECOND_FACTOR_LIMIT_EXCEEDED = 'maximum-second-factor-count-exceeded',\n TENANT_ID_MISMATCH = 'tenant-id-mismatch',\n TIMEOUT = 'timeout',\n TOKEN_EXPIRED = 'user-token-expired',\n TOO_MANY_ATTEMPTS_TRY_LATER = 'too-many-requests',\n UNAUTHORIZED_DOMAIN = 'unauthorized-continue-uri',\n UNSUPPORTED_FIRST_FACTOR = 'unsupported-first-factor',\n UNSUPPORTED_PERSISTENCE = 'unsupported-persistence-type',\n UNSUPPORTED_TENANT_OPERATION = 'unsupported-tenant-operation',\n UNVERIFIED_EMAIL = 'unverified-email',\n USER_CANCELLED = 'user-cancelled',\n USER_DELETED = 'user-not-found',\n USER_DISABLED = 'user-disabled',\n USER_MISMATCH = 'user-mismatch',\n USER_SIGNED_OUT = 'user-signed-out',\n WEAK_PASSWORD = 'weak-password',\n WEB_STORAGE_UNSUPPORTED = 'web-storage-unsupported',\n ALREADY_INITIALIZED = 'already-initialized',\n RECAPTCHA_NOT_ENABLED = 'recaptcha-not-enabled',\n MISSING_RECAPTCHA_TOKEN = 'missing-recaptcha-token',\n INVALID_RECAPTCHA_TOKEN = 'invalid-recaptcha-token',\n INVALID_RECAPTCHA_ACTION = 'invalid-recaptcha-action',\n MISSING_CLIENT_TYPE = 'missing-client-type',\n MISSING_RECAPTCHA_VERSION = 'missing-recaptcha-version',\n INVALID_RECAPTCHA_VERSION = 'invalid-recaptcha-version',\n INVALID_REQ_TYPE = 'invalid-req-type',\n UNSUPPORTED_PASSWORD_POLICY_SCHEMA_VERSION = 'unsupported-password-policy-schema-version',\n PASSWORD_DOES_NOT_MEET_REQUIREMENTS = 'password-does-not-meet-requirements',\n INVALID_HOSTING_LINK_DOMAIN = 'invalid-hosting-link-domain'\n}\n\nfunction _debugErrorMap(): ErrorMap<AuthErrorCode> {\n return {\n [AuthErrorCode.ADMIN_ONLY_OPERATION]:\n 'This operation is restricted to administrators only.',\n [AuthErrorCode.ARGUMENT_ERROR]: '',\n [AuthErrorCode.APP_NOT_AUTHORIZED]:\n \"This app, identified by the domain where it's hosted, is not \" +\n 'authorized to use Firebase Authentication with the provided API key. ' +\n 'Review your key configuration in the Google API console.',\n [AuthErrorCode.APP_NOT_INSTALLED]:\n 'The requested mobile application corresponding to the identifier (' +\n 'Android package name or iOS bundle ID) provided is not installed on ' +\n 'this device.',\n [AuthErrorCode.CAPTCHA_CHECK_FAILED]:\n 'The reCAPTCHA response token provided is either invalid, expired, ' +\n 'already used or the domain associated with it does not match the list ' +\n 'of whitelisted domains.',\n [AuthErrorCode.CODE_EXPIRED]:\n 'The SMS code has expired. Please re-send the verification code to try ' +\n 'again.',\n [AuthErrorCode.CORDOVA_NOT_READY]: 'Cordova framework is not ready.',\n [AuthErrorCode.CORS_UNSUPPORTED]: 'This browser is not supported.',\n [AuthErrorCode.CREDENTIAL_ALREADY_IN_USE]:\n 'This credential is already associated with a different user account.',\n [AuthErrorCode.CREDENTIAL_MISMATCH]:\n 'The custom token corresponds to a different audience.',\n [AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN]:\n 'This operation is sensitive and requires recent authentication. Log in ' +\n 'again before retrying this request.',\n [AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH]:\n 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +\n 'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +\n 'starting any other Firebase SDK.',\n [AuthErrorCode.DYNAMIC_LINK_NOT_ACTIVATED]:\n 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' +\n 'conditions.',\n [AuthErrorCode.EMAIL_CHANGE_NEEDS_VERIFICATION]:\n 'Multi-factor users must always have a verified email.',\n [AuthErrorCode.EMAIL_EXISTS]:\n 'The email address is already in use by another account.',\n [AuthErrorCode.EMULATOR_CONFIG_FAILED]:\n 'Auth instance has already been used to make a network call. Auth can ' +\n 'no longer be configured to use the emulator. Try calling ' +\n '\"connectAuthEmulator()\" sooner.',\n [AuthErrorCode.EXPIRED_OOB_CODE]: 'The action code has expired.',\n [AuthErrorCode.EXPIRED_POPUP_REQUEST]:\n 'This operation has been cancelled due to another conflicting popup being opened.',\n [AuthErrorCode.INTERNAL_ERROR]: 'An internal AuthError has occurred.',\n [AuthErrorCode.INVALID_APP_CREDENTIAL]:\n 'The phone verification request contains an invalid application verifier.' +\n ' The reCAPTCHA token response is either invalid or expired.',\n [AuthErrorCode.INVALID_APP_ID]:\n 'The mobile app identifier is not registered for the current project.',\n [AuthErrorCode.INVALID_AUTH]:\n \"This user's credential isn't valid for this project. This can happen \" +\n \"if the user's token has been tampered with, or if the user isn't for \" +\n 'the project associated with this API key.',\n [AuthErrorCode.INVALID_AUTH_EVENT]: 'An internal AuthError has occurred.',\n [AuthErrorCode.INVALID_CODE]:\n 'The SMS verification code used to create the phone auth credential is ' +\n 'invalid. Please resend the verification code sms and be sure to use the ' +\n 'verification code provided by the user.',\n [AuthErrorCode.INVALID_CONTINUE_URI]:\n 'The continue URL provided in the request is invalid.',\n [AuthErrorCode.INVALID_CORDOVA_CONFIGURATION]:\n 'The following Cordova plugins must be installed to enable OAuth sign-in: ' +\n 'cordova-plugin-buildinfo, cordova-universal-links-plugin, ' +\n 'cordova-plugin-browsertab, cordova-plugin-inappbrowser and ' +\n 'cordova-plugin-customurlscheme.',\n [AuthErrorCode.INVALID_CUSTOM_TOKEN]:\n 'The custom token format is incorrect. Please check the documentation.',\n [AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN]:\n 'The provided dynamic link domain is not configured or authorized for the current project.',\n [AuthErrorCode.INVALID_EMAIL]: 'The email address is badly formatted.',\n [AuthErrorCode.INVALID_EMULATOR_SCHEME]:\n 'Emulator URL must start with a valid scheme (http:// or https://).',\n [AuthErrorCode.INVALID_API_KEY]:\n 'Your API key is invalid, please check you have copied it correctly.',\n [AuthErrorCode.INVALID_CERT_HASH]:\n 'The SHA-1 certificate hash provided is invalid.',\n [AuthErrorCode.INVALID_CREDENTIAL]:\n 'The supplied auth credential is incorrect, malformed or has expired.',\n [AuthErrorCode.INVALID_MESSAGE_PAYLOAD]:\n 'The email template corresponding to this action contains invalid characters in its message. ' +\n 'Please fix by going to the Auth email templates section in the Firebase Console.',\n [AuthErrorCode.INVALID_MFA_SESSION]:\n 'The request does not contain a valid proof of first factor successful sign-in.',\n [AuthErrorCode.INVALID_OAUTH_PROVIDER]:\n 'EmailAuthProvider is not supported for this operation. This operation ' +\n 'only supports OAuth providers.',\n [AuthErrorCode.INVALID_OAUTH_CLIENT_ID]:\n 'The OAuth client ID provided is either invalid or does not match the ' +\n 'specified API key.',\n [AuthErrorCode.INVALID_ORIGIN]:\n 'This domain is not authorized for OAuth operations for your Firebase ' +\n 'project. Edit the list of authorized domains from the Firebase console.',\n [AuthErrorCode.INVALID_OOB_CODE]:\n 'The action code is invalid. This can happen if the code is malformed, ' +\n 'expired, or has already been used.',\n [AuthErrorCode.INVALID_PASSWORD]:\n 'The password is invalid or the user does not have a password.',\n [AuthErrorCode.INVALID_PERSISTENCE]:\n 'The specified persistence type is invalid. It can only be local, session or none.',\n [AuthErrorCode.INVALID_PHONE_NUMBER]:\n 'The format of the phone number provided is incorrect. Please enter the ' +\n 'phone number in a format that can be parsed into E.164 format. E.164 ' +\n 'phone numbers are written in the format [+][country code][subscriber ' +\n 'number including area code].',\n [AuthErrorCode.INVALID_PROVIDER_ID]:\n 'The specified provider ID is invalid.',\n [AuthErrorCode.INVALID_RECIPIENT_EMAIL]:\n 'The email corresponding to this action failed to send as the provided ' +\n 'recipient email address is invalid.',\n [AuthErrorCode.INVALID_SENDER]:\n 'The email template corresponding to this action contains an invalid sender email or name. ' +\n 'Please fix by going to the Auth email templates section in the Firebase Console.',\n [AuthErrorCode.INVALID_SESSION_INFO]:\n 'The verification ID used to create the phone auth credential is invalid.',\n [AuthErrorCode.INVALID_TENANT_ID]:\n \"The Auth instance's tenant ID is invalid.\",\n [AuthErrorCode.LOGIN_BLOCKED]:\n 'Login blocked by user-provided method: {$originalMessage}',\n [AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME]:\n 'An Android Package Name must be provided if the Android App is required to be installed.',\n [AuthErrorCode.MISSING_AUTH_DOMAIN]:\n 'Be sure to include authDomain when calling firebase.initializeApp(), ' +\n 'by following the instructions in the Firebase console.',\n [AuthErrorCode.MISSING_APP_CREDENTIAL]:\n 'The phone verification request is missing an application verifier ' +\n 'assertion. A reCAPTCHA response token needs to be provided.',\n [AuthErrorCode.MISSING_CODE]:\n 'The phone auth credential was created with an empty SMS verification code.',\n [AuthErrorCode.MISSING_CONTINUE_URI]:\n 'A continue URL must be provided in the request.',\n [AuthErrorCode.MISSING_IFRAME_START]: 'An internal AuthError has occurred.',\n [AuthErrorCode.MISSING_IOS_BUNDLE_ID]:\n 'An iOS Bundle ID must be provided if an App Store ID is provided.',\n [AuthErrorCode.MISSING_OR_INVALID_NONCE]:\n 'The request does not contain a valid nonce. This can occur if the ' +\n 'SHA-256 hash of the provided raw nonce does not match the hashed nonce ' +\n 'in the ID token payload.',\n [AuthErrorCode.MISSING_PASSWORD]: 'A non-empty password must be provided',\n [AuthErrorCode.MISSING_MFA_INFO]:\n 'No second factor identifier is provided.',\n [AuthErrorCode.MISSING_MFA_SESSION]:\n 'The request is missing proof of first factor successful sign-in.',\n [AuthErrorCode.MISSING_PHONE_NUMBER]:\n 'To send verification codes, provide a phone number for the recipient.',\n [AuthErrorCode.MISSING_SESSION_INFO]:\n 'The phone auth credential was created with an empty verification ID.',\n [AuthErrorCode.MODULE_DESTROYED]:\n 'This instance of FirebaseApp has been deleted.',\n [AuthErrorCode.MFA_INFO_NOT_FOUND]:\n 'The user does not have a second factor matching the identifier provided.',\n [AuthErrorCode.MFA_REQUIRED]:\n 'Proof of ownership of a second factor is required to complete sign-in.',\n [AuthErrorCode.NEED_CONFIRMATION]:\n 'An account already exists with the same email address but different ' +\n 'sign-in credentials. Sign in using a provider associated with this ' +\n 'email address.',\n [AuthErrorCode.NETWORK_REQUEST_FAILED]:\n 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',\n [AuthErrorCode.NO_AUTH_EVENT]: 'An internal AuthError has occurred.',\n [AuthErrorCode.NO_SUCH_PROVIDER]:\n 'User was not linked to an account with the given provider.',\n [AuthErrorCode.NULL_USER]:\n 'A null user object was provided as the argument for an operation which ' +\n 'requires a non-null user object.',\n [AuthErrorCode.OPERATION_NOT_ALLOWED]:\n 'The given sign-in provider is disabled for this Firebase project. ' +\n 'Enable it in the Firebase console, under the sign-in method tab of the ' +\n 'Auth section.',\n [AuthErrorCode.OPERATION_NOT_SUPPORTED]:\n 'This operation is not supported in the environment this application is ' +\n 'running on. \"location.protocol\" must be http, https or chrome-extension' +\n ' and web storage must be enabled.',\n [AuthErrorCode.POPUP_BLOCKED]:\n 'Unable to establish a connection with the popup. It may have been blocked by the browser.',\n [AuthErrorCode.POPUP_CLOSED_BY_USER]:\n 'The popup has been closed by the user before finalizing the operation.',\n [AuthErrorCode.PROVIDER_ALREADY_LINKED]:\n 'User can only be linked to one identity for the given provider.',\n [AuthErrorCode.QUOTA_EXCEEDED]:\n \"The project's quota for this operation has been exceeded.\",\n [AuthErrorCode.REDIRECT_CANCELLED_BY_USER]:\n 'The redirect operation has been cancelled by the user before finalizing.',\n [AuthErrorCode.REDIRECT_OPERATION_PENDING]:\n 'A redirect sign-in operation is already pending.',\n [AuthErrorCode.REJECTED_CREDENTIAL]:\n 'The request contains malformed or mismatching credentials.',\n [AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED]:\n 'The second factor is already enrolled on this account.',\n [AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED]:\n 'The maximum allowed number of second factors on a user has been exceeded.',\n [AuthErrorCode.TENANT_ID_MISMATCH]:\n \"The provided tenant ID does not match the Auth instance's tenant ID\",\n [AuthErrorCode.TIMEOUT]: 'The operation has timed out.',\n [AuthErrorCode.TOKEN_EXPIRED]:\n \"The user's credential is no longer valid. The user must sign in again.\",\n [AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER]:\n 'We have blocked all requests from this device due to unusual activity. ' +\n 'Try again later.',\n [AuthErrorCode.UNAUTHORIZED_DOMAIN]:\n 'The domain of the continue URL is not whitelisted. Please whitelist ' +\n 'the domain in the Firebase console.',\n [AuthErrorCode.UNSUPPORTED_FIRST_FACTOR]:\n 'Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.',\n [AuthErrorCode.UNSUPPORTED_PERSISTENCE]:\n 'The current environment does not support the specified persistence type.',\n [AuthErrorCode.UNSUPPORTED_TENANT_OPERATION]:\n 'This operation is not supported in a multi-tenant context.',\n [AuthErrorCode.UNVERIFIED_EMAIL]:\n 'The operation requires a verified email.',\n [AuthErrorCode.USER_CANCELLED]:\n 'The user did not grant your application the permissions it requested.',\n [AuthErrorCode.USER_DELETED]:\n 'There is no user record corresponding to this identifier. The user may ' +\n 'have been deleted.',\n [AuthErrorCode.USER_DISABLED]:\n 'The user account has been disabled by an administrator.',\n [AuthErrorCode.USER_MISMATCH]:\n 'The supplied credentials do not correspond to the previously signed in user.',\n [AuthErrorCode.USER_SIGNED_OUT]: '',\n [AuthErrorCode.WEAK_PASSWORD]:\n 'The password must be 6 characters long or more.',\n [AuthErrorCode.WEB_STORAGE_UNSUPPORTED]:\n 'This browser is not supported or 3rd party cookies and data may be disabled.',\n [AuthErrorCode.ALREADY_INITIALIZED]:\n 'initializeAuth() has already been called with ' +\n 'different options. To avoid this error, call initializeAuth() with the ' +\n 'same options as when it was originally called, or call getAuth() to return the' +\n ' already initialized instance.',\n [AuthErrorCode.MISSING_RECAPTCHA_TOKEN]:\n 'The reCAPTCHA token is missing when sending request to the backend.',\n [AuthErrorCode.INVALID_RECAPTCHA_TOKEN]:\n 'The reCAPTCHA token is invalid when sending request to the backend.',\n [AuthErrorCode.INVALID_RECAPTCHA_ACTION]:\n 'The reCAPTCHA action is invalid when sending request to the backend.',\n [AuthErrorCode.RECAPTCHA_NOT_ENABLED]:\n 'reCAPTCHA Enterprise integration is not enabled for this project.',\n [AuthErrorCode.MISSING_CLIENT_TYPE]:\n 'The reCAPTCHA client type is missing when sending request to the backend.',\n [AuthErrorCode.MISSING_RECAPTCHA_VERSION]:\n 'The reCAPTCHA version is missing when sending request to the backend.',\n [AuthErrorCode.INVALID_REQ_TYPE]: 'Invalid request parameters.',\n [AuthErrorCode.INVALID_RECAPTCHA_VERSION]:\n 'The reCAPTCHA version is invalid when sending request to the backend.',\n [AuthErrorCode.UNSUPPORTED_PASSWORD_POLICY_SCHEMA_VERSION]:\n 'The password policy received from the backend uses a schema version that is not supported by this version of the Firebase SDK.',\n [AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS]:\n 'The password does not meet the requirements.',\n [AuthErrorCode.INVALID_HOSTING_LINK_DOMAIN]:\n 'The provided Hosting link domain is not configured in Firebase Hosting or is not owned by ' +\n 'the current project. This cannot be a default Hosting domain (`web.app` or `firebaseapp.com`).'\n };\n}\n\nexport interface ErrorMapRetriever extends AuthErrorMap {\n (): ErrorMap<AuthErrorCode>;\n}\n\nfunction _prodErrorMap(): ErrorMap<AuthErrorCode> {\n // We will include this one message in the prod error map since by the very\n // nature of this error, developers will never be able to see the message\n // using the debugErrorMap (which is installed during auth initialization).\n return {\n [AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH]:\n 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +\n 'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +\n 'starting any other Firebase SDK.'\n } as ErrorMap<AuthErrorCode>;\n}\n\n/**\n * A verbose error map with detailed descriptions for most error codes.\n *\n * See discussion at {@link AuthErrorMap}\n *\n * @public\n */\nexport const debugErrorMap: AuthErrorMap = _debugErrorMap;\n\n/**\n * A minimal error map with all verbose error messages stripped.\n *\n * See discussion at {@link AuthErrorMap}\n *\n * @public\n */\nexport const prodErrorMap: AuthErrorMap = _prodErrorMap;\n\nexport interface NamedErrorParams {\n appName: AppName;\n credential?: AuthCredential;\n email?: string;\n phoneNumber?: string;\n tenantId?: string;\n user?: User;\n _serverResponse?: object;\n}\n\n/**\n * @internal\n */\ntype GenericAuthErrorParams = {\n [key in Exclude<\n AuthErrorCode,\n | AuthErrorCode.ARGUMENT_ERROR\n | AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH\n | AuthErrorCode.INTERNAL_ERROR\n | AuthErrorCode.MFA_REQUIRED\n | AuthErrorCode.NO_AUTH_EVENT\n | AuthErrorCode.OPERATION_NOT_SUPPORTED\n >]: {\n appName?: AppName;\n email?: string;\n phoneNumber?: string;\n message?: string;\n };\n};\n\n/**\n * @internal\n */\nexport interface AuthErrorParams extends GenericAuthErrorParams {\n [AuthErrorCode.ARGUMENT_ERROR]: { appName?: AppName };\n [AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH]: { appName?: AppName };\n [AuthErrorCode.INTERNAL_ERROR]: { appName?: AppName };\n [AuthErrorCode.LOGIN_BLOCKED]: {\n appName?: AppName;\n originalMessage?: string;\n };\n [AuthErrorCode.OPERATION_NOT_SUPPORTED]: { appName?: AppName };\n [AuthErrorCode.NO_AUTH_EVENT]: { appName?: AppName };\n [AuthErrorCode.MFA_REQUIRED]: {\n appName: AppName;\n _serverResponse: IdTokenMfaResponse;\n };\n [AuthErrorCode.INVALID_CORDOVA_CONFIGURATION]: {\n appName: AppName;\n missingPlugin?: string;\n };\n}\n\nexport const _DEFAULT_AUTH_ERROR_FACTORY = new ErrorFactory<\n AuthErrorCode,\n AuthErrorParams\n>('auth', 'Firebase', _prodErrorMap());\n\n/**\n * A map of potential `Auth` error codes, for easier comparison with errors\n * thrown by the SDK.\n *\n * @remarks\n * Note that you can't tree-shake individual keys\n * in the map, so by using the map you might substantially increase your\n * bundle size.\n *\n * @public\n */\nexport const AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY = {\n ADMIN_ONLY_OPERATION: 'auth/admin-restricted-operation',\n ARGUMENT_ERROR: 'auth/argument-error',\n APP_NOT_AUTHORIZED: 'auth/app-not-authorized',\n APP_NOT_INSTALLED: 'auth/app-not-installed',\n CAPTCHA_CHECK_FAILED: 'auth/captcha-check-failed',\n CODE_EXPIRED: 'auth/code-expired',\n CORDOVA_NOT_READY: 'auth/cordova-not-ready',\n CORS_UNSUPPORTED: 'auth/cors-unsupported',\n CREDENTIAL_ALREADY_IN_USE: 'auth/credential-already-in-use',\n CREDENTIAL_MISMATCH: 'auth/custom-token-mismatch',\n CREDENTIAL_TOO_OLD_LOGIN_AGAIN: 'auth/requires-recent-login',\n DEPENDENT_SDK_INIT_BEFORE_AUTH: 'auth/dependent-sdk-initialized-before-auth',\n DYNAMIC_LINK_NOT_ACTIVATED: 'auth/dynamic-link-not-activated',\n EMAIL_CHANGE_NEEDS_VERIFICATION: 'auth/email-change-needs-verification',\n EMAIL_EXISTS: 'auth/email-already-in-use',\n EMULATOR_CONFIG_FAILED: 'auth/emulator-config-failed',\n EXPIRED_OOB_CODE: 'auth/expired-action-code',\n EXPIRED_POPUP_REQUEST: 'auth/cancelled-popup-request',\n INTERNAL_ERROR: 'auth/internal-error',\n INVALID_API_KEY: 'auth/invalid-api-key',\n INVALID_APP_CREDENTIAL: 'auth/invalid-app-credential',\n INVALID_APP_ID: 'auth/invalid-app-id',\n INVALID_AUTH: 'auth/invalid-user-token',\n INVALID_AUTH_EVENT: 'auth/invalid-auth-event',\n INVALID_CERT_HASH: 'auth/invalid-cert-hash',\n INVALID_CODE: 'auth/invalid-verification-code',\n INVALID_CONTINUE_URI: 'auth/invalid-continue-uri',\n INVALID_CORDOVA_CONFIGURATION: 'auth/invalid-cordova-configuration',\n INVALID_CUSTOM_TOKEN: 'auth/invalid-custom-token',\n INVALID_DYNAMIC_LINK_DOMAIN: 'auth/invalid-dynamic-link-domain',\n INVALID_EMAIL: 'auth/invalid-email',\n INVALID_EMULATOR_SCHEME: 'auth/invalid-emulator-scheme',\n INVALID_IDP_RESPONSE: 'auth/invalid-credential',\n INVALID_LOGIN_CREDENTIALS: 'auth/invalid-credential',\n INVALID_MESSAGE_PAYLOAD: 'auth/invalid-message-payload',\n INVALID_MFA_SESSION: 'auth/invalid-multi-factor-session',\n INVALID_OAUTH_CLIENT_ID: 'auth/invalid-oauth-client-id',\n INVALID_OAUTH_PROVIDER: 'auth/invalid-oauth-provider',\n INVALID_OOB_CODE: 'auth/invalid-action-code',\n INVALID_ORIGIN: 'auth/unauthorized-domain',\n INVALID_PASSWORD: 'auth/wrong-password',\n INVALID_PERSISTENCE: 'auth/invalid-persistence-type',\n INVALID_PHONE_NUMBER: 'auth/invalid-phone-number',\n INVALID_PROVIDER_ID: 'auth/invalid-provider-id',\n INVALID_RECIPIENT_EMAIL: 'auth/invalid-recipient-email',\n INVALID_SENDER: 'auth/invalid-sender',\n INVALID_SESSION_INFO: 'auth/invalid-verification-id',\n INVALID_TENANT_ID: 'auth/invalid-tenant-id',\n MFA_INFO_NOT_FOUND: 'auth/multi-factor-info-not-found',\n MFA_REQUIRED: 'auth/multi-factor-auth-required',\n MISSING_ANDROID_PACKAGE_NAME: 'auth/missing-android-pkg-name',\n MISSING_APP_CREDENTIAL: 'auth/missing-app-credential',\n MISSING_AUTH_DOMAIN: 'auth/auth-domain-config-required',\n MISSING_CODE: 'auth/missing-verification-code',\n MISSING_CONTINUE_URI: 'auth/missing-continue-uri',\n MISSING_IFRAME_START: 'auth/missing-iframe-start',\n MISSING_IOS_BUNDLE_ID: 'auth/missing-ios-bundle-id',\n MISSING_OR_INVALID_NONCE: 'auth/missing-or-invalid-nonce',\n MISSING_MFA_INFO: 'auth/missing-multi-factor-info',\n MISSING_MFA_SESSION: 'auth/missing-multi-factor-session',\n MISSING_PHONE_NUMBER: 'auth/missing-phone-number',\n MISSING_PASSWORD: 'auth/missing-password',\n MISSING_SESSION_INFO: 'auth/missing-verification-id',\n MODULE_DESTROYED: 'auth/app-deleted',\n NEED_CONFIRMATION: 'auth/account-exists-with-different-credential',\n NETWORK_REQUEST_FAILED: 'auth/network-request-failed',\n NULL_USER: 'auth/null-user',\n NO_AUTH_EVENT: 'auth/no-auth-event',\n NO_SUCH_PROVIDER: 'auth/no-such-provider',\n OPERATION_NOT_ALLOWED: 'auth/operation-not-allowed',\n OPERATION_NOT_SUPPORTED: 'auth/operation-not-supported-in-this-environment',\n POPUP_BLOCKED: 'auth/popup-blocked',\n POPUP_CLOSED_BY_USER: 'auth/popup-closed-by-user',\n PROVIDER_ALREADY_LINKED: 'auth/provider-already-linked',\n QUOTA_EXCEEDED: 'auth/quota-exceeded',\n REDIRECT_CANCELLED_BY_USER: 'auth/redirect-cancelled-by-user',\n REDIRECT_OPERATION_PENDING: 'auth/redirect-operation-pending',\n REJECTED_CREDENTIAL: 'auth/rejected-credential',\n SECOND_FACTOR_ALREADY_ENROLLED: 'auth/second-factor-already-in-use',\n SECOND_FACTOR_LIMIT_EXCEEDED: 'auth/maximum-second-factor-count-exceeded',\n TENANT_ID_MISMATCH: 'auth/tenant-id-mismatch',\n TIMEOUT: 'auth/timeout',\n TOKEN_EXPIRED: 'auth/user-token-expired',\n TOO_MANY_ATTEMPTS_TRY_LATER: 'auth/too-many-requests',\n UNAUTHORIZED_DOMAIN: 'auth/unauthorized-continue-uri',\n UNSUPPORTED_FIRST_FACTOR: 'auth/unsupported-first-factor',\n UNSUPPORTED_PERSISTENCE: 'auth/unsupported-persistence-type',\n UNSUPPORTED_TENANT_OPERATION: 'auth/unsupported-tenant-operation',\n UNVERIFIED_EMAIL: 'auth/unverified-email',\n USER_CANCELLED: 'auth/user-cancelled',\n USER_DELETED: 'auth/user-not-found',\n USER_DISABLED: 'auth/user-disabled',\n USER_MISMATCH: 'auth/user-mismatch',\n USER_SIGNED_OUT: 'auth/user-signed-out',\n WEAK_PASSWORD: 'auth/weak-password',\n WEB_STORAGE_UNSUPPORTED: 'auth/web-storage-unsupported',\n ALREADY_INITIALIZED: 'auth/already-initialized',\n RECAPTCHA_NOT_ENABLED: 'auth/recaptcha-not-enabled',\n MISSING_RECAPTCHA_TOKEN: 'auth/missing-recaptcha-token',\n INVALID_RECAPTCHA_TOKEN: 'auth/invalid-recaptcha-token',\n INVALID_RECAPTCHA_ACTION: 'auth/invalid-recaptcha-action',\n MISSING_CLIENT_TYPE: 'auth/missing-client-type',\n MISSING_RECAPTCHA_VERSION: 'auth/missing-recaptcha-version',\n INVALID_RECAPTCHA_VERSION: 'auth/invalid-recaptcha-version',\n INVALID_REQ_TYPE: 'auth/invalid-req-type',\n INVALID_HOSTING_LINK_DOMAIN: 'auth/invalid-hosting-link-domain'\n} as const;\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Logger, LogLevel } from '@firebase/logger';\nimport { SDK_VERSION } from '@firebase/app';\n\nexport { LogLevel };\n\nconst logClient = new Logger('@firebase/auth');\n\n// Helper methods are needed because variables can't be exported as read/write\nexport function _getLogLevel(): LogLevel {\n return logClient.logLevel;\n}\n\nexport function _setLogLevel(newLevel: LogLevel): void {\n logClient.logLevel = newLevel;\n}\n\nexport function _logDebug(msg: string, ...args: string[]): void {\n if (logClient.logLevel <= LogLevel.DEBUG) {\n logClient.debug(`Auth (${SDK_VERSION}): ${msg}`, ...args);\n }\n}\n\nexport function _logWarn(msg: string, ...args: string[]): void {\n if (logClient.logLevel <= LogLevel.WARN) {\n logClient.warn(`Auth (${SDK_VERSION}): ${msg}`, ...args);\n }\n}\n\nexport function _logError(msg: string, ...args: string[]): void {\n if (logClient.logLevel <= LogLevel.ERROR) {\n logClient.error(`Auth (${SDK_VERSION}): ${msg}`, ...args);\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Auth } from '../../model/public_types';\nimport { ErrorFactory, FirebaseError } from '@firebase/util';\nimport { AuthInternal } from '../../model/auth';\nimport {\n _DEFAULT_AUTH_ERROR_FACTORY,\n AuthErrorCode,\n AuthErrorParams,\n prodErrorMap,\n ErrorMapRetriever\n} from '../errors';\nimport { _logError } from './log';\n\ntype AuthErrorListParams<K> = K extends keyof AuthErrorParams\n ? [AuthErrorParams[K]]\n : [];\ntype LessAppName<K extends AuthErrorCode> = Omit<AuthErrorParams[K], 'appName'>;\n\n/**\n * Unconditionally fails, throwing a developer facing INTERNAL_ERROR\n *\n * @example\n * ```javascript\n * fail(auth, AuthErrorCode.MFA_REQUIRED); // Error: the MFA_REQUIRED error needs more params than appName\n * fail(auth, AuthErrorCode.MFA_REQUIRED, {serverResponse}); // Compiles\n * fail(AuthErrorCode.INTERNAL_ERROR); // Compiles; internal error does not need appName\n * fail(AuthErrorCode.USER_DELETED); // Error: USER_DELETED requires app name\n * fail(auth, AuthErrorCode.USER_DELETED); // Compiles; USER_DELETED _only_ needs app name\n * ```\n *\n * @param appName App name for tagging the error\n * @throws FirebaseError\n */\nexport function _fail<K extends AuthErrorCode>(\n code: K,\n ...data: {} extends AuthErrorParams[K]\n ? [AuthErrorParams[K]?]\n : [AuthErrorParams[K]]\n): never;\nexport function _fail<K extends AuthErrorCode>(\n auth: Auth,\n code: K,\n ...data: {} extends LessAppName<K> ? [LessAppName<K>?] : [LessAppName<K>]\n): never;\nexport function _fail<K extends AuthErrorCode>(\n authOrCode: Auth | K,\n ...rest: unknown[]\n): never {\n throw createErrorInternal(authOrCode, ...rest);\n}\n\nexport function _createError<K extends AuthErrorCode>(\n code: K,\n ...data: {} extends AuthErrorParams[K]\n ? [AuthErrorParams[K]?]\n : [AuthErrorParams[K]]\n): FirebaseError;\nexport function _createError<K extends AuthErrorCode>(\n auth: Auth,\n code: K,\n ...data: {} extends LessAppName<K> ? [LessAppName<K>?] : [LessAppName<K>]\n): FirebaseError;\nexport function _createError<K extends AuthErrorCode>(\n authOrCode: Auth | K,\n ...rest: unknown[]\n): FirebaseError {\n return createErrorInternal(authOrCode, ...rest);\n}\n\nexport function _errorWithCustomMessage(\n auth: Auth,\n code: AuthErrorCode,\n message: string\n): FirebaseError {\n const errorMap = {\n ...(prodErrorMap as ErrorMapRetriever)(),\n [code]: message\n };\n const factory = new ErrorFactory<AuthErrorCode, AuthErrorParams>(\n 'auth',\n 'Firebase',\n errorMap\n );\n return factory.create(code, {\n appName: auth.name\n });\n}\n\nexport function _serverAppCurrentUserOperationNotSupportedError(\n auth: Auth\n): FirebaseError {\n return _errorWithCustomMessage(\n auth,\n AuthErrorCode.OPERATION_NOT_SUPPORTED,\n 'Operations that alter the current user are not supported in conjunction with FirebaseServerApp'\n );\n}\n\nexport function _assertInstanceOf(\n auth: Auth,\n object: object,\n instance: unknown\n): void {\n const constructorInstance = instance as { new (...args: unknown[]): unknown };\n if (!(object instanceof constructorInstance)) {\n if (constructorInstance.name !== object.constructor.name) {\n _fail(auth, AuthErrorCode.ARGUMENT_ERROR);\n }\n\n throw _errorWithCustomMessage(\n auth,\n AuthErrorCode.ARGUMENT_ERROR,\n `Type of ${object.constructor.name} does not match expected instance.` +\n `Did you pass a reference from a different Auth SDK?`\n );\n }\n}\n\nfunction createErrorInternal<K extends AuthErrorCode>(\n authOrCode: Auth | K,\n ...rest: unknown[]\n): FirebaseError {\n if (typeof authOrCode !== 'string') {\n const code = rest[0] as K;\n const fullParams = [...rest.slice(1)] as AuthErrorListParams<K>;\n if (fullParams[0]) {\n fullParams[0].appName = authOrCode.name;\n }\n\n return (authOrCode as AuthInternal)._errorFactory.create(\n code,\n ...fullParams\n );\n }\n\n return _DEFAULT_AUTH_ERROR_FACTORY.create(\n authOrCode,\n ...(rest as AuthErrorListParams<K>)\n );\n}\n\nexport function _assert<K extends AuthErrorCode>(\n assertion: unknown,\n code: K,\n ...data: {} extends AuthErrorParams[K]\n ? [AuthErrorParams[K]?]\n : [AuthErrorParams[K]]\n): asserts assertion;\nexport function _assert<K extends AuthErrorCode>(\n assertion: unknown,\n auth: Auth,\n code: K,\n ...data: {} extends LessAppName<K> ? [LessAppName<K>?] : [LessAppName<K>]\n): asserts assertion;\nexport function _assert<K extends AuthErrorCode>(\n assertion: unknown,\n authOrCode: Auth | K,\n ...rest: unknown[]\n): asserts assertion {\n if (!assertion) {\n throw createErrorInternal(authOrCode, ...rest);\n }\n}\n\n// We really do want to accept literally any function type here\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype TypeExpectation = Function | string | MapType;\n\ninterface MapType extends Record<string, TypeExpectation | Optional> {}\n\nclass Optional {\n constructor(readonly type: TypeExpectation) {}\n}\n\nexport function opt(type: TypeExpectation): Optional {\n return new Optional(type);\n}\n\n/**\n * Asserts the runtime types of arguments. The 'expected' field can be one of\n * a class, a string (representing a \"typeof\" call), or a record map of name\n * to type. Furthermore, the opt() function can be used to mark a field as\n * optional. For example:\n *\n * function foo(auth: Auth, profile: {displayName?: string}, update = false) {\n * assertTypes(arguments, [AuthImpl, {displayName: opt('string')}, opt('boolean')]);\n * }\n *\n * opt() can be used for any type:\n * function foo(auth?: Auth) {\n * assertTypes(arguments, [opt(AuthImpl)]);\n * }\n *\n * The string types can be or'd together, and you can use \"null\" as well (note\n * that typeof null === 'object'; this is an edge case). For example:\n *\n * function foo(profile: {displayName?: string | null}) {\n * assertTypes(arguments, [{displayName: opt('string|null')}]);\n * }\n *\n * @param args\n * @param expected\n */\nexport function assertTypes(\n args: Omit<IArguments, 'callee'>,\n ...expected: Array<TypeExpectation | Optional>\n): void {\n if (args.length > expected.length) {\n _fail(AuthErrorCode.ARGUMENT_ERROR, {});\n }\n\n for (let i = 0; i < expected.length; i++) {\n let expect = expected[i];\n const arg = args[i];\n\n if (expect instanceof Optional) {\n // If the arg is undefined, then it matches \"optional\" and we can move to\n // the next arg\n if (typeof arg === 'undefined') {\n continue;\n }\n expect = expect.type;\n }\n\n if (typeof expect === 'string') {\n // Handle the edge case for null because typeof null === 'object'\n if (expect.includes('null') && arg === null) {\n continue;\n }\n\n const required = expect.split('|');\n _assert(required.includes(typeof arg), AuthErrorCode.ARGUMENT_ERROR, {});\n } else if (typeof expect === 'object') {\n // Recursively check record arguments\n const record = arg as Record<string, unknown>;\n const map = expect as MapType;\n const keys = Object.keys(expect);\n\n assertTypes(\n keys.map(k => record[k]),\n ...keys.map(k => map[k])\n );\n } else {\n _assert(arg instanceof expect, AuthErrorCode.ARGUMENT_ERROR, {});\n }\n }\n}\n\n/**\n * Unconditionally fails, throwing an internal error with the given message.\n *\n * @param failure type of failure encountered\n * @throws Error\n */\nexport function debugFail(failure: string): never {\n // Log the failure in addition to throw an exception, just in case the\n // exception is swallowed.\n const message = `INTERNAL ASSERTION FAILED: ` + failure;\n _logError(message);\n\n // NOTE: We don't use FirebaseError here because these are internal failures\n // that cannot be handled by the user. (Also it would create a circular\n // dependency between the error and assert modules which doesn't work.)\n throw new Error(message);\n}\n\n/**\n * Fails if the given assertion condition is false, throwing an Error with the\n * given message if it did.\n *\n * @param assertion\n * @param message\n */\nexport function debugAssert(\n assertion: unknown,\n message: string\n): asserts assertion {\n if (!assertion) {\n debugFail(message);\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function _getCurrentUrl(): string {\n return (typeof self !== 'undefined' && self.location?.href) || '';\n}\n\nexport function _isHttpOrHttps(): boolean {\n return _getCurrentScheme() === 'http:' || _getCurrentScheme() === 'https:';\n}\n\nexport function _getCurrentScheme(): string | null {\n return (typeof self !== 'undefined' && self.location?.protocol) || null;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isBrowserExtension } from '@firebase/util';\nimport { _isHttpOrHttps } from './location';\n\n/**\n * Determine whether the browser is working online\n */\nexport function _isOnline(): boolean {\n if (\n typeof navigator !== 'undefined' &&\n navigator &&\n 'onLine' in navigator &&\n typeof navigator.onLine === 'boolean' &&\n // Apply only for traditional web apps and Chrome extensions.\n // This is especially true for Cordova apps which have unreliable\n // navigator.onLine behavior unless cordova-plugin-network-information is\n // installed which overwrites the native navigator.onLine value and\n // defines navigator.connection.\n (_isHttpOrHttps() || isBrowserExtension() || 'connection' in navigator)\n ) {\n return navigator.onLine;\n }\n // If we can't determine the state, assume it is online.\n return true;\n}\n\nexport function _getUserLanguage(): string | null {\n if (typeof navigator === 'undefined') {\n return null;\n }\n const navigatorLanguage: NavigatorLanguage = navigator;\n return (\n // Most reliable, but only supported in Chrome/Firefox.\n (navigatorLanguage.languages && navigatorLanguage.languages[0]) ||\n // Supported in most browsers, but returns the language of the browser\n // UI, not the language set in browser settings.\n navigatorLanguage.language ||\n // Couldn't determine language.\n null\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isMobileCordova, isReactNative } from '@firebase/util';\nimport { _isOnline } from './navigator';\nimport { debugAssert } from './assert';\n\nexport const enum DelayMin {\n OFFLINE = 5000\n}\n\n/**\n * A structure to help pick between a range of long and short delay durations\n * depending on the current environment. In general, the long delay is used for\n * mobile environments whereas short delays are used for desktop environments.\n */\nexport class Delay {\n // The default value for the offline delay timeout in ms.\n\n private readonly isMobile: boolean;\n constructor(\n private readonly shortDelay: number,\n private readonly longDelay: number\n ) {\n // Internal error when improperly initialized.\n debugAssert(\n longDelay > shortDelay,\n 'Short delay should be less than long delay!'\n );\n this.isMobile = isMobileCordova() || isReactNative();\n }\n\n get(): number {\n if (!_isOnline()) {\n // Pick the shorter timeout.\n return Math.min(DelayMin.OFFLINE, this.shortDelay);\n }\n // If running in a mobile environment, return the long delay, otherwise\n // return the short delay.\n // This could be improved in the future to dynamically change based on other\n // variables instead of just reading the current environment.\n return this.isMobile ? this.longDelay : this.shortDelay;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ConfigInternal } from '../../model/auth';\nimport { debugAssert } from './assert';\n\nexport function _emulatorUrl(config: ConfigInternal, path?: string): string {\n debugAssert(config.emulator, 'Emulator should always be set here');\n const { url } = config.emulator;\n\n if (!path) {\n return url;\n }\n\n return `${url}${path.startsWith('/') ? path.slice(1) : path}`;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { debugFail } from './assert';\n\nexport class FetchProvider {\n private static fetchImpl: typeof fetch | null;\n private static headersImpl: typeof Headers | null;\n private static responseImpl: typeof Response | null;\n\n static initialize(\n fetchImpl: typeof fetch,\n headersImpl?: typeof Headers,\n responseImpl?: typeof Response\n ): void {\n this.fetchImpl = fetchImpl;\n if (headersImpl) {\n this.headersImpl = headersImpl;\n }\n if (responseImpl) {\n this.responseImpl = responseImpl;\n }\n }\n\n static fetch(): typeof fetch {\n if (this.fetchImpl) {\n return this.fetchImpl;\n }\n if (typeof self !== 'undefined' && 'fetch' in self) {\n return self.fetch;\n }\n if (typeof globalThis !== 'undefined' && globalThis.fetch) {\n return globalThis.fetch;\n }\n if (typeof fetch !== 'undefined') {\n return fetch;\n }\n debugFail(\n 'Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'\n );\n }\n\n static headers(): typeof Headers {\n if (this.headersImpl) {\n return this.headersImpl;\n }\n if (typeof self !== 'undefined' && 'Headers' in self) {\n return self.Headers;\n }\n if (typeof globalThis !== 'undefined' && globalThis.Headers) {\n return globalThis.Headers;\n }\n if (typeof Headers !== 'undefined') {\n return Headers;\n }\n debugFail(\n 'Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'\n );\n }\n\n static response(): typeof Response {\n if (this.responseImpl) {\n return this.responseImpl;\n }\n if (typeof self !== 'undefined' && 'Response' in self) {\n return self.Response;\n }\n if (typeof globalThis !== 'undefined' && globalThis.Response) {\n return globalThis.Response;\n }\n if (typeof Response !== 'undefined') {\n return Response;\n }\n debugFail(\n 'Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'\n );\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AuthErrorCode } from '../core/errors';\n\n/**\n * Errors that can be returned by the backend\n */\nexport const enum ServerError {\n ADMIN_ONLY_OPERATION = 'ADMIN_ONLY_OPERATION',\n BLOCKING_FUNCTION_ERROR_RESPONSE = 'BLOCKING_FUNCTION_ERROR_RESPONSE',\n CAPTCHA_CHECK_FAILED = 'CAPTCHA_CHECK_FAILED',\n CORS_UNSUPPORTED = 'CORS_UNSUPPORTED',\n CREDENTIAL_MISMATCH = 'CREDENTIAL_MISMATCH',\n CREDENTIAL_TOO_OLD_LOGIN_AGAIN = 'CREDENTIAL_TOO_OLD_LOGIN_AGAIN',\n DYNAMIC_LINK_NOT_ACTIVATED = 'DYNAMIC_LINK_NOT_ACTIVATED',\n EMAIL_CHANGE_NEEDS_VERIFICATION = 'EMAIL_CHANGE_NEEDS_VERIFICATION',\n EMAIL_EXISTS = 'EMAIL_EXISTS',\n EMAIL_NOT_FOUND = 'EMAIL_NOT_FOUND',\n EXPIRED_OOB_CODE = 'EXPIRED_OOB_CODE',\n FEDERATED_USER_ID_ALREADY_LINKED = 'FEDERATED_USER_ID_ALREADY_LINKED',\n INVALID_APP_CREDENTIAL = 'INVALID_APP_CREDENTIAL',\n INVALID_APP_ID = 'INVALID_APP_ID',\n INVALID_CERT_HASH = 'INVALID_CERT_HASH',\n INVALID_CODE = 'INVALID_CODE',\n INVALID_CONTINUE_URI = 'INVALID_CONTINUE_URI',\n INVALID_CUSTOM_TOKEN = 'INVALID_CUSTOM_TOKEN',\n INVALID_DYNAMIC_LINK_DOMAIN = 'INVALID_DYNAMIC_LINK_DOMAIN',\n INVALID_EMAIL = 'INVALID_EMAIL',\n INVALID_ID_TOKEN = 'INVALID_ID_TOKEN',\n INVALID_IDP_RESPONSE = 'INVALID_IDP_RESPONSE',\n INVALID_IDENTIFIER = 'INVALID_IDENTIFIER',\n INVALID_LOGIN_CREDENTIALS = 'INVALID_LOGIN_CREDENTIALS',\n INVALID_MESSAGE_PAYLOAD = 'INVALID_MESSAGE_PAYLOAD',\n INVALID_MFA_PENDING_CREDENTIAL = 'INVALID_MFA_PENDING_CREDENTIAL',\n INVALID_OAUTH_CLIENT_ID = 'INVALID_OAUTH_CLIENT_ID',\n INVALID_OOB_CODE = 'INVALID_OOB_CODE',\n INVALID_PASSWORD = 'INVALID_PASSWORD',\n INVALID_PENDING_TOKEN = 'INVALID_PENDING_TOKEN',\n INVALID_PHONE_NUMBER = 'INVALID_PHONE_NUMBER',\n INVALID_PROVIDER_ID = 'INVALID_PROVIDER_ID',\n INVALID_RECIPIENT_EMAIL = 'INVALID_RECIPIENT_EMAIL',\n INVALID_SENDER = 'INVALID_SENDER',\n INVALID_SESSION_INFO = 'INVALID_SESSION_INFO',\n INVALID_TEMPORARY_PROOF = 'INVALID_TEMPORARY_PROOF',\n INVALID_TENANT_ID = 'INVALID_TENANT_ID',\n MFA_ENROLLMENT_NOT_FOUND = 'MFA_ENROLLMENT_NOT_FOUND',\n MISSING_ANDROID_PACKAGE_NAME = 'MISSING_ANDROID_PACKAGE_NAME',\n MISSING_APP_CREDENTIAL = 'MISSING_APP_CREDENTIAL',\n MISSING_CODE = 'MISSING_CODE',\n MISSING_CONTINUE_URI = 'MISSING_CONTINUE_URI',\n MISSING_CUSTOM_TOKEN = 'MISSING_CUSTOM_TOKEN',\n MISSING_IOS_BUNDLE_ID = 'MISSING_IOS_BUNDLE_ID',\n MISSING_MFA_ENROLLMENT_ID = 'MISSING_MFA_ENROLLMENT_ID',\n MISSING_MFA_PENDING_CREDENTIAL = 'MISSING_MFA_PENDING_CREDENTIAL',\n MISSING_OOB_CODE = 'MISSING_OOB_CODE',\n MISSING_OR_INVALID_NONCE = 'MISSING_OR_INVALID_NONCE',\n MISSING_PASSWORD = 'MISSING_PASSWORD',\n MISSING_REQ_TYPE = 'MISSING_REQ_TYPE',\n MISSING_PHONE_NUMBER = 'MISSING_PHONE_NUMBER',\n MISSING_SESSION_INFO = 'MISSING_SESSION_INFO',\n OPERATION_NOT_ALLOWED = 'OPERATION_NOT_ALLOWED',\n PASSWORD_LOGIN_DISABLED = 'PASSWORD_LOGIN_DISABLED',\n QUOTA_EXCEEDED = 'QUOTA_EXCEEDED',\n RESET_PASSWORD_EXCEED_LIMIT = 'RESET_PASSWORD_EXCEED_LIMIT',\n REJECTED_CREDENTIAL = 'REJECTED_CREDENTIAL',\n SECOND_FACTOR_EXISTS = 'SECOND_FACTOR_EXISTS',\n SECOND_FACTOR_LIMIT_EXCEEDED = 'SECOND_FACTOR_LIMIT_EXCEEDED',\n SESSION_EXPIRED = 'SESSION_EXPIRED',\n TENANT_ID_MISMATCH = 'TENANT_ID_MISMATCH',\n TOKEN_EXPIRED = 'TOKEN_EXPIRED',\n TOO_MANY_ATTEMPTS_TRY_LATER = 'TOO_MANY_ATTEMPTS_TRY_LATER',\n UNSUPPORTED_FIRST_FACTOR = 'UNSUPPORTED_FIRST_FACTOR',\n UNSUPPORTED_TENANT_OPERATION = 'UNSUPPORTED_TENANT_OPERATION',\n UNAUTHORIZED_DOMAIN = 'UNAUTHORIZED_DOMAIN',\n UNVERIFIED_EMAIL = 'UNVERIFIED_EMAIL',\n USER_CANCELLED = 'USER_CANCELLED',\n USER_DISABLED = 'USER_DISABLED',\n USER_NOT_FOUND = 'USER_NOT_FOUND',\n WEAK_PASSWORD = 'WEAK_PASSWORD',\n RECAPTCHA_NOT_ENABLED = 'RECAPTCHA_NOT_ENABLED',\n MISSING_RECAPTCHA_TOKEN = 'MISSING_RECAPTCHA_TOKEN',\n INVALID_RECAPTCHA_TOKEN = 'INVALID_RECAPTCHA_TOKEN',\n INVALID_RECAPTCHA_ACTION = 'INVALID_RECAPTCHA_ACTION',\n MISSING_CLIENT_TYPE = 'MISSING_CLIENT_TYPE',\n MISSING_RECAPTCHA_VERSION = 'MISSING_RECAPTCHA_VERSION',\n INVALID_RECAPTCHA_VERSION = 'INVALID_RECAPTCHA_VERSION',\n INVALID_REQ_TYPE = 'INVALID_REQ_TYPE',\n PASSWORD_DOES_NOT_MEET_REQUIREMENTS = 'PASSWORD_DOES_NOT_MEET_REQUIREMENTS',\n INVALID_HOSTING_LINK_DOMAIN = 'INVALID_HOSTING_LINK_DOMAIN'\n}\n\n/**\n * API Response in the event of an error\n */\nexport interface JsonError {\n error: {\n code: number;\n message: string;\n errors?: [\n {\n message: ServerError;\n domain: string;\n reason: string;\n }\n ];\n };\n}\n\n/**\n * Type definition for a map from server errors to developer visible errors\n */\nexport declare type ServerErrorMap<ApiError extends string> = {\n readonly [K in ApiError]: AuthErrorCode;\n};\n\n/**\n * Map from errors returned by the server to errors to developer visible errors\n */\nexport const SERVER_ERROR_MAP: Partial<ServerErrorMap<ServerError>> = {\n // Custom token errors.\n [ServerError.CREDENTIAL_MISMATCH]: AuthErrorCode.CREDENTIAL_MISMATCH,\n // This can only happen if the SDK sends a bad request.\n [ServerError.MISSING_CUSTOM_TOKEN]: AuthErrorCode.INTERNAL_ERROR,\n\n // Create Auth URI errors.\n [ServerError.INVALID_IDENTIFIER]: AuthErrorCode.INVALID_EMAIL,\n // This can only happen if the SDK sends a bad request.\n [ServerError.MISSING_CONTINUE_URI]: AuthErrorCode.INTERNAL_ERROR,\n\n // Sign in with email and password errors (some apply to sign up too).\n [ServerError.INVALID_PASSWORD]: AuthErrorCode.INVALID_PASSWORD,\n // This can only happen if the SDK sends a bad request.\n [ServerError.MISSING_PASSWORD]: AuthErrorCode.MISSING_PASSWORD,\n // Thrown if Email Enumeration Protection is enabled in the project and the email or password is\n // invalid.\n [ServerError.INVALID_LOGIN_CREDENTIALS]: AuthErrorCode.INVALID_CREDENTIAL,\n\n // Sign up with email and password errors.\n [ServerError.EMAIL_EXISTS]: AuthErrorCode.EMAIL_EXISTS,\n [ServerError.PASSWORD_LOGIN_DISABLED]: AuthErrorCode.OPERATION_NOT_ALLOWED,\n\n // Verify assertion for sign in with credential errors:\n [ServerError.INVALID_IDP_RESPONSE]: AuthErrorCode.INVALID_CREDENTIAL,\n [ServerError.INVALID_PENDING_TOKEN]: AuthErrorCode.INVALID_CREDENTIAL,\n [ServerError.FEDERATED_USER_ID_ALREADY_LINKED]:\n AuthErrorCode.CREDENTIAL_ALREADY_IN_USE,\n\n // This can only happen if the SDK sends a bad request.\n [ServerError.MISSING_REQ_TYPE]: AuthErrorCode.INTERNAL_ERROR,\n\n // Send Password reset email errors:\n [ServerError.EMAIL_NOT_FOUND]: AuthErrorCode.USER_DELETED,\n [ServerError.RESET_PASSWORD_EXCEED_LIMIT]:\n AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER,\n\n [ServerError.EXPIRED_OOB_CODE]: AuthErrorCode.EXPIRED_OOB_CODE,\n [ServerError.INVALID_OOB_CODE]: AuthErrorCode.INVALID_OOB_CODE,\n // This can only happen if the SDK sends a bad request.\n [ServerError.MISSING_OOB_CODE]: AuthErrorCode.INTERNAL_ERROR,\n\n // Operations that require ID token in request:\n [ServerError.CREDENTIAL_TOO_OLD_LOGIN_AGAIN]:\n AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN,\n [ServerError.INVALID_ID_TOKEN]: AuthErrorCode.INVALID_AUTH,\n [ServerError.TOKEN_EXPIRED]: AuthErrorCode.TOKEN_EXPIRED,\n [ServerError.USER_NOT_FOUND]: AuthErrorCode.TOKEN_EXPIRED,\n\n // Other errors.\n [ServerError.TOO_MANY_ATTEMPTS_TRY_LATER]:\n AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER,\n [ServerError.PASSWORD_DOES_NOT_MEET_REQUIREMENTS]:\n AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS,\n\n // Phone Auth related errors.\n [ServerError.INVALID_CODE]: AuthErrorCode.INVALID_CODE,\n [ServerError.INVALID_SESSION_INFO]: AuthErrorCode.INVALID_SESSION_INFO,\n [ServerError.INVALID_TEMPORARY_PROOF]: AuthErrorCode.INVALID_CREDENTIAL,\n [ServerError.MISSING_SESSION_INFO]: AuthErrorCode.MISSING_SESSION_INFO,\n [ServerError.SESSION_EXPIRED]: AuthErrorCode.CODE_EXPIRED,\n\n // Other action code errors when additional settings passed.\n // MISSING_CONTINUE_URI is getting mapped to INTERNAL_ERROR above.\n // This is OK as this error will be caught by client side validation.\n [ServerError.MISSING_ANDROID_PACKAGE_NAME]:\n AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME,\n [ServerError.UNAUTHORIZED_DOMAIN]: AuthErrorCode.UNAUTHORIZED_DOMAIN,\n\n // getProjectConfig errors when clientId is passed.\n [ServerError.INVALID_OAUTH_CLIENT_ID]: AuthErrorCode.INVALID_OAUTH_CLIENT_ID,\n\n // User actions (sign-up or deletion) disabled errors.\n [ServerError.ADMIN_ONLY_OPERATION]: AuthErrorCode.ADMIN_ONLY_OPERATION,\n\n // Multi factor related errors.\n [ServerError.INVALID_MFA_PENDING_CREDENTIAL]:\n AuthErrorCode.INVALID_MFA_SESSION,\n [ServerError.MFA_ENROLLMENT_NOT_FOUND]: AuthErrorCode.MFA_INFO_NOT_FOUND,\n [ServerError.MISSING_MFA_ENROLLMENT_ID]: AuthErrorCode.MISSING_MFA_INFO,\n [ServerError.MISSING_MFA_PENDING_CREDENTIAL]:\n AuthErrorCode.MISSING_MFA_SESSION,\n [ServerError.SECOND_FACTOR_EXISTS]:\n AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED,\n [ServerError.SECOND_FACTOR_LIMIT_EXCEEDED]:\n AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED,\n\n // Blocking functions related errors.\n [ServerError.BLOCKING_FUNCTION_ERROR_RESPONSE]: AuthErrorCode.INTERNAL_ERROR,\n\n // Recaptcha related errors.\n [ServerError.RECAPTCHA_NOT_ENABLED]: AuthErrorCode.RECAPTCHA_NOT_ENABLED,\n [ServerError.MISSING_RECAPTCHA_TOKEN]: AuthErrorCode.MISSING_RECAPTCHA_TOKEN,\n [ServerError.INVALID_RECAPTCHA_TOKEN]: AuthErrorCode.INVALID_RECAPTCHA_TOKEN,\n [ServerError.INVALID_RECAPTCHA_ACTION]:\n AuthErrorCode.INVALID_RECAPTCHA_ACTION,\n [ServerError.MISSING_CLIENT_TYPE]: AuthErrorCode.MISSING_CLIENT_TYPE,\n [ServerError.MISSING_RECAPTCHA_VERSION]:\n AuthErrorCode.MISSING_RECAPTCHA_VERSION,\n [ServerError.INVALID_RECAPTCHA_VERSION]:\n AuthErrorCode.INVALID_RECAPTCHA_VERSION,\n [ServerError.INVALID_REQ_TYPE]: AuthErrorCode.INVALID_REQ_TYPE\n};\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n FirebaseError,\n isCloudflareWorker,\n isCloudWorkstation,\n querystring\n} from '@firebase/util';\n\nimport { AuthErrorCode, NamedErrorParams } from '../core/errors';\nimport {\n _createError,\n _errorWithCustomMessage,\n _fail\n} from '../core/util/assert';\nimport { Delay } from '../core/util/delay';\nimport { _emulatorUrl } from '../core/util/emulator';\nimport { FetchProvider } from '../core/util/fetch_provider';\nimport { Auth } from '../model/public_types';\nimport { AuthInternal, ConfigInternal } from '../model/auth';\nimport { IdTokenResponse, TaggedWithTokenResponse } from '../model/id_token';\nimport { IdTokenMfaResponse } from './authentication/mfa';\nimport { SERVER_ERROR_MAP, ServerError, ServerErrorMap } from './errors';\nimport { PersistenceType } from '../core/persistence';\nimport { CookiePersistence } from '../platform_browser/persistence/cookie_storage';\n\nexport const enum HttpMethod {\n POST = 'POST',\n GET = 'GET'\n}\n\nexport const enum HttpHeader {\n CONTENT_TYPE = 'Content-Type',\n X_FIREBASE_LOCALE = 'X-Firebase-Locale',\n X_CLIENT_VERSION = 'X-Client-Version',\n X_FIREBASE_GMPID = 'X-Firebase-gmpid',\n X_FIREBASE_CLIENT = 'X-Firebase-Client',\n X_FIREBASE_APP_CHECK = 'X-Firebase-AppCheck'\n}\n\nexport const enum Endpoint {\n CREATE_AUTH_URI = '/v1/accounts:createAuthUri',\n DELETE_ACCOUNT = '/v1/accounts:delete',\n RESET_PASSWORD = '/v1/accounts:resetPassword',\n SIGN_UP = '/v1/accounts:signUp',\n SIGN_IN_WITH_CUSTOM_TOKEN = '/v1/accounts:signInWithCustomToken',\n SIGN_IN_WITH_EMAIL_LINK = '/v1/accounts:signInWithEmailLink',\n SIGN_IN_WITH_IDP = '/v1/accounts:signInWithIdp',\n SIGN_IN_WITH_PASSWORD = '/v1/accounts:signInWithPassword',\n SIGN_IN_WITH_PHONE_NUMBER = '/v1/accounts:signInWithPhoneNumber',\n SEND_VERIFICATION_CODE = '/v1/accounts:sendVerificationCode',\n SEND_OOB_CODE = '/v1/accounts:sendOobCode',\n SET_ACCOUNT_INFO = '/v1/accounts:update',\n GET_ACCOUNT_INFO = '/v1/accounts:lookup',\n GET_RECAPTCHA_PARAM = '/v1/recaptchaParams',\n START_MFA_ENROLLMENT = '/v2/accounts/mfaEnrollment:start',\n FINALIZE_MFA_ENROLLMENT = '/v2/accounts/mfaEnrollment:finalize',\n START_MFA_SIGN_IN = '/v2/accounts/mfaSignIn:start',\n FINALIZE_MFA_SIGN_IN = '/v2/accounts/mfaSignIn:finalize',\n WITHDRAW_MFA = '/v2/accounts/mfaEnrollment:withdraw',\n GET_PROJECT_CONFIG = '/v1/projects',\n GET_RECAPTCHA_CONFIG = '/v2/recaptchaConfig',\n GET_PASSWORD_POLICY = '/v2/passwordPolicy',\n TOKEN = '/v1/token',\n REVOKE_TOKEN = '/v2/accounts:revokeToken'\n}\n\nconst CookieAuthProxiedEndpoints: string[] = [\n Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN,\n Endpoint.SIGN_IN_WITH_EMAIL_LINK,\n Endpoint.SIGN_IN_WITH_IDP,\n Endpoint.SIGN_IN_WITH_PASSWORD,\n Endpoint.SIGN_IN_WITH_PHONE_NUMBER,\n Endpoint.TOKEN\n];\n\nexport const enum RecaptchaClientType {\n WEB = 'CLIENT_TYPE_WEB',\n ANDROID = 'CLIENT_TYPE_ANDROID',\n IOS = 'CLIENT_TYPE_IOS'\n}\n\nexport const enum RecaptchaVersion {\n ENTERPRISE = 'RECAPTCHA_ENTERPRISE'\n}\n\nexport const enum RecaptchaActionName {\n SIGN_IN_WITH_PASSWORD = 'signInWithPassword',\n GET_OOB_CODE = 'getOobCode',\n SIGN_UP_PASSWORD = 'signUpPassword',\n SEND_VERIFICATION_CODE = 'sendVerificationCode',\n MFA_SMS_ENROLLMENT = 'mfaSmsEnrollment',\n MFA_SMS_SIGNIN = 'mfaSmsSignIn'\n}\n\nexport const enum EnforcementState {\n ENFORCE = 'ENFORCE',\n AUDIT = 'AUDIT',\n OFF = 'OFF',\n ENFORCEMENT_STATE_UNSPECIFIED = 'ENFORCEMENT_STATE_UNSPECIFIED'\n}\n\n// Providers that have reCAPTCHA Enterprise support.\nexport const enum RecaptchaAuthProvider {\n EMAIL_PASSWORD_PROVIDER = 'EMAIL_PASSWORD_PROVIDER',\n PHONE_PROVIDER = 'PHONE_PROVIDER'\n}\n\nexport const DEFAULT_API_TIMEOUT_MS = new Delay(30_000, 60_000);\n\nexport function _addTidIfNecessary<T extends { tenantId?: string }>(\n auth: Auth,\n request: T\n): T {\n if (auth.tenantId && !request.tenantId) {\n return {\n ...request,\n tenantId: auth.tenantId\n };\n }\n return request;\n}\n\nexport async function _performApiRequest<T, V>(\n auth: Auth,\n method: HttpMethod,\n path: Endpoint,\n request?: T,\n customErrorMap: Partial<ServerErrorMap<ServerError>> = {}\n): Promise<V> {\n return _performFetchWithErrorHandling(auth, customErrorMap, async () => {\n let body = {};\n let params = {};\n if (request) {\n if (method === HttpMethod.GET) {\n params = request;\n } else {\n body = {\n body: JSON.stringify(request)\n };\n }\n }\n\n const query = querystring({\n key: auth.config.apiKey,\n ...params\n }).slice(1);\n\n const headers = await (auth as AuthInternal)._getAdditionalHeaders();\n headers[HttpHeader.CONTENT_TYPE] = 'application/json';\n\n if (auth.languageCode) {\n headers[HttpHeader.X_FIREBASE_LOCALE] = auth.languageCode;\n }\n\n const fetchArgs: RequestInit = {\n method,\n headers,\n ...body\n };\n\n /* Security-conscious server-side frameworks tend to have built in mitigations for referrer\n problems\". See the Cloudflare GitHub issue #487: Error: The 'referrerPolicy' field on\n 'RequestInitializerDict' is not implemented.\"\n https://github.com/cloudflare/next-on-pages/issues/487 */\n if (!isCloudflareWorker()) {\n fetchArgs.referrerPolicy = 'no-referrer';\n }\n\n if (auth.emulatorConfig && isCloudWorkstation(auth.emulatorConfig.host)) {\n fetchArgs.credentials = 'include';\n }\n\n return FetchProvider.fetch()(\n await _getFinalTarget(auth, auth.config.apiHost, path, query),\n fetchArgs\n );\n });\n}\n\nexport async function _performFetchWithErrorHandling<V>(\n auth: Auth,\n customErrorMap: Partial<ServerErrorMap<ServerError>>,\n fetchFn: () => Promise<Response>\n): Promise<V> {\n (auth as AuthInternal)._canInitEmulator = false;\n const errorMap = { ...SERVER_ERROR_MAP, ...customErrorMap };\n try {\n const networkTimeout = new NetworkTimeout<Response>(auth);\n const response: Response = await Promise.race<Promise<Response>>([\n fetchFn(),\n networkTimeout.promise\n ]);\n\n // If we've reached this point, the fetch succeeded and the networkTimeout\n // didn't throw; clear the network timeout delay so that Node won't hang\n networkTimeout.clearNetworkTimeout();\n\n const json = await response.json();\n if ('needConfirmation' in json) {\n throw _makeTaggedError(auth, AuthErrorCode.NEED_CONFIRMATION, json);\n }\n\n if (response.ok && !('errorMessage' in json)) {\n return json;\n } else {\n const errorMessage = response.ok ? json.errorMessage : json.error.message;\n const [serverErrorCode, serverErrorMessage] = errorMessage.split(' : ');\n if (serverErrorCode === ServerError.FEDERATED_USER_ID_ALREADY_LINKED) {\n throw _makeTaggedError(\n auth,\n AuthErrorCode.CREDENTIAL_ALREADY_IN_USE,\n json\n );\n } else if (serverErrorCode === ServerError.EMAIL_EXISTS) {\n throw _makeTaggedError(auth, AuthErrorCode.EMAIL_EXISTS, json);\n } else if (serverErrorCode === ServerError.USER_DISABLED) {\n throw _makeTaggedError(auth, AuthErrorCode.USER_DISABLED, json);\n }\n const authError =\n errorMap[serverErrorCode as ServerError] ||\n (serverErrorCode\n .toLowerCase()\n .replace(/[_\\s]+/g, '-') as unknown as AuthErrorCode);\n if (serverErrorMessage) {\n throw _errorWithCustomMessage(auth, authError, serverErrorMessage);\n } else {\n _fail(auth, authError);\n }\n }\n } catch (e) {\n if (e instanceof FirebaseError) {\n throw e;\n }\n // Changing this to a different error code will log user out when there is a network error\n // because we treat any error other than NETWORK_REQUEST_FAILED as token is invalid.\n // https://github.com/firebase/firebase-js-sdk/blob/4fbc73610d70be4e0852e7de63a39cb7897e8546/packages/auth/src/core/auth/auth_impl.ts#L309-L316\n _fail(auth, AuthErrorCode.NETWORK_REQUEST_FAILED, { 'message': String(e) });\n }\n}\n\nexport async function _performSignInRequest<T, V extends IdTokenResponse>(\n auth: Auth,\n method: HttpMethod,\n path: Endpoint,\n request?: T,\n customErrorMap: Partial<ServerErrorMap<ServerError>> = {}\n): Promise<V> {\n const serverResponse = await _performApiRequest<T, V | IdTokenMfaResponse>(\n auth,\n method,\n path,\n request,\n customErrorMap\n );\n if ('mfaPendingCredential' in serverResponse) {\n _fail(auth, AuthErrorCode.MFA_REQUIRED, {\n _serverResponse: serverResponse\n });\n }\n\n return serverResponse as V;\n}\n\nexport async function _getFinalTarget(\n auth: Auth,\n host: string,\n path: string,\n query: string\n): Promise<string> {\n const base = `${host}${path}?${query}`;\n\n const authInternal = auth as AuthInternal;\n const finalTarget = authInternal.config.emulator\n ? _emulatorUrl(auth.config as ConfigInternal, base)\n : `${auth.config.apiScheme}://${base}`;\n\n // Cookie auth works by MiTMing the signIn and token endpoints from the developer's backend,\n // saving the idToken and refreshToken into cookies, and then redacting the refreshToken\n // from the response\n if (CookieAuthProxiedEndpoints.includes(path)) {\n // Persistence manager is async, we need to await it. We can't just wait for auth initialized\n // here since auth initialization calls this function.\n await authInternal._persistenceManagerAvailable;\n if (authInternal._getPersistenceType() === PersistenceType.COOKIE) {\n const cookiePersistence =\n authInternal._getPersistence() as CookiePersistence;\n return cookiePersistence._getFinalTarget(finalTarget).toString();\n }\n }\n\n return finalTarget;\n}\n\nexport function _parseEnforcementState(\n enforcementStateStr: string\n): EnforcementState {\n switch (enforcementStateStr) {\n case 'ENFORCE':\n return EnforcementState.ENFORCE;\n case 'AUDIT':\n return EnforcementState.AUDIT;\n case 'OFF':\n return EnforcementState.OFF;\n default:\n return EnforcementState.ENFORCEMENT_STATE_UNSPECIFIED;\n }\n}\n\nclass NetworkTimeout<T> {\n // Node timers and browser timers are fundamentally incompatible, but we\n // don't care about the value here\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private timer: any | null = null;\n readonly promise = new Promise<T>((_, reject) => {\n this.timer = setTimeout(() => {\n return reject(\n _createError(this.auth, AuthErrorCode.NETWORK_REQUEST_FAILED)\n );\n }, DEFAULT_API_TIMEOUT_MS.get());\n });\n\n clearNetworkTimeout(): void {\n clearTimeout(this.timer);\n }\n\n constructor(private readonly auth: Auth) {}\n}\n\ninterface PotentialResponse extends IdTokenResponse {\n email?: string;\n phoneNumber?: string;\n}\n\nexport function _makeTaggedError(\n auth: Auth,\n code: AuthErrorCode,\n response: PotentialResponse\n): FirebaseError {\n const errorParams: NamedErrorParams = {\n appName: auth.name\n };\n\n if (response.email) {\n errorParams.email = response.email;\n }\n if (response.phoneNumber) {\n errorParams.phoneNumber = response.phoneNumber;\n }\n\n const error = _createError(auth, code, errorParams);\n\n // We know customData is defined on error because errorParams is defined\n (error.customData! as TaggedWithTokenResponse)._tokenResponse = response;\n return error;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { RecaptchaParameters } from '../../model/public_types';\nimport {\n GetRecaptchaConfigResponse,\n RecaptchaEnforcementProviderState\n} from '../../api/authentication/recaptcha';\nimport {\n EnforcementState,\n RecaptchaAuthProvider,\n _parseEnforcementState\n} from '../../api/index';\n\n// reCAPTCHA v2 interface\nexport interface Recaptcha {\n render: (container: HTMLElement, parameters: RecaptchaParameters) => number;\n getResponse: (id: number) => string;\n execute: (id: number) => unknown;\n reset: (id: number) => unknown;\n}\n\nexport function isV2(\n grecaptcha: Recaptcha | GreCAPTCHA | undefined\n): grecaptcha is Recaptcha {\n return (\n grecaptcha !== undefined &&\n (grecaptcha as Recaptcha).getResponse !== undefined\n );\n}\n\n// reCAPTCHA Enterprise & v3 shared interface\nexport interface GreCAPTCHATopLevel extends GreCAPTCHA {\n enterprise: GreCAPTCHA;\n}\n\n// reCAPTCHA Enterprise interface\nexport interface GreCAPTCHA {\n ready: (callback: () => void) => void;\n execute: (siteKey: string, options: { action: string }) => Promise<string>;\n render: (\n container: string | HTMLElement,\n parameters: GreCAPTCHARenderOption\n ) => string;\n}\n\nexport interface GreCAPTCHARenderOption {\n sitekey: string;\n size: 'invisible';\n}\n\nexport function isEnterprise(\n grecaptcha: Recaptcha | GreCAPTCHA | undefined\n): grecaptcha is GreCAPTCHATopLevel {\n return (\n grecaptcha !== undefined &&\n (grecaptcha as GreCAPTCHATopLevel).enterprise !== undefined\n );\n}\n\n// TODO(chuanr): Replace this with the AuthWindow after resolving the dependency issue in Node.js env.\ndeclare global {\n interface Window {\n grecaptcha?: Recaptcha | GreCAPTCHATopLevel;\n }\n}\n\nexport class RecaptchaConfig {\n /**\n * The reCAPTCHA site key.\n */\n siteKey: string = '';\n\n /**\n * The list of providers and their enablement status for reCAPTCHA Enterprise.\n */\n recaptchaEnforcementState: RecaptchaEnforcementProviderState[] = [];\n\n constructor(response: GetRecaptchaConfigResponse) {\n if (response.recaptchaKey === undefined) {\n throw new Error('recaptchaKey undefined');\n }\n // Example response.recaptchaKey: \"projects/proj123/keys/sitekey123\"\n this.siteKey = response.recaptchaKey.split('/')[3];\n this.recaptchaEnforcementState = response.recaptchaEnforcementState;\n }\n\n /**\n * Returns the reCAPTCHA Enterprise enforcement state for the given provider.\n *\n * @param providerStr - The provider whose enforcement state is to be returned.\n * @returns The reCAPTCHA Enterprise enforcement state for the given provider.\n */\n getProviderEnforcementState(providerStr: string): EnforcementState | null {\n if (\n !this.recaptchaEnforcementState ||\n this.recaptchaEnforcementState.length === 0\n ) {\n return null;\n }\n\n for (const recaptchaEnforcementState of this.recaptchaEnforcementState) {\n if (\n recaptchaEnforcementState.provider &&\n recaptchaEnforcementState.provider === providerStr\n ) {\n return _parseEnforcementState(\n recaptchaEnforcementState.enforcementState\n );\n }\n }\n return null;\n }\n\n /**\n * Returns true if the reCAPTCHA Enterprise enforcement state for the provider is set to ENFORCE or AUDIT.\n *\n * @param providerStr - The provider whose enablement state is to be returned.\n * @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider.\n */\n isProviderEnabled(providerStr: string): boolean {\n return (\n this.getProviderEnforcementState(providerStr) ===\n EnforcementState.ENFORCE ||\n this.getProviderEnforcementState(providerStr) === EnforcementState.AUDIT\n );\n }\n\n /**\n * Returns true if reCAPTCHA Enterprise protection is enabled in at least one provider, otherwise\n * returns false.\n *\n * @returns Whether or not reCAPTCHA Enterprise protection is enabled for at least one provider.\n */\n isAnyProviderEnabled(): boolean {\n return (\n this.isProviderEnabled(RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER) ||\n this.isProviderEnabled(RecaptchaAuthProvider.PHONE_PROVIDER)\n );\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Endpoint,\n HttpMethod,\n RecaptchaClientType,\n RecaptchaVersion,\n _performApiRequest,\n _addTidIfNecessary\n} from '../index';\nimport { Auth } from '../../model/public_types';\n\ninterface GetRecaptchaParamResponse {\n recaptchaSiteKey?: string;\n}\n\nexport async function getRecaptchaParams(auth: Auth): Promise<string> {\n return (\n (\n await _performApiRequest<void, GetRecaptchaParamResponse>(\n auth,\n HttpMethod.GET,\n Endpoint.GET_RECAPTCHA_PARAM\n )\n ).recaptchaSiteKey || ''\n );\n}\n\n// The following functions are for reCAPTCHA enterprise integration.\ninterface GetRecaptchaConfigRequest {\n tenantId?: string;\n clientType?: RecaptchaClientType;\n version?: RecaptchaVersion;\n}\n\nexport interface RecaptchaEnforcementProviderState {\n provider: string;\n enforcementState: string;\n}\n\nexport interface GetRecaptchaConfigResponse {\n recaptchaKey: string;\n recaptchaEnforcementState: RecaptchaEnforcementProviderState[];\n}\n\nexport async function getRecaptchaConfig(\n auth: Auth,\n request: GetRecaptchaConfigRequest\n): Promise<GetRecaptchaConfigResponse> {\n return _performApiRequest<\n GetRecaptchaConfigRequest,\n GetRecaptchaConfigResponse\n >(\n auth,\n HttpMethod.GET,\n Endpoint.GET_RECAPTCHA_CONFIG,\n _addTidIfNecessary(auth, request)\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Endpoint, HttpMethod, _performApiRequest } from '../index';\nimport { MfaEnrollment } from './mfa';\nimport { Auth } from '../../model/public_types';\n\nexport interface DeleteAccountRequest {\n idToken: string;\n}\n\nexport async function deleteAccount(\n auth: Auth,\n request: DeleteAccountRequest\n): Promise<void> {\n return _performApiRequest<DeleteAccountRequest, void>(\n auth,\n HttpMethod.POST,\n Endpoint.DELETE_ACCOUNT,\n request\n );\n}\n\nexport interface ProviderUserInfo {\n providerId: string;\n rawId?: string;\n email?: string;\n displayName?: string;\n photoUrl?: string;\n phoneNumber?: string;\n}\n\nexport interface DeleteLinkedAccountsRequest {\n idToken: string;\n deleteProvider: string[];\n}\n\nexport interface DeleteLinkedAccountsResponse {\n providerUserInfo: ProviderUserInfo[];\n}\n\nexport async function deleteLinkedAccounts(\n auth: Auth,\n request: DeleteLinkedAccountsRequest\n): Promise<DeleteLinkedAccountsResponse> {\n return _performApiRequest<\n DeleteLinkedAccountsRequest,\n DeleteLinkedAccountsResponse\n >(auth, HttpMethod.POST, Endpoint.SET_ACCOUNT_INFO, request);\n}\n\nexport interface APIUserInfo {\n localId?: string;\n displayName?: string;\n photoUrl?: string;\n email?: string;\n emailVerified?: boolean;\n phoneNumber?: string;\n lastLoginAt?: number;\n createdAt?: number;\n tenantId?: string;\n passwordHash?: string;\n providerUserInfo?: ProviderUserInfo[];\n mfaInfo?: MfaEnrollment[];\n}\n\nexport interface GetAccountInfoRequest {\n idToken: string;\n}\n\nexport interface GetAccountInfoResponse {\n users: APIUserInfo[];\n}\n\nexport async function getAccountInfo(\n auth: Auth,\n request: GetAccountInfoRequest\n): Promise<GetAccountInfoResponse> {\n return _performApiRequest<GetAccountInfoRequest, GetAccountInfoResponse>(\n auth,\n HttpMethod.POST,\n Endpoint.GET_ACCOUNT_INFO,\n request\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function utcTimestampToDateString(\n utcTimestamp?: string | number\n): string | undefined {\n if (!utcTimestamp) {\n return undefined;\n }\n try {\n // Convert to date object.\n const date = new Date(Number(utcTimestamp));\n // Test date is valid.\n if (!isNaN(date.getTime())) {\n // Convert to UTC date string.\n return date.toUTCString();\n }\n } catch (e) {\n // Do nothing. undefined will be returned.\n }\n return undefined;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IdTokenResult, ParsedToken, User } from '../../model/public_types';\nimport { base64Decode, getModularInstance } from '@firebase/util';\n\nimport { UserInternal } from '../../model/user';\nimport { _assert } from '../util/assert';\nimport { _logError } from '../util/log';\nimport { utcTimestampToDateString } from '../util/time';\nimport { AuthErrorCode } from '../errors';\n\n/**\n * Returns a JSON Web Token (JWT) used to identify the user to a Firebase service.\n *\n * @remarks\n * Returns the current token if it has not expired or if it will not expire in the next five\n * minutes. Otherwise, this will refresh the token and return a new one.\n *\n * @param user - The user.\n * @param forceRefresh - Force refresh regardless of token expiration.\n *\n * @public\n */\nexport function getIdToken(user: User, forceRefresh = false): Promise<string> {\n return getModularInstance(user).getIdToken(forceRefresh);\n}\n\n/**\n * Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service.\n *\n * @remarks\n * Returns the current token if it has not expired or if it will not expire in the next five\n * minutes. Otherwise, this will refresh the token and return a new one.\n *\n * @param user - The user.\n * @param forceRefresh - Force refresh regardless of token expiration.\n *\n * @public\n */\nexport async function getIdTokenResult(\n user: User,\n forceRefresh = false\n): Promise<IdTokenResult> {\n const userInternal = getModularInstance(user) as UserInternal;\n const token = await userInternal.getIdToken(forceRefresh);\n const claims = _parseToken(token);\n\n _assert(\n claims && claims.exp && claims.auth_time && claims.iat,\n userInternal.auth,\n AuthErrorCode.INTERNAL_ERROR\n );\n const firebase =\n typeof claims.firebase === 'object' ? claims.firebase : undefined;\n\n const signInProvider: string | undefined = firebase?.['sign_in_provider'];\n\n return {\n claims,\n token,\n authTime: utcTimestampToDateString(\n secondsStringToMilliseconds(claims.auth_time)\n )!,\n issuedAtTime: utcTimestampToDateString(\n secondsStringToMilliseconds(claims.iat)\n )!,\n expirationTime: utcTimestampToDateString(\n secondsStringToMilliseconds(claims.exp)\n )!,\n signInProvider: signInProvider || null,\n signInSecondFactor: firebase?.['sign_in_second_factor'] || null\n };\n}\n\nfunction secondsStringToMilliseconds(seconds: string): number {\n return Number(seconds) * 1000;\n}\n\nexport function _parseToken(token: string): ParsedToken | null {\n const [algorithm, payload, signature] = token.split('.');\n if (\n algorithm === undefined ||\n payload === undefined ||\n signature === undefined\n ) {\n _logError('JWT malformed, contained fewer than 3 sections');\n return null;\n }\n\n try {\n const decoded = base64Decode(payload);\n if (!decoded) {\n _logError('Failed to decode base64 JWT payload');\n return null;\n }\n return JSON.parse(decoded);\n } catch (e) {\n _logError(\n 'Caught error parsing JWT payload as JSON',\n (e as Error)?.toString()\n );\n return null;\n }\n}\n\n/**\n * Extract expiresIn TTL from a token by subtracting the expiration from the issuance.\n */\nexport function _tokenExpiresIn(token: string): number {\n const parsedToken = _parseToken(token);\n _assert(parsedToken, AuthErrorCode.INTERNAL_ERROR);\n _assert(typeof parsedToken.exp !== 'undefined', AuthErrorCode.INTERNAL_ERROR);\n _assert(typeof parsedToken.iat !== 'undefined', AuthErrorCode.INTERNAL_ERROR);\n return Number(parsedToken.exp) - Number(parsedToken.iat);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseError } from '@firebase/util';\n\nimport { UserInternal } from '../../model/user';\nimport { AuthErrorCode } from '../errors';\n\nexport async function _logoutIfInvalidated<T>(\n user: UserInternal,\n promise: Promise<T>,\n bypassAuthState = false\n): Promise<T> {\n if (bypassAuthState) {\n return promise;\n }\n try {\n return await promise;\n } catch (e) {\n if (e instanceof FirebaseError && isUserInvalidated(e)) {\n if (user.auth.currentUser === user) {\n await user.auth.signOut();\n }\n }\n\n throw e;\n }\n}\n\nfunction isUserInvalidated({ code }: FirebaseError): boolean {\n return (\n code === `auth/${AuthErrorCode.USER_DISABLED}` ||\n code === `auth/${AuthErrorCode.TOKEN_EXPIRED}`\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseError } from '@firebase/util';\nimport { UserInternal } from '../../model/user';\nimport { AuthErrorCode } from '../errors';\n\n// Refresh the token five minutes before expiration\nexport const enum Duration {\n OFFSET = 5 * 1000 * 60,\n RETRY_BACKOFF_MIN = 30 * 1000,\n RETRY_BACKOFF_MAX = 16 * 60 * 1000\n}\n\nexport class ProactiveRefresh {\n private isRunning = false;\n\n // Node timers and browser timers return fundamentally different types.\n // We don't actually care what the value is but TS won't accept unknown and\n // we can't cast properly in both environments.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private timerId: any | null = null;\n private errorBackoff = Duration.RETRY_BACKOFF_MIN;\n\n constructor(private readonly user: UserInternal) {}\n\n _start(): void {\n if (this.isRunning) {\n return;\n }\n\n this.isRunning = true;\n this.schedule();\n }\n\n _stop(): void {\n if (!this.isRunning) {\n return;\n }\n\n this.isRunning = false;\n if (this.timerId !== null) {\n clearTimeout(this.timerId);\n }\n }\n\n private getInterval(wasError: boolean): number {\n if (wasError) {\n const interval = this.errorBackoff;\n this.errorBackoff = Math.min(\n this.errorBackoff * 2,\n Duration.RETRY_BACKOFF_MAX\n );\n return interval;\n } else {\n // Reset the error backoff\n this.errorBackoff = Duration.RETRY_BACKOFF_MIN;\n const expTime = this.user.stsTokenManager.expirationTime ?? 0;\n const interval = expTime - Date.now() - Duration.OFFSET;\n\n return Math.max(0, interval);\n }\n }\n\n private schedule(wasError = false): void {\n if (!this.isRunning) {\n // Just in case...\n return;\n }\n\n const interval = this.getInterval(wasError);\n this.timerId = setTimeout(async () => {\n await this.iteration();\n }, interval);\n }\n\n private async iteration(): Promise<void> {\n try {\n await this.user.getIdToken(true);\n } catch (e) {\n // Only retry on network errors\n if (\n (e as FirebaseError)?.code ===\n `auth/${AuthErrorCode.NETWORK_REQUEST_FAILED}`\n ) {\n this.schedule(/* wasError */ true);\n }\n\n return;\n }\n this.schedule();\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { UserMetadata as UserMetadataType } from '../../model/public_types';\n\nimport { utcTimestampToDateString } from '../util/time';\n\nexport class UserMetadata implements UserMetadataType {\n creationTime?: string;\n lastSignInTime?: string;\n\n constructor(\n private createdAt?: string | number,\n private lastLoginAt?: string | number\n ) {\n this._initializeTime();\n }\n\n private _initializeTime(): void {\n this.lastSignInTime = utcTimestampToDateString(this.lastLoginAt);\n this.creationTime = utcTimestampToDateString(this.createdAt);\n }\n\n _copy(metadata: UserMetadata): void {\n this.createdAt = metadata.createdAt;\n this.lastLoginAt = metadata.lastLoginAt;\n this._initializeTime();\n }\n\n toJSON(): object {\n return {\n createdAt: this.createdAt,\n lastLoginAt: this.lastLoginAt\n };\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { User, UserInfo } from '../../model/public_types';\n\nimport {\n getAccountInfo,\n ProviderUserInfo\n} from '../../api/account_management/account';\nimport { UserInternal } from '../../model/user';\nimport { AuthErrorCode } from '../errors';\nimport { _assert } from '../util/assert';\nimport { _logoutIfInvalidated } from './invalidation';\nimport { UserMetadata } from './user_metadata';\nimport { getModularInstance } from '@firebase/util';\n\nexport async function _reloadWithoutSaving(user: UserInternal): Promise<void> {\n const auth = user.auth;\n const idToken = await user.getIdToken();\n const response = await _logoutIfInvalidated(\n user,\n getAccountInfo(auth, { idToken })\n );\n\n _assert(response?.users.length, auth, AuthErrorCode.INTERNAL_ERROR);\n\n const coreAccount = response.users[0];\n\n user._notifyReloadListener(coreAccount);\n\n const newProviderData = coreAccount.providerUserInfo?.length\n ? extractProviderData(coreAccount.providerUserInfo)\n : [];\n\n const providerData = mergeProviderData(user.providerData, newProviderData);\n\n // Preserves the non-nonymous status of the stored user, even if no more\n // credentials (federated or email/password) are linked to the user. If\n // the user was previously anonymous, then use provider data to update.\n // On the other hand, if it was not anonymous before, it should never be\n // considered anonymous now.\n const oldIsAnonymous = user.isAnonymous;\n const newIsAnonymous =\n !(user.email && coreAccount.passwordHash) && !providerData?.length;\n const isAnonymous = !oldIsAnonymous ? false : newIsAnonymous;\n\n const updates: Partial<UserInternal> = {\n uid: coreAccount.localId,\n displayName: coreAccount.displayName || null,\n photoURL: coreAccount.photoUrl || null,\n email: coreAccount.email || null,\n emailVerified: coreAccount.emailVerified || false,\n phoneNumber: coreAccount.phoneNumber || null,\n tenantId: coreAccount.tenantId || null,\n providerData,\n metadata: new UserMetadata(coreAccount.createdAt, coreAccount.lastLoginAt),\n isAnonymous\n };\n\n Object.assign(user, updates);\n}\n\n/**\n * Reloads user account data, if signed in.\n *\n * @param user - The user.\n *\n * @public\n */\nexport async function reload(user: User): Promise<void> {\n const userInternal: UserInternal = getModularInstance(user) as UserInternal;\n await _reloadWithoutSaving(userInternal);\n\n // Even though the current user hasn't changed, update\n // current user will trigger a persistence update w/ the\n // new info.\n await userInternal.auth._persistUserIfCurrent(userInternal);\n userInternal.auth._notifyListenersIfCurrent(userInternal);\n}\n\nfunction mergeProviderData(\n original: UserInfo[],\n newData: UserInfo[]\n): UserInfo[] {\n const deduped = original.filter(\n o => !newData.some(n => n.providerId === o.providerId)\n );\n return [...deduped, ...newData];\n}\n\nexport function extractProviderData(providers: ProviderUserInfo[]): UserInfo[] {\n return providers.map(({ providerId, ...provider }) => {\n return {\n providerId,\n uid: provider.rawId || '',\n displayName: provider.displayName || null,\n email: provider.email || null,\n phoneNumber: provider.phoneNumber || null,\n photoURL: provider.photoUrl || null\n };\n });\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable camelcase */\n\nimport { isCloudWorkstation, querystring } from '@firebase/util';\n\nimport {\n _getFinalTarget,\n _performFetchWithErrorHandling,\n _performApiRequest,\n _addTidIfNecessary,\n HttpMethod,\n HttpHeader,\n Endpoint\n} from '../index';\nimport { FetchProvider } from '../../core/util/fetch_provider';\nimport { Auth } from '../../model/public_types';\nimport { AuthInternal } from '../../model/auth';\n\nexport const enum TokenType {\n REFRESH_TOKEN = 'REFRESH_TOKEN',\n ACCESS_TOKEN = 'ACCESS_TOKEN'\n}\n\n/** The server responses with snake_case; we convert to camelCase */\ninterface RequestStsTokenServerResponse {\n access_token: string;\n expires_in: string;\n refresh_token: string;\n}\n\nexport interface RequestStsTokenResponse {\n accessToken: string;\n expiresIn: string;\n refreshToken: string;\n}\n\nexport interface RevokeTokenRequest {\n providerId: string;\n tokenType: TokenType;\n token: string;\n idToken: string;\n tenantId?: string;\n}\n\nexport interface RevokeTokenResponse {}\n\nexport async function requestStsToken(\n auth: Auth,\n refreshToken: string\n): Promise<RequestStsTokenResponse> {\n const response =\n await _performFetchWithErrorHandling<RequestStsTokenServerResponse>(\n auth,\n {},\n async () => {\n const body = querystring({\n 'grant_type': 'refresh_token',\n 'refresh_token': refreshToken\n }).slice(1);\n const { tokenApiHost, apiKey } = auth.config;\n const url = await _getFinalTarget(\n auth,\n tokenApiHost,\n Endpoint.TOKEN,\n `key=${apiKey}`\n );\n\n const headers = await (auth as AuthInternal)._getAdditionalHeaders();\n headers[HttpHeader.CONTENT_TYPE] = 'application/x-www-form-urlencoded';\n\n const options: RequestInit = {\n method: HttpMethod.POST,\n headers,\n body\n };\n if (\n auth.emulatorConfig &&\n isCloudWorkstation(auth.emulatorConfig.host)\n ) {\n options.credentials = 'include';\n }\n return FetchProvider.fetch()(url, options);\n }\n );\n\n // The response comes back in snake_case. Convert to camel:\n return {\n accessToken: response.access_token,\n expiresIn: response.expires_in,\n refreshToken: response.refresh_token\n };\n}\n\nexport async function revokeToken(\n auth: Auth,\n request: RevokeTokenRequest\n): Promise<RevokeTokenResponse> {\n return _performApiRequest<RevokeTokenRequest, RevokeTokenResponse>(\n auth,\n HttpMethod.POST,\n Endpoint.REVOKE_TOKEN,\n _addTidIfNecessary(auth, request)\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FinalizeMfaResponse } from '../../api/authentication/mfa';\nimport { requestStsToken } from '../../api/authentication/token';\nimport { AuthInternal } from '../../model/auth';\nimport { IdTokenResponse } from '../../model/id_token';\nimport { AuthErrorCode } from '../errors';\nimport { PersistedBlob } from '../persistence';\nimport { _assert, debugFail } from '../util/assert';\nimport { _tokenExpiresIn } from './id_token_result';\n\n/**\n * The number of milliseconds before the official expiration time of a token\n * to refresh that token, to provide a buffer for RPCs to complete.\n */\nexport const enum Buffer {\n TOKEN_REFRESH = 30_000\n}\n\n/**\n * We need to mark this class as internal explicitly to exclude it in the public typings, because\n * it references AuthInternal which has a circular dependency with UserInternal.\n *\n * @internal\n */\nexport class StsTokenManager {\n refreshToken: string | null = null;\n accessToken: string | null = null;\n expirationTime: number | null = null;\n\n get isExpired(): boolean {\n return (\n !this.expirationTime ||\n Date.now() > this.expirationTime - Buffer.TOKEN_REFRESH\n );\n }\n\n updateFromServerResponse(\n response: IdTokenResponse | FinalizeMfaResponse\n ): void {\n _assert(response.idToken, AuthErrorCode.INTERNAL_ERROR);\n _assert(\n typeof response.idToken !== 'undefined',\n AuthErrorCode.INTERNAL_ERROR\n );\n _assert(\n typeof response.refreshToken !== 'undefined',\n AuthErrorCode.INTERNAL_ERROR\n );\n const expiresIn =\n 'expiresIn' in response && typeof response.expiresIn !== 'undefined'\n ? Number(response.expiresIn)\n : _tokenExpiresIn(response.idToken);\n this.updateTokensAndExpiration(\n response.idToken,\n response.refreshToken,\n expiresIn\n );\n }\n\n updateFromIdToken(idToken: string): void {\n _assert(idToken.length !== 0, AuthErrorCode.INTERNAL_ERROR);\n const expiresIn = _tokenExpiresIn(idToken);\n this.updateTokensAndExpiration(idToken, null, expiresIn);\n }\n\n async getToken(\n auth: AuthInternal,\n forceRefresh = false\n ): Promise<string | null> {\n if (!forceRefresh && this.accessToken && !this.isExpired) {\n return this.accessToken;\n }\n\n _assert(this.refreshToken, auth, AuthErrorCode.TOKEN_EXPIRED);\n\n if (this.refreshToken) {\n await this.refresh(auth, this.refreshToken!);\n return this.accessToken;\n }\n\n return null;\n }\n\n clearRefreshToken(): void {\n this.refreshToken = null;\n }\n\n private async refresh(auth: AuthInternal, oldToken: string): Promise<void> {\n const { accessToken, refreshToken, expiresIn } = await requestStsToken(\n auth,\n oldToken\n );\n this.updateTokensAndExpiration(\n accessToken,\n refreshToken,\n Number(expiresIn)\n );\n }\n\n private updateTokensAndExpiration(\n accessToken: string,\n refreshToken: string | null,\n expiresInSec: number\n ): void {\n this.refreshToken = refreshToken || null;\n this.accessToken = accessToken || null;\n this.expirationTime = Date.now() + expiresInSec * 1000;\n }\n\n static fromJSON(appName: string, object: PersistedBlob): StsTokenManager {\n const { refreshToken, accessToken, expirationTime } = object;\n\n const manager = new StsTokenManager();\n if (refreshToken) {\n _assert(typeof refreshToken === 'string', AuthErrorCode.INTERNAL_ERROR, {\n appName\n });\n manager.refreshToken = refreshToken;\n }\n if (accessToken) {\n _assert(typeof accessToken === 'string', AuthErrorCode.INTERNAL_ERROR, {\n appName\n });\n manager.accessToken = accessToken;\n }\n if (expirationTime) {\n _assert(\n typeof expirationTime === 'number',\n AuthErrorCode.INTERNAL_ERROR,\n {\n appName\n }\n );\n manager.expirationTime = expirationTime;\n }\n return manager;\n }\n\n toJSON(): object {\n return {\n refreshToken: this.refreshToken,\n accessToken: this.accessToken,\n expirationTime: this.expirationTime\n };\n }\n\n _assign(stsTokenManager: StsTokenManager): void {\n this.accessToken = stsTokenManager.accessToken;\n this.refreshToken = stsTokenManager.refreshToken;\n this.expirationTime = stsTokenManager.expirationTime;\n }\n\n _clone(): StsTokenManager {\n return Object.assign(new StsTokenManager(), this.toJSON());\n }\n\n _performRefresh(): never {\n return debugFail('not implemented');\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IdTokenResult, UserInfo } from '../../model/public_types';\nimport { NextFn } from '@firebase/util';\nimport {\n APIUserInfo,\n GetAccountInfoResponse,\n deleteAccount\n} from '../../api/account_management/account';\nimport { FinalizeMfaResponse } from '../../api/authentication/mfa';\nimport { AuthInternal } from '../../model/auth';\nimport { IdTokenResponse } from '../../model/id_token';\nimport {\n MutableUserInfo,\n UserInternal,\n UserParameters\n} from '../../model/user';\nimport { AuthErrorCode } from '../errors';\nimport { PersistedBlob } from '../persistence';\nimport {\n _assert,\n _serverAppCurrentUserOperationNotSupportedError\n} from '../util/assert';\nimport { getIdTokenResult } from './id_token_result';\nimport { _logoutIfInvalidated } from './invalidation';\nimport { ProactiveRefresh } from './proactive_refresh';\nimport { extractProviderData, _reloadWithoutSaving, reload } from './reload';\nimport { StsTokenManager } from './token_manager';\nimport { UserMetadata } from './user_metadata';\nimport { ProviderId } from '../../model/enums';\nimport { _isFirebaseServerApp } from '@firebase/app';\n\nfunction assertStringOrUndefined(\n assertion: unknown,\n appName: string\n): asserts assertion is string | undefined {\n _assert(\n typeof assertion === 'string' || typeof assertion === 'undefined',\n AuthErrorCode.INTERNAL_ERROR,\n { appName }\n );\n}\n\nexport class UserImpl implements UserInternal {\n // For the user object, provider is always Firebase.\n readonly providerId = ProviderId.FIREBASE;\n stsTokenManager: StsTokenManager;\n // Last known accessToken so we know when it changes\n private accessToken: string | null;\n\n uid: string;\n auth: AuthInternal;\n emailVerified: boolean;\n isAnonymous: boolean;\n tenantId: string | null;\n readonly metadata: UserMetadata;\n providerData: MutableUserInfo[];\n\n // Optional fields from UserInfo\n displayName: string | null;\n email: string | null;\n phoneNumber: string | null;\n photoURL: string | null;\n\n _redirectEventId?: string;\n private readonly proactiveRefresh = new ProactiveRefresh(this);\n\n constructor({ uid, auth, stsTokenManager, ...opt }: UserParameters) {\n this.uid = uid;\n this.auth = auth;\n this.stsTokenManager = stsTokenManager;\n this.accessToken = stsTokenManager.accessToken;\n this.displayName = opt.displayName || null;\n this.email = opt.email || null;\n this.emailVerified = opt.emailVerified || false;\n this.phoneNumber = opt.phoneNumber || null;\n this.photoURL = opt.photoURL || null;\n this.isAnonymous = opt.isAnonymous || false;\n this.tenantId = opt.tenantId || null;\n this.providerData = opt.providerData ? [...opt.providerData] : [];\n this.metadata = new UserMetadata(\n opt.createdAt || undefined,\n opt.lastLoginAt || undefined\n );\n }\n\n async getIdToken(forceRefresh?: boolean): Promise<string> {\n const accessToken = await _logoutIfInvalidated(\n this,\n this.stsTokenManager.getToken(this.auth, forceRefresh)\n );\n _assert(accessToken, this.auth, AuthErrorCode.INTERNAL_ERROR);\n\n if (this.accessToken !== accessToken) {\n this.accessToken = accessToken;\n await this.auth._persistUserIfCurrent(this);\n this.auth._notifyListenersIfCurrent(this);\n }\n\n return accessToken;\n }\n\n getIdTokenResult(forceRefresh?: boolean): Promise<IdTokenResult> {\n return getIdTokenResult(this, forceRefresh);\n }\n\n reload(): Promise<void> {\n return reload(this);\n }\n\n private reloadUserInfo: APIUserInfo | null = null;\n private reloadListener: NextFn<APIUserInfo> | null = null;\n\n _assign(user: UserInternal): void {\n if (this === user) {\n return;\n }\n _assert(this.uid === user.uid, this.auth, AuthErrorCode.INTERNAL_ERROR);\n this.displayName = user.displayName;\n this.photoURL = user.photoURL;\n this.email = user.email;\n this.emailVerified = user.emailVerified;\n this.phoneNumber = user.phoneNumber;\n this.isAnonymous = user.isAnonymous;\n this.tenantId = user.tenantId;\n this.providerData = user.providerData.map(userInfo => ({ ...userInfo }));\n this.metadata._copy(user.metadata);\n this.stsTokenManager._assign(user.stsTokenManager);\n }\n\n _clone(auth: AuthInternal): UserInternal {\n const newUser = new UserImpl({\n ...this,\n auth,\n stsTokenManager: this.stsTokenManager._clone()\n });\n newUser.metadata._copy(this.metadata);\n return newUser;\n }\n\n _onReload(callback: NextFn<APIUserInfo>): void {\n // There should only ever be one listener, and that is a single instance of MultiFactorUser\n _assert(!this.reloadListener, this.auth, AuthErrorCode.INTERNAL_ERROR);\n this.reloadListener = callback;\n if (this.reloadUserInfo) {\n this._notifyReloadListener(this.reloadUserInfo);\n this.reloadUserInfo = null;\n }\n }\n\n _notifyReloadListener(userInfo: APIUserInfo): void {\n if (this.reloadListener) {\n this.reloadListener(userInfo);\n } else {\n // If no listener is subscribed yet, save the result so it's available when they do subscribe\n this.reloadUserInfo = userInfo;\n }\n }\n\n _startProactiveRefresh(): void {\n this.proactiveRefresh._start();\n }\n\n _stopProactiveRefresh(): void {\n this.proactiveRefresh._stop();\n }\n\n async _updateTokensIfNecessary(\n response: IdTokenResponse | FinalizeMfaResponse,\n reload = false\n ): Promise<void> {\n let tokensRefreshed = false;\n if (\n response.idToken &&\n response.idToken !== this.stsTokenManager.accessToken\n ) {\n this.stsTokenManager.updateFromServerResponse(response);\n tokensRefreshed = true;\n }\n\n if (reload) {\n await _reloadWithoutSaving(this);\n }\n\n await this.auth._persistUserIfCurrent(this);\n if (tokensRefreshed) {\n this.auth._notifyListenersIfCurrent(this);\n }\n }\n\n async delete(): Promise<void> {\n if (_isFirebaseServerApp(this.auth.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(this.auth)\n );\n }\n const idToken = await this.getIdToken();\n await _logoutIfInvalidated(this, deleteAccount(this.auth, { idToken }));\n this.stsTokenManager.clearRefreshToken();\n\n // TODO: Determine if cancellable-promises are necessary to use in this class so that delete()\n // cancels pending actions...\n\n return this.auth.signOut();\n }\n\n toJSON(): PersistedBlob {\n return {\n uid: this.uid,\n email: this.email || undefined,\n emailVerified: this.emailVerified,\n displayName: this.displayName || undefined,\n isAnonymous: this.isAnonymous,\n photoURL: this.photoURL || undefined,\n phoneNumber: this.phoneNumber || undefined,\n tenantId: this.tenantId || undefined,\n providerData: this.providerData.map(userInfo => ({ ...userInfo })),\n stsTokenManager: this.stsTokenManager.toJSON(),\n // Redirect event ID must be maintained in case there is a pending\n // redirect event.\n _redirectEventId: this._redirectEventId,\n ...this.metadata.toJSON(),\n\n // Required for compatibility with the legacy SDK (go/firebase-auth-sdk-persistence-parsing):\n apiKey: this.auth.config.apiKey,\n appName: this.auth.name\n // Missing authDomain will be tolerated by the legacy SDK.\n // stsTokenManager.apiKey isn't actually required (despite the legacy SDK persisting it).\n };\n }\n\n get refreshToken(): string {\n return this.stsTokenManager.refreshToken || '';\n }\n\n static _fromJSON(auth: AuthInternal, object: PersistedBlob): UserInternal {\n const displayName = object.displayName ?? undefined;\n const email = object.email ?? undefined;\n const phoneNumber = object.phoneNumber ?? undefined;\n const photoURL = object.photoURL ?? undefined;\n const tenantId = object.tenantId ?? undefined;\n const _redirectEventId = object._redirectEventId ?? undefined;\n const createdAt = object.createdAt ?? undefined;\n const lastLoginAt = object.lastLoginAt ?? undefined;\n const {\n uid,\n emailVerified,\n isAnonymous,\n providerData,\n stsTokenManager: plainObjectTokenManager\n } = object;\n\n _assert(uid && plainObjectTokenManager, auth, AuthErrorCode.INTERNAL_ERROR);\n\n const stsTokenManager = StsTokenManager.fromJSON(\n this.name,\n plainObjectTokenManager as PersistedBlob\n );\n\n _assert(typeof uid === 'string', auth, AuthErrorCode.INTERNAL_ERROR);\n assertStringOrUndefined(displayName, auth.name);\n assertStringOrUndefined(email, auth.name);\n _assert(\n typeof emailVerified === 'boolean',\n auth,\n AuthErrorCode.INTERNAL_ERROR\n );\n _assert(\n typeof isAnonymous === 'boolean',\n auth,\n AuthErrorCode.INTERNAL_ERROR\n );\n assertStringOrUndefined(phoneNumber, auth.name);\n assertStringOrUndefined(photoURL, auth.name);\n assertStringOrUndefined(tenantId, auth.name);\n assertStringOrUndefined(_redirectEventId, auth.name);\n assertStringOrUndefined(createdAt, auth.name);\n assertStringOrUndefined(lastLoginAt, auth.name);\n const user = new UserImpl({\n uid,\n auth,\n email,\n emailVerified,\n displayName,\n isAnonymous,\n photoURL,\n phoneNumber,\n tenantId,\n stsTokenManager,\n createdAt,\n lastLoginAt\n });\n\n if (providerData && Array.isArray(providerData)) {\n user.providerData = providerData.map(userInfo => ({ ...userInfo }));\n }\n\n if (_redirectEventId) {\n user._redirectEventId = _redirectEventId;\n }\n\n return user;\n }\n\n /**\n * Initialize a User from an idToken server response\n * @param auth\n * @param idTokenResponse\n */\n static async _fromIdTokenResponse(\n auth: AuthInternal,\n idTokenResponse: IdTokenResponse,\n isAnonymous: boolean = false\n ): Promise<UserInternal> {\n const stsTokenManager = new StsTokenManager();\n stsTokenManager.updateFromServerResponse(idTokenResponse);\n\n // Initialize the Firebase Auth user.\n const user = new UserImpl({\n uid: idTokenResponse.localId,\n auth,\n stsTokenManager,\n isAnonymous\n });\n\n // Updates the user info and data and resolves with a user instance.\n await _reloadWithoutSaving(user);\n return user;\n }\n\n /**\n * Initialize a User from an idToken server response\n * @param auth\n * @param idTokenResponse\n */\n static async _fromGetAccountInfoResponse(\n auth: AuthInternal,\n response: GetAccountInfoResponse,\n idToken: string\n ): Promise<UserInternal> {\n const coreAccount = response.users[0];\n _assert(coreAccount.localId !== undefined, AuthErrorCode.INTERNAL_ERROR);\n\n const providerData: UserInfo[] =\n coreAccount.providerUserInfo !== undefined\n ? extractProviderData(coreAccount.providerUserInfo)\n : [];\n\n const isAnonymous =\n !(coreAccount.email && coreAccount.passwordHash) && !providerData?.length;\n\n const stsTokenManager = new StsTokenManager();\n stsTokenManager.updateFromIdToken(idToken);\n\n // Initialize the Firebase Auth user.\n const user = new UserImpl({\n uid: coreAccount.localId,\n auth,\n stsTokenManager,\n isAnonymous\n });\n\n // update the user with data from the GetAccountInfo response.\n const updates: Partial<UserInternal> = {\n uid: coreAccount.localId,\n displayName: coreAccount.displayName || null,\n photoURL: coreAccount.photoUrl || null,\n email: coreAccount.email || null,\n emailVerified: coreAccount.emailVerified || false,\n phoneNumber: coreAccount.phoneNumber || null,\n tenantId: coreAccount.tenantId || null,\n providerData,\n metadata: new UserMetadata(\n coreAccount.createdAt,\n coreAccount.lastLoginAt\n ),\n isAnonymous:\n !(coreAccount.email && coreAccount.passwordHash) &&\n !providerData?.length\n };\n\n Object.assign(user, updates);\n return user;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { debugAssert } from './assert';\n\n/**\n * Our API has a lot of one-off constants that are used to do things.\n * Unfortunately we can't export these as classes instantiated directly since\n * the constructor may side effect and therefore can't be proven to be safely\n * culled. Instead, we export these classes themselves as a lowerCamelCase\n * constant, and instantiate them under the hood.\n */\nexport interface SingletonInstantiator<T> {\n new (): T;\n}\n\nconst instanceCache: Map<unknown, unknown> = new Map();\n\nexport function _getInstance<T>(cls: unknown): T {\n debugAssert(cls instanceof Function, 'Expected a class definition');\n let instance = instanceCache.get(cls) as T | undefined;\n\n if (instance) {\n debugAssert(\n instance instanceof cls,\n 'Instance stored in cache mismatched with class'\n );\n return instance;\n }\n\n instance = new (cls as SingletonInstantiator<T>)();\n instanceCache.set(cls, instance);\n return instance;\n}\n\nexport function _clearInstanceMap(): void {\n instanceCache.clear();\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Persistence } from '../../model/public_types';\n\nimport {\n PersistenceInternal,\n PersistenceType,\n PersistenceValue,\n StorageEventListener\n} from '../persistence';\n\nexport class InMemoryPersistence implements PersistenceInternal {\n static type: 'NONE' = 'NONE';\n readonly type = PersistenceType.NONE;\n storage: Record<string, PersistenceValue> = {};\n\n async _isAvailable(): Promise<boolean> {\n return true;\n }\n\n async _set(key: string, value: PersistenceValue): Promise<void> {\n this.storage[key] = value;\n }\n\n async _get<T extends PersistenceValue>(key: string): Promise<T | null> {\n const value = this.storage[key];\n return value === undefined ? null : (value as T);\n }\n\n async _remove(key: string): Promise<void> {\n delete this.storage[key];\n }\n\n _addListener(_key: string, _listener: StorageEventListener): void {\n // Listeners are not supported for in-memory storage since it cannot be shared across windows/workers\n return;\n }\n\n _removeListener(_key: string, _listener: StorageEventListener): void {\n // Listeners are not supported for in-memory storage since it cannot be shared across windows/workers\n return;\n }\n}\n\n/**\n * An implementation of {@link Persistence} of type 'NONE'.\n *\n * @public\n */\nexport const inMemoryPersistence: Persistence = InMemoryPersistence;\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getAccountInfo } from '../../api/account_management/account';\nimport { ApiKey, AppName, AuthInternal } from '../../model/auth';\nimport { UserInternal } from '../../model/user';\nimport { PersistedBlob, PersistenceInternal } from '../persistence';\nimport { UserImpl } from '../user/user_impl';\nimport { _getInstance } from '../util/instantiator';\nimport { inMemoryPersistence } from './in_memory';\n\nexport const enum KeyName {\n AUTH_USER = 'authUser',\n AUTH_EVENT = 'authEvent',\n REDIRECT_USER = 'redirectUser',\n PERSISTENCE_USER = 'persistence'\n}\nexport const enum Namespace {\n PERSISTENCE = 'firebase'\n}\n\nexport function _persistenceKeyName(\n key: string,\n apiKey: ApiKey,\n appName: AppName\n): string {\n return `${Namespace.PERSISTENCE}:${key}:${apiKey}:${appName}`;\n}\n\nexport class PersistenceUserManager {\n private readonly fullUserKey: string;\n private readonly fullPersistenceKey: string;\n private readonly boundEventHandler: () => void;\n\n private constructor(\n public persistence: PersistenceInternal,\n private readonly auth: AuthInternal,\n private readonly userKey: string\n ) {\n const { config, name } = this.auth;\n this.fullUserKey = _persistenceKeyName(this.userKey, config.apiKey, name);\n this.fullPersistenceKey = _persistenceKeyName(\n KeyName.PERSISTENCE_USER,\n config.apiKey,\n name\n );\n this.boundEventHandler = auth._onStorageEvent.bind(auth);\n this.persistence._addListener(this.fullUserKey, this.boundEventHandler);\n }\n\n setCurrentUser(user: UserInternal): Promise<void> {\n return this.persistence._set(this.fullUserKey, user.toJSON());\n }\n\n async getCurrentUser(): Promise<UserInternal | null> {\n const blob = await this.persistence._get<PersistedBlob | string>(\n this.fullUserKey\n );\n if (!blob) {\n return null;\n }\n if (typeof blob === 'string') {\n const response = await getAccountInfo(this.auth, { idToken: blob }).catch(\n () => undefined\n );\n if (!response) {\n return null;\n }\n return UserImpl._fromGetAccountInfoResponse(this.auth, response, blob);\n }\n return UserImpl._fromJSON(this.auth, blob);\n }\n\n removeCurrentUser(): Promise<void> {\n return this.persistence._remove(this.fullUserKey);\n }\n\n savePersistenceForRedirect(): Promise<void> {\n return this.persistence._set(\n this.fullPersistenceKey,\n this.persistence.type\n );\n }\n\n async setPersistence(newPersistence: PersistenceInternal): Promise<void> {\n if (this.persistence === newPersistence) {\n return;\n }\n\n const currentUser = await this.getCurrentUser();\n await this.removeCurrentUser();\n\n this.persistence = newPersistence;\n\n if (currentUser) {\n return this.setCurrentUser(currentUser);\n }\n }\n\n delete(): void {\n this.persistence._removeListener(this.fullUserKey, this.boundEventHandler);\n }\n\n static async create(\n auth: AuthInternal,\n persistenceHierarchy: PersistenceInternal[],\n userKey = KeyName.AUTH_USER\n ): Promise<PersistenceUserManager> {\n if (!persistenceHierarchy.length) {\n return new PersistenceUserManager(\n _getInstance(inMemoryPersistence),\n auth,\n userKey\n );\n }\n\n // Eliminate any persistences that are not available\n const availablePersistences = (\n await Promise.all(\n persistenceHierarchy.map(async persistence => {\n if (await persistence._isAvailable()) {\n return persistence;\n }\n return undefined;\n })\n )\n ).filter(persistence => persistence) as PersistenceInternal[];\n\n // Fall back to the first persistence listed, or in memory if none available\n let selectedPersistence =\n availablePersistences[0] ||\n _getInstance<PersistenceInternal>(inMemoryPersistence);\n\n const key = _persistenceKeyName(userKey, auth.config.apiKey, auth.name);\n\n // Pull out the existing user, setting the chosen persistence to that\n // persistence if the user exists.\n let userToMigrate: UserInternal | null = null;\n // Note, here we check for a user in _all_ persistences, not just the\n // ones deemed available. If we can migrate a user out of a broken\n // persistence, we will (but only if that persistence supports migration).\n for (const persistence of persistenceHierarchy) {\n try {\n const blob = await persistence._get<PersistedBlob | string>(key);\n if (blob) {\n let user: UserInternal;\n if (typeof blob === 'string') {\n const response = await getAccountInfo(auth, {\n idToken: blob\n }).catch(() => undefined);\n if (!response) {\n break;\n }\n user = await UserImpl._fromGetAccountInfoResponse(\n auth,\n response,\n blob\n );\n } else {\n user = UserImpl._fromJSON(auth, blob); // throws for unparsable blob (wrong format)\n }\n if (persistence !== selectedPersistence) {\n userToMigrate = user;\n }\n selectedPersistence = persistence;\n break;\n }\n } catch {}\n }\n\n // If we find the user in a persistence that does support migration, use\n // that migration path (of only persistences that support migration)\n const migrationHierarchy = availablePersistences.filter(\n p => p._shouldAllowMigration\n );\n\n // If the persistence does _not_ allow migration, just finish off here\n if (\n !selectedPersistence._shouldAllowMigration ||\n !migrationHierarchy.length\n ) {\n return new PersistenceUserManager(selectedPersistence, auth, userKey);\n }\n\n selectedPersistence = migrationHierarchy[0];\n if (userToMigrate) {\n // This normally shouldn't throw since chosenPersistence.isAvailable() is true, but if it does\n // we'll just let it bubble to surface the error.\n await selectedPersistence._set(key, userToMigrate.toJSON());\n }\n\n // Attempt to clear the key in other persistences but ignore errors. This helps prevent issues\n // such as users getting stuck with a previous account after signing out and refreshing the tab.\n await Promise.all(\n persistenceHierarchy.map(async persistence => {\n if (persistence !== selectedPersistence) {\n try {\n await persistence._remove(key);\n } catch {}\n }\n })\n );\n return new PersistenceUserManager(selectedPersistence, auth, userKey);\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isIE, getUA } from '@firebase/util';\n\ninterface NavigatorStandalone extends Navigator {\n standalone?: unknown;\n}\n\ninterface Document {\n documentMode?: number;\n}\n\n/**\n * Enums for Browser name.\n */\nexport const enum BrowserName {\n ANDROID = 'Android',\n BLACKBERRY = 'Blackberry',\n EDGE = 'Edge',\n FIREFOX = 'Firefox',\n IE = 'IE',\n IEMOBILE = 'IEMobile',\n OPERA = 'Opera',\n OTHER = 'Other',\n CHROME = 'Chrome',\n SAFARI = 'Safari',\n SILK = 'Silk',\n WEBOS = 'Webos'\n}\n\n/**\n * Determine the browser for the purposes of reporting usage to the API\n */\nexport function _getBrowserName(userAgent: string): BrowserName | string {\n const ua = userAgent.toLowerCase();\n if (ua.includes('opera/') || ua.includes('opr/') || ua.includes('opios/')) {\n return BrowserName.OPERA;\n } else if (_isIEMobile(ua)) {\n // Windows phone IEMobile browser.\n return BrowserName.IEMOBILE;\n } else if (ua.includes('msie') || ua.includes('trident/')) {\n return BrowserName.IE;\n } else if (ua.includes('edge/')) {\n return BrowserName.EDGE;\n } else if (_isFirefox(ua)) {\n return BrowserName.FIREFOX;\n } else if (ua.includes('silk/')) {\n return BrowserName.SILK;\n } else if (_isBlackBerry(ua)) {\n // Blackberry browser.\n return BrowserName.BLACKBERRY;\n } else if (_isWebOS(ua)) {\n // WebOS default browser.\n return BrowserName.WEBOS;\n } else if (_isSafari(ua)) {\n return BrowserName.SAFARI;\n } else if (\n (ua.includes('chrome/') || _isChromeIOS(ua)) &&\n !ua.includes('edge/')\n ) {\n return BrowserName.CHROME;\n } else if (_isAndroid(ua)) {\n // Android stock browser.\n return BrowserName.ANDROID;\n } else {\n // Most modern browsers have name/version at end of user agent string.\n const re = /([a-zA-Z\\d\\.]+)\\/[a-zA-Z\\d\\.]*$/;\n const matches = userAgent.match(re);\n if (matches?.length === 2) {\n return matches[1];\n }\n }\n return BrowserName.OTHER;\n}\n\nexport function _isFirefox(ua = getUA()): boolean {\n return /firefox\\//i.test(ua);\n}\n\nexport function _isSafari(userAgent = getUA()): boolean {\n const ua = userAgent.toLowerCase();\n return (\n ua.includes('safari/') &&\n !ua.includes('chrome/') &&\n !ua.includes('crios/') &&\n !ua.includes('android')\n );\n}\n\nexport function _isChromeIOS(ua = getUA()): boolean {\n return /crios\\//i.test(ua);\n}\n\nexport function _isIEMobile(ua = getUA()): boolean {\n return /iemobile/i.test(ua);\n}\n\nexport function _isAndroid(ua = getUA()): boolean {\n return /android/i.test(ua);\n}\n\nexport function _isBlackBerry(ua = getUA()): boolean {\n return /blackberry/i.test(ua);\n}\n\nexport function _isWebOS(ua = getUA()): boolean {\n return /webos/i.test(ua);\n}\n\nexport function _isIOS(ua = getUA()): boolean {\n return (\n /iphone|ipad|ipod/i.test(ua) ||\n (/macintosh/i.test(ua) && /mobile/i.test(ua))\n );\n}\n\nexport function _isIOS7Or8(ua = getUA()): boolean {\n return (\n /(iPad|iPhone|iPod).*OS 7_\\d/i.test(ua) ||\n /(iPad|iPhone|iPod).*OS 8_\\d/i.test(ua)\n );\n}\n\nexport function _isIOSStandalone(ua = getUA()): boolean {\n return _isIOS(ua) && !!(window.navigator as NavigatorStandalone)?.standalone;\n}\n\nexport function _isIE10(): boolean {\n return isIE() && (document as Document).documentMode === 10;\n}\n\nexport function _isMobileBrowser(ua: string = getUA()): boolean {\n // TODO: implement getBrowserName equivalent for OS.\n return (\n _isIOS(ua) ||\n _isAndroid(ua) ||\n _isWebOS(ua) ||\n _isBlackBerry(ua) ||\n /windows phone/i.test(ua) ||\n _isIEMobile(ua)\n );\n}\n\nexport function _isIframe(): boolean {\n try {\n // Check that the current window is not the top window.\n // If so, return true.\n return !!(window && window !== window.top);\n } catch (e) {\n return false;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SDK_VERSION } from '@firebase/app';\nimport { _getBrowserName } from './browser';\nimport { getUA } from '@firebase/util';\n\nexport const enum ClientImplementation {\n CORE = 'JsCore'\n}\n\n/**\n * @internal\n */\nexport const enum ClientPlatform {\n BROWSER = 'Browser',\n NODE = 'Node',\n REACT_NATIVE = 'ReactNative',\n CORDOVA = 'Cordova',\n WORKER = 'Worker',\n WEB_EXTENSION = 'WebExtension'\n}\n\n/*\n * Determine the SDK version string\n */\nexport function _getClientVersion(\n clientPlatform: ClientPlatform,\n frameworks: readonly string[] = []\n): string {\n let reportedPlatform: string;\n switch (clientPlatform) {\n case ClientPlatform.BROWSER:\n // In a browser environment, report the browser name.\n reportedPlatform = _getBrowserName(getUA());\n break;\n case ClientPlatform.WORKER:\n // Technically a worker runs from a browser but we need to differentiate a\n // worker from a browser.\n // For example: Chrome-Worker/JsCore/4.9.1/FirebaseCore-web.\n reportedPlatform = `${_getBrowserName(getUA())}-${clientPlatform}`;\n break;\n default:\n reportedPlatform = clientPlatform;\n }\n const reportedFrameworks = frameworks.length\n ? frameworks.join(',')\n : 'FirebaseCore-web'; /* default value if no other framework is used */\n return `${reportedPlatform}/${ClientImplementation.CORE}/${SDK_VERSION}/${reportedFrameworks}`;\n}\n","/**\n * @license\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AuthInternal } from '../../model/auth';\nimport { Unsubscribe, User } from '../../model/public_types';\nimport { AuthErrorCode } from '../errors';\n\ninterface MiddlewareEntry {\n (user: User | null): Promise<void>;\n onAbort?: () => void;\n}\n\nexport class AuthMiddlewareQueue {\n private readonly queue: MiddlewareEntry[] = [];\n\n constructor(private readonly auth: AuthInternal) {}\n\n pushCallback(\n callback: (user: User | null) => void | Promise<void>,\n onAbort?: () => void\n ): Unsubscribe {\n // The callback could be sync or async. Wrap it into a\n // function that is always async.\n const wrappedCallback: MiddlewareEntry = (\n user: User | null\n ): Promise<void> =>\n new Promise((resolve, reject) => {\n try {\n const result = callback(user);\n // Either resolve with existing promise or wrap a non-promise\n // return value into a promise.\n resolve(result);\n } catch (e) {\n // Sync callback throws.\n reject(e);\n }\n });\n // Attach the onAbort if present\n wrappedCallback.onAbort = onAbort;\n this.queue.push(wrappedCallback);\n\n const index = this.queue.length - 1;\n return () => {\n // Unsubscribe. Replace with no-op. Do not remove from array, or it will disturb\n // indexing of other elements.\n this.queue[index] = () => Promise.resolve();\n };\n }\n\n async runMiddleware(nextUser: User | null): Promise<void> {\n if (this.auth.currentUser === nextUser) {\n return;\n }\n\n // While running the middleware, build a temporary stack of onAbort\n // callbacks to call if one middleware callback rejects.\n\n const onAbortStack: Array<() => void> = [];\n try {\n for (const beforeStateCallback of this.queue) {\n await beforeStateCallback(nextUser);\n\n // Only push the onAbort if the callback succeeds\n if (beforeStateCallback.onAbort) {\n onAbortStack.push(beforeStateCallback.onAbort);\n }\n }\n } catch (e) {\n // Run all onAbort, with separate try/catch to ignore any errors and\n // continue\n onAbortStack.reverse();\n for (const onAbort of onAbortStack) {\n try {\n onAbort();\n } catch (_) {\n /* swallow error */\n }\n }\n\n throw this.auth._errorFactory.create(AuthErrorCode.LOGIN_BLOCKED, {\n originalMessage: (e as Error)?.message\n });\n }\n }\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n _performApiRequest,\n Endpoint,\n HttpMethod,\n _addTidIfNecessary\n} from '../index';\nimport { Auth } from '../../model/public_types';\n\n/**\n * Request object for fetching the password policy.\n */\nexport interface GetPasswordPolicyRequest {\n tenantId?: string;\n}\n\n/**\n * Response object for fetching the password policy.\n */\nexport interface GetPasswordPolicyResponse {\n customStrengthOptions: {\n minPasswordLength?: number;\n maxPasswordLength?: number;\n containsLowercaseCharacter?: boolean;\n containsUppercaseCharacter?: boolean;\n containsNumericCharacter?: boolean;\n containsNonAlphanumericCharacter?: boolean;\n };\n allowedNonAlphanumericCharacters?: string[];\n enforcementState: string;\n forceUpgradeOnSignin?: boolean;\n schemaVersion: number;\n}\n\n/**\n * Fetches the password policy for the currently set tenant or the project if no tenant is set.\n *\n * @param auth Auth object.\n * @param request Password policy request.\n * @returns Password policy response.\n */\nexport async function _getPasswordPolicy(\n auth: Auth,\n request: GetPasswordPolicyRequest = {}\n): Promise<GetPasswordPolicyResponse> {\n return _performApiRequest<\n GetPasswordPolicyRequest,\n GetPasswordPolicyResponse\n >(\n auth,\n HttpMethod.GET,\n Endpoint.GET_PASSWORD_POLICY,\n _addTidIfNecessary(auth, request)\n );\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { GetPasswordPolicyResponse } from '../../api/password_policy/get_password_policy';\nimport {\n PasswordPolicyCustomStrengthOptions,\n PasswordPolicyInternal,\n PasswordValidationStatusInternal\n} from '../../model/password_policy';\nimport { PasswordValidationStatus } from '../../model/public_types';\n\n// Minimum min password length enforced by the backend, even if no minimum length is set.\nconst MINIMUM_MIN_PASSWORD_LENGTH = 6;\n\n/**\n * Stores password policy requirements and provides password validation against the policy.\n *\n * @internal\n */\nexport class PasswordPolicyImpl implements PasswordPolicyInternal {\n readonly customStrengthOptions: PasswordPolicyCustomStrengthOptions;\n readonly allowedNonAlphanumericCharacters: string;\n readonly enforcementState: string;\n readonly forceUpgradeOnSignin: boolean;\n readonly schemaVersion: number;\n\n constructor(response: GetPasswordPolicyResponse) {\n // Only include custom strength options defined in the response.\n const responseOptions = response.customStrengthOptions;\n this.customStrengthOptions = {};\n // TODO: Remove once the backend is updated to include the minimum min password length instead of undefined when there is no minimum length set.\n this.customStrengthOptions.minPasswordLength =\n responseOptions.minPasswordLength ?? MINIMUM_MIN_PASSWORD_LENGTH;\n if (responseOptions.maxPasswordLength) {\n this.customStrengthOptions.maxPasswordLength =\n responseOptions.maxPasswordLength;\n }\n if (responseOptions.containsLowercaseCharacter !== undefined) {\n this.customStrengthOptions.containsLowercaseLetter =\n responseOptions.containsLowercaseCharacter;\n }\n if (responseOptions.containsUppercaseCharacter !== undefined) {\n this.customStrengthOptions.containsUppercaseLetter =\n responseOptions.containsUppercaseCharacter;\n }\n if (responseOptions.containsNumericCharacter !== undefined) {\n this.customStrengthOptions.containsNumericCharacter =\n responseOptions.containsNumericCharacter;\n }\n if (responseOptions.containsNonAlphanumericCharacter !== undefined) {\n this.customStrengthOptions.containsNonAlphanumericCharacter =\n responseOptions.containsNonAlphanumericCharacter;\n }\n\n this.enforcementState = response.enforcementState;\n if (this.enforcementState === 'ENFORCEMENT_STATE_UNSPECIFIED') {\n this.enforcementState = 'OFF';\n }\n\n // Use an empty string if no non-alphanumeric characters are specified in the response.\n this.allowedNonAlphanumericCharacters =\n response.allowedNonAlphanumericCharacters?.join('') ?? '';\n\n this.forceUpgradeOnSignin = response.forceUpgradeOnSignin ?? false;\n this.schemaVersion = response.schemaVersion;\n }\n\n validatePassword(password: string): PasswordValidationStatus {\n const status: PasswordValidationStatusInternal = {\n isValid: true,\n passwordPolicy: this\n };\n\n // Check the password length and character options.\n this.validatePasswordLengthOptions(password, status);\n this.validatePasswordCharacterOptions(password, status);\n\n // Combine the status into single isValid property.\n status.isValid &&= status.meetsMinPasswordLength ?? true;\n status.isValid &&= status.meetsMaxPasswordLength ?? true;\n status.isValid &&= status.containsLowercaseLetter ?? true;\n status.isValid &&= status.containsUppercaseLetter ?? true;\n status.isValid &&= status.containsNumericCharacter ?? true;\n status.isValid &&= status.containsNonAlphanumericCharacter ?? true;\n\n return status;\n }\n\n /**\n * Validates that the password meets the length options for the policy.\n *\n * @param password Password to validate.\n * @param status Validation status.\n */\n private validatePasswordLengthOptions(\n password: string,\n status: PasswordValidationStatusInternal\n ): void {\n const minPasswordLength = this.customStrengthOptions.minPasswordLength;\n const maxPasswordLength = this.customStrengthOptions.maxPasswordLength;\n if (minPasswordLength) {\n status.meetsMinPasswordLength = password.length >= minPasswordLength;\n }\n if (maxPasswordLength) {\n status.meetsMaxPasswordLength = password.length <= maxPasswordLength;\n }\n }\n\n /**\n * Validates that the password meets the character options for the policy.\n *\n * @param password Password to validate.\n * @param status Validation status.\n */\n private validatePasswordCharacterOptions(\n password: string,\n status: PasswordValidationStatusInternal\n ): void {\n // Assign statuses for requirements even if the password is an empty string.\n this.updatePasswordCharacterOptionsStatuses(\n status,\n /* containsLowercaseCharacter= */ false,\n /* containsUppercaseCharacter= */ false,\n /* containsNumericCharacter= */ false,\n /* containsNonAlphanumericCharacter= */ false\n );\n\n let passwordChar;\n for (let i = 0; i < password.length; i++) {\n passwordChar = password.charAt(i);\n this.updatePasswordCharacterOptionsStatuses(\n status,\n /* containsLowercaseCharacter= */ passwordChar >= 'a' &&\n passwordChar <= 'z',\n /* containsUppercaseCharacter= */ passwordChar >= 'A' &&\n passwordChar <= 'Z',\n /* containsNumericCharacter= */ passwordChar >= '0' &&\n passwordChar <= '9',\n /* containsNonAlphanumericCharacter= */ this.allowedNonAlphanumericCharacters.includes(\n passwordChar\n )\n );\n }\n }\n\n /**\n * Updates the running validation status with the statuses for the character options.\n * Expected to be called each time a character is processed to update each option status\n * based on the current character.\n *\n * @param status Validation status.\n * @param containsLowercaseCharacter Whether the character is a lowercase letter.\n * @param containsUppercaseCharacter Whether the character is an uppercase letter.\n * @param containsNumericCharacter Whether the character is a numeric character.\n * @param containsNonAlphanumericCharacter Whether the character is a non-alphanumeric character.\n */\n private updatePasswordCharacterOptionsStatuses(\n status: PasswordValidationStatusInternal,\n containsLowercaseCharacter: boolean,\n containsUppercaseCharacter: boolean,\n containsNumericCharacter: boolean,\n containsNonAlphanumericCharacter: boolean\n ): void {\n if (this.customStrengthOptions.containsLowercaseLetter) {\n status.containsLowercaseLetter ||= containsLowercaseCharacter;\n }\n if (this.customStrengthOptions.containsUppercaseLetter) {\n status.containsUppercaseLetter ||= containsUppercaseCharacter;\n }\n if (this.customStrengthOptions.containsNumericCharacter) {\n status.containsNumericCharacter ||= containsNumericCharacter;\n }\n if (this.customStrengthOptions.containsNonAlphanumericCharacter) {\n status.containsNonAlphanumericCharacter ||=\n containsNonAlphanumericCharacter;\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n _isFirebaseServerApp,\n _FirebaseService,\n FirebaseApp\n} from '@firebase/app';\nimport { Provider } from '@firebase/component';\nimport { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';\nimport {\n Auth,\n AuthErrorMap,\n AuthSettings,\n EmulatorConfig,\n NextOrObserver,\n Persistence,\n PopupRedirectResolver,\n User,\n UserCredential,\n CompleteFn,\n ErrorFn,\n NextFn,\n Unsubscribe,\n PasswordValidationStatus\n} from '../../model/public_types';\nimport {\n createSubscribe,\n ErrorFactory,\n FirebaseError,\n getModularInstance,\n Observer,\n Subscribe\n} from '@firebase/util';\n\nimport { AuthInternal, ConfigInternal } from '../../model/auth';\nimport { PopupRedirectResolverInternal } from '../../model/popup_redirect';\nimport { UserInternal } from '../../model/user';\nimport {\n AuthErrorCode,\n AuthErrorParams,\n ErrorMapRetriever,\n _DEFAULT_AUTH_ERROR_FACTORY\n} from '../errors';\nimport { PersistenceInternal } from '../persistence';\nimport {\n KeyName,\n PersistenceUserManager\n} from '../persistence/persistence_user_manager';\nimport { _reloadWithoutSaving } from '../user/reload';\nimport {\n _assert,\n _serverAppCurrentUserOperationNotSupportedError\n} from '../util/assert';\nimport { _getInstance } from '../util/instantiator';\nimport { _getUserLanguage } from '../util/navigator';\nimport { _getClientVersion } from '../util/version';\nimport { HttpHeader } from '../../api';\nimport {\n RevokeTokenRequest,\n TokenType,\n revokeToken\n} from '../../api/authentication/token';\nimport { AuthMiddlewareQueue } from './middleware';\nimport { RecaptchaConfig } from '../../platform_browser/recaptcha/recaptcha';\nimport { _logWarn } from '../util/log';\nimport { _getPasswordPolicy } from '../../api/password_policy/get_password_policy';\nimport { PasswordPolicyInternal } from '../../model/password_policy';\nimport { PasswordPolicyImpl } from './password_policy_impl';\nimport { getAccountInfo } from '../../api/account_management/account';\nimport { UserImpl } from '../user/user_impl';\n\ninterface AsyncAction {\n (): Promise<void>;\n}\n\nexport const enum DefaultConfig {\n TOKEN_API_HOST = 'securetoken.googleapis.com',\n API_HOST = 'identitytoolkit.googleapis.com',\n API_SCHEME = 'https'\n}\n\nexport class AuthImpl implements AuthInternal, _FirebaseService {\n currentUser: User | null = null;\n emulatorConfig: EmulatorConfig | null = null;\n private operations = Promise.resolve();\n private persistenceManager?: PersistenceUserManager;\n private redirectPersistenceManager?: PersistenceUserManager;\n private authStateSubscription = new Subscription<User>(this);\n private idTokenSubscription = new Subscription<User>(this);\n private readonly beforeStateQueue = new AuthMiddlewareQueue(this);\n private redirectUser: UserInternal | null = null;\n private isProactiveRefreshEnabled = false;\n private readonly EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION: number = 1;\n\n // Any network calls will set this to true and prevent subsequent emulator\n // initialization\n _canInitEmulator = true;\n _isInitialized = false;\n _deleted = false;\n _initializationPromise: Promise<void> | null = null;\n _popupRedirectResolver: PopupRedirectResolverInternal | null = null;\n _errorFactory: ErrorFactory<AuthErrorCode, AuthErrorParams> =\n _DEFAULT_AUTH_ERROR_FACTORY;\n _agentRecaptchaConfig: RecaptchaConfig | null = null;\n _tenantRecaptchaConfigs: Record<string, RecaptchaConfig> = {};\n _projectPasswordPolicy: PasswordPolicyInternal | null = null;\n _tenantPasswordPolicies: Record<string, PasswordPolicyInternal> = {};\n _resolvePersistenceManagerAvailable:\n | ((value: void | PromiseLike<void>) => void)\n | undefined = undefined;\n _persistenceManagerAvailable: Promise<void>;\n readonly name: string;\n\n // Tracks the last notified UID for state change listeners to prevent\n // repeated calls to the callbacks. Undefined means it's never been\n // called, whereas null means it's been called with a signed out user\n private lastNotifiedUid: string | null | undefined = undefined;\n\n languageCode: string | null = null;\n tenantId: string | null = null;\n settings: AuthSettings = { appVerificationDisabledForTesting: false };\n\n constructor(\n public readonly app: FirebaseApp,\n private readonly heartbeatServiceProvider: Provider<'heartbeat'>,\n private readonly appCheckServiceProvider: Provider<AppCheckInternalComponentName>,\n public readonly config: ConfigInternal\n ) {\n this.name = app.name;\n this.clientVersion = config.sdkClientVersion;\n // TODO(jamesdaniels) explore less hacky way to do this, cookie authentication needs\n // persistenceMananger to be available. see _getFinalTarget for more context\n this._persistenceManagerAvailable = new Promise<void>(\n resolve => (this._resolvePersistenceManagerAvailable = resolve)\n );\n }\n\n _initializeWithPersistence(\n persistenceHierarchy: PersistenceInternal[],\n popupRedirectResolver?: PopupRedirectResolver\n ): Promise<void> {\n if (popupRedirectResolver) {\n this._popupRedirectResolver = _getInstance(popupRedirectResolver);\n }\n\n // Have to check for app deletion throughout initialization (after each\n // promise resolution)\n this._initializationPromise = this.queue(async () => {\n if (this._deleted) {\n return;\n }\n\n this.persistenceManager = await PersistenceUserManager.create(\n this,\n persistenceHierarchy\n );\n this._resolvePersistenceManagerAvailable?.();\n\n if (this._deleted) {\n return;\n }\n\n // Initialize the resolver early if necessary (only applicable to web:\n // this will cause the iframe to load immediately in certain cases)\n if (this._popupRedirectResolver?._shouldInitProactively) {\n // If this fails, don't halt auth loading\n try {\n await this._popupRedirectResolver._initialize(this);\n } catch (e) {\n /* Ignore the error */\n }\n }\n\n await this.initializeCurrentUser(popupRedirectResolver);\n\n this.lastNotifiedUid = this.currentUser?.uid || null;\n\n if (this._deleted) {\n return;\n }\n\n this._isInitialized = true;\n });\n\n return this._initializationPromise;\n }\n\n /**\n * If the persistence is changed in another window, the user manager will let us know\n */\n async _onStorageEvent(): Promise<void> {\n if (this._deleted) {\n return;\n }\n\n const user = await this.assertedPersistence.getCurrentUser();\n\n if (!this.currentUser && !user) {\n // No change, do nothing (was signed out and remained signed out).\n return;\n }\n\n // If the same user is to be synchronized.\n if (this.currentUser && user && this.currentUser.uid === user.uid) {\n // Data update, simply copy data changes.\n this._currentUser._assign(user);\n // If tokens changed from previous user tokens, this will trigger\n // notifyAuthListeners_.\n await this.currentUser.getIdToken();\n return;\n }\n\n // Update current Auth state. Either a new login or logout.\n // Skip blocking callbacks, they should not apply to a change in another tab.\n await this._updateCurrentUser(user, /* skipBeforeStateCallbacks */ true);\n }\n\n private async initializeCurrentUserFromIdToken(\n idToken: string\n ): Promise<void> {\n try {\n const response = await getAccountInfo(this, { idToken });\n const user = await UserImpl._fromGetAccountInfoResponse(\n this,\n response,\n idToken\n );\n await this.directlySetCurrentUser(user);\n } catch (err) {\n console.warn(\n 'FirebaseServerApp could not login user with provided authIdToken: ',\n err\n );\n await this.directlySetCurrentUser(null);\n }\n }\n\n private async initializeCurrentUser(\n popupRedirectResolver?: PopupRedirectResolver\n ): Promise<void> {\n if (_isFirebaseServerApp(this.app)) {\n const idToken = this.app.settings.authIdToken;\n if (idToken) {\n // Start the auth operation in the next tick to allow a moment for the customer's app to\n // attach an emulator, if desired.\n return new Promise<void>(resolve => {\n setTimeout(() =>\n this.initializeCurrentUserFromIdToken(idToken).then(\n resolve,\n resolve\n )\n );\n });\n } else {\n return this.directlySetCurrentUser(null);\n }\n }\n\n // First check to see if we have a pending redirect event.\n const previouslyStoredUser =\n (await this.assertedPersistence.getCurrentUser()) as UserInternal | null;\n let futureCurrentUser = previouslyStoredUser;\n let needsTocheckMiddleware = false;\n if (popupRedirectResolver && this.config.authDomain) {\n await this.getOrInitRedirectPersistenceManager();\n const redirectUserEventId = this.redirectUser?._redirectEventId;\n const storedUserEventId = futureCurrentUser?._redirectEventId;\n const result = await this.tryRedirectSignIn(popupRedirectResolver);\n\n // If the stored user (i.e. the old \"currentUser\") has a redirectId that\n // matches the redirect user, then we want to initially sign in with the\n // new user object from result.\n // TODO(samgho): More thoroughly test all of this\n if (\n (!redirectUserEventId || redirectUserEventId === storedUserEventId) &&\n result?.user\n ) {\n futureCurrentUser = result.user as UserInternal;\n needsTocheckMiddleware = true;\n }\n }\n\n // If no user in persistence, there is no current user. Set to null.\n if (!futureCurrentUser) {\n return this.directlySetCurrentUser(null);\n }\n\n if (!futureCurrentUser._redirectEventId) {\n // This isn't a redirect link operation, we can reload and bail.\n // First though, ensure that we check the middleware is happy.\n if (needsTocheckMiddleware) {\n try {\n await this.beforeStateQueue.runMiddleware(futureCurrentUser);\n } catch (e) {\n futureCurrentUser = previouslyStoredUser;\n // We know this is available since the bit is only set when the\n // resolver is available\n this._popupRedirectResolver!._overrideRedirectResult(this, () =>\n Promise.reject(e)\n );\n }\n }\n\n if (futureCurrentUser) {\n return this.reloadAndSetCurrentUserOrClear(futureCurrentUser);\n } else {\n return this.directlySetCurrentUser(null);\n }\n }\n\n _assert(this._popupRedirectResolver, this, AuthErrorCode.ARGUMENT_ERROR);\n await this.getOrInitRedirectPersistenceManager();\n\n // If the redirect user's event ID matches the current user's event ID,\n // DO NOT reload the current user, otherwise they'll be cleared from storage.\n // This is important for the reauthenticateWithRedirect() flow.\n if (\n this.redirectUser &&\n this.redirectUser._redirectEventId === futureCurrentUser._redirectEventId\n ) {\n return this.directlySetCurrentUser(futureCurrentUser);\n }\n\n return this.reloadAndSetCurrentUserOrClear(futureCurrentUser);\n }\n\n private async tryRedirectSignIn(\n redirectResolver: PopupRedirectResolver\n ): Promise<UserCredential | null> {\n // The redirect user needs to be checked (and signed in if available)\n // during auth initialization. All of the normal sign in and link/reauth\n // flows call back into auth and push things onto the promise queue. We\n // need to await the result of the redirect sign in *inside the promise\n // queue*. This presents a problem: we run into deadlock. See:\n // ┌> [Initialization] ─────┐\n // ┌> [<other queue tasks>] │\n // └─ [getRedirectResult] <─┘\n // where [] are tasks on the queue and arrows denote awaits\n // Initialization will never complete because it's waiting on something\n // that's waiting for initialization to complete!\n //\n // Instead, this method calls getRedirectResult() (stored in\n // _completeRedirectFn) with an optional parameter that instructs all of\n // the underlying auth operations to skip anything that mutates auth state.\n\n let result: UserCredential | null = null;\n try {\n // We know this._popupRedirectResolver is set since redirectResolver\n // is passed in. The _completeRedirectFn expects the unwrapped extern.\n result = await this._popupRedirectResolver!._completeRedirectFn(\n this,\n redirectResolver,\n true\n );\n } catch (e) {\n // Swallow any errors here; the code can retrieve them in\n // getRedirectResult().\n await this._setRedirectUser(null);\n }\n\n return result;\n }\n\n private async reloadAndSetCurrentUserOrClear(\n user: UserInternal\n ): Promise<void> {\n try {\n await _reloadWithoutSaving(user);\n } catch (e) {\n if (\n (e as FirebaseError)?.code !==\n `auth/${AuthErrorCode.NETWORK_REQUEST_FAILED}`\n ) {\n // Something's wrong with the user's token. Log them out and remove\n // them from storage\n return this.directlySetCurrentUser(null);\n }\n }\n\n return this.directlySetCurrentUser(user);\n }\n\n useDeviceLanguage(): void {\n this.languageCode = _getUserLanguage();\n }\n\n async _delete(): Promise<void> {\n this._deleted = true;\n }\n\n async updateCurrentUser(userExtern: User | null): Promise<void> {\n if (_isFirebaseServerApp(this.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(this)\n );\n }\n // The public updateCurrentUser method needs to make a copy of the user,\n // and also check that the project matches\n const user = userExtern\n ? (getModularInstance(userExtern) as UserInternal)\n : null;\n if (user) {\n _assert(\n user.auth.config.apiKey === this.config.apiKey,\n this,\n AuthErrorCode.INVALID_AUTH\n );\n }\n return this._updateCurrentUser(user && user._clone(this));\n }\n\n async _updateCurrentUser(\n user: User | null,\n skipBeforeStateCallbacks: boolean = false\n ): Promise<void> {\n if (this._deleted) {\n return;\n }\n if (user) {\n _assert(\n this.tenantId === user.tenantId,\n this,\n AuthErrorCode.TENANT_ID_MISMATCH\n );\n }\n\n if (!skipBeforeStateCallbacks) {\n await this.beforeStateQueue.runMiddleware(user);\n }\n\n return this.queue(async () => {\n await this.directlySetCurrentUser(user as UserInternal | null);\n this.notifyAuthListeners();\n });\n }\n\n async signOut(): Promise<void> {\n if (_isFirebaseServerApp(this.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(this)\n );\n }\n // Run first, to block _setRedirectUser() if any callbacks fail.\n await this.beforeStateQueue.runMiddleware(null);\n // Clear the redirect user when signOut is called\n if (this.redirectPersistenceManager || this._popupRedirectResolver) {\n await this._setRedirectUser(null);\n }\n\n // Prevent callbacks from being called again in _updateCurrentUser, as\n // they were already called in the first line.\n return this._updateCurrentUser(null, /* skipBeforeStateCallbacks */ true);\n }\n\n setPersistence(persistence: Persistence): Promise<void> {\n if (_isFirebaseServerApp(this.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(this)\n );\n }\n return this.queue(async () => {\n await this.assertedPersistence.setPersistence(_getInstance(persistence));\n });\n }\n\n _getRecaptchaConfig(): RecaptchaConfig | null {\n if (this.tenantId == null) {\n return this._agentRecaptchaConfig;\n } else {\n return this._tenantRecaptchaConfigs[this.tenantId];\n }\n }\n\n async validatePassword(password: string): Promise<PasswordValidationStatus> {\n if (!this._getPasswordPolicyInternal()) {\n await this._updatePasswordPolicy();\n }\n\n // Password policy will be defined after fetching.\n const passwordPolicy: PasswordPolicyInternal =\n this._getPasswordPolicyInternal()!;\n\n // Check that the policy schema version is supported by the SDK.\n // TODO: Update this logic to use a max supported policy schema version once we have multiple schema versions.\n if (\n passwordPolicy.schemaVersion !==\n this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION\n ) {\n return Promise.reject(\n this._errorFactory.create(\n AuthErrorCode.UNSUPPORTED_PASSWORD_POLICY_SCHEMA_VERSION,\n {}\n )\n );\n }\n\n return passwordPolicy.validatePassword(password);\n }\n\n _getPasswordPolicyInternal(): PasswordPolicyInternal | null {\n if (this.tenantId === null) {\n return this._projectPasswordPolicy;\n } else {\n return this._tenantPasswordPolicies[this.tenantId];\n }\n }\n\n async _updatePasswordPolicy(): Promise<void> {\n const response = await _getPasswordPolicy(this);\n\n const passwordPolicy: PasswordPolicyInternal = new PasswordPolicyImpl(\n response\n );\n\n if (this.tenantId === null) {\n this._projectPasswordPolicy = passwordPolicy;\n } else {\n this._tenantPasswordPolicies[this.tenantId] = passwordPolicy;\n }\n }\n\n _getPersistenceType(): string {\n return this.assertedPersistence.persistence.type;\n }\n\n _getPersistence(): PersistenceInternal {\n return this.assertedPersistence.persistence;\n }\n\n _updateErrorMap(errorMap: AuthErrorMap): void {\n this._errorFactory = new ErrorFactory<AuthErrorCode, AuthErrorParams>(\n 'auth',\n 'Firebase',\n (errorMap as ErrorMapRetriever)()\n );\n }\n\n onAuthStateChanged(\n nextOrObserver: NextOrObserver<User>,\n error?: ErrorFn,\n completed?: CompleteFn\n ): Unsubscribe {\n return this.registerStateListener(\n this.authStateSubscription,\n nextOrObserver,\n error,\n completed\n );\n }\n\n beforeAuthStateChanged(\n callback: (user: User | null) => void | Promise<void>,\n onAbort?: () => void\n ): Unsubscribe {\n return this.beforeStateQueue.pushCallback(callback, onAbort);\n }\n\n onIdTokenChanged(\n nextOrObserver: NextOrObserver<User>,\n error?: ErrorFn,\n completed?: CompleteFn\n ): Unsubscribe {\n return this.registerStateListener(\n this.idTokenSubscription,\n nextOrObserver,\n error,\n completed\n );\n }\n\n authStateReady(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (this.currentUser) {\n resolve();\n } else {\n const unsubscribe = this.onAuthStateChanged(() => {\n unsubscribe();\n resolve();\n }, reject);\n }\n });\n }\n\n /**\n * Revokes the given access token. Currently only supports Apple OAuth access tokens.\n */\n async revokeAccessToken(token: string): Promise<void> {\n if (this.currentUser) {\n const idToken = await this.currentUser.getIdToken();\n // Generalize this to accept other providers once supported.\n const request: RevokeTokenRequest = {\n providerId: 'apple.com',\n tokenType: TokenType.ACCESS_TOKEN,\n token,\n idToken\n };\n if (this.tenantId != null) {\n request.tenantId = this.tenantId;\n }\n await revokeToken(this, request);\n }\n }\n\n toJSON(): object {\n return {\n apiKey: this.config.apiKey,\n authDomain: this.config.authDomain,\n appName: this.name,\n currentUser: this._currentUser?.toJSON()\n };\n }\n\n async _setRedirectUser(\n user: UserInternal | null,\n popupRedirectResolver?: PopupRedirectResolver\n ): Promise<void> {\n const redirectManager = await this.getOrInitRedirectPersistenceManager(\n popupRedirectResolver\n );\n return user === null\n ? redirectManager.removeCurrentUser()\n : redirectManager.setCurrentUser(user);\n }\n\n private async getOrInitRedirectPersistenceManager(\n popupRedirectResolver?: PopupRedirectResolver\n ): Promise<PersistenceUserManager> {\n if (!this.redirectPersistenceManager) {\n const resolver: PopupRedirectResolverInternal | null =\n (popupRedirectResolver && _getInstance(popupRedirectResolver)) ||\n this._popupRedirectResolver;\n _assert(resolver, this, AuthErrorCode.ARGUMENT_ERROR);\n this.redirectPersistenceManager = await PersistenceUserManager.create(\n this,\n [_getInstance(resolver._redirectPersistence)],\n KeyName.REDIRECT_USER\n );\n this.redirectUser =\n await this.redirectPersistenceManager.getCurrentUser();\n }\n\n return this.redirectPersistenceManager;\n }\n\n async _redirectUserForId(id: string): Promise<UserInternal | null> {\n // Make sure we've cleared any pending persistence actions if we're not in\n // the initializer\n if (this._isInitialized) {\n await this.queue(async () => {});\n }\n\n if (this._currentUser?._redirectEventId === id) {\n return this._currentUser;\n }\n\n if (this.redirectUser?._redirectEventId === id) {\n return this.redirectUser;\n }\n\n return null;\n }\n\n async _persistUserIfCurrent(user: UserInternal): Promise<void> {\n if (user === this.currentUser) {\n return this.queue(async () => this.directlySetCurrentUser(user));\n }\n }\n\n /** Notifies listeners only if the user is current */\n _notifyListenersIfCurrent(user: UserInternal): void {\n if (user === this.currentUser) {\n this.notifyAuthListeners();\n }\n }\n\n _key(): string {\n return `${this.config.authDomain}:${this.config.apiKey}:${this.name}`;\n }\n\n _startProactiveRefresh(): void {\n this.isProactiveRefreshEnabled = true;\n if (this.currentUser) {\n this._currentUser._startProactiveRefresh();\n }\n }\n\n _stopProactiveRefresh(): void {\n this.isProactiveRefreshEnabled = false;\n if (this.currentUser) {\n this._currentUser._stopProactiveRefresh();\n }\n }\n\n /** Returns the current user cast as the internal type */\n get _currentUser(): UserInternal {\n return this.currentUser as UserInternal;\n }\n\n private notifyAuthListeners(): void {\n if (!this._isInitialized) {\n return;\n }\n\n this.idTokenSubscription.next(this.currentUser);\n\n const currentUid = this.currentUser?.uid ?? null;\n if (this.lastNotifiedUid !== currentUid) {\n this.lastNotifiedUid = currentUid;\n this.authStateSubscription.next(this.currentUser);\n }\n }\n\n private registerStateListener(\n subscription: Subscription<User>,\n nextOrObserver: NextOrObserver<User>,\n error?: ErrorFn,\n completed?: CompleteFn\n ): Unsubscribe {\n if (this._deleted) {\n return () => {};\n }\n\n const cb =\n typeof nextOrObserver === 'function'\n ? nextOrObserver\n : nextOrObserver.next.bind(nextOrObserver);\n\n let isUnsubscribed = false;\n\n const promise = this._isInitialized\n ? Promise.resolve()\n : this._initializationPromise;\n _assert(promise, this, AuthErrorCode.INTERNAL_ERROR);\n // The callback needs to be called asynchronously per the spec.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n promise.then(() => {\n if (isUnsubscribed) {\n return;\n }\n cb(this.currentUser);\n });\n\n if (typeof nextOrObserver === 'function') {\n const unsubscribe = subscription.addObserver(\n nextOrObserver,\n error,\n completed\n );\n return () => {\n isUnsubscribed = true;\n unsubscribe();\n };\n } else {\n const unsubscribe = subscription.addObserver(nextOrObserver);\n return () => {\n isUnsubscribed = true;\n unsubscribe();\n };\n }\n }\n\n /**\n * Unprotected (from race conditions) method to set the current user. This\n * should only be called from within a queued callback. This is necessary\n * because the queue shouldn't rely on another queued callback.\n */\n private async directlySetCurrentUser(\n user: UserInternal | null\n ): Promise<void> {\n if (this.currentUser && this.currentUser !== user) {\n this._currentUser._stopProactiveRefresh();\n }\n if (user && this.isProactiveRefreshEnabled) {\n user._startProactiveRefresh();\n }\n\n this.currentUser = user;\n\n if (user) {\n await this.assertedPersistence.setCurrentUser(user);\n } else {\n await this.assertedPersistence.removeCurrentUser();\n }\n }\n\n private queue(action: AsyncAction): Promise<void> {\n // In case something errors, the callback still should be called in order\n // to keep the promise chain alive\n this.operations = this.operations.then(action, action);\n return this.operations;\n }\n\n private get assertedPersistence(): PersistenceUserManager {\n _assert(this.persistenceManager, this, AuthErrorCode.INTERNAL_ERROR);\n return this.persistenceManager;\n }\n\n private frameworks: string[] = [];\n private clientVersion: string;\n _logFramework(framework: string): void {\n if (!framework || this.frameworks.includes(framework)) {\n return;\n }\n this.frameworks.push(framework);\n\n // Sort alphabetically so that \"FirebaseCore-web,FirebaseUI-web\" and\n // \"FirebaseUI-web,FirebaseCore-web\" aren't viewed as different.\n this.frameworks.sort();\n this.clientVersion = _getClientVersion(\n this.config.clientPlatform,\n this._getFrameworks()\n );\n }\n _getFrameworks(): readonly string[] {\n return this.frameworks;\n }\n async _getAdditionalHeaders(): Promise<Record<string, string>> {\n // Additional headers on every request\n const headers: Record<string, string> = {\n [HttpHeader.X_CLIENT_VERSION]: this.clientVersion\n };\n\n if (this.app.options.appId) {\n headers[HttpHeader.X_FIREBASE_GMPID] = this.app.options.appId;\n }\n\n // If the heartbeat service exists, add the heartbeat string\n const heartbeatsHeader = await this.heartbeatServiceProvider\n .getImmediate({\n optional: true\n })\n ?.getHeartbeatsHeader();\n if (heartbeatsHeader) {\n headers[HttpHeader.X_FIREBASE_CLIENT] = heartbeatsHeader;\n }\n\n // If the App Check service exists, add the App Check token in the headers\n const appCheckToken = await this._getAppCheckToken();\n if (appCheckToken) {\n headers[HttpHeader.X_FIREBASE_APP_CHECK] = appCheckToken;\n }\n\n return headers;\n }\n\n async _getAppCheckToken(): Promise<string | undefined> {\n if (_isFirebaseServerApp(this.app) && this.app.settings.appCheckToken) {\n return this.app.settings.appCheckToken;\n }\n const appCheckTokenResult = await this.appCheckServiceProvider\n .getImmediate({ optional: true })\n ?.getToken();\n if (appCheckTokenResult?.error) {\n // Context: appCheck.getToken() will never throw even if an error happened.\n // In the error case, a dummy token will be returned along with an error field describing\n // the error. In general, we shouldn't care about the error condition and just use\n // the token (actual or dummy) to send requests.\n _logWarn(\n `Error while retrieving App Check token: ${appCheckTokenResult.error}`\n );\n }\n return appCheckTokenResult?.token;\n }\n}\n\n/**\n * Method to be used to cast down to our private implementation of Auth.\n * It will also handle unwrapping from the compat type if necessary\n *\n * @param auth Auth object passed in from developer\n */\nexport function _castAuth(auth: Auth): AuthInternal {\n return getModularInstance(auth) as AuthInternal;\n}\n\n/** Helper class to wrap subscriber logic */\nclass Subscription<T> {\n private observer: Observer<T | null> | null = null;\n readonly addObserver: Subscribe<T | null> = createSubscribe(\n observer => (this.observer = observer)\n );\n\n constructor(readonly auth: AuthInternal) {}\n\n get next(): NextFn<T | null> {\n _assert(this.observer, this.auth, AuthErrorCode.INTERNAL_ERROR);\n return this.observer.next.bind(this.observer);\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ninterface ExternalJSProvider {\n loadJS(url: string): Promise<Event>;\n recaptchaV2Script: string;\n recaptchaEnterpriseScript: string;\n gapiScript: string;\n}\n\nlet externalJSProvider: ExternalJSProvider = {\n async loadJS() {\n throw new Error('Unable to load external scripts');\n },\n\n recaptchaV2Script: '',\n recaptchaEnterpriseScript: '',\n gapiScript: ''\n};\n\nexport function _setExternalJSProvider(p: ExternalJSProvider): void {\n externalJSProvider = p;\n}\n\nexport function _loadJS(url: string): Promise<Event> {\n return externalJSProvider.loadJS(url);\n}\n\nexport function _recaptchaV2ScriptUrl(): string {\n return externalJSProvider.recaptchaV2Script;\n}\n\nexport function _recaptchaEnterpriseScriptUrl(): string {\n return externalJSProvider.recaptchaEnterpriseScript;\n}\n\nexport function _gapiScriptUrl(): string {\n return externalJSProvider.gapiScript;\n}\n\nexport function _generateCallbackName(prefix: string): string {\n return `__${prefix}${Math.floor(Math.random() * 1000000)}`;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AuthErrorCode } from '../../core/errors';\nimport { _assert } from '../../core/util/assert';\nimport { AuthInternal } from '../../model/auth';\nimport { RecaptchaParameters } from '../../model/public_types';\nimport {\n Recaptcha,\n GreCAPTCHATopLevel,\n GreCAPTCHARenderOption,\n GreCAPTCHA\n} from './recaptcha';\n\nexport const _SOLVE_TIME_MS = 500;\nexport const _EXPIRATION_TIME_MS = 60_000;\nexport const _WIDGET_ID_START = 1_000_000_000_000;\n\nexport interface Widget {\n getResponse: () => string | null;\n delete: () => void;\n execute: () => void;\n}\n\nexport class MockReCaptcha implements Recaptcha {\n private counter = _WIDGET_ID_START;\n _widgets = new Map<number, Widget>();\n\n constructor(private readonly auth: AuthInternal) {}\n\n render(\n container: string | HTMLElement,\n parameters?: RecaptchaParameters\n ): number {\n const id = this.counter;\n this._widgets.set(\n id,\n new MockWidget(container, this.auth.name, parameters || {})\n );\n this.counter++;\n return id;\n }\n\n reset(optWidgetId?: number): void {\n const id = optWidgetId || _WIDGET_ID_START;\n void this._widgets.get(id)?.delete();\n this._widgets.delete(id);\n }\n\n getResponse(optWidgetId?: number): string {\n const id = optWidgetId || _WIDGET_ID_START;\n return this._widgets.get(id)?.getResponse() || '';\n }\n\n async execute(optWidgetId?: number | string): Promise<string> {\n const id: number = (optWidgetId as number) || _WIDGET_ID_START;\n void this._widgets.get(id)?.execute();\n return '';\n }\n}\n\nexport class MockGreCAPTCHATopLevel implements GreCAPTCHATopLevel {\n enterprise: GreCAPTCHA = new MockGreCAPTCHA();\n ready(callback: () => void): void {\n callback();\n }\n\n execute(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _siteKey: string,\n _options: { action: string }\n ): Promise<string> {\n return Promise.resolve('token');\n }\n render(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _container: string | HTMLElement,\n _parameters: GreCAPTCHARenderOption\n ): string {\n return '';\n }\n}\n\nexport class MockGreCAPTCHA implements GreCAPTCHA {\n ready(callback: () => void): void {\n callback();\n }\n\n execute(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _siteKey: string,\n _options: { action: string }\n ): Promise<string> {\n return Promise.resolve('token');\n }\n render(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _container: string | HTMLElement,\n _parameters: GreCAPTCHARenderOption\n ): string {\n return '';\n }\n}\n\nexport class MockWidget {\n private readonly container: HTMLElement;\n private readonly isVisible: boolean;\n private timerId: number | null = null;\n private deleted = false;\n private responseToken: string | null = null;\n private readonly clickHandler = (): void => {\n this.execute();\n };\n\n constructor(\n containerOrId: string | HTMLElement,\n appName: string,\n private readonly params: RecaptchaParameters\n ) {\n const container =\n typeof containerOrId === 'string'\n ? document.getElementById(containerOrId)\n : containerOrId;\n _assert(container, AuthErrorCode.ARGUMENT_ERROR, { appName });\n\n this.container = container;\n this.isVisible = this.params.size !== 'invisible';\n if (this.isVisible) {\n this.execute();\n } else {\n this.container.addEventListener('click', this.clickHandler);\n }\n }\n\n getResponse(): string | null {\n this.checkIfDeleted();\n return this.responseToken;\n }\n\n delete(): void {\n this.checkIfDeleted();\n this.deleted = true;\n if (this.timerId) {\n clearTimeout(this.timerId);\n this.timerId = null;\n }\n this.container.removeEventListener('click', this.clickHandler);\n }\n\n execute(): void {\n this.checkIfDeleted();\n if (this.timerId) {\n return;\n }\n\n this.timerId = window.setTimeout(() => {\n this.responseToken = generateRandomAlphaNumericString(50);\n const { callback, 'expired-callback': expiredCallback } = this.params;\n if (callback) {\n try {\n callback(this.responseToken);\n } catch (e) {}\n }\n\n this.timerId = window.setTimeout(() => {\n this.timerId = null;\n this.responseToken = null;\n if (expiredCallback) {\n try {\n expiredCallback();\n } catch (e) {}\n }\n\n if (this.isVisible) {\n this.execute();\n }\n }, _EXPIRATION_TIME_MS);\n }, _SOLVE_TIME_MS);\n }\n\n private checkIfDeleted(): void {\n if (this.deleted) {\n throw new Error('reCAPTCHA mock was already deleted!');\n }\n }\n}\n\nfunction generateRandomAlphaNumericString(len: number): string {\n const chars = [];\n const allowedChars =\n '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n for (let i = 0; i < len; i++) {\n chars.push(\n allowedChars.charAt(Math.floor(Math.random() * allowedChars.length))\n );\n }\n return chars.join('');\n}\n","/* eslint-disable @typescript-eslint/no-require-imports */\n/**\n * @license\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isEnterprise, RecaptchaConfig } from './recaptcha';\nimport { getRecaptchaConfig } from '../../api/authentication/recaptcha';\nimport {\n RecaptchaClientType,\n RecaptchaVersion,\n RecaptchaActionName,\n RecaptchaAuthProvider,\n EnforcementState\n} from '../../api';\n\nimport { Auth } from '../../model/public_types';\nimport { AuthInternal } from '../../model/auth';\nimport { _castAuth } from '../../core/auth/auth_impl';\nimport * as jsHelpers from '../load_js';\nimport { AuthErrorCode } from '../../core/errors';\nimport { StartPhoneMfaEnrollmentRequest } from '../../api/account_management/mfa';\nimport { StartPhoneMfaSignInRequest } from '../../api/authentication/mfa';\nimport { MockGreCAPTCHATopLevel } from './recaptcha_mock';\n\nexport const RECAPTCHA_ENTERPRISE_VERIFIER_TYPE = 'recaptcha-enterprise';\nexport const FAKE_TOKEN = 'NO_RECAPTCHA';\n\nexport class RecaptchaEnterpriseVerifier {\n /**\n * Identifies the type of application verifier (e.g. \"recaptcha-enterprise\").\n */\n readonly type = RECAPTCHA_ENTERPRISE_VERIFIER_TYPE;\n\n private readonly auth: AuthInternal;\n\n /**\n *\n * @param authExtern - The corresponding Firebase {@link Auth} instance.\n *\n */\n constructor(authExtern: Auth) {\n this.auth = _castAuth(authExtern);\n }\n\n /**\n * Executes the verification process.\n *\n * @returns A Promise for a token that can be used to assert the validity of a request.\n */\n async verify(\n action: string = 'verify',\n forceRefresh = false\n ): Promise<string> {\n async function retrieveSiteKey(auth: AuthInternal): Promise<string> {\n if (!forceRefresh) {\n if (auth.tenantId == null && auth._agentRecaptchaConfig != null) {\n return auth._agentRecaptchaConfig.siteKey;\n }\n if (\n auth.tenantId != null &&\n auth._tenantRecaptchaConfigs[auth.tenantId] !== undefined\n ) {\n return auth._tenantRecaptchaConfigs[auth.tenantId].siteKey;\n }\n }\n\n return new Promise<string>(async (resolve, reject) => {\n getRecaptchaConfig(auth, {\n clientType: RecaptchaClientType.WEB,\n version: RecaptchaVersion.ENTERPRISE\n })\n .then(response => {\n if (response.recaptchaKey === undefined) {\n reject(new Error('recaptcha Enterprise site key undefined'));\n } else {\n const config = new RecaptchaConfig(response);\n if (auth.tenantId == null) {\n auth._agentRecaptchaConfig = config;\n } else {\n auth._tenantRecaptchaConfigs[auth.tenantId] = config;\n }\n return resolve(config.siteKey);\n }\n })\n .catch(error => {\n reject(error);\n });\n });\n }\n\n function retrieveRecaptchaToken(\n siteKey: string,\n resolve: (value: string | PromiseLike<string>) => void,\n reject: (reason?: unknown) => void\n ): void {\n const grecaptcha = window.grecaptcha;\n if (isEnterprise(grecaptcha)) {\n grecaptcha.enterprise.ready(() => {\n grecaptcha.enterprise\n .execute(siteKey, { action })\n .then(token => {\n resolve(token);\n })\n .catch(() => {\n resolve(FAKE_TOKEN);\n });\n });\n } else {\n reject(Error('No reCAPTCHA enterprise script loaded.'));\n }\n }\n\n // Returns Promise for a mock token when appVerificationDisabledForTesting is true.\n if (this.auth.settings.appVerificationDisabledForTesting) {\n const mockRecaptcha = new MockGreCAPTCHATopLevel();\n return mockRecaptcha.execute('siteKey', { action: 'verify' });\n }\n\n return new Promise<string>((resolve, reject) => {\n retrieveSiteKey(this.auth)\n .then(siteKey => {\n if (!forceRefresh && isEnterprise(window.grecaptcha)) {\n retrieveRecaptchaToken(siteKey, resolve, reject);\n } else {\n if (typeof window === 'undefined') {\n reject(\n new Error('RecaptchaVerifier is only supported in browser')\n );\n return;\n }\n let url = jsHelpers._recaptchaEnterpriseScriptUrl();\n if (url.length !== 0) {\n url += siteKey;\n }\n jsHelpers\n ._loadJS(url)\n .then(() => {\n retrieveRecaptchaToken(siteKey, resolve, reject);\n })\n .catch(error => {\n reject(error);\n });\n }\n })\n .catch(error => {\n reject(error);\n });\n });\n }\n}\n\nexport async function injectRecaptchaFields<T extends object>(\n auth: AuthInternal,\n request: T,\n action: RecaptchaActionName,\n isCaptchaResp = false,\n isFakeToken = false\n): Promise<T> {\n const verifier = new RecaptchaEnterpriseVerifier(auth);\n let captchaResponse;\n\n if (isFakeToken) {\n captchaResponse = FAKE_TOKEN;\n } else {\n try {\n captchaResponse = await verifier.verify(action);\n } catch (error) {\n captchaResponse = await verifier.verify(action, true);\n }\n }\n\n const newRequest = { ...request };\n if (\n action === RecaptchaActionName.MFA_SMS_ENROLLMENT ||\n action === RecaptchaActionName.MFA_SMS_SIGNIN\n ) {\n if ('phoneEnrollmentInfo' in newRequest) {\n const phoneNumber = (\n newRequest as unknown as StartPhoneMfaEnrollmentRequest\n ).phoneEnrollmentInfo.phoneNumber;\n const recaptchaToken = (\n newRequest as unknown as StartPhoneMfaEnrollmentRequest\n ).phoneEnrollmentInfo.recaptchaToken;\n\n Object.assign(newRequest, {\n 'phoneEnrollmentInfo': {\n phoneNumber,\n recaptchaToken,\n captchaResponse,\n 'clientType': RecaptchaClientType.WEB,\n 'recaptchaVersion': RecaptchaVersion.ENTERPRISE\n }\n });\n } else if ('phoneSignInInfo' in newRequest) {\n const recaptchaToken = (\n newRequest as unknown as StartPhoneMfaSignInRequest\n ).phoneSignInInfo.recaptchaToken;\n\n Object.assign(newRequest, {\n 'phoneSignInInfo': {\n recaptchaToken,\n captchaResponse,\n 'clientType': RecaptchaClientType.WEB,\n 'recaptchaVersion': RecaptchaVersion.ENTERPRISE\n }\n });\n }\n return newRequest;\n }\n\n if (!isCaptchaResp) {\n Object.assign(newRequest, { captchaResponse });\n } else {\n Object.assign(newRequest, { 'captchaResp': captchaResponse });\n }\n Object.assign(newRequest, { 'clientType': RecaptchaClientType.WEB });\n Object.assign(newRequest, {\n 'recaptchaVersion': RecaptchaVersion.ENTERPRISE\n });\n return newRequest;\n}\n\ntype ActionMethod<TRequest, TResponse> = (\n auth: AuthInternal,\n request: TRequest\n) => Promise<TResponse>;\n\nexport async function handleRecaptchaFlow<TRequest extends object, TResponse>(\n authInstance: AuthInternal,\n request: TRequest,\n actionName: RecaptchaActionName,\n actionMethod: ActionMethod<TRequest, TResponse>,\n recaptchaAuthProvider: RecaptchaAuthProvider\n): Promise<TResponse> {\n if (recaptchaAuthProvider === RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER) {\n if (\n authInstance\n ._getRecaptchaConfig()\n ?.isProviderEnabled(RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER)\n ) {\n const requestWithRecaptcha = await injectRecaptchaFields(\n authInstance,\n request,\n actionName,\n actionName === RecaptchaActionName.GET_OOB_CODE\n );\n return actionMethod(authInstance, requestWithRecaptcha);\n } else {\n return actionMethod(authInstance, request).catch(async error => {\n if (error.code === `auth/${AuthErrorCode.MISSING_RECAPTCHA_TOKEN}`) {\n console.log(\n `${actionName} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`\n );\n const requestWithRecaptcha = await injectRecaptchaFields(\n authInstance,\n request,\n actionName,\n actionName === RecaptchaActionName.GET_OOB_CODE\n );\n return actionMethod(authInstance, requestWithRecaptcha);\n } else {\n return Promise.reject(error);\n }\n });\n }\n } else if (recaptchaAuthProvider === RecaptchaAuthProvider.PHONE_PROVIDER) {\n if (\n authInstance\n ._getRecaptchaConfig()\n ?.isProviderEnabled(RecaptchaAuthProvider.PHONE_PROVIDER)\n ) {\n const requestWithRecaptcha = await injectRecaptchaFields(\n authInstance,\n request,\n actionName\n );\n\n return actionMethod(authInstance, requestWithRecaptcha).catch(\n async error => {\n if (\n authInstance\n ._getRecaptchaConfig()\n ?.getProviderEnforcementState(\n RecaptchaAuthProvider.PHONE_PROVIDER\n ) === EnforcementState.AUDIT\n ) {\n // AUDIT mode\n if (\n error.code === `auth/${AuthErrorCode.MISSING_RECAPTCHA_TOKEN}` ||\n error.code === `auth/${AuthErrorCode.INVALID_APP_CREDENTIAL}`\n ) {\n console.log(\n `Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${actionName} flow.`\n );\n // reCAPTCHA Enterprise token is missing or reCAPTCHA Enterprise token\n // check fails.\n // Fallback to reCAPTCHA v2 flow.\n const requestWithRecaptchaFields = await injectRecaptchaFields(\n authInstance,\n request,\n actionName,\n false, // isCaptchaResp\n true // isFakeToken\n );\n // This will call the PhoneApiCaller to fetch and inject reCAPTCHA v2 token.\n return actionMethod(authInstance, requestWithRecaptchaFields);\n }\n }\n // ENFORCE mode or AUDIT mode with any other error.\n return Promise.reject(error);\n }\n );\n } else {\n // Do reCAPTCHA v2 flow.\n const requestWithRecaptchaFields = await injectRecaptchaFields(\n authInstance,\n request,\n actionName,\n false, // isCaptchaResp\n true // isFakeToken\n );\n\n // This will call the PhoneApiCaller to fetch and inject v2 token.\n return actionMethod(authInstance, requestWithRecaptchaFields);\n }\n } else {\n return Promise.reject(\n recaptchaAuthProvider + ' provider is not supported.'\n );\n }\n}\n\nexport async function _initializeRecaptchaConfig(auth: Auth): Promise<void> {\n const authInternal = _castAuth(auth);\n\n const response = await getRecaptchaConfig(authInternal, {\n clientType: RecaptchaClientType.WEB,\n version: RecaptchaVersion.ENTERPRISE\n });\n\n const config = new RecaptchaConfig(response);\n if (authInternal.tenantId == null) {\n authInternal._agentRecaptchaConfig = config;\n } else {\n authInternal._tenantRecaptchaConfigs[authInternal.tenantId] = config;\n }\n\n if (config.isAnyProviderEnabled()) {\n const verifier = new RecaptchaEnterpriseVerifier(authInternal);\n void verifier.verify();\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _getProvider, FirebaseApp } from '@firebase/app';\nimport { deepEqual } from '@firebase/util';\nimport { Auth, Dependencies } from '../../model/public_types';\n\nimport { AuthErrorCode } from '../errors';\nimport { PersistenceInternal } from '../persistence';\nimport { _fail } from '../util/assert';\nimport { _getInstance } from '../util/instantiator';\nimport { AuthImpl } from './auth_impl';\n\n/**\n * Initializes an {@link Auth} instance with fine-grained control over\n * {@link Dependencies}.\n *\n * @remarks\n *\n * This function allows more control over the {@link Auth} instance than\n * {@link getAuth}. `getAuth` uses platform-specific defaults to supply\n * the {@link Dependencies}. In general, `getAuth` is the easiest way to\n * initialize Auth and works for most use cases. Use `initializeAuth` if you\n * need control over which persistence layer is used, or to minimize bundle\n * size if you're not using either `signInWithPopup` or `signInWithRedirect`.\n *\n * For example, if your app only uses anonymous accounts and you only want\n * accounts saved for the current session, initialize `Auth` with:\n *\n * ```js\n * const auth = initializeAuth(app, {\n * persistence: browserSessionPersistence,\n * popupRedirectResolver: undefined,\n * });\n * ```\n *\n * @public\n */\nexport function initializeAuth(app: FirebaseApp, deps?: Dependencies): Auth {\n const provider = _getProvider(app, 'auth');\n\n if (provider.isInitialized()) {\n const auth = provider.getImmediate() as AuthImpl;\n const initialOptions = provider.getOptions() as Dependencies;\n if (deepEqual(initialOptions, deps ?? {})) {\n return auth;\n } else {\n _fail(auth, AuthErrorCode.ALREADY_INITIALIZED);\n }\n }\n\n const auth = provider.initialize({ options: deps }) as AuthImpl;\n\n return auth;\n}\n\nexport function _initializeAuthInstance(\n auth: AuthImpl,\n deps?: Dependencies\n): void {\n const persistence = deps?.persistence || [];\n const hierarchy = (\n Array.isArray(persistence) ? persistence : [persistence]\n ).map<PersistenceInternal>(_getInstance);\n if (deps?.errorMap) {\n auth._updateErrorMap(deps.errorMap);\n }\n\n // This promise is intended to float; auth initialization happens in the\n // background, meanwhile the auth object may be used by the app.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n auth._initializeWithPersistence(hierarchy, deps?.popupRedirectResolver);\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Auth } from '../../model/public_types';\nimport { AuthErrorCode } from '../errors';\nimport { _assert } from '../util/assert';\nimport { _castAuth } from './auth_impl';\nimport {\n deepEqual,\n isCloudWorkstation,\n pingServer,\n updateEmulatorBanner\n} from '@firebase/util';\n\n/**\n * Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production\n * Firebase Auth services.\n *\n * @remarks\n * This must be called synchronously immediately following the first call to\n * {@link initializeAuth}. Do not use with production credentials as emulator\n * traffic is not encrypted.\n *\n *\n * @example\n * ```javascript\n * connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true });\n * ```\n *\n * @param auth - The {@link Auth} instance.\n * @param url - The URL at which the emulator is running (eg, 'http://localhost:9099').\n * @param options - Optional. `options.disableWarnings` defaults to `false`. Set it to\n * `true` to disable the warning banner attached to the DOM.\n *\n * @public\n */\nexport function connectAuthEmulator(\n auth: Auth,\n url: string,\n options?: { disableWarnings: boolean }\n): void {\n const authInternal = _castAuth(auth);\n _assert(\n /^https?:\\/\\//.test(url),\n authInternal,\n AuthErrorCode.INVALID_EMULATOR_SCHEME\n );\n\n const disableWarnings = !!options?.disableWarnings;\n\n const protocol = extractProtocol(url);\n const { host, port } = extractHostAndPort(url);\n const portStr = port === null ? '' : `:${port}`;\n\n // Always replace path with \"/\" (even if input url had no path at all, or had a different one).\n const emulator = { url: `${protocol}//${host}${portStr}/` };\n const emulatorConfig = Object.freeze({\n host,\n port,\n protocol: protocol.replace(':', ''),\n options: Object.freeze({ disableWarnings })\n });\n\n // There are a few scenarios to guard against if the Auth instance has already started:\n if (!authInternal._canInitEmulator) {\n // Applications may not initialize the emulator for the first time if Auth has already started\n // to make network requests.\n _assert(\n authInternal.config.emulator && authInternal.emulatorConfig,\n authInternal,\n AuthErrorCode.EMULATOR_CONFIG_FAILED\n );\n\n // Applications may not alter the configuration of the emulator (aka pass a different config)\n // once Auth has started to make network requests.\n _assert(\n deepEqual(emulator, authInternal.config.emulator) &&\n deepEqual(emulatorConfig, authInternal.emulatorConfig),\n authInternal,\n AuthErrorCode.EMULATOR_CONFIG_FAILED\n );\n\n // It's valid, however, to invoke connectAuthEmulator() after Auth has started making\n // connections, so long as the config matches the existing config. This results in a no-op.\n return;\n }\n\n authInternal.config.emulator = emulator;\n authInternal.emulatorConfig = emulatorConfig;\n authInternal.settings.appVerificationDisabledForTesting = true;\n\n // Workaround to get cookies in Firebase Studio\n if (isCloudWorkstation(host)) {\n void pingServer(`${protocol}//${host}${portStr}`);\n updateEmulatorBanner('Auth', true);\n } else if (!disableWarnings) {\n emitEmulatorWarning();\n }\n}\n\nfunction extractProtocol(url: string): string {\n const protocolEnd = url.indexOf(':');\n return protocolEnd < 0 ? '' : url.substr(0, protocolEnd + 1);\n}\n\nfunction extractHostAndPort(url: string): {\n host: string;\n port: number | null;\n} {\n const protocol = extractProtocol(url);\n const authority = /(\\/\\/)?([^?#/]+)/.exec(url.substr(protocol.length)); // Between // and /, ? or #.\n if (!authority) {\n return { host: '', port: null };\n }\n const hostAndPort = authority[2].split('@').pop() || ''; // Strip out \"username:password@\".\n const bracketedIPv6 = /^(\\[[^\\]]+\\])(:|$)/.exec(hostAndPort);\n if (bracketedIPv6) {\n const host = bracketedIPv6[1];\n return { host, port: parsePort(hostAndPort.substr(host.length + 1)) };\n } else {\n const [host, port] = hostAndPort.split(':');\n return { host, port: parsePort(port) };\n }\n}\n\nfunction parsePort(portStr: string): number | null {\n if (!portStr) {\n return null;\n }\n const port = Number(portStr);\n if (isNaN(port)) {\n return null;\n }\n return port;\n}\n\nfunction emitEmulatorWarning(): void {\n function attachBanner(): void {\n const el = document.createElement('p');\n const sty = el.style;\n el.innerText =\n 'Running in emulator mode. Do not use with production credentials.';\n sty.position = 'fixed';\n sty.width = '100%';\n sty.backgroundColor = '#ffffff';\n sty.border = '.1em solid #000000';\n sty.color = '#b50000';\n sty.bottom = '0px';\n sty.left = '0px';\n sty.margin = '0px';\n sty.zIndex = '10000';\n sty.textAlign = 'center';\n el.classList.add('firebase-emulator-warning');\n document.body.appendChild(el);\n }\n\n if (typeof console !== 'undefined' && typeof console.info === 'function') {\n console.info(\n 'WARNING: You are using the Auth Emulator,' +\n ' which is intended for local testing only. Do not use with' +\n ' production credentials.'\n );\n }\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n if (document.readyState === 'loading') {\n window.addEventListener('DOMContentLoaded', attachBanner);\n } else {\n attachBanner();\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { PhoneOrOauthTokenResponse } from '../../api/authentication/mfa';\nimport { AuthInternal } from '../../model/auth';\nimport { IdTokenResponse } from '../../model/id_token';\nimport { debugFail } from '../util/assert';\n\n/**\n * Interface that represents the credentials returned by an {@link AuthProvider}.\n *\n * @remarks\n * Implementations specify the details about each auth provider's credential requirements.\n *\n * @public\n */\nexport class AuthCredential {\n /** @internal */\n protected constructor(\n /**\n * The authentication provider ID for the credential.\n *\n * @remarks\n * For example, 'facebook.com', or 'google.com'.\n */\n readonly providerId: string,\n /**\n * The authentication sign in method for the credential.\n *\n * @remarks\n * For example, {@link SignInMethod}.EMAIL_PASSWORD, or\n * {@link SignInMethod}.EMAIL_LINK. This corresponds to the sign-in method\n * identifier as returned in {@link fetchSignInMethodsForEmail}.\n */\n readonly signInMethod: string\n ) {}\n\n /**\n * Returns a JSON-serializable representation of this object.\n *\n * @returns a JSON-serializable representation of this object.\n */\n toJSON(): object {\n return debugFail('not implemented');\n }\n\n /** @internal */\n _getIdTokenResponse(_auth: AuthInternal): Promise<PhoneOrOauthTokenResponse> {\n return debugFail('not implemented');\n }\n /** @internal */\n _linkToIdToken(\n _auth: AuthInternal,\n _idToken: string\n ): Promise<IdTokenResponse> {\n return debugFail('not implemented');\n }\n /** @internal */\n _getReauthenticationResolver(_auth: AuthInternal): Promise<IdTokenResponse> {\n return debugFail('not implemented');\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ActionCodeOperation, Auth } from '../../model/public_types';\n\nimport {\n Endpoint,\n HttpMethod,\n _addTidIfNecessary,\n _performApiRequest\n} from '../index';\nimport { IdTokenResponse } from '../../model/id_token';\nimport { MfaEnrollment } from './mfa';\nimport { SignUpRequest, SignUpResponse } from '../authentication/sign_up';\n\nexport interface ResetPasswordRequest {\n oobCode: string;\n newPassword?: string;\n tenantId?: string;\n}\n\nexport interface ResetPasswordResponse {\n email: string;\n newEmail?: string;\n requestType?: ActionCodeOperation;\n mfaInfo?: MfaEnrollment;\n}\n\nexport async function resetPassword(\n auth: Auth,\n request: ResetPasswordRequest\n): Promise<ResetPasswordResponse> {\n return _performApiRequest<ResetPasswordRequest, ResetPasswordResponse>(\n auth,\n HttpMethod.POST,\n Endpoint.RESET_PASSWORD,\n _addTidIfNecessary(auth, request)\n );\n}\nexport interface UpdateEmailPasswordRequest {\n idToken: string;\n returnSecureToken?: boolean;\n email?: string;\n password?: string;\n}\n\nexport interface UpdateEmailPasswordResponse extends IdTokenResponse {}\n\nexport async function updateEmailPassword(\n auth: Auth,\n request: UpdateEmailPasswordRequest\n): Promise<UpdateEmailPasswordResponse> {\n return _performApiRequest<\n UpdateEmailPasswordRequest,\n UpdateEmailPasswordResponse\n >(auth, HttpMethod.POST, Endpoint.SET_ACCOUNT_INFO, request);\n}\n\n// Used for linking an email/password account to an existing idToken. Uses the same request/response\n// format as updateEmailPassword.\nexport async function linkEmailPassword(\n auth: Auth,\n request: SignUpRequest\n): Promise<SignUpResponse> {\n return _performApiRequest<SignUpRequest, SignUpResponse>(\n auth,\n HttpMethod.POST,\n Endpoint.SIGN_UP,\n request\n );\n}\n\nexport interface ApplyActionCodeRequest {\n oobCode: string;\n tenantId?: string;\n}\n\nexport interface ApplyActionCodeResponse {}\n\nexport async function applyActionCode(\n auth: Auth,\n request: ApplyActionCodeRequest\n): Promise<ApplyActionCodeResponse> {\n return _performApiRequest<ApplyActionCodeRequest, ApplyActionCodeResponse>(\n auth,\n HttpMethod.POST,\n Endpoint.SET_ACCOUNT_INFO,\n _addTidIfNecessary(auth, request)\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ActionCodeOperation, Auth } from '../../model/public_types';\n\nimport {\n Endpoint,\n HttpMethod,\n RecaptchaClientType,\n RecaptchaVersion,\n _addTidIfNecessary,\n _performApiRequest,\n _performSignInRequest\n} from '../index';\nimport { IdToken, IdTokenResponse } from '../../model/id_token';\n\nexport interface SignInWithPasswordRequest {\n returnSecureToken?: boolean;\n email: string;\n password: string;\n tenantId?: string;\n captchaResponse?: string;\n clientType?: RecaptchaClientType;\n recaptchaVersion?: RecaptchaVersion;\n}\n\nexport interface SignInWithPasswordResponse extends IdTokenResponse {\n email: string;\n displayName: string;\n}\n\nexport async function signInWithPassword(\n auth: Auth,\n request: SignInWithPasswordRequest\n): Promise<SignInWithPasswordResponse> {\n return _performSignInRequest<\n SignInWithPasswordRequest,\n SignInWithPasswordResponse\n >(\n auth,\n HttpMethod.POST,\n Endpoint.SIGN_IN_WITH_PASSWORD,\n _addTidIfNecessary(auth, request)\n );\n}\n\nexport interface GetOobCodeRequest {\n email?: string; // Everything except VERIFY_AND_CHANGE_EMAIL\n continueUrl?: string;\n iOSBundleId?: string;\n iosAppStoreId?: string;\n androidPackageName?: string;\n androidInstallApp?: boolean;\n androidMinimumVersionCode?: string;\n canHandleCodeInApp?: boolean;\n dynamicLinkDomain?: string;\n tenantId?: string;\n targetProjectid?: string;\n linkDomain?: string;\n}\n\nexport interface VerifyEmailRequest extends GetOobCodeRequest {\n requestType: ActionCodeOperation.VERIFY_EMAIL;\n idToken: IdToken;\n}\n\nexport interface PasswordResetRequest extends GetOobCodeRequest {\n requestType: ActionCodeOperation.PASSWORD_RESET;\n email: string;\n captchaResp?: string;\n clientType?: RecaptchaClientType;\n recaptchaVersion?: RecaptchaVersion;\n}\n\nexport interface EmailSignInRequest extends GetOobCodeRequest {\n requestType: ActionCodeOperation.EMAIL_SIGNIN;\n email: string;\n captchaResp?: string;\n clientType?: RecaptchaClientType;\n recaptchaVersion?: RecaptchaVersion;\n}\n\nexport interface VerifyAndChangeEmailRequest extends GetOobCodeRequest {\n requestType: ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL;\n idToken: IdToken;\n newEmail: string;\n}\n\ninterface GetOobCodeResponse {\n email: string;\n}\n\nexport interface VerifyEmailResponse extends GetOobCodeResponse {}\nexport interface PasswordResetResponse extends GetOobCodeResponse {}\nexport interface EmailSignInResponse extends GetOobCodeResponse {}\nexport interface VerifyAndChangeEmailResponse extends GetOobCodeRequest {}\n\nasync function sendOobCode(\n auth: Auth,\n request: GetOobCodeRequest\n): Promise<GetOobCodeResponse> {\n return _performApiRequest<GetOobCodeRequest, GetOobCodeResponse>(\n auth,\n HttpMethod.POST,\n Endpoint.SEND_OOB_CODE,\n _addTidIfNecessary(auth, request)\n );\n}\n\nexport async function sendEmailVerification(\n auth: Auth,\n request: VerifyEmailRequest\n): Promise<VerifyEmailResponse> {\n return sendOobCode(auth, request);\n}\n\nexport async function sendPasswordResetEmail(\n auth: Auth,\n request: PasswordResetRequest\n): Promise<PasswordResetResponse> {\n return sendOobCode(auth, request);\n}\n\nexport async function sendSignInLinkToEmail(\n auth: Auth,\n request: EmailSignInRequest\n): Promise<EmailSignInResponse> {\n return sendOobCode(auth, request);\n}\n\nexport async function verifyAndChangeEmail(\n auth: Auth,\n request: VerifyAndChangeEmailRequest\n): Promise<VerifyAndChangeEmailResponse> {\n return sendOobCode(auth, request);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n _performSignInRequest,\n Endpoint,\n HttpMethod,\n _addTidIfNecessary\n} from '../index';\nimport { IdTokenResponse } from '../../model/id_token';\nimport { Auth } from '../../model/public_types';\n\nexport interface SignInWithEmailLinkRequest {\n email: string;\n oobCode: string;\n tenantId?: string;\n}\n\nexport interface SignInWithEmailLinkResponse extends IdTokenResponse {\n email: string;\n isNewUser: boolean;\n}\n\nexport async function signInWithEmailLink(\n auth: Auth,\n request: SignInWithEmailLinkRequest\n): Promise<SignInWithEmailLinkResponse> {\n return _performSignInRequest<\n SignInWithEmailLinkRequest,\n SignInWithEmailLinkResponse\n >(\n auth,\n HttpMethod.POST,\n Endpoint.SIGN_IN_WITH_EMAIL_LINK,\n _addTidIfNecessary(auth, request)\n );\n}\n\nexport interface SignInWithEmailLinkForLinkingRequest\n extends SignInWithEmailLinkRequest {\n idToken: string;\n}\n\nexport async function signInWithEmailLinkForLinking(\n auth: Auth,\n request: SignInWithEmailLinkForLinkingRequest\n): Promise<SignInWithEmailLinkResponse> {\n return _performSignInRequest<\n SignInWithEmailLinkForLinkingRequest,\n SignInWithEmailLinkResponse\n >(\n auth,\n HttpMethod.POST,\n Endpoint.SIGN_IN_WITH_EMAIL_LINK,\n _addTidIfNecessary(auth, request)\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ProviderId, SignInMethod } from '../../model/enums';\n\nimport { linkEmailPassword } from '../../api/account_management/email_and_password';\nimport {\n signInWithPassword,\n SignInWithPasswordRequest\n} from '../../api/authentication/email_and_password';\nimport {\n signInWithEmailLink,\n signInWithEmailLinkForLinking\n} from '../../api/authentication/email_link';\nimport { AuthInternal } from '../../model/auth';\nimport { IdTokenResponse } from '../../model/id_token';\nimport { AuthErrorCode } from '../errors';\nimport { _fail } from '../util/assert';\nimport { AuthCredential } from './auth_credential';\nimport { handleRecaptchaFlow } from '../../platform_browser/recaptcha/recaptcha_enterprise_verifier';\nimport {\n RecaptchaActionName,\n RecaptchaClientType,\n RecaptchaAuthProvider\n} from '../../api';\nimport { SignUpRequest } from '../../api/authentication/sign_up';\n/**\n * Interface that represents the credentials returned by {@link EmailAuthProvider} for\n * {@link ProviderId}.PASSWORD\n *\n * @remarks\n * Covers both {@link SignInMethod}.EMAIL_PASSWORD and\n * {@link SignInMethod}.EMAIL_LINK.\n *\n * @public\n */\nexport class EmailAuthCredential extends AuthCredential {\n /** @internal */\n private constructor(\n /** @internal */\n readonly _email: string,\n /** @internal */\n readonly _password: string,\n signInMethod: SignInMethod,\n /** @internal */\n readonly _tenantId: string | null = null\n ) {\n super(ProviderId.PASSWORD, signInMethod);\n }\n\n /** @internal */\n static _fromEmailAndPassword(\n email: string,\n password: string\n ): EmailAuthCredential {\n return new EmailAuthCredential(\n email,\n password,\n SignInMethod.EMAIL_PASSWORD\n );\n }\n\n /** @internal */\n static _fromEmailAndCode(\n email: string,\n oobCode: string,\n tenantId: string | null = null\n ): EmailAuthCredential {\n return new EmailAuthCredential(\n email,\n oobCode,\n SignInMethod.EMAIL_LINK,\n tenantId\n );\n }\n\n /** {@inheritdoc AuthCredential.toJSON} */\n toJSON(): object {\n return {\n email: this._email,\n password: this._password,\n signInMethod: this.signInMethod,\n tenantId: this._tenantId\n };\n }\n\n /**\n * Static method to deserialize a JSON representation of an object into an {@link AuthCredential}.\n *\n * @param json - Either `object` or the stringified representation of the object. When string is\n * provided, `JSON.parse` would be called first.\n *\n * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.\n */\n static fromJSON(json: object | string): EmailAuthCredential | null {\n const obj = typeof json === 'string' ? JSON.parse(json) : json;\n if (obj?.email && obj?.password) {\n if (obj.signInMethod === SignInMethod.EMAIL_PASSWORD) {\n return this._fromEmailAndPassword(obj.email, obj.password);\n } else if (obj.signInMethod === SignInMethod.EMAIL_LINK) {\n return this._fromEmailAndCode(obj.email, obj.password, obj.tenantId);\n }\n }\n return null;\n }\n\n /** @internal */\n async _getIdTokenResponse(auth: AuthInternal): Promise<IdTokenResponse> {\n switch (this.signInMethod) {\n case SignInMethod.EMAIL_PASSWORD:\n const request: SignInWithPasswordRequest = {\n returnSecureToken: true,\n email: this._email,\n password: this._password,\n clientType: RecaptchaClientType.WEB\n };\n return handleRecaptchaFlow(\n auth,\n request,\n RecaptchaActionName.SIGN_IN_WITH_PASSWORD,\n signInWithPassword,\n RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER\n );\n case SignInMethod.EMAIL_LINK:\n return signInWithEmailLink(auth, {\n email: this._email,\n oobCode: this._password\n });\n default:\n _fail(auth, AuthErrorCode.INTERNAL_ERROR);\n }\n }\n\n /** @internal */\n async _linkToIdToken(\n auth: AuthInternal,\n idToken: string\n ): Promise<IdTokenResponse> {\n switch (this.signInMethod) {\n case SignInMethod.EMAIL_PASSWORD:\n const request: SignUpRequest = {\n idToken,\n returnSecureToken: true,\n email: this._email,\n password: this._password,\n clientType: RecaptchaClientType.WEB\n };\n return handleRecaptchaFlow(\n auth,\n request,\n RecaptchaActionName.SIGN_UP_PASSWORD,\n linkEmailPassword,\n RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER\n );\n case SignInMethod.EMAIL_LINK:\n return signInWithEmailLinkForLinking(auth, {\n idToken,\n email: this._email,\n oobCode: this._password\n });\n default:\n _fail(auth, AuthErrorCode.INTERNAL_ERROR);\n }\n }\n\n /** @internal */\n _getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse> {\n return this._getIdTokenResponse(auth);\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Endpoint,\n HttpMethod,\n _addTidIfNecessary,\n _performSignInRequest\n} from '../index';\nimport { IdToken, IdTokenResponse } from '../../model/id_token';\nimport { Auth } from '../../model/public_types';\n\nexport interface SignInWithIdpRequest {\n requestUri: string;\n postBody?: string;\n sessionId?: string;\n tenantId?: string;\n returnSecureToken: boolean;\n returnIdpCredential?: boolean;\n idToken?: IdToken;\n autoCreate?: boolean;\n pendingToken?: string;\n}\n\n/**\n * @internal\n */\nexport interface SignInWithIdpResponse extends IdTokenResponse {\n oauthAccessToken?: string;\n oauthTokenSecret?: string;\n nonce?: string;\n oauthIdToken?: string;\n pendingToken?: string;\n}\n\nexport async function signInWithIdp(\n auth: Auth,\n request: SignInWithIdpRequest\n): Promise<SignInWithIdpResponse> {\n return _performSignInRequest<SignInWithIdpRequest, SignInWithIdpResponse>(\n auth,\n HttpMethod.POST,\n Endpoint.SIGN_IN_WITH_IDP,\n _addTidIfNecessary(auth, request)\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { querystring } from '@firebase/util';\n\nimport {\n signInWithIdp,\n SignInWithIdpRequest\n} from '../../api/authentication/idp';\nimport { AuthInternal } from '../../model/auth';\nimport { IdTokenResponse } from '../../model/id_token';\nimport { AuthErrorCode } from '../errors';\nimport { _fail } from '../util/assert';\nimport { AuthCredential } from './auth_credential';\n\nconst IDP_REQUEST_URI = 'http://localhost';\n\nexport interface OAuthCredentialParams {\n // OAuth 2 uses either id token or access token\n idToken?: string | null;\n accessToken?: string | null;\n\n // These fields are used with OAuth 1\n oauthToken?: string;\n secret?: string;\n oauthTokenSecret?: string;\n\n // Nonce is only set if pendingToken is not present\n nonce?: string;\n pendingToken?: string;\n\n // Utilities\n providerId: string;\n signInMethod: string;\n}\n\n/**\n * Represents the OAuth credentials returned by an {@link OAuthProvider}.\n *\n * @remarks\n * Implementations specify the details about each auth provider's credential requirements.\n *\n * @public\n */\nexport class OAuthCredential extends AuthCredential {\n /**\n * The OAuth ID token associated with the credential if it belongs to an OIDC provider,\n * such as `google.com`.\n * @readonly\n */\n idToken?: string;\n /**\n * The OAuth access token associated with the credential if it belongs to an\n * {@link OAuthProvider}, such as `facebook.com`, `twitter.com`, etc.\n * @readonly\n */\n accessToken?: string;\n /**\n * The OAuth access token secret associated with the credential if it belongs to an OAuth 1.0\n * provider, such as `twitter.com`.\n * @readonly\n */\n secret?: string;\n\n private nonce?: string;\n private pendingToken: string | null = null;\n\n /** @internal */\n static _fromParams(params: OAuthCredentialParams): OAuthCredential {\n const cred = new OAuthCredential(params.providerId, params.signInMethod);\n\n if (params.idToken || params.accessToken) {\n // OAuth 2 and either ID token or access token.\n if (params.idToken) {\n cred.idToken = params.idToken;\n }\n\n if (params.accessToken) {\n cred.accessToken = params.accessToken;\n }\n\n // Add nonce if available and no pendingToken is present.\n if (params.nonce && !params.pendingToken) {\n cred.nonce = params.nonce;\n }\n\n if (params.pendingToken) {\n cred.pendingToken = params.pendingToken;\n }\n } else if (params.oauthToken && params.oauthTokenSecret) {\n // OAuth 1 and OAuth token with token secret\n cred.accessToken = params.oauthToken;\n cred.secret = params.oauthTokenSecret;\n } else {\n _fail(AuthErrorCode.ARGUMENT_ERROR);\n }\n\n return cred;\n }\n\n /** {@inheritdoc AuthCredential.toJSON} */\n toJSON(): object {\n return {\n idToken: this.idToken,\n accessToken: this.accessToken,\n secret: this.secret,\n nonce: this.nonce,\n pendingToken: this.pendingToken,\n providerId: this.providerId,\n signInMethod: this.signInMethod\n };\n }\n\n /**\n * Static method to deserialize a JSON representation of an object into an\n * {@link AuthCredential}.\n *\n * @param json - Input can be either Object or the stringified representation of the object.\n * When string is provided, JSON.parse would be called first.\n *\n * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.\n */\n static fromJSON(json: string | object): OAuthCredential | null {\n const obj = typeof json === 'string' ? JSON.parse(json) : json;\n const { providerId, signInMethod, ...rest }: OAuthCredentialParams = obj;\n if (!providerId || !signInMethod) {\n return null;\n }\n\n const cred = new OAuthCredential(providerId, signInMethod);\n cred.idToken = rest.idToken || undefined;\n cred.accessToken = rest.accessToken || undefined;\n cred.secret = rest.secret;\n cred.nonce = rest.nonce;\n cred.pendingToken = rest.pendingToken || null;\n return cred;\n }\n\n /** @internal */\n _getIdTokenResponse(auth: AuthInternal): Promise<IdTokenResponse> {\n const request = this.buildRequest();\n return signInWithIdp(auth, request);\n }\n\n /** @internal */\n _linkToIdToken(\n auth: AuthInternal,\n idToken: string\n ): Promise<IdTokenResponse> {\n const request = this.buildRequest();\n request.idToken = idToken;\n return signInWithIdp(auth, request);\n }\n\n /** @internal */\n _getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse> {\n const request = this.buildRequest();\n request.autoCreate = false;\n return signInWithIdp(auth, request);\n }\n\n private buildRequest(): SignInWithIdpRequest {\n const request: SignInWithIdpRequest = {\n requestUri: IDP_REQUEST_URI,\n returnSecureToken: true\n };\n\n if (this.pendingToken) {\n request.pendingToken = this.pendingToken;\n } else {\n const postBody: Record<string, string> = {};\n if (this.idToken) {\n postBody['id_token'] = this.idToken;\n }\n if (this.accessToken) {\n postBody['access_token'] = this.accessToken;\n }\n if (this.secret) {\n postBody['oauth_token_secret'] = this.secret;\n }\n\n postBody['providerId'] = this.providerId;\n if (this.nonce && !this.pendingToken) {\n postBody['nonce'] = this.nonce;\n }\n\n request.postBody = querystring(postBody);\n }\n\n return request;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Endpoint,\n HttpMethod,\n RecaptchaClientType,\n RecaptchaVersion,\n _addTidIfNecessary,\n _makeTaggedError,\n _performApiRequest,\n _performSignInRequest\n} from '../index';\nimport { AuthErrorCode } from '../../core/errors';\nimport { IdTokenResponse } from '../../model/id_token';\nimport { ServerError, ServerErrorMap } from '../errors';\nimport { Auth } from '../../model/public_types';\n\nexport interface SendPhoneVerificationCodeRequest {\n phoneNumber: string;\n // reCAPTCHA v2 token\n recaptchaToken?: string;\n tenantId?: string;\n // reCAPTCHA Enterprise token\n captchaResponse?: string;\n clientType?: RecaptchaClientType;\n recaptchaVersion?: RecaptchaVersion;\n}\n\nexport interface SendPhoneVerificationCodeResponse {\n sessionInfo: string;\n}\n\nexport async function sendPhoneVerificationCode(\n auth: Auth,\n request: SendPhoneVerificationCodeRequest\n): Promise<SendPhoneVerificationCodeResponse> {\n return _performApiRequest<\n SendPhoneVerificationCodeRequest,\n SendPhoneVerificationCodeResponse\n >(\n auth,\n HttpMethod.POST,\n Endpoint.SEND_VERIFICATION_CODE,\n _addTidIfNecessary(auth, request)\n );\n}\n\n/**\n * @internal\n */\nexport interface SignInWithPhoneNumberRequest {\n temporaryProof?: string;\n phoneNumber?: string;\n sessionInfo?: string;\n code?: string;\n tenantId?: string;\n}\n\nexport interface LinkWithPhoneNumberRequest\n extends SignInWithPhoneNumberRequest {\n idToken: string;\n}\n\n/**\n * @internal\n */\nexport interface SignInWithPhoneNumberResponse extends IdTokenResponse {\n temporaryProof?: string;\n phoneNumber?: string;\n}\n\nexport async function signInWithPhoneNumber(\n auth: Auth,\n request: SignInWithPhoneNumberRequest\n): Promise<SignInWithPhoneNumberResponse> {\n return _performSignInRequest<\n SignInWithPhoneNumberRequest,\n SignInWithPhoneNumberResponse\n >(\n auth,\n HttpMethod.POST,\n Endpoint.SIGN_IN_WITH_PHONE_NUMBER,\n _addTidIfNecessary(auth, request)\n );\n}\n\nexport async function linkWithPhoneNumber(\n auth: Auth,\n request: LinkWithPhoneNumberRequest\n): Promise<SignInWithPhoneNumberResponse> {\n const response = await _performSignInRequest<\n LinkWithPhoneNumberRequest,\n SignInWithPhoneNumberResponse\n >(\n auth,\n HttpMethod.POST,\n Endpoint.SIGN_IN_WITH_PHONE_NUMBER,\n _addTidIfNecessary(auth, request)\n );\n if (response.temporaryProof) {\n throw _makeTaggedError(auth, AuthErrorCode.NEED_CONFIRMATION, response);\n }\n return response;\n}\n\ninterface VerifyPhoneNumberForExistingRequest\n extends SignInWithPhoneNumberRequest {\n operation: 'REAUTH';\n}\n\nconst VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_: Partial<\n ServerErrorMap<ServerError>\n> = {\n [ServerError.USER_NOT_FOUND]: AuthErrorCode.USER_DELETED\n};\n\nexport async function verifyPhoneNumberForExisting(\n auth: Auth,\n request: SignInWithPhoneNumberRequest\n): Promise<SignInWithPhoneNumberResponse> {\n const apiRequest: VerifyPhoneNumberForExistingRequest = {\n ...request,\n operation: 'REAUTH'\n };\n return _performSignInRequest<\n VerifyPhoneNumberForExistingRequest,\n SignInWithPhoneNumberResponse\n >(\n auth,\n HttpMethod.POST,\n Endpoint.SIGN_IN_WITH_PHONE_NUMBER,\n _addTidIfNecessary(auth, apiRequest),\n VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ProviderId, SignInMethod } from '../../model/enums';\n\nimport { PhoneOrOauthTokenResponse } from '../../api/authentication/mfa';\nimport {\n linkWithPhoneNumber,\n signInWithPhoneNumber,\n SignInWithPhoneNumberRequest,\n verifyPhoneNumberForExisting\n} from '../../api/authentication/sms';\nimport { AuthInternal } from '../../model/auth';\nimport { IdTokenResponse } from '../../model/id_token';\nimport { AuthCredential } from './auth_credential';\n\nexport interface PhoneAuthCredentialParameters {\n verificationId?: string;\n verificationCode?: string;\n phoneNumber?: string;\n temporaryProof?: string;\n}\n\n/**\n * Represents the credentials returned by {@link PhoneAuthProvider}.\n *\n * @public\n */\nexport class PhoneAuthCredential extends AuthCredential {\n private constructor(private readonly params: PhoneAuthCredentialParameters) {\n super(ProviderId.PHONE, SignInMethod.PHONE);\n }\n\n /** @internal */\n static _fromVerification(\n verificationId: string,\n verificationCode: string\n ): PhoneAuthCredential {\n return new PhoneAuthCredential({ verificationId, verificationCode });\n }\n\n /** @internal */\n static _fromTokenResponse(\n phoneNumber: string,\n temporaryProof: string\n ): PhoneAuthCredential {\n return new PhoneAuthCredential({ phoneNumber, temporaryProof });\n }\n\n /** @internal */\n _getIdTokenResponse(auth: AuthInternal): Promise<PhoneOrOauthTokenResponse> {\n return signInWithPhoneNumber(auth, this._makeVerificationRequest());\n }\n\n /** @internal */\n _linkToIdToken(\n auth: AuthInternal,\n idToken: string\n ): Promise<IdTokenResponse> {\n return linkWithPhoneNumber(auth, {\n idToken,\n ...this._makeVerificationRequest()\n });\n }\n\n /** @internal */\n _getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse> {\n return verifyPhoneNumberForExisting(auth, this._makeVerificationRequest());\n }\n\n /** @internal */\n _makeVerificationRequest(): SignInWithPhoneNumberRequest {\n const { temporaryProof, phoneNumber, verificationId, verificationCode } =\n this.params;\n if (temporaryProof && phoneNumber) {\n return { temporaryProof, phoneNumber };\n }\n\n return {\n sessionInfo: verificationId,\n code: verificationCode\n };\n }\n\n /** {@inheritdoc AuthCredential.toJSON} */\n toJSON(): object {\n const obj: Record<string, string> = {\n providerId: this.providerId\n };\n if (this.params.phoneNumber) {\n obj.phoneNumber = this.params.phoneNumber;\n }\n if (this.params.temporaryProof) {\n obj.temporaryProof = this.params.temporaryProof;\n }\n if (this.params.verificationCode) {\n obj.verificationCode = this.params.verificationCode;\n }\n if (this.params.verificationId) {\n obj.verificationId = this.params.verificationId;\n }\n\n return obj;\n }\n\n /** Generates a phone credential based on a plain object or a JSON string. */\n static fromJSON(json: object | string): PhoneAuthCredential | null {\n if (typeof json === 'string') {\n json = JSON.parse(json);\n }\n\n const { verificationId, verificationCode, phoneNumber, temporaryProof } =\n json as { [key: string]: string };\n if (\n !verificationCode &&\n !verificationId &&\n !phoneNumber &&\n !temporaryProof\n ) {\n return null;\n }\n\n return new PhoneAuthCredential({\n verificationId,\n verificationCode,\n phoneNumber,\n temporaryProof\n });\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { extractQuerystring, querystringDecode } from '@firebase/util';\nimport { ActionCodeOperation } from '../model/public_types';\nimport { AuthErrorCode } from './errors';\nimport { _assert } from './util/assert';\n\n/**\n * Enums for fields in URL query string.\n *\n * @enum {string}\n */\nconst enum QueryField {\n API_KEY = 'apiKey',\n CODE = 'oobCode',\n CONTINUE_URL = 'continueUrl',\n LANGUAGE_CODE = 'lang',\n MODE = 'mode',\n TENANT_ID = 'tenantId'\n}\n\n/**\n * Maps the mode string in action code URL to Action Code Info operation.\n *\n * @param mode\n */\nfunction parseMode(mode: string | null): ActionCodeOperation | null {\n switch (mode) {\n case 'recoverEmail':\n return ActionCodeOperation.RECOVER_EMAIL;\n case 'resetPassword':\n return ActionCodeOperation.PASSWORD_RESET;\n case 'signIn':\n return ActionCodeOperation.EMAIL_SIGNIN;\n case 'verifyEmail':\n return ActionCodeOperation.VERIFY_EMAIL;\n case 'verifyAndChangeEmail':\n return ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL;\n case 'revertSecondFactorAddition':\n return ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION;\n default:\n return null;\n }\n}\n\n/**\n * Helper to parse FDL links\n *\n * @param url\n */\nfunction parseDeepLink(url: string): string {\n const link = querystringDecode(extractQuerystring(url))['link'];\n\n // Double link case (automatic redirect).\n const doubleDeepLink = link\n ? querystringDecode(extractQuerystring(link))['deep_link_id']\n : null;\n // iOS custom scheme links.\n const iOSDeepLink = querystringDecode(extractQuerystring(url))[\n 'deep_link_id'\n ];\n const iOSDoubleDeepLink = iOSDeepLink\n ? querystringDecode(extractQuerystring(iOSDeepLink))['link']\n : null;\n return iOSDoubleDeepLink || iOSDeepLink || doubleDeepLink || link || url;\n}\n\n/**\n * A utility class to parse email action URLs such as password reset, email verification,\n * email link sign in, etc.\n *\n * @public\n */\nexport class ActionCodeURL {\n /**\n * The API key of the email action link.\n */\n readonly apiKey: string;\n /**\n * The action code of the email action link.\n */\n readonly code: string;\n /**\n * The continue URL of the email action link. Null if not provided.\n */\n readonly continueUrl: string | null;\n /**\n * The language code of the email action link. Null if not provided.\n */\n readonly languageCode: string | null;\n /**\n * The action performed by the email action link. It returns from one of the types from\n * {@link ActionCodeInfo}\n */\n readonly operation: string;\n /**\n * The tenant ID of the email action link. Null if the email action is from the parent project.\n */\n readonly tenantId: string | null;\n\n /**\n * @param actionLink - The link from which to extract the URL.\n * @returns The {@link ActionCodeURL} object, or null if the link is invalid.\n *\n * @internal\n */\n constructor(actionLink: string) {\n const searchParams = querystringDecode(extractQuerystring(actionLink));\n const apiKey = searchParams[QueryField.API_KEY] ?? null;\n const code = searchParams[QueryField.CODE] ?? null;\n const operation = parseMode(searchParams[QueryField.MODE] ?? null);\n // Validate API key, code and mode.\n _assert(apiKey && code && operation, AuthErrorCode.ARGUMENT_ERROR);\n this.apiKey = apiKey;\n this.operation = operation;\n this.code = code;\n this.continueUrl = searchParams[QueryField.CONTINUE_URL] ?? null;\n this.languageCode = searchParams[QueryField.LANGUAGE_CODE] ?? null;\n this.tenantId = searchParams[QueryField.TENANT_ID] ?? null;\n }\n\n /**\n * Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid,\n * otherwise returns null.\n *\n * @param link - The email action link string.\n * @returns The {@link ActionCodeURL} object, or null if the link is invalid.\n *\n * @public\n */\n static parseLink(link: string): ActionCodeURL | null {\n const actionLink = parseDeepLink(link);\n try {\n return new ActionCodeURL(actionLink);\n } catch {\n return null;\n }\n }\n}\n\n/**\n * Parses the email action link string and returns an {@link ActionCodeURL} if\n * the link is valid, otherwise returns null.\n *\n * @public\n */\nexport function parseActionCodeURL(link: string): ActionCodeURL | null {\n return ActionCodeURL.parseLink(link);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ProviderId, SignInMethod } from '../../model/enums';\nimport { AuthProvider } from '../../model/public_types';\n\nimport { ActionCodeURL } from '../action_code_url';\nimport { EmailAuthCredential } from '../credentials/email';\nimport { AuthErrorCode } from '../errors';\nimport { _assert } from '../util/assert';\n\n/**\n * Provider for generating {@link EmailAuthCredential}.\n *\n * @public\n */\nexport class EmailAuthProvider implements AuthProvider {\n /**\n * Always set to {@link ProviderId}.PASSWORD, even for email link.\n */\n static readonly PROVIDER_ID: 'password' = ProviderId.PASSWORD;\n /**\n * Always set to {@link SignInMethod}.EMAIL_PASSWORD.\n */\n static readonly EMAIL_PASSWORD_SIGN_IN_METHOD: 'password' =\n SignInMethod.EMAIL_PASSWORD;\n /**\n * Always set to {@link SignInMethod}.EMAIL_LINK.\n */\n static readonly EMAIL_LINK_SIGN_IN_METHOD: 'emailLink' =\n SignInMethod.EMAIL_LINK;\n /**\n * Always set to {@link ProviderId}.PASSWORD, even for email link.\n */\n readonly providerId = EmailAuthProvider.PROVIDER_ID;\n\n /**\n * Initialize an {@link AuthCredential} using an email and password.\n *\n * @example\n * ```javascript\n * const authCredential = EmailAuthProvider.credential(email, password);\n * const userCredential = await signInWithCredential(auth, authCredential);\n * ```\n *\n * @example\n * ```javascript\n * const userCredential = await signInWithEmailAndPassword(auth, email, password);\n * ```\n *\n * @param email - Email address.\n * @param password - User account password.\n * @returns The auth provider credential.\n */\n static credential(email: string, password: string): EmailAuthCredential {\n return EmailAuthCredential._fromEmailAndPassword(email, password);\n }\n\n /**\n * Initialize an {@link AuthCredential} using an email and an email link after a sign in with\n * email link operation.\n *\n * @example\n * ```javascript\n * const authCredential = EmailAuthProvider.credentialWithLink(auth, email, emailLink);\n * const userCredential = await signInWithCredential(auth, authCredential);\n * ```\n *\n * @example\n * ```javascript\n * await sendSignInLinkToEmail(auth, email);\n * // Obtain emailLink from user.\n * const userCredential = await signInWithEmailLink(auth, email, emailLink);\n * ```\n *\n * @param auth - The {@link Auth} instance used to verify the link.\n * @param email - Email address.\n * @param emailLink - Sign-in email link.\n * @returns - The auth provider credential.\n */\n static credentialWithLink(\n email: string,\n emailLink: string\n ): EmailAuthCredential {\n const actionCodeUrl = ActionCodeURL.parseLink(emailLink);\n _assert(actionCodeUrl, AuthErrorCode.ARGUMENT_ERROR);\n\n return EmailAuthCredential._fromEmailAndCode(\n email,\n actionCodeUrl.code,\n actionCodeUrl.tenantId\n );\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AuthProvider } from '../../model/public_types';\n\n/**\n * Map of OAuth Custom Parameters.\n *\n * @public\n */\nexport type CustomParameters = Record<string, string>;\n\n/**\n * The base class for all Federated providers (OAuth (including OIDC), SAML).\n *\n * This class is not meant to be instantiated directly.\n *\n * @public\n */\nexport abstract class FederatedAuthProvider implements AuthProvider {\n /** @internal */\n defaultLanguageCode: string | null = null;\n /** @internal */\n private customParameters: CustomParameters = {};\n\n /**\n * Constructor for generic OAuth providers.\n *\n * @param providerId - Provider for which credentials should be generated.\n */\n constructor(readonly providerId: string) {}\n\n /**\n * Set the language gode.\n *\n * @param languageCode - language code\n */\n setDefaultLanguage(languageCode: string | null): void {\n this.defaultLanguageCode = languageCode;\n }\n\n /**\n * Sets the OAuth custom parameters to pass in an OAuth request for popup and redirect sign-in\n * operations.\n *\n * @remarks\n * For a detailed list, check the reserved required OAuth 2.0 parameters such as `client_id`,\n * `redirect_uri`, `scope`, `response_type`, and `state` are not allowed and will be ignored.\n *\n * @param customOAuthParameters - The custom OAuth parameters to pass in the OAuth request.\n */\n setCustomParameters(customOAuthParameters: CustomParameters): AuthProvider {\n this.customParameters = customOAuthParameters;\n return this;\n }\n\n /**\n * Retrieve the current list of {@link CustomParameters}.\n */\n getCustomParameters(): CustomParameters {\n return this.customParameters;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AuthProvider, UserCredential } from '../../model/public_types';\n\nimport { _assert } from '../util/assert';\nimport { AuthErrorCode } from '../errors';\n\nimport { OAuthCredential, OAuthCredentialParams } from '../credentials/oauth';\nimport { UserCredentialInternal } from '../../model/user';\nimport { FirebaseError } from '@firebase/util';\nimport { TaggedWithTokenResponse } from '../../model/id_token';\nimport { SignInWithIdpResponse } from '../../../internal';\nimport { FederatedAuthProvider } from './federated';\n\n/**\n * Defines the options for initializing an {@link OAuthCredential}.\n *\n * @remarks\n * For ID tokens with nonce claim, the raw nonce has to also be provided.\n *\n * @public\n */\nexport interface OAuthCredentialOptions {\n /**\n * The OAuth ID token used to initialize the {@link OAuthCredential}.\n */\n idToken?: string;\n /**\n * The OAuth access token used to initialize the {@link OAuthCredential}.\n */\n accessToken?: string;\n /**\n * The raw nonce associated with the ID token.\n *\n * @remarks\n * It is required when an ID token with a nonce field is provided. The SHA-256 hash of the\n * raw nonce must match the nonce field in the ID token.\n */\n rawNonce?: string;\n}\n\n/**\n * Common code to all OAuth providers. This is separate from the\n * {@link OAuthProvider} so that child providers (like\n * {@link GoogleAuthProvider}) don't inherit the `credential` instance method.\n * Instead, they rely on a static `credential` method.\n */\nexport abstract class BaseOAuthProvider\n extends FederatedAuthProvider\n implements AuthProvider\n{\n /** @internal */\n private scopes: string[] = [];\n\n /**\n * Add an OAuth scope to the credential.\n *\n * @param scope - Provider OAuth scope to add.\n */\n addScope(scope: string): AuthProvider {\n // If not already added, add scope to list.\n if (!this.scopes.includes(scope)) {\n this.scopes.push(scope);\n }\n return this;\n }\n\n /**\n * Retrieve the current list of OAuth scopes.\n */\n getScopes(): string[] {\n return [...this.scopes];\n }\n}\n\n/**\n * Provider for generating generic {@link OAuthCredential}.\n *\n * @example\n * ```javascript\n * // Sign in using a redirect.\n * const provider = new OAuthProvider('google.com');\n * // Start a sign in process for an unauthenticated user.\n * provider.addScope('profile');\n * provider.addScope('email');\n * await signInWithRedirect(auth, provider);\n * // This will trigger a full page redirect away from your app\n *\n * // After returning from the redirect when your app initializes you can obtain the result\n * const result = await getRedirectResult(auth);\n * if (result) {\n * // This is the signed-in user\n * const user = result.user;\n * // This gives you a OAuth Access Token for the provider.\n * const credential = provider.credentialFromResult(auth, result);\n * const token = credential.accessToken;\n * }\n * ```\n *\n * @example\n * ```javascript\n * // Sign in using a popup.\n * const provider = new OAuthProvider('google.com');\n * provider.addScope('profile');\n * provider.addScope('email');\n * const result = await signInWithPopup(auth, provider);\n *\n * // The signed-in user info.\n * const user = result.user;\n * // This gives you a OAuth Access Token for the provider.\n * const credential = provider.credentialFromResult(auth, result);\n * const token = credential.accessToken;\n * ```\n * @public\n */\nexport class OAuthProvider extends BaseOAuthProvider {\n /**\n * Creates an {@link OAuthCredential} from a JSON string or a plain object.\n * @param json - A plain object or a JSON string\n */\n static credentialFromJSON(json: object | string): OAuthCredential {\n const obj = typeof json === 'string' ? JSON.parse(json) : json;\n _assert(\n 'providerId' in obj && 'signInMethod' in obj,\n AuthErrorCode.ARGUMENT_ERROR\n );\n return OAuthCredential._fromParams(obj);\n }\n\n /**\n * Creates a {@link OAuthCredential} from a generic OAuth provider's access token or ID token.\n *\n * @remarks\n * The raw nonce is required when an ID token with a nonce field is provided. The SHA-256 hash of\n * the raw nonce must match the nonce field in the ID token.\n *\n * @example\n * ```javascript\n * // `googleUser` from the onsuccess Google Sign In callback.\n * // Initialize a generate OAuth provider with a `google.com` providerId.\n * const provider = new OAuthProvider('google.com');\n * const credential = provider.credential({\n * idToken: googleUser.getAuthResponse().id_token,\n * });\n * const result = await signInWithCredential(credential);\n * ```\n *\n * @param params - Either the options object containing the ID token, access token and raw nonce\n * or the ID token string.\n */\n credential(params: OAuthCredentialOptions): OAuthCredential {\n return this._credential({ ...params, nonce: params.rawNonce });\n }\n\n /** An internal credential method that accepts more permissive options */\n private _credential(\n params: Omit<OAuthCredentialParams, 'signInMethod' | 'providerId'>\n ): OAuthCredential {\n _assert(params.idToken || params.accessToken, AuthErrorCode.ARGUMENT_ERROR);\n // For OAuthCredential, sign in method is same as providerId.\n return OAuthCredential._fromParams({\n ...params,\n providerId: this.providerId,\n signInMethod: this.providerId\n });\n }\n\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromResult(\n userCredential: UserCredential\n ): OAuthCredential | null {\n return OAuthProvider.oauthCredentialFromTaggedObject(\n userCredential as UserCredentialInternal\n );\n }\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\n * thrown during a sign-in, link, or reauthenticate operation.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromError(error: FirebaseError): OAuthCredential | null {\n return OAuthProvider.oauthCredentialFromTaggedObject(\n (error.customData || {}) as TaggedWithTokenResponse\n );\n }\n\n private static oauthCredentialFromTaggedObject({\n _tokenResponse: tokenResponse\n }: TaggedWithTokenResponse): OAuthCredential | null {\n if (!tokenResponse) {\n return null;\n }\n\n const {\n oauthIdToken,\n oauthAccessToken,\n oauthTokenSecret,\n pendingToken,\n nonce,\n providerId\n } = tokenResponse as SignInWithIdpResponse;\n if (\n !oauthAccessToken &&\n !oauthTokenSecret &&\n !oauthIdToken &&\n !pendingToken\n ) {\n return null;\n }\n\n if (!providerId) {\n return null;\n }\n\n try {\n return new OAuthProvider(providerId)._credential({\n idToken: oauthIdToken,\n accessToken: oauthAccessToken,\n nonce,\n pendingToken\n });\n } catch (e) {\n return null;\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { UserCredential } from '../../model/public_types';\nimport { FirebaseError } from '@firebase/util';\n\nimport { TaggedWithTokenResponse } from '../../model/id_token';\nimport { UserCredentialInternal } from '../../model/user';\nimport { OAuthCredential } from '../credentials/oauth';\nimport { BaseOAuthProvider } from './oauth';\nimport { ProviderId, SignInMethod } from '../../model/enums';\n\n/**\n * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.FACEBOOK.\n *\n * @example\n * ```javascript\n * // Sign in using a redirect.\n * const provider = new FacebookAuthProvider();\n * // Start a sign in process for an unauthenticated user.\n * provider.addScope('user_birthday');\n * await signInWithRedirect(auth, provider);\n * // This will trigger a full page redirect away from your app\n *\n * // After returning from the redirect when your app initializes you can obtain the result\n * const result = await getRedirectResult(auth);\n * if (result) {\n * // This is the signed-in user\n * const user = result.user;\n * // This gives you a Facebook Access Token.\n * const credential = FacebookAuthProvider.credentialFromResult(result);\n * const token = credential.accessToken;\n * }\n * ```\n *\n * @example\n * ```javascript\n * // Sign in using a popup.\n * const provider = new FacebookAuthProvider();\n * provider.addScope('user_birthday');\n * const result = await signInWithPopup(auth, provider);\n *\n * // The signed-in user info.\n * const user = result.user;\n * // This gives you a Facebook Access Token.\n * const credential = FacebookAuthProvider.credentialFromResult(result);\n * const token = credential.accessToken;\n * ```\n *\n * @public\n */\nexport class FacebookAuthProvider extends BaseOAuthProvider {\n /** Always set to {@link SignInMethod}.FACEBOOK. */\n static readonly FACEBOOK_SIGN_IN_METHOD: 'facebook.com' =\n SignInMethod.FACEBOOK;\n /** Always set to {@link ProviderId}.FACEBOOK. */\n static readonly PROVIDER_ID: 'facebook.com' = ProviderId.FACEBOOK;\n\n constructor() {\n super(ProviderId.FACEBOOK);\n }\n\n /**\n * Creates a credential for Facebook.\n *\n * @example\n * ```javascript\n * // `event` from the Facebook auth.authResponseChange callback.\n * const credential = FacebookAuthProvider.credential(event.authResponse.accessToken);\n * const result = await signInWithCredential(credential);\n * ```\n *\n * @param accessToken - Facebook access token.\n */\n static credential(accessToken: string): OAuthCredential {\n return OAuthCredential._fromParams({\n providerId: FacebookAuthProvider.PROVIDER_ID,\n signInMethod: FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD,\n accessToken\n });\n }\n\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromResult(\n userCredential: UserCredential\n ): OAuthCredential | null {\n return FacebookAuthProvider.credentialFromTaggedObject(\n userCredential as UserCredentialInternal\n );\n }\n\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\n * thrown during a sign-in, link, or reauthenticate operation.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromError(error: FirebaseError): OAuthCredential | null {\n return FacebookAuthProvider.credentialFromTaggedObject(\n (error.customData || {}) as TaggedWithTokenResponse\n );\n }\n\n private static credentialFromTaggedObject({\n _tokenResponse: tokenResponse\n }: TaggedWithTokenResponse): OAuthCredential | null {\n if (!tokenResponse || !('oauthAccessToken' in tokenResponse)) {\n return null;\n }\n\n if (!tokenResponse.oauthAccessToken) {\n return null;\n }\n\n try {\n return FacebookAuthProvider.credential(tokenResponse.oauthAccessToken);\n } catch {\n return null;\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { UserCredential } from '../../model/public_types';\nimport { FirebaseError } from '@firebase/util';\n\nimport { SignInWithIdpResponse } from '../../api/authentication/idp';\nimport { TaggedWithTokenResponse } from '../../model/id_token';\nimport { UserCredentialInternal } from '../../model/user';\nimport { OAuthCredential } from '../credentials/oauth';\nimport { BaseOAuthProvider } from './oauth';\nimport { ProviderId, SignInMethod } from '../../model/enums';\n\n/**\n * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GOOGLE.\n *\n * @example\n * ```javascript\n * // Sign in using a redirect.\n * const provider = new GoogleAuthProvider();\n * // Start a sign in process for an unauthenticated user.\n * provider.addScope('profile');\n * provider.addScope('email');\n * await signInWithRedirect(auth, provider);\n * // This will trigger a full page redirect away from your app\n *\n * // After returning from the redirect when your app initializes you can obtain the result\n * const result = await getRedirectResult(auth);\n * if (result) {\n * // This is the signed-in user\n * const user = result.user;\n * // This gives you a Google Access Token.\n * const credential = GoogleAuthProvider.credentialFromResult(result);\n * const token = credential.accessToken;\n * }\n * ```\n *\n * @example\n * ```javascript\n * // Sign in using a popup.\n * const provider = new GoogleAuthProvider();\n * provider.addScope('profile');\n * provider.addScope('email');\n * const result = await signInWithPopup(auth, provider);\n *\n * // The signed-in user info.\n * const user = result.user;\n * // This gives you a Google Access Token.\n * const credential = GoogleAuthProvider.credentialFromResult(result);\n * const token = credential.accessToken;\n * ```\n *\n * @public\n */\nexport class GoogleAuthProvider extends BaseOAuthProvider {\n /** Always set to {@link SignInMethod}.GOOGLE. */\n static readonly GOOGLE_SIGN_IN_METHOD: 'google.com' = SignInMethod.GOOGLE;\n /** Always set to {@link ProviderId}.GOOGLE. */\n static readonly PROVIDER_ID: 'google.com' = ProviderId.GOOGLE;\n\n constructor() {\n super(ProviderId.GOOGLE);\n this.addScope('profile');\n }\n\n /**\n * Creates a credential for Google. At least one of ID token and access token is required.\n *\n * @example\n * ```javascript\n * // \\`googleUser\\` from the onsuccess Google Sign In callback.\n * const credential = GoogleAuthProvider.credential(googleUser.getAuthResponse().id_token);\n * const result = await signInWithCredential(credential);\n * ```\n *\n * @param idToken - Google ID token.\n * @param accessToken - Google access token.\n */\n static credential(\n idToken?: string | null,\n accessToken?: string | null\n ): OAuthCredential {\n return OAuthCredential._fromParams({\n providerId: GoogleAuthProvider.PROVIDER_ID,\n signInMethod: GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD,\n idToken,\n accessToken\n });\n }\n\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromResult(\n userCredential: UserCredential\n ): OAuthCredential | null {\n return GoogleAuthProvider.credentialFromTaggedObject(\n userCredential as UserCredentialInternal\n );\n }\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\n * thrown during a sign-in, link, or reauthenticate operation.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromError(error: FirebaseError): OAuthCredential | null {\n return GoogleAuthProvider.credentialFromTaggedObject(\n (error.customData || {}) as TaggedWithTokenResponse\n );\n }\n\n private static credentialFromTaggedObject({\n _tokenResponse: tokenResponse\n }: TaggedWithTokenResponse): OAuthCredential | null {\n if (!tokenResponse) {\n return null;\n }\n\n const { oauthIdToken, oauthAccessToken } =\n tokenResponse as SignInWithIdpResponse;\n if (!oauthIdToken && !oauthAccessToken) {\n // This could be an oauth 1 credential or a phone credential\n return null;\n }\n\n try {\n return GoogleAuthProvider.credential(oauthIdToken, oauthAccessToken);\n } catch {\n return null;\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { UserCredential } from '../../model/public_types';\nimport { FirebaseError } from '@firebase/util';\n\nimport { TaggedWithTokenResponse } from '../../model/id_token';\nimport { UserCredentialInternal } from '../../model/user';\nimport { OAuthCredential } from '../credentials/oauth';\nimport { BaseOAuthProvider } from './oauth';\nimport { ProviderId, SignInMethod } from '../../model/enums';\n\n/**\n * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GITHUB.\n *\n * @remarks\n * GitHub requires an OAuth 2.0 redirect, so you can either handle the redirect directly, or use\n * the {@link signInWithPopup} handler:\n *\n * @example\n * ```javascript\n * // Sign in using a redirect.\n * const provider = new GithubAuthProvider();\n * // Start a sign in process for an unauthenticated user.\n * provider.addScope('repo');\n * await signInWithRedirect(auth, provider);\n * // This will trigger a full page redirect away from your app\n *\n * // After returning from the redirect when your app initializes you can obtain the result\n * const result = await getRedirectResult(auth);\n * if (result) {\n * // This is the signed-in user\n * const user = result.user;\n * // This gives you a GitHub Access Token.\n * const credential = GithubAuthProvider.credentialFromResult(result);\n * const token = credential.accessToken;\n * }\n * ```\n *\n * @example\n * ```javascript\n * // Sign in using a popup.\n * const provider = new GithubAuthProvider();\n * provider.addScope('repo');\n * const result = await signInWithPopup(auth, provider);\n *\n * // The signed-in user info.\n * const user = result.user;\n * // This gives you a GitHub Access Token.\n * const credential = GithubAuthProvider.credentialFromResult(result);\n * const token = credential.accessToken;\n * ```\n * @public\n */\nexport class GithubAuthProvider extends BaseOAuthProvider {\n /** Always set to {@link SignInMethod}.GITHUB. */\n static readonly GITHUB_SIGN_IN_METHOD: 'github.com' = SignInMethod.GITHUB;\n /** Always set to {@link ProviderId}.GITHUB. */\n static readonly PROVIDER_ID: 'github.com' = ProviderId.GITHUB;\n\n constructor() {\n super(ProviderId.GITHUB);\n }\n\n /**\n * Creates a credential for GitHub.\n *\n * @param accessToken - GitHub access token.\n */\n static credential(accessToken: string): OAuthCredential {\n return OAuthCredential._fromParams({\n providerId: GithubAuthProvider.PROVIDER_ID,\n signInMethod: GithubAuthProvider.GITHUB_SIGN_IN_METHOD,\n accessToken\n });\n }\n\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromResult(\n userCredential: UserCredential\n ): OAuthCredential | null {\n return GithubAuthProvider.credentialFromTaggedObject(\n userCredential as UserCredentialInternal\n );\n }\n\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\n * thrown during a sign-in, link, or reauthenticate operation.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromError(error: FirebaseError): OAuthCredential | null {\n return GithubAuthProvider.credentialFromTaggedObject(\n (error.customData || {}) as TaggedWithTokenResponse\n );\n }\n\n private static credentialFromTaggedObject({\n _tokenResponse: tokenResponse\n }: TaggedWithTokenResponse): OAuthCredential | null {\n if (!tokenResponse || !('oauthAccessToken' in tokenResponse)) {\n return null;\n }\n\n if (!tokenResponse.oauthAccessToken) {\n return null;\n }\n\n try {\n return GithubAuthProvider.credential(tokenResponse.oauthAccessToken);\n } catch {\n return null;\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Represents the SAML credentials returned by an {@link SAMLAuthProvider}.\n *\n * @public\n */\n\nimport {\n signInWithIdp,\n SignInWithIdpRequest\n} from '../../api/authentication/idp';\nimport { AuthInternal } from '../../model/auth';\nimport { IdTokenResponse } from '../../model/id_token';\nimport { AuthCredential } from './auth_credential';\n\nconst IDP_REQUEST_URI = 'http://localhost';\n\n/**\n * @public\n */\nexport class SAMLAuthCredential extends AuthCredential {\n /** @internal */\n private constructor(\n providerId: string,\n private readonly pendingToken: string\n ) {\n super(providerId, providerId);\n }\n\n /** @internal */\n _getIdTokenResponse(auth: AuthInternal): Promise<IdTokenResponse> {\n const request = this.buildRequest();\n return signInWithIdp(auth, request);\n }\n\n /** @internal */\n _linkToIdToken(\n auth: AuthInternal,\n idToken: string\n ): Promise<IdTokenResponse> {\n const request = this.buildRequest();\n request.idToken = idToken;\n return signInWithIdp(auth, request);\n }\n\n /** @internal */\n _getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse> {\n const request = this.buildRequest();\n request.autoCreate = false;\n return signInWithIdp(auth, request);\n }\n\n /** {@inheritdoc AuthCredential.toJSON} */\n toJSON(): object {\n return {\n signInMethod: this.signInMethod,\n providerId: this.providerId,\n pendingToken: this.pendingToken\n };\n }\n\n /**\n * Static method to deserialize a JSON representation of an object into an\n * {@link AuthCredential}.\n *\n * @param json - Input can be either Object or the stringified representation of the object.\n * When string is provided, JSON.parse would be called first.\n *\n * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.\n */\n static fromJSON(json: string | object): SAMLAuthCredential | null {\n const obj = typeof json === 'string' ? JSON.parse(json) : json;\n const { providerId, signInMethod, pendingToken }: Record<string, string> =\n obj;\n if (\n !providerId ||\n !signInMethod ||\n !pendingToken ||\n providerId !== signInMethod\n ) {\n return null;\n }\n\n return new SAMLAuthCredential(providerId, pendingToken);\n }\n\n /**\n * Helper static method to avoid exposing the constructor to end users.\n *\n * @internal\n */\n static _create(providerId: string, pendingToken: string): SAMLAuthCredential {\n return new SAMLAuthCredential(providerId, pendingToken);\n }\n\n private buildRequest(): SignInWithIdpRequest {\n return {\n requestUri: IDP_REQUEST_URI,\n returnSecureToken: true,\n pendingToken: this.pendingToken\n };\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseError } from '@firebase/util';\nimport { SignInWithIdpResponse } from '../../api/authentication/idp';\nimport { TaggedWithTokenResponse } from '../../model/id_token';\nimport { UserCredential } from '../../model/public_types';\nimport { UserCredentialInternal } from '../../model/user';\nimport { AuthCredential } from '../credentials';\nimport { SAMLAuthCredential } from '../credentials/saml';\nimport { AuthErrorCode } from '../errors';\nimport { _assert } from '../util/assert';\nimport { FederatedAuthProvider } from './federated';\n\nconst SAML_PROVIDER_PREFIX = 'saml.';\n\n/**\n * An {@link AuthProvider} for SAML.\n *\n * @public\n */\nexport class SAMLAuthProvider extends FederatedAuthProvider {\n /**\n * Constructor. The providerId must start with \"saml.\"\n * @param providerId - SAML provider ID.\n */\n constructor(providerId: string) {\n _assert(\n providerId.startsWith(SAML_PROVIDER_PREFIX),\n AuthErrorCode.ARGUMENT_ERROR\n );\n super(providerId);\n }\n\n /**\n * Generates an {@link AuthCredential} from a {@link UserCredential} after a\n * successful SAML flow completes.\n *\n * @remarks\n *\n * For example, to get an {@link AuthCredential}, you could write the\n * following code:\n *\n * ```js\n * const userCredential = await signInWithPopup(auth, samlProvider);\n * const credential = SAMLAuthProvider.credentialFromResult(userCredential);\n * ```\n *\n * @param userCredential - The user credential.\n */\n static credentialFromResult(\n userCredential: UserCredential\n ): AuthCredential | null {\n return SAMLAuthProvider.samlCredentialFromTaggedObject(\n userCredential as UserCredentialInternal\n );\n }\n\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\n * thrown during a sign-in, link, or reauthenticate operation.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromError(error: FirebaseError): AuthCredential | null {\n return SAMLAuthProvider.samlCredentialFromTaggedObject(\n (error.customData || {}) as TaggedWithTokenResponse\n );\n }\n\n /**\n * Creates an {@link AuthCredential} from a JSON string or a plain object.\n * @param json - A plain object or a JSON string\n */\n static credentialFromJSON(json: string | object): AuthCredential {\n const credential = SAMLAuthCredential.fromJSON(json);\n _assert(credential, AuthErrorCode.ARGUMENT_ERROR);\n return credential;\n }\n\n private static samlCredentialFromTaggedObject({\n _tokenResponse: tokenResponse\n }: TaggedWithTokenResponse): SAMLAuthCredential | null {\n if (!tokenResponse) {\n return null;\n }\n\n const { pendingToken, providerId } = tokenResponse as SignInWithIdpResponse;\n\n if (!pendingToken || !providerId) {\n return null;\n }\n\n try {\n return SAMLAuthCredential._create(providerId, pendingToken);\n } catch (e) {\n return null;\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * @license\n * Copyright 2020 Twitter LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { UserCredential } from '../../model/public_types';\nimport { FirebaseError } from '@firebase/util';\n\nimport { SignInWithIdpResponse } from '../../api/authentication/idp';\nimport { TaggedWithTokenResponse } from '../../model/id_token';\nimport { UserCredentialInternal } from '../../model/user';\nimport { OAuthCredential } from '../credentials/oauth';\nimport { BaseOAuthProvider } from './oauth';\nimport { ProviderId, SignInMethod } from '../../model/enums';\n\n/**\n * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.TWITTER.\n *\n * @example\n * ```javascript\n * // Sign in using a redirect.\n * const provider = new TwitterAuthProvider();\n * // Start a sign in process for an unauthenticated user.\n * await signInWithRedirect(auth, provider);\n * // This will trigger a full page redirect away from your app\n *\n * // After returning from the redirect when your app initializes you can obtain the result\n * const result = await getRedirectResult(auth);\n * if (result) {\n * // This is the signed-in user\n * const user = result.user;\n * // This gives you a Twitter Access Token and Secret.\n * const credential = TwitterAuthProvider.credentialFromResult(result);\n * const token = credential.accessToken;\n * const secret = credential.secret;\n * }\n * ```\n *\n * @example\n * ```javascript\n * // Sign in using a popup.\n * const provider = new TwitterAuthProvider();\n * const result = await signInWithPopup(auth, provider);\n *\n * // The signed-in user info.\n * const user = result.user;\n * // This gives you a Twitter Access Token and Secret.\n * const credential = TwitterAuthProvider.credentialFromResult(result);\n * const token = credential.accessToken;\n * const secret = credential.secret;\n * ```\n *\n * @public\n */\nexport class TwitterAuthProvider extends BaseOAuthProvider {\n /** Always set to {@link SignInMethod}.TWITTER. */\n static readonly TWITTER_SIGN_IN_METHOD: 'twitter.com' = SignInMethod.TWITTER;\n /** Always set to {@link ProviderId}.TWITTER. */\n static readonly PROVIDER_ID: 'twitter.com' = ProviderId.TWITTER;\n\n constructor() {\n super(ProviderId.TWITTER);\n }\n\n /**\n * Creates a credential for Twitter.\n *\n * @param token - Twitter access token.\n * @param secret - Twitter secret.\n */\n static credential(token: string, secret: string): OAuthCredential {\n return OAuthCredential._fromParams({\n providerId: TwitterAuthProvider.PROVIDER_ID,\n signInMethod: TwitterAuthProvider.TWITTER_SIGN_IN_METHOD,\n oauthToken: token,\n oauthTokenSecret: secret\n });\n }\n\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromResult(\n userCredential: UserCredential\n ): OAuthCredential | null {\n return TwitterAuthProvider.credentialFromTaggedObject(\n userCredential as UserCredentialInternal\n );\n }\n\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\n * thrown during a sign-in, link, or reauthenticate operation.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromError(error: FirebaseError): OAuthCredential | null {\n return TwitterAuthProvider.credentialFromTaggedObject(\n (error.customData || {}) as TaggedWithTokenResponse\n );\n }\n\n private static credentialFromTaggedObject({\n _tokenResponse: tokenResponse\n }: TaggedWithTokenResponse): OAuthCredential | null {\n if (!tokenResponse) {\n return null;\n }\n const { oauthAccessToken, oauthTokenSecret } =\n tokenResponse as SignInWithIdpResponse;\n if (!oauthAccessToken || !oauthTokenSecret) {\n return null;\n }\n\n try {\n return TwitterAuthProvider.credential(oauthAccessToken, oauthTokenSecret);\n } catch {\n return null;\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Endpoint,\n HttpMethod,\n RecaptchaClientType,\n RecaptchaVersion,\n _addTidIfNecessary,\n _performSignInRequest\n} from '../index';\nimport { IdTokenResponse } from '../../model/id_token';\nimport { Auth } from '../../model/public_types';\n\nexport interface SignUpRequest {\n idToken?: string;\n returnSecureToken?: boolean;\n email?: string;\n password?: string;\n tenantId?: string;\n captchaResponse?: string;\n clientType?: RecaptchaClientType;\n recaptchaVersion?: RecaptchaVersion;\n}\n\nexport interface SignUpResponse extends IdTokenResponse {\n displayName?: string;\n email?: string;\n}\n\nexport async function signUp(\n auth: Auth,\n request: SignUpRequest\n): Promise<SignUpResponse> {\n return _performSignInRequest<SignUpRequest, SignUpResponse>(\n auth,\n HttpMethod.POST,\n Endpoint.SIGN_UP,\n _addTidIfNecessary(auth, request)\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { PhoneOrOauthTokenResponse } from '../../api/authentication/mfa';\nimport { IdTokenResponse } from '../../model/id_token';\nimport { UserInternal, UserCredentialInternal } from '../../model/user';\nimport { UserImpl } from './user_impl';\nimport { AuthInternal } from '../../model/auth';\nimport { OperationType, ProviderId } from '../../model/enums';\n\ninterface UserCredentialParams {\n readonly user: UserInternal;\n readonly providerId: ProviderId | string | null;\n readonly _tokenResponse?: PhoneOrOauthTokenResponse;\n readonly operationType: OperationType;\n}\n\nexport class UserCredentialImpl\n implements UserCredentialInternal, UserCredentialParams\n{\n readonly user: UserInternal;\n readonly providerId: ProviderId | string | null;\n readonly _tokenResponse: PhoneOrOauthTokenResponse | undefined;\n readonly operationType: OperationType;\n\n constructor(params: UserCredentialParams) {\n this.user = params.user;\n this.providerId = params.providerId;\n this._tokenResponse = params._tokenResponse;\n this.operationType = params.operationType;\n }\n\n static async _fromIdTokenResponse(\n auth: AuthInternal,\n operationType: OperationType,\n idTokenResponse: IdTokenResponse,\n isAnonymous: boolean = false\n ): Promise<UserCredentialInternal> {\n const user = await UserImpl._fromIdTokenResponse(\n auth,\n idTokenResponse,\n isAnonymous\n );\n const providerId = providerIdForResponse(idTokenResponse);\n const userCred = new UserCredentialImpl({\n user,\n providerId,\n _tokenResponse: idTokenResponse,\n operationType\n });\n return userCred;\n }\n\n static async _forOperation(\n user: UserInternal,\n operationType: OperationType,\n response: PhoneOrOauthTokenResponse\n ): Promise<UserCredentialImpl> {\n await user._updateTokensIfNecessary(response, /* reload */ true);\n const providerId = providerIdForResponse(response);\n return new UserCredentialImpl({\n user,\n providerId,\n _tokenResponse: response,\n operationType\n });\n }\n}\n\nfunction providerIdForResponse(\n response: IdTokenResponse\n): ProviderId | string | null {\n if (response.providerId) {\n return response.providerId;\n }\n\n if ('phoneNumber' in response) {\n return ProviderId.PHONE;\n }\n\n return null;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Auth, UserCredential } from '../../model/public_types';\nimport { signUp } from '../../api/authentication/sign_up';\nimport { UserInternal } from '../../model/user';\nimport { UserCredentialImpl } from '../user/user_credential_impl';\nimport { _castAuth } from '../auth/auth_impl';\nimport { OperationType } from '../../model/enums';\nimport { _isFirebaseServerApp } from '@firebase/app';\nimport { _serverAppCurrentUserOperationNotSupportedError } from '../../core/util/assert';\n\n/**\n * Asynchronously signs in as an anonymous user.\n *\n * @remarks\n * If there is already an anonymous user signed in, that user will be returned; otherwise, a\n * new anonymous user identity will be created and returned.\n *\n * This method is not supported by {@link Auth} instances created with a\n * {@link @firebase/app#FirebaseServerApp}.\n *\n * @param auth - The {@link Auth} instance.\n *\n * @public\n */\nexport async function signInAnonymously(auth: Auth): Promise<UserCredential> {\n if (_isFirebaseServerApp(auth.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(auth)\n );\n }\n const authInternal = _castAuth(auth);\n await authInternal._initializationPromise;\n if (authInternal.currentUser?.isAnonymous) {\n // If an anonymous user is already signed in, no need to sign them in again.\n return new UserCredentialImpl({\n user: authInternal.currentUser as UserInternal,\n providerId: null,\n operationType: OperationType.SIGN_IN\n });\n }\n const response = await signUp(authInternal, {\n returnSecureToken: true\n });\n const userCredential = await UserCredentialImpl._fromIdTokenResponse(\n authInternal,\n OperationType.SIGN_IN,\n response,\n true\n );\n await authInternal._updateCurrentUser(userCredential.user);\n return userCredential;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MultiFactorError as MultiFactorErrorPublic } from '../model/public_types';\nimport { FirebaseError } from '@firebase/util';\nimport { AuthInternal } from '../model/auth';\nimport { IdTokenResponse } from '../model/id_token';\nimport { AuthErrorCode } from '../core/errors';\nimport { UserInternal } from '../model/user';\nimport { AuthCredential } from '../core/credentials';\nimport { IdTokenMfaResponse } from '../api/authentication/mfa';\nimport { OperationType } from '../model/enums';\n\nexport type MultiFactorErrorData = MultiFactorErrorPublic['customData'] & {\n _serverResponse: IdTokenMfaResponse;\n};\n\nexport class MultiFactorError\n extends FirebaseError\n implements MultiFactorErrorPublic\n{\n readonly customData: MultiFactorErrorData;\n\n private constructor(\n auth: AuthInternal,\n error: FirebaseError,\n readonly operationType: OperationType,\n readonly user?: UserInternal\n ) {\n super(error.code, error.message);\n // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, MultiFactorError.prototype);\n this.customData = {\n appName: auth.name,\n tenantId: auth.tenantId ?? undefined,\n _serverResponse: error.customData!._serverResponse as IdTokenMfaResponse,\n operationType\n };\n }\n\n static _fromErrorAndOperation(\n auth: AuthInternal,\n error: FirebaseError,\n operationType: OperationType,\n user?: UserInternal\n ): MultiFactorError {\n return new MultiFactorError(auth, error, operationType, user);\n }\n}\n\nexport function _processCredentialSavingMfaContextIfNecessary(\n auth: AuthInternal,\n operationType: OperationType,\n credential: AuthCredential,\n user?: UserInternal\n): Promise<IdTokenResponse> {\n const idTokenProvider =\n operationType === OperationType.REAUTHENTICATE\n ? credential._getReauthenticationResolver(auth)\n : credential._getIdTokenResponse(auth);\n\n return idTokenProvider.catch(error => {\n if (error.code === `auth/${AuthErrorCode.MFA_REQUIRED}`) {\n throw MultiFactorError._fromErrorAndOperation(\n auth,\n error,\n operationType,\n user\n );\n }\n\n throw error;\n });\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface ProviderAssociatedObject {\n providerId?: string;\n}\n\n/**\n * Takes a set of UserInfo provider data and converts it to a set of names\n */\nexport function providerDataAsNames<T extends ProviderAssociatedObject>(\n providerData: T[]\n): Set<string> {\n return new Set(\n providerData\n .map(({ providerId }) => providerId)\n .filter(pid => !!pid) as string[]\n );\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { User } from '../../model/public_types';\n\nimport { deleteLinkedAccounts } from '../../api/account_management/account';\nimport { UserInternal, UserCredentialInternal } from '../../model/user';\nimport { AuthCredential } from '../credentials';\nimport { AuthErrorCode } from '../errors';\nimport { _assert } from '../util/assert';\nimport { providerDataAsNames } from '../util/providers';\nimport { _logoutIfInvalidated } from './invalidation';\nimport { _reloadWithoutSaving } from './reload';\nimport { UserCredentialImpl } from './user_credential_impl';\nimport { getModularInstance } from '@firebase/util';\nimport { OperationType, ProviderId } from '../../model/enums';\n\n/**\n * Unlinks a provider from a user account.\n *\n * @param user - The user.\n * @param providerId - The provider to unlink.\n *\n * @public\n */\nexport async function unlink(user: User, providerId: string): Promise<User> {\n const userInternal = getModularInstance(user) as UserInternal;\n await _assertLinkedStatus(true, userInternal, providerId);\n const { providerUserInfo } = await deleteLinkedAccounts(userInternal.auth, {\n idToken: await userInternal.getIdToken(),\n deleteProvider: [providerId]\n });\n\n const providersLeft = providerDataAsNames(providerUserInfo || []);\n\n userInternal.providerData = userInternal.providerData.filter(pd =>\n providersLeft.has(pd.providerId)\n );\n if (!providersLeft.has(ProviderId.PHONE)) {\n userInternal.phoneNumber = null;\n }\n\n await userInternal.auth._persistUserIfCurrent(userInternal);\n return userInternal;\n}\n\nexport async function _link(\n user: UserInternal,\n credential: AuthCredential,\n bypassAuthState = false\n): Promise<UserCredentialInternal> {\n const response = await _logoutIfInvalidated(\n user,\n credential._linkToIdToken(user.auth, await user.getIdToken()),\n bypassAuthState\n );\n return UserCredentialImpl._forOperation(user, OperationType.LINK, response);\n}\n\nexport async function _assertLinkedStatus(\n expected: boolean,\n user: UserInternal,\n provider: string\n): Promise<void> {\n await _reloadWithoutSaving(user);\n const providerIds = providerDataAsNames(user.providerData);\n\n const code =\n expected === false\n ? AuthErrorCode.PROVIDER_ALREADY_LINKED\n : AuthErrorCode.NO_SUCH_PROVIDER;\n _assert(providerIds.has(provider) === expected, user.auth, code);\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FirebaseError } from '@firebase/util';\nimport { _processCredentialSavingMfaContextIfNecessary } from '../../mfa/mfa_error';\nimport { OperationType } from '../../model/enums';\nimport { UserInternal } from '../../model/user';\nimport { AuthCredential } from '../credentials';\nimport { AuthErrorCode } from '../errors';\nimport { _assert, _fail } from '../util/assert';\nimport { _parseToken } from './id_token_result';\nimport { _logoutIfInvalidated } from './invalidation';\nimport { UserCredentialImpl } from './user_credential_impl';\nimport { _isFirebaseServerApp } from '@firebase/app';\nimport { _serverAppCurrentUserOperationNotSupportedError } from '../../core/util/assert';\n\nexport async function _reauthenticate(\n user: UserInternal,\n credential: AuthCredential,\n bypassAuthState = false\n): Promise<UserCredentialImpl> {\n const { auth } = user;\n if (_isFirebaseServerApp(auth.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(auth)\n );\n }\n const operationType = OperationType.REAUTHENTICATE;\n\n try {\n const response = await _logoutIfInvalidated(\n user,\n _processCredentialSavingMfaContextIfNecessary(\n auth,\n operationType,\n credential,\n user\n ),\n bypassAuthState\n );\n _assert(response.idToken, auth, AuthErrorCode.INTERNAL_ERROR);\n const parsed = _parseToken(response.idToken);\n _assert(parsed, auth, AuthErrorCode.INTERNAL_ERROR);\n\n const { sub: localId } = parsed;\n _assert(user.uid === localId, auth, AuthErrorCode.USER_MISMATCH);\n\n return UserCredentialImpl._forOperation(user, operationType, response);\n } catch (e) {\n // Convert user deleted error into user mismatch\n if ((e as FirebaseError)?.code === `auth/${AuthErrorCode.USER_DELETED}`) {\n _fail(auth, AuthErrorCode.USER_MISMATCH);\n }\n throw e;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { UserCredential, Auth, User } from '../../model/public_types';\n\nimport { _processCredentialSavingMfaContextIfNecessary } from '../../mfa/mfa_error';\nimport { AuthInternal } from '../../model/auth';\nimport { UserInternal } from '../../model/user';\nimport { AuthCredential } from '../credentials';\nimport { _assertLinkedStatus, _link } from '../user/link_unlink';\nimport { _reauthenticate } from '../user/reauthenticate';\nimport { UserCredentialImpl } from '../user/user_credential_impl';\nimport { _castAuth } from '../auth/auth_impl';\nimport { getModularInstance } from '@firebase/util';\nimport { OperationType } from '../../model/enums';\nimport { _isFirebaseServerApp } from '@firebase/app';\nimport { _serverAppCurrentUserOperationNotSupportedError } from '../../core/util/assert';\n\nexport async function _signInWithCredential(\n auth: AuthInternal,\n credential: AuthCredential,\n bypassAuthState = false\n): Promise<UserCredential> {\n if (_isFirebaseServerApp(auth.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(auth)\n );\n }\n const operationType = OperationType.SIGN_IN;\n const response = await _processCredentialSavingMfaContextIfNecessary(\n auth,\n operationType,\n credential\n );\n const userCredential = await UserCredentialImpl._fromIdTokenResponse(\n auth,\n operationType,\n response\n );\n\n if (!bypassAuthState) {\n await auth._updateCurrentUser(userCredential.user);\n }\n return userCredential;\n}\n\n/**\n * Asynchronously signs in with the given credentials.\n *\n * @remarks\n * An {@link AuthProvider} can be used to generate the credential.\n *\n * This method is not supported by {@link Auth} instances created with a\n * {@link @firebase/app#FirebaseServerApp}.\n *\n * @param auth - The {@link Auth} instance.\n * @param credential - The auth credential.\n *\n * @public\n */\nexport async function signInWithCredential(\n auth: Auth,\n credential: AuthCredential\n): Promise<UserCredential> {\n return _signInWithCredential(_castAuth(auth), credential);\n}\n\n/**\n * Links the user account with the given credentials.\n *\n * @remarks\n * An {@link AuthProvider} can be used to generate the credential.\n *\n * @param user - The user.\n * @param credential - The auth credential.\n *\n * @public\n */\nexport async function linkWithCredential(\n user: User,\n credential: AuthCredential\n): Promise<UserCredential> {\n const userInternal = getModularInstance(user) as UserInternal;\n\n await _assertLinkedStatus(false, userInternal, credential.providerId);\n\n return _link(userInternal, credential);\n}\n\n/**\n * Re-authenticates a user using a fresh credential.\n *\n * @remarks\n * Use before operations such as {@link updatePassword} that require tokens from recent sign-in\n * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error\n * or a `TOKEN_EXPIRED` error.\n *\n * This method is not supported on any {@link User} signed in by {@link Auth} instances\n * created with a {@link @firebase/app#FirebaseServerApp}.\n *\n * @param user - The user.\n * @param credential - The auth credential.\n *\n * @public\n */\nexport async function reauthenticateWithCredential(\n user: User,\n credential: AuthCredential\n): Promise<UserCredential> {\n return _reauthenticate(getModularInstance(user) as UserInternal, credential);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Endpoint,\n HttpMethod,\n _addTidIfNecessary,\n _performSignInRequest\n} from '../index';\nimport { IdTokenResponse } from '../../model/id_token';\nimport { Auth } from '../../model/public_types';\n\nexport interface SignInWithCustomTokenRequest {\n token: string;\n returnSecureToken: boolean;\n tenantId?: string;\n}\n\nexport interface SignInWithCustomTokenResponse extends IdTokenResponse {}\n\nexport async function signInWithCustomToken(\n auth: Auth,\n request: SignInWithCustomTokenRequest\n): Promise<SignInWithCustomTokenResponse> {\n return _performSignInRequest<\n SignInWithCustomTokenRequest,\n SignInWithCustomTokenResponse\n >(\n auth,\n HttpMethod.POST,\n Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN,\n _addTidIfNecessary(auth, request)\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Auth, UserCredential } from '../../model/public_types';\n\nimport { signInWithCustomToken as getIdTokenResponse } from '../../api/authentication/custom_token';\nimport { IdTokenResponse } from '../../model/id_token';\nimport { UserCredentialImpl } from '../user/user_credential_impl';\nimport { _castAuth } from '../auth/auth_impl';\nimport { OperationType } from '../../model/enums';\nimport { _isFirebaseServerApp } from '@firebase/app';\nimport { _serverAppCurrentUserOperationNotSupportedError } from '../../core/util/assert';\n/**\n * Asynchronously signs in using a custom token.\n *\n * @remarks\n * Custom tokens are used to integrate Firebase Auth with existing auth systems, and must\n * be generated by an auth backend using the\n * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#createcustomtoken | createCustomToken}\n * method in the {@link https://firebase.google.com/docs/auth/admin | Admin SDK} .\n *\n * Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service.\n *\n * This method is not supported by {@link Auth} instances created with a\n * {@link @firebase/app#FirebaseServerApp}.\n *\n * @param auth - The {@link Auth} instance.\n * @param customToken - The custom token to sign in with.\n *\n * @public\n */\nexport async function signInWithCustomToken(\n auth: Auth,\n customToken: string\n): Promise<UserCredential> {\n if (_isFirebaseServerApp(auth.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(auth)\n );\n }\n const authInternal = _castAuth(auth);\n const response: IdTokenResponse = await getIdTokenResponse(authInternal, {\n token: customToken,\n returnSecureToken: true\n });\n const cred = await UserCredentialImpl._fromIdTokenResponse(\n authInternal,\n OperationType.SIGN_IN,\n response\n );\n await authInternal._updateCurrentUser(cred.user);\n return cred;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n FactorId,\n MultiFactorInfo,\n PhoneMultiFactorInfo,\n TotpMultiFactorInfo\n} from '../model/public_types';\nimport {\n PhoneMfaEnrollment,\n MfaEnrollment,\n TotpMfaEnrollment\n} from '../api/account_management/mfa';\nimport { AuthErrorCode } from '../core/errors';\nimport { _fail } from '../core/util/assert';\nimport { AuthInternal } from '../model/auth';\n\nexport abstract class MultiFactorInfoImpl implements MultiFactorInfo {\n readonly uid: string;\n readonly displayName?: string | null;\n readonly enrollmentTime: string;\n\n protected constructor(readonly factorId: FactorId, response: MfaEnrollment) {\n this.uid = response.mfaEnrollmentId;\n this.enrollmentTime = new Date(response.enrolledAt).toUTCString();\n this.displayName = response.displayName;\n }\n\n static _fromServerResponse(\n auth: AuthInternal,\n enrollment: MfaEnrollment\n ): MultiFactorInfoImpl {\n if ('phoneInfo' in enrollment) {\n return PhoneMultiFactorInfoImpl._fromServerResponse(auth, enrollment);\n } else if ('totpInfo' in enrollment) {\n return TotpMultiFactorInfoImpl._fromServerResponse(auth, enrollment);\n }\n return _fail(auth, AuthErrorCode.INTERNAL_ERROR);\n }\n}\n\nexport class PhoneMultiFactorInfoImpl\n extends MultiFactorInfoImpl\n implements PhoneMultiFactorInfo\n{\n readonly phoneNumber: string;\n\n private constructor(response: PhoneMfaEnrollment) {\n super(FactorId.PHONE, response);\n this.phoneNumber = response.phoneInfo;\n }\n\n static _fromServerResponse(\n _auth: AuthInternal,\n enrollment: MfaEnrollment\n ): PhoneMultiFactorInfoImpl {\n return new PhoneMultiFactorInfoImpl(enrollment as PhoneMfaEnrollment);\n }\n}\nexport class TotpMultiFactorInfoImpl\n extends MultiFactorInfoImpl\n implements TotpMultiFactorInfo\n{\n private constructor(response: TotpMfaEnrollment) {\n super(FactorId.TOTP, response);\n }\n\n static _fromServerResponse(\n _auth: AuthInternal,\n enrollment: MfaEnrollment\n ): TotpMultiFactorInfoImpl {\n return new TotpMultiFactorInfoImpl(enrollment as TotpMfaEnrollment);\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ActionCodeSettings, Auth } from '../../model/public_types';\n\nimport { GetOobCodeRequest } from '../../api/authentication/email_and_password';\nimport { AuthErrorCode } from '../errors';\nimport { _assert } from '../util/assert';\n\nexport function _setActionCodeSettingsOnRequest(\n auth: Auth,\n request: GetOobCodeRequest,\n actionCodeSettings: ActionCodeSettings\n): void {\n _assert(\n actionCodeSettings.url?.length > 0,\n auth,\n AuthErrorCode.INVALID_CONTINUE_URI\n );\n _assert(\n typeof actionCodeSettings.dynamicLinkDomain === 'undefined' ||\n actionCodeSettings.dynamicLinkDomain.length > 0,\n auth,\n AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN\n );\n _assert(\n typeof actionCodeSettings.linkDomain === 'undefined' ||\n actionCodeSettings.linkDomain.length > 0,\n auth,\n AuthErrorCode.INVALID_HOSTING_LINK_DOMAIN\n );\n\n request.continueUrl = actionCodeSettings.url;\n request.dynamicLinkDomain = actionCodeSettings.dynamicLinkDomain;\n request.linkDomain = actionCodeSettings.linkDomain;\n request.canHandleCodeInApp = actionCodeSettings.handleCodeInApp;\n\n if (actionCodeSettings.iOS) {\n _assert(\n actionCodeSettings.iOS.bundleId.length > 0,\n auth,\n AuthErrorCode.MISSING_IOS_BUNDLE_ID\n );\n request.iOSBundleId = actionCodeSettings.iOS.bundleId;\n }\n\n if (actionCodeSettings.android) {\n _assert(\n actionCodeSettings.android.packageName.length > 0,\n auth,\n AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME\n );\n request.androidInstallApp = actionCodeSettings.android.installApp;\n request.androidMinimumVersionCode =\n actionCodeSettings.android.minimumVersion;\n request.androidPackageName = actionCodeSettings.android.packageName;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ActionCodeInfo,\n ActionCodeOperation,\n ActionCodeSettings,\n Auth,\n UserCredential\n} from '../../model/public_types';\n\nimport * as account from '../../api/account_management/email_and_password';\nimport * as authentication from '../../api/authentication/email_and_password';\nimport { signUp, SignUpRequest } from '../../api/authentication/sign_up';\nimport { MultiFactorInfoImpl } from '../../mfa/mfa_info';\nimport { EmailAuthProvider } from '../providers/email';\nimport { UserCredentialImpl } from '../user/user_credential_impl';\nimport {\n _assert,\n _serverAppCurrentUserOperationNotSupportedError\n} from '../util/assert';\nimport { _setActionCodeSettingsOnRequest } from './action_code_settings';\nimport { signInWithCredential } from './credential';\nimport { _castAuth } from '../auth/auth_impl';\nimport { AuthErrorCode } from '../errors';\nimport { getModularInstance } from '@firebase/util';\nimport { OperationType } from '../../model/enums';\nimport { handleRecaptchaFlow } from '../../platform_browser/recaptcha/recaptcha_enterprise_verifier';\nimport { IdTokenResponse } from '../../model/id_token';\nimport {\n RecaptchaActionName,\n RecaptchaClientType,\n RecaptchaAuthProvider\n} from '../../api';\nimport { _isFirebaseServerApp } from '@firebase/app';\n\n/**\n * Updates the password policy cached in the {@link Auth} instance if a policy is already\n * cached for the project or tenant.\n *\n * @remarks\n * We only fetch the password policy if the password did not meet policy requirements and\n * there is an existing policy cached. A developer must call validatePassword at least\n * once for the cache to be automatically updated.\n *\n * @param auth - The {@link Auth} instance.\n *\n * @private\n */\nasync function recachePasswordPolicy(auth: Auth): Promise<void> {\n const authInternal = _castAuth(auth);\n if (authInternal._getPasswordPolicyInternal()) {\n await authInternal._updatePasswordPolicy();\n }\n}\n\n/**\n * Sends a password reset email to the given email address. This method does not throw an error when\n * there's no user account with the given email address and\n * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}\n * is enabled.\n *\n * @remarks\n * To complete the password reset, call {@link confirmPasswordReset} with the code supplied in\n * the email sent to the user, along with the new password specified by the user.\n *\n * @example\n * ```javascript\n * const actionCodeSettings = {\n * url: 'https://www.example.com/?email=user@example.com',\n * iOS: {\n * bundleId: 'com.example.ios'\n * },\n * android: {\n * packageName: 'com.example.android',\n * installApp: true,\n * minimumVersion: '12'\n * },\n * handleCodeInApp: true\n * };\n * await sendPasswordResetEmail(auth, 'user@example.com', actionCodeSettings);\n * // Obtain code from user.\n * await confirmPasswordReset('user@example.com', code);\n * ```\n *\n * @param auth - The {@link Auth} instance.\n * @param email - The user's email address.\n * @param actionCodeSettings - The {@link ActionCodeSettings}.\n *\n * @public\n */\nexport async function sendPasswordResetEmail(\n auth: Auth,\n email: string,\n actionCodeSettings?: ActionCodeSettings\n): Promise<void> {\n const authInternal = _castAuth(auth);\n const request: authentication.PasswordResetRequest = {\n requestType: ActionCodeOperation.PASSWORD_RESET,\n email,\n clientType: RecaptchaClientType.WEB\n };\n if (actionCodeSettings) {\n _setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);\n }\n await handleRecaptchaFlow(\n authInternal,\n request,\n RecaptchaActionName.GET_OOB_CODE,\n authentication.sendPasswordResetEmail,\n RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER\n );\n}\n\n/**\n * Completes the password reset process, given a confirmation code and new password.\n *\n * @param auth - The {@link Auth} instance.\n * @param oobCode - A confirmation code sent to the user.\n * @param newPassword - The new password.\n *\n * @public\n */\nexport async function confirmPasswordReset(\n auth: Auth,\n oobCode: string,\n newPassword: string\n): Promise<void> {\n await account\n .resetPassword(getModularInstance(auth), {\n oobCode,\n newPassword\n })\n .catch(async error => {\n if (\n error.code ===\n `auth/${AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS}`\n ) {\n void recachePasswordPolicy(auth);\n }\n\n throw error;\n });\n // Do not return the email.\n}\n\n/**\n * Applies a verification code sent to the user by email or other out-of-band mechanism.\n *\n * @param auth - The {@link Auth} instance.\n * @param oobCode - A verification code sent to the user.\n *\n * @public\n */\nexport async function applyActionCode(\n auth: Auth,\n oobCode: string\n): Promise<void> {\n await account.applyActionCode(getModularInstance(auth), { oobCode });\n}\n\n/**\n * Checks a verification code sent to the user by email or other out-of-band mechanism.\n *\n * @returns metadata about the code.\n *\n * @param auth - The {@link Auth} instance.\n * @param oobCode - A verification code sent to the user.\n *\n * @public\n */\nexport async function checkActionCode(\n auth: Auth,\n oobCode: string\n): Promise<ActionCodeInfo> {\n const authModular = getModularInstance(auth);\n const response = await account.resetPassword(authModular, { oobCode });\n\n // Email could be empty only if the request type is EMAIL_SIGNIN or\n // VERIFY_AND_CHANGE_EMAIL.\n // New email should not be empty if the request type is\n // VERIFY_AND_CHANGE_EMAIL.\n // Multi-factor info could not be empty if the request type is\n // REVERT_SECOND_FACTOR_ADDITION.\n const operation = response.requestType;\n _assert(operation, authModular, AuthErrorCode.INTERNAL_ERROR);\n switch (operation) {\n case ActionCodeOperation.EMAIL_SIGNIN:\n break;\n case ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL:\n _assert(response.newEmail, authModular, AuthErrorCode.INTERNAL_ERROR);\n break;\n case ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION:\n _assert(response.mfaInfo, authModular, AuthErrorCode.INTERNAL_ERROR);\n // fall through\n default:\n _assert(response.email, authModular, AuthErrorCode.INTERNAL_ERROR);\n }\n\n // The multi-factor info for revert second factor addition\n let multiFactorInfo: MultiFactorInfoImpl | null = null;\n if (response.mfaInfo) {\n multiFactorInfo = MultiFactorInfoImpl._fromServerResponse(\n _castAuth(authModular),\n response.mfaInfo\n );\n }\n\n return {\n data: {\n email:\n (response.requestType === ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL\n ? response.newEmail\n : response.email) || null,\n previousEmail:\n (response.requestType === ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL\n ? response.email\n : response.newEmail) || null,\n multiFactorInfo\n },\n operation\n };\n}\n\n/**\n * Checks a password reset code sent to the user by email or other out-of-band mechanism.\n *\n * @returns the user's email address if valid.\n *\n * @param auth - The {@link Auth} instance.\n * @param code - A verification code sent to the user.\n *\n * @public\n */\nexport async function verifyPasswordResetCode(\n auth: Auth,\n code: string\n): Promise<string> {\n const { data } = await checkActionCode(getModularInstance(auth), code);\n // Email should always be present since a code was sent to it\n return data.email!;\n}\n\n/**\n * Creates a new user account associated with the specified email address and password.\n *\n * @remarks\n * On successful creation of the user account, this user will also be signed in to your application.\n *\n * User account creation can fail if the account already exists or the password is invalid.\n *\n * This method is not supported on {@link Auth} instances created with a\n * {@link @firebase/app#FirebaseServerApp}.\n *\n * Note: The email address acts as a unique identifier for the user and enables an email-based\n * password reset. This function will create a new user account and set the initial user password.\n *\n * @param auth - The {@link Auth} instance.\n * @param email - The user's email address.\n * @param password - The user's chosen password.\n *\n * @public\n */\nexport async function createUserWithEmailAndPassword(\n auth: Auth,\n email: string,\n password: string\n): Promise<UserCredential> {\n if (_isFirebaseServerApp(auth.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(auth)\n );\n }\n const authInternal = _castAuth(auth);\n const request: SignUpRequest = {\n returnSecureToken: true,\n email,\n password,\n clientType: RecaptchaClientType.WEB\n };\n const signUpResponse: Promise<IdTokenResponse> = handleRecaptchaFlow(\n authInternal,\n request,\n RecaptchaActionName.SIGN_UP_PASSWORD,\n signUp,\n RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER\n );\n const response = await signUpResponse.catch(error => {\n if (\n error.code === `auth/${AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS}`\n ) {\n void recachePasswordPolicy(auth);\n }\n\n throw error;\n });\n\n const userCredential = await UserCredentialImpl._fromIdTokenResponse(\n authInternal,\n OperationType.SIGN_IN,\n response\n );\n await authInternal._updateCurrentUser(userCredential.user);\n\n return userCredential;\n}\n\n/**\n * Asynchronously signs in using an email and password.\n *\n * @remarks\n * Fails with an error if the email address and password do not match. When\n * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}\n * is enabled, this method fails with \"auth/invalid-credential\" in case of an invalid\n * email/password.\n *\n * This method is not supported on {@link Auth} instances created with a\n * {@link @firebase/app#FirebaseServerApp}.\n *\n * Note: The user's password is NOT the password used to access the user's email account. The\n * email address serves as a unique identifier for the user, and the password is used to access\n * the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}.\n *\n *\n * @param auth - The {@link Auth} instance.\n * @param email - The users email address.\n * @param password - The users password.\n *\n * @public\n */\nexport function signInWithEmailAndPassword(\n auth: Auth,\n email: string,\n password: string\n): Promise<UserCredential> {\n if (_isFirebaseServerApp(auth.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(auth)\n );\n }\n return signInWithCredential(\n getModularInstance(auth),\n EmailAuthProvider.credential(email, password)\n ).catch(async error => {\n if (\n error.code === `auth/${AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS}`\n ) {\n void recachePasswordPolicy(auth);\n }\n\n throw error;\n });\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ActionCodeOperation,\n ActionCodeSettings,\n Auth,\n UserCredential\n} from '../../model/public_types';\n\nimport * as api from '../../api/authentication/email_and_password';\nimport { ActionCodeURL } from '../action_code_url';\nimport { EmailAuthProvider } from '../providers/email';\nimport { _getCurrentUrl } from '../util/location';\nimport { _setActionCodeSettingsOnRequest } from './action_code_settings';\nimport { signInWithCredential } from './credential';\nimport { AuthErrorCode } from '../errors';\nimport { _assert } from '../util/assert';\nimport { getModularInstance } from '@firebase/util';\nimport { _castAuth } from '../auth/auth_impl';\nimport { handleRecaptchaFlow } from '../../platform_browser/recaptcha/recaptcha_enterprise_verifier';\nimport {\n RecaptchaActionName,\n RecaptchaClientType,\n RecaptchaAuthProvider\n} from '../../api';\nimport { _isFirebaseServerApp } from '@firebase/app';\nimport { _serverAppCurrentUserOperationNotSupportedError } from '../../core/util/assert';\n\n/**\n * Sends a sign-in email link to the user with the specified email.\n *\n * @remarks\n * The sign-in operation has to always be completed in the app unlike other out of band email\n * actions (password reset and email verifications). This is because, at the end of the flow,\n * the user is expected to be signed in and their Auth state persisted within the app.\n *\n * To complete sign in with the email link, call {@link signInWithEmailLink} with the email\n * address and the email link supplied in the email sent to the user.\n *\n * @example\n * ```javascript\n * const actionCodeSettings = {\n * url: 'https://www.example.com/?email=user@example.com',\n * iOS: {\n * bundleId: 'com.example.ios'\n * },\n * android: {\n * packageName: 'com.example.android',\n * installApp: true,\n * minimumVersion: '12'\n * },\n * handleCodeInApp: true\n * };\n * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);\n * // Obtain emailLink from the user.\n * if(isSignInWithEmailLink(auth, emailLink)) {\n * await signInWithEmailLink(auth, 'user@example.com', emailLink);\n * }\n * ```\n *\n * @param authInternal - The {@link Auth} instance.\n * @param email - The user's email address.\n * @param actionCodeSettings - The {@link ActionCodeSettings}.\n *\n * @public\n */\nexport async function sendSignInLinkToEmail(\n auth: Auth,\n email: string,\n actionCodeSettings: ActionCodeSettings\n): Promise<void> {\n const authInternal = _castAuth(auth);\n const request: api.EmailSignInRequest = {\n requestType: ActionCodeOperation.EMAIL_SIGNIN,\n email,\n clientType: RecaptchaClientType.WEB\n };\n function setActionCodeSettings(\n request: api.EmailSignInRequest,\n actionCodeSettings: ActionCodeSettings\n ): void {\n _assert(\n actionCodeSettings.handleCodeInApp,\n authInternal,\n AuthErrorCode.ARGUMENT_ERROR\n );\n if (actionCodeSettings) {\n _setActionCodeSettingsOnRequest(\n authInternal,\n request,\n actionCodeSettings\n );\n }\n }\n setActionCodeSettings(request, actionCodeSettings);\n await handleRecaptchaFlow(\n authInternal,\n request,\n RecaptchaActionName.GET_OOB_CODE,\n api.sendSignInLinkToEmail,\n RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER\n );\n}\n\n/**\n * Checks if an incoming link is a sign-in with email link suitable for {@link signInWithEmailLink}.\n *\n * @param auth - The {@link Auth} instance.\n * @param emailLink - The link sent to the user's email address.\n *\n * @public\n */\nexport function isSignInWithEmailLink(auth: Auth, emailLink: string): boolean {\n const actionCodeUrl = ActionCodeURL.parseLink(emailLink);\n return actionCodeUrl?.operation === ActionCodeOperation.EMAIL_SIGNIN;\n}\n\n/**\n * Asynchronously signs in using an email and sign-in email link.\n *\n * @remarks\n * If no link is passed, the link is inferred from the current URL.\n *\n * Fails with an error if the email address is invalid or OTP in email link expires.\n *\n * This method is not supported by {@link Auth} instances created with a\n * {@link @firebase/app#FirebaseServerApp}.\n *\n * Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink.\n *\n * @example\n * ```javascript\n * const actionCodeSettings = {\n * url: 'https://www.example.com/?email=user@example.com',\n * iOS: {\n * bundleId: 'com.example.ios'\n * },\n * android: {\n * packageName: 'com.example.android',\n * installApp: true,\n * minimumVersion: '12'\n * },\n * handleCodeInApp: true\n * };\n * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);\n * // Obtain emailLink from the user.\n * if(isSignInWithEmailLink(auth, emailLink)) {\n * await signInWithEmailLink(auth, 'user@example.com', emailLink);\n * }\n * ```\n *\n *\n * @param auth - The {@link Auth} instance.\n * @param email - The user's email address.\n * @param emailLink - The link sent to the user's email address.\n *\n * @public\n */\nexport async function signInWithEmailLink(\n auth: Auth,\n email: string,\n emailLink?: string\n): Promise<UserCredential> {\n if (_isFirebaseServerApp(auth.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(auth)\n );\n }\n const authModular = getModularInstance(auth);\n const credential = EmailAuthProvider.credentialWithLink(\n email,\n emailLink || _getCurrentUrl()\n );\n // Check if the tenant ID in the email link matches the tenant ID on Auth\n // instance.\n _assert(\n credential._tenantId === (authModular.tenantId || null),\n authModular,\n AuthErrorCode.TENANT_ID_MISMATCH\n );\n return signInWithCredential(authModular, credential);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Endpoint,\n HttpMethod,\n _addTidIfNecessary,\n _performApiRequest\n} from '../index';\nimport { Auth } from '../../model/public_types';\n\nexport interface CreateAuthUriRequest {\n identifier: string;\n continueUri: string;\n tenantId?: string;\n}\n\nexport interface CreateAuthUriResponse {\n signinMethods: string[];\n}\n\nexport async function createAuthUri(\n auth: Auth,\n request: CreateAuthUriRequest\n): Promise<CreateAuthUriResponse> {\n return _performApiRequest<CreateAuthUriRequest, CreateAuthUriResponse>(\n auth,\n HttpMethod.POST,\n Endpoint.CREATE_AUTH_URI,\n _addTidIfNecessary(auth, request)\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ActionCodeOperation,\n ActionCodeSettings,\n Auth,\n User\n} from '../../model/public_types';\n\nimport {\n createAuthUri,\n CreateAuthUriRequest\n} from '../../api/authentication/create_auth_uri';\nimport * as api from '../../api/authentication/email_and_password';\nimport { UserInternal } from '../../model/user';\nimport { _getCurrentUrl, _isHttpOrHttps } from '../util/location';\nimport { _setActionCodeSettingsOnRequest } from './action_code_settings';\nimport { getModularInstance } from '@firebase/util';\n\n/**\n * Gets the list of possible sign in methods for the given email address. This method returns an\n * empty list when\n * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}\n * is enabled, irrespective of the number of authentication methods available for the given email.\n *\n * @remarks\n * This is useful to differentiate methods of sign-in for the same provider, eg.\n * {@link EmailAuthProvider} which has 2 methods of sign-in,\n * {@link SignInMethod}.EMAIL_PASSWORD and\n * {@link SignInMethod}.EMAIL_LINK.\n *\n * @param auth - The {@link Auth} instance.\n * @param email - The user's email address.\n *\n * Deprecated. Migrating off of this method is recommended as a security best-practice.\n * Learn more in the Identity Platform documentation for\n * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}.\n * @public\n */\nexport async function fetchSignInMethodsForEmail(\n auth: Auth,\n email: string\n): Promise<string[]> {\n // createAuthUri returns an error if continue URI is not http or https.\n // For environments like Cordova, Chrome extensions, native frameworks, file\n // systems, etc, use http://localhost as continue URL.\n const continueUri = _isHttpOrHttps() ? _getCurrentUrl() : 'http://localhost';\n const request: CreateAuthUriRequest = {\n identifier: email,\n continueUri\n };\n\n const { signinMethods } = await createAuthUri(\n getModularInstance(auth),\n request\n );\n\n return signinMethods || [];\n}\n\n/**\n * Sends a verification email to a user.\n *\n * @remarks\n * The verification process is completed by calling {@link applyActionCode}.\n *\n * @example\n * ```javascript\n * const actionCodeSettings = {\n * url: 'https://www.example.com/?email=user@example.com',\n * iOS: {\n * bundleId: 'com.example.ios'\n * },\n * android: {\n * packageName: 'com.example.android',\n * installApp: true,\n * minimumVersion: '12'\n * },\n * handleCodeInApp: true\n * };\n * await sendEmailVerification(user, actionCodeSettings);\n * // Obtain code from the user.\n * await applyActionCode(auth, code);\n * ```\n *\n * @param user - The user.\n * @param actionCodeSettings - The {@link ActionCodeSettings}.\n *\n * @public\n */\nexport async function sendEmailVerification(\n user: User,\n actionCodeSettings?: ActionCodeSettings | null\n): Promise<void> {\n const userInternal = getModularInstance(user) as UserInternal;\n const idToken = await user.getIdToken();\n const request: api.VerifyEmailRequest = {\n requestType: ActionCodeOperation.VERIFY_EMAIL,\n idToken\n };\n if (actionCodeSettings) {\n _setActionCodeSettingsOnRequest(\n userInternal.auth,\n request,\n actionCodeSettings\n );\n }\n\n const { email } = await api.sendEmailVerification(userInternal.auth, request);\n\n if (email !== user.email) {\n await user.reload();\n }\n}\n\n/**\n * Sends a verification email to a new email address.\n *\n * @remarks\n * The user's email will be updated to the new one after being verified.\n *\n * If you have a custom email action handler, you can complete the verification process by calling\n * {@link applyActionCode}.\n *\n * @example\n * ```javascript\n * const actionCodeSettings = {\n * url: 'https://www.example.com/?email=user@example.com',\n * iOS: {\n * bundleId: 'com.example.ios'\n * },\n * android: {\n * packageName: 'com.example.android',\n * installApp: true,\n * minimumVersion: '12'\n * },\n * handleCodeInApp: true\n * };\n * await verifyBeforeUpdateEmail(user, 'newemail@example.com', actionCodeSettings);\n * // Obtain code from the user.\n * await applyActionCode(auth, code);\n * ```\n *\n * @param user - The user.\n * @param newEmail - The new email address to be verified before update.\n * @param actionCodeSettings - The {@link ActionCodeSettings}.\n *\n * @public\n */\nexport async function verifyBeforeUpdateEmail(\n user: User,\n newEmail: string,\n actionCodeSettings?: ActionCodeSettings | null\n): Promise<void> {\n const userInternal = getModularInstance(user) as UserInternal;\n const idToken = await user.getIdToken();\n const request: api.VerifyAndChangeEmailRequest = {\n requestType: ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL,\n idToken,\n newEmail\n };\n if (actionCodeSettings) {\n _setActionCodeSettingsOnRequest(\n userInternal.auth,\n request,\n actionCodeSettings\n );\n }\n\n const { email } = await api.verifyAndChangeEmail(userInternal.auth, request);\n\n if (email !== user.email) {\n // If the local copy of the email on user is outdated, reload the\n // user.\n await user.reload();\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Endpoint, HttpMethod, _performApiRequest } from '../index';\nimport { IdTokenResponse } from '../../model/id_token';\nimport { Auth } from '../../model/public_types';\n\nexport interface UpdateProfileRequest {\n idToken: string;\n displayName?: string | null;\n photoUrl?: string | null;\n returnSecureToken: boolean;\n}\n\nexport interface UpdateProfileResponse extends IdTokenResponse {\n displayName?: string | null;\n photoUrl?: string | null;\n}\n\nexport async function updateProfile(\n auth: Auth,\n request: UpdateProfileRequest\n): Promise<UpdateProfileResponse> {\n return _performApiRequest<UpdateProfileRequest, UpdateProfileResponse>(\n auth,\n HttpMethod.POST,\n Endpoint.SET_ACCOUNT_INFO,\n request\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { User } from '../../model/public_types';\n\nimport {\n updateEmailPassword as apiUpdateEmailPassword,\n UpdateEmailPasswordRequest\n} from '../../api/account_management/email_and_password';\nimport { updateProfile as apiUpdateProfile } from '../../api/account_management/profile';\nimport { UserInternal } from '../../model/user';\nimport { _logoutIfInvalidated } from './invalidation';\nimport { getModularInstance } from '@firebase/util';\nimport { ProviderId } from '../../model/enums';\nimport { _isFirebaseServerApp } from '@firebase/app';\nimport { _serverAppCurrentUserOperationNotSupportedError } from '../../core/util/assert';\n\n/**\n * Updates a user's profile data.\n *\n * @param user - The user.\n * @param profile - The profile's `displayName` and `photoURL` to update.\n *\n * @public\n */\nexport async function updateProfile(\n user: User,\n {\n displayName,\n photoURL: photoUrl\n }: { displayName?: string | null; photoURL?: string | null }\n): Promise<void> {\n if (displayName === undefined && photoUrl === undefined) {\n return;\n }\n\n const userInternal = getModularInstance(user) as UserInternal;\n const idToken = await userInternal.getIdToken();\n const profileRequest = {\n idToken,\n displayName,\n photoUrl,\n returnSecureToken: true\n };\n const response = await _logoutIfInvalidated(\n userInternal,\n apiUpdateProfile(userInternal.auth, profileRequest)\n );\n\n userInternal.displayName = response.displayName || null;\n userInternal.photoURL = response.photoUrl || null;\n\n // Update the password provider as well\n const passwordProvider = userInternal.providerData.find(\n ({ providerId }) => providerId === ProviderId.PASSWORD\n );\n if (passwordProvider) {\n passwordProvider.displayName = userInternal.displayName;\n passwordProvider.photoURL = userInternal.photoURL;\n }\n\n await userInternal._updateTokensIfNecessary(response);\n}\n\n/**\n * Updates the user's email address.\n *\n * @remarks\n * An email will be sent to the original email address (if it was set) that allows to revoke the\n * email address change, in order to protect them from account hijacking.\n *\n * This method is not supported on any {@link User} signed in by {@link Auth} instances\n * created with a {@link @firebase/app#FirebaseServerApp}.\n *\n * Important: this is a security sensitive operation that requires the user to have recently signed\n * in. If this requirement isn't met, ask the user to authenticate again and then call\n * {@link reauthenticateWithCredential}.\n *\n * @param user - The user.\n * @param newEmail - The new email address.\n *\n * Throws \"auth/operation-not-allowed\" error when\n * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}\n * is enabled.\n * Deprecated - Use {@link verifyBeforeUpdateEmail} instead.\n *\n * @public\n */\nexport function updateEmail(user: User, newEmail: string): Promise<void> {\n const userInternal = getModularInstance(user) as UserInternal;\n if (_isFirebaseServerApp(userInternal.auth.app)) {\n return Promise.reject(\n _serverAppCurrentUserOperationNotSupportedError(userInternal.auth)\n );\n }\n return updateEmailOrPassword(userInternal, newEmail, null);\n}\n\n/**\n * Updates the user's password.\n *\n * @remarks\n * Important: this is a security sensitive operation that requires the user to have recently signed\n * in. If this requirement isn't met, ask the user to authenticate again and then call\n * {@link reauthenticateWithCredential}.\n *\n * @param user - The user.\n * @param newPassword - The new password.\n *\n * @public\n */\nexport function updatePassword(user: User, newPassword: string): Promise<void> {\n return updateEmailOrPassword(\n getModularInstance(user) as UserInternal,\n null,\n newPassword\n );\n}\n\nasync function updateEmailOrPassword(\n user: UserInternal,\n email: string | null,\n password: string | null\n): Promise<void> {\n const { auth } = user;\n const idToken = await user.getIdToken();\n const request: UpdateEmailPasswordRequest = {\n idToken,\n returnSecureToken: true\n };\n\n if (email) {\n request.email = email;\n }\n\n if (password) {\n request.password = password;\n }\n\n const response = await _logoutIfInvalidated(\n user,\n apiUpdateEmailPassword(auth, request)\n );\n await user._updateTokensIfNecessary(response, /* reload */ true);\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AdditionalUserInfo, UserCredential } from '../../model/public_types';\nimport { IdTokenResponse, IdTokenResponseKind } from '../../model/id_token';\nimport { _parseToken } from './id_token_result';\nimport { UserCredentialInternal } from '../../model/user';\nimport { ProviderId } from '../../model/enums';\n\n/**\n * Parse the `AdditionalUserInfo` from the ID token response.\n *\n */\nexport function _fromIdTokenResponse(\n idTokenResponse?: IdTokenResponse\n): AdditionalUserInfo | null {\n if (!idTokenResponse) {\n return null;\n }\n const { providerId } = idTokenResponse;\n const profile = idTokenResponse.rawUserInfo\n ? JSON.parse(idTokenResponse.rawUserInfo)\n : {};\n const isNewUser =\n idTokenResponse.isNewUser ||\n idTokenResponse.kind === IdTokenResponseKind.SignupNewUser;\n if (!providerId && idTokenResponse?.idToken) {\n const signInProvider = _parseToken(idTokenResponse.idToken)?.firebase?.[\n 'sign_in_provider'\n ];\n if (signInProvider) {\n const filteredProviderId =\n signInProvider !== ProviderId.ANONYMOUS &&\n signInProvider !== ProviderId.CUSTOM\n ? (signInProvider as ProviderId)\n : null;\n // Uses generic class in accordance with the legacy SDK.\n return new GenericAdditionalUserInfo(isNewUser, filteredProviderId);\n }\n }\n if (!providerId) {\n return null;\n }\n switch (providerId) {\n case ProviderId.FACEBOOK:\n return new FacebookAdditionalUserInfo(isNewUser, profile);\n case ProviderId.GITHUB:\n return new GithubAdditionalUserInfo(isNewUser, profile);\n case ProviderId.GOOGLE:\n return new GoogleAdditionalUserInfo(isNewUser, profile);\n case ProviderId.TWITTER:\n return new TwitterAdditionalUserInfo(\n isNewUser,\n profile,\n idTokenResponse.screenName || null\n );\n case ProviderId.CUSTOM:\n case ProviderId.ANONYMOUS:\n return new GenericAdditionalUserInfo(isNewUser, null);\n default:\n return new GenericAdditionalUserInfo(isNewUser, providerId, profile);\n }\n}\n\nclass GenericAdditionalUserInfo implements AdditionalUserInfo {\n constructor(\n readonly isNewUser: boolean,\n readonly providerId: ProviderId | string | null,\n readonly profile: Record<string, unknown> = {}\n ) {}\n}\n\nclass FederatedAdditionalUserInfoWithUsername extends GenericAdditionalUserInfo {\n constructor(\n isNewUser: boolean,\n providerId: ProviderId,\n profile: Record<string, unknown>,\n readonly username: string | null\n ) {\n super(isNewUser, providerId, profile);\n }\n}\n\nclass FacebookAdditionalUserInfo extends GenericAdditionalUserInfo {\n constructor(isNewUser: boolean, profile: Record<string, unknown>) {\n super(isNewUser, ProviderId.FACEBOOK, profile);\n }\n}\n\nclass GithubAdditionalUserInfo extends FederatedAdditionalUserInfoWithUsername {\n constructor(isNewUser: boolean, profile: Record<string, unknown>) {\n super(\n isNewUser,\n ProviderId.GITHUB,\n profile,\n typeof profile?.login === 'string' ? profile?.login : null\n );\n }\n}\n\nclass GoogleAdditionalUserInfo extends GenericAdditionalUserInfo {\n constructor(isNewUser: boolean, profile: Record<string, unknown>) {\n super(isNewUser, ProviderId.GOOGLE, profile);\n }\n}\n\nclass TwitterAdditionalUserInfo extends FederatedAdditionalUserInfoWithUsername {\n constructor(\n isNewUser: boolean,\n profile: Record<string, unknown>,\n screenName: string | null\n ) {\n super(isNewUser, ProviderId.TWITTER, profile, screenName);\n }\n}\n\n/**\n * Extracts provider specific {@link AdditionalUserInfo} for the given credential.\n *\n * @param userCredential - The user credential.\n *\n * @public\n */\nexport function getAdditionalUserInfo(\n userCredential: UserCredential\n): AdditionalUserInfo | null {\n const { user, _tokenResponse } = userCredential as UserCredentialInternal;\n if (user.isAnonymous && !_tokenResponse) {\n // Handle the special case where signInAnonymously() gets called twice.\n // No network call is made so there's nothing to actually fill this in\n return {\n providerId: null,\n isNewUser: false,\n profile: null\n };\n }\n\n return _fromIdTokenResponse(_tokenResponse);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getModularInstance } from '@firebase/util';\nimport {\n Auth,\n NextOrObserver,\n Persistence,\n User,\n CompleteFn,\n ErrorFn,\n Unsubscribe,\n PasswordValidationStatus\n} from '../model/public_types';\nimport { _initializeRecaptchaConfig } from '../platform_browser/recaptcha/recaptcha_enterprise_verifier';\nimport { _castAuth } from '../core/auth/auth_impl';\n\nexport {\n debugErrorMap,\n prodErrorMap,\n AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as AuthErrorCodes\n} from './errors';\n\n// Non-optional auth methods.\n/**\n * Changes the type of persistence on the {@link Auth} instance for the currently saved\n * `Auth` session and applies this type of persistence for future sign-in requests, including\n * sign-in with redirect requests.\n *\n * @remarks\n * This makes it easy for a user signing in to specify whether their session should be\n * remembered or not. It also makes it easier to never persist the `Auth` state for applications\n * that are shared by other users or have sensitive data.\n *\n * This method does not work in a Node.js environment or with {@link Auth} instances created with a\n * {@link @firebase/app#FirebaseServerApp}.\n *\n * @example\n * ```javascript\n * setPersistence(auth, browserSessionPersistence);\n * ```\n *\n * @param auth - The {@link Auth} instance.\n * @param persistence - The {@link Persistence} to use.\n * @returns A `Promise` that resolves once the persistence change has completed\n *\n * @public\n */\nexport function setPersistence(\n auth: Auth,\n persistence: Persistence\n): Promise<void> {\n return getModularInstance(auth).setPersistence(persistence);\n}\n\n/**\n * Loads the reCAPTCHA configuration into the `Auth` instance.\n *\n * @remarks\n * This will load the reCAPTCHA config, which indicates whether the reCAPTCHA\n * verification flow should be triggered for each auth provider, into the\n * current Auth session.\n *\n * If initializeRecaptchaConfig() is not invoked, the auth flow will always start\n * without reCAPTCHA verification. If the provider is configured to require reCAPTCHA\n * verification, the SDK will transparently load the reCAPTCHA config and restart the\n * auth flows.\n *\n * Thus, by calling this optional method, you will reduce the latency of future auth flows.\n * Loading the reCAPTCHA config early will also enhance the signal collected by reCAPTCHA.\n *\n * This method does not work in a Node.js environment.\n *\n * @example\n * ```javascript\n * initializeRecaptchaConfig(auth);\n * ```\n *\n * @param auth - The {@link Auth} instance.\n *\n * @public\n */\nexport function initializeRecaptchaConfig(auth: Auth): Promise<void> {\n return _initializeRecaptchaConfig(auth);\n}\n\n/**\n * Validates the password against the password policy configured for the project or tenant.\n *\n * @remarks\n * If no tenant ID is set on the `Auth` instance, then this method will use the password\n * policy configured for the project. Otherwise, this method will use the policy configured\n * for the tenant. If a password policy has not been configured, then the default policy\n * configured for all projects will be used.\n *\n * If an auth flow fails because a submitted password does not meet the password policy\n * requirements and this method has previously been called, then this method will use the\n * most recent policy available when called again.\n *\n * @example\n * ```javascript\n * validatePassword(auth, 'some-password');\n * ```\n *\n * @param auth The {@link Auth} instance.\n * @param password The password to validate.\n *\n * @public\n */\nexport async function validatePassword(\n auth: Auth,\n password: string\n): Promise<PasswordValidationStatus> {\n const authInternal = _castAuth(auth);\n return authInternal.validatePassword(password);\n}\n\n/**\n * Adds an observer for changes to the signed-in user's ID token.\n *\n * @remarks\n * This includes sign-in, sign-out, and token refresh events.\n * This will not be triggered automatically upon ID token expiration. Use {@link User.getIdToken} to refresh the ID token.\n *\n * @param auth - The {@link Auth} instance.\n * @param nextOrObserver - callback triggered on change.\n * @param error - Deprecated. This callback is never triggered. Errors\n * on signing in/out can be caught in promises returned from\n * sign-in/sign-out functions.\n * @param completed - Deprecated. This callback is never triggered.\n *\n * @public\n */\nexport function onIdTokenChanged(\n auth: Auth,\n nextOrObserver: NextOrObserver<User>,\n error?: ErrorFn,\n completed?: CompleteFn\n): Unsubscribe {\n return getModularInstance(auth).onIdTokenChanged(\n nextOrObserver,\n error,\n completed\n );\n}\n/**\n * Adds a blocking callback that runs before an auth state change\n * sets a new user.\n *\n * @param auth - The {@link Auth} instance.\n * @param callback - callback triggered before new user value is set.\n * If this throws, it blocks the user from being set.\n * @param onAbort - callback triggered if a later `beforeAuthStateChanged()`\n * callback throws, allowing you to undo any side effects.\n */\nexport function beforeAuthStateChanged(\n auth: Auth,\n callback: (user: User | null) => void | Promise<void>,\n onAbort?: () => void\n): Unsubscribe {\n return getModularInstance(auth).beforeAuthStateChanged(callback, onAbort);\n}\n/**\n * Adds an observer for changes to the user's sign-in state.\n *\n * @remarks\n * To keep the old behavior, see {@link onIdTokenChanged}.\n *\n * @param auth - The {@link Auth} instance.\n * @param nextOrObserver - callback triggered on change.\n * @param error - Deprecated. This callback is never triggered. Errors\n * on signing in/out can be caught in promises returned from\n * sign-in/sign-out functions.\n * @param completed - Deprecated. This callback is never triggered.\n *\n * @public\n */\nexport function onAuthStateChanged(\n auth: Auth,\n nextOrObserver: NextOrObserver<User>,\n error?: ErrorFn,\n completed?: CompleteFn\n): Unsubscribe {\n return getModularInstance(auth).onAuthStateChanged(\n nextOrObserver,\n error,\n completed\n );\n}\n/**\n * Sets the current language to the default device/browser preference.\n *\n * @param auth - The {@link Auth} instance.\n *\n * @public\n */\nexport function useDeviceLanguage(auth: Auth): void {\n getModularInstance(auth).useDeviceLanguage();\n}\n/**\n * Asynchronously sets the provided user as {@link Auth.currentUser} on the\n * {@link Auth} instance.\n *\n * @remarks\n * A new instance copy of the user provided will be made and set as currentUser.\n *\n * This will trigger {@link onAuthStateChanged} and {@link onIdTokenChanged} listeners\n * like other sign in methods.\n *\n * The operation fails with an error if the user to be updated belongs to a different Firebase\n * project.\n *\n * This method is not supported by {@link Auth} instances created with a\n * {@link @firebase/app#FirebaseServerApp}.\n *\n * @param auth - The {@link Auth} instance.\n * @param user - The new {@link User}.\n *\n * @public\n */\nexport function updateCurrentUser(\n auth: Auth,\n user: User | null\n): Promise<void> {\n return getModularInstance(auth).updateCurrentUser(user);\n}\n/**\n * Signs out the current user.\n *\n * @remarks\n * This method is not supported by {@link Auth} instances created with a\n * {@link @firebase/app#FirebaseServerApp}.\n *\n * @param auth - The {@link Auth} instance.\n *\n * @public\n */\nexport function signOut(auth: Auth): Promise<void> {\n return getModularInstance(auth).signOut();\n}\n\n/**\n * Revokes the given access token. Currently only supports Apple OAuth access tokens.\n *\n * @param auth - The {@link Auth} instance.\n * @param token - The Apple OAuth access token.\n *\n * @public\n */\nexport function revokeAccessToken(auth: Auth, token: string): Promise<void> {\n const authInternal = _castAuth(auth);\n return authInternal.revokeAccessToken(token);\n}\n\nexport { initializeAuth } from './auth/initialize';\nexport { connectAuthEmulator } from './auth/emulator';\n\n// credentials\nexport { AuthCredential } from './credentials';\nexport { EmailAuthCredential } from './credentials/email';\nexport { OAuthCredential } from './credentials/oauth';\nexport { PhoneAuthCredential } from './credentials/phone';\n\n// persistence\nexport { inMemoryPersistence } from './persistence/in_memory';\n\n// providers\nexport { EmailAuthProvider } from './providers/email';\nexport { FacebookAuthProvider } from './providers/facebook';\nexport { CustomParameters } from './providers/federated';\nexport { GoogleAuthProvider } from './providers/google';\nexport { GithubAuthProvider } from './providers/github';\nexport { OAuthProvider, OAuthCredentialOptions } from './providers/oauth';\nexport { SAMLAuthProvider } from './providers/saml';\nexport { TwitterAuthProvider } from './providers/twitter';\n\n// strategies\nexport { signInAnonymously } from './strategies/anonymous';\nexport {\n signInWithCredential,\n linkWithCredential,\n reauthenticateWithCredential\n} from './strategies/credential';\nexport { signInWithCustomToken } from './strategies/custom_token';\nexport {\n sendPasswordResetEmail,\n confirmPasswordReset,\n applyActionCode,\n checkActionCode,\n verifyPasswordResetCode,\n createUserWithEmailAndPassword,\n signInWithEmailAndPassword\n} from './strategies/email_and_password';\nexport {\n sendSignInLinkToEmail,\n isSignInWithEmailLink,\n signInWithEmailLink\n} from './strategies/email_link';\nexport {\n fetchSignInMethodsForEmail,\n sendEmailVerification,\n verifyBeforeUpdateEmail\n} from './strategies/email';\n\n// core\nexport { ActionCodeURL, parseActionCodeURL } from './action_code_url';\n\n// user\nexport {\n updateProfile,\n updateEmail,\n updatePassword\n} from './user/account_info';\nexport { getIdToken, getIdTokenResult } from './user/id_token_result';\nexport { unlink } from './user/link_unlink';\nexport { getAdditionalUserInfo } from './user/additional_user_info';\n\n// Non-optional user methods.\nexport { reload } from './user/reload';\n/**\n * Deletes and signs out the user.\n *\n * @remarks\n * Important: this is a security-sensitive operation that requires the user to have recently\n * signed in. If this requirement isn't met, ask the user to authenticate again and then call\n * {@link reauthenticateWithCredential}.\n *\n * @param user - The user.\n *\n * @public\n */\nexport async function deleteUser(user: User): Promise<void> {\n return getModularInstance(user).delete();\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { UserInternal } from '../model/user';\nimport { MultiFactorSession } from '../model/public_types';\n\nexport const enum MultiFactorSessionType {\n ENROLL = 'enroll',\n SIGN_IN = 'signin'\n}\n\ninterface SerializedMultiFactorSession {\n multiFactorSession: {\n idToken?: string;\n pendingCredential?: string;\n };\n}\n\nexport class MultiFactorSessionImpl implements MultiFactorSession {\n private constructor(\n readonly type: MultiFactorSessionType,\n readonly credential: string,\n readonly user?: UserInternal\n ) {}\n\n static _fromIdtoken(\n idToken: string,\n user?: UserInternal\n ): MultiFactorSessionImpl {\n return new MultiFactorSessionImpl(\n MultiFactorSessionType.ENROLL,\n idToken,\n user\n );\n }\n\n static _fromMfaPendingCredential(\n mfaPendingCredential: string\n ): MultiFactorSessionImpl {\n return new MultiFactorSessionImpl(\n MultiFactorSessionType.SIGN_IN,\n mfaPendingCredential\n );\n }\n\n toJSON(): SerializedMultiFactorSession {\n const key =\n this.type === MultiFactorSessionType.ENROLL\n ? 'idToken'\n : 'pendingCredential';\n return {\n multiFactorSession: {\n [key]: this.credential\n }\n };\n }\n\n static fromJSON(\n obj: Partial<SerializedMultiFactorSession>\n ): MultiFactorSessionImpl | null {\n if (obj?.multiFactorSession) {\n if (obj.multiFactorSession?.pendingCredential) {\n return MultiFactorSessionImpl._fromMfaPendingCredential(\n obj.multiFactorSession.pendingCredential\n );\n } else if (obj.multiFactorSession?.idToken) {\n return MultiFactorSessionImpl._fromIdtoken(\n obj.multiFactorSession.idToken\n );\n }\n }\n return null;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Auth,\n MultiFactorResolver,\n UserCredential,\n MultiFactorError\n} from '../model/public_types';\n\nimport { _castAuth } from '../core/auth/auth_impl';\nimport { AuthErrorCode } from '../core/errors';\nimport { UserCredentialImpl } from '../core/user/user_credential_impl';\nimport { _assert, _fail } from '../core/util/assert';\nimport { UserCredentialInternal } from '../model/user';\nimport { MultiFactorAssertionImpl } from './mfa_assertion';\nimport { MultiFactorError as MultiFactorErrorInternal } from './mfa_error';\nimport { MultiFactorInfoImpl } from './mfa_info';\nimport { MultiFactorSessionImpl } from './mfa_session';\nimport { getModularInstance } from '@firebase/util';\nimport { OperationType } from '../model/enums';\n\nexport class MultiFactorResolverImpl implements MultiFactorResolver {\n private constructor(\n readonly session: MultiFactorSessionImpl,\n readonly hints: MultiFactorInfoImpl[],\n private readonly signInResolver: (\n assertion: MultiFactorAssertionImpl\n ) => Promise<UserCredentialInternal>\n ) {}\n\n /** @internal */\n static _fromError(\n authExtern: Auth,\n error: MultiFactorErrorInternal\n ): MultiFactorResolverImpl {\n const auth = _castAuth(authExtern);\n const serverResponse = error.customData._serverResponse;\n const hints = (serverResponse.mfaInfo || []).map(enrollment =>\n MultiFactorInfoImpl._fromServerResponse(auth, enrollment)\n );\n\n _assert(\n serverResponse.mfaPendingCredential,\n auth,\n AuthErrorCode.INTERNAL_ERROR\n );\n const session = MultiFactorSessionImpl._fromMfaPendingCredential(\n serverResponse.mfaPendingCredential\n );\n\n return new MultiFactorResolverImpl(\n session,\n hints,\n async (\n assertion: MultiFactorAssertionImpl\n ): Promise<UserCredentialInternal> => {\n const mfaResponse = await assertion._process(auth, session);\n // Clear out the unneeded fields from the old login response\n delete serverResponse.mfaInfo;\n delete serverResponse.mfaPendingCredential;\n\n // Use in the new token & refresh token in the old response\n const idTokenResponse = {\n ...serverResponse,\n idToken: mfaResponse.idToken,\n refreshToken: mfaResponse.refreshToken\n };\n\n // TODO: we should collapse this switch statement into UserCredentialImpl._forOperation and have it support the SIGN_IN case\n switch (error.operationType) {\n case OperationType.SIGN_IN:\n const userCredential =\n await UserCredentialImpl._fromIdTokenResponse(\n auth,\n error.operationType,\n idTokenResponse\n );\n await auth._updateCurrentUser(userCredential.user);\n return userCredential;\n case OperationType.REAUTHENTICATE:\n _assert(error.user, auth, AuthErrorCode.INTERNAL_ERROR);\n return UserCredentialImpl._forOperation(\n error.user,\n error.operationType,\n idTokenResponse\n );\n default:\n _fail(auth, AuthErrorCode.INTERNAL_ERROR);\n }\n }\n );\n }\n\n async resolveSignIn(\n assertionExtern: MultiFactorAssertionImpl\n ): Promise<UserCredential> {\n const assertion = assertionExtern as MultiFactorAssertionImpl;\n return this.signInResolver(assertion);\n }\n}\n\n/**\n * Provides a {@link MultiFactorResolver} suitable for completion of a\n * multi-factor flow.\n *\n * @param auth - The {@link Auth} instance.\n * @param error - The {@link MultiFactorError} raised during a sign-in, or\n * reauthentication operation.\n *\n * @public\n */\nexport function getMultiFactorResolver(\n auth: Auth,\n error: MultiFactorError\n): MultiFactorResolver {\n const authModular = getModularInstance(auth);\n const errorInternal = error as MultiFactorErrorInternal;\n _assert(\n error.customData.operationType,\n authModular,\n AuthErrorCode.ARGUMENT_ERROR\n );\n _assert(\n errorInternal.customData._serverResponse?.mfaPendingCredential,\n authModular,\n AuthErrorCode.ARGUMENT_ERROR\n );\n\n return MultiFactorResolverImpl._fromError(authModular, errorInternal);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Endpoint,\n HttpMethod,\n RecaptchaClientType,\n RecaptchaVersion,\n _addTidIfNecessary,\n _performApiRequest\n} from '../index';\nimport { SignInWithPhoneNumberRequest } from '../authentication/sms';\nimport { FinalizeMfaResponse } from '../authentication/mfa';\nimport { AuthInternal } from '../../model/auth';\n\n/**\n * MFA Info as returned by the API.\n */\ninterface BaseMfaEnrollment {\n mfaEnrollmentId: string;\n enrolledAt: number;\n displayName?: string;\n}\n\n/**\n * An MFA provided by SMS verification.\n */\nexport interface PhoneMfaEnrollment extends BaseMfaEnrollment {\n phoneInfo: string;\n}\n\n/**\n * An MFA provided by TOTP (Time-based One Time Password).\n */\nexport interface TotpMfaEnrollment extends BaseMfaEnrollment {}\n\n/**\n * MfaEnrollment can be any subtype of BaseMfaEnrollment, currently only PhoneMfaEnrollment and TotpMfaEnrollment are supported.\n */\nexport type MfaEnrollment = PhoneMfaEnrollment | TotpMfaEnrollment;\n\nexport interface StartPhoneMfaEnrollmentRequest {\n idToken: string;\n phoneEnrollmentInfo: {\n phoneNumber: string;\n // reCAPTCHA v2 token\n recaptchaToken?: string;\n // reCAPTCHA Enterprise token\n captchaResponse?: string;\n clientType?: RecaptchaClientType;\n recaptchaVersion?: RecaptchaVersion;\n };\n tenantId?: string;\n}\n\nexport interface StartPhoneMfaEnrollmentResponse {\n phoneSessionInfo: {\n sessionInfo: string;\n };\n}\n\nexport function startEnrollPhoneMfa(\n auth: AuthInternal,\n request: StartPhoneMfaEnrollmentRequest\n): Promise<StartPhoneMfaEnrollmentResponse> {\n return _performApiRequest<\n StartPhoneMfaEnrollmentRequest,\n StartPhoneMfaEnrollmentResponse\n >(\n auth,\n HttpMethod.POST,\n Endpoint.START_MFA_ENROLLMENT,\n _addTidIfNecessary(auth, request)\n );\n}\n\nexport interface FinalizePhoneMfaEnrollmentRequest {\n idToken: string;\n phoneVerificationInfo: SignInWithPhoneNumberRequest;\n displayName?: string | null;\n tenantId?: string;\n}\n\nexport interface FinalizePhoneMfaEnrollmentResponse\n extends FinalizeMfaResponse {}\n\nexport function finalizeEnrollPhoneMfa(\n auth: AuthInternal,\n request: FinalizePhoneMfaEnrollmentRequest\n): Promise<FinalizePhoneMfaEnrollmentResponse> {\n return _performApiRequest<\n FinalizePhoneMfaEnrollmentRequest,\n FinalizePhoneMfaEnrollmentResponse\n >(\n auth,\n HttpMethod.POST,\n Endpoint.FINALIZE_MFA_ENROLLMENT,\n _addTidIfNecessary(auth, request)\n );\n}\nexport interface StartTotpMfaEnrollmentRequest {\n idToken: string;\n totpEnrollmentInfo: {};\n tenantId?: string;\n}\n\nexport interface StartTotpMfaEnrollmentResponse {\n totpSessionInfo: {\n sharedSecretKey: string;\n verificationCodeLength: number;\n hashingAlgorithm: string;\n periodSec: number;\n sessionInfo: string;\n finalizeEnrollmentTime: number;\n };\n}\n\nexport function startEnrollTotpMfa(\n auth: AuthInternal,\n request: StartTotpMfaEnrollmentRequest\n): Promise<StartTotpMfaEnrollmentResponse> {\n return _performApiRequest<\n StartTotpMfaEnrollmentRequest,\n StartTotpMfaEnrollmentResponse\n >(\n auth,\n HttpMethod.POST,\n Endpoint.START_MFA_ENROLLMENT,\n _addTidIfNecessary(auth, request)\n );\n}\n\nexport interface TotpVerificationInfo {\n sessionInfo: string;\n verificationCode: string;\n}\nexport interface FinalizeTotpMfaEnrollmentRequest {\n idToken: string;\n totpVerificationInfo: TotpVerificationInfo;\n displayName?: string | null;\n tenantId?: string;\n}\n\nexport interface FinalizeTotpMfaEnrollmentResponse\n extends FinalizeMfaResponse {}\n\nexport function finalizeEnrollTotpMfa(\n auth: AuthInternal,\n request: FinalizeTotpMfaEnrollmentRequest\n): Promise<FinalizeTotpMfaEnrollmentResponse> {\n return _performApiRequest<\n FinalizeTotpMfaEnrollmentRequest,\n FinalizeTotpMfaEnrollmentResponse\n >(\n auth,\n HttpMethod.POST,\n Endpoint.FINALIZE_MFA_ENROLLMENT,\n _addTidIfNecessary(auth, request)\n );\n}\n\nexport interface WithdrawMfaRequest {\n idToken: string;\n mfaEnrollmentId: string;\n tenantId?: string;\n}\n\nexport interface WithdrawMfaResponse extends FinalizeMfaResponse {}\n\nexport function withdrawMfa(\n auth: AuthInternal,\n request: WithdrawMfaRequest\n): Promise<WithdrawMfaResponse> {\n return _performApiRequest<WithdrawMfaRequest, WithdrawMfaResponse>(\n auth,\n HttpMethod.POST,\n Endpoint.WITHDRAW_MFA,\n _addTidIfNecessary(auth, request)\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n MultiFactorAssertion,\n MultiFactorInfo,\n MultiFactorSession,\n MultiFactorUser,\n User\n} from '../model/public_types';\n\nimport { withdrawMfa } from '../api/account_management/mfa';\nimport { _logoutIfInvalidated } from '../core/user/invalidation';\nimport { UserInternal } from '../model/user';\nimport { MultiFactorAssertionImpl } from './mfa_assertion';\nimport { MultiFactorInfoImpl } from './mfa_info';\nimport { MultiFactorSessionImpl } from './mfa_session';\nimport { getModularInstance } from '@firebase/util';\n\nexport class MultiFactorUserImpl implements MultiFactorUser {\n enrolledFactors: MultiFactorInfo[] = [];\n\n private constructor(readonly user: UserInternal) {\n user._onReload(userInfo => {\n if (userInfo.mfaInfo) {\n this.enrolledFactors = userInfo.mfaInfo.map(enrollment =>\n MultiFactorInfoImpl._fromServerResponse(user.auth, enrollment)\n );\n }\n });\n }\n\n static _fromUser(user: UserInternal): MultiFactorUserImpl {\n return new MultiFactorUserImpl(user);\n }\n\n async getSession(): Promise<MultiFactorSession> {\n return MultiFactorSessionImpl._fromIdtoken(\n await this.user.getIdToken(),\n this.user\n );\n }\n\n async enroll(\n assertionExtern: MultiFactorAssertion,\n displayName?: string | null\n ): Promise<void> {\n const assertion = assertionExtern as MultiFactorAssertionImpl;\n const session = (await this.getSession()) as MultiFactorSessionImpl;\n const finalizeMfaResponse = await _logoutIfInvalidated(\n this.user,\n assertion._process(this.user.auth, session, displayName)\n );\n // New tokens will be issued after enrollment of the new second factors.\n // They need to be updated on the user.\n await this.user._updateTokensIfNecessary(finalizeMfaResponse);\n // The user needs to be reloaded to get the new multi-factor information\n // from server. USER_RELOADED event will be triggered and `enrolledFactors`\n // will be updated.\n return this.user.reload();\n }\n\n async unenroll(infoOrUid: MultiFactorInfo | string): Promise<void> {\n const mfaEnrollmentId =\n typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid;\n const idToken = await this.user.getIdToken();\n try {\n const idTokenResponse = await _logoutIfInvalidated(\n this.user,\n withdrawMfa(this.user.auth, {\n idToken,\n mfaEnrollmentId\n })\n );\n // Remove the second factor from the user's list.\n this.enrolledFactors = this.enrolledFactors.filter(\n ({ uid }) => uid !== mfaEnrollmentId\n );\n // Depending on whether the backend decided to revoke the user's session,\n // the tokenResponse may be empty. If the tokens were not updated (and they\n // are now invalid), reloading the user will discover this and invalidate\n // the user's state accordingly.\n await this.user._updateTokensIfNecessary(idTokenResponse);\n await this.user.reload();\n } catch (e) {\n throw e;\n }\n }\n}\n\nconst multiFactorUserCache = new WeakMap<User, MultiFactorUser>();\n\n/**\n * The {@link MultiFactorUser} corresponding to the user.\n *\n * @remarks\n * This is used to access all multi-factor properties and operations related to the user.\n *\n * @param user - The user.\n *\n * @public\n */\nexport function multiFactor(user: User): MultiFactorUser {\n const userModular = getModularInstance(user);\n if (!multiFactorUserCache.has(userModular)) {\n multiFactorUserCache.set(\n userModular,\n MultiFactorUserImpl._fromUser(userModular as UserInternal)\n );\n }\n return multiFactorUserCache.get(userModular)!;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Persistence } from '../../model/public_types';\n\nexport const enum PersistenceType {\n SESSION = 'SESSION',\n LOCAL = 'LOCAL',\n NONE = 'NONE',\n COOKIE = 'COOKIE'\n}\n\nexport type PersistedBlob = Record<string, unknown>;\n\nexport interface Instantiator<T> {\n (blob: PersistedBlob): T;\n}\n\nexport type PersistenceValue = PersistedBlob | string;\n\nexport const STORAGE_AVAILABLE_KEY = '__sak';\n\nexport interface StorageEventListener {\n (value: PersistenceValue | null): void;\n}\n\nexport interface PersistenceInternal extends Persistence {\n type: PersistenceType;\n _isAvailable(): Promise<boolean>;\n _set(key: string, value: PersistenceValue): Promise<void>;\n _get<T extends PersistenceValue>(key: string): Promise<T | null>;\n _remove(key: string): Promise<void>;\n _addListener(key: string, listener: StorageEventListener): void;\n _removeListener(key: string, listener: StorageEventListener): void;\n // Should this persistence allow migration up the chosen hierarchy?\n _shouldAllowMigration?: boolean;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** TODO: remove this once tslib has a polyfill for Promise.allSettled */\ninterface PromiseFulfilledResult<T> {\n fulfilled: true;\n value: T;\n}\n\ninterface PromiseRejectedResult {\n fulfilled: false;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n reason: any;\n}\n\nexport type PromiseSettledResult<T> =\n | PromiseFulfilledResult<T>\n | PromiseRejectedResult;\n\n/**\n * Shim for Promise.allSettled, note the slightly different format of `fulfilled` vs `status`.\n *\n * @param promises - Array of promises to wait on.\n */\nexport function _allSettled<T>(\n promises: Array<Promise<T>>\n): Promise<Array<PromiseSettledResult<T>>> {\n return Promise.all(\n promises.map(async promise => {\n try {\n const value = await promise;\n return {\n fulfilled: true,\n value\n } as PromiseFulfilledResult<T>;\n } catch (reason) {\n return {\n fulfilled: false,\n reason\n } as PromiseRejectedResult;\n }\n })\n );\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ReceiverHandler,\n _EventType,\n _ReceiverResponse,\n SenderMessageEvent,\n _Status,\n _SenderRequest\n} from './index';\nimport { _allSettled } from './promise';\n\n/**\n * Interface class for receiving messages.\n *\n */\nexport class Receiver {\n private static readonly receivers: Receiver[] = [];\n private readonly boundEventHandler: EventListener;\n\n private readonly handlersMap: {\n // TypeScript doesn't have existential types :(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [eventType: string]: Set<ReceiverHandler<any, any>>;\n } = {};\n\n constructor(private readonly eventTarget: EventTarget) {\n this.boundEventHandler = this.handleEvent.bind(this);\n }\n\n /**\n * Obtain an instance of a Receiver for a given event target, if none exists it will be created.\n *\n * @param eventTarget - An event target (such as window or self) through which the underlying\n * messages will be received.\n */\n static _getInstance(eventTarget: EventTarget): Receiver {\n // The results are stored in an array since objects can't be keys for other\n // objects. In addition, setting a unique property on an event target as a\n // hash map key may not be allowed due to CORS restrictions.\n const existingInstance = this.receivers.find(receiver =>\n receiver.isListeningto(eventTarget)\n );\n if (existingInstance) {\n return existingInstance;\n }\n const newInstance = new Receiver(eventTarget);\n this.receivers.push(newInstance);\n return newInstance;\n }\n\n private isListeningto(eventTarget: EventTarget): boolean {\n return this.eventTarget === eventTarget;\n }\n\n /**\n * Fans out a MessageEvent to the appropriate listeners.\n *\n * @remarks\n * Sends an {@link Status.ACK} upon receipt and a {@link Status.DONE} once all handlers have\n * finished processing.\n *\n * @param event - The MessageEvent.\n *\n */\n private async handleEvent<\n T extends _ReceiverResponse,\n S extends _SenderRequest\n >(event: Event): Promise<void> {\n const messageEvent = event as MessageEvent<SenderMessageEvent<S>>;\n const { eventId, eventType, data } = messageEvent.data;\n\n const handlers: Set<ReceiverHandler<T, S>> | undefined =\n this.handlersMap[eventType];\n if (!handlers?.size) {\n return;\n }\n\n messageEvent.ports[0].postMessage({\n status: _Status.ACK,\n eventId,\n eventType\n });\n\n const promises = Array.from(handlers).map(async handler =>\n handler(messageEvent.origin, data)\n );\n const response = await _allSettled(promises);\n messageEvent.ports[0].postMessage({\n status: _Status.DONE,\n eventId,\n eventType,\n response\n });\n }\n\n /**\n * Subscribe an event handler for a particular event.\n *\n * @param eventType - Event name to subscribe to.\n * @param eventHandler - The event handler which should receive the events.\n *\n */\n _subscribe<T extends _ReceiverResponse, S extends _SenderRequest>(\n eventType: _EventType,\n eventHandler: ReceiverHandler<T, S>\n ): void {\n if (Object.keys(this.handlersMap).length === 0) {\n this.eventTarget.addEventListener('message', this.boundEventHandler);\n }\n\n if (!this.handlersMap[eventType]) {\n this.handlersMap[eventType] = new Set();\n }\n\n this.handlersMap[eventType].add(eventHandler);\n }\n\n /**\n * Unsubscribe an event handler from a particular event.\n *\n * @param eventType - Event name to unsubscribe from.\n * @param eventHandler - Optional event handler, if none provided, unsubscribe all handlers on this event.\n *\n */\n _unsubscribe<T extends _ReceiverResponse, S extends _SenderRequest>(\n eventType: _EventType,\n eventHandler?: ReceiverHandler<T, S>\n ): void {\n if (this.handlersMap[eventType] && eventHandler) {\n this.handlersMap[eventType].delete(eventHandler);\n }\n if (!eventHandler || this.handlersMap[eventType].size === 0) {\n delete this.handlersMap[eventType];\n }\n\n if (Object.keys(this.handlersMap).length === 0) {\n this.eventTarget.removeEventListener('message', this.boundEventHandler);\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function _generateEventId(prefix = '', digits = 10): string {\n let random = '';\n for (let i = 0; i < digits; i++) {\n random += Math.floor(Math.random() * 10);\n }\n return prefix + random;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _generateEventId } from '../../core/util/event_id';\nimport {\n _SenderRequest,\n _EventType,\n ReceiverMessageEvent,\n _MessageError,\n SenderMessageEvent,\n _Status,\n _ReceiverMessageResponse,\n _ReceiverResponse,\n _TimeoutDuration\n} from './index';\n\ninterface MessageHandler {\n messageChannel: MessageChannel;\n onMessage: EventListenerOrEventListenerObject;\n}\n\n/**\n * Interface for sending messages and waiting for a completion response.\n *\n */\nexport class Sender {\n private readonly handlers = new Set<MessageHandler>();\n\n constructor(private readonly target: ServiceWorker) {}\n\n /**\n * Unsubscribe the handler and remove it from our tracking Set.\n *\n * @param handler - The handler to unsubscribe.\n */\n private removeMessageHandler(handler: MessageHandler): void {\n if (handler.messageChannel) {\n handler.messageChannel.port1.removeEventListener(\n 'message',\n handler.onMessage\n );\n handler.messageChannel.port1.close();\n }\n this.handlers.delete(handler);\n }\n\n /**\n * Send a message to the Receiver located at {@link target}.\n *\n * @remarks\n * We'll first wait a bit for an ACK , if we get one we will wait significantly longer until the\n * receiver has had a chance to fully process the event.\n *\n * @param eventType - Type of event to send.\n * @param data - The payload of the event.\n * @param timeout - Timeout for waiting on an ACK from the receiver.\n *\n * @returns An array of settled promises from all the handlers that were listening on the receiver.\n */\n async _send<T extends _ReceiverResponse, S extends _SenderRequest>(\n eventType: _EventType,\n data: S,\n timeout = _TimeoutDuration.ACK\n ): Promise<_ReceiverMessageResponse<T>> {\n const messageChannel =\n typeof MessageChannel !== 'undefined' ? new MessageChannel() : null;\n if (!messageChannel) {\n throw new Error(_MessageError.CONNECTION_UNAVAILABLE);\n }\n // Node timers and browser timers return fundamentally different types.\n // We don't actually care what the value is but TS won't accept unknown and\n // we can't cast properly in both environments.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let completionTimer: any;\n let handler: MessageHandler;\n return new Promise<_ReceiverMessageResponse<T>>((resolve, reject) => {\n const eventId = _generateEventId('', 20);\n messageChannel.port1.start();\n const ackTimer = setTimeout(() => {\n reject(new Error(_MessageError.UNSUPPORTED_EVENT));\n }, timeout);\n handler = {\n messageChannel,\n onMessage(event: Event): void {\n const messageEvent = event as MessageEvent<ReceiverMessageEvent<T>>;\n if (messageEvent.data.eventId !== eventId) {\n return;\n }\n switch (messageEvent.data.status) {\n case _Status.ACK:\n // The receiver should ACK first.\n clearTimeout(ackTimer);\n completionTimer = setTimeout(() => {\n reject(new Error(_MessageError.TIMEOUT));\n }, _TimeoutDuration.COMPLETION);\n break;\n case _Status.DONE:\n // Once the receiver's handlers are finished we will get the results.\n clearTimeout(completionTimer);\n resolve(messageEvent.data.response);\n break;\n default:\n clearTimeout(ackTimer);\n clearTimeout(completionTimer);\n reject(new Error(_MessageError.INVALID_RESPONSE));\n break;\n }\n }\n };\n this.handlers.add(handler);\n messageChannel.port1.addEventListener('message', handler.onMessage);\n this.target.postMessage(\n {\n eventType,\n eventId,\n data\n } as SenderMessageEvent<S>,\n [messageChannel.port2]\n );\n }).finally(() => {\n if (handler) {\n this.removeMessageHandler(handler);\n }\n });\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Recaptcha, GreCAPTCHATopLevel } from './recaptcha/recaptcha';\n\n/**\n * A specialized window type that melds the normal window type plus the\n * various bits we need. The three different blocks that are &'d together\n * cant be defined in the same block together.\n */\nexport type AuthWindow = {\n // Standard window types\n [T in keyof Window]: Window[T];\n} & {\n // Any known / named properties we want to add\n grecaptcha?: Recaptcha | GreCAPTCHATopLevel;\n /* eslint-disable-next-line @typescript-eslint/no-explicit-any */\n ___jsl?: Record<string, any>;\n gapi?: typeof gapi;\n} & {\n // A final catch-all for callbacks (which will have random names) that\n // we will stick on the window.\n [callback: string]: (...args: unknown[]) => void;\n};\n\n/**\n * Lazy accessor for window, since the compat layer won't tree shake this out,\n * we need to make sure not to mess with window unless we have to\n */\nexport function _window(): AuthWindow {\n return window as unknown as AuthWindow;\n}\n\nexport function _setWindowLocation(url: string): void {\n _window().location.href = url;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _window } from '../auth_window';\n\nexport function _isWorker(): boolean {\n return (\n typeof _window()['WorkerGlobalScope'] !== 'undefined' &&\n typeof _window()['importScripts'] === 'function'\n );\n}\n\nexport async function _getActiveServiceWorker(): Promise<ServiceWorker | null> {\n if (!navigator?.serviceWorker) {\n return null;\n }\n try {\n const registration = await navigator.serviceWorker.ready;\n return registration.active;\n } catch {\n return null;\n }\n}\n\nexport function _getServiceWorkerController(): ServiceWorker | null {\n return navigator?.serviceWorker?.controller || null;\n}\n\nexport function _getWorkerGlobalScope(): ServiceWorker | null {\n return _isWorker() ? (self as unknown as ServiceWorker) : null;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Persistence } from '../../model/public_types';\nimport {\n PersistedBlob,\n PersistenceInternal as InternalPersistence,\n PersistenceType,\n PersistenceValue,\n StorageEventListener,\n STORAGE_AVAILABLE_KEY\n} from '../../core/persistence/';\nimport {\n _EventType,\n _PingResponse,\n KeyChangedResponse,\n KeyChangedRequest,\n PingRequest,\n _TimeoutDuration\n} from '../messagechannel/index';\nimport { Receiver } from '../messagechannel/receiver';\nimport { Sender } from '../messagechannel/sender';\nimport {\n _isWorker,\n _getActiveServiceWorker,\n _getServiceWorkerController,\n _getWorkerGlobalScope\n} from '../util/worker';\n\nexport const DB_NAME = 'firebaseLocalStorageDb';\nconst DB_VERSION = 1;\nconst DB_OBJECTSTORE_NAME = 'firebaseLocalStorage';\nconst DB_DATA_KEYPATH = 'fbase_key';\n\ninterface DBObject {\n [DB_DATA_KEYPATH]: string;\n value: PersistedBlob;\n}\n\n/**\n * Promise wrapper for IDBRequest\n *\n * Unfortunately we can't cleanly extend Promise<T> since promises are not callable in ES6\n *\n */\nclass DBPromise<T> {\n constructor(private readonly request: IDBRequest) {}\n\n toPromise(): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n this.request.addEventListener('success', () => {\n resolve(this.request.result);\n });\n this.request.addEventListener('error', () => {\n reject(this.request.error);\n });\n });\n }\n}\n\nfunction getObjectStore(db: IDBDatabase, isReadWrite: boolean): IDBObjectStore {\n return db\n .transaction([DB_OBJECTSTORE_NAME], isReadWrite ? 'readwrite' : 'readonly')\n .objectStore(DB_OBJECTSTORE_NAME);\n}\n\nexport async function _clearDatabase(db: IDBDatabase): Promise<void> {\n const objectStore = getObjectStore(db, true);\n return new DBPromise<void>(objectStore.clear()).toPromise();\n}\n\nexport function _deleteDatabase(): Promise<void> {\n const request = indexedDB.deleteDatabase(DB_NAME);\n return new DBPromise<void>(request).toPromise();\n}\n\nexport function _openDatabase(): Promise<IDBDatabase> {\n const request = indexedDB.open(DB_NAME, DB_VERSION);\n return new Promise((resolve, reject) => {\n request.addEventListener('error', () => {\n reject(request.error);\n });\n\n request.addEventListener('upgradeneeded', () => {\n const db = request.result;\n\n try {\n db.createObjectStore(DB_OBJECTSTORE_NAME, { keyPath: DB_DATA_KEYPATH });\n } catch (e) {\n reject(e);\n }\n });\n\n request.addEventListener('success', async () => {\n const db: IDBDatabase = request.result;\n // Strange bug that occurs in Firefox when multiple tabs are opened at the\n // same time. The only way to recover seems to be deleting the database\n // and re-initializing it.\n // https://github.com/firebase/firebase-js-sdk/issues/634\n\n if (!db.objectStoreNames.contains(DB_OBJECTSTORE_NAME)) {\n // Need to close the database or else you get a `blocked` event\n db.close();\n await _deleteDatabase();\n resolve(await _openDatabase());\n } else {\n resolve(db);\n }\n });\n });\n}\n\nexport async function _putObject(\n db: IDBDatabase,\n key: string,\n value: PersistenceValue | string\n): Promise<void> {\n const request = getObjectStore(db, true).put({\n [DB_DATA_KEYPATH]: key,\n value\n });\n return new DBPromise<void>(request).toPromise();\n}\n\nasync function getObject(\n db: IDBDatabase,\n key: string\n): Promise<PersistedBlob | null> {\n const request = getObjectStore(db, false).get(key);\n const data = await new DBPromise<DBObject | undefined>(request).toPromise();\n return data === undefined ? null : data.value;\n}\n\nexport function _deleteObject(db: IDBDatabase, key: string): Promise<void> {\n const request = getObjectStore(db, true).delete(key);\n return new DBPromise<void>(request).toPromise();\n}\n\nexport const _POLLING_INTERVAL_MS = 800;\nexport const _TRANSACTION_RETRY_COUNT = 3;\n\nclass IndexedDBLocalPersistence implements InternalPersistence {\n static type: 'LOCAL' = 'LOCAL';\n\n type = PersistenceType.LOCAL;\n db?: IDBDatabase;\n readonly _shouldAllowMigration = true;\n\n private readonly listeners: Record<string, Set<StorageEventListener>> = {};\n private readonly localCache: Record<string, PersistenceValue | null> = {};\n // setTimeout return value is platform specific\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private pollTimer: any | null = null;\n private pendingWrites = 0;\n\n private receiver: Receiver | null = null;\n private sender: Sender | null = null;\n private serviceWorkerReceiverAvailable = false;\n private activeServiceWorker: ServiceWorker | null = null;\n // Visible for testing only\n readonly _workerInitializationPromise: Promise<void>;\n\n constructor() {\n // Fire & forget the service worker registration as it may never resolve\n this._workerInitializationPromise =\n this.initializeServiceWorkerMessaging().then(\n () => {},\n () => {}\n );\n }\n\n async _openDb(): Promise<IDBDatabase> {\n if (this.db) {\n return this.db;\n }\n this.db = await _openDatabase();\n return this.db;\n }\n\n async _withRetries<T>(op: (db: IDBDatabase) => Promise<T>): Promise<T> {\n let numAttempts = 0;\n\n while (true) {\n try {\n const db = await this._openDb();\n return await op(db);\n } catch (e) {\n if (numAttempts++ > _TRANSACTION_RETRY_COUNT) {\n throw e;\n }\n if (this.db) {\n this.db.close();\n this.db = undefined;\n }\n // TODO: consider adding exponential backoff\n }\n }\n }\n\n /**\n * IndexedDB events do not propagate from the main window to the worker context. We rely on a\n * postMessage interface to send these events to the worker ourselves.\n */\n private async initializeServiceWorkerMessaging(): Promise<void> {\n return _isWorker() ? this.initializeReceiver() : this.initializeSender();\n }\n\n /**\n * As the worker we should listen to events from the main window.\n */\n private async initializeReceiver(): Promise<void> {\n this.receiver = Receiver._getInstance(_getWorkerGlobalScope()!);\n // Refresh from persistence if we receive a KeyChanged message.\n this.receiver._subscribe(\n _EventType.KEY_CHANGED,\n async (_origin: string, data: KeyChangedRequest) => {\n const keys = await this._poll();\n return {\n keyProcessed: keys.includes(data.key)\n };\n }\n );\n // Let the sender know that we are listening so they give us more timeout.\n this.receiver._subscribe(\n _EventType.PING,\n async (_origin: string, _data: PingRequest) => {\n return [_EventType.KEY_CHANGED];\n }\n );\n }\n\n /**\n * As the main window, we should let the worker know when keys change (set and remove).\n *\n * @remarks\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/ready | ServiceWorkerContainer.ready}\n * may not resolve.\n */\n private async initializeSender(): Promise<void> {\n // Check to see if there's an active service worker.\n this.activeServiceWorker = await _getActiveServiceWorker();\n if (!this.activeServiceWorker) {\n return;\n }\n this.sender = new Sender(this.activeServiceWorker);\n // Ping the service worker to check what events they can handle.\n const results = await this.sender._send<_PingResponse, PingRequest>(\n _EventType.PING,\n {},\n _TimeoutDuration.LONG_ACK\n );\n if (!results) {\n return;\n }\n if (\n results[0]?.fulfilled &&\n results[0]?.value.includes(_EventType.KEY_CHANGED)\n ) {\n this.serviceWorkerReceiverAvailable = true;\n }\n }\n\n /**\n * Let the worker know about a changed key, the exact key doesn't technically matter since the\n * worker will just trigger a full sync anyway.\n *\n * @remarks\n * For now, we only support one service worker per page.\n *\n * @param key - Storage key which changed.\n */\n private async notifyServiceWorker(key: string): Promise<void> {\n if (\n !this.sender ||\n !this.activeServiceWorker ||\n _getServiceWorkerController() !== this.activeServiceWorker\n ) {\n return;\n }\n try {\n await this.sender._send<KeyChangedResponse, KeyChangedRequest>(\n _EventType.KEY_CHANGED,\n { key },\n // Use long timeout if receiver has previously responded to a ping from us.\n this.serviceWorkerReceiverAvailable\n ? _TimeoutDuration.LONG_ACK\n : _TimeoutDuration.ACK\n );\n } catch {\n // This is a best effort approach. Ignore errors.\n }\n }\n\n async _isAvailable(): Promise<boolean> {\n try {\n if (!indexedDB) {\n return false;\n }\n const db = await _openDatabase();\n await _putObject(db, STORAGE_AVAILABLE_KEY, '1');\n await _deleteObject(db, STORAGE_AVAILABLE_KEY);\n return true;\n } catch {}\n return false;\n }\n\n private async _withPendingWrite(write: () => Promise<void>): Promise<void> {\n this.pendingWrites++;\n try {\n await write();\n } finally {\n this.pendingWrites--;\n }\n }\n\n async _set(key: string, value: PersistenceValue): Promise<void> {\n return this._withPendingWrite(async () => {\n await this._withRetries((db: IDBDatabase) => _putObject(db, key, value));\n this.localCache[key] = value;\n return this.notifyServiceWorker(key);\n });\n }\n\n async _get<T extends PersistenceValue>(key: string): Promise<T | null> {\n const obj = (await this._withRetries((db: IDBDatabase) =>\n getObject(db, key)\n )) as T;\n this.localCache[key] = obj;\n return obj;\n }\n\n async _remove(key: string): Promise<void> {\n return this._withPendingWrite(async () => {\n await this._withRetries((db: IDBDatabase) => _deleteObject(db, key));\n delete this.localCache[key];\n return this.notifyServiceWorker(key);\n });\n }\n\n private async _poll(): Promise<string[]> {\n // TODO: check if we need to fallback if getAll is not supported\n const result = await this._withRetries((db: IDBDatabase) => {\n const getAllRequest = getObjectStore(db, false).getAll();\n return new DBPromise<DBObject[] | null>(getAllRequest).toPromise();\n });\n\n if (!result) {\n return [];\n }\n\n // If we have pending writes in progress abort, we'll get picked up on the next poll\n if (this.pendingWrites !== 0) {\n return [];\n }\n\n const keys = [];\n const keysInResult = new Set();\n if (result.length !== 0) {\n for (const { fbase_key: key, value } of result) {\n keysInResult.add(key);\n if (JSON.stringify(this.localCache[key]) !== JSON.stringify(value)) {\n this.notifyListeners(key, value as PersistenceValue);\n keys.push(key);\n }\n }\n }\n\n for (const localKey of Object.keys(this.localCache)) {\n if (this.localCache[localKey] && !keysInResult.has(localKey)) {\n // Deleted\n this.notifyListeners(localKey, null);\n keys.push(localKey);\n }\n }\n return keys;\n }\n\n private notifyListeners(\n key: string,\n newValue: PersistenceValue | null\n ): void {\n this.localCache[key] = newValue;\n const listeners = this.listeners[key];\n if (listeners) {\n for (const listener of Array.from(listeners)) {\n listener(newValue);\n }\n }\n }\n\n private startPolling(): void {\n this.stopPolling();\n\n this.pollTimer = setInterval(\n async () => this._poll(),\n _POLLING_INTERVAL_MS\n );\n }\n\n private stopPolling(): void {\n if (this.pollTimer) {\n clearInterval(this.pollTimer);\n this.pollTimer = null;\n }\n }\n\n _addListener(key: string, listener: StorageEventListener): void {\n if (Object.keys(this.listeners).length === 0) {\n this.startPolling();\n }\n if (!this.listeners[key]) {\n this.listeners[key] = new Set();\n // Populate the cache to avoid spuriously triggering on first poll.\n void this._get(key); // This can happen in the background async and we can return immediately.\n }\n this.listeners[key].add(listener);\n }\n\n _removeListener(key: string, listener: StorageEventListener): void {\n if (this.listeners[key]) {\n this.listeners[key].delete(listener);\n\n if (this.listeners[key].size === 0) {\n delete this.listeners[key];\n }\n }\n\n if (Object.keys(this.listeners).length === 0) {\n this.stopPolling();\n }\n }\n}\n\n/**\n * An implementation of {@link Persistence} of type `LOCAL` using `indexedDB`\n * for the underlying storage.\n *\n * @public\n */\nexport const indexedDBLocalPersistence: Persistence = IndexedDBLocalPersistence;\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n _performApiRequest,\n Endpoint,\n HttpMethod,\n RecaptchaClientType,\n RecaptchaVersion,\n _addTidIfNecessary\n} from '../index';\nimport { Auth } from '../../model/public_types';\nimport { IdTokenResponse } from '../../model/id_token';\nimport { MfaEnrollment } from '../account_management/mfa';\nimport { SignInWithIdpResponse } from './idp';\nimport {\n SignInWithPhoneNumberRequest,\n SignInWithPhoneNumberResponse\n} from './sms';\n\nexport interface FinalizeMfaResponse {\n idToken: string;\n refreshToken: string;\n}\n\n/**\n * @internal\n */\nexport interface IdTokenMfaResponse extends IdTokenResponse {\n mfaPendingCredential?: string;\n mfaInfo?: MfaEnrollment[];\n}\n\nexport interface StartPhoneMfaSignInRequest {\n mfaPendingCredential: string;\n mfaEnrollmentId: string;\n phoneSignInInfo: {\n // reCAPTCHA v2 token\n recaptchaToken?: string;\n // reCAPTCHA Enterprise token\n captchaResponse?: string;\n clientType?: RecaptchaClientType;\n recaptchaVersion?: RecaptchaVersion;\n };\n tenantId?: string;\n}\n\nexport interface StartPhoneMfaSignInResponse {\n phoneResponseInfo: {\n sessionInfo: string;\n };\n}\n\nexport function startSignInPhoneMfa(\n auth: Auth,\n request: StartPhoneMfaSignInRequest\n): Promise<StartPhoneMfaSignInResponse> {\n return _performApiRequest<\n StartPhoneMfaSignInRequest,\n StartPhoneMfaSignInResponse\n >(\n auth,\n HttpMethod.POST,\n Endpoint.START_MFA_SIGN_IN,\n _addTidIfNecessary(auth, request)\n );\n}\n\nexport interface FinalizePhoneMfaSignInRequest {\n mfaPendingCredential: string;\n phoneVerificationInfo: SignInWithPhoneNumberRequest;\n tenantId?: string;\n}\n\n// TOTP MFA Sign in only has a finalize phase. Phone MFA has a start phase to initiate sending an\n// SMS and a finalize phase to complete sign in. With TOTP, the user already has the OTP in the\n// TOTP/Authenticator app.\nexport interface FinalizeTotpMfaSignInRequest {\n mfaPendingCredential: string;\n totpVerificationInfo: { verificationCode: string };\n tenantId?: string;\n mfaEnrollmentId: string;\n}\n\nexport interface FinalizePhoneMfaSignInResponse extends FinalizeMfaResponse {}\n\nexport interface FinalizeTotpMfaSignInResponse extends FinalizeMfaResponse {}\n\nexport function finalizeSignInPhoneMfa(\n auth: Auth,\n request: FinalizePhoneMfaSignInRequest\n): Promise<FinalizePhoneMfaSignInResponse> {\n return _performApiRequest<\n FinalizePhoneMfaSignInRequest,\n FinalizePhoneMfaSignInResponse\n >(\n auth,\n HttpMethod.POST,\n Endpoint.FINALIZE_MFA_SIGN_IN,\n _addTidIfNecessary(auth, request)\n );\n}\n\nexport function finalizeSignInTotpMfa(\n auth: Auth,\n request: FinalizeTotpMfaSignInRequest\n): Promise<FinalizeTotpMfaSignInResponse> {\n return _performApiRequest<\n FinalizeTotpMfaSignInRequest,\n FinalizeTotpMfaSignInResponse\n >(\n auth,\n HttpMethod.POST,\n Endpoint.FINALIZE_MFA_SIGN_IN,\n _addTidIfNecessary(auth, request)\n );\n}\n\n/**\n * @internal\n */\nexport type PhoneOrOauthTokenResponse =\n | SignInWithPhoneNumberResponse\n | SignInWithIdpResponse\n | IdTokenResponse;\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { FactorId, MultiFactorAssertion } from '../model/public_types';\nimport { debugFail } from '../core/util/assert';\nimport { MultiFactorSessionImpl, MultiFactorSessionType } from './mfa_session';\nimport { FinalizeMfaResponse } from '../api/authentication/mfa';\nimport { AuthInternal } from '../model/auth';\n\nexport abstract class MultiFactorAssertionImpl implements MultiFactorAssertion {\n protected constructor(readonly factorId: FactorId) {}\n\n _process(\n auth: AuthInternal,\n session: MultiFactorSessionImpl,\n displayName?: string | null\n ): Promise<FinalizeMfaResponse> {\n switch (session.type) {\n case MultiFactorSessionType.ENROLL:\n return this._finalizeEnroll(auth, session.credential, displayName);\n case MultiFactorSessionType.SIGN_IN:\n return this._finalizeSignIn(auth, session.credential);\n default:\n return debugFail('unexpected MultiFactorSessionType');\n }\n }\n\n abstract _finalizeEnroll(\n auth: AuthInternal,\n idToken: string,\n displayName?: string | null\n ): Promise<FinalizeMfaResponse>;\n abstract _finalizeSignIn(\n auth: AuthInternal,\n mfaPendingCredential: string\n ): Promise<FinalizeMfaResponse>;\n}\n","/**\n * @license\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n TotpMultiFactorAssertion,\n MultiFactorSession,\n FactorId\n} from '../../model/public_types';\nimport { AuthInternal } from '../../model/auth';\nimport {\n finalizeEnrollTotpMfa,\n startEnrollTotpMfa,\n StartTotpMfaEnrollmentResponse,\n TotpVerificationInfo\n} from '../../api/account_management/mfa';\nimport {\n FinalizeMfaResponse,\n finalizeSignInTotpMfa\n} from '../../api/authentication/mfa';\nimport { MultiFactorAssertionImpl } from '../../mfa/mfa_assertion';\nimport { MultiFactorSessionImpl } from '../mfa_session';\nimport { AuthErrorCode } from '../../core/errors';\nimport { _assert } from '../../core/util/assert';\n\n/**\n * Provider for generating a {@link TotpMultiFactorAssertion}.\n *\n * @public\n */\nexport class TotpMultiFactorGenerator {\n /**\n * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of\n * the TOTP (time-based one-time password) second factor.\n * This assertion is used to complete enrollment in TOTP second factor.\n *\n * @param secret A {@link TotpSecret} containing the shared secret key and other TOTP parameters.\n * @param oneTimePassword One-time password from TOTP App.\n * @returns A {@link TotpMultiFactorAssertion} which can be used with\n * {@link MultiFactorUser.enroll}.\n */\n static assertionForEnrollment(\n secret: TotpSecret,\n oneTimePassword: string\n ): TotpMultiFactorAssertion {\n return TotpMultiFactorAssertionImpl._fromSecret(secret, oneTimePassword);\n }\n\n /**\n * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of the TOTP second factor.\n * This assertion is used to complete signIn with TOTP as the second factor.\n *\n * @param enrollmentId identifies the enrolled TOTP second factor.\n * @param oneTimePassword One-time password from TOTP App.\n * @returns A {@link TotpMultiFactorAssertion} which can be used with\n * {@link MultiFactorResolver.resolveSignIn}.\n */\n static assertionForSignIn(\n enrollmentId: string,\n oneTimePassword: string\n ): TotpMultiFactorAssertion {\n return TotpMultiFactorAssertionImpl._fromEnrollmentId(\n enrollmentId,\n oneTimePassword\n );\n }\n\n /**\n * Returns a promise to {@link TotpSecret} which contains the TOTP shared secret key and other parameters.\n * Creates a TOTP secret as part of enrolling a TOTP second factor.\n * Used for generating a QR code URL or inputting into a TOTP app.\n * This method uses the auth instance corresponding to the user in the multiFactorSession.\n *\n * @param session The {@link MultiFactorSession} that the user is part of.\n * @returns A promise to {@link TotpSecret}.\n */\n static async generateSecret(\n session: MultiFactorSession\n ): Promise<TotpSecret> {\n const mfaSession = session as MultiFactorSessionImpl;\n _assert(\n typeof mfaSession.user?.auth !== 'undefined',\n AuthErrorCode.INTERNAL_ERROR\n );\n const response = await startEnrollTotpMfa(mfaSession.user.auth, {\n idToken: mfaSession.credential,\n totpEnrollmentInfo: {}\n });\n return TotpSecret._fromStartTotpMfaEnrollmentResponse(\n response,\n mfaSession.user.auth\n );\n }\n\n /**\n * The identifier of the TOTP second factor: `totp`.\n */\n static FACTOR_ID: 'totp' = FactorId.TOTP;\n}\n\nexport class TotpMultiFactorAssertionImpl\n extends MultiFactorAssertionImpl\n implements TotpMultiFactorAssertion\n{\n constructor(\n readonly otp: string,\n readonly enrollmentId?: string,\n readonly secret?: TotpSecret\n ) {\n super(FactorId.TOTP);\n }\n\n /** @internal */\n static _fromSecret(\n secret: TotpSecret,\n otp: string\n ): TotpMultiFactorAssertionImpl {\n return new TotpMultiFactorAssertionImpl(otp, undefined, secret);\n }\n\n /** @internal */\n static _fromEnrollmentId(\n enrollmentId: string,\n otp: string\n ): TotpMultiFactorAssertionImpl {\n return new TotpMultiFactorAssertionImpl(otp, enrollmentId);\n }\n\n /** @internal */\n async _finalizeEnroll(\n auth: AuthInternal,\n idToken: string,\n displayName?: string | null\n ): Promise<FinalizeMfaResponse> {\n _assert(\n typeof this.secret !== 'undefined',\n auth,\n AuthErrorCode.ARGUMENT_ERROR\n );\n return finalizeEnrollTotpMfa(auth, {\n idToken,\n displayName,\n totpVerificationInfo: this.secret._makeTotpVerificationInfo(this.otp)\n });\n }\n\n /** @internal */\n async _finalizeSignIn(\n auth: AuthInternal,\n mfaPendingCredential: string\n ): Promise<FinalizeMfaResponse> {\n _assert(\n this.enrollmentId !== undefined && this.otp !== undefined,\n auth,\n AuthErrorCode.ARGUMENT_ERROR\n );\n const totpVerificationInfo = { verificationCode: this.otp };\n return finalizeSignInTotpMfa(auth, {\n mfaPendingCredential,\n mfaEnrollmentId: this.enrollmentId,\n totpVerificationInfo\n });\n }\n}\n\n/**\n * Provider for generating a {@link TotpMultiFactorAssertion}.\n *\n * Stores the shared secret key and other parameters to generate time-based OTPs.\n * Implements methods to retrieve the shared secret key and generate a QR code URL.\n * @public\n */\nexport class TotpSecret {\n /**\n * Shared secret key/seed used for enrolling in TOTP MFA and generating OTPs.\n */\n readonly secretKey: string;\n /**\n * Hashing algorithm used.\n */\n readonly hashingAlgorithm: string;\n /**\n * Length of the one-time passwords to be generated.\n */\n readonly codeLength: number;\n /**\n * The interval (in seconds) when the OTP codes should change.\n */\n readonly codeIntervalSeconds: number;\n /**\n * The timestamp (UTC string) by which TOTP enrollment should be completed.\n */\n // This can be used by callers to show a countdown of when to enter OTP code by.\n readonly enrollmentCompletionDeadline: string;\n\n // The public members are declared outside the constructor so the docs can be generated.\n private constructor(\n secretKey: string,\n hashingAlgorithm: string,\n codeLength: number,\n codeIntervalSeconds: number,\n enrollmentCompletionDeadline: string,\n private readonly sessionInfo: string,\n private readonly auth: AuthInternal\n ) {\n this.secretKey = secretKey;\n this.hashingAlgorithm = hashingAlgorithm;\n this.codeLength = codeLength;\n this.codeIntervalSeconds = codeIntervalSeconds;\n this.enrollmentCompletionDeadline = enrollmentCompletionDeadline;\n }\n\n /** @internal */\n static _fromStartTotpMfaEnrollmentResponse(\n response: StartTotpMfaEnrollmentResponse,\n auth: AuthInternal\n ): TotpSecret {\n return new TotpSecret(\n response.totpSessionInfo.sharedSecretKey,\n response.totpSessionInfo.hashingAlgorithm,\n response.totpSessionInfo.verificationCodeLength,\n response.totpSessionInfo.periodSec,\n new Date(response.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),\n response.totpSessionInfo.sessionInfo,\n auth\n );\n }\n\n /** @internal */\n _makeTotpVerificationInfo(otp: string): TotpVerificationInfo {\n return { sessionInfo: this.sessionInfo, verificationCode: otp };\n }\n\n /**\n * Returns a QR code URL as described in\n * https://github.com/google/google-authenticator/wiki/Key-Uri-Format\n * This can be displayed to the user as a QR code to be scanned into a TOTP app like Google Authenticator.\n * If the optional parameters are unspecified, an accountName of <userEmail> and issuer of <firebaseAppName> are used.\n *\n * @param accountName the name of the account/app along with a user identifier.\n * @param issuer issuer of the TOTP (likely the app name).\n * @returns A QR code URL string.\n */\n generateQrCodeUrl(accountName?: string, issuer?: string): string {\n let useDefaults = false;\n if (_isEmptyString(accountName) || _isEmptyString(issuer)) {\n useDefaults = true;\n }\n if (useDefaults) {\n if (_isEmptyString(accountName)) {\n accountName = this.auth.currentUser?.email || 'unknownuser';\n }\n if (_isEmptyString(issuer)) {\n issuer = this.auth.name;\n }\n }\n return `otpauth://totp/${issuer}:${accountName}?secret=${this.secretKey}&issuer=${issuer}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`;\n }\n}\n\n/** @internal */\nfunction _isEmptyString(input?: string): boolean {\n return typeof input === 'undefined' || input?.length === 0;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Unsubscribe } from '@firebase/util';\nimport { FirebaseAuthInternal } from '@firebase/auth-interop-types';\n\nimport { AuthInternal } from '../../model/auth';\nimport { UserInternal } from '../../model/user';\nimport { _assert } from '../util/assert';\nimport { AuthErrorCode } from '../errors';\n\ninterface TokenListener {\n (tok: string | null): unknown;\n}\n\nexport class AuthInterop implements FirebaseAuthInternal {\n private readonly internalListeners: Map<TokenListener, Unsubscribe> =\n new Map();\n\n constructor(private readonly auth: AuthInternal) {}\n\n getUid(): string | null {\n this.assertAuthConfigured();\n return this.auth.currentUser?.uid || null;\n }\n\n async getToken(\n forceRefresh?: boolean\n ): Promise<{ accessToken: string } | null> {\n this.assertAuthConfigured();\n await this.auth._initializationPromise;\n if (!this.auth.currentUser) {\n return null;\n }\n\n const accessToken = await this.auth.currentUser.getIdToken(forceRefresh);\n return { accessToken };\n }\n\n addAuthTokenListener(listener: TokenListener): void {\n this.assertAuthConfigured();\n if (this.internalListeners.has(listener)) {\n return;\n }\n\n const unsubscribe = this.auth.onIdTokenChanged(user => {\n listener(\n (user as UserInternal | null)?.stsTokenManager.accessToken || null\n );\n });\n this.internalListeners.set(listener, unsubscribe);\n this.updateProactiveRefresh();\n }\n\n removeAuthTokenListener(listener: TokenListener): void {\n this.assertAuthConfigured();\n const unsubscribe = this.internalListeners.get(listener);\n if (!unsubscribe) {\n return;\n }\n\n this.internalListeners.delete(listener);\n unsubscribe();\n this.updateProactiveRefresh();\n }\n\n private assertAuthConfigured(): void {\n _assert(\n this.auth._initializationPromise,\n AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH\n );\n }\n\n private updateProactiveRefresh(): void {\n if (this.internalListeners.size > 0) {\n this.auth._startProactiveRefresh();\n } else {\n this.auth._stopProactiveRefresh();\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _registerComponent, registerVersion } from '@firebase/app';\nimport {\n Component,\n ComponentType,\n InstantiationMode\n} from '@firebase/component';\n\nimport { name, version } from '../../../package.json';\nimport { AuthErrorCode } from '../errors';\nimport { _assert } from '../util/assert';\nimport { _getClientVersion, ClientPlatform } from '../util/version';\nimport { _castAuth, AuthImpl, DefaultConfig } from './auth_impl';\nimport { AuthInterop } from './firebase_internal';\nimport { ConfigInternal } from '../../model/auth';\nimport { Dependencies } from '../../model/public_types';\nimport { _initializeAuthInstance } from './initialize';\n\nexport const enum _ComponentName {\n AUTH = 'auth',\n AUTH_INTERNAL = 'auth-internal'\n}\n\nfunction getVersionForPlatform(\n clientPlatform: ClientPlatform\n): string | undefined {\n switch (clientPlatform) {\n case ClientPlatform.NODE:\n return 'node';\n case ClientPlatform.REACT_NATIVE:\n return 'rn';\n case ClientPlatform.WORKER:\n return 'webworker';\n case ClientPlatform.CORDOVA:\n return 'cordova';\n case ClientPlatform.WEB_EXTENSION:\n return 'web-extension';\n default:\n return undefined;\n }\n}\n\n/** @internal */\nexport function registerAuth(clientPlatform: ClientPlatform): void {\n _registerComponent(\n new Component(\n _ComponentName.AUTH,\n (container, { options: deps }: { options?: Dependencies }) => {\n const app = container.getProvider('app').getImmediate()!;\n const heartbeatServiceProvider =\n container.getProvider<'heartbeat'>('heartbeat');\n const appCheckServiceProvider =\n container.getProvider<'app-check-internal'>('app-check-internal');\n const { apiKey, authDomain } = app.options;\n\n _assert(\n apiKey && !apiKey.includes(':'),\n AuthErrorCode.INVALID_API_KEY,\n { appName: app.name }\n );\n\n const config: ConfigInternal = {\n apiKey,\n authDomain,\n clientPlatform,\n apiHost: DefaultConfig.API_HOST,\n tokenApiHost: DefaultConfig.TOKEN_API_HOST,\n apiScheme: DefaultConfig.API_SCHEME,\n sdkClientVersion: _getClientVersion(clientPlatform)\n };\n\n const authInstance = new AuthImpl(\n app,\n heartbeatServiceProvider,\n appCheckServiceProvider,\n config\n );\n _initializeAuthInstance(authInstance, deps);\n\n return authInstance;\n },\n ComponentType.PUBLIC\n )\n /**\n * Auth can only be initialized by explicitly calling getAuth() or initializeAuth()\n * For why we do this, See go/firebase-next-auth-init\n */\n .setInstantiationMode(InstantiationMode.EXPLICIT)\n /**\n * Because all firebase products that depend on auth depend on auth-internal directly,\n * we need to initialize auth-internal after auth is initialized to make it available to other firebase products.\n */\n .setInstanceCreatedCallback(\n (container, _instanceIdentifier, _instance) => {\n const authInternalProvider = container.getProvider(\n _ComponentName.AUTH_INTERNAL\n );\n authInternalProvider.initialize();\n }\n )\n );\n\n _registerComponent(\n new Component(\n _ComponentName.AUTH_INTERNAL,\n container => {\n const auth = _castAuth(\n container.getProvider(_ComponentName.AUTH).getImmediate()!\n );\n return (auth => new AuthInterop(auth))(auth);\n },\n ComponentType.PRIVATE\n ).setInstantiationMode(InstantiationMode.EXPLICIT)\n );\n\n registerVersion(name, version, getVersionForPlatform(clientPlatform));\n // BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation\n registerVersion(name, version, '__BUILD_TARGET__');\n}\n"],"names":["jsHelpers._recaptchaEnterpriseScriptUrl","jsHelpers\n ._loadJS","applyActionCode","sendEmailVerification","sendPasswordResetEmail","sendSignInLinkToEmail","signInWithEmailLink","IDP_REQUEST_URI","signInWithCustomToken","getIdTokenResponse","authentication.sendPasswordResetEmail","account\n .resetPassword","account.applyActionCode","account.resetPassword","api.sendSignInLinkToEmail","api.sendEmailVerification","api.verifyAndChangeEmail","updateProfile","apiUpdateProfile","apiUpdateEmailPassword"],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;AAeG;AA6HH,SAAS,cAAc,GAAA;IACrB,OAAO;AACL,QAAA,CAAA,4BAAA,4CACE,sDAAsD;AACxD,QAAA,CAAA,gBAAA,sCAAgC,EAAE;AAClC,QAAA,CAAA,oBAAA,0CACE,+DAA+D;YAC/D,uEAAuE;YACvE,0DAA0D;AAC5D,QAAA,CAAA,mBAAA,yCACE,oEAAoE;YACpE,sEAAsE;YACtE,cAAc;AAChB,QAAA,CAAA,sBAAA,4CACE,oEAAoE;YACpE,wEAAwE;YACxE,yBAAyB;AAC3B,QAAA,CAAA,cAAA,oCACE,wEAAwE;YACxE,QAAQ;AACV,QAAA,CAAA,mBAAA,yCAAmC,iCAAiC;AACpE,QAAA,CAAA,kBAAA,wCAAkC,gCAAgC;AAClE,Q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,qBAAqB,CAAC,cAAc,CAAC,CAAC,CAAC;;AAEtE,IAAA,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,SAAkB,CAAC,CAAC;AACrD;;;;"}
\ No newline at end of file diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/scripts/run_node_tests.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/scripts/run_node_tests.d.ts deleted file mode 100644 index 731d2d9..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/scripts/run_node_tests.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/account_management/account.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/account_management/account.d.ts deleted file mode 100644 index f106e93..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/account_management/account.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { MfaEnrollment } from './mfa'; -import { Auth } from '../../model/public_types'; -export interface DeleteAccountRequest { - idToken: string; -} -export declare function deleteAccount(auth: Auth, request: DeleteAccountRequest): Promise<void>; -export interface ProviderUserInfo { - providerId: string; - rawId?: string; - email?: string; - displayName?: string; - photoUrl?: string; - phoneNumber?: string; -} -export interface DeleteLinkedAccountsRequest { - idToken: string; - deleteProvider: string[]; -} -export interface DeleteLinkedAccountsResponse { - providerUserInfo: ProviderUserInfo[]; -} -export declare function deleteLinkedAccounts(auth: Auth, request: DeleteLinkedAccountsRequest): Promise<DeleteLinkedAccountsResponse>; -export interface APIUserInfo { - localId?: string; - displayName?: string; - photoUrl?: string; - email?: string; - emailVerified?: boolean; - phoneNumber?: string; - lastLoginAt?: number; - createdAt?: number; - tenantId?: string; - passwordHash?: string; - providerUserInfo?: ProviderUserInfo[]; - mfaInfo?: MfaEnrollment[]; -} -export interface GetAccountInfoRequest { - idToken: string; -} -export interface GetAccountInfoResponse { - users: APIUserInfo[]; -} -export declare function getAccountInfo(auth: Auth, request: GetAccountInfoRequest): Promise<GetAccountInfoResponse>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/account_management/email_and_password.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/account_management/email_and_password.d.ts deleted file mode 100644 index 5a3bb06..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/account_management/email_and_password.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ActionCodeOperation, Auth } from '../../model/public_types'; -import { IdTokenResponse } from '../../model/id_token'; -import { MfaEnrollment } from './mfa'; -import { SignUpRequest, SignUpResponse } from '../authentication/sign_up'; -export interface ResetPasswordRequest { - oobCode: string; - newPassword?: string; - tenantId?: string; -} -export interface ResetPasswordResponse { - email: string; - newEmail?: string; - requestType?: ActionCodeOperation; - mfaInfo?: MfaEnrollment; -} -export declare function resetPassword(auth: Auth, request: ResetPasswordRequest): Promise<ResetPasswordResponse>; -export interface UpdateEmailPasswordRequest { - idToken: string; - returnSecureToken?: boolean; - email?: string; - password?: string; -} -export interface UpdateEmailPasswordResponse extends IdTokenResponse { -} -export declare function updateEmailPassword(auth: Auth, request: UpdateEmailPasswordRequest): Promise<UpdateEmailPasswordResponse>; -export declare function linkEmailPassword(auth: Auth, request: SignUpRequest): Promise<SignUpResponse>; -export interface ApplyActionCodeRequest { - oobCode: string; - tenantId?: string; -} -export interface ApplyActionCodeResponse { -} -export declare function applyActionCode(auth: Auth, request: ApplyActionCodeRequest): Promise<ApplyActionCodeResponse>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/account_management/mfa.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/account_management/mfa.d.ts deleted file mode 100644 index 8db0c0d..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/account_management/mfa.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { RecaptchaClientType, RecaptchaVersion } from '../index'; -import { SignInWithPhoneNumberRequest } from '../authentication/sms'; -import { FinalizeMfaResponse } from '../authentication/mfa'; -import { AuthInternal } from '../../model/auth'; -/** - * MFA Info as returned by the API. - */ -interface BaseMfaEnrollment { - mfaEnrollmentId: string; - enrolledAt: number; - displayName?: string; -} -/** - * An MFA provided by SMS verification. - */ -export interface PhoneMfaEnrollment extends BaseMfaEnrollment { - phoneInfo: string; -} -/** - * An MFA provided by TOTP (Time-based One Time Password). - */ -export interface TotpMfaEnrollment extends BaseMfaEnrollment { -} -/** - * MfaEnrollment can be any subtype of BaseMfaEnrollment, currently only PhoneMfaEnrollment and TotpMfaEnrollment are supported. - */ -export type MfaEnrollment = PhoneMfaEnrollment | TotpMfaEnrollment; -export interface StartPhoneMfaEnrollmentRequest { - idToken: string; - phoneEnrollmentInfo: { - phoneNumber: string; - recaptchaToken?: string; - captchaResponse?: string; - clientType?: RecaptchaClientType; - recaptchaVersion?: RecaptchaVersion; - }; - tenantId?: string; -} -export interface StartPhoneMfaEnrollmentResponse { - phoneSessionInfo: { - sessionInfo: string; - }; -} -export declare function startEnrollPhoneMfa(auth: AuthInternal, request: StartPhoneMfaEnrollmentRequest): Promise<StartPhoneMfaEnrollmentResponse>; -export interface FinalizePhoneMfaEnrollmentRequest { - idToken: string; - phoneVerificationInfo: SignInWithPhoneNumberRequest; - displayName?: string | null; - tenantId?: string; -} -export interface FinalizePhoneMfaEnrollmentResponse extends FinalizeMfaResponse { -} -export declare function finalizeEnrollPhoneMfa(auth: AuthInternal, request: FinalizePhoneMfaEnrollmentRequest): Promise<FinalizePhoneMfaEnrollmentResponse>; -export interface StartTotpMfaEnrollmentRequest { - idToken: string; - totpEnrollmentInfo: {}; - tenantId?: string; -} -export interface StartTotpMfaEnrollmentResponse { - totpSessionInfo: { - sharedSecretKey: string; - verificationCodeLength: number; - hashingAlgorithm: string; - periodSec: number; - sessionInfo: string; - finalizeEnrollmentTime: number; - }; -} -export declare function startEnrollTotpMfa(auth: AuthInternal, request: StartTotpMfaEnrollmentRequest): Promise<StartTotpMfaEnrollmentResponse>; -export interface TotpVerificationInfo { - sessionInfo: string; - verificationCode: string; -} -export interface FinalizeTotpMfaEnrollmentRequest { - idToken: string; - totpVerificationInfo: TotpVerificationInfo; - displayName?: string | null; - tenantId?: string; -} -export interface FinalizeTotpMfaEnrollmentResponse extends FinalizeMfaResponse { -} -export declare function finalizeEnrollTotpMfa(auth: AuthInternal, request: FinalizeTotpMfaEnrollmentRequest): Promise<FinalizeTotpMfaEnrollmentResponse>; -export interface WithdrawMfaRequest { - idToken: string; - mfaEnrollmentId: string; - tenantId?: string; -} -export interface WithdrawMfaResponse extends FinalizeMfaResponse { -} -export declare function withdrawMfa(auth: AuthInternal, request: WithdrawMfaRequest): Promise<WithdrawMfaResponse>; -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/account_management/profile.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/account_management/profile.d.ts deleted file mode 100644 index 9b1d591..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/account_management/profile.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { IdTokenResponse } from '../../model/id_token'; -import { Auth } from '../../model/public_types'; -export interface UpdateProfileRequest { - idToken: string; - displayName?: string | null; - photoUrl?: string | null; - returnSecureToken: boolean; -} -export interface UpdateProfileResponse extends IdTokenResponse { - displayName?: string | null; - photoUrl?: string | null; -} -export declare function updateProfile(auth: Auth, request: UpdateProfileRequest): Promise<UpdateProfileResponse>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/create_auth_uri.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/create_auth_uri.d.ts deleted file mode 100644 index 8c2db00..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/create_auth_uri.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth } from '../../model/public_types'; -export interface CreateAuthUriRequest { - identifier: string; - continueUri: string; - tenantId?: string; -} -export interface CreateAuthUriResponse { - signinMethods: string[]; -} -export declare function createAuthUri(auth: Auth, request: CreateAuthUriRequest): Promise<CreateAuthUriResponse>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/custom_token.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/custom_token.d.ts deleted file mode 100644 index ad776c7..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/custom_token.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { IdTokenResponse } from '../../model/id_token'; -import { Auth } from '../../model/public_types'; -export interface SignInWithCustomTokenRequest { - token: string; - returnSecureToken: boolean; - tenantId?: string; -} -export interface SignInWithCustomTokenResponse extends IdTokenResponse { -} -export declare function signInWithCustomToken(auth: Auth, request: SignInWithCustomTokenRequest): Promise<SignInWithCustomTokenResponse>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/email_and_password.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/email_and_password.d.ts deleted file mode 100644 index 90028bd..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/email_and_password.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ActionCodeOperation, Auth } from '../../model/public_types'; -import { RecaptchaClientType, RecaptchaVersion } from '../index'; -import { IdToken, IdTokenResponse } from '../../model/id_token'; -export interface SignInWithPasswordRequest { - returnSecureToken?: boolean; - email: string; - password: string; - tenantId?: string; - captchaResponse?: string; - clientType?: RecaptchaClientType; - recaptchaVersion?: RecaptchaVersion; -} -export interface SignInWithPasswordResponse extends IdTokenResponse { - email: string; - displayName: string; -} -export declare function signInWithPassword(auth: Auth, request: SignInWithPasswordRequest): Promise<SignInWithPasswordResponse>; -export interface GetOobCodeRequest { - email?: string; - continueUrl?: string; - iOSBundleId?: string; - iosAppStoreId?: string; - androidPackageName?: string; - androidInstallApp?: boolean; - androidMinimumVersionCode?: string; - canHandleCodeInApp?: boolean; - dynamicLinkDomain?: string; - tenantId?: string; - targetProjectid?: string; - linkDomain?: string; -} -export interface VerifyEmailRequest extends GetOobCodeRequest { - requestType: ActionCodeOperation.VERIFY_EMAIL; - idToken: IdToken; -} -export interface PasswordResetRequest extends GetOobCodeRequest { - requestType: ActionCodeOperation.PASSWORD_RESET; - email: string; - captchaResp?: string; - clientType?: RecaptchaClientType; - recaptchaVersion?: RecaptchaVersion; -} -export interface EmailSignInRequest extends GetOobCodeRequest { - requestType: ActionCodeOperation.EMAIL_SIGNIN; - email: string; - captchaResp?: string; - clientType?: RecaptchaClientType; - recaptchaVersion?: RecaptchaVersion; -} -export interface VerifyAndChangeEmailRequest extends GetOobCodeRequest { - requestType: ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL; - idToken: IdToken; - newEmail: string; -} -interface GetOobCodeResponse { - email: string; -} -export interface VerifyEmailResponse extends GetOobCodeResponse { -} -export interface PasswordResetResponse extends GetOobCodeResponse { -} -export interface EmailSignInResponse extends GetOobCodeResponse { -} -export interface VerifyAndChangeEmailResponse extends GetOobCodeRequest { -} -export declare function sendEmailVerification(auth: Auth, request: VerifyEmailRequest): Promise<VerifyEmailResponse>; -export declare function sendPasswordResetEmail(auth: Auth, request: PasswordResetRequest): Promise<PasswordResetResponse>; -export declare function sendSignInLinkToEmail(auth: Auth, request: EmailSignInRequest): Promise<EmailSignInResponse>; -export declare function verifyAndChangeEmail(auth: Auth, request: VerifyAndChangeEmailRequest): Promise<VerifyAndChangeEmailResponse>; -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/email_link.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/email_link.d.ts deleted file mode 100644 index eef24a5..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/email_link.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { IdTokenResponse } from '../../model/id_token'; -import { Auth } from '../../model/public_types'; -export interface SignInWithEmailLinkRequest { - email: string; - oobCode: string; - tenantId?: string; -} -export interface SignInWithEmailLinkResponse extends IdTokenResponse { - email: string; - isNewUser: boolean; -} -export declare function signInWithEmailLink(auth: Auth, request: SignInWithEmailLinkRequest): Promise<SignInWithEmailLinkResponse>; -export interface SignInWithEmailLinkForLinkingRequest extends SignInWithEmailLinkRequest { - idToken: string; -} -export declare function signInWithEmailLinkForLinking(auth: Auth, request: SignInWithEmailLinkForLinkingRequest): Promise<SignInWithEmailLinkResponse>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/idp.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/idp.d.ts deleted file mode 100644 index dd75832..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/idp.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { IdToken, IdTokenResponse } from '../../model/id_token'; -import { Auth } from '../../model/public_types'; -export interface SignInWithIdpRequest { - requestUri: string; - postBody?: string; - sessionId?: string; - tenantId?: string; - returnSecureToken: boolean; - returnIdpCredential?: boolean; - idToken?: IdToken; - autoCreate?: boolean; - pendingToken?: string; -} -/** - * @internal - */ -export interface SignInWithIdpResponse extends IdTokenResponse { - oauthAccessToken?: string; - oauthTokenSecret?: string; - nonce?: string; - oauthIdToken?: string; - pendingToken?: string; -} -export declare function signInWithIdp(auth: Auth, request: SignInWithIdpRequest): Promise<SignInWithIdpResponse>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/mfa.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/mfa.d.ts deleted file mode 100644 index 0d2abed..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/mfa.d.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { RecaptchaClientType, RecaptchaVersion } from '../index'; -import { Auth } from '../../model/public_types'; -import { IdTokenResponse } from '../../model/id_token'; -import { MfaEnrollment } from '../account_management/mfa'; -import { SignInWithIdpResponse } from './idp'; -import { SignInWithPhoneNumberRequest, SignInWithPhoneNumberResponse } from './sms'; -export interface FinalizeMfaResponse { - idToken: string; - refreshToken: string; -} -/** - * @internal - */ -export interface IdTokenMfaResponse extends IdTokenResponse { - mfaPendingCredential?: string; - mfaInfo?: MfaEnrollment[]; -} -export interface StartPhoneMfaSignInRequest { - mfaPendingCredential: string; - mfaEnrollmentId: string; - phoneSignInInfo: { - recaptchaToken?: string; - captchaResponse?: string; - clientType?: RecaptchaClientType; - recaptchaVersion?: RecaptchaVersion; - }; - tenantId?: string; -} -export interface StartPhoneMfaSignInResponse { - phoneResponseInfo: { - sessionInfo: string; - }; -} -export declare function startSignInPhoneMfa(auth: Auth, request: StartPhoneMfaSignInRequest): Promise<StartPhoneMfaSignInResponse>; -export interface FinalizePhoneMfaSignInRequest { - mfaPendingCredential: string; - phoneVerificationInfo: SignInWithPhoneNumberRequest; - tenantId?: string; -} -export interface FinalizeTotpMfaSignInRequest { - mfaPendingCredential: string; - totpVerificationInfo: { - verificationCode: string; - }; - tenantId?: string; - mfaEnrollmentId: string; -} -export interface FinalizePhoneMfaSignInResponse extends FinalizeMfaResponse { -} -export interface FinalizeTotpMfaSignInResponse extends FinalizeMfaResponse { -} -export declare function finalizeSignInPhoneMfa(auth: Auth, request: FinalizePhoneMfaSignInRequest): Promise<FinalizePhoneMfaSignInResponse>; -export declare function finalizeSignInTotpMfa(auth: Auth, request: FinalizeTotpMfaSignInRequest): Promise<FinalizeTotpMfaSignInResponse>; -/** - * @internal - */ -export type PhoneOrOauthTokenResponse = SignInWithPhoneNumberResponse | SignInWithIdpResponse | IdTokenResponse; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/recaptcha.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/recaptcha.d.ts deleted file mode 100644 index e324d6d..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/recaptcha.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { RecaptchaClientType, RecaptchaVersion } from '../index'; -import { Auth } from '../../model/public_types'; -export declare function getRecaptchaParams(auth: Auth): Promise<string>; -interface GetRecaptchaConfigRequest { - tenantId?: string; - clientType?: RecaptchaClientType; - version?: RecaptchaVersion; -} -export interface RecaptchaEnforcementProviderState { - provider: string; - enforcementState: string; -} -export interface GetRecaptchaConfigResponse { - recaptchaKey: string; - recaptchaEnforcementState: RecaptchaEnforcementProviderState[]; -} -export declare function getRecaptchaConfig(auth: Auth, request: GetRecaptchaConfigRequest): Promise<GetRecaptchaConfigResponse>; -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/sign_up.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/sign_up.d.ts deleted file mode 100644 index 78f0838..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/sign_up.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { RecaptchaClientType, RecaptchaVersion } from '../index'; -import { IdTokenResponse } from '../../model/id_token'; -import { Auth } from '../../model/public_types'; -export interface SignUpRequest { - idToken?: string; - returnSecureToken?: boolean; - email?: string; - password?: string; - tenantId?: string; - captchaResponse?: string; - clientType?: RecaptchaClientType; - recaptchaVersion?: RecaptchaVersion; -} -export interface SignUpResponse extends IdTokenResponse { - displayName?: string; - email?: string; -} -export declare function signUp(auth: Auth, request: SignUpRequest): Promise<SignUpResponse>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/sms.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/sms.d.ts deleted file mode 100644 index 617aa64..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/sms.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { RecaptchaClientType, RecaptchaVersion } from '../index'; -import { IdTokenResponse } from '../../model/id_token'; -import { Auth } from '../../model/public_types'; -export interface SendPhoneVerificationCodeRequest { - phoneNumber: string; - recaptchaToken?: string; - tenantId?: string; - captchaResponse?: string; - clientType?: RecaptchaClientType; - recaptchaVersion?: RecaptchaVersion; -} -export interface SendPhoneVerificationCodeResponse { - sessionInfo: string; -} -export declare function sendPhoneVerificationCode(auth: Auth, request: SendPhoneVerificationCodeRequest): Promise<SendPhoneVerificationCodeResponse>; -/** - * @internal - */ -export interface SignInWithPhoneNumberRequest { - temporaryProof?: string; - phoneNumber?: string; - sessionInfo?: string; - code?: string; - tenantId?: string; -} -export interface LinkWithPhoneNumberRequest extends SignInWithPhoneNumberRequest { - idToken: string; -} -/** - * @internal - */ -export interface SignInWithPhoneNumberResponse extends IdTokenResponse { - temporaryProof?: string; - phoneNumber?: string; -} -export declare function signInWithPhoneNumber(auth: Auth, request: SignInWithPhoneNumberRequest): Promise<SignInWithPhoneNumberResponse>; -export declare function linkWithPhoneNumber(auth: Auth, request: LinkWithPhoneNumberRequest): Promise<SignInWithPhoneNumberResponse>; -export declare function verifyPhoneNumberForExisting(auth: Auth, request: SignInWithPhoneNumberRequest): Promise<SignInWithPhoneNumberResponse>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/token.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/token.d.ts deleted file mode 100644 index 1433eae..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/authentication/token.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth } from '../../model/public_types'; -export declare const enum TokenType { - REFRESH_TOKEN = "REFRESH_TOKEN", - ACCESS_TOKEN = "ACCESS_TOKEN" -} -export interface RequestStsTokenResponse { - accessToken: string; - expiresIn: string; - refreshToken: string; -} -export interface RevokeTokenRequest { - providerId: string; - tokenType: TokenType; - token: string; - idToken: string; - tenantId?: string; -} -export interface RevokeTokenResponse { -} -export declare function requestStsToken(auth: Auth, refreshToken: string): Promise<RequestStsTokenResponse>; -export declare function revokeToken(auth: Auth, request: RevokeTokenRequest): Promise<RevokeTokenResponse>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/errors.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/errors.d.ts deleted file mode 100644 index 208e19d..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/errors.d.ts +++ /dev/null @@ -1,129 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthErrorCode } from '../core/errors'; -/** - * Errors that can be returned by the backend - */ -export declare const enum ServerError { - ADMIN_ONLY_OPERATION = "ADMIN_ONLY_OPERATION", - BLOCKING_FUNCTION_ERROR_RESPONSE = "BLOCKING_FUNCTION_ERROR_RESPONSE", - CAPTCHA_CHECK_FAILED = "CAPTCHA_CHECK_FAILED", - CORS_UNSUPPORTED = "CORS_UNSUPPORTED", - CREDENTIAL_MISMATCH = "CREDENTIAL_MISMATCH", - CREDENTIAL_TOO_OLD_LOGIN_AGAIN = "CREDENTIAL_TOO_OLD_LOGIN_AGAIN", - DYNAMIC_LINK_NOT_ACTIVATED = "DYNAMIC_LINK_NOT_ACTIVATED", - EMAIL_CHANGE_NEEDS_VERIFICATION = "EMAIL_CHANGE_NEEDS_VERIFICATION", - EMAIL_EXISTS = "EMAIL_EXISTS", - EMAIL_NOT_FOUND = "EMAIL_NOT_FOUND", - EXPIRED_OOB_CODE = "EXPIRED_OOB_CODE", - FEDERATED_USER_ID_ALREADY_LINKED = "FEDERATED_USER_ID_ALREADY_LINKED", - INVALID_APP_CREDENTIAL = "INVALID_APP_CREDENTIAL", - INVALID_APP_ID = "INVALID_APP_ID", - INVALID_CERT_HASH = "INVALID_CERT_HASH", - INVALID_CODE = "INVALID_CODE", - INVALID_CONTINUE_URI = "INVALID_CONTINUE_URI", - INVALID_CUSTOM_TOKEN = "INVALID_CUSTOM_TOKEN", - INVALID_DYNAMIC_LINK_DOMAIN = "INVALID_DYNAMIC_LINK_DOMAIN", - INVALID_EMAIL = "INVALID_EMAIL", - INVALID_ID_TOKEN = "INVALID_ID_TOKEN", - INVALID_IDP_RESPONSE = "INVALID_IDP_RESPONSE", - INVALID_IDENTIFIER = "INVALID_IDENTIFIER", - INVALID_LOGIN_CREDENTIALS = "INVALID_LOGIN_CREDENTIALS", - INVALID_MESSAGE_PAYLOAD = "INVALID_MESSAGE_PAYLOAD", - INVALID_MFA_PENDING_CREDENTIAL = "INVALID_MFA_PENDING_CREDENTIAL", - INVALID_OAUTH_CLIENT_ID = "INVALID_OAUTH_CLIENT_ID", - INVALID_OOB_CODE = "INVALID_OOB_CODE", - INVALID_PASSWORD = "INVALID_PASSWORD", - INVALID_PENDING_TOKEN = "INVALID_PENDING_TOKEN", - INVALID_PHONE_NUMBER = "INVALID_PHONE_NUMBER", - INVALID_PROVIDER_ID = "INVALID_PROVIDER_ID", - INVALID_RECIPIENT_EMAIL = "INVALID_RECIPIENT_EMAIL", - INVALID_SENDER = "INVALID_SENDER", - INVALID_SESSION_INFO = "INVALID_SESSION_INFO", - INVALID_TEMPORARY_PROOF = "INVALID_TEMPORARY_PROOF", - INVALID_TENANT_ID = "INVALID_TENANT_ID", - MFA_ENROLLMENT_NOT_FOUND = "MFA_ENROLLMENT_NOT_FOUND", - MISSING_ANDROID_PACKAGE_NAME = "MISSING_ANDROID_PACKAGE_NAME", - MISSING_APP_CREDENTIAL = "MISSING_APP_CREDENTIAL", - MISSING_CODE = "MISSING_CODE", - MISSING_CONTINUE_URI = "MISSING_CONTINUE_URI", - MISSING_CUSTOM_TOKEN = "MISSING_CUSTOM_TOKEN", - MISSING_IOS_BUNDLE_ID = "MISSING_IOS_BUNDLE_ID", - MISSING_MFA_ENROLLMENT_ID = "MISSING_MFA_ENROLLMENT_ID", - MISSING_MFA_PENDING_CREDENTIAL = "MISSING_MFA_PENDING_CREDENTIAL", - MISSING_OOB_CODE = "MISSING_OOB_CODE", - MISSING_OR_INVALID_NONCE = "MISSING_OR_INVALID_NONCE", - MISSING_PASSWORD = "MISSING_PASSWORD", - MISSING_REQ_TYPE = "MISSING_REQ_TYPE", - MISSING_PHONE_NUMBER = "MISSING_PHONE_NUMBER", - MISSING_SESSION_INFO = "MISSING_SESSION_INFO", - OPERATION_NOT_ALLOWED = "OPERATION_NOT_ALLOWED", - PASSWORD_LOGIN_DISABLED = "PASSWORD_LOGIN_DISABLED", - QUOTA_EXCEEDED = "QUOTA_EXCEEDED", - RESET_PASSWORD_EXCEED_LIMIT = "RESET_PASSWORD_EXCEED_LIMIT", - REJECTED_CREDENTIAL = "REJECTED_CREDENTIAL", - SECOND_FACTOR_EXISTS = "SECOND_FACTOR_EXISTS", - SECOND_FACTOR_LIMIT_EXCEEDED = "SECOND_FACTOR_LIMIT_EXCEEDED", - SESSION_EXPIRED = "SESSION_EXPIRED", - TENANT_ID_MISMATCH = "TENANT_ID_MISMATCH", - TOKEN_EXPIRED = "TOKEN_EXPIRED", - TOO_MANY_ATTEMPTS_TRY_LATER = "TOO_MANY_ATTEMPTS_TRY_LATER", - UNSUPPORTED_FIRST_FACTOR = "UNSUPPORTED_FIRST_FACTOR", - UNSUPPORTED_TENANT_OPERATION = "UNSUPPORTED_TENANT_OPERATION", - UNAUTHORIZED_DOMAIN = "UNAUTHORIZED_DOMAIN", - UNVERIFIED_EMAIL = "UNVERIFIED_EMAIL", - USER_CANCELLED = "USER_CANCELLED", - USER_DISABLED = "USER_DISABLED", - USER_NOT_FOUND = "USER_NOT_FOUND", - WEAK_PASSWORD = "WEAK_PASSWORD", - RECAPTCHA_NOT_ENABLED = "RECAPTCHA_NOT_ENABLED", - MISSING_RECAPTCHA_TOKEN = "MISSING_RECAPTCHA_TOKEN", - INVALID_RECAPTCHA_TOKEN = "INVALID_RECAPTCHA_TOKEN", - INVALID_RECAPTCHA_ACTION = "INVALID_RECAPTCHA_ACTION", - MISSING_CLIENT_TYPE = "MISSING_CLIENT_TYPE", - MISSING_RECAPTCHA_VERSION = "MISSING_RECAPTCHA_VERSION", - INVALID_RECAPTCHA_VERSION = "INVALID_RECAPTCHA_VERSION", - INVALID_REQ_TYPE = "INVALID_REQ_TYPE", - PASSWORD_DOES_NOT_MEET_REQUIREMENTS = "PASSWORD_DOES_NOT_MEET_REQUIREMENTS", - INVALID_HOSTING_LINK_DOMAIN = "INVALID_HOSTING_LINK_DOMAIN" -} -/** - * API Response in the event of an error - */ -export interface JsonError { - error: { - code: number; - message: string; - errors?: [ - { - message: ServerError; - domain: string; - reason: string; - } - ]; - }; -} -/** - * Type definition for a map from server errors to developer visible errors - */ -export declare type ServerErrorMap<ApiError extends string> = { - readonly [K in ApiError]: AuthErrorCode; -}; -/** - * Map from errors returned by the server to errors to developer visible errors - */ -export declare const SERVER_ERROR_MAP: Partial<ServerErrorMap<ServerError>>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/index.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/index.d.ts deleted file mode 100644 index 1df9f79..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/index.d.ts +++ /dev/null @@ -1,101 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { FirebaseError } from '@firebase/util'; -import { AuthErrorCode } from '../core/errors'; -import { Delay } from '../core/util/delay'; -import { Auth } from '../model/public_types'; -import { IdTokenResponse } from '../model/id_token'; -import { ServerError, ServerErrorMap } from './errors'; -export declare const enum HttpMethod { - POST = "POST", - GET = "GET" -} -export declare const enum HttpHeader { - CONTENT_TYPE = "Content-Type", - X_FIREBASE_LOCALE = "X-Firebase-Locale", - X_CLIENT_VERSION = "X-Client-Version", - X_FIREBASE_GMPID = "X-Firebase-gmpid", - X_FIREBASE_CLIENT = "X-Firebase-Client", - X_FIREBASE_APP_CHECK = "X-Firebase-AppCheck" -} -export declare const enum Endpoint { - CREATE_AUTH_URI = "/v1/accounts:createAuthUri", - DELETE_ACCOUNT = "/v1/accounts:delete", - RESET_PASSWORD = "/v1/accounts:resetPassword", - SIGN_UP = "/v1/accounts:signUp", - SIGN_IN_WITH_CUSTOM_TOKEN = "/v1/accounts:signInWithCustomToken", - SIGN_IN_WITH_EMAIL_LINK = "/v1/accounts:signInWithEmailLink", - SIGN_IN_WITH_IDP = "/v1/accounts:signInWithIdp", - SIGN_IN_WITH_PASSWORD = "/v1/accounts:signInWithPassword", - SIGN_IN_WITH_PHONE_NUMBER = "/v1/accounts:signInWithPhoneNumber", - SEND_VERIFICATION_CODE = "/v1/accounts:sendVerificationCode", - SEND_OOB_CODE = "/v1/accounts:sendOobCode", - SET_ACCOUNT_INFO = "/v1/accounts:update", - GET_ACCOUNT_INFO = "/v1/accounts:lookup", - GET_RECAPTCHA_PARAM = "/v1/recaptchaParams", - START_MFA_ENROLLMENT = "/v2/accounts/mfaEnrollment:start", - FINALIZE_MFA_ENROLLMENT = "/v2/accounts/mfaEnrollment:finalize", - START_MFA_SIGN_IN = "/v2/accounts/mfaSignIn:start", - FINALIZE_MFA_SIGN_IN = "/v2/accounts/mfaSignIn:finalize", - WITHDRAW_MFA = "/v2/accounts/mfaEnrollment:withdraw", - GET_PROJECT_CONFIG = "/v1/projects", - GET_RECAPTCHA_CONFIG = "/v2/recaptchaConfig", - GET_PASSWORD_POLICY = "/v2/passwordPolicy", - TOKEN = "/v1/token", - REVOKE_TOKEN = "/v2/accounts:revokeToken" -} -export declare const enum RecaptchaClientType { - WEB = "CLIENT_TYPE_WEB", - ANDROID = "CLIENT_TYPE_ANDROID", - IOS = "CLIENT_TYPE_IOS" -} -export declare const enum RecaptchaVersion { - ENTERPRISE = "RECAPTCHA_ENTERPRISE" -} -export declare const enum RecaptchaActionName { - SIGN_IN_WITH_PASSWORD = "signInWithPassword", - GET_OOB_CODE = "getOobCode", - SIGN_UP_PASSWORD = "signUpPassword", - SEND_VERIFICATION_CODE = "sendVerificationCode", - MFA_SMS_ENROLLMENT = "mfaSmsEnrollment", - MFA_SMS_SIGNIN = "mfaSmsSignIn" -} -export declare const enum EnforcementState { - ENFORCE = "ENFORCE", - AUDIT = "AUDIT", - OFF = "OFF", - ENFORCEMENT_STATE_UNSPECIFIED = "ENFORCEMENT_STATE_UNSPECIFIED" -} -export declare const enum RecaptchaAuthProvider { - EMAIL_PASSWORD_PROVIDER = "EMAIL_PASSWORD_PROVIDER", - PHONE_PROVIDER = "PHONE_PROVIDER" -} -export declare const DEFAULT_API_TIMEOUT_MS: Delay; -export declare function _addTidIfNecessary<T extends { - tenantId?: string; -}>(auth: Auth, request: T): T; -export declare function _performApiRequest<T, V>(auth: Auth, method: HttpMethod, path: Endpoint, request?: T, customErrorMap?: Partial<ServerErrorMap<ServerError>>): Promise<V>; -export declare function _performFetchWithErrorHandling<V>(auth: Auth, customErrorMap: Partial<ServerErrorMap<ServerError>>, fetchFn: () => Promise<Response>): Promise<V>; -export declare function _performSignInRequest<T, V extends IdTokenResponse>(auth: Auth, method: HttpMethod, path: Endpoint, request?: T, customErrorMap?: Partial<ServerErrorMap<ServerError>>): Promise<V>; -export declare function _getFinalTarget(auth: Auth, host: string, path: string, query: string): Promise<string>; -export declare function _parseEnforcementState(enforcementStateStr: string): EnforcementState; -interface PotentialResponse extends IdTokenResponse { - email?: string; - phoneNumber?: string; -} -export declare function _makeTaggedError(auth: Auth, code: AuthErrorCode, response: PotentialResponse): FirebaseError; -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/password_policy/get_password_policy.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/password_policy/get_password_policy.d.ts deleted file mode 100644 index f8a90e9..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/password_policy/get_password_policy.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @license - * Copyright 2023 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth } from '../../model/public_types'; -/** - * Request object for fetching the password policy. - */ -export interface GetPasswordPolicyRequest { - tenantId?: string; -} -/** - * Response object for fetching the password policy. - */ -export interface GetPasswordPolicyResponse { - customStrengthOptions: { - minPasswordLength?: number; - maxPasswordLength?: number; - containsLowercaseCharacter?: boolean; - containsUppercaseCharacter?: boolean; - containsNumericCharacter?: boolean; - containsNonAlphanumericCharacter?: boolean; - }; - allowedNonAlphanumericCharacters?: string[]; - enforcementState: string; - forceUpgradeOnSignin?: boolean; - schemaVersion: number; -} -/** - * Fetches the password policy for the currently set tenant or the project if no tenant is set. - * - * @param auth Auth object. - * @param request Password policy request. - * @returns Password policy response. - */ -export declare function _getPasswordPolicy(auth: Auth, request?: GetPasswordPolicyRequest): Promise<GetPasswordPolicyResponse>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/project_config/get_project_config.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/project_config/get_project_config.d.ts deleted file mode 100644 index c7a881a..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/api/project_config/get_project_config.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth } from '../../model/public_types'; -export interface GetProjectConfigRequest { - androidPackageName?: string; - iosBundleId?: string; -} -export interface GetProjectConfigResponse { - authorizedDomains: string[]; -} -export declare function _getProjectConfig(auth: Auth, request?: GetProjectConfigRequest): Promise<GetProjectConfigResponse>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/action_code_url.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/action_code_url.d.ts deleted file mode 100644 index 39f14b6..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/action_code_url.d.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * A utility class to parse email action URLs such as password reset, email verification, - * email link sign in, etc. - * - * @public - */ -export declare class ActionCodeURL { - /** - * The API key of the email action link. - */ - readonly apiKey: string; - /** - * The action code of the email action link. - */ - readonly code: string; - /** - * The continue URL of the email action link. Null if not provided. - */ - readonly continueUrl: string | null; - /** - * The language code of the email action link. Null if not provided. - */ - readonly languageCode: string | null; - /** - * The action performed by the email action link. It returns from one of the types from - * {@link ActionCodeInfo} - */ - readonly operation: string; - /** - * The tenant ID of the email action link. Null if the email action is from the parent project. - */ - readonly tenantId: string | null; - /** - * @param actionLink - The link from which to extract the URL. - * @returns The {@link ActionCodeURL} object, or null if the link is invalid. - * - * @internal - */ - constructor(actionLink: string); - /** - * Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid, - * otherwise returns null. - * - * @param link - The email action link string. - * @returns The {@link ActionCodeURL} object, or null if the link is invalid. - * - * @public - */ - static parseLink(link: string): ActionCodeURL | null; -} -/** - * Parses the email action link string and returns an {@link ActionCodeURL} if - * the link is valid, otherwise returns null. - * - * @public - */ -export declare function parseActionCodeURL(link: string): ActionCodeURL | null; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/auth_event_manager.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/auth_event_manager.d.ts deleted file mode 100644 index 42edbc6..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/auth_event_manager.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthEvent, AuthEventConsumer, EventManager } from '../../model/popup_redirect'; -import { AuthInternal } from '../../model/auth'; -export declare class AuthEventManager implements EventManager { - private readonly auth; - private readonly cachedEventUids; - private readonly consumers; - protected queuedRedirectEvent: AuthEvent | null; - protected hasHandledPotentialRedirect: boolean; - private lastProcessedEventTime; - constructor(auth: AuthInternal); - registerConsumer(authEventConsumer: AuthEventConsumer): void; - unregisterConsumer(authEventConsumer: AuthEventConsumer): void; - onEvent(event: AuthEvent): boolean; - private sendToConsumer; - private isEventForConsumer; - private hasEventBeenHandled; - private saveEventToCache; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/auth_impl.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/auth_impl.d.ts deleted file mode 100644 index 87aab60..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/auth_impl.d.ts +++ /dev/null @@ -1,133 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { _FirebaseService, FirebaseApp } from '@firebase/app'; -import { Provider } from '@firebase/component'; -import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types'; -import { Auth, AuthErrorMap, AuthSettings, EmulatorConfig, NextOrObserver, Persistence, PopupRedirectResolver, User, CompleteFn, ErrorFn, Unsubscribe, PasswordValidationStatus } from '../../model/public_types'; -import { ErrorFactory } from '@firebase/util'; -import { AuthInternal, ConfigInternal } from '../../model/auth'; -import { PopupRedirectResolverInternal } from '../../model/popup_redirect'; -import { UserInternal } from '../../model/user'; -import { AuthErrorCode, AuthErrorParams } from '../errors'; -import { PersistenceInternal } from '../persistence'; -import { RecaptchaConfig } from '../../platform_browser/recaptcha/recaptcha'; -import { PasswordPolicyInternal } from '../../model/password_policy'; -export declare const enum DefaultConfig { - TOKEN_API_HOST = "securetoken.googleapis.com", - API_HOST = "identitytoolkit.googleapis.com", - API_SCHEME = "https" -} -export declare class AuthImpl implements AuthInternal, _FirebaseService { - readonly app: FirebaseApp; - private readonly heartbeatServiceProvider; - private readonly appCheckServiceProvider; - readonly config: ConfigInternal; - currentUser: User | null; - emulatorConfig: EmulatorConfig | null; - private operations; - private persistenceManager?; - private redirectPersistenceManager?; - private authStateSubscription; - private idTokenSubscription; - private readonly beforeStateQueue; - private redirectUser; - private isProactiveRefreshEnabled; - private readonly EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION; - _canInitEmulator: boolean; - _isInitialized: boolean; - _deleted: boolean; - _initializationPromise: Promise<void> | null; - _popupRedirectResolver: PopupRedirectResolverInternal | null; - _errorFactory: ErrorFactory<AuthErrorCode, AuthErrorParams>; - _agentRecaptchaConfig: RecaptchaConfig | null; - _tenantRecaptchaConfigs: Record<string, RecaptchaConfig>; - _projectPasswordPolicy: PasswordPolicyInternal | null; - _tenantPasswordPolicies: Record<string, PasswordPolicyInternal>; - _resolvePersistenceManagerAvailable: ((value: void | PromiseLike<void>) => void) | undefined; - _persistenceManagerAvailable: Promise<void>; - readonly name: string; - private lastNotifiedUid; - languageCode: string | null; - tenantId: string | null; - settings: AuthSettings; - constructor(app: FirebaseApp, heartbeatServiceProvider: Provider<'heartbeat'>, appCheckServiceProvider: Provider<AppCheckInternalComponentName>, config: ConfigInternal); - _initializeWithPersistence(persistenceHierarchy: PersistenceInternal[], popupRedirectResolver?: PopupRedirectResolver): Promise<void>; - /** - * If the persistence is changed in another window, the user manager will let us know - */ - _onStorageEvent(): Promise<void>; - private initializeCurrentUserFromIdToken; - private initializeCurrentUser; - private tryRedirectSignIn; - private reloadAndSetCurrentUserOrClear; - useDeviceLanguage(): void; - _delete(): Promise<void>; - updateCurrentUser(userExtern: User | null): Promise<void>; - _updateCurrentUser(user: User | null, skipBeforeStateCallbacks?: boolean): Promise<void>; - signOut(): Promise<void>; - setPersistence(persistence: Persistence): Promise<void>; - _getRecaptchaConfig(): RecaptchaConfig | null; - validatePassword(password: string): Promise<PasswordValidationStatus>; - _getPasswordPolicyInternal(): PasswordPolicyInternal | null; - _updatePasswordPolicy(): Promise<void>; - _getPersistenceType(): string; - _getPersistence(): PersistenceInternal; - _updateErrorMap(errorMap: AuthErrorMap): void; - onAuthStateChanged(nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe; - beforeAuthStateChanged(callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe; - onIdTokenChanged(nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe; - authStateReady(): Promise<void>; - /** - * Revokes the given access token. Currently only supports Apple OAuth access tokens. - */ - revokeAccessToken(token: string): Promise<void>; - toJSON(): object; - _setRedirectUser(user: UserInternal | null, popupRedirectResolver?: PopupRedirectResolver): Promise<void>; - private getOrInitRedirectPersistenceManager; - _redirectUserForId(id: string): Promise<UserInternal | null>; - _persistUserIfCurrent(user: UserInternal): Promise<void>; - /** Notifies listeners only if the user is current */ - _notifyListenersIfCurrent(user: UserInternal): void; - _key(): string; - _startProactiveRefresh(): void; - _stopProactiveRefresh(): void; - /** Returns the current user cast as the internal type */ - get _currentUser(): UserInternal; - private notifyAuthListeners; - private registerStateListener; - /** - * Unprotected (from race conditions) method to set the current user. This - * should only be called from within a queued callback. This is necessary - * because the queue shouldn't rely on another queued callback. - */ - private directlySetCurrentUser; - private queue; - private get assertedPersistence(); - private frameworks; - private clientVersion; - _logFramework(framework: string): void; - _getFrameworks(): readonly string[]; - _getAdditionalHeaders(): Promise<Record<string, string>>; - _getAppCheckToken(): Promise<string | undefined>; -} -/** - * Method to be used to cast down to our private implementation of Auth. - * It will also handle unwrapping from the compat type if necessary - * - * @param auth Auth object passed in from developer - */ -export declare function _castAuth(auth: Auth): AuthInternal; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/emulator.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/emulator.d.ts deleted file mode 100644 index 56dd81c..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/emulator.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth } from '../../model/public_types'; -/** - * Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production - * Firebase Auth services. - * - * @remarks - * This must be called synchronously immediately following the first call to - * {@link initializeAuth}. Do not use with production credentials as emulator - * traffic is not encrypted. - * - * - * @example - * ```javascript - * connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true }); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param url - The URL at which the emulator is running (eg, 'http://localhost:9099'). - * @param options - Optional. `options.disableWarnings` defaults to `false`. Set it to - * `true` to disable the warning banner attached to the DOM. - * - * @public - */ -export declare function connectAuthEmulator(auth: Auth, url: string, options?: { - disableWarnings: boolean; -}): void; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/firebase_internal.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/firebase_internal.d.ts deleted file mode 100644 index 9a68c98..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/firebase_internal.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { FirebaseAuthInternal } from '@firebase/auth-interop-types'; -import { AuthInternal } from '../../model/auth'; -interface TokenListener { - (tok: string | null): unknown; -} -export declare class AuthInterop implements FirebaseAuthInternal { - private readonly auth; - private readonly internalListeners; - constructor(auth: AuthInternal); - getUid(): string | null; - getToken(forceRefresh?: boolean): Promise<{ - accessToken: string; - } | null>; - addAuthTokenListener(listener: TokenListener): void; - removeAuthTokenListener(listener: TokenListener): void; - private assertAuthConfigured; - private updateProactiveRefresh; -} -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/initialize.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/initialize.d.ts deleted file mode 100644 index 3dd0e1e..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/initialize.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { FirebaseApp } from '@firebase/app'; -import { Auth, Dependencies } from '../../model/public_types'; -import { AuthImpl } from './auth_impl'; -/** - * Initializes an {@link Auth} instance with fine-grained control over - * {@link Dependencies}. - * - * @remarks - * - * This function allows more control over the {@link Auth} instance than - * {@link getAuth}. `getAuth` uses platform-specific defaults to supply - * the {@link Dependencies}. In general, `getAuth` is the easiest way to - * initialize Auth and works for most use cases. Use `initializeAuth` if you - * need control over which persistence layer is used, or to minimize bundle - * size if you're not using either `signInWithPopup` or `signInWithRedirect`. - * - * For example, if your app only uses anonymous accounts and you only want - * accounts saved for the current session, initialize `Auth` with: - * - * ```js - * const auth = initializeAuth(app, { - * persistence: browserSessionPersistence, - * popupRedirectResolver: undefined, - * }); - * ``` - * - * @public - */ -export declare function initializeAuth(app: FirebaseApp, deps?: Dependencies): Auth; -export declare function _initializeAuthInstance(auth: AuthImpl, deps?: Dependencies): void; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/middleware.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/middleware.d.ts deleted file mode 100644 index 74c4183..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/middleware.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthInternal } from '../../model/auth'; -import { Unsubscribe, User } from '../../model/public_types'; -export declare class AuthMiddlewareQueue { - private readonly auth; - private readonly queue; - constructor(auth: AuthInternal); - pushCallback(callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe; - runMiddleware(nextUser: User | null): Promise<void>; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/password_policy_impl.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/password_policy_impl.d.ts deleted file mode 100644 index 45a8127..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/password_policy_impl.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @license - * Copyright 2023 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { GetPasswordPolicyResponse } from '../../api/password_policy/get_password_policy'; -import { PasswordPolicyCustomStrengthOptions, PasswordPolicyInternal } from '../../model/password_policy'; -import { PasswordValidationStatus } from '../../model/public_types'; -/** - * Stores password policy requirements and provides password validation against the policy. - * - * @internal - */ -export declare class PasswordPolicyImpl implements PasswordPolicyInternal { - readonly customStrengthOptions: PasswordPolicyCustomStrengthOptions; - readonly allowedNonAlphanumericCharacters: string; - readonly enforcementState: string; - readonly forceUpgradeOnSignin: boolean; - readonly schemaVersion: number; - constructor(response: GetPasswordPolicyResponse); - validatePassword(password: string): PasswordValidationStatus; - /** - * Validates that the password meets the length options for the policy. - * - * @param password Password to validate. - * @param status Validation status. - */ - private validatePasswordLengthOptions; - /** - * Validates that the password meets the character options for the policy. - * - * @param password Password to validate. - * @param status Validation status. - */ - private validatePasswordCharacterOptions; - /** - * Updates the running validation status with the statuses for the character options. - * Expected to be called each time a character is processed to update each option status - * based on the current character. - * - * @param status Validation status. - * @param containsLowercaseCharacter Whether the character is a lowercase letter. - * @param containsUppercaseCharacter Whether the character is an uppercase letter. - * @param containsNumericCharacter Whether the character is a numeric character. - * @param containsNonAlphanumericCharacter Whether the character is a non-alphanumeric character. - */ - private updatePasswordCharacterOptionsStatuses; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/register.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/register.d.ts deleted file mode 100644 index 260c739..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/auth/register.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ClientPlatform } from '../util/version'; -export declare const enum _ComponentName { - AUTH = "auth", - AUTH_INTERNAL = "auth-internal" -} -/** @internal */ -export declare function registerAuth(clientPlatform: ClientPlatform): void; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/auth_credential.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/auth_credential.d.ts deleted file mode 100644 index 1287582..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/auth_credential.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { PhoneOrOauthTokenResponse } from '../../api/authentication/mfa'; -import { AuthInternal } from '../../model/auth'; -import { IdTokenResponse } from '../../model/id_token'; -/** - * Interface that represents the credentials returned by an {@link AuthProvider}. - * - * @remarks - * Implementations specify the details about each auth provider's credential requirements. - * - * @public - */ -export declare class AuthCredential { - /** - * The authentication provider ID for the credential. - * - * @remarks - * For example, 'facebook.com', or 'google.com'. - */ - readonly providerId: string; - /** - * The authentication sign in method for the credential. - * - * @remarks - * For example, {@link SignInMethod}.EMAIL_PASSWORD, or - * {@link SignInMethod}.EMAIL_LINK. This corresponds to the sign-in method - * identifier as returned in {@link fetchSignInMethodsForEmail}. - */ - readonly signInMethod: string; - /** @internal */ - protected constructor( - /** - * The authentication provider ID for the credential. - * - * @remarks - * For example, 'facebook.com', or 'google.com'. - */ - providerId: string, - /** - * The authentication sign in method for the credential. - * - * @remarks - * For example, {@link SignInMethod}.EMAIL_PASSWORD, or - * {@link SignInMethod}.EMAIL_LINK. This corresponds to the sign-in method - * identifier as returned in {@link fetchSignInMethodsForEmail}. - */ - signInMethod: string); - /** - * Returns a JSON-serializable representation of this object. - * - * @returns a JSON-serializable representation of this object. - */ - toJSON(): object; - /** @internal */ - _getIdTokenResponse(_auth: AuthInternal): Promise<PhoneOrOauthTokenResponse>; - /** @internal */ - _linkToIdToken(_auth: AuthInternal, _idToken: string): Promise<IdTokenResponse>; - /** @internal */ - _getReauthenticationResolver(_auth: AuthInternal): Promise<IdTokenResponse>; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/email.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/email.d.ts deleted file mode 100644 index 0f44811..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/email.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthInternal } from '../../model/auth'; -import { IdTokenResponse } from '../../model/id_token'; -import { AuthCredential } from './auth_credential'; -/** - * Interface that represents the credentials returned by {@link EmailAuthProvider} for - * {@link ProviderId}.PASSWORD - * - * @remarks - * Covers both {@link SignInMethod}.EMAIL_PASSWORD and - * {@link SignInMethod}.EMAIL_LINK. - * - * @public - */ -export declare class EmailAuthCredential extends AuthCredential { - /** @internal */ - readonly _email: string; - /** @internal */ - readonly _password: string; - /** @internal */ - readonly _tenantId: string | null; - /** @internal */ - private constructor(); - /** @internal */ - static _fromEmailAndPassword(email: string, password: string): EmailAuthCredential; - /** @internal */ - static _fromEmailAndCode(email: string, oobCode: string, tenantId?: string | null): EmailAuthCredential; - /** {@inheritdoc AuthCredential.toJSON} */ - toJSON(): object; - /** - * Static method to deserialize a JSON representation of an object into an {@link AuthCredential}. - * - * @param json - Either `object` or the stringified representation of the object. When string is - * provided, `JSON.parse` would be called first. - * - * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned. - */ - static fromJSON(json: object | string): EmailAuthCredential | null; - /** @internal */ - _getIdTokenResponse(auth: AuthInternal): Promise<IdTokenResponse>; - /** @internal */ - _linkToIdToken(auth: AuthInternal, idToken: string): Promise<IdTokenResponse>; - /** @internal */ - _getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse>; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/index.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/index.d.ts deleted file mode 100644 index 475dee6..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/index.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * This file is required due to the circular dependency from the parent class to its children - */ -export { AuthCredential } from './auth_credential'; -export { EmailAuthCredential } from './email'; -export { OAuthCredential } from './oauth'; -export { PhoneAuthCredential as PhoneAuthCredential } from './phone'; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/oauth.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/oauth.d.ts deleted file mode 100644 index 96a1928..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/oauth.d.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthInternal } from '../../model/auth'; -import { IdTokenResponse } from '../../model/id_token'; -import { AuthCredential } from './auth_credential'; -export interface OAuthCredentialParams { - idToken?: string | null; - accessToken?: string | null; - oauthToken?: string; - secret?: string; - oauthTokenSecret?: string; - nonce?: string; - pendingToken?: string; - providerId: string; - signInMethod: string; -} -/** - * Represents the OAuth credentials returned by an {@link OAuthProvider}. - * - * @remarks - * Implementations specify the details about each auth provider's credential requirements. - * - * @public - */ -export declare class OAuthCredential extends AuthCredential { - /** - * The OAuth ID token associated with the credential if it belongs to an OIDC provider, - * such as `google.com`. - * @readonly - */ - idToken?: string; - /** - * The OAuth access token associated with the credential if it belongs to an - * {@link OAuthProvider}, such as `facebook.com`, `twitter.com`, etc. - * @readonly - */ - accessToken?: string; - /** - * The OAuth access token secret associated with the credential if it belongs to an OAuth 1.0 - * provider, such as `twitter.com`. - * @readonly - */ - secret?: string; - private nonce?; - private pendingToken; - /** @internal */ - static _fromParams(params: OAuthCredentialParams): OAuthCredential; - /** {@inheritdoc AuthCredential.toJSON} */ - toJSON(): object; - /** - * Static method to deserialize a JSON representation of an object into an - * {@link AuthCredential}. - * - * @param json - Input can be either Object or the stringified representation of the object. - * When string is provided, JSON.parse would be called first. - * - * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned. - */ - static fromJSON(json: string | object): OAuthCredential | null; - /** @internal */ - _getIdTokenResponse(auth: AuthInternal): Promise<IdTokenResponse>; - /** @internal */ - _linkToIdToken(auth: AuthInternal, idToken: string): Promise<IdTokenResponse>; - /** @internal */ - _getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse>; - private buildRequest; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/phone.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/phone.d.ts deleted file mode 100644 index 1924744..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/phone.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { PhoneOrOauthTokenResponse } from '../../api/authentication/mfa'; -import { SignInWithPhoneNumberRequest } from '../../api/authentication/sms'; -import { AuthInternal } from '../../model/auth'; -import { IdTokenResponse } from '../../model/id_token'; -import { AuthCredential } from './auth_credential'; -export interface PhoneAuthCredentialParameters { - verificationId?: string; - verificationCode?: string; - phoneNumber?: string; - temporaryProof?: string; -} -/** - * Represents the credentials returned by {@link PhoneAuthProvider}. - * - * @public - */ -export declare class PhoneAuthCredential extends AuthCredential { - private readonly params; - private constructor(); - /** @internal */ - static _fromVerification(verificationId: string, verificationCode: string): PhoneAuthCredential; - /** @internal */ - static _fromTokenResponse(phoneNumber: string, temporaryProof: string): PhoneAuthCredential; - /** @internal */ - _getIdTokenResponse(auth: AuthInternal): Promise<PhoneOrOauthTokenResponse>; - /** @internal */ - _linkToIdToken(auth: AuthInternal, idToken: string): Promise<IdTokenResponse>; - /** @internal */ - _getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse>; - /** @internal */ - _makeVerificationRequest(): SignInWithPhoneNumberRequest; - /** {@inheritdoc AuthCredential.toJSON} */ - toJSON(): object; - /** Generates a phone credential based on a plain object or a JSON string. */ - static fromJSON(json: object | string): PhoneAuthCredential | null; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/saml.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/saml.d.ts deleted file mode 100644 index 54fea84..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/credentials/saml.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthInternal } from '../../model/auth'; -import { IdTokenResponse } from '../../model/id_token'; -import { AuthCredential } from './auth_credential'; -/** - * @public - */ -export declare class SAMLAuthCredential extends AuthCredential { - private readonly pendingToken; - /** @internal */ - private constructor(); - /** @internal */ - _getIdTokenResponse(auth: AuthInternal): Promise<IdTokenResponse>; - /** @internal */ - _linkToIdToken(auth: AuthInternal, idToken: string): Promise<IdTokenResponse>; - /** @internal */ - _getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse>; - /** {@inheritdoc AuthCredential.toJSON} */ - toJSON(): object; - /** - * Static method to deserialize a JSON representation of an object into an - * {@link AuthCredential}. - * - * @param json - Input can be either Object or the stringified representation of the object. - * When string is provided, JSON.parse would be called first. - * - * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned. - */ - static fromJSON(json: string | object): SAMLAuthCredential | null; - /** - * Helper static method to avoid exposing the constructor to end users. - * - * @internal - */ - static _create(providerId: string, pendingToken: string): SAMLAuthCredential; - private buildRequest; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/errors.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/errors.d.ts deleted file mode 100644 index 3d81b3a..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/errors.d.ts +++ /dev/null @@ -1,328 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthErrorMap, User } from '../model/public_types'; -import { ErrorFactory, ErrorMap } from '@firebase/util'; -import { IdTokenMfaResponse } from '../api/authentication/mfa'; -import { AppName } from '../model/auth'; -import { AuthCredential } from './credentials'; -/** - * Enumeration of Firebase Auth error codes. - * - * @internal - */ -export declare const enum AuthErrorCode { - ADMIN_ONLY_OPERATION = "admin-restricted-operation", - ARGUMENT_ERROR = "argument-error", - APP_NOT_AUTHORIZED = "app-not-authorized", - APP_NOT_INSTALLED = "app-not-installed", - CAPTCHA_CHECK_FAILED = "captcha-check-failed", - CODE_EXPIRED = "code-expired", - CORDOVA_NOT_READY = "cordova-not-ready", - CORS_UNSUPPORTED = "cors-unsupported", - CREDENTIAL_ALREADY_IN_USE = "credential-already-in-use", - CREDENTIAL_MISMATCH = "custom-token-mismatch", - CREDENTIAL_TOO_OLD_LOGIN_AGAIN = "requires-recent-login", - DEPENDENT_SDK_INIT_BEFORE_AUTH = "dependent-sdk-initialized-before-auth", - DYNAMIC_LINK_NOT_ACTIVATED = "dynamic-link-not-activated", - EMAIL_CHANGE_NEEDS_VERIFICATION = "email-change-needs-verification", - EMAIL_EXISTS = "email-already-in-use", - EMULATOR_CONFIG_FAILED = "emulator-config-failed", - EXPIRED_OOB_CODE = "expired-action-code", - EXPIRED_POPUP_REQUEST = "cancelled-popup-request", - INTERNAL_ERROR = "internal-error", - INVALID_API_KEY = "invalid-api-key", - INVALID_APP_CREDENTIAL = "invalid-app-credential", - INVALID_APP_ID = "invalid-app-id", - INVALID_AUTH = "invalid-user-token", - INVALID_AUTH_EVENT = "invalid-auth-event", - INVALID_CERT_HASH = "invalid-cert-hash", - INVALID_CODE = "invalid-verification-code", - INVALID_CONTINUE_URI = "invalid-continue-uri", - INVALID_CORDOVA_CONFIGURATION = "invalid-cordova-configuration", - INVALID_CUSTOM_TOKEN = "invalid-custom-token", - INVALID_DYNAMIC_LINK_DOMAIN = "invalid-dynamic-link-domain", - INVALID_EMAIL = "invalid-email", - INVALID_EMULATOR_SCHEME = "invalid-emulator-scheme", - INVALID_CREDENTIAL = "invalid-credential", - INVALID_MESSAGE_PAYLOAD = "invalid-message-payload", - INVALID_MFA_SESSION = "invalid-multi-factor-session", - INVALID_OAUTH_CLIENT_ID = "invalid-oauth-client-id", - INVALID_OAUTH_PROVIDER = "invalid-oauth-provider", - INVALID_OOB_CODE = "invalid-action-code", - INVALID_ORIGIN = "unauthorized-domain", - INVALID_PASSWORD = "wrong-password", - INVALID_PERSISTENCE = "invalid-persistence-type", - INVALID_PHONE_NUMBER = "invalid-phone-number", - INVALID_PROVIDER_ID = "invalid-provider-id", - INVALID_RECIPIENT_EMAIL = "invalid-recipient-email", - INVALID_SENDER = "invalid-sender", - INVALID_SESSION_INFO = "invalid-verification-id", - INVALID_TENANT_ID = "invalid-tenant-id", - LOGIN_BLOCKED = "login-blocked", - MFA_INFO_NOT_FOUND = "multi-factor-info-not-found", - MFA_REQUIRED = "multi-factor-auth-required", - MISSING_ANDROID_PACKAGE_NAME = "missing-android-pkg-name", - MISSING_APP_CREDENTIAL = "missing-app-credential", - MISSING_AUTH_DOMAIN = "auth-domain-config-required", - MISSING_CODE = "missing-verification-code", - MISSING_CONTINUE_URI = "missing-continue-uri", - MISSING_IFRAME_START = "missing-iframe-start", - MISSING_IOS_BUNDLE_ID = "missing-ios-bundle-id", - MISSING_OR_INVALID_NONCE = "missing-or-invalid-nonce", - MISSING_MFA_INFO = "missing-multi-factor-info", - MISSING_MFA_SESSION = "missing-multi-factor-session", - MISSING_PHONE_NUMBER = "missing-phone-number", - MISSING_PASSWORD = "missing-password", - MISSING_SESSION_INFO = "missing-verification-id", - MODULE_DESTROYED = "app-deleted", - NEED_CONFIRMATION = "account-exists-with-different-credential", - NETWORK_REQUEST_FAILED = "network-request-failed", - NULL_USER = "null-user", - NO_AUTH_EVENT = "no-auth-event", - NO_SUCH_PROVIDER = "no-such-provider", - OPERATION_NOT_ALLOWED = "operation-not-allowed", - OPERATION_NOT_SUPPORTED = "operation-not-supported-in-this-environment", - POPUP_BLOCKED = "popup-blocked", - POPUP_CLOSED_BY_USER = "popup-closed-by-user", - PROVIDER_ALREADY_LINKED = "provider-already-linked", - QUOTA_EXCEEDED = "quota-exceeded", - REDIRECT_CANCELLED_BY_USER = "redirect-cancelled-by-user", - REDIRECT_OPERATION_PENDING = "redirect-operation-pending", - REJECTED_CREDENTIAL = "rejected-credential", - SECOND_FACTOR_ALREADY_ENROLLED = "second-factor-already-in-use", - SECOND_FACTOR_LIMIT_EXCEEDED = "maximum-second-factor-count-exceeded", - TENANT_ID_MISMATCH = "tenant-id-mismatch", - TIMEOUT = "timeout", - TOKEN_EXPIRED = "user-token-expired", - TOO_MANY_ATTEMPTS_TRY_LATER = "too-many-requests", - UNAUTHORIZED_DOMAIN = "unauthorized-continue-uri", - UNSUPPORTED_FIRST_FACTOR = "unsupported-first-factor", - UNSUPPORTED_PERSISTENCE = "unsupported-persistence-type", - UNSUPPORTED_TENANT_OPERATION = "unsupported-tenant-operation", - UNVERIFIED_EMAIL = "unverified-email", - USER_CANCELLED = "user-cancelled", - USER_DELETED = "user-not-found", - USER_DISABLED = "user-disabled", - USER_MISMATCH = "user-mismatch", - USER_SIGNED_OUT = "user-signed-out", - WEAK_PASSWORD = "weak-password", - WEB_STORAGE_UNSUPPORTED = "web-storage-unsupported", - ALREADY_INITIALIZED = "already-initialized", - RECAPTCHA_NOT_ENABLED = "recaptcha-not-enabled", - MISSING_RECAPTCHA_TOKEN = "missing-recaptcha-token", - INVALID_RECAPTCHA_TOKEN = "invalid-recaptcha-token", - INVALID_RECAPTCHA_ACTION = "invalid-recaptcha-action", - MISSING_CLIENT_TYPE = "missing-client-type", - MISSING_RECAPTCHA_VERSION = "missing-recaptcha-version", - INVALID_RECAPTCHA_VERSION = "invalid-recaptcha-version", - INVALID_REQ_TYPE = "invalid-req-type", - UNSUPPORTED_PASSWORD_POLICY_SCHEMA_VERSION = "unsupported-password-policy-schema-version", - PASSWORD_DOES_NOT_MEET_REQUIREMENTS = "password-does-not-meet-requirements", - INVALID_HOSTING_LINK_DOMAIN = "invalid-hosting-link-domain" -} -export interface ErrorMapRetriever extends AuthErrorMap { - (): ErrorMap<AuthErrorCode>; -} -/** - * A verbose error map with detailed descriptions for most error codes. - * - * See discussion at {@link AuthErrorMap} - * - * @public - */ -export declare const debugErrorMap: AuthErrorMap; -/** - * A minimal error map with all verbose error messages stripped. - * - * See discussion at {@link AuthErrorMap} - * - * @public - */ -export declare const prodErrorMap: AuthErrorMap; -export interface NamedErrorParams { - appName: AppName; - credential?: AuthCredential; - email?: string; - phoneNumber?: string; - tenantId?: string; - user?: User; - _serverResponse?: object; -} -/** - * @internal - */ -type GenericAuthErrorParams = { - [key in Exclude<AuthErrorCode, AuthErrorCode.ARGUMENT_ERROR | AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH | AuthErrorCode.INTERNAL_ERROR | AuthErrorCode.MFA_REQUIRED | AuthErrorCode.NO_AUTH_EVENT | AuthErrorCode.OPERATION_NOT_SUPPORTED>]: { - appName?: AppName; - email?: string; - phoneNumber?: string; - message?: string; - }; -}; -/** - * @internal - */ -export interface AuthErrorParams extends GenericAuthErrorParams { - [AuthErrorCode.ARGUMENT_ERROR]: { - appName?: AppName; - }; - [AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH]: { - appName?: AppName; - }; - [AuthErrorCode.INTERNAL_ERROR]: { - appName?: AppName; - }; - [AuthErrorCode.LOGIN_BLOCKED]: { - appName?: AppName; - originalMessage?: string; - }; - [AuthErrorCode.OPERATION_NOT_SUPPORTED]: { - appName?: AppName; - }; - [AuthErrorCode.NO_AUTH_EVENT]: { - appName?: AppName; - }; - [AuthErrorCode.MFA_REQUIRED]: { - appName: AppName; - _serverResponse: IdTokenMfaResponse; - }; - [AuthErrorCode.INVALID_CORDOVA_CONFIGURATION]: { - appName: AppName; - missingPlugin?: string; - }; -} -export declare const _DEFAULT_AUTH_ERROR_FACTORY: ErrorFactory<AuthErrorCode, AuthErrorParams>; -/** - * A map of potential `Auth` error codes, for easier comparison with errors - * thrown by the SDK. - * - * @remarks - * Note that you can't tree-shake individual keys - * in the map, so by using the map you might substantially increase your - * bundle size. - * - * @public - */ -export declare const AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY: { - readonly ADMIN_ONLY_OPERATION: "auth/admin-restricted-operation"; - readonly ARGUMENT_ERROR: "auth/argument-error"; - readonly APP_NOT_AUTHORIZED: "auth/app-not-authorized"; - readonly APP_NOT_INSTALLED: "auth/app-not-installed"; - readonly CAPTCHA_CHECK_FAILED: "auth/captcha-check-failed"; - readonly CODE_EXPIRED: "auth/code-expired"; - readonly CORDOVA_NOT_READY: "auth/cordova-not-ready"; - readonly CORS_UNSUPPORTED: "auth/cors-unsupported"; - readonly CREDENTIAL_ALREADY_IN_USE: "auth/credential-already-in-use"; - readonly CREDENTIAL_MISMATCH: "auth/custom-token-mismatch"; - readonly CREDENTIAL_TOO_OLD_LOGIN_AGAIN: "auth/requires-recent-login"; - readonly DEPENDENT_SDK_INIT_BEFORE_AUTH: "auth/dependent-sdk-initialized-before-auth"; - readonly DYNAMIC_LINK_NOT_ACTIVATED: "auth/dynamic-link-not-activated"; - readonly EMAIL_CHANGE_NEEDS_VERIFICATION: "auth/email-change-needs-verification"; - readonly EMAIL_EXISTS: "auth/email-already-in-use"; - readonly EMULATOR_CONFIG_FAILED: "auth/emulator-config-failed"; - readonly EXPIRED_OOB_CODE: "auth/expired-action-code"; - readonly EXPIRED_POPUP_REQUEST: "auth/cancelled-popup-request"; - readonly INTERNAL_ERROR: "auth/internal-error"; - readonly INVALID_API_KEY: "auth/invalid-api-key"; - readonly INVALID_APP_CREDENTIAL: "auth/invalid-app-credential"; - readonly INVALID_APP_ID: "auth/invalid-app-id"; - readonly INVALID_AUTH: "auth/invalid-user-token"; - readonly INVALID_AUTH_EVENT: "auth/invalid-auth-event"; - readonly INVALID_CERT_HASH: "auth/invalid-cert-hash"; - readonly INVALID_CODE: "auth/invalid-verification-code"; - readonly INVALID_CONTINUE_URI: "auth/invalid-continue-uri"; - readonly INVALID_CORDOVA_CONFIGURATION: "auth/invalid-cordova-configuration"; - readonly INVALID_CUSTOM_TOKEN: "auth/invalid-custom-token"; - readonly INVALID_DYNAMIC_LINK_DOMAIN: "auth/invalid-dynamic-link-domain"; - readonly INVALID_EMAIL: "auth/invalid-email"; - readonly INVALID_EMULATOR_SCHEME: "auth/invalid-emulator-scheme"; - readonly INVALID_IDP_RESPONSE: "auth/invalid-credential"; - readonly INVALID_LOGIN_CREDENTIALS: "auth/invalid-credential"; - readonly INVALID_MESSAGE_PAYLOAD: "auth/invalid-message-payload"; - readonly INVALID_MFA_SESSION: "auth/invalid-multi-factor-session"; - readonly INVALID_OAUTH_CLIENT_ID: "auth/invalid-oauth-client-id"; - readonly INVALID_OAUTH_PROVIDER: "auth/invalid-oauth-provider"; - readonly INVALID_OOB_CODE: "auth/invalid-action-code"; - readonly INVALID_ORIGIN: "auth/unauthorized-domain"; - readonly INVALID_PASSWORD: "auth/wrong-password"; - readonly INVALID_PERSISTENCE: "auth/invalid-persistence-type"; - readonly INVALID_PHONE_NUMBER: "auth/invalid-phone-number"; - readonly INVALID_PROVIDER_ID: "auth/invalid-provider-id"; - readonly INVALID_RECIPIENT_EMAIL: "auth/invalid-recipient-email"; - readonly INVALID_SENDER: "auth/invalid-sender"; - readonly INVALID_SESSION_INFO: "auth/invalid-verification-id"; - readonly INVALID_TENANT_ID: "auth/invalid-tenant-id"; - readonly MFA_INFO_NOT_FOUND: "auth/multi-factor-info-not-found"; - readonly MFA_REQUIRED: "auth/multi-factor-auth-required"; - readonly MISSING_ANDROID_PACKAGE_NAME: "auth/missing-android-pkg-name"; - readonly MISSING_APP_CREDENTIAL: "auth/missing-app-credential"; - readonly MISSING_AUTH_DOMAIN: "auth/auth-domain-config-required"; - readonly MISSING_CODE: "auth/missing-verification-code"; - readonly MISSING_CONTINUE_URI: "auth/missing-continue-uri"; - readonly MISSING_IFRAME_START: "auth/missing-iframe-start"; - readonly MISSING_IOS_BUNDLE_ID: "auth/missing-ios-bundle-id"; - readonly MISSING_OR_INVALID_NONCE: "auth/missing-or-invalid-nonce"; - readonly MISSING_MFA_INFO: "auth/missing-multi-factor-info"; - readonly MISSING_MFA_SESSION: "auth/missing-multi-factor-session"; - readonly MISSING_PHONE_NUMBER: "auth/missing-phone-number"; - readonly MISSING_PASSWORD: "auth/missing-password"; - readonly MISSING_SESSION_INFO: "auth/missing-verification-id"; - readonly MODULE_DESTROYED: "auth/app-deleted"; - readonly NEED_CONFIRMATION: "auth/account-exists-with-different-credential"; - readonly NETWORK_REQUEST_FAILED: "auth/network-request-failed"; - readonly NULL_USER: "auth/null-user"; - readonly NO_AUTH_EVENT: "auth/no-auth-event"; - readonly NO_SUCH_PROVIDER: "auth/no-such-provider"; - readonly OPERATION_NOT_ALLOWED: "auth/operation-not-allowed"; - readonly OPERATION_NOT_SUPPORTED: "auth/operation-not-supported-in-this-environment"; - readonly POPUP_BLOCKED: "auth/popup-blocked"; - readonly POPUP_CLOSED_BY_USER: "auth/popup-closed-by-user"; - readonly PROVIDER_ALREADY_LINKED: "auth/provider-already-linked"; - readonly QUOTA_EXCEEDED: "auth/quota-exceeded"; - readonly REDIRECT_CANCELLED_BY_USER: "auth/redirect-cancelled-by-user"; - readonly REDIRECT_OPERATION_PENDING: "auth/redirect-operation-pending"; - readonly REJECTED_CREDENTIAL: "auth/rejected-credential"; - readonly SECOND_FACTOR_ALREADY_ENROLLED: "auth/second-factor-already-in-use"; - readonly SECOND_FACTOR_LIMIT_EXCEEDED: "auth/maximum-second-factor-count-exceeded"; - readonly TENANT_ID_MISMATCH: "auth/tenant-id-mismatch"; - readonly TIMEOUT: "auth/timeout"; - readonly TOKEN_EXPIRED: "auth/user-token-expired"; - readonly TOO_MANY_ATTEMPTS_TRY_LATER: "auth/too-many-requests"; - readonly UNAUTHORIZED_DOMAIN: "auth/unauthorized-continue-uri"; - readonly UNSUPPORTED_FIRST_FACTOR: "auth/unsupported-first-factor"; - readonly UNSUPPORTED_PERSISTENCE: "auth/unsupported-persistence-type"; - readonly UNSUPPORTED_TENANT_OPERATION: "auth/unsupported-tenant-operation"; - readonly UNVERIFIED_EMAIL: "auth/unverified-email"; - readonly USER_CANCELLED: "auth/user-cancelled"; - readonly USER_DELETED: "auth/user-not-found"; - readonly USER_DISABLED: "auth/user-disabled"; - readonly USER_MISMATCH: "auth/user-mismatch"; - readonly USER_SIGNED_OUT: "auth/user-signed-out"; - readonly WEAK_PASSWORD: "auth/weak-password"; - readonly WEB_STORAGE_UNSUPPORTED: "auth/web-storage-unsupported"; - readonly ALREADY_INITIALIZED: "auth/already-initialized"; - readonly RECAPTCHA_NOT_ENABLED: "auth/recaptcha-not-enabled"; - readonly MISSING_RECAPTCHA_TOKEN: "auth/missing-recaptcha-token"; - readonly INVALID_RECAPTCHA_TOKEN: "auth/invalid-recaptcha-token"; - readonly INVALID_RECAPTCHA_ACTION: "auth/invalid-recaptcha-action"; - readonly MISSING_CLIENT_TYPE: "auth/missing-client-type"; - readonly MISSING_RECAPTCHA_VERSION: "auth/missing-recaptcha-version"; - readonly INVALID_RECAPTCHA_VERSION: "auth/invalid-recaptcha-version"; - readonly INVALID_REQ_TYPE: "auth/invalid-req-type"; - readonly INVALID_HOSTING_LINK_DOMAIN: "auth/invalid-hosting-link-domain"; -}; -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/index.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/index.d.ts deleted file mode 100644 index 8829292..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/index.d.ts +++ /dev/null @@ -1,230 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth, NextOrObserver, Persistence, User, CompleteFn, ErrorFn, Unsubscribe, PasswordValidationStatus } from '../model/public_types'; -export { debugErrorMap, prodErrorMap, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as AuthErrorCodes } from './errors'; -/** - * Changes the type of persistence on the {@link Auth} instance for the currently saved - * `Auth` session and applies this type of persistence for future sign-in requests, including - * sign-in with redirect requests. - * - * @remarks - * This makes it easy for a user signing in to specify whether their session should be - * remembered or not. It also makes it easier to never persist the `Auth` state for applications - * that are shared by other users or have sensitive data. - * - * This method does not work in a Node.js environment or with {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * setPersistence(auth, browserSessionPersistence); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param persistence - The {@link Persistence} to use. - * @returns A `Promise` that resolves once the persistence change has completed - * - * @public - */ -export declare function setPersistence(auth: Auth, persistence: Persistence): Promise<void>; -/** - * Loads the reCAPTCHA configuration into the `Auth` instance. - * - * @remarks - * This will load the reCAPTCHA config, which indicates whether the reCAPTCHA - * verification flow should be triggered for each auth provider, into the - * current Auth session. - * - * If initializeRecaptchaConfig() is not invoked, the auth flow will always start - * without reCAPTCHA verification. If the provider is configured to require reCAPTCHA - * verification, the SDK will transparently load the reCAPTCHA config and restart the - * auth flows. - * - * Thus, by calling this optional method, you will reduce the latency of future auth flows. - * Loading the reCAPTCHA config early will also enhance the signal collected by reCAPTCHA. - * - * This method does not work in a Node.js environment. - * - * @example - * ```javascript - * initializeRecaptchaConfig(auth); - * ``` - * - * @param auth - The {@link Auth} instance. - * - * @public - */ -export declare function initializeRecaptchaConfig(auth: Auth): Promise<void>; -/** - * Validates the password against the password policy configured for the project or tenant. - * - * @remarks - * If no tenant ID is set on the `Auth` instance, then this method will use the password - * policy configured for the project. Otherwise, this method will use the policy configured - * for the tenant. If a password policy has not been configured, then the default policy - * configured for all projects will be used. - * - * If an auth flow fails because a submitted password does not meet the password policy - * requirements and this method has previously been called, then this method will use the - * most recent policy available when called again. - * - * @example - * ```javascript - * validatePassword(auth, 'some-password'); - * ``` - * - * @param auth The {@link Auth} instance. - * @param password The password to validate. - * - * @public - */ -export declare function validatePassword(auth: Auth, password: string): Promise<PasswordValidationStatus>; -/** - * Adds an observer for changes to the signed-in user's ID token. - * - * @remarks - * This includes sign-in, sign-out, and token refresh events. - * This will not be triggered automatically upon ID token expiration. Use {@link User.getIdToken} to refresh the ID token. - * - * @param auth - The {@link Auth} instance. - * @param nextOrObserver - callback triggered on change. - * @param error - Deprecated. This callback is never triggered. Errors - * on signing in/out can be caught in promises returned from - * sign-in/sign-out functions. - * @param completed - Deprecated. This callback is never triggered. - * - * @public - */ -export declare function onIdTokenChanged(auth: Auth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe; -/** - * Adds a blocking callback that runs before an auth state change - * sets a new user. - * - * @param auth - The {@link Auth} instance. - * @param callback - callback triggered before new user value is set. - * If this throws, it blocks the user from being set. - * @param onAbort - callback triggered if a later `beforeAuthStateChanged()` - * callback throws, allowing you to undo any side effects. - */ -export declare function beforeAuthStateChanged(auth: Auth, callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe; -/** - * Adds an observer for changes to the user's sign-in state. - * - * @remarks - * To keep the old behavior, see {@link onIdTokenChanged}. - * - * @param auth - The {@link Auth} instance. - * @param nextOrObserver - callback triggered on change. - * @param error - Deprecated. This callback is never triggered. Errors - * on signing in/out can be caught in promises returned from - * sign-in/sign-out functions. - * @param completed - Deprecated. This callback is never triggered. - * - * @public - */ -export declare function onAuthStateChanged(auth: Auth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe; -/** - * Sets the current language to the default device/browser preference. - * - * @param auth - The {@link Auth} instance. - * - * @public - */ -export declare function useDeviceLanguage(auth: Auth): void; -/** - * Asynchronously sets the provided user as {@link Auth.currentUser} on the - * {@link Auth} instance. - * - * @remarks - * A new instance copy of the user provided will be made and set as currentUser. - * - * This will trigger {@link onAuthStateChanged} and {@link onIdTokenChanged} listeners - * like other sign in methods. - * - * The operation fails with an error if the user to be updated belongs to a different Firebase - * project. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * @param user - The new {@link User}. - * - * @public - */ -export declare function updateCurrentUser(auth: Auth, user: User | null): Promise<void>; -/** - * Signs out the current user. - * - * @remarks - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * - * @public - */ -export declare function signOut(auth: Auth): Promise<void>; -/** - * Revokes the given access token. Currently only supports Apple OAuth access tokens. - * - * @param auth - The {@link Auth} instance. - * @param token - The Apple OAuth access token. - * - * @public - */ -export declare function revokeAccessToken(auth: Auth, token: string): Promise<void>; -export { initializeAuth } from './auth/initialize'; -export { connectAuthEmulator } from './auth/emulator'; -export { AuthCredential } from './credentials'; -export { EmailAuthCredential } from './credentials/email'; -export { OAuthCredential } from './credentials/oauth'; -export { PhoneAuthCredential } from './credentials/phone'; -export { inMemoryPersistence } from './persistence/in_memory'; -export { EmailAuthProvider } from './providers/email'; -export { FacebookAuthProvider } from './providers/facebook'; -export { CustomParameters } from './providers/federated'; -export { GoogleAuthProvider } from './providers/google'; -export { GithubAuthProvider } from './providers/github'; -export { OAuthProvider, OAuthCredentialOptions } from './providers/oauth'; -export { SAMLAuthProvider } from './providers/saml'; -export { TwitterAuthProvider } from './providers/twitter'; -export { signInAnonymously } from './strategies/anonymous'; -export { signInWithCredential, linkWithCredential, reauthenticateWithCredential } from './strategies/credential'; -export { signInWithCustomToken } from './strategies/custom_token'; -export { sendPasswordResetEmail, confirmPasswordReset, applyActionCode, checkActionCode, verifyPasswordResetCode, createUserWithEmailAndPassword, signInWithEmailAndPassword } from './strategies/email_and_password'; -export { sendSignInLinkToEmail, isSignInWithEmailLink, signInWithEmailLink } from './strategies/email_link'; -export { fetchSignInMethodsForEmail, sendEmailVerification, verifyBeforeUpdateEmail } from './strategies/email'; -export { ActionCodeURL, parseActionCodeURL } from './action_code_url'; -export { updateProfile, updateEmail, updatePassword } from './user/account_info'; -export { getIdToken, getIdTokenResult } from './user/id_token_result'; -export { unlink } from './user/link_unlink'; -export { getAdditionalUserInfo } from './user/additional_user_info'; -export { reload } from './user/reload'; -/** - * Deletes and signs out the user. - * - * @remarks - * Important: this is a security-sensitive operation that requires the user to have recently - * signed in. If this requirement isn't met, ask the user to authenticate again and then call - * {@link reauthenticateWithCredential}. - * - * @param user - The user. - * - * @public - */ -export declare function deleteUser(user: User): Promise<void>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/persistence/in_memory.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/persistence/in_memory.d.ts deleted file mode 100644 index 60278cd..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/persistence/in_memory.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Persistence } from '../../model/public_types'; -import { PersistenceInternal, PersistenceType, PersistenceValue, StorageEventListener } from '../persistence'; -export declare class InMemoryPersistence implements PersistenceInternal { - static type: 'NONE'; - readonly type = PersistenceType.NONE; - storage: Record<string, PersistenceValue>; - _isAvailable(): Promise<boolean>; - _set(key: string, value: PersistenceValue): Promise<void>; - _get<T extends PersistenceValue>(key: string): Promise<T | null>; - _remove(key: string): Promise<void>; - _addListener(_key: string, _listener: StorageEventListener): void; - _removeListener(_key: string, _listener: StorageEventListener): void; -} -/** - * An implementation of {@link Persistence} of type 'NONE'. - * - * @public - */ -export declare const inMemoryPersistence: Persistence; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/persistence/index.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/persistence/index.d.ts deleted file mode 100644 index 4460f02..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/persistence/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Persistence } from '../../model/public_types'; -export declare const enum PersistenceType { - SESSION = "SESSION", - LOCAL = "LOCAL", - NONE = "NONE", - COOKIE = "COOKIE" -} -export type PersistedBlob = Record<string, unknown>; -export interface Instantiator<T> { - (blob: PersistedBlob): T; -} -export type PersistenceValue = PersistedBlob | string; -export declare const STORAGE_AVAILABLE_KEY = "__sak"; -export interface StorageEventListener { - (value: PersistenceValue | null): void; -} -export interface PersistenceInternal extends Persistence { - type: PersistenceType; - _isAvailable(): Promise<boolean>; - _set(key: string, value: PersistenceValue): Promise<void>; - _get<T extends PersistenceValue>(key: string): Promise<T | null>; - _remove(key: string): Promise<void>; - _addListener(key: string, listener: StorageEventListener): void; - _removeListener(key: string, listener: StorageEventListener): void; - _shouldAllowMigration?: boolean; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/persistence/persistence_user_manager.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/persistence/persistence_user_manager.d.ts deleted file mode 100644 index 7aca0d8..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/persistence/persistence_user_manager.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ApiKey, AppName, AuthInternal } from '../../model/auth'; -import { UserInternal } from '../../model/user'; -import { PersistenceInternal } from '../persistence'; -export declare const enum KeyName { - AUTH_USER = "authUser", - AUTH_EVENT = "authEvent", - REDIRECT_USER = "redirectUser", - PERSISTENCE_USER = "persistence" -} -export declare const enum Namespace { - PERSISTENCE = "firebase" -} -export declare function _persistenceKeyName(key: string, apiKey: ApiKey, appName: AppName): string; -export declare class PersistenceUserManager { - persistence: PersistenceInternal; - private readonly auth; - private readonly userKey; - private readonly fullUserKey; - private readonly fullPersistenceKey; - private readonly boundEventHandler; - private constructor(); - setCurrentUser(user: UserInternal): Promise<void>; - getCurrentUser(): Promise<UserInternal | null>; - removeCurrentUser(): Promise<void>; - savePersistenceForRedirect(): Promise<void>; - setPersistence(newPersistence: PersistenceInternal): Promise<void>; - delete(): void; - static create(auth: AuthInternal, persistenceHierarchy: PersistenceInternal[], userKey?: KeyName): Promise<PersistenceUserManager>; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/email.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/email.d.ts deleted file mode 100644 index be276ad..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/email.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthProvider } from '../../model/public_types'; -import { EmailAuthCredential } from '../credentials/email'; -/** - * Provider for generating {@link EmailAuthCredential}. - * - * @public - */ -export declare class EmailAuthProvider implements AuthProvider { - /** - * Always set to {@link ProviderId}.PASSWORD, even for email link. - */ - static readonly PROVIDER_ID: 'password'; - /** - * Always set to {@link SignInMethod}.EMAIL_PASSWORD. - */ - static readonly EMAIL_PASSWORD_SIGN_IN_METHOD: 'password'; - /** - * Always set to {@link SignInMethod}.EMAIL_LINK. - */ - static readonly EMAIL_LINK_SIGN_IN_METHOD: 'emailLink'; - /** - * Always set to {@link ProviderId}.PASSWORD, even for email link. - */ - readonly providerId: "password"; - /** - * Initialize an {@link AuthCredential} using an email and password. - * - * @example - * ```javascript - * const authCredential = EmailAuthProvider.credential(email, password); - * const userCredential = await signInWithCredential(auth, authCredential); - * ``` - * - * @example - * ```javascript - * const userCredential = await signInWithEmailAndPassword(auth, email, password); - * ``` - * - * @param email - Email address. - * @param password - User account password. - * @returns The auth provider credential. - */ - static credential(email: string, password: string): EmailAuthCredential; - /** - * Initialize an {@link AuthCredential} using an email and an email link after a sign in with - * email link operation. - * - * @example - * ```javascript - * const authCredential = EmailAuthProvider.credentialWithLink(auth, email, emailLink); - * const userCredential = await signInWithCredential(auth, authCredential); - * ``` - * - * @example - * ```javascript - * await sendSignInLinkToEmail(auth, email); - * // Obtain emailLink from user. - * const userCredential = await signInWithEmailLink(auth, email, emailLink); - * ``` - * - * @param auth - The {@link Auth} instance used to verify the link. - * @param email - Email address. - * @param emailLink - Sign-in email link. - * @returns - The auth provider credential. - */ - static credentialWithLink(email: string, emailLink: string): EmailAuthCredential; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/facebook.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/facebook.d.ts deleted file mode 100644 index cd8feca..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/facebook.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { UserCredential } from '../../model/public_types'; -import { FirebaseError } from '@firebase/util'; -import { OAuthCredential } from '../credentials/oauth'; -import { BaseOAuthProvider } from './oauth'; -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.FACEBOOK. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new FacebookAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('user_birthday'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = FacebookAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new FacebookAuthProvider(); - * provider.addScope('user_birthday'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = FacebookAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * ``` - * - * @public - */ -export declare class FacebookAuthProvider extends BaseOAuthProvider { - /** Always set to {@link SignInMethod}.FACEBOOK. */ - static readonly FACEBOOK_SIGN_IN_METHOD: 'facebook.com'; - /** Always set to {@link ProviderId}.FACEBOOK. */ - static readonly PROVIDER_ID: 'facebook.com'; - constructor(); - /** - * Creates a credential for Facebook. - * - * @example - * ```javascript - * // `event` from the Facebook auth.authResponseChange callback. - * const credential = FacebookAuthProvider.credential(event.authResponse.accessToken); - * const result = await signInWithCredential(credential); - * ``` - * - * @param accessToken - Facebook access token. - */ - static credential(accessToken: string): OAuthCredential; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): OAuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): OAuthCredential | null; - private static credentialFromTaggedObject; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/federated.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/federated.d.ts deleted file mode 100644 index 91d38b1..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/federated.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthProvider } from '../../model/public_types'; -/** - * Map of OAuth Custom Parameters. - * - * @public - */ -export type CustomParameters = Record<string, string>; -/** - * The base class for all Federated providers (OAuth (including OIDC), SAML). - * - * This class is not meant to be instantiated directly. - * - * @public - */ -export declare abstract class FederatedAuthProvider implements AuthProvider { - readonly providerId: string; - /** @internal */ - defaultLanguageCode: string | null; - /** @internal */ - private customParameters; - /** - * Constructor for generic OAuth providers. - * - * @param providerId - Provider for which credentials should be generated. - */ - constructor(providerId: string); - /** - * Set the language gode. - * - * @param languageCode - language code - */ - setDefaultLanguage(languageCode: string | null): void; - /** - * Sets the OAuth custom parameters to pass in an OAuth request for popup and redirect sign-in - * operations. - * - * @remarks - * For a detailed list, check the reserved required OAuth 2.0 parameters such as `client_id`, - * `redirect_uri`, `scope`, `response_type`, and `state` are not allowed and will be ignored. - * - * @param customOAuthParameters - The custom OAuth parameters to pass in the OAuth request. - */ - setCustomParameters(customOAuthParameters: CustomParameters): AuthProvider; - /** - * Retrieve the current list of {@link CustomParameters}. - */ - getCustomParameters(): CustomParameters; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/github.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/github.d.ts deleted file mode 100644 index b8b3ee9..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/github.d.ts +++ /dev/null @@ -1,89 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { UserCredential } from '../../model/public_types'; -import { FirebaseError } from '@firebase/util'; -import { OAuthCredential } from '../credentials/oauth'; -import { BaseOAuthProvider } from './oauth'; -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GITHUB. - * - * @remarks - * GitHub requires an OAuth 2.0 redirect, so you can either handle the redirect directly, or use - * the {@link signInWithPopup} handler: - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new GithubAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('repo'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a GitHub Access Token. - * const credential = GithubAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new GithubAuthProvider(); - * provider.addScope('repo'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a GitHub Access Token. - * const credential = GithubAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * ``` - * @public - */ -export declare class GithubAuthProvider extends BaseOAuthProvider { - /** Always set to {@link SignInMethod}.GITHUB. */ - static readonly GITHUB_SIGN_IN_METHOD: 'github.com'; - /** Always set to {@link ProviderId}.GITHUB. */ - static readonly PROVIDER_ID: 'github.com'; - constructor(); - /** - * Creates a credential for GitHub. - * - * @param accessToken - GitHub access token. - */ - static credential(accessToken: string): OAuthCredential; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): OAuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): OAuthCredential | null; - private static credentialFromTaggedObject; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/google.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/google.d.ts deleted file mode 100644 index 25d74c8..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/google.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { UserCredential } from '../../model/public_types'; -import { FirebaseError } from '@firebase/util'; -import { OAuthCredential } from '../credentials/oauth'; -import { BaseOAuthProvider } from './oauth'; -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GOOGLE. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new GoogleAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('profile'); - * provider.addScope('email'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Google Access Token. - * const credential = GoogleAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new GoogleAuthProvider(); - * provider.addScope('profile'); - * provider.addScope('email'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Google Access Token. - * const credential = GoogleAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * ``` - * - * @public - */ -export declare class GoogleAuthProvider extends BaseOAuthProvider { - /** Always set to {@link SignInMethod}.GOOGLE. */ - static readonly GOOGLE_SIGN_IN_METHOD: 'google.com'; - /** Always set to {@link ProviderId}.GOOGLE. */ - static readonly PROVIDER_ID: 'google.com'; - constructor(); - /** - * Creates a credential for Google. At least one of ID token and access token is required. - * - * @example - * ```javascript - * // \`googleUser\` from the onsuccess Google Sign In callback. - * const credential = GoogleAuthProvider.credential(googleUser.getAuthResponse().id_token); - * const result = await signInWithCredential(credential); - * ``` - * - * @param idToken - Google ID token. - * @param accessToken - Google access token. - */ - static credential(idToken?: string | null, accessToken?: string | null): OAuthCredential; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): OAuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): OAuthCredential | null; - private static credentialFromTaggedObject; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/oauth.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/oauth.d.ts deleted file mode 100644 index 3e8e664..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/oauth.d.ts +++ /dev/null @@ -1,151 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthProvider, UserCredential } from '../../model/public_types'; -import { OAuthCredential } from '../credentials/oauth'; -import { FirebaseError } from '@firebase/util'; -import { FederatedAuthProvider } from './federated'; -/** - * Defines the options for initializing an {@link OAuthCredential}. - * - * @remarks - * For ID tokens with nonce claim, the raw nonce has to also be provided. - * - * @public - */ -export interface OAuthCredentialOptions { - /** - * The OAuth ID token used to initialize the {@link OAuthCredential}. - */ - idToken?: string; - /** - * The OAuth access token used to initialize the {@link OAuthCredential}. - */ - accessToken?: string; - /** - * The raw nonce associated with the ID token. - * - * @remarks - * It is required when an ID token with a nonce field is provided. The SHA-256 hash of the - * raw nonce must match the nonce field in the ID token. - */ - rawNonce?: string; -} -/** - * Common code to all OAuth providers. This is separate from the - * {@link OAuthProvider} so that child providers (like - * {@link GoogleAuthProvider}) don't inherit the `credential` instance method. - * Instead, they rely on a static `credential` method. - */ -export declare abstract class BaseOAuthProvider extends FederatedAuthProvider implements AuthProvider { - /** @internal */ - private scopes; - /** - * Add an OAuth scope to the credential. - * - * @param scope - Provider OAuth scope to add. - */ - addScope(scope: string): AuthProvider; - /** - * Retrieve the current list of OAuth scopes. - */ - getScopes(): string[]; -} -/** - * Provider for generating generic {@link OAuthCredential}. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new OAuthProvider('google.com'); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('profile'); - * provider.addScope('email'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a OAuth Access Token for the provider. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new OAuthProvider('google.com'); - * provider.addScope('profile'); - * provider.addScope('email'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a OAuth Access Token for the provider. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * ``` - * @public - */ -export declare class OAuthProvider extends BaseOAuthProvider { - /** - * Creates an {@link OAuthCredential} from a JSON string or a plain object. - * @param json - A plain object or a JSON string - */ - static credentialFromJSON(json: object | string): OAuthCredential; - /** - * Creates a {@link OAuthCredential} from a generic OAuth provider's access token or ID token. - * - * @remarks - * The raw nonce is required when an ID token with a nonce field is provided. The SHA-256 hash of - * the raw nonce must match the nonce field in the ID token. - * - * @example - * ```javascript - * // `googleUser` from the onsuccess Google Sign In callback. - * // Initialize a generate OAuth provider with a `google.com` providerId. - * const provider = new OAuthProvider('google.com'); - * const credential = provider.credential({ - * idToken: googleUser.getAuthResponse().id_token, - * }); - * const result = await signInWithCredential(credential); - * ``` - * - * @param params - Either the options object containing the ID token, access token and raw nonce - * or the ID token string. - */ - credential(params: OAuthCredentialOptions): OAuthCredential; - /** An internal credential method that accepts more permissive options */ - private _credential; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): OAuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): OAuthCredential | null; - private static oauthCredentialFromTaggedObject; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/saml.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/saml.d.ts deleted file mode 100644 index 6017bfe..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/saml.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { FirebaseError } from '@firebase/util'; -import { UserCredential } from '../../model/public_types'; -import { AuthCredential } from '../credentials'; -import { FederatedAuthProvider } from './federated'; -/** - * An {@link AuthProvider} for SAML. - * - * @public - */ -export declare class SAMLAuthProvider extends FederatedAuthProvider { - /** - * Constructor. The providerId must start with "saml." - * @param providerId - SAML provider ID. - */ - constructor(providerId: string); - /** - * Generates an {@link AuthCredential} from a {@link UserCredential} after a - * successful SAML flow completes. - * - * @remarks - * - * For example, to get an {@link AuthCredential}, you could write the - * following code: - * - * ```js - * const userCredential = await signInWithPopup(auth, samlProvider); - * const credential = SAMLAuthProvider.credentialFromResult(userCredential); - * ``` - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): AuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): AuthCredential | null; - /** - * Creates an {@link AuthCredential} from a JSON string or a plain object. - * @param json - A plain object or a JSON string - */ - static credentialFromJSON(json: string | object): AuthCredential; - private static samlCredentialFromTaggedObject; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/twitter.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/twitter.d.ts deleted file mode 100644 index 612913d..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/providers/twitter.d.ts +++ /dev/null @@ -1,103 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @license - * Copyright 2020 Twitter LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { UserCredential } from '../../model/public_types'; -import { FirebaseError } from '@firebase/util'; -import { OAuthCredential } from '../credentials/oauth'; -import { BaseOAuthProvider } from './oauth'; -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.TWITTER. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new TwitterAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Twitter Access Token and Secret. - * const credential = TwitterAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * const secret = credential.secret; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new TwitterAuthProvider(); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Twitter Access Token and Secret. - * const credential = TwitterAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * const secret = credential.secret; - * ``` - * - * @public - */ -export declare class TwitterAuthProvider extends BaseOAuthProvider { - /** Always set to {@link SignInMethod}.TWITTER. */ - static readonly TWITTER_SIGN_IN_METHOD: 'twitter.com'; - /** Always set to {@link ProviderId}.TWITTER. */ - static readonly PROVIDER_ID: 'twitter.com'; - constructor(); - /** - * Creates a credential for Twitter. - * - * @param token - Twitter access token. - * @param secret - Twitter secret. - */ - static credential(token: string, secret: string): OAuthCredential; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): OAuthCredential | null; - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - static credentialFromError(error: FirebaseError): OAuthCredential | null; - private static credentialFromTaggedObject; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/abstract_popup_redirect_operation.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/abstract_popup_redirect_operation.d.ts deleted file mode 100644 index 6f5e076..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/abstract_popup_redirect_operation.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { FirebaseError } from '@firebase/util'; -import { AuthEvent, AuthEventConsumer, AuthEventType, PopupRedirectResolverInternal } from '../../model/popup_redirect'; -import { UserInternal, UserCredentialInternal } from '../../model/user'; -import { AuthInternal } from '../../model/auth'; -/** - * Popup event manager. Handles the popup's entire lifecycle; listens to auth - * events - */ -export declare abstract class AbstractPopupRedirectOperation implements AuthEventConsumer { - protected readonly auth: AuthInternal; - protected readonly resolver: PopupRedirectResolverInternal; - protected user?: UserInternal | undefined; - protected readonly bypassAuthState: boolean; - private pendingPromise; - private eventManager; - readonly filter: AuthEventType[]; - abstract eventId: string | null; - constructor(auth: AuthInternal, filter: AuthEventType | AuthEventType[], resolver: PopupRedirectResolverInternal, user?: UserInternal | undefined, bypassAuthState?: boolean); - abstract onExecution(): Promise<void>; - execute(): Promise<UserCredentialInternal | null>; - onAuthEvent(event: AuthEvent): Promise<void>; - onError(error: FirebaseError): void; - private getIdpTask; - protected resolve(cred: UserCredentialInternal | null): void; - protected reject(error: Error): void; - private unregisterAndCleanUp; - abstract cleanUp(): void; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/action_code_settings.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/action_code_settings.d.ts deleted file mode 100644 index 23fa039..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/action_code_settings.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ActionCodeSettings, Auth } from '../../model/public_types'; -import { GetOobCodeRequest } from '../../api/authentication/email_and_password'; -export declare function _setActionCodeSettingsOnRequest(auth: Auth, request: GetOobCodeRequest, actionCodeSettings: ActionCodeSettings): void; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/anonymous.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/anonymous.d.ts deleted file mode 100644 index 687a797..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/anonymous.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth, UserCredential } from '../../model/public_types'; -/** - * Asynchronously signs in as an anonymous user. - * - * @remarks - * If there is already an anonymous user signed in, that user will be returned; otherwise, a - * new anonymous user identity will be created and returned. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * - * @public - */ -export declare function signInAnonymously(auth: Auth): Promise<UserCredential>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/credential.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/credential.d.ts deleted file mode 100644 index 392d663..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/credential.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { UserCredential, Auth, User } from '../../model/public_types'; -import { AuthInternal } from '../../model/auth'; -import { AuthCredential } from '../credentials'; -export declare function _signInWithCredential(auth: AuthInternal, credential: AuthCredential, bypassAuthState?: boolean): Promise<UserCredential>; -/** - * Asynchronously signs in with the given credentials. - * - * @remarks - * An {@link AuthProvider} can be used to generate the credential. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * @param credential - The auth credential. - * - * @public - */ -export declare function signInWithCredential(auth: Auth, credential: AuthCredential): Promise<UserCredential>; -/** - * Links the user account with the given credentials. - * - * @remarks - * An {@link AuthProvider} can be used to generate the credential. - * - * @param user - The user. - * @param credential - The auth credential. - * - * @public - */ -export declare function linkWithCredential(user: User, credential: AuthCredential): Promise<UserCredential>; -/** - * Re-authenticates a user using a fresh credential. - * - * @remarks - * Use before operations such as {@link updatePassword} that require tokens from recent sign-in - * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error - * or a `TOKEN_EXPIRED` error. - * - * This method is not supported on any {@link User} signed in by {@link Auth} instances - * created with a {@link @firebase/app#FirebaseServerApp}. - * - * @param user - The user. - * @param credential - The auth credential. - * - * @public - */ -export declare function reauthenticateWithCredential(user: User, credential: AuthCredential): Promise<UserCredential>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/custom_token.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/custom_token.d.ts deleted file mode 100644 index e95cc38..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/custom_token.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth, UserCredential } from '../../model/public_types'; -/** - * Asynchronously signs in using a custom token. - * - * @remarks - * Custom tokens are used to integrate Firebase Auth with existing auth systems, and must - * be generated by an auth backend using the - * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#createcustomtoken | createCustomToken} - * method in the {@link https://firebase.google.com/docs/auth/admin | Admin SDK} . - * - * Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @param auth - The {@link Auth} instance. - * @param customToken - The custom token to sign in with. - * - * @public - */ -export declare function signInWithCustomToken(auth: Auth, customToken: string): Promise<UserCredential>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/email.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/email.d.ts deleted file mode 100644 index 3505c34..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/email.d.ts +++ /dev/null @@ -1,104 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ActionCodeSettings, Auth, User } from '../../model/public_types'; -/** - * Gets the list of possible sign in methods for the given email address. This method returns an - * empty list when - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection} - * is enabled, irrespective of the number of authentication methods available for the given email. - * - * @remarks - * This is useful to differentiate methods of sign-in for the same provider, eg. - * {@link EmailAuthProvider} which has 2 methods of sign-in, - * {@link SignInMethod}.EMAIL_PASSWORD and - * {@link SignInMethod}.EMAIL_LINK. - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * - * Deprecated. Migrating off of this method is recommended as a security best-practice. - * Learn more in the Identity Platform documentation for - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}. - * @public - */ -export declare function fetchSignInMethodsForEmail(auth: Auth, email: string): Promise<string[]>; -/** - * Sends a verification email to a user. - * - * @remarks - * The verification process is completed by calling {@link applyActionCode}. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendEmailVerification(user, actionCodeSettings); - * // Obtain code from the user. - * await applyActionCode(auth, code); - * ``` - * - * @param user - The user. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ -export declare function sendEmailVerification(user: User, actionCodeSettings?: ActionCodeSettings | null): Promise<void>; -/** - * Sends a verification email to a new email address. - * - * @remarks - * The user's email will be updated to the new one after being verified. - * - * If you have a custom email action handler, you can complete the verification process by calling - * {@link applyActionCode}. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await verifyBeforeUpdateEmail(user, 'newemail@example.com', actionCodeSettings); - * // Obtain code from the user. - * await applyActionCode(auth, code); - * ``` - * - * @param user - The user. - * @param newEmail - The new email address to be verified before update. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ -export declare function verifyBeforeUpdateEmail(user: User, newEmail: string, actionCodeSettings?: ActionCodeSettings | null): Promise<void>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/email_and_password.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/email_and_password.d.ts deleted file mode 100644 index 205f33a..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/email_and_password.d.ts +++ /dev/null @@ -1,139 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ActionCodeInfo, ActionCodeSettings, Auth, UserCredential } from '../../model/public_types'; -/** - * Sends a password reset email to the given email address. This method does not throw an error when - * there's no user account with the given email address and - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection} - * is enabled. - * - * @remarks - * To complete the password reset, call {@link confirmPasswordReset} with the code supplied in - * the email sent to the user, along with the new password specified by the user. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendPasswordResetEmail(auth, 'user@example.com', actionCodeSettings); - * // Obtain code from user. - * await confirmPasswordReset('user@example.com', code); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ -export declare function sendPasswordResetEmail(auth: Auth, email: string, actionCodeSettings?: ActionCodeSettings): Promise<void>; -/** - * Completes the password reset process, given a confirmation code and new password. - * - * @param auth - The {@link Auth} instance. - * @param oobCode - A confirmation code sent to the user. - * @param newPassword - The new password. - * - * @public - */ -export declare function confirmPasswordReset(auth: Auth, oobCode: string, newPassword: string): Promise<void>; -/** - * Applies a verification code sent to the user by email or other out-of-band mechanism. - * - * @param auth - The {@link Auth} instance. - * @param oobCode - A verification code sent to the user. - * - * @public - */ -export declare function applyActionCode(auth: Auth, oobCode: string): Promise<void>; -/** - * Checks a verification code sent to the user by email or other out-of-band mechanism. - * - * @returns metadata about the code. - * - * @param auth - The {@link Auth} instance. - * @param oobCode - A verification code sent to the user. - * - * @public - */ -export declare function checkActionCode(auth: Auth, oobCode: string): Promise<ActionCodeInfo>; -/** - * Checks a password reset code sent to the user by email or other out-of-band mechanism. - * - * @returns the user's email address if valid. - * - * @param auth - The {@link Auth} instance. - * @param code - A verification code sent to the user. - * - * @public - */ -export declare function verifyPasswordResetCode(auth: Auth, code: string): Promise<string>; -/** - * Creates a new user account associated with the specified email address and password. - * - * @remarks - * On successful creation of the user account, this user will also be signed in to your application. - * - * User account creation can fail if the account already exists or the password is invalid. - * - * This method is not supported on {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * Note: The email address acts as a unique identifier for the user and enables an email-based - * password reset. This function will create a new user account and set the initial user password. - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * @param password - The user's chosen password. - * - * @public - */ -export declare function createUserWithEmailAndPassword(auth: Auth, email: string, password: string): Promise<UserCredential>; -/** - * Asynchronously signs in using an email and password. - * - * @remarks - * Fails with an error if the email address and password do not match. When - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection} - * is enabled, this method fails with "auth/invalid-credential" in case of an invalid - * email/password. - * - * This method is not supported on {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * Note: The user's password is NOT the password used to access the user's email account. The - * email address serves as a unique identifier for the user, and the password is used to access - * the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}. - * - * - * @param auth - The {@link Auth} instance. - * @param email - The users email address. - * @param password - The users password. - * - * @public - */ -export declare function signInWithEmailAndPassword(auth: Auth, email: string, password: string): Promise<UserCredential>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/email_link.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/email_link.d.ts deleted file mode 100644 index 8d01e8a..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/email_link.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ActionCodeSettings, Auth, UserCredential } from '../../model/public_types'; -/** - * Sends a sign-in email link to the user with the specified email. - * - * @remarks - * The sign-in operation has to always be completed in the app unlike other out of band email - * actions (password reset and email verifications). This is because, at the end of the flow, - * the user is expected to be signed in and their Auth state persisted within the app. - * - * To complete sign in with the email link, call {@link signInWithEmailLink} with the email - * address and the email link supplied in the email sent to the user. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings); - * // Obtain emailLink from the user. - * if(isSignInWithEmailLink(auth, emailLink)) { - * await signInWithEmailLink(auth, 'user@example.com', emailLink); - * } - * ``` - * - * @param authInternal - The {@link Auth} instance. - * @param email - The user's email address. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ -export declare function sendSignInLinkToEmail(auth: Auth, email: string, actionCodeSettings: ActionCodeSettings): Promise<void>; -/** - * Checks if an incoming link is a sign-in with email link suitable for {@link signInWithEmailLink}. - * - * @param auth - The {@link Auth} instance. - * @param emailLink - The link sent to the user's email address. - * - * @public - */ -export declare function isSignInWithEmailLink(auth: Auth, emailLink: string): boolean; -/** - * Asynchronously signs in using an email and sign-in email link. - * - * @remarks - * If no link is passed, the link is inferred from the current URL. - * - * Fails with an error if the email address is invalid or OTP in email link expires. - * - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings); - * // Obtain emailLink from the user. - * if(isSignInWithEmailLink(auth, emailLink)) { - * await signInWithEmailLink(auth, 'user@example.com', emailLink); - * } - * ``` - * - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * @param emailLink - The link sent to the user's email address. - * - * @public - */ -export declare function signInWithEmailLink(auth: Auth, email: string, emailLink?: string): Promise<UserCredential>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/idp.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/idp.d.ts deleted file mode 100644 index 179d4f7..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/idp.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthInternal } from '../../model/auth'; -import { UserInternal, UserCredentialInternal } from '../../model/user'; -export interface IdpTaskParams { - auth: AuthInternal; - requestUri: string; - sessionId?: string; - tenantId?: string; - postBody?: string; - pendingToken?: string; - user?: UserInternal; - bypassAuthState?: boolean; -} -export type IdpTask = (params: IdpTaskParams) => Promise<UserCredentialInternal>; -export declare function _signIn(params: IdpTaskParams): Promise<UserCredentialInternal>; -export declare function _reauth(params: IdpTaskParams): Promise<UserCredentialInternal>; -export declare function _link(params: IdpTaskParams): Promise<UserCredentialInternal>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/redirect.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/redirect.d.ts deleted file mode 100644 index 10178ef..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/strategies/redirect.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthInternal } from '../../model/auth'; -import { AuthEvent, PopupRedirectResolverInternal } from '../../model/popup_redirect'; -import { UserCredentialInternal } from '../../model/user'; -import { AbstractPopupRedirectOperation } from './abstract_popup_redirect_operation'; -export declare class RedirectAction extends AbstractPopupRedirectOperation { - eventId: null; - constructor(auth: AuthInternal, resolver: PopupRedirectResolverInternal, bypassAuthState?: boolean); - /** - * Override the execute function; if we already have a redirect result, then - * just return it. - */ - execute(): Promise<UserCredentialInternal | null>; - onAuthEvent(event: AuthEvent): Promise<void>; - onExecution(): Promise<void>; - cleanUp(): void; -} -export declare function _getAndClearPendingRedirectStatus(resolver: PopupRedirectResolverInternal, auth: AuthInternal): Promise<boolean>; -export declare function _setPendingRedirectStatus(resolver: PopupRedirectResolverInternal, auth: AuthInternal): Promise<void>; -export declare function _clearRedirectOutcomes(): void; -export declare function _overrideRedirectResult(auth: AuthInternal, result: () => Promise<UserCredentialInternal | null>): void; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/account_info.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/account_info.d.ts deleted file mode 100644 index 312e23c..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/account_info.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { User } from '../../model/public_types'; -/** - * Updates a user's profile data. - * - * @param user - The user. - * @param profile - The profile's `displayName` and `photoURL` to update. - * - * @public - */ -export declare function updateProfile(user: User, { displayName, photoURL: photoUrl }: { - displayName?: string | null; - photoURL?: string | null; -}): Promise<void>; -/** - * Updates the user's email address. - * - * @remarks - * An email will be sent to the original email address (if it was set) that allows to revoke the - * email address change, in order to protect them from account hijacking. - * - * This method is not supported on any {@link User} signed in by {@link Auth} instances - * created with a {@link @firebase/app#FirebaseServerApp}. - * - * Important: this is a security sensitive operation that requires the user to have recently signed - * in. If this requirement isn't met, ask the user to authenticate again and then call - * {@link reauthenticateWithCredential}. - * - * @param user - The user. - * @param newEmail - The new email address. - * - * Throws "auth/operation-not-allowed" error when - * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection} - * is enabled. - * Deprecated - Use {@link verifyBeforeUpdateEmail} instead. - * - * @public - */ -export declare function updateEmail(user: User, newEmail: string): Promise<void>; -/** - * Updates the user's password. - * - * @remarks - * Important: this is a security sensitive operation that requires the user to have recently signed - * in. If this requirement isn't met, ask the user to authenticate again and then call - * {@link reauthenticateWithCredential}. - * - * @param user - The user. - * @param newPassword - The new password. - * - * @public - */ -export declare function updatePassword(user: User, newPassword: string): Promise<void>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/additional_user_info.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/additional_user_info.d.ts deleted file mode 100644 index d5fd65b..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/additional_user_info.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AdditionalUserInfo, UserCredential } from '../../model/public_types'; -import { IdTokenResponse } from '../../model/id_token'; -/** - * Parse the `AdditionalUserInfo` from the ID token response. - * - */ -export declare function _fromIdTokenResponse(idTokenResponse?: IdTokenResponse): AdditionalUserInfo | null; -/** - * Extracts provider specific {@link AdditionalUserInfo} for the given credential. - * - * @param userCredential - The user credential. - * - * @public - */ -export declare function getAdditionalUserInfo(userCredential: UserCredential): AdditionalUserInfo | null; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/id_token_result.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/id_token_result.d.ts deleted file mode 100644 index c1b2032..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/id_token_result.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { IdTokenResult, ParsedToken, User } from '../../model/public_types'; -/** - * Returns a JSON Web Token (JWT) used to identify the user to a Firebase service. - * - * @remarks - * Returns the current token if it has not expired or if it will not expire in the next five - * minutes. Otherwise, this will refresh the token and return a new one. - * - * @param user - The user. - * @param forceRefresh - Force refresh regardless of token expiration. - * - * @public - */ -export declare function getIdToken(user: User, forceRefresh?: boolean): Promise<string>; -/** - * Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service. - * - * @remarks - * Returns the current token if it has not expired or if it will not expire in the next five - * minutes. Otherwise, this will refresh the token and return a new one. - * - * @param user - The user. - * @param forceRefresh - Force refresh regardless of token expiration. - * - * @public - */ -export declare function getIdTokenResult(user: User, forceRefresh?: boolean): Promise<IdTokenResult>; -export declare function _parseToken(token: string): ParsedToken | null; -/** - * Extract expiresIn TTL from a token by subtracting the expiration from the issuance. - */ -export declare function _tokenExpiresIn(token: string): number; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/invalidation.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/invalidation.d.ts deleted file mode 100644 index 81446ea..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/invalidation.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { UserInternal } from '../../model/user'; -export declare function _logoutIfInvalidated<T>(user: UserInternal, promise: Promise<T>, bypassAuthState?: boolean): Promise<T>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/link_unlink.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/link_unlink.d.ts deleted file mode 100644 index 9408524..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/link_unlink.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { User } from '../../model/public_types'; -import { UserInternal, UserCredentialInternal } from '../../model/user'; -import { AuthCredential } from '../credentials'; -/** - * Unlinks a provider from a user account. - * - * @param user - The user. - * @param providerId - The provider to unlink. - * - * @public - */ -export declare function unlink(user: User, providerId: string): Promise<User>; -export declare function _link(user: UserInternal, credential: AuthCredential, bypassAuthState?: boolean): Promise<UserCredentialInternal>; -export declare function _assertLinkedStatus(expected: boolean, user: UserInternal, provider: string): Promise<void>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/proactive_refresh.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/proactive_refresh.d.ts deleted file mode 100644 index ff52286..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/proactive_refresh.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { UserInternal } from '../../model/user'; -export declare const enum Duration { - OFFSET = 300000, - RETRY_BACKOFF_MIN = 30000, - RETRY_BACKOFF_MAX = 960000 -} -export declare class ProactiveRefresh { - private readonly user; - private isRunning; - private timerId; - private errorBackoff; - constructor(user: UserInternal); - _start(): void; - _stop(): void; - private getInterval; - private schedule; - private iteration; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/reauthenticate.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/reauthenticate.d.ts deleted file mode 100644 index 1855132..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/reauthenticate.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { UserInternal } from '../../model/user'; -import { AuthCredential } from '../credentials'; -import { UserCredentialImpl } from './user_credential_impl'; -export declare function _reauthenticate(user: UserInternal, credential: AuthCredential, bypassAuthState?: boolean): Promise<UserCredentialImpl>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/reload.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/reload.d.ts deleted file mode 100644 index f2690fa..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/reload.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { User, UserInfo } from '../../model/public_types'; -import { ProviderUserInfo } from '../../api/account_management/account'; -import { UserInternal } from '../../model/user'; -export declare function _reloadWithoutSaving(user: UserInternal): Promise<void>; -/** - * Reloads user account data, if signed in. - * - * @param user - The user. - * - * @public - */ -export declare function reload(user: User): Promise<void>; -export declare function extractProviderData(providers: ProviderUserInfo[]): UserInfo[]; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/token_manager.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/token_manager.d.ts deleted file mode 100644 index 790e283..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/token_manager.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { FinalizeMfaResponse } from '../../api/authentication/mfa'; -import { AuthInternal } from '../../model/auth'; -import { IdTokenResponse } from '../../model/id_token'; -import { PersistedBlob } from '../persistence'; -/** - * The number of milliseconds before the official expiration time of a token - * to refresh that token, to provide a buffer for RPCs to complete. - */ -export declare const enum Buffer { - TOKEN_REFRESH = 30000 -} -/** - * We need to mark this class as internal explicitly to exclude it in the public typings, because - * it references AuthInternal which has a circular dependency with UserInternal. - * - * @internal - */ -export declare class StsTokenManager { - refreshToken: string | null; - accessToken: string | null; - expirationTime: number | null; - get isExpired(): boolean; - updateFromServerResponse(response: IdTokenResponse | FinalizeMfaResponse): void; - updateFromIdToken(idToken: string): void; - getToken(auth: AuthInternal, forceRefresh?: boolean): Promise<string | null>; - clearRefreshToken(): void; - private refresh; - private updateTokensAndExpiration; - static fromJSON(appName: string, object: PersistedBlob): StsTokenManager; - toJSON(): object; - _assign(stsTokenManager: StsTokenManager): void; - _clone(): StsTokenManager; - _performRefresh(): never; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/user_credential_impl.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/user_credential_impl.d.ts deleted file mode 100644 index 44ece34..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/user_credential_impl.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { PhoneOrOauthTokenResponse } from '../../api/authentication/mfa'; -import { IdTokenResponse } from '../../model/id_token'; -import { UserInternal, UserCredentialInternal } from '../../model/user'; -import { AuthInternal } from '../../model/auth'; -import { OperationType, ProviderId } from '../../model/enums'; -interface UserCredentialParams { - readonly user: UserInternal; - readonly providerId: ProviderId | string | null; - readonly _tokenResponse?: PhoneOrOauthTokenResponse; - readonly operationType: OperationType; -} -export declare class UserCredentialImpl implements UserCredentialInternal, UserCredentialParams { - readonly user: UserInternal; - readonly providerId: ProviderId | string | null; - readonly _tokenResponse: PhoneOrOauthTokenResponse | undefined; - readonly operationType: OperationType; - constructor(params: UserCredentialParams); - static _fromIdTokenResponse(auth: AuthInternal, operationType: OperationType, idTokenResponse: IdTokenResponse, isAnonymous?: boolean): Promise<UserCredentialInternal>; - static _forOperation(user: UserInternal, operationType: OperationType, response: PhoneOrOauthTokenResponse): Promise<UserCredentialImpl>; -} -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/user_impl.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/user_impl.d.ts deleted file mode 100644 index f795111..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/user_impl.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { IdTokenResult } from '../../model/public_types'; -import { NextFn } from '@firebase/util'; -import { APIUserInfo, GetAccountInfoResponse } from '../../api/account_management/account'; -import { FinalizeMfaResponse } from '../../api/authentication/mfa'; -import { AuthInternal } from '../../model/auth'; -import { IdTokenResponse } from '../../model/id_token'; -import { MutableUserInfo, UserInternal, UserParameters } from '../../model/user'; -import { PersistedBlob } from '../persistence'; -import { StsTokenManager } from './token_manager'; -import { UserMetadata } from './user_metadata'; -import { ProviderId } from '../../model/enums'; -export declare class UserImpl implements UserInternal { - readonly providerId = ProviderId.FIREBASE; - stsTokenManager: StsTokenManager; - private accessToken; - uid: string; - auth: AuthInternal; - emailVerified: boolean; - isAnonymous: boolean; - tenantId: string | null; - readonly metadata: UserMetadata; - providerData: MutableUserInfo[]; - displayName: string | null; - email: string | null; - phoneNumber: string | null; - photoURL: string | null; - _redirectEventId?: string; - private readonly proactiveRefresh; - constructor({ uid, auth, stsTokenManager, ...opt }: UserParameters); - getIdToken(forceRefresh?: boolean): Promise<string>; - getIdTokenResult(forceRefresh?: boolean): Promise<IdTokenResult>; - reload(): Promise<void>; - private reloadUserInfo; - private reloadListener; - _assign(user: UserInternal): void; - _clone(auth: AuthInternal): UserInternal; - _onReload(callback: NextFn<APIUserInfo>): void; - _notifyReloadListener(userInfo: APIUserInfo): void; - _startProactiveRefresh(): void; - _stopProactiveRefresh(): void; - _updateTokensIfNecessary(response: IdTokenResponse | FinalizeMfaResponse, reload?: boolean): Promise<void>; - delete(): Promise<void>; - toJSON(): PersistedBlob; - get refreshToken(): string; - static _fromJSON(auth: AuthInternal, object: PersistedBlob): UserInternal; - /** - * Initialize a User from an idToken server response - * @param auth - * @param idTokenResponse - */ - static _fromIdTokenResponse(auth: AuthInternal, idTokenResponse: IdTokenResponse, isAnonymous?: boolean): Promise<UserInternal>; - /** - * Initialize a User from an idToken server response - * @param auth - * @param idTokenResponse - */ - static _fromGetAccountInfoResponse(auth: AuthInternal, response: GetAccountInfoResponse, idToken: string): Promise<UserInternal>; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/user_metadata.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/user_metadata.d.ts deleted file mode 100644 index c732ce3..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/user/user_metadata.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { UserMetadata as UserMetadataType } from '../../model/public_types'; -export declare class UserMetadata implements UserMetadataType { - private createdAt?; - private lastLoginAt?; - creationTime?: string; - lastSignInTime?: string; - constructor(createdAt?: (string | number) | undefined, lastLoginAt?: (string | number) | undefined); - private _initializeTime; - _copy(metadata: UserMetadata): void; - toJSON(): object; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/assert.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/assert.d.ts deleted file mode 100644 index b877b42..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/assert.d.ts +++ /dev/null @@ -1,94 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth } from '../../model/public_types'; -import { FirebaseError } from '@firebase/util'; -import { AuthErrorCode, AuthErrorParams } from '../errors'; -type LessAppName<K extends AuthErrorCode> = Omit<AuthErrorParams[K], 'appName'>; -/** - * Unconditionally fails, throwing a developer facing INTERNAL_ERROR - * - * @example - * ```javascript - * fail(auth, AuthErrorCode.MFA_REQUIRED); // Error: the MFA_REQUIRED error needs more params than appName - * fail(auth, AuthErrorCode.MFA_REQUIRED, {serverResponse}); // Compiles - * fail(AuthErrorCode.INTERNAL_ERROR); // Compiles; internal error does not need appName - * fail(AuthErrorCode.USER_DELETED); // Error: USER_DELETED requires app name - * fail(auth, AuthErrorCode.USER_DELETED); // Compiles; USER_DELETED _only_ needs app name - * ``` - * - * @param appName App name for tagging the error - * @throws FirebaseError - */ -export declare function _fail<K extends AuthErrorCode>(code: K, ...data: {} extends AuthErrorParams[K] ? [AuthErrorParams[K]?] : [AuthErrorParams[K]]): never; -export declare function _fail<K extends AuthErrorCode>(auth: Auth, code: K, ...data: {} extends LessAppName<K> ? [LessAppName<K>?] : [LessAppName<K>]): never; -export declare function _createError<K extends AuthErrorCode>(code: K, ...data: {} extends AuthErrorParams[K] ? [AuthErrorParams[K]?] : [AuthErrorParams[K]]): FirebaseError; -export declare function _createError<K extends AuthErrorCode>(auth: Auth, code: K, ...data: {} extends LessAppName<K> ? [LessAppName<K>?] : [LessAppName<K>]): FirebaseError; -export declare function _errorWithCustomMessage(auth: Auth, code: AuthErrorCode, message: string): FirebaseError; -export declare function _serverAppCurrentUserOperationNotSupportedError(auth: Auth): FirebaseError; -export declare function _assertInstanceOf(auth: Auth, object: object, instance: unknown): void; -export declare function _assert<K extends AuthErrorCode>(assertion: unknown, code: K, ...data: {} extends AuthErrorParams[K] ? [AuthErrorParams[K]?] : [AuthErrorParams[K]]): asserts assertion; -export declare function _assert<K extends AuthErrorCode>(assertion: unknown, auth: Auth, code: K, ...data: {} extends LessAppName<K> ? [LessAppName<K>?] : [LessAppName<K>]): asserts assertion; -type TypeExpectation = Function | string | MapType; -interface MapType extends Record<string, TypeExpectation | Optional> { -} -declare class Optional { - readonly type: TypeExpectation; - constructor(type: TypeExpectation); -} -export declare function opt(type: TypeExpectation): Optional; -/** - * Asserts the runtime types of arguments. The 'expected' field can be one of - * a class, a string (representing a "typeof" call), or a record map of name - * to type. Furthermore, the opt() function can be used to mark a field as - * optional. For example: - * - * function foo(auth: Auth, profile: {displayName?: string}, update = false) { - * assertTypes(arguments, [AuthImpl, {displayName: opt('string')}, opt('boolean')]); - * } - * - * opt() can be used for any type: - * function foo(auth?: Auth) { - * assertTypes(arguments, [opt(AuthImpl)]); - * } - * - * The string types can be or'd together, and you can use "null" as well (note - * that typeof null === 'object'; this is an edge case). For example: - * - * function foo(profile: {displayName?: string | null}) { - * assertTypes(arguments, [{displayName: opt('string|null')}]); - * } - * - * @param args - * @param expected - */ -export declare function assertTypes(args: Omit<IArguments, 'callee'>, ...expected: Array<TypeExpectation | Optional>): void; -/** - * Unconditionally fails, throwing an internal error with the given message. - * - * @param failure type of failure encountered - * @throws Error - */ -export declare function debugFail(failure: string): never; -/** - * Fails if the given assertion condition is false, throwing an Error with the - * given message if it did. - * - * @param assertion - * @param message - */ -export declare function debugAssert(assertion: unknown, message: string): asserts assertion; -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/browser.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/browser.d.ts deleted file mode 100644 index f2abeb6..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/browser.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Enums for Browser name. - */ -export declare const enum BrowserName { - ANDROID = "Android", - BLACKBERRY = "Blackberry", - EDGE = "Edge", - FIREFOX = "Firefox", - IE = "IE", - IEMOBILE = "IEMobile", - OPERA = "Opera", - OTHER = "Other", - CHROME = "Chrome", - SAFARI = "Safari", - SILK = "Silk", - WEBOS = "Webos" -} -/** - * Determine the browser for the purposes of reporting usage to the API - */ -export declare function _getBrowserName(userAgent: string): BrowserName | string; -export declare function _isFirefox(ua?: string): boolean; -export declare function _isSafari(userAgent?: string): boolean; -export declare function _isChromeIOS(ua?: string): boolean; -export declare function _isIEMobile(ua?: string): boolean; -export declare function _isAndroid(ua?: string): boolean; -export declare function _isBlackBerry(ua?: string): boolean; -export declare function _isWebOS(ua?: string): boolean; -export declare function _isIOS(ua?: string): boolean; -export declare function _isIOS7Or8(ua?: string): boolean; -export declare function _isIOSStandalone(ua?: string): boolean; -export declare function _isIE10(): boolean; -export declare function _isMobileBrowser(ua?: string): boolean; -export declare function _isIframe(): boolean; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/delay.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/delay.d.ts deleted file mode 100644 index 6358c7e..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/delay.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export declare const enum DelayMin { - OFFLINE = 5000 -} -/** - * A structure to help pick between a range of long and short delay durations - * depending on the current environment. In general, the long delay is used for - * mobile environments whereas short delays are used for desktop environments. - */ -export declare class Delay { - private readonly shortDelay; - private readonly longDelay; - private readonly isMobile; - constructor(shortDelay: number, longDelay: number); - get(): number; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/emulator.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/emulator.d.ts deleted file mode 100644 index 068c50a..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/emulator.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ConfigInternal } from '../../model/auth'; -export declare function _emulatorUrl(config: ConfigInternal, path?: string): string; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/event_id.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/event_id.d.ts deleted file mode 100644 index a235857..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/event_id.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export declare function _generateEventId(prefix?: string, digits?: number): string; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/fetch_provider.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/fetch_provider.d.ts deleted file mode 100644 index b30fc05..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/fetch_provider.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export declare class FetchProvider { - private static fetchImpl; - private static headersImpl; - private static responseImpl; - static initialize(fetchImpl: typeof fetch, headersImpl?: typeof Headers, responseImpl?: typeof Response): void; - static fetch(): typeof fetch; - static headers(): typeof Headers; - static response(): typeof Response; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/handler.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/handler.d.ts deleted file mode 100644 index d5ff063..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/handler.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthProvider } from '../../model/public_types'; -import { AuthInternal } from '../../model/auth'; -import { AuthEventType } from '../../model/popup_redirect'; -export declare function _getRedirectUrl(auth: AuthInternal, provider: AuthProvider, authType: AuthEventType, redirectUrl?: string, eventId?: string, additionalParams?: Record<string, string>): Promise<string>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/instantiator.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/instantiator.d.ts deleted file mode 100644 index 33e7c95..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/instantiator.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Our API has a lot of one-off constants that are used to do things. - * Unfortunately we can't export these as classes instantiated directly since - * the constructor may side effect and therefore can't be proven to be safely - * culled. Instead, we export these classes themselves as a lowerCamelCase - * constant, and instantiate them under the hood. - */ -export interface SingletonInstantiator<T> { - new (): T; -} -export declare function _getInstance<T>(cls: unknown): T; -export declare function _clearInstanceMap(): void; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/location.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/location.d.ts deleted file mode 100644 index c79ac38..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/location.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export declare function _getCurrentUrl(): string; -export declare function _isHttpOrHttps(): boolean; -export declare function _getCurrentScheme(): string | null; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/log.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/log.d.ts deleted file mode 100644 index b65ea5c..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/log.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { LogLevel } from '@firebase/logger'; -export { LogLevel }; -export declare function _getLogLevel(): LogLevel; -export declare function _setLogLevel(newLevel: LogLevel): void; -export declare function _logDebug(msg: string, ...args: string[]): void; -export declare function _logWarn(msg: string, ...args: string[]): void; -export declare function _logError(msg: string, ...args: string[]): void; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/navigator.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/navigator.d.ts deleted file mode 100644 index ac91633..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/navigator.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Determine whether the browser is working online - */ -export declare function _isOnline(): boolean; -export declare function _getUserLanguage(): string | null; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/providers.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/providers.d.ts deleted file mode 100644 index c2ffdb3..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/providers.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export interface ProviderAssociatedObject { - providerId?: string; -} -/** - * Takes a set of UserInfo provider data and converts it to a set of names - */ -export declare function providerDataAsNames<T extends ProviderAssociatedObject>(providerData: T[]): Set<string>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/resolver.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/resolver.d.ts deleted file mode 100644 index e7c2c7c..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/resolver.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { PopupRedirectResolver } from '../../model/public_types'; -import { AuthInternal } from '../../model/auth'; -import { PopupRedirectResolverInternal } from '../../model/popup_redirect'; -/** - * Chooses a popup/redirect resolver to use. This prefers the override (which - * is directly passed in), and falls back to the property set on the auth - * object. If neither are available, this function errors w/ an argument error. - */ -export declare function _withDefaultResolver(auth: AuthInternal, resolverOverride: PopupRedirectResolver | undefined): PopupRedirectResolverInternal; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/time.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/time.d.ts deleted file mode 100644 index d82976e..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/time.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export declare function utcTimestampToDateString(utcTimestamp?: string | number): string | undefined; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/validate_origin.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/validate_origin.d.ts deleted file mode 100644 index dde89b0..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/validate_origin.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthInternal } from '../../model/auth'; -export declare function _validateOrigin(auth: AuthInternal): Promise<void>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/version.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/version.d.ts deleted file mode 100644 index 342ceb5..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/core/util/version.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export declare const enum ClientImplementation { - CORE = "JsCore" -} -/** - * @internal - */ -export declare const enum ClientPlatform { - BROWSER = "Browser", - NODE = "Node", - REACT_NATIVE = "ReactNative", - CORDOVA = "Cordova", - WORKER = "Worker", - WEB_EXTENSION = "WebExtension" -} -export declare function _getClientVersion(clientPlatform: ClientPlatform, frameworks?: readonly string[]): string; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/index.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/index.d.ts deleted file mode 100644 index 4b71927..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export * from './core'; -export * from './mfa'; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/assertions/totp.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/assertions/totp.d.ts deleted file mode 100644 index 6b6df19..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/assertions/totp.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { TotpMultiFactorAssertion, MultiFactorSession } from '../../model/public_types'; -import { AuthInternal } from '../../model/auth'; -import { StartTotpMfaEnrollmentResponse, TotpVerificationInfo } from '../../api/account_management/mfa'; -import { FinalizeMfaResponse } from '../../api/authentication/mfa'; -import { MultiFactorAssertionImpl } from '../../mfa/mfa_assertion'; -/** - * Provider for generating a {@link TotpMultiFactorAssertion}. - * - * @public - */ -export declare class TotpMultiFactorGenerator { - /** - * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of - * the TOTP (time-based one-time password) second factor. - * This assertion is used to complete enrollment in TOTP second factor. - * - * @param secret A {@link TotpSecret} containing the shared secret key and other TOTP parameters. - * @param oneTimePassword One-time password from TOTP App. - * @returns A {@link TotpMultiFactorAssertion} which can be used with - * {@link MultiFactorUser.enroll}. - */ - static assertionForEnrollment(secret: TotpSecret, oneTimePassword: string): TotpMultiFactorAssertion; - /** - * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of the TOTP second factor. - * This assertion is used to complete signIn with TOTP as the second factor. - * - * @param enrollmentId identifies the enrolled TOTP second factor. - * @param oneTimePassword One-time password from TOTP App. - * @returns A {@link TotpMultiFactorAssertion} which can be used with - * {@link MultiFactorResolver.resolveSignIn}. - */ - static assertionForSignIn(enrollmentId: string, oneTimePassword: string): TotpMultiFactorAssertion; - /** - * Returns a promise to {@link TotpSecret} which contains the TOTP shared secret key and other parameters. - * 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 {@link MultiFactorSession} that the user is part of. - * @returns A promise to {@link TotpSecret}. - */ - static generateSecret(session: MultiFactorSession): Promise<TotpSecret>; - /** - * The identifier of the TOTP second factor: `totp`. - */ - static FACTOR_ID: 'totp'; -} -export declare class TotpMultiFactorAssertionImpl extends MultiFactorAssertionImpl implements TotpMultiFactorAssertion { - readonly otp: string; - readonly enrollmentId?: string | undefined; - readonly secret?: TotpSecret | undefined; - constructor(otp: string, enrollmentId?: string | undefined, secret?: TotpSecret | undefined); - /** @internal */ - static _fromSecret(secret: TotpSecret, otp: string): TotpMultiFactorAssertionImpl; - /** @internal */ - static _fromEnrollmentId(enrollmentId: string, otp: string): TotpMultiFactorAssertionImpl; - /** @internal */ - _finalizeEnroll(auth: AuthInternal, idToken: string, displayName?: string | null): Promise<FinalizeMfaResponse>; - /** @internal */ - _finalizeSignIn(auth: AuthInternal, mfaPendingCredential: string): Promise<FinalizeMfaResponse>; -} -/** - * Provider for generating a {@link TotpMultiFactorAssertion}. - * - * Stores the shared secret key and other parameters to generate time-based OTPs. - * Implements methods to retrieve the shared secret key and generate a QR code URL. - * @public - */ -export declare class TotpSecret { - private readonly sessionInfo; - private readonly auth; - /** - * Shared secret key/seed used for enrolling in TOTP MFA and generating OTPs. - */ - readonly secretKey: string; - /** - * Hashing algorithm used. - */ - readonly hashingAlgorithm: string; - /** - * Length of the one-time passwords to be generated. - */ - readonly codeLength: number; - /** - * The interval (in seconds) when the OTP codes should change. - */ - readonly codeIntervalSeconds: number; - /** - * The timestamp (UTC string) by which TOTP enrollment should be completed. - */ - readonly enrollmentCompletionDeadline: string; - private constructor(); - /** @internal */ - static _fromStartTotpMfaEnrollmentResponse(response: StartTotpMfaEnrollmentResponse, auth: AuthInternal): TotpSecret; - /** @internal */ - _makeTotpVerificationInfo(otp: string): TotpVerificationInfo; - /** - * Returns a QR code URL as described in - * https://github.com/google/google-authenticator/wiki/Key-Uri-Format - * This can be displayed to the user as a QR code to be scanned into a TOTP app like Google Authenticator. - * If the optional parameters are unspecified, an accountName of <userEmail> and issuer of <firebaseAppName> are used. - * - * @param accountName the name of the account/app along with a user identifier. - * @param issuer issuer of the TOTP (likely the app name). - * @returns A QR code URL string. - */ - generateQrCodeUrl(accountName?: string, issuer?: string): string; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/index.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/index.d.ts deleted file mode 100644 index c976896..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export { getMultiFactorResolver } from './mfa_resolver'; -export { multiFactor } from './mfa_user'; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_assertion.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_assertion.d.ts deleted file mode 100644 index ab9d4fb..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_assertion.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { FactorId, MultiFactorAssertion } from '../model/public_types'; -import { MultiFactorSessionImpl } from './mfa_session'; -import { FinalizeMfaResponse } from '../api/authentication/mfa'; -import { AuthInternal } from '../model/auth'; -export declare abstract class MultiFactorAssertionImpl implements MultiFactorAssertion { - readonly factorId: FactorId; - protected constructor(factorId: FactorId); - _process(auth: AuthInternal, session: MultiFactorSessionImpl, displayName?: string | null): Promise<FinalizeMfaResponse>; - abstract _finalizeEnroll(auth: AuthInternal, idToken: string, displayName?: string | null): Promise<FinalizeMfaResponse>; - abstract _finalizeSignIn(auth: AuthInternal, mfaPendingCredential: string): Promise<FinalizeMfaResponse>; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_error.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_error.d.ts deleted file mode 100644 index d6b719c..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_error.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { MultiFactorError as MultiFactorErrorPublic } from '../model/public_types'; -import { FirebaseError } from '@firebase/util'; -import { AuthInternal } from '../model/auth'; -import { IdTokenResponse } from '../model/id_token'; -import { UserInternal } from '../model/user'; -import { AuthCredential } from '../core/credentials'; -import { IdTokenMfaResponse } from '../api/authentication/mfa'; -import { OperationType } from '../model/enums'; -export type MultiFactorErrorData = MultiFactorErrorPublic['customData'] & { - _serverResponse: IdTokenMfaResponse; -}; -export declare class MultiFactorError extends FirebaseError implements MultiFactorErrorPublic { - readonly operationType: OperationType; - readonly user?: UserInternal | undefined; - readonly customData: MultiFactorErrorData; - private constructor(); - static _fromErrorAndOperation(auth: AuthInternal, error: FirebaseError, operationType: OperationType, user?: UserInternal): MultiFactorError; -} -export declare function _processCredentialSavingMfaContextIfNecessary(auth: AuthInternal, operationType: OperationType, credential: AuthCredential, user?: UserInternal): Promise<IdTokenResponse>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_info.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_info.d.ts deleted file mode 100644 index 49888fd..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_info.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { FactorId, MultiFactorInfo, PhoneMultiFactorInfo, TotpMultiFactorInfo } from '../model/public_types'; -import { MfaEnrollment } from '../api/account_management/mfa'; -import { AuthInternal } from '../model/auth'; -export declare abstract class MultiFactorInfoImpl implements MultiFactorInfo { - readonly factorId: FactorId; - readonly uid: string; - readonly displayName?: string | null; - readonly enrollmentTime: string; - protected constructor(factorId: FactorId, response: MfaEnrollment); - static _fromServerResponse(auth: AuthInternal, enrollment: MfaEnrollment): MultiFactorInfoImpl; -} -export declare class PhoneMultiFactorInfoImpl extends MultiFactorInfoImpl implements PhoneMultiFactorInfo { - readonly phoneNumber: string; - private constructor(); - static _fromServerResponse(_auth: AuthInternal, enrollment: MfaEnrollment): PhoneMultiFactorInfoImpl; -} -export declare class TotpMultiFactorInfoImpl extends MultiFactorInfoImpl implements TotpMultiFactorInfo { - private constructor(); - static _fromServerResponse(_auth: AuthInternal, enrollment: MfaEnrollment): TotpMultiFactorInfoImpl; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_resolver.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_resolver.d.ts deleted file mode 100644 index edf54ed..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_resolver.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth, MultiFactorResolver, UserCredential, MultiFactorError } from '../model/public_types'; -import { MultiFactorAssertionImpl } from './mfa_assertion'; -import { MultiFactorError as MultiFactorErrorInternal } from './mfa_error'; -import { MultiFactorInfoImpl } from './mfa_info'; -import { MultiFactorSessionImpl } from './mfa_session'; -export declare class MultiFactorResolverImpl implements MultiFactorResolver { - readonly session: MultiFactorSessionImpl; - readonly hints: MultiFactorInfoImpl[]; - private readonly signInResolver; - private constructor(); - /** @internal */ - static _fromError(authExtern: Auth, error: MultiFactorErrorInternal): MultiFactorResolverImpl; - resolveSignIn(assertionExtern: MultiFactorAssertionImpl): Promise<UserCredential>; -} -/** - * Provides a {@link MultiFactorResolver} suitable for completion of a - * multi-factor flow. - * - * @param auth - The {@link Auth} instance. - * @param error - The {@link MultiFactorError} raised during a sign-in, or - * reauthentication operation. - * - * @public - */ -export declare function getMultiFactorResolver(auth: Auth, error: MultiFactorError): MultiFactorResolver; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_session.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_session.d.ts deleted file mode 100644 index a144670..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_session.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { UserInternal } from '../model/user'; -import { MultiFactorSession } from '../model/public_types'; -export declare const enum MultiFactorSessionType { - ENROLL = "enroll", - SIGN_IN = "signin" -} -interface SerializedMultiFactorSession { - multiFactorSession: { - idToken?: string; - pendingCredential?: string; - }; -} -export declare class MultiFactorSessionImpl implements MultiFactorSession { - readonly type: MultiFactorSessionType; - readonly credential: string; - readonly user?: UserInternal | undefined; - private constructor(); - static _fromIdtoken(idToken: string, user?: UserInternal): MultiFactorSessionImpl; - static _fromMfaPendingCredential(mfaPendingCredential: string): MultiFactorSessionImpl; - toJSON(): SerializedMultiFactorSession; - static fromJSON(obj: Partial<SerializedMultiFactorSession>): MultiFactorSessionImpl | null; -} -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_user.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_user.d.ts deleted file mode 100644 index 4850e26..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/mfa/mfa_user.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { MultiFactorAssertion, MultiFactorInfo, MultiFactorSession, MultiFactorUser, User } from '../model/public_types'; -import { UserInternal } from '../model/user'; -export declare class MultiFactorUserImpl implements MultiFactorUser { - readonly user: UserInternal; - enrolledFactors: MultiFactorInfo[]; - private constructor(); - static _fromUser(user: UserInternal): MultiFactorUserImpl; - getSession(): Promise<MultiFactorSession>; - enroll(assertionExtern: MultiFactorAssertion, displayName?: string | null): Promise<void>; - unenroll(infoOrUid: MultiFactorInfo | string): Promise<void>; -} -/** - * The {@link MultiFactorUser} corresponding to the user. - * - * @remarks - * This is used to access all multi-factor properties and operations related to the user. - * - * @param user - The user. - * - * @public - */ -export declare function multiFactor(user: User): MultiFactorUser; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/application_verifier.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/application_verifier.d.ts deleted file mode 100644 index fc6dca5..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/application_verifier.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ApplicationVerifier } from './public_types'; -export interface ApplicationVerifierInternal extends ApplicationVerifier { - /** - * @internal - */ - _reset(): void; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/auth.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/auth.d.ts deleted file mode 100644 index 986054b..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/auth.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth, AuthSettings, Config, EmulatorConfig, PasswordPolicy, PasswordValidationStatus, PopupRedirectResolver, User } from './public_types'; -import { ErrorFactory } from '@firebase/util'; -import { AuthErrorCode, AuthErrorParams } from '../core/errors'; -import { PopupRedirectResolverInternal } from './popup_redirect'; -import { UserInternal } from './user'; -import { ClientPlatform } from '../core/util/version'; -import { RecaptchaConfig } from '../platform_browser/recaptcha/recaptcha'; -import { PasswordPolicyInternal } from './password_policy'; -import { PersistenceInternal } from '../core/persistence'; -export type AppName = string; -export type ApiKey = string; -export type AuthDomain = string; -/** - * @internal - */ -export interface ConfigInternal extends Config { - /** - * @readonly - */ - emulator?: { - url: string; - }; - /** - * @readonly - */ - clientPlatform: ClientPlatform; -} -/** - * UserInternal and AuthInternal reference each other, so both of them are included in the public typings. - * In order to exclude them, we mark them as internal explicitly. - * - * @internal - */ -export interface AuthInternal extends Auth { - currentUser: User | null; - emulatorConfig: EmulatorConfig | null; - _agentRecaptchaConfig: RecaptchaConfig | null; - _tenantRecaptchaConfigs: Record<string, RecaptchaConfig>; - _projectPasswordPolicy: PasswordPolicy | null; - _tenantPasswordPolicies: Record<string, PasswordPolicy>; - _canInitEmulator: boolean; - _isInitialized: boolean; - _initializationPromise: Promise<void> | null; - _persistenceManagerAvailable: Promise<void>; - _updateCurrentUser(user: UserInternal | null): Promise<void>; - _onStorageEvent(): void; - _notifyListenersIfCurrent(user: UserInternal): void; - _persistUserIfCurrent(user: UserInternal): Promise<void>; - _setRedirectUser(user: UserInternal | null, popupRedirectResolver?: PopupRedirectResolver): Promise<void>; - _redirectUserForId(id: string): Promise<UserInternal | null>; - _popupRedirectResolver: PopupRedirectResolverInternal | null; - _key(): string; - _startProactiveRefresh(): void; - _stopProactiveRefresh(): void; - _getPersistenceType(): string; - _getPersistence(): PersistenceInternal; - _getRecaptchaConfig(): RecaptchaConfig | null; - _getPasswordPolicyInternal(): PasswordPolicyInternal | null; - _updatePasswordPolicy(): Promise<void>; - _logFramework(framework: string): void; - _getFrameworks(): readonly string[]; - _getAdditionalHeaders(): Promise<Record<string, string>>; - _getAppCheckToken(): Promise<string | undefined>; - readonly name: AppName; - readonly config: ConfigInternal; - languageCode: string | null; - tenantId: string | null; - readonly settings: AuthSettings; - _errorFactory: ErrorFactory<AuthErrorCode, AuthErrorParams>; - useDeviceLanguage(): void; - signOut(): Promise<void>; - validatePassword(password: string): Promise<PasswordValidationStatus>; - revokeAccessToken(token: string): Promise<void>; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/enum_maps.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/enum_maps.d.ts deleted file mode 100644 index 60095b5..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/enum_maps.d.ts +++ /dev/null @@ -1,98 +0,0 @@ -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * An enum of factors that may be used for multifactor authentication. - * - * @public - */ -export declare const FactorId: { - /** Phone as second factor */ - readonly PHONE: "phone"; - readonly TOTP: "totp"; -}; -/** - * Enumeration of supported providers. - * - * @public - */ -export declare const ProviderId: { - /** Facebook provider ID */ - readonly FACEBOOK: "facebook.com"; - /** GitHub provider ID */ - readonly GITHUB: "github.com"; - /** Google provider ID */ - readonly GOOGLE: "google.com"; - /** Password provider */ - readonly PASSWORD: "password"; - /** Phone provider */ - readonly PHONE: "phone"; - /** Twitter provider ID */ - readonly TWITTER: "twitter.com"; -}; -/** - * Enumeration of supported sign-in methods. - * - * @public - */ -export declare const SignInMethod: { - /** Email link sign in method */ - readonly EMAIL_LINK: "emailLink"; - /** Email/password sign in method */ - readonly EMAIL_PASSWORD: "password"; - /** Facebook sign in method */ - readonly FACEBOOK: "facebook.com"; - /** GitHub sign in method */ - readonly GITHUB: "github.com"; - /** Google sign in method */ - readonly GOOGLE: "google.com"; - /** Phone sign in method */ - readonly PHONE: "phone"; - /** Twitter sign in method */ - readonly TWITTER: "twitter.com"; -}; -/** - * Enumeration of supported operation types. - * - * @public - */ -export declare const OperationType: { - /** Operation involving linking an additional provider to an already signed-in user. */ - readonly LINK: "link"; - /** Operation involving using a provider to reauthenticate an already signed-in user. */ - readonly REAUTHENTICATE: "reauthenticate"; - /** Operation involving signing in a user. */ - readonly SIGN_IN: "signIn"; -}; -/** - * An enumeration of the possible email action types. - * - * @public - */ -export declare const ActionCodeOperation: { - /** The email link sign-in action. */ - readonly EMAIL_SIGNIN: "EMAIL_SIGNIN"; - /** The password reset action. */ - readonly PASSWORD_RESET: "PASSWORD_RESET"; - /** The email revocation action. */ - readonly RECOVER_EMAIL: "RECOVER_EMAIL"; - /** The revert second factor addition email action. */ - readonly REVERT_SECOND_FACTOR_ADDITION: "REVERT_SECOND_FACTOR_ADDITION"; - /** The revert second factor addition email action. */ - readonly VERIFY_AND_CHANGE_EMAIL: "VERIFY_AND_CHANGE_EMAIL"; - /** The email verification action. */ - readonly VERIFY_EMAIL: "VERIFY_EMAIL"; -}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/enums.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/enums.d.ts deleted file mode 100644 index a917e14..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/enums.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Enumeration of supported providers. - * @internal - */ -export declare const enum ProviderId { - /** @internal */ - ANONYMOUS = "anonymous", - /** @internal */ - CUSTOM = "custom", - /** Facebook provider ID */ - FACEBOOK = "facebook.com", - /** @internal */ - FIREBASE = "firebase", - /** GitHub provider ID */ - GITHUB = "github.com", - /** Google provider ID */ - GOOGLE = "google.com", - /** Password provider */ - PASSWORD = "password", - /** Phone provider */ - PHONE = "phone", - /** Twitter provider ID */ - TWITTER = "twitter.com" -} -/** - * Enumeration of supported sign-in methods. - * @internal - */ -export declare const enum SignInMethod { - /** @internal */ - ANONYMOUS = "anonymous", - /** Email link sign in method */ - EMAIL_LINK = "emailLink", - /** Email/password sign in method */ - EMAIL_PASSWORD = "password", - /** Facebook sign in method */ - FACEBOOK = "facebook.com", - /** GitHub sign in method */ - GITHUB = "github.com", - /** Google sign in method */ - GOOGLE = "google.com", - /** Phone sign in method */ - PHONE = "phone", - /** Twitter sign in method */ - TWITTER = "twitter.com" -} -/** - * Enumeration of supported operation types. - * @internal - */ -export declare const enum OperationType { - /** Operation involving linking an additional provider to an already signed-in user. */ - LINK = "link", - /** Operation involving using a provider to reauthenticate an already signed-in user. */ - REAUTHENTICATE = "reauthenticate", - /** Operation involving signing in a user. */ - SIGN_IN = "signIn" -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/id_token.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/id_token.d.ts deleted file mode 100644 index b288dcf..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/id_token.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { PhoneOrOauthTokenResponse } from '../api/authentication/mfa'; -/** - * Raw encoded JWT - * - */ -export type IdToken = string; -/** - * Raw parsed JWT - * - */ -export interface ParsedIdToken { - iss: string; - aud: string; - exp: number; - sub: string; - iat: number; - email?: string; - verified: boolean; - providerId?: string; - tenantId?: string; - anonymous: boolean; - federatedId?: string; - displayName?: string; - photoURL?: string; - toString(): string; -} -/** - * IdToken as returned by the API - * - * @internal - */ -export interface IdTokenResponse { - localId: string; - idToken?: IdToken; - refreshToken?: string; - expiresIn?: string; - providerId?: string; - displayName?: string | null; - isNewUser?: boolean; - kind?: IdTokenResponseKind; - photoUrl?: string | null; - rawUserInfo?: string; - screenName?: string | null; -} -/** - * The possible types of the `IdTokenResponse` - * - * @internal - */ -export declare const enum IdTokenResponseKind { - CreateAuthUri = "identitytoolkit#CreateAuthUriResponse", - DeleteAccount = "identitytoolkit#DeleteAccountResponse", - DownloadAccount = "identitytoolkit#DownloadAccountResponse", - EmailLinkSignin = "identitytoolkit#EmailLinkSigninResponse", - GetAccountInfo = "identitytoolkit#GetAccountInfoResponse", - GetOobConfirmationCode = "identitytoolkit#GetOobConfirmationCodeResponse", - GetRecaptchaParam = "identitytoolkit#GetRecaptchaParamResponse", - ResetPassword = "identitytoolkit#ResetPasswordResponse", - SetAccountInfo = "identitytoolkit#SetAccountInfoResponse", - SignupNewUser = "identitytoolkit#SignupNewUserResponse", - UploadAccount = "identitytoolkit#UploadAccountResponse", - VerifyAssertion = "identitytoolkit#VerifyAssertionResponse", - VerifyCustomToken = "identitytoolkit#VerifyCustomTokenResponse", - VerifyPassword = "identitytoolkit#VerifyPasswordResponse" -} -/** - * @internal - */ -export interface TaggedWithTokenResponse { - _tokenResponse?: PhoneOrOauthTokenResponse; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/password_policy.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/password_policy.d.ts deleted file mode 100644 index 0a438d2..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/password_policy.d.ts +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @license - * Copyright 2023 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { PasswordPolicy, PasswordValidationStatus } from './public_types'; -/** - * Internal typing of password policy that includes the schema version and methods for - * validating that a password meets the policy. The developer does not need access to - * these properties and methods, so they are excluded from the public typing. - * - * @internal - */ -export interface PasswordPolicyInternal extends PasswordPolicy { - /** - * Requirements enforced by the password policy. - */ - readonly customStrengthOptions: PasswordPolicyCustomStrengthOptions; - /** - * Schema version of the password policy. - */ - readonly schemaVersion: number; - /** - * Validates the password against the policy. - * @param password Password to validate. - */ - validatePassword(password: string): PasswordValidationStatus; -} -/** - * Internal typing of the password policy custom strength options that is modifiable. This - * allows us to construct the strength options before storing them in the policy. - * - * @internal - */ -export interface PasswordPolicyCustomStrengthOptions { - /** - * Minimum password length. - */ - minPasswordLength?: number; - /** - * Maximum password length. - */ - maxPasswordLength?: number; - /** - * Whether the password should contain a lowercase letter. - */ - containsLowercaseLetter?: boolean; - /** - * Whether the password should contain an uppercase letter. - */ - containsUppercaseLetter?: boolean; - /** - * Whether the password should contain a numeric character. - */ - containsNumericCharacter?: boolean; - /** - * Whether the password should contain a non-alphanumeric character. - */ - containsNonAlphanumericCharacter?: boolean; -} -/** - * Internal typing of password validation status that is modifiable. This allows us to - * construct the validation status before returning it. - * - * @internal - */ -export interface PasswordValidationStatusInternal extends PasswordValidationStatus { - /** - * Whether the password meets all requirements. - */ - isValid: boolean; - /** - * Whether the password meets the minimum password length. - */ - meetsMinPasswordLength?: boolean; - /** - * Whether the password meets the maximum password length. - */ - meetsMaxPasswordLength?: boolean; - /** - * Whether the password contains a lowercase letter, if required. - */ - containsLowercaseLetter?: boolean; - /** - * Whether the password contains an uppercase letter, if required. - */ - containsUppercaseLetter?: boolean; - /** - * Whether the password contains a numeric character, if required. - */ - containsNumericCharacter?: boolean; - /** - * Whether the password contains a non-alphanumeric character, if required. - */ - containsNonAlphanumericCharacter?: boolean; - /** - * The policy used to validate the password. - */ - passwordPolicy: PasswordPolicy; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/popup_redirect.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/popup_redirect.d.ts deleted file mode 100644 index 1ed2872..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/popup_redirect.d.ts +++ /dev/null @@ -1,94 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth, AuthProvider, Persistence, PopupRedirectResolver, UserCredential } from './public_types'; -import { FirebaseError } from '@firebase/util'; -import { AuthPopup } from '../platform_browser/util/popup'; -import { AuthInternal } from './auth'; -import { UserCredentialInternal } from './user'; -export declare const enum EventFilter { - POPUP = 0, - REDIRECT = 1 -} -export declare const enum GapiOutcome { - ACK = "ACK", - ERROR = "ERROR" -} -export interface GapiAuthEvent extends gapi.iframes.Message { - authEvent: AuthEvent; -} -/** - * @internal - */ -export declare const enum AuthEventType { - LINK_VIA_POPUP = "linkViaPopup", - LINK_VIA_REDIRECT = "linkViaRedirect", - REAUTH_VIA_POPUP = "reauthViaPopup", - REAUTH_VIA_REDIRECT = "reauthViaRedirect", - SIGN_IN_VIA_POPUP = "signInViaPopup", - SIGN_IN_VIA_REDIRECT = "signInViaRedirect", - UNKNOWN = "unknown", - VERIFY_APP = "verifyApp" -} -export interface AuthEventError extends Error { - code: string; - message: string; -} -/** - * @internal - */ -export interface AuthEvent { - type: AuthEventType; - eventId: string | null; - urlResponse: string | null; - sessionId: string | null; - postBody: string | null; - tenantId: string | null; - error?: AuthEventError; -} -/** - * @internal - */ -export interface AuthEventConsumer { - readonly filter: AuthEventType[]; - eventId: string | null; - onAuthEvent(event: AuthEvent): unknown; - onError(error: FirebaseError): unknown; -} -/** - * @internal - */ -export interface EventManager { - registerConsumer(authEventConsumer: AuthEventConsumer): void; - unregisterConsumer(authEventConsumer: AuthEventConsumer): void; -} -/** - * We need to mark this interface as internal explicitly to exclude it in the public typings, because - * it references AuthInternal which has a circular dependency with UserInternal. - * - * @internal - */ -export interface PopupRedirectResolverInternal extends PopupRedirectResolver { - _shouldInitProactively: boolean; - _initialize(auth: AuthInternal): Promise<EventManager>; - _openPopup(auth: AuthInternal, provider: AuthProvider, authType: AuthEventType, eventId?: string): Promise<AuthPopup>; - _openRedirect(auth: AuthInternal, provider: AuthProvider, authType: AuthEventType, eventId?: string): Promise<void | never>; - _isIframeWebStorageSupported(auth: AuthInternal, cb: (support: boolean) => unknown): void; - _redirectPersistence: Persistence; - _originValidation(auth: Auth): Promise<void>; - _completeRedirectFn: (auth: Auth, resolver: PopupRedirectResolver, bypassAuthState: boolean) => Promise<UserCredential | null>; - _overrideRedirectResult: (auth: AuthInternal, resultGetter: () => Promise<UserCredentialInternal | null>) => void; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/public_types.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/public_types.d.ts deleted file mode 100644 index d1600ce..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/public_types.d.ts +++ /dev/null @@ -1,1291 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { FirebaseApp } from '@firebase/app'; -import { CompleteFn, ErrorFn, FirebaseError, NextFn, Observer, Unsubscribe } from '@firebase/util'; -import { FactorId as FactorIdMap, OperationType as OperationTypeMap, ActionCodeOperation as ActionCodeOperationMap } from './enum_maps'; -export { CompleteFn, ErrorFn, NextFn, Unsubscribe }; -/** - * Interface representing the `Auth` config. - * - * @public - */ -export interface Config { - /** - * The API Key used to communicate with the Firebase Auth backend. - */ - apiKey: string; - /** - * The host at which the Firebase Auth backend is running. - */ - apiHost: string; - /** - * The scheme used to communicate with the Firebase Auth backend. - */ - apiScheme: string; - /** - * The host at which the Secure Token API is running. - */ - tokenApiHost: string; - /** - * The SDK Client Version. - */ - sdkClientVersion: string; - /** - * The domain at which the web widgets are hosted (provided via Firebase Config). - */ - authDomain?: string; -} -/** - * Interface representing reCAPTCHA parameters. - * - * See the {@link https://developers.google.com/recaptcha/docs/display#render_param | reCAPTCHA docs} - * for the list of accepted parameters. All parameters are accepted except for `sitekey`: Firebase Auth - * provisions a reCAPTCHA for each project and will configure the site key upon rendering. - * - * For an invisible reCAPTCHA, set the `size` key to `invisible`. - * - * @public - */ -export interface RecaptchaParameters { - [key: string]: any; -} -/** - * Interface representing a parsed ID token. - * - * @privateRemarks TODO(avolkovi): consolidate with parsed_token in implementation. - * - * @public - */ -export interface ParsedToken { - /** Expiration time of the token. */ - 'exp'?: string; - /** UID of the user. */ - 'sub'?: string; - /** Time at which authentication was performed. */ - 'auth_time'?: string; - /** Issuance time of the token. */ - 'iat'?: string; - /** Firebase specific claims, containing the provider(s) used to authenticate the user. */ - 'firebase'?: { - 'sign_in_provider'?: string; - 'sign_in_second_factor'?: string; - 'identities'?: Record<string, string>; - }; - /** Map of any additional custom claims. */ - [key: string]: unknown; -} -/** - * Type definition for an event callback. - * - * @privateRemarks TODO(avolkovi): should we consolidate with Subscribe<T> since we're changing the API anyway? - * - * @public - */ -export type NextOrObserver<T> = NextFn<T | null> | Observer<T | null>; -/** - * Interface for an `Auth` error. - * - * @public - */ -export interface AuthError extends FirebaseError { - /** Details about the Firebase Auth error. */ - readonly customData: { - /** The name of the Firebase App which triggered this error. */ - readonly appName: string; - /** The email address of the user's account, used for sign-in and linking. */ - readonly email?: string; - /** The phone number of the user's account, used for sign-in and linking. */ - readonly phoneNumber?: string; - /** - * The tenant ID being used for sign-in and linking. - * - * @remarks - * If you use {@link signInWithRedirect} to sign in, - * you have to set the tenant ID on the {@link Auth} instance again as the tenant ID is not persisted - * after redirection. - */ - readonly tenantId?: string; - }; -} -/** - * Interface representing an {@link Auth} instance's settings. - * - * @remarks Currently used for enabling/disabling app verification for phone Auth testing. - * - * @public - */ -export interface AuthSettings { - /** - * When set, this property disables app verification for the purpose of testing phone - * authentication. For this property to take effect, it needs to be set before rendering a - * reCAPTCHA app verifier. When this is disabled, a mock reCAPTCHA is rendered instead. This is - * useful for manual testing during development or for automated integration tests. - * - * In order to use this feature, you will need to - * {@link https://firebase.google.com/docs/auth/web/phone-auth#test-with-whitelisted-phone-numbers | whitelist your phone number} - * via the Firebase Console. - * - * The default value is false (app verification is enabled). - */ - appVerificationDisabledForTesting: boolean; -} -/** - * Interface representing Firebase Auth service. - * - * @remarks - * See {@link https://firebase.google.com/docs/auth/ | Firebase Authentication} for a full guide - * on how to use the Firebase Auth service. - * - * @public - */ -export interface Auth { - /** The {@link @firebase/app#FirebaseApp} associated with the `Auth` service instance. */ - readonly app: FirebaseApp; - /** The name of the app associated with the `Auth` service instance. */ - readonly name: string; - /** The {@link Config} used to initialize this instance. */ - readonly config: Config; - /** - * Changes the type of persistence on the `Auth` instance. - * - * @remarks - * This will affect the currently saved Auth session and applies this type of persistence for - * future sign-in requests, including sign-in with redirect requests. - * - * This makes it easy for a user signing in to specify whether their session should be - * remembered or not. It also makes it easier to never persist the Auth state for applications - * that are shared by other users or have sensitive data. - * - * This method does not work in a Node.js environment. - * - * @example - * ```javascript - * auth.setPersistence(browserSessionPersistence); - * ``` - * - * @param persistence - The {@link Persistence} to use. - */ - setPersistence(persistence: Persistence): Promise<void>; - /** - * The {@link Auth} instance's language code. - * - * @remarks - * This is a readable/writable property. When set to null, the default Firebase Console language - * setting is applied. The language code will propagate to email action templates (password - * reset, email verification and email change revocation), SMS templates for phone authentication, - * reCAPTCHA verifier and OAuth popup/redirect operations provided the specified providers support - * localization with the language code specified. - */ - languageCode: string | null; - /** - * The {@link Auth} instance's tenant ID. - * - * @remarks - * This is a readable/writable property. When you set the tenant ID of an {@link Auth} instance, all - * future sign-in/sign-up operations will pass this tenant ID and sign in or sign up users to - * the specified tenant project. When set to null, users are signed in to the parent project. - * - * @example - * ```javascript - * // Set the tenant ID on Auth instance. - * auth.tenantId = 'TENANT_PROJECT_ID'; - * - * // All future sign-in request now include tenant ID. - * const result = await signInWithEmailAndPassword(auth, email, password); - * // result.user.tenantId should be 'TENANT_PROJECT_ID'. - * ``` - * - * @defaultValue null - */ - tenantId: string | null; - /** - * The {@link Auth} instance's settings. - * - * @remarks - * This is used to edit/read configuration related options such as app verification mode for - * phone authentication. - */ - readonly settings: AuthSettings; - /** - * Adds an observer for changes to the user's sign-in state. - * - * @remarks - * To keep the old behavior, see {@link Auth.onIdTokenChanged}. - * - * @param nextOrObserver - callback triggered on change. - * @param error - Deprecated. This callback is never triggered. Errors - * on signing in/out can be caught in promises returned from - * sign-in/sign-out functions. - * @param completed - Deprecated. This callback is never triggered. - */ - onAuthStateChanged(nextOrObserver: NextOrObserver<User | null>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe; - /** - * Adds a blocking callback that runs before an auth state change - * sets a new user. - * - * @param callback - callback triggered before new user value is set. - * If this throws, it blocks the user from being set. - * @param onAbort - callback triggered if a later `beforeAuthStateChanged()` - * callback throws, allowing you to undo any side effects. - */ - beforeAuthStateChanged(callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe; - /** - * Adds an observer for changes to the signed-in user's ID token. - * - * @remarks - * This includes sign-in, sign-out, and token refresh events. - * - * @param nextOrObserver - callback triggered on change. - * @param error - Deprecated. This callback is never triggered. Errors - * on signing in/out can be caught in promises returned from - * sign-in/sign-out functions. - * @param completed - Deprecated. This callback is never triggered. - */ - onIdTokenChanged(nextOrObserver: NextOrObserver<User | null>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe; - /** - * returns a promise that resolves immediately when the initial - * auth state is settled. When the promise resolves, the current user might be a valid user - * or `null` if the user signed out. - */ - authStateReady(): Promise<void>; - /** The currently signed-in user (or null). */ - readonly currentUser: User | null; - /** The current emulator configuration (or null). */ - readonly emulatorConfig: EmulatorConfig | null; - /** - * Asynchronously sets the provided user as {@link Auth.currentUser} on the {@link Auth} instance. - * - * @remarks - * A new instance copy of the user provided will be made and set as currentUser. - * - * This will trigger {@link Auth.onAuthStateChanged} and {@link Auth.onIdTokenChanged} listeners - * like other sign in methods. - * - * The operation fails with an error if the user to be updated belongs to a different Firebase - * project. - * - * @param user - The new {@link User}. - */ - updateCurrentUser(user: User | null): Promise<void>; - /** - * Sets the current language to the default device/browser preference. - */ - useDeviceLanguage(): void; - /** - * Signs out the current user. This does not automatically revoke the user's ID token. - * - * @remarks - * This method is not supported by {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - */ - signOut(): Promise<void>; -} -/** - * An interface covering the possible persistence mechanism types. - * - * @public - */ -export interface Persistence { - /** - * Type of Persistence. - * - 'SESSION' is used for temporary persistence such as `sessionStorage`. - * - 'LOCAL' is used for long term persistence such as `localStorage` or `IndexedDB`. - * - 'NONE' is used for in-memory, or no persistence. - * - 'COOKIE' is used for cookie persistence, useful for server-side rendering. - */ - readonly type: 'SESSION' | 'LOCAL' | 'NONE' | 'COOKIE'; -} -/** - * Interface representing ID token result obtained from {@link User.getIdTokenResult}. - * - * @remarks - * `IdTokenResult` contains the ID token JWT string and other helper properties for getting different data - * associated with the token as well as all the decoded payload claims. - * - * Note that these claims are not to be trusted as they are parsed client side. Only server side - * verification can guarantee the integrity of the token claims. - * - * @public - */ -export interface IdTokenResult { - /** - * The authentication time formatted as a UTC string. - * - * @remarks - * This is the time the user authenticated (signed in) and not the time the token was refreshed. - */ - authTime: string; - /** The ID token expiration time formatted as a UTC string. */ - expirationTime: string; - /** The ID token issuance time formatted as a UTC string. */ - issuedAtTime: string; - /** - * The sign-in provider through which the ID token was obtained (anonymous, custom, phone, - * password, etc). - * - * @remarks - * Note, this does not map to provider IDs. - */ - signInProvider: string | null; - /** - * The type of second factor associated with this session, provided the user was multi-factor - * authenticated (eg. phone, etc). - */ - signInSecondFactor: string | null; - /** The Firebase Auth ID token JWT string. */ - token: string; - /** - * The entire payload claims of the ID token including the standard reserved claims as well as - * the custom claims. - */ - claims: ParsedToken; -} -/** - * A response from {@link checkActionCode}. - * - * @public - */ -export interface ActionCodeInfo { - /** - * The data associated with the action code. - * - * @remarks - * For the {@link ActionCodeOperation}.PASSWORD_RESET, {@link ActionCodeOperation}.VERIFY_EMAIL, and - * {@link ActionCodeOperation}.RECOVER_EMAIL actions, this object contains an email field with the address - * the email was sent to. - * - * For the {@link ActionCodeOperation}.RECOVER_EMAIL action, which allows a user to undo an email address - * change, this object also contains a `previousEmail` field with the user account's current - * email address. After the action completes, the user's email address will revert to the value - * in the `email` field from the value in `previousEmail` field. - * - * For the {@link ActionCodeOperation}.VERIFY_AND_CHANGE_EMAIL action, which allows a user to verify the - * email before updating it, this object contains a `previousEmail` field with the user account's - * email address before updating. After the action completes, the user's email address will be - * updated to the value in the `email` field from the value in `previousEmail` field. - * - * For the {@link ActionCodeOperation}.REVERT_SECOND_FACTOR_ADDITION action, which allows a user to - * unenroll a newly added second factor, this object contains a `multiFactorInfo` field with - * the information about the second factor. For phone second factor, the `multiFactorInfo` - * is a {@link MultiFactorInfo} object, which contains the phone number. - */ - data: { - email?: string | null; - multiFactorInfo?: MultiFactorInfo | null; - previousEmail?: string | null; - }; - /** - * The type of operation that generated the action code. - */ - operation: (typeof ActionCodeOperationMap)[keyof typeof ActionCodeOperationMap]; -} -/** - * An enumeration of the possible email action types. - * - * @internal - */ -export declare const enum ActionCodeOperation { - /** The email link sign-in action. */ - EMAIL_SIGNIN = "EMAIL_SIGNIN", - /** The password reset action. */ - PASSWORD_RESET = "PASSWORD_RESET", - /** The email revocation action. */ - RECOVER_EMAIL = "RECOVER_EMAIL", - /** The revert second factor addition email action. */ - REVERT_SECOND_FACTOR_ADDITION = "REVERT_SECOND_FACTOR_ADDITION", - /** The revert second factor addition email action. */ - VERIFY_AND_CHANGE_EMAIL = "VERIFY_AND_CHANGE_EMAIL", - /** The email verification action. */ - VERIFY_EMAIL = "VERIFY_EMAIL" -} -/** - * An interface that defines the required continue/state URL with optional Android and iOS - * bundle identifiers. - * - * @public - */ -export interface ActionCodeSettings { - /** - * Sets the Android package name. - * - * @remarks - * This will try to open the link in an Android app if it is installed. - */ - android?: { - installApp?: boolean; - minimumVersion?: string; - packageName: string; - }; - /** - * When set to true, the action code link will be be sent as a Universal Link or Android App - * Link and will be opened by the app if installed. - * - * @remarks - * In the false case, the code will be sent to the web widget first and then on continue will - * redirect to the app if installed. - * - * @defaultValue false - */ - handleCodeInApp?: boolean; - /** - * Sets the iOS bundle ID. - * - * @remarks - * This will try to open the link in an iOS app if it is installed. - */ - iOS?: { - bundleId: string; - }; - /** - * Sets the link continue/state URL. - * - * @remarks - * This has different meanings in different contexts: - * - When the link is handled in the web action widgets, this is the deep link in the - * `continueUrl` query parameter. - * - When the link is handled in the app directly, this is the `continueUrl` query parameter in - * the deep link of the Dynamic Link or Hosting link. - */ - url: string; - /** - * When multiple custom dynamic link domains are defined for a project, specify which one to use - * when the link is to be opened via a specified mobile app (for example, `example.page.link`). - * - * - * @defaultValue The first domain is automatically selected. - * - * @deprecated Firebase Dynamic Links is deprecated and will be shut down as early as August - * 2025. Instead, use {@link ActionCodeSettings.linkDomain} to set a custom domain for mobile - * links. Learn more in the {@link https://firebase.google.com/support/dynamic-links-faq | Dynamic Links deprecation FAQ}. - */ - dynamicLinkDomain?: string; - /** - * The optional custom Firebase Hosting domain to use when the link is to be opened via - * a specified mobile app. The domain must be configured in Firebase Hosting and owned - * by the project. This cannot be a default Hosting domain (`web.app` or `firebaseapp.com`). - * - * @defaultValue The default Hosting domain will be used (for example, `example.firebaseapp.com`). - */ - linkDomain?: string; -} -/** - * A verifier for domain verification and abuse prevention. - * - * @remarks - * Currently, the only implementation is {@link RecaptchaVerifier}. - * - * @public - */ -export interface ApplicationVerifier { - /** - * Identifies the type of application verifier (e.g. "recaptcha"). - */ - readonly type: string; - /** - * Executes the verification process. - * - * @returns A Promise for a token that can be used to assert the validity of a request. - */ - verify(): Promise<string>; -} -/** - * Interface that represents an auth provider, used to facilitate creating {@link AuthCredential}. - * - * @public - */ -export interface AuthProvider { - /** - * Provider for which credentials can be constructed. - */ - readonly providerId: string; -} -/** - * An enum of factors that may be used for multifactor authentication. - * - * Internally we use an enum type for FactorId, ActionCodeOperation, but there is a copy in https://github.com/firebase/firebase-js-sdk/blob/48a2096aec53a7eaa9ffcc2625016ecb9f90d113/packages/auth/src/model/enum_maps.ts#L23 that uses maps. - * const enums are better for tree-shaking, however can cause runtime errors if exposed in public APIs, example - https://github.com/microsoft/rushstack/issues/3058 - * So, we expose enum maps publicly, but use const enums internally to get some tree-shaking benefit. - * @internal - */ -export declare const enum FactorId { - /** Phone as second factor */ - PHONE = "phone", - TOTP = "totp" -} -/** - * A result from a phone number sign-in, link, or reauthenticate call. - * - * @public - */ -export interface ConfirmationResult { - /** - * The phone number authentication operation's verification ID. - * - * @remarks - * This can be used along with the verification code to initialize a - * {@link PhoneAuthCredential}. - */ - readonly verificationId: string; - /** - * Finishes a phone number sign-in, link, or reauthentication. - * - * @example - * ```javascript - * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier); - * // Obtain verificationCode from the user. - * const userCredential = await confirmationResult.confirm(verificationCode); - * ``` - * - * @param verificationCode - The code that was sent to the user's mobile device. - */ - confirm(verificationCode: string): Promise<UserCredential>; -} -/** - * The base class for asserting ownership of a second factor. - * - * @remarks - * This is used to facilitate enrollment of a second factor on an existing user or sign-in of a - * user who already verified the first factor. - * - * @public - */ -export interface MultiFactorAssertion { - /** The identifier of the second factor. */ - readonly factorId: (typeof FactorIdMap)[keyof typeof FactorIdMap]; -} -/** - * The error thrown when the user needs to provide a second factor to sign in successfully. - * - * @remarks - * The error code for this error is `auth/multi-factor-auth-required`. - * - * @example - * ```javascript - * let resolver; - * let multiFactorHints; - * - * signInWithEmailAndPassword(auth, email, password) - * .then((result) => { - * // User signed in. No 2nd factor challenge is needed. - * }) - * .catch((error) => { - * if (error.code == 'auth/multi-factor-auth-required') { - * resolver = getMultiFactorResolver(auth, error); - * multiFactorHints = resolver.hints; - * } else { - * // Handle other errors. - * } - * }); - * - * // Obtain a multiFactorAssertion by verifying the second factor. - * - * const userCredential = await resolver.resolveSignIn(multiFactorAssertion); - * ``` - * - * @public - */ -export interface MultiFactorError extends AuthError { - /** Details about the MultiFactorError. */ - readonly customData: AuthError['customData'] & { - /** - * The type of operation (sign-in, linking, or re-authentication) that raised the error. - */ - readonly operationType: (typeof OperationTypeMap)[keyof typeof OperationTypeMap]; - }; -} -/** - * A structure containing the information of a second factor entity. - * - * @public - */ -export interface MultiFactorInfo { - /** The multi-factor enrollment ID. */ - readonly uid: string; - /** The user friendly name of the current second factor. */ - readonly displayName?: string | null; - /** The enrollment date of the second factor formatted as a UTC string. */ - readonly enrollmentTime: string; - /** The identifier of the second factor. */ - readonly factorId: (typeof FactorIdMap)[keyof typeof FactorIdMap]; -} -/** - * The subclass of the {@link MultiFactorInfo} interface for phone number - * second factors. The `factorId` of this second factor is {@link FactorId}.PHONE. - * @public - */ -export interface PhoneMultiFactorInfo extends MultiFactorInfo { - /** The phone number associated with the current second factor. */ - readonly phoneNumber: string; -} -/** - * The subclass of the {@link MultiFactorInfo} interface for TOTP - * second factors. The `factorId` of this second factor is {@link FactorId}.TOTP. - * @public - */ -export interface TotpMultiFactorInfo extends MultiFactorInfo { -} -/** - * The class used to facilitate recovery from {@link MultiFactorError} when a user needs to - * provide a second factor to sign in. - * - * @example - * ```javascript - * let resolver; - * let multiFactorHints; - * - * signInWithEmailAndPassword(auth, email, password) - * .then((result) => { - * // User signed in. No 2nd factor challenge is needed. - * }) - * .catch((error) => { - * if (error.code == 'auth/multi-factor-auth-required') { - * resolver = getMultiFactorResolver(auth, error); - * // Show UI to let user select second factor. - * multiFactorHints = resolver.hints; - * } else { - * // Handle other errors. - * } - * }); - * - * // The enrolled second factors that can be used to complete - * // sign-in are returned in the `MultiFactorResolver.hints` list. - * // UI needs to be presented to allow the user to select a second factor - * // from that list. - * - * const selectedHint = // ; selected from multiFactorHints - * const phoneAuthProvider = new PhoneAuthProvider(auth); - * const phoneInfoOptions = { - * multiFactorHint: selectedHint, - * session: resolver.session - * }; - * const verificationId = phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier); - * // Store `verificationId` and show UI to let user enter verification code. - * - * // UI to enter verification code and continue. - * // Continue button click handler - * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential); - * const userCredential = await resolver.resolveSignIn(multiFactorAssertion); - * ``` - * - * @public - */ -export interface MultiFactorResolver { - /** - * The list of hints for the second factors needed to complete the sign-in for the current - * session. - */ - readonly hints: MultiFactorInfo[]; - /** - * The session identifier for the current sign-in flow, which can be used to complete the second - * factor sign-in. - */ - readonly session: MultiFactorSession; - /** - * A helper function to help users complete sign in with a second factor using an - * {@link MultiFactorAssertion} confirming the user successfully completed the second factor - * challenge. - * - * @example - * ```javascript - * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential); - * const userCredential = await resolver.resolveSignIn(multiFactorAssertion); - * ``` - * - * @param assertion - The multi-factor assertion to resolve sign-in with. - * @returns The promise that resolves with the user credential object. - */ - resolveSignIn(assertion: MultiFactorAssertion): Promise<UserCredential>; -} -/** - * An interface defining the multi-factor session object used for enrolling a second factor on a - * user or helping sign in an enrolled user with a second factor. - * - * @public - */ -export interface MultiFactorSession { -} -/** - * An interface that defines the multi-factor related properties and operations pertaining - * to a {@link User}. - * - * @public - */ -export interface MultiFactorUser { - /** Returns a list of the user's enrolled second factors. */ - readonly enrolledFactors: MultiFactorInfo[]; - /** - * Returns the session identifier for a second factor enrollment operation. This is used to - * identify the user trying to enroll a second factor. - * - * @example - * ```javascript - * const multiFactorUser = multiFactor(auth.currentUser); - * const multiFactorSession = await multiFactorUser.getSession(); - * - * // Send verification code. - * const phoneAuthProvider = new PhoneAuthProvider(auth); - * const phoneInfoOptions = { - * phoneNumber: phoneNumber, - * session: multiFactorSession - * }; - * const verificationId = await phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier); - * - * // Obtain verification code from user. - * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential); - * await multiFactorUser.enroll(multiFactorAssertion); - * ``` - * - * @returns The promise that resolves with the {@link MultiFactorSession}. - */ - getSession(): Promise<MultiFactorSession>; - /** - * - * Enrolls a second factor as identified by the {@link MultiFactorAssertion} for the - * user. - * - * @remarks - * On resolution, the user tokens are updated to reflect the change in the JWT payload. - * Accepts an additional display name parameter used to identify the second factor to the end - * user. Recent re-authentication is required for this operation to succeed. On successful - * enrollment, existing Firebase sessions (refresh tokens) are revoked. When a new factor is - * enrolled, an email notification is sent to the user’s email. - * - * @example - * ```javascript - * const multiFactorUser = multiFactor(auth.currentUser); - * const multiFactorSession = await multiFactorUser.getSession(); - * - * // Send verification code. - * const phoneAuthProvider = new PhoneAuthProvider(auth); - * const phoneInfoOptions = { - * phoneNumber: phoneNumber, - * session: multiFactorSession - * }; - * const verificationId = await phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier); - * - * // Obtain verification code from user. - * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential); - * await multiFactorUser.enroll(multiFactorAssertion); - * // Second factor enrolled. - * ``` - * - * @param assertion - The multi-factor assertion to enroll with. - * @param displayName - The display name of the second factor. - */ - enroll(assertion: MultiFactorAssertion, displayName?: string | null): Promise<void>; - /** - * Unenrolls the specified second factor. - * - * @remarks - * To specify the factor to remove, pass a {@link MultiFactorInfo} object (retrieved from - * {@link MultiFactorUser.enrolledFactors}) or the - * factor's UID string. Sessions are not revoked when the account is unenrolled. An email - * notification is likely to be sent to the user notifying them of the change. Recent - * re-authentication is required for this operation to succeed. When an existing factor is - * unenrolled, an email notification is sent to the user’s email. - * - * @example - * ```javascript - * const multiFactorUser = multiFactor(auth.currentUser); - * // Present user the option to choose which factor to unenroll. - * await multiFactorUser.unenroll(multiFactorUser.enrolledFactors[i]) - * ``` - * - * @param option - The multi-factor option to unenroll. - * @returns - A `Promise` which resolves when the unenroll operation is complete. - */ - unenroll(option: MultiFactorInfo | string): Promise<void>; -} -/** - * The class for asserting ownership of a phone second factor. Provided by - * {@link PhoneMultiFactorGenerator.assertion}. - * - * @public - */ -export interface PhoneMultiFactorAssertion extends MultiFactorAssertion { -} -/** - * The information required to verify the ownership of a phone number. - * - * @remarks - * The information that's required depends on whether you are doing single-factor sign-in, - * multi-factor enrollment or multi-factor sign-in. - * - * @public - */ -export type PhoneInfoOptions = PhoneSingleFactorInfoOptions | PhoneMultiFactorEnrollInfoOptions | PhoneMultiFactorSignInInfoOptions; -/** - * Options used for single-factor sign-in. - * - * @public - */ -export interface PhoneSingleFactorInfoOptions { - /** Phone number to send a verification code to. */ - phoneNumber: string; -} -/** - * Options used for enrolling a second factor. - * - * @public - */ -export interface PhoneMultiFactorEnrollInfoOptions { - /** Phone number to send a verification code to. */ - phoneNumber: string; - /** The {@link MultiFactorSession} obtained via {@link MultiFactorUser.getSession}. */ - session: MultiFactorSession; -} -/** - * Options used for signing in with a second factor. - * - * @public - */ -export interface PhoneMultiFactorSignInInfoOptions { - /** - * The {@link MultiFactorInfo} obtained via {@link MultiFactorResolver.hints}. - * - * One of `multiFactorHint` or `multiFactorUid` is required. - */ - multiFactorHint?: MultiFactorInfo; - /** - * The uid of the second factor. - * - * One of `multiFactorHint` or `multiFactorUid` is required. - */ - multiFactorUid?: string; - /** The {@link MultiFactorSession} obtained via {@link MultiFactorResolver.session}. */ - session: MultiFactorSession; -} -/** - * Interface for a supplied `AsyncStorage`. - * - * @public - */ -export interface ReactNativeAsyncStorage { - /** - * Persist an item in storage. - * - * @param key - storage key. - * @param value - storage value. - */ - setItem(key: string, value: string): Promise<void>; - /** - * Retrieve an item from storage. - * - * @param key - storage key. - */ - getItem(key: string): Promise<string | null>; - /** - * Remove an item from storage. - * - * @param key - storage key. - */ - removeItem(key: string): Promise<void>; -} -/** - * A user account. - * - * @public - */ -export interface User extends UserInfo { - /** - * Whether the email has been verified with {@link sendEmailVerification} and - * {@link applyActionCode}. - */ - readonly emailVerified: boolean; - /** - * Whether the user is authenticated using the {@link ProviderId}.ANONYMOUS provider. - */ - readonly isAnonymous: boolean; - /** - * Additional metadata around user creation and sign-in times. - */ - readonly metadata: UserMetadata; - /** - * Additional per provider such as displayName and profile information. - */ - readonly providerData: UserInfo[]; - /** - * Refresh token used to reauthenticate the user. Avoid using this directly and prefer - * {@link User.getIdToken} to refresh the ID token instead. - */ - readonly refreshToken: string; - /** - * The user's tenant ID. - * - * @remarks - * This is a read-only property, which indicates the tenant ID - * used to sign in the user. This is null if the user is signed in from the parent - * project. - * - * @example - * ```javascript - * // Set the tenant ID on Auth instance. - * auth.tenantId = 'TENANT_PROJECT_ID'; - * - * // All future sign-in request now include tenant ID. - * const result = await signInWithEmailAndPassword(auth, email, password); - * // result.user.tenantId should be 'TENANT_PROJECT_ID'. - * ``` - */ - readonly tenantId: string | null; - /** - * Deletes and signs out the user. - * - * @remarks - * Important: this is a security-sensitive operation that requires the user to have recently - * signed in. If this requirement isn't met, ask the user to authenticate again and then call - * one of the reauthentication methods like {@link reauthenticateWithCredential}. - * - * This method is not supported on any {@link User} signed in by {@link Auth} instances - * created with a {@link @firebase/app#FirebaseServerApp}. - */ - delete(): Promise<void>; - /** - * Returns a JSON Web Token (JWT) used to identify the user to a Firebase service. - * - * @remarks - * Returns the current token if it has not expired or if it will not expire in the next five - * minutes. Otherwise, this will refresh the token and return a new one. - * - * @param forceRefresh - Force refresh regardless of token expiration. - */ - getIdToken(forceRefresh?: boolean): Promise<string>; - /** - * Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service. - * - * @remarks - * Returns the current token if it has not expired or if it will not expire in the next five - * minutes. Otherwise, this will refresh the token and return a new one. - * - * @param forceRefresh - Force refresh regardless of token expiration. - */ - getIdTokenResult(forceRefresh?: boolean): Promise<IdTokenResult>; - /** - * Refreshes the user, if signed in. - */ - reload(): Promise<void>; - /** - * Returns a JSON-serializable representation of this object. - * - * @returns A JSON-serializable representation of this object. - */ - toJSON(): object; -} -/** - * A structure containing a {@link User}, the {@link OperationType}, and the provider ID. - * - * @remarks - * `operationType` could be {@link OperationType}.SIGN_IN for a sign-in operation, - * {@link OperationType}.LINK for a linking operation and {@link OperationType}.REAUTHENTICATE for - * a reauthentication operation. - * - * @public - */ -export interface UserCredential { - /** - * The user authenticated by this credential. - */ - user: User; - /** - * The provider which was used to authenticate the user. - */ - providerId: string | null; - /** - * The type of operation which was used to authenticate the user (such as sign-in or link). - */ - operationType: (typeof OperationTypeMap)[keyof typeof OperationTypeMap]; -} -/** - * User profile information, visible only to the Firebase project's apps. - * - * @public - */ -export interface UserInfo { - /** - * The display name of the user. - */ - readonly displayName: string | null; - /** - * The email of the user. - */ - readonly email: string | null; - /** - * The phone number normalized based on the E.164 standard (e.g. +16505550101) for the - * user. - * - * @remarks - * This is null if the user has no phone credential linked to the account. - */ - readonly phoneNumber: string | null; - /** - * The profile photo URL of the user. - */ - readonly photoURL: string | null; - /** - * The provider used to authenticate the user. - */ - readonly providerId: string; - /** - * The user's unique ID, scoped to the project. - */ - readonly uid: string; -} -/** - * Interface representing a user's metadata. - * - * @public - */ -export interface UserMetadata { - /** Time the user was created. */ - readonly creationTime?: string; - /** Time the user last signed in. */ - readonly lastSignInTime?: string; -} -/** - * A structure containing additional user information from a federated identity provider. - * - * @public - */ -export interface AdditionalUserInfo { - /** - * Whether the user is new (created via sign-up) or existing (authenticated using sign-in). - */ - readonly isNewUser: boolean; - /** - * Map containing IDP-specific user data. - */ - readonly profile: Record<string, unknown> | null; - /** - * Identifier for the provider used to authenticate this user. - */ - readonly providerId: string | null; - /** - * The username if the provider is GitHub or Twitter. - */ - readonly username?: string | null; -} -/** - * User profile used in {@link AdditionalUserInfo}. - * - * @public - */ -export type UserProfile = Record<string, unknown>; -/** - * A resolver used for handling DOM specific operations like {@link signInWithPopup} - * or {@link signInWithRedirect}. - * - * @public - */ -export interface PopupRedirectResolver { -} -declare module '@firebase/component' { - interface NameServiceMapping { - 'auth': Auth; - } -} -/** - * Configuration of Firebase Authentication Emulator. - * @public - */ -export interface EmulatorConfig { - /** - * The protocol used to communicate with the emulator ("http"/"https"). - */ - readonly protocol: string; - /** - * The hostname of the emulator, which may be a domain ("localhost"), IPv4 address ("127.0.0.1") - * or quoted IPv6 address ("[::1]"). - */ - readonly host: string; - /** - * The port of the emulator, or null if port isn't specified (i.e. protocol default). - */ - readonly port: number | null; - /** - * The emulator-specific options. - */ - readonly options: { - /** - * Whether the warning banner attached to the DOM was disabled. - */ - readonly disableWarnings: boolean; - }; -} -/** - * A mapping of error codes to error messages. - * - * @remarks - * - * While error messages are useful for debugging (providing verbose textual - * context around what went wrong), these strings take up a lot of space in the - * compiled code. When deploying code in production, using {@link prodErrorMap} - * will save you roughly 10k compressed/gzipped over {@link debugErrorMap}. You - * can select the error map during initialization: - * - * ```javascript - * initializeAuth(app, {errorMap: debugErrorMap}) - * ``` - * - * When initializing Auth, {@link prodErrorMap} is default. - * - * @public - */ -export interface AuthErrorMap { -} -/** - * The dependencies that can be used to initialize an {@link Auth} instance. - * - * @remarks - * - * The modular SDK enables tree shaking by allowing explicit declarations of - * dependencies. For example, a web app does not need to include code that - * enables Cordova redirect sign in. That functionality is therefore split into - * {@link browserPopupRedirectResolver} and - * {@link cordovaPopupRedirectResolver}. The dependencies object is how Auth is - * configured to reduce bundle sizes. - * - * There are two ways to initialize an {@link Auth} instance: {@link getAuth} and - * {@link initializeAuth}. `getAuth` initializes everything using - * platform-specific configurations, while `initializeAuth` takes a - * `Dependencies` object directly, giving you more control over what is used. - * - * @public - */ -export interface Dependencies { - /** - * Which {@link Persistence} to use. If this is an array, the first - * `Persistence` that the device supports is used. The SDK searches for an - * existing account in order and, if one is found in a secondary - * `Persistence`, the account is moved to the primary `Persistence`. - * - * If no persistence is provided, the SDK falls back on - * {@link inMemoryPersistence}. - */ - persistence?: Persistence | Persistence[]; - /** - * The {@link PopupRedirectResolver} to use. This value depends on the - * platform. Options are {@link browserPopupRedirectResolver} and - * {@link cordovaPopupRedirectResolver}. This field is optional if neither - * {@link signInWithPopup} or {@link signInWithRedirect} are being used. - */ - popupRedirectResolver?: PopupRedirectResolver; - /** - * Which {@link AuthErrorMap} to use. - */ - errorMap?: AuthErrorMap; -} -/** - * The class for asserting ownership of a TOTP second factor. Provided by - * {@link TotpMultiFactorGenerator.assertionForEnrollment} and - * {@link TotpMultiFactorGenerator.assertionForSignIn}. - * - * @public - */ -export interface TotpMultiFactorAssertion extends MultiFactorAssertion { -} -/** - * A structure specifying password policy requirements. - * - * @public - */ -export interface PasswordPolicy { - /** - * Requirements enforced by this password policy. - */ - readonly customStrengthOptions: { - /** - * Minimum password length, or undefined if not configured. - */ - readonly minPasswordLength?: number; - /** - * Maximum password length, or undefined if not configured. - */ - readonly maxPasswordLength?: number; - /** - * Whether the password should contain a lowercase letter, or undefined if not configured. - */ - readonly containsLowercaseLetter?: boolean; - /** - * Whether the password should contain an uppercase letter, or undefined if not configured. - */ - readonly containsUppercaseLetter?: boolean; - /** - * Whether the password should contain a numeric character, or undefined if not configured. - */ - readonly containsNumericCharacter?: boolean; - /** - * Whether the password should contain a non-alphanumeric character, or undefined if not configured. - */ - readonly containsNonAlphanumericCharacter?: boolean; - }; - /** - * List of characters that are considered non-alphanumeric during validation. - */ - readonly allowedNonAlphanumericCharacters: string; - /** - * The enforcement state of the policy. Can be 'OFF' or 'ENFORCE'. - */ - readonly enforcementState: string; - /** - * Whether existing passwords must meet the policy. - */ - readonly forceUpgradeOnSignin: boolean; -} -/** - * A structure indicating which password policy requirements were met or violated and what the - * requirements are. - * - * @public - */ -export interface PasswordValidationStatus { - /** - * Whether the password meets all requirements. - */ - readonly isValid: boolean; - /** - * Whether the password meets the minimum password length, or undefined if not required. - */ - readonly meetsMinPasswordLength?: boolean; - /** - * Whether the password meets the maximum password length, or undefined if not required. - */ - readonly meetsMaxPasswordLength?: boolean; - /** - * Whether the password contains a lowercase letter, or undefined if not required. - */ - readonly containsLowercaseLetter?: boolean; - /** - * Whether the password contains an uppercase letter, or undefined if not required. - */ - readonly containsUppercaseLetter?: boolean; - /** - * Whether the password contains a numeric character, or undefined if not required. - */ - readonly containsNumericCharacter?: boolean; - /** - * Whether the password contains a non-alphanumeric character, or undefined if not required. - */ - readonly containsNonAlphanumericCharacter?: boolean; - /** - * The policy used to validate the password. - */ - readonly passwordPolicy: PasswordPolicy; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/user.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/user.d.ts deleted file mode 100644 index 7e40566..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/model/user.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { IdTokenResult, User, UserCredential, UserInfo } from './public_types'; -import { NextFn } from '@firebase/util'; -import { APIUserInfo } from '../api/account_management/account'; -import { FinalizeMfaResponse } from '../api/authentication/mfa'; -import { PersistedBlob } from '../core/persistence'; -import { StsTokenManager } from '../core/user/token_manager'; -import { UserMetadata } from '../core/user/user_metadata'; -import { AuthInternal } from './auth'; -import { IdTokenResponse, TaggedWithTokenResponse } from './id_token'; -import { ProviderId } from './enums'; -export type MutableUserInfo = { - -readonly [K in keyof UserInfo]: UserInfo[K]; -}; -export interface UserParameters { - uid: string; - auth: AuthInternal; - stsTokenManager: StsTokenManager; - displayName?: string | null; - email?: string | null; - phoneNumber?: string | null; - photoURL?: string | null; - isAnonymous?: boolean | null; - emailVerified?: boolean | null; - tenantId?: string | null; - providerData?: MutableUserInfo[] | null; - createdAt?: string | null; - lastLoginAt?: string | null; -} -/** - * UserInternal and AuthInternal reference each other, so both of them are included in the public typings. - * In order to exclude them, we mark them as internal explicitly. - * - * @internal - */ -export interface UserInternal extends User { - displayName: string | null; - email: string | null; - phoneNumber: string | null; - photoURL: string | null; - auth: AuthInternal; - providerId: ProviderId.FIREBASE; - refreshToken: string; - emailVerified: boolean; - tenantId: string | null; - providerData: MutableUserInfo[]; - metadata: UserMetadata; - stsTokenManager: StsTokenManager; - _redirectEventId?: string; - _updateTokensIfNecessary(response: IdTokenResponse | FinalizeMfaResponse, reload?: boolean): Promise<void>; - _assign(user: UserInternal): void; - _clone(auth: AuthInternal): UserInternal; - _onReload: (cb: NextFn<APIUserInfo>) => void; - _notifyReloadListener: NextFn<APIUserInfo>; - _startProactiveRefresh: () => void; - _stopProactiveRefresh: () => void; - getIdToken(forceRefresh?: boolean): Promise<string>; - getIdTokenResult(forceRefresh?: boolean): Promise<IdTokenResult>; - reload(): Promise<void>; - delete(): Promise<void>; - toJSON(): PersistedBlob; -} -/** - * @internal - */ -export interface UserCredentialInternal extends UserCredential, TaggedWithTokenResponse { - user: UserInternal; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/auth_window.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/auth_window.d.ts deleted file mode 100644 index b3087c7..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/auth_window.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Recaptcha, GreCAPTCHATopLevel } from './recaptcha/recaptcha'; -/** - * A specialized window type that melds the normal window type plus the - * various bits we need. The three different blocks that are &'d together - * cant be defined in the same block together. - */ -export type AuthWindow = { - [T in keyof Window]: Window[T]; -} & { - grecaptcha?: Recaptcha | GreCAPTCHATopLevel; - ___jsl?: Record<string, any>; - gapi?: typeof gapi; -} & { - [callback: string]: (...args: unknown[]) => void; -}; -/** - * Lazy accessor for window, since the compat layer won't tree shake this out, - * we need to make sure not to mess with window unless we have to - */ -export declare function _window(): AuthWindow; -export declare function _setWindowLocation(url: string): void; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/iframe/gapi.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/iframe/gapi.d.ts deleted file mode 100644 index c2a65cd..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/iframe/gapi.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthInternal } from '../../model/auth'; -export declare function _loadGapi(auth: AuthInternal): Promise<gapi.iframes.Context>; -export declare function _resetLoader(): void; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/iframe/gapi.iframes.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/iframe/gapi.iframes.d.ts deleted file mode 100644 index 9b5f24b..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/iframe/gapi.iframes.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -declare namespace gapi { - type LoadCallback = () => void; - interface LoadConfig { - } - interface LoadOptions { - callback?: LoadCallback; - timeout?: number; - ontimeout?: LoadCallback; - } - function load(features: 'gapi.iframes', options?: LoadOptions | LoadCallback): void; -} -declare namespace gapi.iframes { - interface Message { - type: string; - } - type IframesFilter = (iframe: Iframe) => boolean; - type MessageHandler<T extends Message> = (message: T) => unknown | Promise<void>; - type SendCallback = () => void; - type Callback = (iframe: Iframe) => void; - class Context { - open(options: Record<string, unknown>, callback?: Callback): Promise<Iframe>; - } - class Iframe { - register<T extends Message>(message: string, handler: MessageHandler<T>, filter?: IframesFilter): void; - send<T extends Message, U extends Message>(type: string, data: T, callback?: MessageHandler<U>, filter?: IframesFilter): void; - ping(callback: SendCallback, data?: unknown): Promise<unknown[]>; - restyle(style: Record<string, string | boolean>, callback?: SendCallback): Promise<unknown[]>; - } - const CROSS_ORIGIN_IFRAMES_FILTER: IframesFilter; - function getContext(): Context; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/iframe/iframe.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/iframe/iframe.d.ts deleted file mode 100644 index 781c92f..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/iframe/iframe.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthInternal } from '../../model/auth'; -export declare function _openIframe(auth: AuthInternal): Promise<gapi.iframes.Iframe>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/index.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/index.d.ts deleted file mode 100644 index ebd5cb8..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/index.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { FirebaseApp } from '@firebase/app'; -import { Auth } from '../model/public_types'; -/** - * Returns the Auth instance associated with the provided {@link @firebase/app#FirebaseApp}. - * If no instance exists, initializes an Auth instance with platform-specific default dependencies. - * - * @param app - The Firebase App. - * - * @public - */ -export declare function getAuth(app?: FirebaseApp): Auth; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/load_js.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/load_js.d.ts deleted file mode 100644 index 861517a..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/load_js.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -interface ExternalJSProvider { - loadJS(url: string): Promise<Event>; - recaptchaV2Script: string; - recaptchaEnterpriseScript: string; - gapiScript: string; -} -export declare function _setExternalJSProvider(p: ExternalJSProvider): void; -export declare function _loadJS(url: string): Promise<Event>; -export declare function _recaptchaV2ScriptUrl(): string; -export declare function _recaptchaEnterpriseScriptUrl(): string; -export declare function _gapiScriptUrl(): string; -export declare function _generateCallbackName(prefix: string): string; -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/messagechannel/index.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/messagechannel/index.d.ts deleted file mode 100644 index 78beb52..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/messagechannel/index.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { PromiseSettledResult } from './promise'; -export declare const enum _TimeoutDuration { - ACK = 50, - COMPLETION = 3000, - LONG_ACK = 800 -} -/** - * Enumeration of possible response types from the Receiver. - */ -export declare const enum _Status { - ACK = "ack", - DONE = "done" -} -export declare const enum _MessageError { - CONNECTION_CLOSED = "connection_closed", - CONNECTION_UNAVAILABLE = "connection_unavailable", - INVALID_RESPONSE = "invalid_response", - TIMEOUT = "timeout", - UNKNOWN = "unknown_error", - UNSUPPORTED_EVENT = "unsupported_event" -} -/** - * Enumeration of possible events sent by the Sender. - */ -export declare const enum _EventType { - KEY_CHANGED = "keyChanged", - PING = "ping" -} -/** - * Response to a {@link EventType.KEY_CHANGED} event. - */ -export interface KeyChangedResponse { - keyProcessed: boolean; -} -/** - * Response to a {@link EventType.PING} event. - */ -export type _PingResponse = _EventType[]; -export type _ReceiverResponse = KeyChangedResponse | _PingResponse; -interface MessageEvent { - eventType: _EventType; - eventId: string; -} -/** - * Request for a {@link EventType.KEY_CHANGED} event. - */ -export interface KeyChangedRequest { - key: string; -} -/** - * Request for a {@link EventType.PING} event. - */ -export interface PingRequest { -} -/** Data sent by Sender */ -export type _SenderRequest = KeyChangedRequest | PingRequest; -/** Receiver handler to process events sent by the Sender */ -export interface ReceiverHandler<T extends _ReceiverResponse, S extends _SenderRequest> { - (origin: string, data: S): T | Promise<T>; -} -/** Full message sent by Sender */ -export interface SenderMessageEvent<T extends _SenderRequest> extends MessageEvent { - data: T; -} -export type _ReceiverMessageResponse<T extends _ReceiverResponse> = Array<PromiseSettledResult<T>> | null; -/** Full message sent by Receiver */ -export interface ReceiverMessageEvent<T extends _ReceiverResponse> extends MessageEvent { - status: _Status; - response: _ReceiverMessageResponse<T>; -} -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/messagechannel/promise.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/messagechannel/promise.d.ts deleted file mode 100644 index d57013b..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/messagechannel/promise.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** TODO: remove this once tslib has a polyfill for Promise.allSettled */ -interface PromiseFulfilledResult<T> { - fulfilled: true; - value: T; -} -interface PromiseRejectedResult { - fulfilled: false; - reason: any; -} -export type PromiseSettledResult<T> = PromiseFulfilledResult<T> | PromiseRejectedResult; -/** - * Shim for Promise.allSettled, note the slightly different format of `fulfilled` vs `status`. - * - * @param promises - Array of promises to wait on. - */ -export declare function _allSettled<T>(promises: Array<Promise<T>>): Promise<Array<PromiseSettledResult<T>>>; -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/messagechannel/receiver.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/messagechannel/receiver.d.ts deleted file mode 100644 index 394de7b..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/messagechannel/receiver.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ReceiverHandler, _EventType, _ReceiverResponse, _SenderRequest } from './index'; -/** - * Interface class for receiving messages. - * - */ -export declare class Receiver { - private readonly eventTarget; - private static readonly receivers; - private readonly boundEventHandler; - private readonly handlersMap; - constructor(eventTarget: EventTarget); - /** - * Obtain an instance of a Receiver for a given event target, if none exists it will be created. - * - * @param eventTarget - An event target (such as window or self) through which the underlying - * messages will be received. - */ - static _getInstance(eventTarget: EventTarget): Receiver; - private isListeningto; - /** - * Fans out a MessageEvent to the appropriate listeners. - * - * @remarks - * Sends an {@link Status.ACK} upon receipt and a {@link Status.DONE} once all handlers have - * finished processing. - * - * @param event - The MessageEvent. - * - */ - private handleEvent; - /** - * Subscribe an event handler for a particular event. - * - * @param eventType - Event name to subscribe to. - * @param eventHandler - The event handler which should receive the events. - * - */ - _subscribe<T extends _ReceiverResponse, S extends _SenderRequest>(eventType: _EventType, eventHandler: ReceiverHandler<T, S>): void; - /** - * Unsubscribe an event handler from a particular event. - * - * @param eventType - Event name to unsubscribe from. - * @param eventHandler - Optional event handler, if none provided, unsubscribe all handlers on this event. - * - */ - _unsubscribe<T extends _ReceiverResponse, S extends _SenderRequest>(eventType: _EventType, eventHandler?: ReceiverHandler<T, S>): void; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/messagechannel/sender.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/messagechannel/sender.d.ts deleted file mode 100644 index a1121b6..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/messagechannel/sender.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { _SenderRequest, _EventType, _ReceiverMessageResponse, _ReceiverResponse, _TimeoutDuration } from './index'; -/** - * Interface for sending messages and waiting for a completion response. - * - */ -export declare class Sender { - private readonly target; - private readonly handlers; - constructor(target: ServiceWorker); - /** - * Unsubscribe the handler and remove it from our tracking Set. - * - * @param handler - The handler to unsubscribe. - */ - private removeMessageHandler; - /** - * Send a message to the Receiver located at {@link target}. - * - * @remarks - * We'll first wait a bit for an ACK , if we get one we will wait significantly longer until the - * receiver has had a chance to fully process the event. - * - * @param eventType - Type of event to send. - * @param data - The payload of the event. - * @param timeout - Timeout for waiting on an ACK from the receiver. - * - * @returns An array of settled promises from all the handlers that were listening on the receiver. - */ - _send<T extends _ReceiverResponse, S extends _SenderRequest>(eventType: _EventType, data: S, timeout?: _TimeoutDuration): Promise<_ReceiverMessageResponse<T>>; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/mfa/assertions/phone.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/mfa/assertions/phone.d.ts deleted file mode 100644 index dc0292d..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/mfa/assertions/phone.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { PhoneMultiFactorAssertion } from '../../../model/public_types'; -import { MultiFactorAssertionImpl } from '../../../mfa/mfa_assertion'; -import { AuthInternal } from '../../../model/auth'; -import { PhoneAuthCredential } from '../../../core/credentials/phone'; -import { FinalizeMfaResponse } from '../../../api/authentication/mfa'; -/** - * {@inheritdoc PhoneMultiFactorAssertion} - * - * @public - */ -export declare class PhoneMultiFactorAssertionImpl extends MultiFactorAssertionImpl implements PhoneMultiFactorAssertion { - private readonly credential; - private constructor(); - /** @internal */ - static _fromCredential(credential: PhoneAuthCredential): PhoneMultiFactorAssertionImpl; - /** @internal */ - _finalizeEnroll(auth: AuthInternal, idToken: string, displayName?: string | null): Promise<FinalizeMfaResponse>; - /** @internal */ - _finalizeSignIn(auth: AuthInternal, mfaPendingCredential: string): Promise<FinalizeMfaResponse>; -} -/** - * Provider for generating a {@link PhoneMultiFactorAssertion}. - * - * @public - */ -export declare class PhoneMultiFactorGenerator { - private constructor(); - /** - * Provides a {@link PhoneMultiFactorAssertion} to confirm ownership of the phone second factor. - * - * @remarks - * This method does not work in a Node.js environment. - * - * @param phoneAuthCredential - A credential provided by {@link PhoneAuthProvider.credential}. - * @returns A {@link PhoneMultiFactorAssertion} which can be used with - * {@link MultiFactorResolver.resolveSignIn} - */ - static assertion(credential: PhoneAuthCredential): PhoneMultiFactorAssertion; - /** - * The identifier of the phone second factor: `phone`. - */ - static FACTOR_ID: string; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/persistence/browser.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/persistence/browser.d.ts deleted file mode 100644 index 5635d97..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/persistence/browser.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { PersistenceValue, PersistenceType } from '../../core/persistence'; -export declare abstract class BrowserPersistenceClass { - protected readonly storageRetriever: () => Storage; - readonly type: PersistenceType; - protected constructor(storageRetriever: () => Storage, type: PersistenceType); - _isAvailable(): Promise<boolean>; - _set(key: string, value: PersistenceValue): Promise<void>; - _get<T extends PersistenceValue>(key: string): Promise<T | null>; - _remove(key: string): Promise<void>; - protected get storage(): Storage; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/persistence/cookie_storage.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/persistence/cookie_storage.d.ts deleted file mode 100644 index f30bcef..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/persistence/cookie_storage.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @license - * Copyright 2025 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Persistence } from '../../model/public_types'; -import { PersistenceInternal, PersistenceType, PersistenceValue, StorageEventListener } from '../../core/persistence'; -export declare class CookiePersistence implements PersistenceInternal { - static type: 'COOKIE'; - readonly type = PersistenceType.COOKIE; - listenerUnsubscribes: Map<StorageEventListener, () => void>; - _getFinalTarget(originalUrl: string): URL | string; - _isAvailable(): Promise<boolean>; - _set(_key: string, _value: PersistenceValue): Promise<void>; - _get<T extends PersistenceValue>(key: string): Promise<T | null>; - _remove(key: string): Promise<void>; - _addListener(key: string, listener: StorageEventListener): void; - _removeListener(_key: string, listener: StorageEventListener): void; -} -/** - * An implementation of {@link Persistence} of type `COOKIE`, for use on the client side in - * applications leveraging hybrid rendering and middleware. - * - * @remarks This persistence method requires companion middleware to function, such as that provided - * by {@link https://firebaseopensource.com/projects/firebaseextended/reactfire/ | ReactFire} for - * NextJS. - * @beta - */ -export declare const browserCookiePersistence: Persistence; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/persistence/indexed_db.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/persistence/indexed_db.d.ts deleted file mode 100644 index 23c1604..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/persistence/indexed_db.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Persistence } from '../../model/public_types'; -import { PersistenceValue } from '../../core/persistence/'; -export declare const DB_NAME = "firebaseLocalStorageDb"; -export declare function _clearDatabase(db: IDBDatabase): Promise<void>; -export declare function _deleteDatabase(): Promise<void>; -export declare function _openDatabase(): Promise<IDBDatabase>; -export declare function _putObject(db: IDBDatabase, key: string, value: PersistenceValue | string): Promise<void>; -export declare function _deleteObject(db: IDBDatabase, key: string): Promise<void>; -export declare const _POLLING_INTERVAL_MS = 800; -export declare const _TRANSACTION_RETRY_COUNT = 3; -/** - * An implementation of {@link Persistence} of type `LOCAL` using `indexedDB` - * for the underlying storage. - * - * @public - */ -export declare const indexedDBLocalPersistence: Persistence; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/persistence/local_storage.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/persistence/local_storage.d.ts deleted file mode 100644 index 34d8d64..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/persistence/local_storage.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Persistence } from '../../model/public_types'; -export declare const _POLLING_INTERVAL_MS = 1000; -/** - * An implementation of {@link Persistence} of type `LOCAL` using `localStorage` - * for the underlying storage. - * - * @public - */ -export declare const browserLocalPersistence: Persistence; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/persistence/session_storage.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/persistence/session_storage.d.ts deleted file mode 100644 index 117c558..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/persistence/session_storage.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Persistence } from '../../model/public_types'; -/** - * An implementation of {@link Persistence} of `SESSION` using `sessionStorage` - * for the underlying storage. - * - * @public - */ -export declare const browserSessionPersistence: Persistence; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/popup_redirect.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/popup_redirect.d.ts deleted file mode 100644 index 61b8ca7..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/popup_redirect.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { PopupRedirectResolver } from '../model/public_types'; -/** - * An implementation of {@link PopupRedirectResolver} suitable for browser - * based applications. - * - * @remarks - * This method does not work in a Node.js environment. - * - * @public - */ -export declare const browserPopupRedirectResolver: PopupRedirectResolver; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/providers/phone.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/providers/phone.d.ts deleted file mode 100644 index 6c1d728..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/providers/phone.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth, PhoneInfoOptions, ApplicationVerifier, UserCredential } from '../../model/public_types'; -import { PhoneAuthCredential } from '../../core/credentials/phone'; -import { AuthCredential } from '../../core'; -import { FirebaseError } from '@firebase/util'; -/** - * Provider for generating an {@link PhoneAuthCredential}. - * - * @remarks - * `PhoneAuthProvider` does not work in a Node.js environment. - * - * @example - * ```javascript - * // 'recaptcha-container' is the ID of an element in the DOM. - * const applicationVerifier = new RecaptchaVerifier('recaptcha-container'); - * const provider = new PhoneAuthProvider(auth); - * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier); - * // Obtain the verificationCode from the user. - * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const userCredential = await signInWithCredential(auth, phoneCredential); - * ``` - * - * @public - */ -export declare class PhoneAuthProvider { - /** Always set to {@link ProviderId}.PHONE. */ - static readonly PROVIDER_ID: 'phone'; - /** Always set to {@link SignInMethod}.PHONE. */ - static readonly PHONE_SIGN_IN_METHOD: 'phone'; - /** Always set to {@link ProviderId}.PHONE. */ - readonly providerId: "phone"; - private readonly auth; - /** - * @param auth - The Firebase {@link Auth} instance in which sign-ins should occur. - * - */ - constructor(auth: Auth); - /** - * - * Starts a phone number authentication flow by sending a verification code to the given phone - * number. - * - * @example - * ```javascript - * const provider = new PhoneAuthProvider(auth); - * const verificationId = await provider.verifyPhoneNumber(phoneNumber, applicationVerifier); - * // Obtain verificationCode from the user. - * const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const userCredential = await signInWithCredential(auth, authCredential); - * ``` - * - * @example - * An alternative flow is provided using the `signInWithPhoneNumber` method. - * ```javascript - * const confirmationResult = signInWithPhoneNumber(auth, phoneNumber, applicationVerifier); - * // Obtain verificationCode from the user. - * const userCredential = confirmationResult.confirm(verificationCode); - * ``` - * - * @param phoneInfoOptions - The user's {@link PhoneInfoOptions}. The phone number should be in - * E.164 format (e.g. +16505550101). - * @param applicationVerifier - An {@link ApplicationVerifier}, which prevents - * requests from unauthorized clients. This SDK includes an implementation - * based on reCAPTCHA v2, {@link RecaptchaVerifier}. If you've enabled - * reCAPTCHA Enterprise bot protection in Enforce mode, this parameter is - * optional; in all other configurations, the parameter is required. - * - * @returns A Promise for a verification ID that can be passed to - * {@link PhoneAuthProvider.credential} to identify this flow. - */ - verifyPhoneNumber(phoneOptions: PhoneInfoOptions | string, applicationVerifier?: ApplicationVerifier): Promise<string>; - /** - * Creates a phone auth credential, given the verification ID from - * {@link PhoneAuthProvider.verifyPhoneNumber} and the code that was sent to the user's - * mobile device. - * - * @example - * ```javascript - * const provider = new PhoneAuthProvider(auth); - * const verificationId = provider.verifyPhoneNumber(phoneNumber, applicationVerifier); - * // Obtain verificationCode from the user. - * const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const userCredential = signInWithCredential(auth, authCredential); - * ``` - * - * @example - * An alternative flow is provided using the `signInWithPhoneNumber` method. - * ```javascript - * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier); - * // Obtain verificationCode from the user. - * const userCredential = await confirmationResult.confirm(verificationCode); - * ``` - * - * @param verificationId - The verification ID returned from {@link PhoneAuthProvider.verifyPhoneNumber}. - * @param verificationCode - The verification code sent to the user's mobile device. - * - * @returns The auth provider credential. - */ - static credential(verificationId: string, verificationCode: string): PhoneAuthCredential; - /** - * Generates an {@link AuthCredential} from a {@link UserCredential}. - * @param userCredential - The user credential. - */ - static credentialFromResult(userCredential: UserCredential): AuthCredential | null; - /** - * Returns an {@link AuthCredential} when passed an error. - * - * @remarks - * - * This method works for errors like - * `auth/account-exists-with-different-credentials`. This is useful for - * recovering when attempting to set a user's phone number but the number - * in question is already tied to another account. For example, the following - * code tries to update the current user's phone number, and if that - * fails, links the user with the account associated with that number: - * - * ```js - * const provider = new PhoneAuthProvider(auth); - * const verificationId = await provider.verifyPhoneNumber(number, verifier); - * try { - * const code = ''; // Prompt the user for the verification code - * await updatePhoneNumber( - * auth.currentUser, - * PhoneAuthProvider.credential(verificationId, code)); - * } catch (e) { - * if ((e as FirebaseError)?.code === 'auth/account-exists-with-different-credential') { - * const cred = PhoneAuthProvider.credentialFromError(e); - * await linkWithCredential(auth.currentUser, cred); - * } - * } - * - * // At this point, auth.currentUser.phoneNumber === number. - * ``` - * - * @param error - The error to generate a credential from. - */ - static credentialFromError(error: FirebaseError): AuthCredential | null; - private static credentialFromTaggedObject; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha.d.ts deleted file mode 100644 index e47806b..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { RecaptchaParameters } from '../../model/public_types'; -import { GetRecaptchaConfigResponse, RecaptchaEnforcementProviderState } from '../../api/authentication/recaptcha'; -import { EnforcementState } from '../../api/index'; -export interface Recaptcha { - render: (container: HTMLElement, parameters: RecaptchaParameters) => number; - getResponse: (id: number) => string; - execute: (id: number) => unknown; - reset: (id: number) => unknown; -} -export declare function isV2(grecaptcha: Recaptcha | GreCAPTCHA | undefined): grecaptcha is Recaptcha; -export interface GreCAPTCHATopLevel extends GreCAPTCHA { - enterprise: GreCAPTCHA; -} -export interface GreCAPTCHA { - ready: (callback: () => void) => void; - execute: (siteKey: string, options: { - action: string; - }) => Promise<string>; - render: (container: string | HTMLElement, parameters: GreCAPTCHARenderOption) => string; -} -export interface GreCAPTCHARenderOption { - sitekey: string; - size: 'invisible'; -} -export declare function isEnterprise(grecaptcha: Recaptcha | GreCAPTCHA | undefined): grecaptcha is GreCAPTCHATopLevel; -declare global { - interface Window { - grecaptcha?: Recaptcha | GreCAPTCHATopLevel; - } -} -export declare class RecaptchaConfig { - /** - * The reCAPTCHA site key. - */ - siteKey: string; - /** - * The list of providers and their enablement status for reCAPTCHA Enterprise. - */ - recaptchaEnforcementState: RecaptchaEnforcementProviderState[]; - constructor(response: GetRecaptchaConfigResponse); - /** - * Returns the reCAPTCHA Enterprise enforcement state for the given provider. - * - * @param providerStr - The provider whose enforcement state is to be returned. - * @returns The reCAPTCHA Enterprise enforcement state for the given provider. - */ - getProviderEnforcementState(providerStr: string): EnforcementState | null; - /** - * Returns true if the reCAPTCHA Enterprise enforcement state for the provider is set to ENFORCE or AUDIT. - * - * @param providerStr - The provider whose enablement state is to be returned. - * @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider. - */ - isProviderEnabled(providerStr: string): boolean; - /** - * Returns true if reCAPTCHA Enterprise protection is enabled in at least one provider, otherwise - * returns false. - * - * @returns Whether or not reCAPTCHA Enterprise protection is enabled for at least one provider. - */ - isAnyProviderEnabled(): boolean; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts deleted file mode 100644 index adead53..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { RecaptchaActionName, RecaptchaAuthProvider } from '../../api'; -import { Auth } from '../../model/public_types'; -import { AuthInternal } from '../../model/auth'; -export declare const RECAPTCHA_ENTERPRISE_VERIFIER_TYPE = "recaptcha-enterprise"; -export declare const FAKE_TOKEN = "NO_RECAPTCHA"; -export declare class RecaptchaEnterpriseVerifier { - /** - * Identifies the type of application verifier (e.g. "recaptcha-enterprise"). - */ - readonly type = "recaptcha-enterprise"; - private readonly auth; - /** - * - * @param authExtern - The corresponding Firebase {@link Auth} instance. - * - */ - constructor(authExtern: Auth); - /** - * Executes the verification process. - * - * @returns A Promise for a token that can be used to assert the validity of a request. - */ - verify(action?: string, forceRefresh?: boolean): Promise<string>; -} -export declare function injectRecaptchaFields<T extends object>(auth: AuthInternal, request: T, action: RecaptchaActionName, isCaptchaResp?: boolean, isFakeToken?: boolean): Promise<T>; -type ActionMethod<TRequest, TResponse> = (auth: AuthInternal, request: TRequest) => Promise<TResponse>; -export declare function handleRecaptchaFlow<TRequest extends object, TResponse>(authInstance: AuthInternal, request: TRequest, actionName: RecaptchaActionName, actionMethod: ActionMethod<TRequest, TResponse>, recaptchaAuthProvider: RecaptchaAuthProvider): Promise<TResponse>; -export declare function _initializeRecaptchaConfig(auth: Auth): Promise<void>; -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha_loader.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha_loader.d.ts deleted file mode 100644 index b0fc1d9..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha_loader.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthInternal } from '../../model/auth'; -import { Recaptcha } from './recaptcha'; -export declare const _JSLOAD_CALLBACK: string; -/** - * We need to mark this interface as internal explicitly to exclude it in the public typings, because - * it references AuthInternal which has a circular dependency with UserInternal. - * - * @internal - */ -export interface ReCaptchaLoader { - load(auth: AuthInternal, hl?: string): Promise<Recaptcha>; - clearedOneInstance(): void; -} -/** - * Loader for the GReCaptcha library. There should only ever be one of this. - */ -export declare class ReCaptchaLoaderImpl implements ReCaptchaLoader { - private hostLanguage; - private counter; - /** - * Check for `render()` method. `window.grecaptcha` will exist if the Enterprise - * version of the ReCAPTCHA script was loaded by someone else (e.g. App Check) but - * `window.grecaptcha.render()` will not. Another load will add it. - */ - private readonly librarySeparatelyLoaded; - load(auth: AuthInternal, hl?: string): Promise<Recaptcha>; - clearedOneInstance(): void; - private shouldResolveImmediately; -} -export declare class MockReCaptchaLoaderImpl implements ReCaptchaLoader { - load(auth: AuthInternal): Promise<Recaptcha>; - clearedOneInstance(): void; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha_mock.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha_mock.d.ts deleted file mode 100644 index 9cab21a..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha_mock.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthInternal } from '../../model/auth'; -import { RecaptchaParameters } from '../../model/public_types'; -import { Recaptcha, GreCAPTCHATopLevel, GreCAPTCHARenderOption, GreCAPTCHA } from './recaptcha'; -export declare const _SOLVE_TIME_MS = 500; -export declare const _EXPIRATION_TIME_MS = 60000; -export declare const _WIDGET_ID_START = 1000000000000; -export interface Widget { - getResponse: () => string | null; - delete: () => void; - execute: () => void; -} -export declare class MockReCaptcha implements Recaptcha { - private readonly auth; - private counter; - _widgets: Map<number, Widget>; - constructor(auth: AuthInternal); - render(container: string | HTMLElement, parameters?: RecaptchaParameters): number; - reset(optWidgetId?: number): void; - getResponse(optWidgetId?: number): string; - execute(optWidgetId?: number | string): Promise<string>; -} -export declare class MockGreCAPTCHATopLevel implements GreCAPTCHATopLevel { - enterprise: GreCAPTCHA; - ready(callback: () => void): void; - execute(_siteKey: string, _options: { - action: string; - }): Promise<string>; - render(_container: string | HTMLElement, _parameters: GreCAPTCHARenderOption): string; -} -export declare class MockGreCAPTCHA implements GreCAPTCHA { - ready(callback: () => void): void; - execute(_siteKey: string, _options: { - action: string; - }): Promise<string>; - render(_container: string | HTMLElement, _parameters: GreCAPTCHARenderOption): string; -} -export declare class MockWidget { - private readonly params; - private readonly container; - private readonly isVisible; - private timerId; - private deleted; - private responseToken; - private readonly clickHandler; - constructor(containerOrId: string | HTMLElement, appName: string, params: RecaptchaParameters); - getResponse(): string | null; - delete(): void; - execute(): void; - private checkIfDeleted; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha_verifier.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha_verifier.d.ts deleted file mode 100644 index cfca5c6..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/recaptcha/recaptcha_verifier.d.ts +++ /dev/null @@ -1,92 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth, RecaptchaParameters } from '../../model/public_types'; -import { ApplicationVerifierInternal } from '../../model/application_verifier'; -import { ReCaptchaLoader } from './recaptcha_loader'; -export declare const RECAPTCHA_VERIFIER_TYPE = "recaptcha"; -/** - * An {@link https://www.google.com/recaptcha/ | reCAPTCHA}-based application verifier. - * - * @remarks - * `RecaptchaVerifier` does not work in a Node.js environment. - * - * @public - */ -export declare class RecaptchaVerifier implements ApplicationVerifierInternal { - private readonly parameters; - /** - * The application verifier type. - * - * @remarks - * For a reCAPTCHA verifier, this is 'recaptcha'. - */ - readonly type = "recaptcha"; - private destroyed; - private widgetId; - private readonly container; - private readonly isInvisible; - private readonly tokenChangeListeners; - private renderPromise; - private readonly auth; - /** @internal */ - readonly _recaptchaLoader: ReCaptchaLoader; - private recaptcha; - /** - * @param authExtern - The corresponding Firebase {@link Auth} instance. - * - * @param containerOrId - The reCAPTCHA container parameter. - * - * @remarks - * This has different meaning depending on whether the reCAPTCHA is hidden or visible. For a - * visible reCAPTCHA the container must be empty. If a string is used, it has to correspond to - * an element ID. The corresponding element must also must be in the DOM at the time of - * initialization. - * - * @param parameters - The optional reCAPTCHA parameters. - * - * @remarks - * Check the reCAPTCHA docs for a comprehensive list. All parameters are accepted except for - * the sitekey. Firebase Auth backend provisions a reCAPTCHA for each project and will - * configure this upon rendering. For an invisible reCAPTCHA, a size key must have the value - * 'invisible'. - */ - constructor(authExtern: Auth, containerOrId: HTMLElement | string, parameters?: RecaptchaParameters); - /** - * Waits for the user to solve the reCAPTCHA and resolves with the reCAPTCHA token. - * - * @returns A Promise for the reCAPTCHA token. - */ - verify(): Promise<string>; - /** - * Renders the reCAPTCHA widget on the page. - * - * @returns A Promise that resolves with the reCAPTCHA widget ID. - */ - render(): Promise<number>; - /** @internal */ - _reset(): void; - /** - * Clears the reCAPTCHA widget from the page and destroys the instance. - */ - clear(): void; - private validateStartingState; - private makeTokenCallback; - private assertNotDestroyed; - private makeRenderPromise; - private init; - private getAssertedRecaptcha; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/strategies/phone.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/strategies/phone.d.ts deleted file mode 100644 index 26dab0b..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/strategies/phone.d.ts +++ /dev/null @@ -1,116 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ApplicationVerifier, Auth, ConfirmationResult, PhoneInfoOptions, User } from '../../model/public_types'; -import { ApplicationVerifierInternal } from '../../model/application_verifier'; -import { PhoneAuthCredential } from '../../core/credentials/phone'; -import { AuthInternal } from '../../model/auth'; -/** - * Asynchronously signs in using a phone number. - * - * @remarks - * This method sends a code via SMS to the given - * phone number, and returns a {@link ConfirmationResult}. After the user - * provides the code sent to their phone, call {@link ConfirmationResult.confirm} - * with the code to sign the user in. - * - * For abuse prevention, this method requires a {@link ApplicationVerifier}. - * This SDK includes an implementation based on reCAPTCHA v2, {@link RecaptchaVerifier}. - * This function can work on other platforms that do not support the - * {@link RecaptchaVerifier} (like React Native), but you need to use a - * third-party {@link ApplicationVerifier} implementation. - * - * If you've enabled project-level reCAPTCHA Enterprise bot protection in - * Enforce mode, you can omit the {@link ApplicationVerifier}. - * - * This method does not work in a Node.js environment or with {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * // 'recaptcha-container' is the ID of an element in the DOM. - * const applicationVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container'); - * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier); - * // Obtain a verificationCode from the user. - * const credential = await confirmationResult.confirm(verificationCode); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101). - * @param appVerifier - The {@link ApplicationVerifier}. - * - * @public - */ -export declare function signInWithPhoneNumber(auth: Auth, phoneNumber: string, appVerifier?: ApplicationVerifier): Promise<ConfirmationResult>; -/** - * Links the user account with the given phone number. - * - * @remarks - * This method does not work in a Node.js environment. - * - * @param user - The user. - * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101). - * @param appVerifier - The {@link ApplicationVerifier}. - * - * @public - */ -export declare function linkWithPhoneNumber(user: User, phoneNumber: string, appVerifier?: ApplicationVerifier): Promise<ConfirmationResult>; -/** - * Re-authenticates a user using a fresh phone credential. - * - * @remarks - * Use before operations such as {@link updatePassword} that require tokens from recent sign-in attempts. - * - * This method does not work in a Node.js environment or on any {@link User} signed in by - * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}. - * - * @param user - The user. - * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101). - * @param appVerifier - The {@link ApplicationVerifier}. - * - * @public - */ -export declare function reauthenticateWithPhoneNumber(user: User, phoneNumber: string, appVerifier?: ApplicationVerifier): Promise<ConfirmationResult>; -/** - * Returns a verification ID to be used in conjunction with the SMS code that is sent. - * - */ -export declare function _verifyPhoneNumber(auth: AuthInternal, options: PhoneInfoOptions | string, verifier?: ApplicationVerifierInternal): Promise<string>; -/** - * Updates the user's phone number. - * - * @remarks - * This method does not work in a Node.js environment or on any {@link User} signed in by - * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ``` - * // 'recaptcha-container' is the ID of an element in the DOM. - * const applicationVerifier = new RecaptchaVerifier('recaptcha-container'); - * const provider = new PhoneAuthProvider(auth); - * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier); - * // Obtain the verificationCode from the user. - * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * await updatePhoneNumber(user, phoneCredential); - * ``` - * - * @param user - The user. - * @param credential - A credential authenticating the new phone number. - * - * @public - */ -export declare function updatePhoneNumber(user: User, credential: PhoneAuthCredential): Promise<void>; -export declare function injectRecaptchaV2Token<T extends object>(auth: AuthInternal, request: T, recaptchaV2Verifier: ApplicationVerifierInternal): Promise<T>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/strategies/popup.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/strategies/popup.d.ts deleted file mode 100644 index 72ba03a..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/strategies/popup.d.ts +++ /dev/null @@ -1,109 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth, AuthProvider, PopupRedirectResolver, User, UserCredential } from '../../model/public_types'; -import { Delay } from '../../core/util/delay'; -export declare const enum _Timeout { - AUTH_EVENT = 8000 -} -export declare const _POLL_WINDOW_CLOSE_TIMEOUT: Delay; -/** - * Authenticates a Firebase client using a popup-based OAuth authentication flow. - * - * @remarks - * If succeeds, returns the signed in user along with the provider's credential. If sign in was - * unsuccessful, returns an error object containing additional information about the error. - * - * This method does not work in a Node.js environment or with {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new FacebookAuthProvider(); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * ``` - * - * @param auth - The {@link Auth} instance. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ -export declare function signInWithPopup(auth: Auth, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<UserCredential>; -/** - * Reauthenticates the current user with the specified {@link OAuthProvider} using a pop-up based - * OAuth flow. - * - * @remarks - * If the reauthentication is successful, the returned result will contain the user and the - * provider's credential. - * - * This method does not work in a Node.js environment or on any {@link User} signed in by - * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new FacebookAuthProvider(); - * const result = await signInWithPopup(auth, provider); - * // Reauthenticate using a popup. - * await reauthenticateWithPopup(result.user, provider); - * ``` - * - * @param user - The user. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ -export declare function reauthenticateWithPopup(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<UserCredential>; -/** - * Links the authenticated provider to the user account using a pop-up based OAuth flow. - * - * @remarks - * If the linking is successful, the returned result will contain the user and the provider's credential. - * - * This method does not work in a Node.js environment. - * - * @example - * ```javascript - * // Sign in using some other provider. - * const result = await signInWithEmailAndPassword(auth, email, password); - * // Link using a popup. - * const provider = new FacebookAuthProvider(); - * await linkWithPopup(result.user, provider); - * ``` - * - * @param user - The user. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ -export declare function linkWithPopup(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<UserCredential>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/strategies/redirect.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/strategies/redirect.d.ts deleted file mode 100644 index d0a9ae5..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/strategies/redirect.d.ts +++ /dev/null @@ -1,176 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth, AuthProvider, PopupRedirectResolver, User, UserCredential } from '../../model/public_types'; -/** - * Authenticates a Firebase client using a full-page redirect flow. - * - * @remarks - * To handle the results and errors for this operation, refer to {@link getRedirectResult}. - * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices - * | best practices} when using {@link signInWithRedirect}. - * - * This method does not work in a Node.js environment or with {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new FacebookAuthProvider(); - * // You can add additional scopes to the provider: - * provider.addScope('user_birthday'); - * // Start a sign in process for an unauthenticated user. - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * } - * // As this API can be used for sign-in, linking and reauthentication, - * // check the operationType to determine what triggered this redirect - * // operation. - * const operationType = result.operationType; - * ``` - * - * @param auth - The {@link Auth} instance. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ -export declare function signInWithRedirect(auth: Auth, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<never>; -export declare function _signInWithRedirect(auth: Auth, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<void | never>; -/** - * Reauthenticates the current user with the specified {@link OAuthProvider} using a full-page redirect flow. - * @remarks - * To handle the results and errors for this operation, refer to {@link getRedirectResult}. - * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices - * | best practices} when using {@link reauthenticateWithRedirect}. - * - * This method does not work in a Node.js environment or with {@link Auth} instances - * created with a {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new FacebookAuthProvider(); - * const result = await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * // Reauthenticate using a redirect. - * await reauthenticateWithRedirect(result.user, provider); - * // This will again trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * ``` - * - * @param user - The user. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ -export declare function reauthenticateWithRedirect(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<never>; -export declare function _reauthenticateWithRedirect(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<void | never>; -/** - * Links the {@link OAuthProvider} to the user account using a full-page redirect flow. - * @remarks - * To handle the results and errors for this operation, refer to {@link getRedirectResult}. - * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices - * | best practices} when using {@link linkWithRedirect}. - * - * This method does not work in a Node.js environment or with {@link Auth} instances - * created with a {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * // Sign in using some other provider. - * const result = await signInWithEmailAndPassword(auth, email, password); - * // Link using a redirect. - * const provider = new FacebookAuthProvider(); - * await linkWithRedirect(result.user, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * ``` - * - * @param user - The user. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ -export declare function linkWithRedirect(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<never>; -export declare function _linkWithRedirect(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<void | never>; -/** - * Returns a {@link UserCredential} from the redirect-based sign-in flow. - * - * @remarks - * If sign-in succeeded, returns the signed in user. If sign-in was unsuccessful, fails with an - * error. If no redirect operation was called, returns `null`. - * - * This method does not work in a Node.js environment or with {@link Auth} instances created with a - * {@link @firebase/app#FirebaseServerApp}. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new FacebookAuthProvider(); - * // You can add additional scopes to the provider: - * provider.addScope('user_birthday'); - * // Start a sign in process for an unauthenticated user. - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * } - * // As this API can be used for sign-in, linking and reauthentication, - * // check the operationType to determine what triggered this redirect - * // operation. - * const operationType = result.operationType; - * ``` - * - * @param auth - The {@link Auth} instance. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ -export declare function getRedirectResult(auth: Auth, resolver?: PopupRedirectResolver): Promise<UserCredential | null>; -export declare function _getRedirectResult(auth: Auth, resolverExtern?: PopupRedirectResolver, bypassAuthState?: boolean): Promise<UserCredential | null>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/util/popup.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/util/popup.d.ts deleted file mode 100644 index 111ca83..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/util/popup.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthInternal } from '../../model/auth'; -export declare class AuthPopup { - readonly window: Window | null; - associatedEvent: string | null; - constructor(window: Window | null); - close(): void; -} -export declare function _open(auth: AuthInternal, url?: string, name?: string, width?: number, height?: number): AuthPopup; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/util/worker.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/util/worker.d.ts deleted file mode 100644 index c871903..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_browser/util/worker.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export declare function _isWorker(): boolean; -export declare function _getActiveServiceWorker(): Promise<ServiceWorker | null>; -export declare function _getServiceWorkerController(): ServiceWorker | null; -export declare function _getWorkerGlobalScope(): ServiceWorker | null; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_cordova/plugins.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_cordova/plugins.d.ts deleted file mode 100644 index d3e157d..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_cordova/plugins.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export interface CordovaWindow extends Window { - cordova: { - plugins: { - browsertab: { - isAvailable(cb: (available: boolean) => void): void; - openUrl(url: string): void; - close(): void; - }; - }; - InAppBrowser: { - open(url: string, target: string, options: string): InAppBrowserRef; - }; - }; - universalLinks: { - subscribe(n: null, cb: (event: Record<string, string> | null) => void): void; - }; - BuildInfo: { - readonly packageName: string; - readonly displayName: string; - }; - handleOpenURL(url: string): void; -} -export interface InAppBrowserRef { - close?: () => void; -} -export declare function _cordovaWindow(): CordovaWindow; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_cordova/popup_redirect/events.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_cordova/popup_redirect/events.d.ts deleted file mode 100644 index 0e5a406..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_cordova/popup_redirect/events.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthEventManager } from '../../core/auth/auth_event_manager'; -import { AuthInternal } from '../../model/auth'; -import { AuthEvent, AuthEventType } from '../../model/popup_redirect'; -/** Custom AuthEventManager that adds passive listeners to events */ -export declare class CordovaAuthEventManager extends AuthEventManager { - private readonly passiveListeners; - private resolveInitialized; - private initPromise; - addPassiveListener(cb: (e: AuthEvent) => void): void; - removePassiveListener(cb: (e: AuthEvent) => void): void; - resetRedirect(): void; - /** Override the onEvent method */ - onEvent(event: AuthEvent): boolean; - initialized(): Promise<void>; -} -/** - * Generates a (partial) {@link AuthEvent}. - */ -export declare function _generateNewEvent(auth: AuthInternal, type: AuthEventType, eventId?: string | null): AuthEvent; -export declare function _savePartialEvent(auth: AuthInternal, event: AuthEvent): Promise<void>; -export declare function _getAndRemoveEvent(auth: AuthInternal): Promise<AuthEvent | null>; -export declare function _eventFromPartialAndUrl(partialEvent: AuthEvent, url: string): AuthEvent | null; -export declare function _getDeepLinkFromCallback(url: string): string; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_cordova/popup_redirect/popup_redirect.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_cordova/popup_redirect/popup_redirect.d.ts deleted file mode 100644 index 2bbf02c..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_cordova/popup_redirect/popup_redirect.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { PopupRedirectResolver } from '../../model/public_types'; -/** - * An implementation of {@link PopupRedirectResolver} suitable for Cordova - * based applications. - * - * @public - */ -export declare const cordovaPopupRedirectResolver: PopupRedirectResolver; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_cordova/popup_redirect/utils.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_cordova/popup_redirect/utils.d.ts deleted file mode 100644 index b9feb06..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_cordova/popup_redirect/utils.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthProvider } from '../../model/public_types'; -import { AuthInternal } from '../../model/auth'; -import { AuthEvent } from '../../model/popup_redirect'; -import { InAppBrowserRef } from '../plugins'; -/** - * Generates the URL for the OAuth handler. - */ -export declare function _generateHandlerUrl(auth: AuthInternal, event: AuthEvent, provider: AuthProvider): Promise<string>; -/** - * Validates that this app is valid for this project configuration - */ -export declare function _validateOrigin(auth: AuthInternal): Promise<void>; -export declare function _performRedirect(handlerUrl: string): Promise<InAppBrowserRef | null>; -interface PassiveAuthEventListener { - addPassiveListener(cb: () => void): void; - removePassiveListener(cb: () => void): void; -} -/** - * This function waits for app activity to be seen before resolving. It does - * this by attaching listeners to various dom events. Once the app is determined - * to be visible, this promise resolves. AFTER that resolution, the listeners - * are detached and any browser tabs left open will be closed. - */ -export declare function _waitForAppResume(auth: AuthInternal, eventListener: PassiveAuthEventListener, iabRef: InAppBrowserRef | null): Promise<void>; -/** - * Checks the configuration of the Cordova environment. This has no side effect - * if the configuration is correct; otherwise it throws an error with the - * missing plugin. - */ -export declare function _checkCordovaConfiguration(auth: AuthInternal): void; -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_cordova/strategies/redirect.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_cordova/strategies/redirect.d.ts deleted file mode 100644 index 9dbd547..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_cordova/strategies/redirect.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth, AuthProvider, PopupRedirectResolver, User } from '../../model/public_types'; -export declare function signInWithRedirect(auth: Auth, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<void>; -export declare function reauthenticateWithRedirect(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<void>; -export declare function linkWithRedirect(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<void>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_node/index.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_node/index.d.ts deleted file mode 100644 index e84ba55..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_node/index.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { FirebaseApp } from '@firebase/app'; -import { Auth } from '../model/public_types'; -export declare function getAuth(app?: FirebaseApp): Auth; -/** Reject with auth/operation-not-supported-in-this-environment */ -declare function fail(): Promise<void>; -/** - * A class which will throw with - * auth/operation-not-supported-in-this-environment if instantiated - */ -declare class FailClass { - constructor(); -} -export declare const browserLocalPersistence: import("../model/public_types").Persistence; -export declare const browserSessionPersistence: import("../model/public_types").Persistence; -export declare const browserCookiePersistence: import("../model/public_types").Persistence; -export declare const indexedDBLocalPersistence: import("../model/public_types").Persistence; -export declare const browserPopupRedirectResolver: import("@firebase/app").FirebaseError; -export declare const PhoneAuthProvider: typeof FailClass; -export declare const signInWithPhoneNumber: typeof fail; -export declare const linkWithPhoneNumber: typeof fail; -export declare const reauthenticateWithPhoneNumber: typeof fail; -export declare const updatePhoneNumber: typeof fail; -export declare const signInWithPopup: typeof fail; -export declare const linkWithPopup: typeof fail; -export declare const reauthenticateWithPopup: typeof fail; -export declare const signInWithRedirect: typeof fail; -export declare const linkWithRedirect: typeof fail; -export declare const reauthenticateWithRedirect: typeof fail; -export declare const getRedirectResult: typeof fail; -export declare const RecaptchaVerifier: typeof FailClass; -export declare const initializeRecaptchaConfig: typeof fail; -export declare class PhoneMultiFactorGenerator { - static assertion(): unknown; -} -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_react_native/persistence/react_native.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_react_native/persistence/react_native.d.ts deleted file mode 100644 index fed8b9f..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/src/platform_react_native/persistence/react_native.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Persistence, ReactNativeAsyncStorage } from '../../model/public_types'; -/** - * Returns a persistence object that wraps `AsyncStorage` imported from - * `react-native` or `@react-native-community/async-storage`, and can - * be used in the persistence dependency field in {@link initializeAuth}. - * - * @public - */ -export declare function getReactNativePersistence(storage: ReactNativeAsyncStorage): Persistence; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/api/helper.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/api/helper.d.ts deleted file mode 100644 index 080e611..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/api/helper.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Endpoint } from '../../../src/api'; -import { Route } from '../mock_fetch'; -export declare function endpointUrl(endpoint: Endpoint): string; -export declare function endpointUrlWithParams(endpoint: Endpoint, params: Record<string, any>): string; -export declare function mockEndpoint(endpoint: Endpoint, response: object, status?: number): Route; -export declare function mockEndpointWithParams(endpoint: Endpoint, params: Record<string, any>, response: object, status?: number): Route; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/delay.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/delay.d.ts deleted file mode 100644 index bcd0c51..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/delay.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Throws tasks to the back of the async task queue. - */ -export declare function delay(cb: () => void): void; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/erroring_unavailable_persistence.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/erroring_unavailable_persistence.d.ts deleted file mode 100644 index 26ea98a..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/erroring_unavailable_persistence.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { PersistenceInternal, PersistenceType, PersistenceValue } from '../../src/core/persistence'; -/** - * Helper class for mocking completely broken persistence that errors when - * accessed. - * - * When disabling cookies in Chrome entirely, for example, simply reading the - * "localStorage" field in "window" will throw an error, but this can't be - * checked for by calling `'localStorage' in window`. This class simulates a - * situation where _isAvailable works correctly but all other methods fail. - */ -export declare class ErroringUnavailablePersistence implements PersistenceInternal { - type: PersistenceType; - _isAvailable(): Promise<boolean>; - _set(): Promise<void>; - _get<T extends PersistenceValue>(): Promise<T | null>; - _remove(): Promise<void>; - _addListener(): void; - _removeListener(): void; - _shouldAllowMigration: boolean; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/fake_service_worker.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/fake_service_worker.d.ts deleted file mode 100644 index 89ecf32..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/fake_service_worker.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export declare class FakeServiceWorker { - private readonly listeners; - postMessage(message: any, transfer: MessagePort[]): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, _options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, _options?: boolean | EventListenerOptions): void; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/id_token_response.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/id_token_response.d.ts deleted file mode 100644 index d7352ed..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/id_token_response.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { IdTokenResponse } from '../../src/model/id_token'; -export declare const TEST_ID_TOKEN_RESPONSE: IdTokenResponse; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/iframe_event.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/iframe_event.d.ts deleted file mode 100644 index 1293d01..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/iframe_event.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthEvent } from '../../src/model/popup_redirect'; -export declare const BASE_AUTH_EVENT: AuthEvent; -export declare function authEvent(event?: Partial<AuthEvent>): AuthEvent; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/integration/emulator_rest_helpers.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/integration/emulator_rest_helpers.d.ts deleted file mode 100644 index 832dc4f..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/integration/emulator_rest_helpers.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export interface VerificationSession { - code: string; - phoneNumber: string; - sessionInfo: string; -} -export interface OobCodeSession { - email: string; - requestType: string; - oobCode: string; - oobLink: string; -} -export declare function getPhoneVerificationCodes(): Promise<Record<string, VerificationSession>>; -export declare function getOobCodes(): Promise<OobCodeSession[]>; -export declare function resetEmulator(): Promise<void>; -export declare function createAnonAccount(): Promise<{ - localId: string; - idToken: string; - refreshToken: string; -}>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/integration/helpers.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/integration/helpers.d.ts deleted file mode 100644 index 86dfd0c..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/integration/helpers.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { FirebaseServerApp } from '@firebase/app'; -import { Auth } from '@firebase/auth'; -export declare function randomEmail(): string; -export declare function getTestInstance(requireEmulator?: boolean): Auth; -export declare function getTestInstanceForServerApp(serverApp: FirebaseServerApp): Auth; -export declare function cleanUpTestInstance(auth: Auth): Promise<void>; -export declare function getTotpCode(sharedSecretKey: string, periodSec: number, verificationCodeLength: number, timestamp: Date): string; -export declare const email = "totpuser-donotdelete@test.com"; -export declare const password = "password"; -export declare const incorrectTotpCode = "1000000"; -/** - * Generates a valid password for the project or tenant password policy in the Auth instance. - * @param auth The {@link Auth} instance. - * @returns A valid password according to the password policy. - */ -export declare function generateValidPassword(auth: Auth): Promise<string>; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/integration/settings.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/integration/settings.d.ts deleted file mode 100644 index 47aeeda..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/integration/settings.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { FirebaseOptions } from '@firebase/app'; -export declare const USE_EMULATOR: boolean; -export declare const PROJECT_ID: any; -export declare const AUTH_DOMAIN: any; -export declare const API_KEY: any; -export declare function getAppConfig(): FirebaseOptions; -export declare function getEmulatorUrl(): string | null; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/jwt.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/jwt.d.ts deleted file mode 100644 index 70e55aa..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/jwt.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export declare function makeJWT(claims: object): string; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/mock_auth.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/mock_auth.d.ts deleted file mode 100644 index 018faf8..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/mock_auth.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Provider } from '@firebase/component'; -import { AppCheckTokenResult } from '@firebase/app-check-interop-types'; -import { PopupRedirectResolver } from '../../src/model/public_types'; -import { AuthImpl } from '../../src/core/auth/auth_impl'; -import { PersistedBlob } from '../../src/core/persistence'; -import { InMemoryPersistence } from '../../src/core/persistence/in_memory'; -import { AuthInternal } from '../../src/model/auth'; -import { UserInternal } from '../../src/model/user'; -export declare const TEST_HOST = "localhost"; -export declare const TEST_TOKEN_HOST = "localhost/token"; -export declare const TEST_AUTH_DOMAIN = "localhost"; -export declare const TEST_SCHEME = "mock"; -export declare const TEST_KEY = "test-api-key"; -export interface TestAuth extends AuthImpl { - persistenceLayer: MockPersistenceLayer; -} -export declare const FAKE_HEARTBEAT_CONTROLLER: { - getHeartbeatsHeader: () => Promise<string>; -}; -export declare const FAKE_HEARTBEAT_CONTROLLER_PROVIDER: Provider<'heartbeat'>; -export declare const FAKE_APP_CHECK_CONTROLLER: { - getToken: () => Promise<AppCheckTokenResult>; -}; -export declare const FAKE_APP_CHECK_CONTROLLER_PROVIDER: Provider<'app-check-internal'>; -export declare class MockPersistenceLayer extends InMemoryPersistence { - lastObjectSet: PersistedBlob | null; - _set(key: string, object: PersistedBlob): Promise<void>; - _remove(key: string): Promise<void>; -} -export declare function testAuth(popupRedirectResolver?: PopupRedirectResolver, persistence?: MockPersistenceLayer, skipAwaitOnInit?: boolean): Promise<TestAuth>; -export declare function testUser(auth: AuthInternal, uid: string, email?: string, fakeTokens?: boolean): UserInternal; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/mock_auth_credential.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/mock_auth_credential.d.ts deleted file mode 100644 index acb21e8..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/mock_auth_credential.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ProviderId, SignInMethod } from '../../src/model/enums'; -import { PhoneOrOauthTokenResponse } from '../../src/api/authentication/mfa'; -import { AuthCredential } from '../../src/core/credentials'; -import { AuthInternal } from '../../src/model/auth'; -import { IdTokenResponse } from '../../src/model/id_token'; -export declare class MockAuthCredential implements AuthCredential { - readonly providerId: ProviderId; - readonly signInMethod: SignInMethod; - constructor(providerId: ProviderId, signInMethod: SignInMethod); - toJSON(): object; - fromJSON(_json: string | object): AuthCredential | null; - _getIdTokenResponse(_auth: AuthInternal): Promise<PhoneOrOauthTokenResponse>; - _linkToIdToken(_auth: AuthInternal, _idToken: string): Promise<IdTokenResponse>; - _getReauthenticationResolver(_auth: AuthInternal): Promise<IdTokenResponse>; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/mock_fetch.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/mock_fetch.d.ts deleted file mode 100644 index fbe493c..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/mock_fetch.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export interface Call { - request?: object | string; - method?: string; - headers: Headers; - fullRequest?: RequestInit; -} -export interface Route { - response: object; - status: number; - calls: Call[]; -} -export declare function setUpWithOverride(fetchOverride: typeof fetch): void; -export declare function setUp(): void; -export declare function mock(url: string, response: object, status?: number): Route; -export declare function tearDown(): void; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/mock_popup_redirect_resolver.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/mock_popup_redirect_resolver.d.ts deleted file mode 100644 index 6d7de21..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/mock_popup_redirect_resolver.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { PopupRedirectResolver } from '../../src/model/public_types'; -import { AuthPopup } from '../../src/platform_browser/util/popup'; -import { EventManager } from '../../src/model/popup_redirect'; -/** - * Generates a PopupRedirectResolver that can be used by the oauth methods. - * These methods expect a class that can be instantiated. - */ -export declare function makeMockPopupRedirectResolver(eventManager?: EventManager, authPopup?: AuthPopup, webStorageSupported?: boolean): PopupRedirectResolver; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/redirect_persistence.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/redirect_persistence.d.ts deleted file mode 100644 index 1c5104c..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/redirect_persistence.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { PersistenceValue } from '../../src/core/persistence'; -import { InMemoryPersistence } from '../../src/core/persistence/in_memory'; -/** Helper class for handling redirect persistence */ -export declare class RedirectPersistence extends InMemoryPersistence { - hasPendingRedirect: boolean; - redirectUser: object | null; - _get<T extends PersistenceValue>(key: string): Promise<T | null>; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/timeout_stub.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/timeout_stub.d.ts deleted file mode 100644 index 39c1705..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/helpers/timeout_stub.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export interface TimerTripFn { - (): void; -} -export interface TimerMap { - [key: number]: TimerTripFn; -} -/** - * Stubs window.setTimeout and returns a map of the functions that were passed - * in (the map is mutable and will be modified as setTimeout gets called). - * You can use this to manually cause timers to trip. The map is keyed by the - * duration of the timeout - */ -export declare function stubTimeouts(ids?: number[]): TimerMap; -/** - * Similar to stubTimeouts, but for use when there's only one timeout you - * care about - */ -export declare function stubSingleTimeout(id?: number): TimerTripFn; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/flows/middleware_test_generator.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/flows/middleware_test_generator.d.ts deleted file mode 100644 index 4ab1adb..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/flows/middleware_test_generator.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth } from '@firebase/auth'; -export declare function generateMiddlewareTests(authGetter: () => Auth, signIn: () => Promise<unknown>): void; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/auth_driver.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/auth_driver.d.ts deleted file mode 100644 index 1d9392f..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/auth_driver.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Auth, User, Persistence } from '@firebase/auth'; -import { WebDriver } from 'selenium-webdriver'; -export declare const START_FUNCTION = "startAuth"; -/** Helper wrapper around the WebDriver object */ -export declare class AuthDriver { - webDriver: WebDriver; - start(browser: string): Promise<void>; - stop(): Promise<void>; - call<T>(fn: string, ...args: unknown[]): Promise<T>; - callNoWait(fn: string, ...args: unknown[]): Promise<void>; - getAuthSnapshot(): Promise<Auth>; - getUserSnapshot(): Promise<User>; - reset(): Promise<void>; - goToTestPage(): Promise<void>; - waitForAuthInit(): Promise<void>; - waitForLegacyAuthInit(): Promise<void>; - reinitOnRedirect(): Promise<void>; - pause(ms: number): Promise<void>; - refresh(): Promise<void>; - private injectConfig; - injectConfigAndInitAuth(): Promise<void>; - injectConfigAndInitLegacySDK(persistence?: Persistence['type']): Promise<void>; - selectPopupWindow(): Promise<void>; - selectMainWindow(options?: { - noWait?: boolean; - }): Promise<void>; - closePopup(): Promise<void>; - closeExtraWindows(): Promise<void>; - isCompatLayer(): boolean; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/functions.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/functions.d.ts deleted file mode 100644 index 66d648b..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/functions.d.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** Available in the browser. See static/anonymous.js */ -export declare enum AnonFunction { - SIGN_IN_ANONYMOUSLY = "anonymous.anonymousSignIn" -} -/** Available redirect functions. See static/redirect.js */ -export declare enum RedirectFunction { - IDP_REDIRECT = "redirect.idpRedirect", - IDP_REAUTH_REDIRECT = "redirect.idpReauthRedirect", - IDP_LINK_REDIRECT = "redirect.idpLinkRedirect", - REDIRECT_RESULT = "redirect.redirectResult", - GENERATE_CREDENTIAL_FROM_RESULT = "redirect.generateCredentialFromRedirectResultAndStore", - SIGN_IN_WITH_REDIRECT_CREDENTIAL = "redirect.signInWithRedirectCredential", - LINK_WITH_ERROR_CREDENTIAL = "redirect.linkWithErrorCredential", - CREATE_FAKE_GOOGLE_USER = "redirect.createFakeGoogleUser", - TRY_TO_SIGN_IN_UNVERIFIED = "redirect.tryToSignInUnverified" -} -/** Available popup functions. See static/popup.js */ -export declare enum PopupFunction { - IDP_POPUP = "popup.idpPopup", - IDP_REAUTH_POPUP = "popup.idpReauthPopup", - IDP_LINK_POPUP = "popup.idpLinkPopup", - POPUP_RESULT = "popup.popupResult", - GENERATE_CREDENTIAL_FROM_RESULT = "popup.generateCredentialFromResult", - SIGN_IN_WITH_POPUP_CREDENTIAL = "popup.signInWithPopupCredential", - LINK_WITH_ERROR_CREDENTIAL = "popup.linkWithErrorCredential", - CREATE_FAKE_GOOGLE_USER = "popup.createFakeGoogleUser", - TRY_TO_SIGN_IN_UNVERIFIED = "popup.tryToSignInUnverified" -} -/** Available email functions. See static/email.js */ -export declare enum EmailFunction { - CREATE_USER = "email.createUser" -} -/** Available core functions within the browser. See static/core.js */ -export declare enum CoreFunction { - RESET = "core.reset", - AWAIT_AUTH_INIT = "core.authInit", - USER_SNAPSHOT = "core.userSnap", - AUTH_SNAPSHOT = "core.authSnap", - SIGN_OUT = "core.signOut", - AWAIT_LEGACY_AUTH_INIT = "core.legacyAuthInit", - LEGACY_USER_SNAPSHOT = "core.legacyUserSnap" -} -/** Available persistence functions within the browser. See static/persistence.js */ -export declare enum PersistenceFunction { - CLEAR_PERSISTENCE = "persistence.clearPersistence", - LOCAL_STORAGE_SNAP = "persistence.localStorageSnap", - LOCAL_STORAGE_SET = "persistence.localStorageSet", - SESSION_STORAGE_SNAP = "persistence.sessionStorageSnap", - SESSION_STORAGE_SET = "persistence.sessionStorageSet", - INDEXED_DB_SNAP = "persistence.indexedDBSnap", - MAKE_INDEXED_DB_READONLY = "persistence.makeIndexedDBReadonly", - SET_PERSISTENCE_MEMORY = "persistence.setPersistenceMemory", - SET_PERSISTENCE_SESSION = "persistence.setPersistenceSession", - SET_PERSISTENCE_INDEXED_DB = "persistence.setPersistenceIndexedDB", - SET_PERSISTENCE_LOCAL_STORAGE = "persistence.setPersistenceLocalStorage" -} -export declare enum MiddlewareFunction { - ATTACH_BLOCKING_MIDDLEWARE = "middleware.attachBlockingMiddleware", - ATTACH_BLOCKING_MIDDLEWARE_ON_START = "middleware.attachBlockingMiddlewareOnStart" -} -/** Available firebase UI functions (only for compat tests) */ -export declare enum UiFunction { - LOAD = "ui.loadUiCode", - START = "ui.startUi" -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/idp_page.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/idp_page.d.ts deleted file mode 100644 index 2d30eb7..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/idp_page.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { WebDriver } from 'selenium-webdriver'; -export declare class IdPPage { - private readonly driver; - static PAGE_TITLE: string; - constructor(driver: WebDriver); - pageLoad(): Promise<void>; - clickAddAccount(): Promise<void>; - clickSignIn(): Promise<void>; - selectExistingAccountByEmail(email: string): Promise<void>; - fillEmail(email: string): Promise<void>; - fillDisplayName(displayName: string): Promise<void>; - fillScreenName(screenName: string): Promise<void>; - fillProfilePhoto(profilePhoto: string): Promise<void>; - private fillInput; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/js_load_condition.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/js_load_condition.d.ts deleted file mode 100644 index a1a0157..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/js_load_condition.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Condition } from 'selenium-webdriver'; -/** - * A condition that looks for the presence of a specified function. This is - * used with WebDriver .wait() as a proxy for determining when the JS has - * finished loading in a page. - */ -export declare class JsLoadCondition extends Condition<boolean> { - constructor(globalValue: string); -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/test_runner.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/test_runner.d.ts deleted file mode 100644 index 8986a26..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/test_runner.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AuthDriver } from './auth_driver'; -/** Main entry point for all WebDriver tests */ -export declare function browserDescribe(title: string, generator: (driver: AuthDriver, browser: string) => void): void; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/test_server.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/test_server.d.ts deleted file mode 100644 index 626807c..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/test_server.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** Simple express server for serving up the static files for testing */ -declare class AuthTestServer { - private app; - private server; - constructor(); - get address(): string; - start(): Promise<void>; - stop(): void; -} -export declare const authTestServer: AuthTestServer; -export {}; diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/ui_page.d.ts b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/ui_page.d.ts deleted file mode 100644 index 295c21c..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/test/integration/webdriver/util/ui_page.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { WebDriver } from 'selenium-webdriver'; -export declare class UiPage { - private readonly driver; - constructor(driver: WebDriver); - clickGuestSignIn(): Promise<void>; - clickGoogleSignIn(): Promise<void>; - clickPhoneSignIn(): Promise<void>; - clickEmailSignIn(): Promise<void>; - clickSubmit(): Promise<void>; - enterPhoneNumber(phoneNumber: string): Promise<void>; - waitForCodeInputToBePresent(): Promise<void>; - enterPhoneCode(code: string): Promise<void>; - enterEmail(email: string): Promise<void>; - enterEmailDisplayName(name: string): Promise<void>; - enterPassword(name: string): Promise<void>; - private fillInput; -} diff --git a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/tsdoc-metadata.json b/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/tsdoc-metadata.json deleted file mode 100644 index 6af1f6a..0000000 --- a/frontend-old/node_modules/@firebase/auth/dist/web-extension-esm/tsdoc-metadata.json +++ /dev/null @@ -1,11 +0,0 @@ -// This file is read by tools that parse documentation comments conforming to the TSDoc standard. -// It should be published with your NPM package. It should not be tracked by Git. -{ - "tsdocVersion": "0.12", - "toolPackages": [ - { - "packageName": "@microsoft/api-extractor", - "packageVersion": "0.1.2" - } - ] -} |
