@react-native-firebase/auth 24.1.1 → 25.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/android/src/main/java/io/invertase/firebase/auth/ReactNativeFirebaseAuthModule.java +16 -4
  3. package/dist/module/ActionCodeURL.js +140 -0
  4. package/dist/module/ActionCodeURL.js.map +1 -0
  5. package/{lib → dist/module}/ConfirmationResult.js +4 -5
  6. package/dist/module/ConfirmationResult.js.map +1 -0
  7. package/{lib → dist/module}/MultiFactorResolver.js +14 -5
  8. package/dist/module/MultiFactorResolver.js.map +1 -0
  9. package/{lib → dist/module}/PhoneAuthListener.js +52 -75
  10. package/dist/module/PhoneAuthListener.js.map +1 -0
  11. package/dist/module/PhoneAuthState.js +25 -0
  12. package/dist/module/PhoneAuthState.js.map +1 -0
  13. package/dist/module/PhoneMultiFactorGenerator.js +39 -0
  14. package/dist/module/PhoneMultiFactorGenerator.js.map +1 -0
  15. package/{lib → dist/module}/Settings.js +3 -7
  16. package/dist/module/Settings.js.map +1 -0
  17. package/{lib → dist/module}/TotpMultiFactorGenerator.js +20 -15
  18. package/dist/module/TotpMultiFactorGenerator.js.map +1 -0
  19. package/{lib → dist/module}/TotpSecret.js +7 -5
  20. package/dist/module/TotpSecret.js.map +1 -0
  21. package/dist/module/User.js +245 -0
  22. package/dist/module/User.js.map +1 -0
  23. package/dist/module/constants.js +54 -0
  24. package/dist/module/constants.js.map +1 -0
  25. package/dist/module/credentials/AuthCredential.js +51 -0
  26. package/dist/module/credentials/AuthCredential.js.map +1 -0
  27. package/dist/module/credentials/EmailAuthCredential.js +51 -0
  28. package/dist/module/credentials/EmailAuthCredential.js.map +1 -0
  29. package/dist/module/credentials/OAuthCredential.js +84 -0
  30. package/dist/module/credentials/OAuthCredential.js.map +1 -0
  31. package/dist/module/credentials/PhoneAuthCredential.js +50 -0
  32. package/dist/module/credentials/PhoneAuthCredential.js.map +1 -0
  33. package/{lib/providers/GoogleAuthProvider.js → dist/module/credentials/index.js} +7 -19
  34. package/dist/module/credentials/index.js.map +1 -0
  35. package/{lib → dist/module}/getMultiFactorResolver.js +5 -8
  36. package/dist/module/getMultiFactorResolver.js.map +1 -0
  37. package/{lib/providers/FacebookAuthProvider.js → dist/module/index.js} +11 -18
  38. package/dist/module/index.js.map +1 -0
  39. package/dist/module/modular.js +793 -0
  40. package/dist/module/modular.js.map +1 -0
  41. package/{lib → dist/module}/multiFactor.js +16 -14
  42. package/dist/module/multiFactor.js.map +1 -0
  43. package/dist/module/namespaced.js +522 -0
  44. package/dist/module/namespaced.js.map +1 -0
  45. package/dist/module/package.json +1 -0
  46. package/dist/module/password-policy/PasswordPolicyImpl.js +103 -0
  47. package/dist/module/password-policy/PasswordPolicyImpl.js.map +1 -0
  48. package/{lib → dist/module}/password-policy/PasswordPolicyMixin.js +14 -16
  49. package/dist/module/password-policy/PasswordPolicyMixin.js.map +1 -0
  50. package/{lib → dist/module}/password-policy/passwordPolicyApi.js +18 -12
  51. package/dist/module/password-policy/passwordPolicyApi.js.map +1 -0
  52. package/{lib → dist/module}/providers/AppleAuthProvider.js +14 -7
  53. package/dist/module/providers/AppleAuthProvider.js.map +1 -0
  54. package/{lib → dist/module}/providers/EmailAuthProvider.js +10 -25
  55. package/dist/module/providers/EmailAuthProvider.js.map +1 -0
  56. package/dist/module/providers/FacebookAuthProvider.js +56 -0
  57. package/dist/module/providers/FacebookAuthProvider.js.map +1 -0
  58. package/dist/module/providers/GithubAuthProvider.js +49 -0
  59. package/dist/module/providers/GithubAuthProvider.js.map +1 -0
  60. package/dist/module/providers/GoogleAuthProvider.js +57 -0
  61. package/dist/module/providers/GoogleAuthProvider.js.map +1 -0
  62. package/dist/module/providers/OAuthProvider.js +116 -0
  63. package/dist/module/providers/OAuthProvider.js.map +1 -0
  64. package/{lib → dist/module}/providers/OIDCAuthProvider.js +15 -7
  65. package/dist/module/providers/OIDCAuthProvider.js.map +1 -0
  66. package/dist/module/providers/PhoneAuthProvider.js +87 -0
  67. package/dist/module/providers/PhoneAuthProvider.js.map +1 -0
  68. package/dist/module/providers/TwitterAuthProvider.js +50 -0
  69. package/dist/module/providers/TwitterAuthProvider.js.map +1 -0
  70. package/dist/module/types/auth.js +43 -0
  71. package/dist/module/types/auth.js.map +1 -0
  72. package/dist/module/types/internal.js +4 -0
  73. package/dist/module/types/internal.js.map +1 -0
  74. package/dist/module/types/namespaced.js +62 -0
  75. package/dist/module/types/namespaced.js.map +1 -0
  76. package/dist/module/version.js +5 -0
  77. package/dist/module/version.js.map +1 -0
  78. package/dist/module/web/RNFBAuthModule.android.js +5 -0
  79. package/dist/module/web/RNFBAuthModule.android.js.map +1 -0
  80. package/dist/module/web/RNFBAuthModule.ios.js +5 -0
  81. package/dist/module/web/RNFBAuthModule.ios.js.map +1 -0
  82. package/{lib → dist/module}/web/RNFBAuthModule.js +104 -321
  83. package/dist/module/web/RNFBAuthModule.js.map +1 -0
  84. package/dist/typescript/lib/ActionCodeURL.d.ts +41 -0
  85. package/dist/typescript/lib/ActionCodeURL.d.ts.map +1 -0
  86. package/dist/typescript/lib/ConfirmationResult.d.ts +10 -0
  87. package/dist/typescript/lib/ConfirmationResult.d.ts.map +1 -0
  88. package/dist/typescript/lib/MultiFactorResolver.d.ts +24 -0
  89. package/dist/typescript/lib/MultiFactorResolver.d.ts.map +1 -0
  90. package/dist/typescript/lib/PhoneAuthListener.d.ts +34 -0
  91. package/dist/typescript/lib/PhoneAuthListener.d.ts.map +1 -0
  92. package/dist/typescript/lib/PhoneAuthState.d.ts +7 -0
  93. package/dist/typescript/lib/PhoneAuthState.d.ts.map +1 -0
  94. package/dist/typescript/lib/PhoneMultiFactorGenerator.d.ts +7 -0
  95. package/dist/typescript/lib/PhoneMultiFactorGenerator.d.ts.map +1 -0
  96. package/dist/typescript/lib/Settings.d.ts +13 -0
  97. package/dist/typescript/lib/Settings.d.ts.map +1 -0
  98. package/dist/typescript/lib/TotpMultiFactorGenerator.d.ts +11 -0
  99. package/dist/typescript/lib/TotpMultiFactorGenerator.d.ts.map +1 -0
  100. package/dist/typescript/lib/TotpSecret.d.ts +33 -0
  101. package/dist/typescript/lib/TotpSecret.d.ts.map +1 -0
  102. package/dist/typescript/lib/User.d.ts +51 -0
  103. package/dist/typescript/lib/User.d.ts.map +1 -0
  104. package/dist/typescript/lib/constants.d.ts +35 -0
  105. package/dist/typescript/lib/constants.d.ts.map +1 -0
  106. package/dist/typescript/lib/credentials/AuthCredential.d.ts +12 -0
  107. package/dist/typescript/lib/credentials/AuthCredential.d.ts.map +1 -0
  108. package/dist/typescript/lib/credentials/EmailAuthCredential.d.ts +8 -0
  109. package/dist/typescript/lib/credentials/EmailAuthCredential.d.ts.map +1 -0
  110. package/dist/typescript/lib/credentials/OAuthCredential.d.ts +22 -0
  111. package/dist/typescript/lib/credentials/OAuthCredential.d.ts.map +1 -0
  112. package/dist/typescript/lib/credentials/PhoneAuthCredential.d.ts +8 -0
  113. package/dist/typescript/lib/credentials/PhoneAuthCredential.d.ts.map +1 -0
  114. package/dist/typescript/lib/credentials/index.d.ts +5 -0
  115. package/dist/typescript/lib/credentials/index.d.ts.map +1 -0
  116. package/dist/typescript/lib/getMultiFactorResolver.d.ts +19 -0
  117. package/dist/typescript/lib/getMultiFactorResolver.d.ts.map +1 -0
  118. package/dist/typescript/lib/index.d.ts +8 -0
  119. package/dist/typescript/lib/index.d.ts.map +1 -0
  120. package/dist/typescript/lib/modular.d.ts +370 -0
  121. package/dist/typescript/lib/modular.d.ts.map +1 -0
  122. package/dist/typescript/lib/multiFactor.d.ts +26 -0
  123. package/dist/typescript/lib/multiFactor.d.ts.map +1 -0
  124. package/dist/typescript/lib/namespaced.d.ts +12 -0
  125. package/dist/typescript/lib/namespaced.d.ts.map +1 -0
  126. package/dist/typescript/lib/password-policy/PasswordPolicyImpl.d.ts +19 -0
  127. package/dist/typescript/lib/password-policy/PasswordPolicyImpl.d.ts.map +1 -0
  128. package/dist/typescript/lib/password-policy/PasswordPolicyMixin.d.ts +11 -0
  129. package/dist/typescript/lib/password-policy/PasswordPolicyMixin.d.ts.map +1 -0
  130. package/dist/typescript/lib/password-policy/passwordPolicyApi.d.ts +10 -0
  131. package/dist/typescript/lib/password-policy/passwordPolicyApi.d.ts.map +1 -0
  132. package/dist/typescript/lib/providers/AppleAuthProvider.d.ts +16 -0
  133. package/dist/typescript/lib/providers/AppleAuthProvider.d.ts.map +1 -0
  134. package/dist/typescript/lib/providers/EmailAuthProvider.d.ts +11 -0
  135. package/dist/typescript/lib/providers/EmailAuthProvider.d.ts.map +1 -0
  136. package/dist/typescript/lib/providers/FacebookAuthProvider.d.ts +19 -0
  137. package/dist/typescript/lib/providers/FacebookAuthProvider.d.ts.map +1 -0
  138. package/dist/typescript/lib/providers/GithubAuthProvider.d.ts +15 -0
  139. package/dist/typescript/lib/providers/GithubAuthProvider.d.ts.map +1 -0
  140. package/dist/typescript/lib/providers/GoogleAuthProvider.d.ts +21 -0
  141. package/dist/typescript/lib/providers/GoogleAuthProvider.d.ts.map +1 -0
  142. package/dist/typescript/lib/providers/OAuthProvider.d.ts +33 -0
  143. package/dist/typescript/lib/providers/OAuthProvider.d.ts.map +1 -0
  144. package/dist/typescript/lib/providers/OIDCAuthProvider.d.ts +16 -0
  145. package/dist/typescript/lib/providers/OIDCAuthProvider.d.ts.map +1 -0
  146. package/dist/typescript/lib/providers/PhoneAuthProvider.d.ts +16 -0
  147. package/dist/typescript/lib/providers/PhoneAuthProvider.d.ts.map +1 -0
  148. package/dist/typescript/lib/providers/TwitterAuthProvider.d.ts +15 -0
  149. package/dist/typescript/lib/providers/TwitterAuthProvider.d.ts.map +1 -0
  150. package/dist/typescript/lib/types/auth.d.ts +305 -0
  151. package/dist/typescript/lib/types/auth.d.ts.map +1 -0
  152. package/dist/typescript/lib/types/internal.d.ts +293 -0
  153. package/dist/typescript/lib/types/internal.d.ts.map +1 -0
  154. package/dist/typescript/lib/types/namespaced.d.ts +2185 -0
  155. package/dist/typescript/lib/types/namespaced.d.ts.map +1 -0
  156. package/dist/typescript/lib/version.d.ts +2 -0
  157. package/dist/typescript/lib/version.d.ts.map +1 -0
  158. package/dist/typescript/lib/web/RNFBAuthModule.android.d.ts +3 -0
  159. package/dist/typescript/lib/web/RNFBAuthModule.android.d.ts.map +1 -0
  160. package/dist/typescript/lib/web/RNFBAuthModule.d.ts +406 -0
  161. package/dist/typescript/lib/web/RNFBAuthModule.d.ts.map +1 -0
  162. package/dist/typescript/lib/web/RNFBAuthModule.ios.d.ts +3 -0
  163. package/dist/typescript/lib/web/RNFBAuthModule.ios.d.ts.map +1 -0
  164. package/dist/typescript/package.json +1 -0
  165. package/ios/RNFBAuth/RNFBAuthModule.m +4 -2
  166. package/lib/ActionCodeURL.ts +174 -0
  167. package/lib/ConfirmationResult.ts +42 -0
  168. package/lib/MultiFactorResolver.ts +51 -0
  169. package/lib/PhoneAuthListener.ts +312 -0
  170. package/lib/PhoneAuthState.ts +22 -0
  171. package/lib/{PhoneMultiFactorGenerator.js → PhoneMultiFactorGenerator.ts} +8 -2
  172. package/lib/Settings.ts +59 -0
  173. package/lib/TotpMultiFactorGenerator.ts +78 -0
  174. package/lib/TotpSecret.ts +71 -0
  175. package/lib/{User.js → User.ts} +127 -83
  176. package/lib/constants.ts +55 -0
  177. package/lib/credentials/AuthCredential.ts +55 -0
  178. package/lib/credentials/EmailAuthCredential.ts +70 -0
  179. package/lib/credentials/OAuthCredential.ts +113 -0
  180. package/lib/credentials/PhoneAuthCredential.ts +66 -0
  181. package/lib/{providers/GithubAuthProvider.js → credentials/index.ts} +4 -19
  182. package/lib/getMultiFactorResolver.ts +40 -0
  183. package/lib/{providers/TwitterAuthProvider.js → index.ts} +14 -19
  184. package/lib/modular.ts +1172 -0
  185. package/lib/multiFactor.ts +83 -0
  186. package/lib/namespaced.ts +846 -0
  187. package/lib/password-policy/{PasswordPolicyImpl.js → PasswordPolicyImpl.ts} +37 -19
  188. package/lib/password-policy/PasswordPolicyMixin.ts +83 -0
  189. package/lib/password-policy/passwordPolicyApi.ts +60 -0
  190. package/lib/providers/AppleAuthProvider.ts +44 -0
  191. package/lib/providers/EmailAuthProvider.ts +42 -0
  192. package/lib/providers/FacebookAuthProvider.ts +58 -0
  193. package/lib/providers/GithubAuthProvider.ts +51 -0
  194. package/lib/providers/GoogleAuthProvider.ts +60 -0
  195. package/lib/providers/OAuthProvider.ts +150 -0
  196. package/lib/providers/OIDCAuthProvider.ts +49 -0
  197. package/lib/providers/PhoneAuthProvider.ts +161 -0
  198. package/lib/providers/TwitterAuthProvider.ts +52 -0
  199. package/lib/types/auth.ts +393 -0
  200. package/lib/types/internal.ts +475 -0
  201. package/lib/{index.d.ts → types/namespaced.ts} +52 -41
  202. package/lib/version.ts +2 -0
  203. package/lib/web/RNFBAuthModule.ts +1359 -0
  204. package/package.json +41 -9
  205. package/plugin/tsconfig.tsbuildinfo +1 -1
  206. package/tsconfig.json +26 -0
  207. package/tsdoc.json +22 -0
  208. package/typedoc.json +9 -2
  209. package/lib/index.js +0 -572
  210. package/lib/modular/index.d.ts +0 -801
  211. package/lib/modular/index.js +0 -651
  212. package/lib/providers/OAuthProvider.js +0 -70
  213. package/lib/providers/PhoneAuthProvider.js +0 -52
  214. package/lib/version.js +0 -2
  215. /package/lib/web/{RNFBAuthModule.android.js → RNFBAuthModule.android.ts} +0 -0
  216. /package/lib/web/{RNFBAuthModule.ios.js → RNFBAuthModule.ios.ts} +0 -0
@@ -0,0 +1,793 @@
1
+ "use strict";
2
+
3
+ /*
4
+ * Copyright (c) 2016-present Invertase Limited & Contributors
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this library 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
+
19
+ import { getApp } from '@react-native-firebase/app';
20
+ import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/dist/module/common';
21
+ import { ActionCodeOperation, FactorId, OperationType, ProviderId, SignInMethod } from "./constants.js";
22
+ import PhoneMultiFactorGenerator from "./PhoneMultiFactorGenerator.js";
23
+ import { PhoneAuthState } from "./PhoneAuthState.js";
24
+ import TotpMultiFactorGenerator from "./TotpMultiFactorGenerator.js";
25
+ import { TotpSecret } from "./TotpSecret.js";
26
+ import { MultiFactorUser as MultiFactorUserModule } from "./multiFactor.js";
27
+ import AppleAuthProvider from "./providers/AppleAuthProvider.js";
28
+ import EmailAuthProvider from "./providers/EmailAuthProvider.js";
29
+ import FacebookAuthProvider from "./providers/FacebookAuthProvider.js";
30
+ import GithubAuthProvider from "./providers/GithubAuthProvider.js";
31
+ import GoogleAuthProvider from "./providers/GoogleAuthProvider.js";
32
+ import OAuthProvider from "./providers/OAuthProvider.js";
33
+ import OIDCAuthProvider from "./providers/OIDCAuthProvider.js";
34
+ import PhoneAuthProvider from "./providers/PhoneAuthProvider.js";
35
+ import TwitterAuthProvider from "./providers/TwitterAuthProvider.js";
36
+ import { ActionCodeURL } from "./ActionCodeURL.js";
37
+
38
+ /**
39
+ * Modular Auth API for React Native Firebase.
40
+ *
41
+ * Most exports mirror the [firebase-js-sdk modular Auth API](https://firebase.google.com/docs/reference/js/auth).
42
+ * Remarks on individual symbols call out React Native-specific behavior, unsupported
43
+ * web-only APIs, and return-type differences.
44
+ *
45
+ * @packageDocumentation
46
+ */
47
+
48
+ export { ActionCodeOperation, FactorId, OperationType, ProviderId, SignInMethod };
49
+ function appWithAuth(app) {
50
+ return app ? getApp(app.name) : getApp();
51
+ }
52
+ function getAuthInternal(auth) {
53
+ return auth;
54
+ }
55
+ function getUserInternal(user) {
56
+ return user;
57
+ }
58
+ function normalizeAdditionalUserInfo(info) {
59
+ return {
60
+ ...info,
61
+ isNewUser: Boolean(info.isNewUser),
62
+ profile: info.profile ?? null,
63
+ providerId: info.providerId ?? null,
64
+ username: info.username ?? null
65
+ };
66
+ }
67
+ function normalizeUserCredential(userCredential, overrides = {}) {
68
+ const normalizedUserCredential = {
69
+ user: userCredential.user,
70
+ providerId: overrides.providerId ?? userCredential.providerId ?? userCredential.additionalUserInfo?.providerId ?? null,
71
+ operationType: overrides.operationType ?? userCredential.operationType ?? OperationType.SIGN_IN
72
+ };
73
+ if (userCredential.additionalUserInfo) {
74
+ normalizedUserCredential.additionalUserInfo = normalizeAdditionalUserInfo(userCredential.additionalUserInfo);
75
+ }
76
+ return normalizedUserCredential;
77
+ }
78
+ function normalizeMultiFactorInfo(info) {
79
+ const normalizedInfo = {
80
+ uid: info.uid,
81
+ displayName: info.displayName ?? null,
82
+ enrollmentTime: info.enrollmentTime,
83
+ factorId: info.factorId
84
+ };
85
+ if ('phoneNumber' in info) {
86
+ return {
87
+ ...normalizedInfo,
88
+ phoneNumber: info.phoneNumber
89
+ };
90
+ }
91
+ return normalizedInfo;
92
+ }
93
+ function normalizeActionCodeInfo(actionCodeInfo) {
94
+ const data = actionCodeInfo.data ?? {};
95
+ return {
96
+ data: {
97
+ email: data.email ?? null,
98
+ multiFactorInfo: 'multiFactorInfo' in data && data.multiFactorInfo ? normalizeMultiFactorInfo(data.multiFactorInfo) : null,
99
+ previousEmail: ('previousEmail' in data ? data.previousEmail : undefined) ?? ('fromEmail' in data ? data.fromEmail : undefined) ?? null
100
+ },
101
+ operation: actionCodeInfo.operation
102
+ };
103
+ }
104
+ function normalizeConfirmationResult(confirmationResult) {
105
+ if (!confirmationResult.verificationId) {
106
+ throw new Error('signInWithPhoneNumber() did not return a verificationId.');
107
+ }
108
+ return {
109
+ verificationId: confirmationResult.verificationId,
110
+ async confirm(verificationCode) {
111
+ const userCredential = await confirmationResult.confirm(verificationCode);
112
+ if (!userCredential) {
113
+ throw new Error('signInWithPhoneNumber().confirm() returned no user credential.');
114
+ }
115
+ return normalizeUserCredential(userCredential, {
116
+ providerId: ProviderId.PHONE,
117
+ operationType: OperationType.SIGN_IN
118
+ });
119
+ }
120
+ };
121
+ }
122
+ function normalizeMultiFactorResolver(resolver) {
123
+ return {
124
+ hints: resolver.hints.map(normalizeMultiFactorInfo),
125
+ session: resolver.session,
126
+ async resolveSignIn(assertion) {
127
+ return normalizeUserCredential(await resolver.resolveSignIn(assertion), {
128
+ providerId: assertion.factorId === FactorId.PHONE ? ProviderId.PHONE : null,
129
+ operationType: OperationType.SIGN_IN
130
+ });
131
+ }
132
+ };
133
+ }
134
+ function normalizeMultiFactorUser(multiFactorUser) {
135
+ return {
136
+ enrolledFactors: multiFactorUser.enrolledFactors.map(normalizeMultiFactorInfo),
137
+ getSession: () => multiFactorUser.getSession(),
138
+ enroll: (assertion, displayName) => multiFactorUser.enroll(assertion, displayName),
139
+ unenroll: option => multiFactorUser.unenroll(option)
140
+ };
141
+ }
142
+ export { ActionCodeURL } from "./ActionCodeURL.js";
143
+ export { AuthCredential, EmailAuthCredential, OAuthCredential, PhoneAuthCredential } from "./credentials/index.js";
144
+ export { AppleAuthProvider, EmailAuthProvider, FacebookAuthProvider, GithubAuthProvider, GoogleAuthProvider, OAuthProvider, OIDCAuthProvider, PhoneAuthProvider, PhoneAuthState, PhoneMultiFactorGenerator, TotpMultiFactorGenerator, TotpSecret, TwitterAuthProvider };
145
+ function normalizeAuthListener(nextOrObserver) {
146
+ if (typeof nextOrObserver === 'function') {
147
+ return nextOrObserver;
148
+ }
149
+ if (typeof nextOrObserver.next !== 'function') {
150
+ return {
151
+ next: () => {}
152
+ };
153
+ }
154
+ return nextOrObserver;
155
+ }
156
+ function callAuthMethod(auth, method, ...args) {
157
+ return method.call(auth, ...args, MODULAR_DEPRECATION_ARG);
158
+ }
159
+ function callUserMethod(user, method, ...args) {
160
+ return method.call(user, ...args, MODULAR_DEPRECATION_ARG);
161
+ }
162
+
163
+ /**
164
+ * Returns the Auth instance associated with the provided FirebaseApp.
165
+ *
166
+ * @param app - The Firebase app instance. Defaults to the default app.
167
+ */
168
+ export function getAuth(app) {
169
+ // Keep getAuth() on the shared namespaced instance; method wrappers add the modular sentinel.
170
+ return appWithAuth(app).auth();
171
+ }
172
+
173
+ /**
174
+ * This function allows more control over the Auth instance than getAuth().
175
+ *
176
+ * @param app - The Firebase app to initialize Auth for.
177
+ * @param _deps - Optional firebase-js-sdk dependency bag.
178
+ *
179
+ * @remarks
180
+ * The optional `deps` argument exists for firebase-js-sdk API parity. React Native Firebase
181
+ * ignores persistence, popup redirect resolver, and error-map dependencies because native
182
+ * iOS/Android SDKs manage auth state and do not support the web-only persistence stack.
183
+ * `initializeAuth()` returns the same shared Auth instance as {@link getAuth}.
184
+ */
185
+ export function initializeAuth(app, _deps) {
186
+ // Keep initializeAuth() aligned with getAuth(); passing the sentinel here creates a second module.
187
+ return appWithAuth(app).auth();
188
+ }
189
+
190
+ /**
191
+ * Applies an out-of-band email action code (for example from a password reset or email verification link).
192
+ */
193
+ export function applyActionCode(auth, oobCode) {
194
+ const authInternal = getAuthInternal(auth);
195
+ return callAuthMethod(authInternal, authInternal.applyActionCode, oobCode);
196
+ }
197
+
198
+ /**
199
+ * Registers a callback to run before an auth state change is committed.
200
+ *
201
+ * @returns An unsubscribe function.
202
+ */
203
+ export function beforeAuthStateChanged(auth, callback, onAbort) {
204
+ const authInternal = getAuthInternal(auth);
205
+ return authInternal.beforeAuthStateChanged(callback, onAbort);
206
+ }
207
+
208
+ /**
209
+ * Checks the validity of an out-of-band email action code and returns metadata about the pending operation.
210
+ *
211
+ * @remarks React Native Firebase normalizes native results toward firebase-js-sdk shapes, including mapping
212
+ * `fromEmail` to `previousEmail` and coercing multi-factor info objects.
213
+ */
214
+ export function checkActionCode(auth, oobCode) {
215
+ const authInternal = getAuthInternal(auth);
216
+ return callAuthMethod(authInternal, authInternal.checkActionCode, oobCode).then(normalizeActionCodeInfo);
217
+ }
218
+
219
+ /**
220
+ * Confirms a password reset using the out-of-band code from the reset email.
221
+ */
222
+ export function confirmPasswordReset(auth, oobCode, newPassword) {
223
+ const authInternal = getAuthInternal(auth);
224
+ return callAuthMethod(authInternal, authInternal.confirmPasswordReset, oobCode, newPassword);
225
+ }
226
+
227
+ /**
228
+ * Connects the Auth instance to the Auth emulator.
229
+ *
230
+ * @remarks Delegates to the native `useEmulator` bridge. Accepts the firebase-js-sdk
231
+ * `options.disableWarnings` flag for {@link Auth.emulatorConfig} parity. On web, that flag
232
+ * suppresses the emulator DOM warning banner; native iOS/Android SDKs do not surface that banner,
233
+ * so the value is recorded on `auth.emulatorConfig.options` only. When `options` is provided,
234
+ * `disableWarnings` is required (matching firebase-js-sdk).
235
+ */
236
+ export function connectAuthEmulator(auth, url, options) {
237
+ const authInternal = getAuthInternal(auth);
238
+ callAuthMethod(authInternal, authInternal.useEmulator, url, options);
239
+ }
240
+
241
+ /**
242
+ * Creates a new user with an email address and password.
243
+ *
244
+ * @remarks Returned {@link UserCredential} objects include top-level `providerId` and `operationType`
245
+ * fields. `additionalUserInfo`, when present, is attached as a non-enumerable property.
246
+ */
247
+ export function createUserWithEmailAndPassword(auth, email, password) {
248
+ const authInternal = getAuthInternal(auth);
249
+ return callAuthMethod(authInternal, authInternal.createUserWithEmailAndPassword, email, password).then(userCredential => normalizeUserCredential(userCredential, {
250
+ operationType: OperationType.SIGN_IN
251
+ }));
252
+ }
253
+
254
+ /**
255
+ * Fetches the sign-in methods available for the given email address.
256
+ */
257
+ export function fetchSignInMethodsForEmail(auth, email) {
258
+ const authInternal = getAuthInternal(auth);
259
+ return callAuthMethod(authInternal, authInternal.fetchSignInMethodsForEmail, email);
260
+ }
261
+
262
+ /**
263
+ * Extracts a {@link MultiFactorResolver} from a {@link MultiFactorError}.
264
+ *
265
+ * @throws If the error does not contain resolver hints.
266
+ */
267
+ export function getMultiFactorResolver(auth, error) {
268
+ const authInternal = getAuthInternal(auth);
269
+ const resolver = callAuthMethod(authInternal, authInternal.getMultiFactorResolver, error);
270
+ if (!resolver) {
271
+ throw new Error('The provided auth error did not contain a multi-factor resolver.');
272
+ }
273
+ return normalizeMultiFactorResolver(resolver);
274
+ }
275
+
276
+ /**
277
+ * Returns the redirect sign-in result after a browser redirect flow completes.
278
+ *
279
+ * @remarks
280
+ * **Not supported on React Native Firebase.** Always throws synchronously because native provider
281
+ * flows do not use the browser redirect contract from the firebase-js-sdk.
282
+ */
283
+ export function getRedirectResult(_auth, _resolver) {
284
+ throw new Error('getRedirectResult is unsupported by the native Firebase SDKs.');
285
+ }
286
+
287
+ /**
288
+ * Checks whether an email link is a valid sign-in with email link URL.
289
+ *
290
+ * @remarks React Native Firebase performs this check through the native bridge and returns
291
+ * `Promise<boolean>`. The firebase-js-sdk returns a synchronous `boolean`.
292
+ */
293
+ export function isSignInWithEmailLink(auth, emailLink) {
294
+ const authInternal = getAuthInternal(auth);
295
+ return callAuthMethod(authInternal, authInternal.isSignInWithEmailLink, emailLink);
296
+ }
297
+
298
+ /**
299
+ * Subscribes to auth state changes for the given Auth instance.
300
+ *
301
+ * @returns An unsubscribe function.
302
+ *
303
+ * @remarks The legacy `error` and `completed` callback overload exists for firebase-js-sdk API parity.
304
+ * Native auth listeners never invoke separate error or completed callbacks.
305
+ */
306
+ export function onAuthStateChanged(auth, nextOrObserver, _error, _completed) {
307
+ // The legacy callback overload exists for JS SDK compatibility, but native auth listeners
308
+ // never invoke separate error/completed callbacks.
309
+ const authInternal = getAuthInternal(auth);
310
+ return callAuthMethod(authInternal, authInternal.onAuthStateChanged, normalizeAuthListener(nextOrObserver));
311
+ }
312
+
313
+ /**
314
+ * Subscribes to ID token changes for the given Auth instance.
315
+ *
316
+ * @returns An unsubscribe function.
317
+ *
318
+ * @remarks The legacy `error` and `completed` callback overload exists for firebase-js-sdk API parity.
319
+ * Native auth listeners never invoke separate error or completed callbacks.
320
+ */
321
+ export function onIdTokenChanged(auth, nextOrObserver, _error, _completed) {
322
+ // The legacy callback overload exists for JS SDK compatibility, but native auth listeners
323
+ // never invoke separate error/completed callbacks.
324
+ const authInternal = getAuthInternal(auth);
325
+ return callAuthMethod(authInternal, authInternal.onIdTokenChanged, normalizeAuthListener(nextOrObserver));
326
+ }
327
+
328
+ /**
329
+ * Revokes the given OAuth access token for the current user.
330
+ *
331
+ * @remarks
332
+ * **Web only.** Always throws synchronously on React Native Firebase.
333
+ */
334
+ export function revokeAccessToken(_auth, _token) {
335
+ throw new Error('revokeAccessToken() is only supported on Web');
336
+ }
337
+
338
+ /**
339
+ * Revokes a user's Sign in with Apple token.
340
+ *
341
+ * @remarks
342
+ * React Native Firebase-specific API required by Apple's account-deletion guidelines.
343
+ * **Supported on iOS** via the native `revokeTokenWithAuthorizationCode` bridge.
344
+ * On Android and Web the bridge resolves without performing revocation (no-op).
345
+ * Distinct from firebase-js-sdk {@link revokeAccessToken}, which revokes OAuth access tokens on Web only.
346
+ */
347
+ export function revokeToken(auth, authorizationCode) {
348
+ const authInternal = getAuthInternal(auth);
349
+ return callAuthMethod(authInternal, authInternal.revokeToken, authorizationCode);
350
+ }
351
+
352
+ /**
353
+ * Sends a password reset email to the given address.
354
+ */
355
+ export function sendPasswordResetEmail(auth, email, actionCodeSettings) {
356
+ const authInternal = getAuthInternal(auth);
357
+ return callAuthMethod(authInternal, authInternal.sendPasswordResetEmail, email, actionCodeSettings);
358
+ }
359
+
360
+ /**
361
+ * Sends a sign-in with email link to the given address.
362
+ *
363
+ * @remarks `actionCodeSettings` is required in the modular API (matching firebase-js-sdk).
364
+ * The namespaced `firebase.auth().sendSignInLinkToEmail(email, settings?)` API still supplies
365
+ * defaults when settings are omitted.
366
+ */
367
+ export function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
368
+ const authInternal = getAuthInternal(auth);
369
+ return callAuthMethod(authInternal, authInternal.sendSignInLinkToEmail, email, actionCodeSettings);
370
+ }
371
+
372
+ /**
373
+ * Sets the persistence type for the Auth instance.
374
+ *
375
+ * @remarks
376
+ * **Not supported on React Native Firebase.** Always throws synchronously because auth state is
377
+ * managed by the native iOS/Android SDKs rather than the web persistence stack.
378
+ */
379
+ export function setPersistence(_auth, _persistence) {
380
+ throw new Error('setPersistence is unsupported by the native Firebase SDKs.');
381
+ }
382
+
383
+ /**
384
+ * Signs in anonymously.
385
+ */
386
+ export function signInAnonymously(auth) {
387
+ const authInternal = getAuthInternal(auth);
388
+ return callAuthMethod(authInternal, authInternal.signInAnonymously).then(userCredential => normalizeUserCredential(userCredential, {
389
+ operationType: OperationType.SIGN_IN
390
+ }));
391
+ }
392
+
393
+ /**
394
+ * Signs in with the given auth credential.
395
+ */
396
+ export function signInWithCredential(auth, credential) {
397
+ const authInternal = getAuthInternal(auth);
398
+ return callAuthMethod(authInternal, authInternal.signInWithCredential, credential).then(userCredential => normalizeUserCredential(userCredential, {
399
+ providerId: credential.providerId,
400
+ operationType: OperationType.SIGN_IN
401
+ }));
402
+ }
403
+
404
+ /**
405
+ * Signs in with a custom authentication token.
406
+ */
407
+ export function signInWithCustomToken(auth, customToken) {
408
+ const authInternal = getAuthInternal(auth);
409
+ return callAuthMethod(authInternal, authInternal.signInWithCustomToken, customToken).then(userCredential => normalizeUserCredential(userCredential, {
410
+ operationType: OperationType.SIGN_IN
411
+ }));
412
+ }
413
+
414
+ /**
415
+ * Signs in with an email address and password.
416
+ */
417
+ export function signInWithEmailAndPassword(auth, email, password) {
418
+ const authInternal = getAuthInternal(auth);
419
+ return callAuthMethod(authInternal, authInternal.signInWithEmailAndPassword, email, password).then(userCredential => normalizeUserCredential(userCredential, {
420
+ operationType: OperationType.SIGN_IN
421
+ }));
422
+ }
423
+
424
+ /**
425
+ * Signs in using an email and sign-in with email link.
426
+ *
427
+ * @remarks The `emailLink` argument is optional, matching firebase-js-sdk.
428
+ */
429
+ export function signInWithEmailLink(auth, email, emailLink) {
430
+ const authInternal = getAuthInternal(auth);
431
+ return callAuthMethod(authInternal, authInternal.signInWithEmailLink, email, emailLink).then(userCredential => normalizeUserCredential(userCredential, {
432
+ providerId: ProviderId.PASSWORD,
433
+ operationType: OperationType.SIGN_IN
434
+ }));
435
+ }
436
+
437
+ /**
438
+ * Signs in with a phone number and returns a confirmation result for SMS verification.
439
+ *
440
+ * @remarks
441
+ * Native SDKs own the phone verification flow. The optional `appVerifier` argument from the
442
+ * firebase-js-sdk is ignored. This modular API also does not accept RNFB's legacy `forceResend`
443
+ * argument — use {@link verifyPhoneNumber} for the native listener / force-resend flow instead.
444
+ */
445
+ export function signInWithPhoneNumber(auth, phoneNumber, _appVerifier) {
446
+ // Native SDKs own the verification flow, so the modular wrapper intentionally ignores the
447
+ // JS SDK's optional ApplicationVerifier and forwards only the phone number.
448
+ const authInternal = getAuthInternal(auth);
449
+ return callAuthMethod(authInternal, authInternal.signInWithPhoneNumber, phoneNumber).then(normalizeConfirmationResult);
450
+ }
451
+
452
+ /**
453
+ * Starts native phone number verification and returns a listener for verification events.
454
+ *
455
+ * @remarks React Native Firebase-specific API with no firebase-js-sdk equivalent. Use this for
456
+ * auto-verification, resend, and multi-step phone auth flows that require native callbacks.
457
+ */
458
+ export function verifyPhoneNumber(auth, phoneNumber, autoVerifyTimeoutOrForceResend, forceResend) {
459
+ const authInternal = getAuthInternal(auth);
460
+ return callAuthMethod(authInternal, authInternal.verifyPhoneNumber, phoneNumber, autoVerifyTimeoutOrForceResend, forceResend);
461
+ }
462
+
463
+ /**
464
+ * Signs in with the given provider using a native popup-style flow where supported.
465
+ */
466
+ export function signInWithPopup(auth, provider, _resolver) {
467
+ const authInternal = getAuthInternal(auth);
468
+ return callAuthMethod(authInternal, authInternal.signInWithPopup, provider).then(userCredential => normalizeUserCredential(userCredential, {
469
+ providerId: provider.providerId,
470
+ operationType: OperationType.SIGN_IN
471
+ }));
472
+ }
473
+
474
+ /**
475
+ * Signs in with the given provider using a redirect-style flow.
476
+ *
477
+ * @remarks On React Native Firebase, native provider flows complete immediately and resolve with a
478
+ * {@link UserCredential} instead of following the browser redirect contract used by the
479
+ * firebase-js-sdk (which resolves later via {@link getRedirectResult}).
480
+ */
481
+ export function signInWithRedirect(auth, provider, _resolver) {
482
+ // Native provider flows complete immediately and return a credential instead of following the
483
+ // browser redirect contract from the Firebase JS SDK.
484
+ const authInternal = getAuthInternal(auth);
485
+ return callAuthMethod(authInternal, authInternal.signInWithRedirect, provider).then(userCredential => normalizeUserCredential(userCredential, {
486
+ providerId: provider.providerId,
487
+ operationType: OperationType.SIGN_IN
488
+ }));
489
+ }
490
+
491
+ /**
492
+ * Signs out the current user for the given Auth instance.
493
+ */
494
+ export function signOut(auth) {
495
+ const authInternal = getAuthInternal(auth);
496
+ return callAuthMethod(authInternal, authInternal.signOut);
497
+ }
498
+
499
+ /**
500
+ * Updates the currently signed-in user on the Auth instance.
501
+ */
502
+ export function updateCurrentUser(auth, user) {
503
+ const authInternal = getAuthInternal(auth);
504
+ return callAuthMethod(authInternal, authInternal.updateCurrentUser, user);
505
+ }
506
+
507
+ /**
508
+ * Sets the Auth `languageCode` from the device locale.
509
+ *
510
+ * @remarks
511
+ * **Not supported on React Native Firebase.** Always throws synchronously. Set `auth.languageCode`
512
+ * directly or use {@link setLanguageCode}.
513
+ */
514
+ export function useDeviceLanguage(_auth) {
515
+ throw new Error('useDeviceLanguage is unsupported by the native Firebase SDKs');
516
+ }
517
+
518
+ /**
519
+ * Sets the Auth language code.
520
+ *
521
+ * @remarks React Native Firebase exposes this as a modular helper. The firebase-js-sdk only exposes
522
+ * the writable `auth.languageCode` property.
523
+ */
524
+ export function setLanguageCode(auth, languageCode) {
525
+ const authInternal = getAuthInternal(auth);
526
+ return callAuthMethod(authInternal, authInternal.setLanguageCode, languageCode);
527
+ }
528
+
529
+ /**
530
+ * Configures iOS keychain access group sharing for the Auth instance.
531
+ *
532
+ * @remarks React Native Firebase-specific iOS helper with no firebase-js-sdk equivalent.
533
+ */
534
+ export function useUserAccessGroup(auth, userAccessGroup) {
535
+ const authInternal = getAuthInternal(auth);
536
+ return callAuthMethod(authInternal, authInternal.useUserAccessGroup, userAccessGroup).then(() => undefined);
537
+ }
538
+
539
+ /**
540
+ * Verifies a password reset code and returns the associated email address.
541
+ */
542
+ export function verifyPasswordResetCode(auth, code) {
543
+ const authInternal = getAuthInternal(auth);
544
+ return callAuthMethod(authInternal, authInternal.verifyPasswordResetCode, code);
545
+ }
546
+
547
+ /**
548
+ * Parses an email action link string.
549
+ *
550
+ * @param link - The email action link to parse.
551
+ * @returns The {@link ActionCodeURL} object, or `null` if the link is invalid.
552
+ *
553
+ * @remarks Pure URL parsing (ported from firebase-js-sdk). Works on all platforms without a native
554
+ * bridge. See also {@link ActionCodeURL.parseLink}.
555
+ */
556
+ export function parseActionCodeURL(link) {
557
+ return ActionCodeURL.parseLink(link);
558
+ }
559
+
560
+ /**
561
+ * Deletes the given user account.
562
+ */
563
+ export function deleteUser(user) {
564
+ const userInternal = getUserInternal(user);
565
+ return callUserMethod(userInternal, userInternal.delete);
566
+ }
567
+
568
+ /**
569
+ * Returns the current ID token for the user.
570
+ */
571
+ export function getIdToken(user, forceRefresh) {
572
+ const userInternal = getUserInternal(user);
573
+ return callUserMethod(userInternal, userInternal.getIdToken, forceRefresh);
574
+ }
575
+
576
+ /**
577
+ * Returns the decoded ID token result for the user.
578
+ */
579
+ export function getIdTokenResult(user, forceRefresh) {
580
+ const userInternal = getUserInternal(user);
581
+ return callUserMethod(userInternal, userInternal.getIdTokenResult, forceRefresh);
582
+ }
583
+
584
+ /**
585
+ * Links the user account with the given credential.
586
+ */
587
+ export function linkWithCredential(user, credential) {
588
+ const userInternal = getUserInternal(user);
589
+ return callUserMethod(userInternal, userInternal.linkWithCredential, credential).then(userCredential => normalizeUserCredential(userCredential, {
590
+ providerId: credential.providerId,
591
+ operationType: OperationType.LINK
592
+ }));
593
+ }
594
+
595
+ /**
596
+ * Links the user account with a phone number using SMS verification.
597
+ *
598
+ * @remarks
599
+ * **Not supported on React Native Firebase.** Always throws synchronously.
600
+ */
601
+ export function linkWithPhoneNumber(_user, _phoneNumber, _appVerifier) {
602
+ throw new Error('linkWithPhoneNumber is unsupported by the native Firebase SDKs');
603
+ }
604
+
605
+ /**
606
+ * Links the user account with the given provider using a native popup-style flow where supported.
607
+ */
608
+ export function linkWithPopup(user, provider, _resolver) {
609
+ const userInternal = getUserInternal(user);
610
+ return callUserMethod(userInternal, userInternal.linkWithPopup, provider).then(userCredential => normalizeUserCredential(userCredential, {
611
+ providerId: provider.providerId,
612
+ operationType: OperationType.LINK
613
+ }));
614
+ }
615
+
616
+ /**
617
+ * Links the user account with the given provider using a redirect-style flow.
618
+ *
619
+ * @remarks On React Native Firebase, native provider flows complete immediately and resolve with a
620
+ * {@link UserCredential} instead of following the browser redirect contract used by the
621
+ * firebase-js-sdk.
622
+ */
623
+ export function linkWithRedirect(user, provider, _resolver) {
624
+ // Native provider flows complete immediately and return a credential instead of following the
625
+ // browser redirect contract from the Firebase JS SDK.
626
+ const userInternal = getUserInternal(user);
627
+ return callUserMethod(userInternal, userInternal.linkWithRedirect, provider).then(userCredential => normalizeUserCredential(userCredential, {
628
+ providerId: provider.providerId,
629
+ operationType: OperationType.LINK
630
+ }));
631
+ }
632
+
633
+ /**
634
+ * Returns the multi-factor interface for the given user.
635
+ *
636
+ * @remarks Uses the user's own Auth instance instead of always calling {@link getAuth}, which fixes
637
+ * secondary Firebase app usage compared with earlier RNFB behavior.
638
+ */
639
+ export function multiFactor(user) {
640
+ return normalizeMultiFactorUser(new MultiFactorUserModule(user._auth || getAuth(), user));
641
+ }
642
+
643
+ /**
644
+ * Reauthenticates the user with the given credential.
645
+ */
646
+ export function reauthenticateWithCredential(user, credential) {
647
+ const userInternal = getUserInternal(user);
648
+ return callUserMethod(userInternal, userInternal.reauthenticateWithCredential, credential).then(userCredential => normalizeUserCredential(userCredential, {
649
+ providerId: credential.providerId,
650
+ operationType: OperationType.REAUTHENTICATE
651
+ }));
652
+ }
653
+
654
+ /**
655
+ * Reauthenticates the user with a phone number using SMS verification.
656
+ *
657
+ * @remarks
658
+ * **Not supported on React Native Firebase.** Always throws synchronously.
659
+ */
660
+ export function reauthenticateWithPhoneNumber(_user, _phoneNumber, _appVerifier) {
661
+ throw new Error('reauthenticateWithPhoneNumber is unsupported by the native Firebase SDKs');
662
+ }
663
+
664
+ /**
665
+ * Reauthenticates the user with the given provider using a native popup-style flow where supported.
666
+ */
667
+ export function reauthenticateWithPopup(user, provider, _resolver) {
668
+ const userInternal = getUserInternal(user);
669
+ return callUserMethod(userInternal, userInternal.reauthenticateWithPopup, provider).then(userCredential => normalizeUserCredential(userCredential, {
670
+ providerId: provider.providerId,
671
+ operationType: OperationType.REAUTHENTICATE
672
+ }));
673
+ }
674
+
675
+ /**
676
+ * Reauthenticates the user with the given provider using a redirect-style flow.
677
+ *
678
+ * @remarks On React Native Firebase, native provider flows do not follow the browser redirect
679
+ * contract. This resolves with `void` after the native flow completes instead of the
680
+ * firebase-js-sdk `Promise<never>` signature used for unresolved browser redirects.
681
+ */
682
+ export function reauthenticateWithRedirect(user, provider, _resolver) {
683
+ const userInternal = getUserInternal(user);
684
+ return callUserMethod(userInternal, userInternal.reauthenticateWithRedirect, provider);
685
+ }
686
+
687
+ /**
688
+ * Reloads the user's profile data from the server.
689
+ */
690
+ export function reload(user) {
691
+ const userInternal = getUserInternal(user);
692
+ return callUserMethod(userInternal, userInternal.reload);
693
+ }
694
+
695
+ /**
696
+ * Sends an email verification message to the user.
697
+ */
698
+ export function sendEmailVerification(user, actionCodeSettings) {
699
+ const userInternal = getUserInternal(user);
700
+ return callUserMethod(userInternal, userInternal.sendEmailVerification, actionCodeSettings ?? undefined);
701
+ }
702
+
703
+ /**
704
+ * Unlinks a provider from the user account.
705
+ */
706
+ export function unlink(user, providerId) {
707
+ const userInternal = getUserInternal(user);
708
+ return callUserMethod(userInternal, userInternal.unlink, providerId);
709
+ }
710
+
711
+ /**
712
+ * Updates the user's email address.
713
+ */
714
+ export function updateEmail(user, newEmail) {
715
+ const userInternal = getUserInternal(user);
716
+ return callUserMethod(userInternal, userInternal.updateEmail, newEmail);
717
+ }
718
+
719
+ /**
720
+ * Updates the user's password.
721
+ */
722
+ export function updatePassword(user, newPassword) {
723
+ const userInternal = getUserInternal(user);
724
+ return callUserMethod(userInternal, userInternal.updatePassword, newPassword);
725
+ }
726
+
727
+ /**
728
+ * Updates the user's phone number using a phone auth credential.
729
+ */
730
+ export function updatePhoneNumber(user, credential) {
731
+ const userInternal = getUserInternal(user);
732
+ return callUserMethod(userInternal, userInternal.updatePhoneNumber, credential);
733
+ }
734
+
735
+ /**
736
+ * Updates the user's display name and/or photo URL.
737
+ */
738
+ export function updateProfile(user, profile) {
739
+ const userInternal = getUserInternal(user);
740
+ return callUserMethod(userInternal, userInternal.updateProfile, {
741
+ displayName: profile.displayName,
742
+ photoURL: profile.photoURL
743
+ });
744
+ }
745
+
746
+ /**
747
+ * Sends a verification email to the new address before updating the user's email.
748
+ */
749
+ export function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) {
750
+ const userInternal = getUserInternal(user);
751
+ return callUserMethod(userInternal, userInternal.verifyBeforeUpdateEmail, newEmail, actionCodeSettings ?? undefined);
752
+ }
753
+
754
+ /**
755
+ * Returns additional OAuth / federated sign-in information from a {@link UserCredential}.
756
+ *
757
+ * @remarks Returns firebase-js-sdk core fields plus any extra native keys copied from the bridge.
758
+ */
759
+ export function getAdditionalUserInfo(userCredential) {
760
+ if (userCredential.additionalUserInfo) {
761
+ return userCredential.additionalUserInfo;
762
+ }
763
+ const info = userCredential.additionalUserInfo;
764
+ if (!info) {
765
+ return null;
766
+ }
767
+ return normalizeAdditionalUserInfo(info);
768
+ }
769
+
770
+ /**
771
+ * Returns the configured custom auth domain for the Auth instance.
772
+ *
773
+ * @remarks React Native Firebase-specific helper with no firebase-js-sdk equivalent.
774
+ */
775
+ export function getCustomAuthDomain(auth) {
776
+ const authInternal = getAuthInternal(auth);
777
+ return callAuthMethod(authInternal, authInternal.getCustomAuthDomain);
778
+ }
779
+
780
+ /**
781
+ * Validates a password against the project's password policy.
782
+ */
783
+ export function validatePassword(auth, password) {
784
+ if (!auth || !('app' in auth)) {
785
+ throw new Error(`firebase.auth().validatePassword(*) 'auth' must be a valid Auth instance with an 'app' property`);
786
+ }
787
+ if (password === null || password === undefined) {
788
+ throw new Error("firebase.auth().validatePassword(*) expected 'password' to be a non-null or a defined value.");
789
+ }
790
+ const authWithPasswordValidation = getAuthInternal(auth);
791
+ return callAuthMethod(authWithPasswordValidation, authWithPasswordValidation.validatePassword, password);
792
+ }
793
+ //# sourceMappingURL=modular.js.map