1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | import { FirebaseError } from '@firebase/util';
|
18 | import { AuthErrorCode } from '../core/errors';
|
19 | import { Delay } from '../core/util/delay';
|
20 | import { Auth } from '../model/public_types';
|
21 | import { IdTokenResponse } from '../model/id_token';
|
22 | import { ServerError, ServerErrorMap } from './errors';
|
23 | export declare const enum HttpMethod {
|
24 | POST = "POST",
|
25 | GET = "GET"
|
26 | }
|
27 | export declare const enum HttpHeader {
|
28 | CONTENT_TYPE = "Content-Type",
|
29 | X_FIREBASE_LOCALE = "X-Firebase-Locale",
|
30 | X_CLIENT_VERSION = "X-Client-Version",
|
31 | X_FIREBASE_GMPID = "X-Firebase-gmpid",
|
32 | X_FIREBASE_CLIENT = "X-Firebase-Client"
|
33 | }
|
34 | export declare const enum Endpoint {
|
35 | CREATE_AUTH_URI = "/v1/accounts:createAuthUri",
|
36 | DELETE_ACCOUNT = "/v1/accounts:delete",
|
37 | RESET_PASSWORD = "/v1/accounts:resetPassword",
|
38 | SIGN_UP = "/v1/accounts:signUp",
|
39 | SIGN_IN_WITH_CUSTOM_TOKEN = "/v1/accounts:signInWithCustomToken",
|
40 | SIGN_IN_WITH_EMAIL_LINK = "/v1/accounts:signInWithEmailLink",
|
41 | SIGN_IN_WITH_IDP = "/v1/accounts:signInWithIdp",
|
42 | SIGN_IN_WITH_PASSWORD = "/v1/accounts:signInWithPassword",
|
43 | SIGN_IN_WITH_PHONE_NUMBER = "/v1/accounts:signInWithPhoneNumber",
|
44 | SEND_VERIFICATION_CODE = "/v1/accounts:sendVerificationCode",
|
45 | SEND_OOB_CODE = "/v1/accounts:sendOobCode",
|
46 | SET_ACCOUNT_INFO = "/v1/accounts:update",
|
47 | GET_ACCOUNT_INFO = "/v1/accounts:lookup",
|
48 | GET_RECAPTCHA_PARAM = "/v1/recaptchaParams",
|
49 | START_PHONE_MFA_ENROLLMENT = "/v2/accounts/mfaEnrollment:start",
|
50 | FINALIZE_PHONE_MFA_ENROLLMENT = "/v2/accounts/mfaEnrollment:finalize",
|
51 | START_PHONE_MFA_SIGN_IN = "/v2/accounts/mfaSignIn:start",
|
52 | FINALIZE_PHONE_MFA_SIGN_IN = "/v2/accounts/mfaSignIn:finalize",
|
53 | WITHDRAW_MFA = "/v2/accounts/mfaEnrollment:withdraw",
|
54 | GET_PROJECT_CONFIG = "/v1/projects"
|
55 | }
|
56 | export declare const DEFAULT_API_TIMEOUT_MS: Delay;
|
57 | export declare function _addTidIfNecessary<T extends {
|
58 | tenantId?: string;
|
59 | }>(auth: Auth, request: T): T;
|
60 | export declare function _performApiRequest<T, V>(auth: Auth, method: HttpMethod, path: Endpoint, request?: T, customErrorMap?: Partial<ServerErrorMap<ServerError>>): Promise<V>;
|
61 | export declare function _performFetchWithErrorHandling<V>(auth: Auth, customErrorMap: Partial<ServerErrorMap<ServerError>>, fetchFn: () => Promise<Response>): Promise<V>;
|
62 | export declare function _performSignInRequest<T, V extends IdTokenResponse>(auth: Auth, method: HttpMethod, path: Endpoint, request?: T, customErrorMap?: Partial<ServerErrorMap<ServerError>>): Promise<V>;
|
63 | export declare function _getFinalTarget(auth: Auth, host: string, path: string, query: string): string;
|
64 | interface PotentialResponse extends IdTokenResponse {
|
65 | email?: string;
|
66 | phoneNumber?: string;
|
67 | }
|
68 | export declare function _makeTaggedError(auth: Auth, code: AuthErrorCode, response: PotentialResponse): FirebaseError;
|
69 | export {};
|