UNPKG

2.84 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2020 Google LLC
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17import { Auth, AuthSettings, Config, EmulatorConfig, PopupRedirectResolver, User } from './public_types';
18import { ErrorFactory } from '@firebase/util';
19import { AuthErrorCode, AuthErrorParams } from '../core/errors';
20import { PopupRedirectResolverInternal } from './popup_redirect';
21import { UserInternal } from './user';
22import { ClientPlatform } from '../core/util/version';
23export declare type AppName = string;
24export declare type ApiKey = string;
25export declare type AuthDomain = string;
26/**
27 * @internal
28 */
29export interface ConfigInternal extends Config {
30 /**
31 * @readonly
32 */
33 emulator?: {
34 url: string;
35 };
36 /**
37 * @readonly
38 */
39 clientPlatform: ClientPlatform;
40}
41/**
42 * UserInternal and AuthInternal reference each other, so both of them are included in the public typings.
43 * In order to exclude them, we mark them as internal explicitly.
44 *
45 * @internal
46 */
47export interface AuthInternal extends Auth {
48 currentUser: User | null;
49 emulatorConfig: EmulatorConfig | null;
50 _canInitEmulator: boolean;
51 _isInitialized: boolean;
52 _initializationPromise: Promise<void> | null;
53 _updateCurrentUser(user: UserInternal | null): Promise<void>;
54 _onStorageEvent(): void;
55 _notifyListenersIfCurrent(user: UserInternal): void;
56 _persistUserIfCurrent(user: UserInternal): Promise<void>;
57 _setRedirectUser(user: UserInternal | null, popupRedirectResolver?: PopupRedirectResolver): Promise<void>;
58 _redirectUserForId(id: string): Promise<UserInternal | null>;
59 _popupRedirectResolver: PopupRedirectResolverInternal | null;
60 _key(): string;
61 _startProactiveRefresh(): void;
62 _stopProactiveRefresh(): void;
63 _getPersistence(): string;
64 _logFramework(framework: string): void;
65 _getFrameworks(): readonly string[];
66 _getAdditionalHeaders(): Promise<Record<string, string>>;
67 readonly name: AppName;
68 readonly config: ConfigInternal;
69 languageCode: string | null;
70 tenantId: string | null;
71 readonly settings: AuthSettings;
72 _errorFactory: ErrorFactory<AuthErrorCode, AuthErrorParams>;
73 useDeviceLanguage(): void;
74 signOut(): Promise<void>;
75}