UNPKG

3.24 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 { ActionCodeSettings, Auth, User } from '../../model/public_types';
18/**
19 * Gets the list of possible sign in methods for the given email address.
20 *
21 * @remarks
22 * This is useful to differentiate methods of sign-in for the same provider, eg.
23 * {@link EmailAuthProvider} which has 2 methods of sign-in,
24 * {@link SignInMethod}.EMAIL_PASSWORD and
25 * {@link SignInMethod}.EMAIL_LINK.
26 *
27 * @param auth - The {@link Auth} instance.
28 * @param email - The user's email address.
29 *
30 * @public
31 */
32export declare function fetchSignInMethodsForEmail(auth: Auth, email: string): Promise<string[]>;
33/**
34 * Sends a verification email to a user.
35 *
36 * @remarks
37 * The verification process is completed by calling {@link applyActionCode}.
38 *
39 * @example
40 * ```javascript
41 * const actionCodeSettings = {
42 * url: 'https://www.example.com/?email=user@example.com',
43 * iOS: {
44 * bundleId: 'com.example.ios'
45 * },
46 * android: {
47 * packageName: 'com.example.android',
48 * installApp: true,
49 * minimumVersion: '12'
50 * },
51 * handleCodeInApp: true
52 * };
53 * await sendEmailVerification(user, actionCodeSettings);
54 * // Obtain code from the user.
55 * await applyActionCode(auth, code);
56 * ```
57 *
58 * @param user - The user.
59 * @param actionCodeSettings - The {@link ActionCodeSettings}.
60 *
61 * @public
62 */
63export declare function sendEmailVerification(user: User, actionCodeSettings?: ActionCodeSettings | null): Promise<void>;
64/**
65 * Sends a verification email to a new email address.
66 *
67 * @remarks
68 * The user's email will be updated to the new one after being verified.
69 *
70 * If you have a custom email action handler, you can complete the verification process by calling
71 * {@link applyActionCode}.
72 *
73 * @example
74 * ```javascript
75 * const actionCodeSettings = {
76 * url: 'https://www.example.com/?email=user@example.com',
77 * iOS: {
78 * bundleId: 'com.example.ios'
79 * },
80 * android: {
81 * packageName: 'com.example.android',
82 * installApp: true,
83 * minimumVersion: '12'
84 * },
85 * handleCodeInApp: true
86 * };
87 * await verifyBeforeUpdateEmail(user, 'newemail@example.com', actionCodeSettings);
88 * // Obtain code from the user.
89 * await applyActionCode(auth, code);
90 * ```
91 *
92 * @param user - The user.
93 * @param newEmail - The new email address to be verified before update.
94 * @param actionCodeSettings - The {@link ActionCodeSettings}.
95 *
96 * @public
97 */
98export declare function verifyBeforeUpdateEmail(user: User, newEmail: string, actionCodeSettings?: ActionCodeSettings | null): Promise<void>;