1 | /*! firebase-admin v10.0.0 */
|
2 | /*!
|
3 | * @license
|
4 | * Copyright 2017 Google Inc.
|
5 | *
|
6 | * Licensed under the Apache License, Version 2.0 (the "License");
|
7 | * you may not use this file except in compliance with the License.
|
8 | * You may obtain a copy of the License at
|
9 | *
|
10 | * http://www.apache.org/licenses/LICENSE-2.0
|
11 | *
|
12 | * Unless required by applicable law or agreed to in writing, software
|
13 | * distributed under the License is distributed on an "AS IS" BASIS,
|
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | * See the License for the specific language governing permissions and
|
16 | * limitations under the License.
|
17 | */
|
18 | export interface MultiFactorInfoResponse {
|
19 | mfaEnrollmentId: string;
|
20 | displayName?: string;
|
21 | phoneInfo?: string;
|
22 | enrolledAt?: string;
|
23 | [key: string]: any;
|
24 | }
|
25 | export interface ProviderUserInfoResponse {
|
26 | rawId: string;
|
27 | displayName?: string;
|
28 | email?: string;
|
29 | photoUrl?: string;
|
30 | phoneNumber?: string;
|
31 | providerId: string;
|
32 | federatedId?: string;
|
33 | }
|
34 | export interface GetAccountInfoUserResponse {
|
35 | localId: string;
|
36 | email?: string;
|
37 | emailVerified?: boolean;
|
38 | phoneNumber?: string;
|
39 | displayName?: string;
|
40 | photoUrl?: string;
|
41 | disabled?: boolean;
|
42 | passwordHash?: string;
|
43 | salt?: string;
|
44 | customAttributes?: string;
|
45 | validSince?: string;
|
46 | tenantId?: string;
|
47 | providerUserInfo?: ProviderUserInfoResponse[];
|
48 | mfaInfo?: MultiFactorInfoResponse[];
|
49 | createdAt?: string;
|
50 | lastLoginAt?: string;
|
51 | lastRefreshAt?: string;
|
52 | [key: string]: any;
|
53 | }
|
54 | /**
|
55 | * Interface representing the common properties of a user-enrolled second factor.
|
56 | */
|
57 | export declare abstract class MultiFactorInfo {
|
58 | /**
|
59 | * The ID of the enrolled second factor. This ID is unique to the user.
|
60 | */
|
61 | readonly uid: string;
|
62 | /**
|
63 | * The optional display name of the enrolled second factor.
|
64 | */
|
65 | readonly displayName?: string;
|
66 | /**
|
67 | * The type identifier of the second factor. For SMS second factors, this is `phone`.
|
68 | */
|
69 | readonly factorId: string;
|
70 | /**
|
71 | * The optional date the second factor was enrolled, formatted as a UTC string.
|
72 | */
|
73 | readonly enrollmentTime?: string;
|
74 | /**
|
75 | * Returns a JSON-serializable representation of this object.
|
76 | *
|
77 | * @returns A JSON-serializable representation of this object.
|
78 | */
|
79 | toJSON(): object;
|
80 | /**
|
81 | * Initializes the MultiFactorInfo object using the provided server response.
|
82 | *
|
83 | * @param response - The server side response.
|
84 | */
|
85 | private initFromServerResponse;
|
86 | }
|
87 | /**
|
88 | * Interface representing a phone specific user-enrolled second factor.
|
89 | */
|
90 | export declare class PhoneMultiFactorInfo extends MultiFactorInfo {
|
91 | /**
|
92 | * The phone number associated with a phone second factor.
|
93 | */
|
94 | readonly phoneNumber: string;
|
95 | /**
|
96 | * {@inheritdoc MultiFactorInfo.toJSON}
|
97 | */
|
98 | toJSON(): object;
|
99 | }
|
100 | /**
|
101 | * The multi-factor related user settings.
|
102 | */
|
103 | export declare class MultiFactorSettings {
|
104 | /**
|
105 | * List of second factors enrolled with the current user.
|
106 | * Currently only phone second factors are supported.
|
107 | */
|
108 | enrolledFactors: MultiFactorInfo[];
|
109 | /**
|
110 | * Returns a JSON-serializable representation of this multi-factor object.
|
111 | *
|
112 | * @returns A JSON-serializable representation of this multi-factor object.
|
113 | */
|
114 | toJSON(): object;
|
115 | }
|
116 | /**
|
117 | * Represents a user's metadata.
|
118 | */
|
119 | export declare class UserMetadata {
|
120 | /**
|
121 | * The date the user was created, formatted as a UTC string.
|
122 | */
|
123 | readonly creationTime: string;
|
124 | /**
|
125 | * The date the user last signed in, formatted as a UTC string.
|
126 | */
|
127 | readonly lastSignInTime: string;
|
128 | /**
|
129 | * The time at which the user was last active (ID token refreshed),
|
130 | * formatted as a UTC Date string (eg 'Sat, 03 Feb 2001 04:05:06 GMT').
|
131 | * Returns null if the user was never active.
|
132 | */
|
133 | readonly lastRefreshTime?: string | null;
|
134 | /**
|
135 | * Returns a JSON-serializable representation of this object.
|
136 | *
|
137 | * @returns A JSON-serializable representation of this object.
|
138 | */
|
139 | toJSON(): object;
|
140 | }
|
141 | /**
|
142 | * Represents a user's info from a third-party identity provider
|
143 | * such as Google or Facebook.
|
144 | */
|
145 | export declare class UserInfo {
|
146 | /**
|
147 | * The user identifier for the linked provider.
|
148 | */
|
149 | readonly uid: string;
|
150 | /**
|
151 | * The display name for the linked provider.
|
152 | */
|
153 | readonly displayName: string;
|
154 | /**
|
155 | * The email for the linked provider.
|
156 | */
|
157 | readonly email: string;
|
158 | /**
|
159 | * The photo URL for the linked provider.
|
160 | */
|
161 | readonly photoURL: string;
|
162 | /**
|
163 | * The linked provider ID (for example, "google.com" for the Google provider).
|
164 | */
|
165 | readonly providerId: string;
|
166 | /**
|
167 | * The phone number for the linked provider.
|
168 | */
|
169 | readonly phoneNumber: string;
|
170 | /**
|
171 | * Returns a JSON-serializable representation of this object.
|
172 | *
|
173 | * @returns A JSON-serializable representation of this object.
|
174 | */
|
175 | toJSON(): object;
|
176 | }
|
177 | /**
|
178 | * Represents a user.
|
179 | */
|
180 | export declare class UserRecord {
|
181 | /**
|
182 | * The user's `uid`.
|
183 | */
|
184 | readonly uid: string;
|
185 | /**
|
186 | * The user's primary email, if set.
|
187 | */
|
188 | readonly email?: string;
|
189 | /**
|
190 | * Whether or not the user's primary email is verified.
|
191 | */
|
192 | readonly emailVerified: boolean;
|
193 | /**
|
194 | * The user's display name.
|
195 | */
|
196 | readonly displayName?: string;
|
197 | /**
|
198 | * The user's photo URL.
|
199 | */
|
200 | readonly photoURL?: string;
|
201 | /**
|
202 | * The user's primary phone number, if set.
|
203 | */
|
204 | readonly phoneNumber?: string;
|
205 | /**
|
206 | * Whether or not the user is disabled: `true` for disabled; `false` for
|
207 | * enabled.
|
208 | */
|
209 | readonly disabled: boolean;
|
210 | /**
|
211 | * Additional metadata about the user.
|
212 | */
|
213 | readonly metadata: UserMetadata;
|
214 | /**
|
215 | * An array of providers (for example, Google, Facebook) linked to the user.
|
216 | */
|
217 | readonly providerData: UserInfo[];
|
218 | /**
|
219 | * The user's hashed password (base64-encoded), only if Firebase Auth hashing
|
220 | * algorithm (SCRYPT) is used. If a different hashing algorithm had been used
|
221 | * when uploading this user, as is typical when migrating from another Auth
|
222 | * system, this will be an empty string. If no password is set, this is
|
223 | * null. This is only available when the user is obtained from
|
224 | * {@link BaseAuth.listUsers}.
|
225 | */
|
226 | readonly passwordHash?: string;
|
227 | /**
|
228 | * The user's password salt (base64-encoded), only if Firebase Auth hashing
|
229 | * algorithm (SCRYPT) is used. If a different hashing algorithm had been used to
|
230 | * upload this user, typical when migrating from another Auth system, this will
|
231 | * be an empty string. If no password is set, this is null. This is only
|
232 | * available when the user is obtained from {@link BaseAuth.listUsers}.
|
233 | */
|
234 | readonly passwordSalt?: string;
|
235 | /**
|
236 | * The user's custom claims object if available, typically used to define
|
237 | * user roles and propagated to an authenticated user's ID token.
|
238 | * This is set via {@link BaseAuth.setCustomUserClaims}
|
239 | */
|
240 | readonly customClaims?: {
|
241 | [key: string]: any;
|
242 | };
|
243 | /**
|
244 | * The ID of the tenant the user belongs to, if available.
|
245 | */
|
246 | readonly tenantId?: string | null;
|
247 | /**
|
248 | * The date the user's tokens are valid after, formatted as a UTC string.
|
249 | * This is updated every time the user's refresh token are revoked either
|
250 | * from the {@link BaseAuth.revokeRefreshTokens}
|
251 | * API or from the Firebase Auth backend on big account changes (password
|
252 | * resets, password or email updates, etc).
|
253 | */
|
254 | readonly tokensValidAfterTime?: string;
|
255 | /**
|
256 | * The multi-factor related properties for the current user, if available.
|
257 | */
|
258 | readonly multiFactor?: MultiFactorSettings;
|
259 | /**
|
260 | * Returns a JSON-serializable representation of this object.
|
261 | *
|
262 | * @returns A JSON-serializable representation of this object.
|
263 | */
|
264 | toJSON(): object;
|
265 | }
|