@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.
- package/CHANGELOG.md +16 -0
- package/android/src/main/java/io/invertase/firebase/auth/ReactNativeFirebaseAuthModule.java +16 -4
- package/dist/module/ActionCodeURL.js +140 -0
- package/dist/module/ActionCodeURL.js.map +1 -0
- package/{lib → dist/module}/ConfirmationResult.js +4 -5
- package/dist/module/ConfirmationResult.js.map +1 -0
- package/{lib → dist/module}/MultiFactorResolver.js +14 -5
- package/dist/module/MultiFactorResolver.js.map +1 -0
- package/{lib → dist/module}/PhoneAuthListener.js +52 -75
- package/dist/module/PhoneAuthListener.js.map +1 -0
- package/dist/module/PhoneAuthState.js +25 -0
- package/dist/module/PhoneAuthState.js.map +1 -0
- package/dist/module/PhoneMultiFactorGenerator.js +39 -0
- package/dist/module/PhoneMultiFactorGenerator.js.map +1 -0
- package/{lib → dist/module}/Settings.js +3 -7
- package/dist/module/Settings.js.map +1 -0
- package/{lib → dist/module}/TotpMultiFactorGenerator.js +20 -15
- package/dist/module/TotpMultiFactorGenerator.js.map +1 -0
- package/{lib → dist/module}/TotpSecret.js +7 -5
- package/dist/module/TotpSecret.js.map +1 -0
- package/dist/module/User.js +245 -0
- package/dist/module/User.js.map +1 -0
- package/dist/module/constants.js +54 -0
- package/dist/module/constants.js.map +1 -0
- package/dist/module/credentials/AuthCredential.js +51 -0
- package/dist/module/credentials/AuthCredential.js.map +1 -0
- package/dist/module/credentials/EmailAuthCredential.js +51 -0
- package/dist/module/credentials/EmailAuthCredential.js.map +1 -0
- package/dist/module/credentials/OAuthCredential.js +84 -0
- package/dist/module/credentials/OAuthCredential.js.map +1 -0
- package/dist/module/credentials/PhoneAuthCredential.js +50 -0
- package/dist/module/credentials/PhoneAuthCredential.js.map +1 -0
- package/{lib/providers/GoogleAuthProvider.js → dist/module/credentials/index.js} +7 -19
- package/dist/module/credentials/index.js.map +1 -0
- package/{lib → dist/module}/getMultiFactorResolver.js +5 -8
- package/dist/module/getMultiFactorResolver.js.map +1 -0
- package/{lib/providers/FacebookAuthProvider.js → dist/module/index.js} +11 -18
- package/dist/module/index.js.map +1 -0
- package/dist/module/modular.js +793 -0
- package/dist/module/modular.js.map +1 -0
- package/{lib → dist/module}/multiFactor.js +16 -14
- package/dist/module/multiFactor.js.map +1 -0
- package/dist/module/namespaced.js +522 -0
- package/dist/module/namespaced.js.map +1 -0
- package/dist/module/package.json +1 -0
- package/dist/module/password-policy/PasswordPolicyImpl.js +103 -0
- package/dist/module/password-policy/PasswordPolicyImpl.js.map +1 -0
- package/{lib → dist/module}/password-policy/PasswordPolicyMixin.js +14 -16
- package/dist/module/password-policy/PasswordPolicyMixin.js.map +1 -0
- package/{lib → dist/module}/password-policy/passwordPolicyApi.js +18 -12
- package/dist/module/password-policy/passwordPolicyApi.js.map +1 -0
- package/{lib → dist/module}/providers/AppleAuthProvider.js +14 -7
- package/dist/module/providers/AppleAuthProvider.js.map +1 -0
- package/{lib → dist/module}/providers/EmailAuthProvider.js +10 -25
- package/dist/module/providers/EmailAuthProvider.js.map +1 -0
- package/dist/module/providers/FacebookAuthProvider.js +56 -0
- package/dist/module/providers/FacebookAuthProvider.js.map +1 -0
- package/dist/module/providers/GithubAuthProvider.js +49 -0
- package/dist/module/providers/GithubAuthProvider.js.map +1 -0
- package/dist/module/providers/GoogleAuthProvider.js +57 -0
- package/dist/module/providers/GoogleAuthProvider.js.map +1 -0
- package/dist/module/providers/OAuthProvider.js +116 -0
- package/dist/module/providers/OAuthProvider.js.map +1 -0
- package/{lib → dist/module}/providers/OIDCAuthProvider.js +15 -7
- package/dist/module/providers/OIDCAuthProvider.js.map +1 -0
- package/dist/module/providers/PhoneAuthProvider.js +87 -0
- package/dist/module/providers/PhoneAuthProvider.js.map +1 -0
- package/dist/module/providers/TwitterAuthProvider.js +50 -0
- package/dist/module/providers/TwitterAuthProvider.js.map +1 -0
- package/dist/module/types/auth.js +43 -0
- package/dist/module/types/auth.js.map +1 -0
- package/dist/module/types/internal.js +4 -0
- package/dist/module/types/internal.js.map +1 -0
- package/dist/module/types/namespaced.js +62 -0
- package/dist/module/types/namespaced.js.map +1 -0
- package/dist/module/version.js +5 -0
- package/dist/module/version.js.map +1 -0
- package/dist/module/web/RNFBAuthModule.android.js +5 -0
- package/dist/module/web/RNFBAuthModule.android.js.map +1 -0
- package/dist/module/web/RNFBAuthModule.ios.js +5 -0
- package/dist/module/web/RNFBAuthModule.ios.js.map +1 -0
- package/{lib → dist/module}/web/RNFBAuthModule.js +104 -321
- package/dist/module/web/RNFBAuthModule.js.map +1 -0
- package/dist/typescript/lib/ActionCodeURL.d.ts +41 -0
- package/dist/typescript/lib/ActionCodeURL.d.ts.map +1 -0
- package/dist/typescript/lib/ConfirmationResult.d.ts +10 -0
- package/dist/typescript/lib/ConfirmationResult.d.ts.map +1 -0
- package/dist/typescript/lib/MultiFactorResolver.d.ts +24 -0
- package/dist/typescript/lib/MultiFactorResolver.d.ts.map +1 -0
- package/dist/typescript/lib/PhoneAuthListener.d.ts +34 -0
- package/dist/typescript/lib/PhoneAuthListener.d.ts.map +1 -0
- package/dist/typescript/lib/PhoneAuthState.d.ts +7 -0
- package/dist/typescript/lib/PhoneAuthState.d.ts.map +1 -0
- package/dist/typescript/lib/PhoneMultiFactorGenerator.d.ts +7 -0
- package/dist/typescript/lib/PhoneMultiFactorGenerator.d.ts.map +1 -0
- package/dist/typescript/lib/Settings.d.ts +13 -0
- package/dist/typescript/lib/Settings.d.ts.map +1 -0
- package/dist/typescript/lib/TotpMultiFactorGenerator.d.ts +11 -0
- package/dist/typescript/lib/TotpMultiFactorGenerator.d.ts.map +1 -0
- package/dist/typescript/lib/TotpSecret.d.ts +33 -0
- package/dist/typescript/lib/TotpSecret.d.ts.map +1 -0
- package/dist/typescript/lib/User.d.ts +51 -0
- package/dist/typescript/lib/User.d.ts.map +1 -0
- package/dist/typescript/lib/constants.d.ts +35 -0
- package/dist/typescript/lib/constants.d.ts.map +1 -0
- package/dist/typescript/lib/credentials/AuthCredential.d.ts +12 -0
- package/dist/typescript/lib/credentials/AuthCredential.d.ts.map +1 -0
- package/dist/typescript/lib/credentials/EmailAuthCredential.d.ts +8 -0
- package/dist/typescript/lib/credentials/EmailAuthCredential.d.ts.map +1 -0
- package/dist/typescript/lib/credentials/OAuthCredential.d.ts +22 -0
- package/dist/typescript/lib/credentials/OAuthCredential.d.ts.map +1 -0
- package/dist/typescript/lib/credentials/PhoneAuthCredential.d.ts +8 -0
- package/dist/typescript/lib/credentials/PhoneAuthCredential.d.ts.map +1 -0
- package/dist/typescript/lib/credentials/index.d.ts +5 -0
- package/dist/typescript/lib/credentials/index.d.ts.map +1 -0
- package/dist/typescript/lib/getMultiFactorResolver.d.ts +19 -0
- package/dist/typescript/lib/getMultiFactorResolver.d.ts.map +1 -0
- package/dist/typescript/lib/index.d.ts +8 -0
- package/dist/typescript/lib/index.d.ts.map +1 -0
- package/dist/typescript/lib/modular.d.ts +370 -0
- package/dist/typescript/lib/modular.d.ts.map +1 -0
- package/dist/typescript/lib/multiFactor.d.ts +26 -0
- package/dist/typescript/lib/multiFactor.d.ts.map +1 -0
- package/dist/typescript/lib/namespaced.d.ts +12 -0
- package/dist/typescript/lib/namespaced.d.ts.map +1 -0
- package/dist/typescript/lib/password-policy/PasswordPolicyImpl.d.ts +19 -0
- package/dist/typescript/lib/password-policy/PasswordPolicyImpl.d.ts.map +1 -0
- package/dist/typescript/lib/password-policy/PasswordPolicyMixin.d.ts +11 -0
- package/dist/typescript/lib/password-policy/PasswordPolicyMixin.d.ts.map +1 -0
- package/dist/typescript/lib/password-policy/passwordPolicyApi.d.ts +10 -0
- package/dist/typescript/lib/password-policy/passwordPolicyApi.d.ts.map +1 -0
- package/dist/typescript/lib/providers/AppleAuthProvider.d.ts +16 -0
- package/dist/typescript/lib/providers/AppleAuthProvider.d.ts.map +1 -0
- package/dist/typescript/lib/providers/EmailAuthProvider.d.ts +11 -0
- package/dist/typescript/lib/providers/EmailAuthProvider.d.ts.map +1 -0
- package/dist/typescript/lib/providers/FacebookAuthProvider.d.ts +19 -0
- package/dist/typescript/lib/providers/FacebookAuthProvider.d.ts.map +1 -0
- package/dist/typescript/lib/providers/GithubAuthProvider.d.ts +15 -0
- package/dist/typescript/lib/providers/GithubAuthProvider.d.ts.map +1 -0
- package/dist/typescript/lib/providers/GoogleAuthProvider.d.ts +21 -0
- package/dist/typescript/lib/providers/GoogleAuthProvider.d.ts.map +1 -0
- package/dist/typescript/lib/providers/OAuthProvider.d.ts +33 -0
- package/dist/typescript/lib/providers/OAuthProvider.d.ts.map +1 -0
- package/dist/typescript/lib/providers/OIDCAuthProvider.d.ts +16 -0
- package/dist/typescript/lib/providers/OIDCAuthProvider.d.ts.map +1 -0
- package/dist/typescript/lib/providers/PhoneAuthProvider.d.ts +16 -0
- package/dist/typescript/lib/providers/PhoneAuthProvider.d.ts.map +1 -0
- package/dist/typescript/lib/providers/TwitterAuthProvider.d.ts +15 -0
- package/dist/typescript/lib/providers/TwitterAuthProvider.d.ts.map +1 -0
- package/dist/typescript/lib/types/auth.d.ts +305 -0
- package/dist/typescript/lib/types/auth.d.ts.map +1 -0
- package/dist/typescript/lib/types/internal.d.ts +293 -0
- package/dist/typescript/lib/types/internal.d.ts.map +1 -0
- package/dist/typescript/lib/types/namespaced.d.ts +2185 -0
- package/dist/typescript/lib/types/namespaced.d.ts.map +1 -0
- package/dist/typescript/lib/version.d.ts +2 -0
- package/dist/typescript/lib/version.d.ts.map +1 -0
- package/dist/typescript/lib/web/RNFBAuthModule.android.d.ts +3 -0
- package/dist/typescript/lib/web/RNFBAuthModule.android.d.ts.map +1 -0
- package/dist/typescript/lib/web/RNFBAuthModule.d.ts +406 -0
- package/dist/typescript/lib/web/RNFBAuthModule.d.ts.map +1 -0
- package/dist/typescript/lib/web/RNFBAuthModule.ios.d.ts +3 -0
- package/dist/typescript/lib/web/RNFBAuthModule.ios.d.ts.map +1 -0
- package/dist/typescript/package.json +1 -0
- package/ios/RNFBAuth/RNFBAuthModule.m +4 -2
- package/lib/ActionCodeURL.ts +174 -0
- package/lib/ConfirmationResult.ts +42 -0
- package/lib/MultiFactorResolver.ts +51 -0
- package/lib/PhoneAuthListener.ts +312 -0
- package/lib/PhoneAuthState.ts +22 -0
- package/lib/{PhoneMultiFactorGenerator.js → PhoneMultiFactorGenerator.ts} +8 -2
- package/lib/Settings.ts +59 -0
- package/lib/TotpMultiFactorGenerator.ts +78 -0
- package/lib/TotpSecret.ts +71 -0
- package/lib/{User.js → User.ts} +127 -83
- package/lib/constants.ts +55 -0
- package/lib/credentials/AuthCredential.ts +55 -0
- package/lib/credentials/EmailAuthCredential.ts +70 -0
- package/lib/credentials/OAuthCredential.ts +113 -0
- package/lib/credentials/PhoneAuthCredential.ts +66 -0
- package/lib/{providers/GithubAuthProvider.js → credentials/index.ts} +4 -19
- package/lib/getMultiFactorResolver.ts +40 -0
- package/lib/{providers/TwitterAuthProvider.js → index.ts} +14 -19
- package/lib/modular.ts +1172 -0
- package/lib/multiFactor.ts +83 -0
- package/lib/namespaced.ts +846 -0
- package/lib/password-policy/{PasswordPolicyImpl.js → PasswordPolicyImpl.ts} +37 -19
- package/lib/password-policy/PasswordPolicyMixin.ts +83 -0
- package/lib/password-policy/passwordPolicyApi.ts +60 -0
- package/lib/providers/AppleAuthProvider.ts +44 -0
- package/lib/providers/EmailAuthProvider.ts +42 -0
- package/lib/providers/FacebookAuthProvider.ts +58 -0
- package/lib/providers/GithubAuthProvider.ts +51 -0
- package/lib/providers/GoogleAuthProvider.ts +60 -0
- package/lib/providers/OAuthProvider.ts +150 -0
- package/lib/providers/OIDCAuthProvider.ts +49 -0
- package/lib/providers/PhoneAuthProvider.ts +161 -0
- package/lib/providers/TwitterAuthProvider.ts +52 -0
- package/lib/types/auth.ts +393 -0
- package/lib/types/internal.ts +475 -0
- package/lib/{index.d.ts → types/namespaced.ts} +52 -41
- package/lib/version.ts +2 -0
- package/lib/web/RNFBAuthModule.ts +1359 -0
- package/package.json +41 -9
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/tsconfig.json +26 -0
- package/tsdoc.json +22 -0
- package/typedoc.json +9 -2
- package/lib/index.js +0 -572
- package/lib/modular/index.d.ts +0 -801
- package/lib/modular/index.js +0 -651
- package/lib/providers/OAuthProvider.js +0 -70
- package/lib/providers/PhoneAuthProvider.js +0 -52
- package/lib/version.js +0 -2
- /package/lib/web/{RNFBAuthModule.android.js → RNFBAuthModule.android.ts} +0 -0
- /package/lib/web/{RNFBAuthModule.ios.js → RNFBAuthModule.ios.ts} +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { AuthCredential, parseCredentialJSON } from './AuthCredential';
|
|
19
|
+
|
|
20
|
+
type OAuthCredentialJSON = {
|
|
21
|
+
providerId?: string;
|
|
22
|
+
signInMethod?: string;
|
|
23
|
+
idToken?: string;
|
|
24
|
+
accessToken?: string;
|
|
25
|
+
rawNonce?: string;
|
|
26
|
+
nonce?: string;
|
|
27
|
+
secret?: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type OAuthCredentialParams = {
|
|
31
|
+
idToken?: string;
|
|
32
|
+
accessToken?: string;
|
|
33
|
+
rawNonce?: string;
|
|
34
|
+
secret?: string;
|
|
35
|
+
/** @internal RNFB native bridge token slot override */
|
|
36
|
+
bridgeToken?: string;
|
|
37
|
+
/** @internal RNFB native bridge secret slot override */
|
|
38
|
+
bridgeSecret?: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
function resolveOAuthBridgeFields(params: OAuthCredentialParams): { token: string; secret: string } {
|
|
42
|
+
if (params.bridgeToken !== undefined || params.bridgeSecret !== undefined) {
|
|
43
|
+
return {
|
|
44
|
+
token: params.bridgeToken ?? '',
|
|
45
|
+
secret: params.bridgeSecret ?? '',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (params.idToken) {
|
|
50
|
+
return {
|
|
51
|
+
token: params.idToken,
|
|
52
|
+
secret: params.rawNonce ?? params.secret ?? params.accessToken ?? '',
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (params.accessToken) {
|
|
57
|
+
// OAuthProvider access-token-only credentials use the secret bridge slot.
|
|
58
|
+
return {
|
|
59
|
+
token: '',
|
|
60
|
+
secret: params.accessToken,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
token: params.secret ?? '',
|
|
66
|
+
secret: params.rawNonce ?? '',
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export class OAuthCredential extends AuthCredential {
|
|
71
|
+
readonly idToken?: string;
|
|
72
|
+
readonly accessToken?: string;
|
|
73
|
+
/** @remarks Used for Sign in with Apple and Facebook limited-login flows. OAuth 1.0 token secrets (e.g. Twitter) use the inherited AuthCredential secret bridge field instead. */
|
|
74
|
+
readonly rawNonce?: string;
|
|
75
|
+
|
|
76
|
+
constructor(providerId: string, params: OAuthCredentialParams) {
|
|
77
|
+
const bridge = resolveOAuthBridgeFields(params);
|
|
78
|
+
super(providerId, providerId, bridge.token, bridge.secret);
|
|
79
|
+
this.idToken = params.idToken;
|
|
80
|
+
this.accessToken = params.accessToken;
|
|
81
|
+
this.rawNonce = params.rawNonce;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
toJSON(): object {
|
|
85
|
+
const json: Record<string, unknown> = {
|
|
86
|
+
providerId: this.providerId,
|
|
87
|
+
signInMethod: this.signInMethod,
|
|
88
|
+
idToken: this.idToken,
|
|
89
|
+
accessToken: this.accessToken,
|
|
90
|
+
rawNonce: this.rawNonce,
|
|
91
|
+
nonce: this.rawNonce,
|
|
92
|
+
};
|
|
93
|
+
// Twitter (and similar) store the token secret in the native bridge secret slot, not rawNonce.
|
|
94
|
+
if (this.secret && !this.rawNonce) {
|
|
95
|
+
json.secret = this.secret;
|
|
96
|
+
}
|
|
97
|
+
return json;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static fromJSON(json: object | string): OAuthCredential | null {
|
|
101
|
+
const parsed = parseCredentialJSON(json) as OAuthCredentialJSON | null;
|
|
102
|
+
if (!parsed || typeof parsed.providerId !== 'string') {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return new OAuthCredential(parsed.providerId, {
|
|
107
|
+
idToken: parsed.idToken,
|
|
108
|
+
accessToken: parsed.accessToken,
|
|
109
|
+
rawNonce: parsed.rawNonce ?? parsed.nonce,
|
|
110
|
+
secret: parsed.secret,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { AuthCredential, parseCredentialJSON } from './AuthCredential';
|
|
19
|
+
|
|
20
|
+
const providerId = 'phone' as const;
|
|
21
|
+
|
|
22
|
+
type PhoneCredentialJSON = {
|
|
23
|
+
providerId?: string;
|
|
24
|
+
signInMethod?: string;
|
|
25
|
+
verificationId?: string;
|
|
26
|
+
verificationCode?: string;
|
|
27
|
+
temporaryProof?: string;
|
|
28
|
+
phoneNumber?: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export class PhoneAuthCredential extends AuthCredential {
|
|
32
|
+
constructor(verificationId: string, verificationCode: string) {
|
|
33
|
+
super(providerId, providerId, verificationId, verificationCode);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
toJSON(): object {
|
|
37
|
+
return {
|
|
38
|
+
verificationId: this.token,
|
|
39
|
+
verificationCode: this.secret,
|
|
40
|
+
providerId: this.providerId,
|
|
41
|
+
signInMethod: this.signInMethod,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static fromJSON(json: object | string): PhoneAuthCredential | null {
|
|
46
|
+
const parsed = parseCredentialJSON(json) as PhoneCredentialJSON | null;
|
|
47
|
+
if (!parsed) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const verificationId = parsed.verificationId;
|
|
52
|
+
const verificationCode = parsed.verificationCode;
|
|
53
|
+
if (typeof verificationId !== 'string' || typeof verificationCode !== 'string') {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return new PhoneAuthCredential(verificationId, verificationCode);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function createPhoneAuthCredential(
|
|
62
|
+
verificationId: string,
|
|
63
|
+
verificationCode: string,
|
|
64
|
+
): PhoneAuthCredential {
|
|
65
|
+
return new PhoneAuthCredential(verificationId, verificationCode);
|
|
66
|
+
}
|
|
@@ -15,22 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
throw new Error('`new GithubAuthProvider()` is not supported on the native Firebase SDKs.');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
static get PROVIDER_ID() {
|
|
26
|
-
return providerId;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static credential(token) {
|
|
30
|
-
return {
|
|
31
|
-
token,
|
|
32
|
-
secret: '',
|
|
33
|
-
providerId,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
18
|
+
export { AuthCredential, parseCredentialJSON } from './AuthCredential';
|
|
19
|
+
export { EmailAuthCredential, createEmailAuthCredential } from './EmailAuthCredential';
|
|
20
|
+
export { OAuthCredential } from './OAuthCredential';
|
|
21
|
+
export { PhoneAuthCredential, createPhoneAuthCredential } from './PhoneAuthCredential';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isOther } from '@react-native-firebase/app/dist/module/common';
|
|
2
|
+
import MultiFactorResolver from './MultiFactorResolver';
|
|
3
|
+
import type { FirebaseAuthTypes } from './types/namespaced';
|
|
4
|
+
import type { AuthInternal } from './types/internal';
|
|
5
|
+
|
|
6
|
+
type ErrorWithResolver = FirebaseAuthTypes.MultiFactorError & {
|
|
7
|
+
userInfo?: {
|
|
8
|
+
resolver?: {
|
|
9
|
+
hints: FirebaseAuthTypes.MultiFactorResolver['hints'];
|
|
10
|
+
session: FirebaseAuthTypes.MultiFactorResolver['session'];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Create a new resolver based on an auth instance and error
|
|
17
|
+
* object.
|
|
18
|
+
*
|
|
19
|
+
* Returns null if no resolver object can be found on the error.
|
|
20
|
+
*/
|
|
21
|
+
export function getMultiFactorResolver(
|
|
22
|
+
auth: AuthInternal,
|
|
23
|
+
error: ErrorWithResolver,
|
|
24
|
+
): FirebaseAuthTypes.MultiFactorResolver | null {
|
|
25
|
+
if (isOther) {
|
|
26
|
+
return auth.native.getMultiFactorResolver(error) as FirebaseAuthTypes.MultiFactorResolver | null;
|
|
27
|
+
}
|
|
28
|
+
if (
|
|
29
|
+
error.hasOwnProperty('userInfo') &&
|
|
30
|
+
error.userInfo?.hasOwnProperty('resolver') &&
|
|
31
|
+
error.userInfo.resolver
|
|
32
|
+
) {
|
|
33
|
+
return new MultiFactorResolver(
|
|
34
|
+
auth,
|
|
35
|
+
error.userInfo.resolver,
|
|
36
|
+
) as unknown as FirebaseAuthTypes.MultiFactorResolver;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
@@ -14,23 +14,18 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
|
+
// modular API
|
|
18
|
+
export type * from './types/auth';
|
|
19
|
+
export { ActionCodeURL } from './ActionCodeURL';
|
|
20
|
+
export {
|
|
21
|
+
AuthCredential,
|
|
22
|
+
EmailAuthCredential,
|
|
23
|
+
OAuthCredential,
|
|
24
|
+
PhoneAuthCredential,
|
|
25
|
+
} from './credentials';
|
|
26
|
+
export * from './modular';
|
|
17
27
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
throw new Error('`new TwitterAuthProvider()` is not supported on the native Firebase SDKs.');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
static get PROVIDER_ID() {
|
|
26
|
-
return providerId;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static credential(token, secret) {
|
|
30
|
-
return {
|
|
31
|
-
token,
|
|
32
|
-
secret,
|
|
33
|
-
providerId,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
28
|
+
// namespaced API
|
|
29
|
+
export * from './types/namespaced';
|
|
30
|
+
export * from './namespaced';
|
|
31
|
+
export { default } from './namespaced';
|