@react-native-firebase/auth 24.1.0 → 25.0.0
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 +14 -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 +779 -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 +360 -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 +292 -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 +1158 -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 +474 -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
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
/*
|
|
2
4
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
5
|
*
|
|
@@ -16,39 +18,33 @@
|
|
|
16
18
|
*/
|
|
17
19
|
|
|
18
20
|
import { isAndroid } from '@react-native-firebase/app/dist/module/common';
|
|
19
|
-
|
|
20
21
|
export default class Settings {
|
|
21
22
|
constructor(auth) {
|
|
22
23
|
this._auth = auth;
|
|
23
24
|
this._forceRecaptchaFlowForTesting = false;
|
|
24
25
|
this._appVerificationDisabledForTesting = false;
|
|
25
26
|
}
|
|
26
|
-
|
|
27
27
|
get forceRecaptchaFlowForTesting() {
|
|
28
28
|
return this._forceRecaptchaFlowForTesting;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
30
|
set forceRecaptchaFlowForTesting(forceRecaptchaFlow) {
|
|
32
31
|
if (isAndroid) {
|
|
33
32
|
this._forceRecaptchaFlowForTesting = forceRecaptchaFlow;
|
|
34
33
|
this._auth.native.forceRecaptchaFlowForTesting(forceRecaptchaFlow);
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
|
-
|
|
38
36
|
get appVerificationDisabledForTesting() {
|
|
39
37
|
return this._appVerificationDisabledForTesting;
|
|
40
38
|
}
|
|
41
|
-
|
|
42
39
|
set appVerificationDisabledForTesting(disabled) {
|
|
43
40
|
this._appVerificationDisabledForTesting = disabled;
|
|
44
41
|
this._auth.native.setAppVerificationDisabledForTesting(disabled);
|
|
45
42
|
}
|
|
46
|
-
|
|
47
43
|
setAutoRetrievedSmsCodeForPhoneNumber(phoneNumber, smsCode) {
|
|
48
44
|
if (isAndroid) {
|
|
49
45
|
return this._auth.native.setAutoRetrievedSmsCodeForPhoneNumber(phoneNumber, smsCode);
|
|
50
46
|
}
|
|
51
|
-
|
|
52
47
|
return Promise.resolve(null);
|
|
53
48
|
}
|
|
54
49
|
}
|
|
50
|
+
//# sourceMappingURL=Settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isAndroid","Settings","constructor","auth","_auth","_forceRecaptchaFlowForTesting","_appVerificationDisabledForTesting","forceRecaptchaFlowForTesting","forceRecaptchaFlow","native","appVerificationDisabledForTesting","disabled","setAppVerificationDisabledForTesting","setAutoRetrievedSmsCodeForPhoneNumber","phoneNumber","smsCode","Promise","resolve"],"sourceRoot":"../../lib","sources":["Settings.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,QAAQ,+CAA+C;AAGzE,eAAe,MAAMC,QAAQ,CAAC;EAK5BC,WAAWA,CAACC,IAAkB,EAAE;IAC9B,IAAI,CAACC,KAAK,GAAGD,IAAI;IACjB,IAAI,CAACE,6BAA6B,GAAG,KAAK;IAC1C,IAAI,CAACC,kCAAkC,GAAG,KAAK;EACjD;EAEA,IAAIC,4BAA4BA,CAAA,EAAY;IAC1C,OAAO,IAAI,CAACF,6BAA6B;EAC3C;EAEA,IAAIE,4BAA4BA,CAACC,kBAA2B,EAAE;IAC5D,IAAIR,SAAS,EAAE;MACb,IAAI,CAACK,6BAA6B,GAAGG,kBAAkB;MACvD,IAAI,CAACJ,KAAK,CAACK,MAAM,CAACF,4BAA4B,CAACC,kBAAkB,CAAC;IACpE;EACF;EAEA,IAAIE,iCAAiCA,CAAA,EAAY;IAC/C,OAAO,IAAI,CAACJ,kCAAkC;EAChD;EAEA,IAAII,iCAAiCA,CAACC,QAAiB,EAAE;IACvD,IAAI,CAACL,kCAAkC,GAAGK,QAAQ;IAClD,IAAI,CAACP,KAAK,CAACK,MAAM,CAACG,oCAAoC,CAACD,QAAQ,CAAC;EAClE;EAEAE,qCAAqCA,CAACC,WAAmB,EAAEC,OAAe,EAAiB;IACzF,IAAIf,SAAS,EAAE;MACb,OAAO,IAAI,CAACI,KAAK,CAACK,MAAM,CAACI,qCAAqC,CAACC,WAAW,EAAEC,OAAO,CAAC;IACtF;IAEA,OAAOC,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC;EAC9B;AACF","ignoreList":[]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
/*
|
|
2
4
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
5
|
*
|
|
@@ -16,41 +18,44 @@
|
|
|
16
18
|
*/
|
|
17
19
|
|
|
18
20
|
import { isOther } from '@react-native-firebase/app/dist/module/common';
|
|
19
|
-
import { TotpSecret } from
|
|
20
|
-
import { getAuth } from
|
|
21
|
-
|
|
21
|
+
import { TotpSecret } from "./TotpSecret.js";
|
|
22
|
+
import { getAuth } from "./modular.js";
|
|
22
23
|
export default class TotpMultiFactorGenerator {
|
|
23
24
|
static FACTOR_ID = 'totp';
|
|
24
|
-
|
|
25
25
|
constructor() {
|
|
26
|
-
throw new Error(
|
|
27
|
-
'`new TotpMultiFactorGenerator()` is not supported on the native Firebase SDKs.',
|
|
28
|
-
);
|
|
26
|
+
throw new Error('`new TotpMultiFactorGenerator()` is not supported on the native Firebase SDKs.');
|
|
29
27
|
}
|
|
30
|
-
|
|
31
28
|
static assertionForSignIn(uid, verificationCode) {
|
|
32
29
|
if (isOther) {
|
|
33
30
|
// we require the web native assertion when using firebase-js-sdk
|
|
34
31
|
// as it has functions used by the SDK, a shim won't do
|
|
35
32
|
return getAuth().native.assertionForSignIn(uid, verificationCode);
|
|
36
33
|
}
|
|
37
|
-
return {
|
|
34
|
+
return {
|
|
35
|
+
uid,
|
|
36
|
+
verificationCode,
|
|
37
|
+
factorId: 'totp'
|
|
38
|
+
};
|
|
38
39
|
}
|
|
39
|
-
|
|
40
40
|
static assertionForEnrollment(totpSecret, verificationCode) {
|
|
41
|
-
return {
|
|
41
|
+
return {
|
|
42
|
+
totpSecret: totpSecret.secretKey,
|
|
43
|
+
verificationCode,
|
|
44
|
+
factorId: 'totp'
|
|
45
|
+
};
|
|
42
46
|
}
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
static async generateSecret(session,
|
|
48
|
+
// Defaulting to getAuth() preserves the firebase-js-sdk one-argument API for the default app.
|
|
49
|
+
auth = getAuth()) {
|
|
45
50
|
if (!session) {
|
|
46
51
|
throw new Error('Session is required to generate a TOTP secret.');
|
|
47
52
|
}
|
|
48
53
|
const {
|
|
49
|
-
secretKey
|
|
54
|
+
secretKey
|
|
50
55
|
// Other properties are not publicly exposed in native APIs
|
|
51
56
|
// hashingAlgorithm, codeLength, codeIntervalSeconds, enrollmentCompletionDeadline
|
|
52
57
|
} = await auth.native.generateTotpSecret(session);
|
|
53
|
-
|
|
54
58
|
return new TotpSecret(secretKey, auth);
|
|
55
59
|
}
|
|
56
60
|
}
|
|
61
|
+
//# sourceMappingURL=TotpMultiFactorGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isOther","TotpSecret","getAuth","TotpMultiFactorGenerator","FACTOR_ID","constructor","Error","assertionForSignIn","uid","verificationCode","native","factorId","assertionForEnrollment","totpSecret","secretKey","generateSecret","session","auth","generateTotpSecret"],"sourceRoot":"../../lib","sources":["TotpMultiFactorGenerator.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,+CAA+C;AACvE,SAASC,UAAU,QAAQ,iBAAc;AACzC,SAASC,OAAO,QAAQ,cAAW;AAInC,eAAe,MAAMC,wBAAwB,CAAC;EAC5C,OAAgBC,SAAS,GAAG,MAAM;EAElCC,WAAWA,CAAA,EAAG;IACZ,MAAM,IAAIC,KAAK,CACb,gFACF,CAAC;EACH;EAEA,OAAOC,kBAAkBA,CAACC,GAAW,EAAEC,gBAAwB,EAA4B;IACzF,IAAIT,OAAO,EAAE;MACX;MACA;MACA,OAAQE,OAAO,CAAC,CAAC,CAA6BQ,MAAM,CAACH,kBAAkB,CACrEC,GAAG,EACHC,gBACF,CAAC;IACH;IACA,OAAO;MACLD,GAAG;MACHC,gBAAgB;MAChBE,QAAQ,EAAE;IACZ,CAAC;EACH;EAEA,OAAOC,sBAAsBA,CAC3BC,UAAsB,EACtBJ,gBAAwB,EACE;IAC1B,OAAO;MACLI,UAAU,EAAEA,UAAU,CAACC,SAAS;MAChCL,gBAAgB;MAChBE,QAAQ,EAAE;IACZ,CAAC;EACH;EAIA,aAAaI,cAAcA,CACzBC,OAA2B;EAC3B;EACAC,IAAU,GAAGf,OAAO,CAAC,CAAC,EACD;IACrB,IAAI,CAACc,OAAO,EAAE;MACZ,MAAM,IAAIV,KAAK,CAAC,gDAAgD,CAAC;IACnE;IACA,MAAM;MACJQ;MACA;MACA;IACF,CAAC,GAAG,MAAOG,IAAI,CAA6BP,MAAM,CAACQ,kBAAkB,CAACF,OAAO,CAAC;IAE9E,OAAO,IAAIf,UAAU,CAACa,SAAS,EAAEG,IAA+B,CAAC;EACnE;AACF","ignoreList":[]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
/*
|
|
2
4
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
5
|
*
|
|
@@ -15,7 +17,6 @@
|
|
|
15
17
|
*/
|
|
16
18
|
|
|
17
19
|
import { isString } from '@react-native-firebase/app/dist/module/common';
|
|
18
|
-
|
|
19
20
|
export class TotpSecret {
|
|
20
21
|
constructor(secretKey, auth) {
|
|
21
22
|
// The native TotpSecret has many more properties, but they are
|
|
@@ -29,8 +30,6 @@ export class TotpSecret {
|
|
|
29
30
|
/**
|
|
30
31
|
* Shared secret key/seed used for enrolling in TOTP MFA and generating OTPs.
|
|
31
32
|
*/
|
|
32
|
-
secretKey = null;
|
|
33
|
-
|
|
34
33
|
/**
|
|
35
34
|
* Returns a QR code URL as described in
|
|
36
35
|
* https://github.com/google/google-authenticator/wiki/Key-Uri-Format
|
|
@@ -39,7 +38,9 @@ export class TotpSecret {
|
|
|
39
38
|
*
|
|
40
39
|
* @param accountName the name of the account/app along with a user identifier.
|
|
41
40
|
* @param issuer issuer of the TOTP (likely the app name).
|
|
42
|
-
* @returns A Promise that resolves to a QR code URL string.
|
|
41
|
+
* @returns A Promise that resolves to a QR code URL string. Unlike the firebase-js-sdk synchronous
|
|
42
|
+
* return type, this method is async because QR code generation is performed through the React Native
|
|
43
|
+
* native auth bridge.
|
|
43
44
|
*/
|
|
44
45
|
async generateQrCodeUrl(accountName, issuer) {
|
|
45
46
|
// accountName and issure are nullable in the API specification but are
|
|
@@ -60,8 +61,9 @@ export class TotpSecret {
|
|
|
60
61
|
* @param qrCodeUrl the URL to open in the app, from generateQrCodeUrl
|
|
61
62
|
*/
|
|
62
63
|
openInOtpApp(qrCodeUrl) {
|
|
63
|
-
if (isString(qrCodeUrl) &&
|
|
64
|
+
if (isString(qrCodeUrl) && qrCodeUrl !== '') {
|
|
64
65
|
return this.auth.native.openInOtpApp(this.secretKey, qrCodeUrl);
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
}
|
|
69
|
+
//# sourceMappingURL=TotpSecret.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isString","TotpSecret","constructor","secretKey","auth","generateQrCodeUrl","accountName","issuer","native","openInOtpApp","qrCodeUrl"],"sourceRoot":"../../lib","sources":["TotpSecret.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,+CAA+C;AAGxE,OAAO,MAAMC,UAAU,CAAC;EAItBC,WAAWA,CAACC,SAAiB,EAAEC,IAAkB,EAAE;IACjD;IACA;IACA,IAAI,CAACD,SAAS,GAAGA,SAAS;;IAE1B;IACA,IAAI,CAACC,IAAI,GAAGA,IAAI;EAClB;;EAEA;AACF;AACA;EACE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,iBAAiBA,CAACC,WAAoB,EAAEC,MAAe,EAAmB;IAC9E;IACA;IACA,IAAI,CAACP,QAAQ,CAACM,WAAW,CAAC,IAAI,CAACN,QAAQ,CAACO,MAAM,CAAC,IAAID,WAAW,KAAK,EAAE,IAAIC,MAAM,KAAK,EAAE,EAAE;MACtF,OAAO,EAAE;IACX;IACA,OAAO,IAAI,CAACH,IAAI,CAACI,MAAM,CAACH,iBAAiB,CAAC,IAAI,CAACF,SAAS,EAAEG,WAAW,EAAEC,MAAM,CAAC;EAChF;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEE,YAAYA,CAACC,SAAiB,EAAiB;IAC7C,IAAIV,QAAQ,CAACU,SAAS,CAAC,IAAIA,SAAS,KAAK,EAAE,EAAE;MAC3C,OAAO,IAAI,CAACN,IAAI,CAACI,MAAM,CAACC,YAAY,CAAC,IAAI,CAACN,SAAS,EAAEO,SAAS,CAAC;IACjE;EACF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,245 @@
|
|
|
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
|
+
|
|
20
|
+
import { isObject, isString, isUndefined, isBoolean } from '@react-native-firebase/app/dist/module/common';
|
|
21
|
+
export default class User {
|
|
22
|
+
/** @internal */
|
|
23
|
+
|
|
24
|
+
/** @internal */
|
|
25
|
+
|
|
26
|
+
constructor(auth, user) {
|
|
27
|
+
this._auth = auth;
|
|
28
|
+
this._user = user;
|
|
29
|
+
}
|
|
30
|
+
get displayName() {
|
|
31
|
+
return this._user.displayName || null;
|
|
32
|
+
}
|
|
33
|
+
get email() {
|
|
34
|
+
return this._user.email || null;
|
|
35
|
+
}
|
|
36
|
+
get emailVerified() {
|
|
37
|
+
return this._user.emailVerified || false;
|
|
38
|
+
}
|
|
39
|
+
get isAnonymous() {
|
|
40
|
+
return this._user.isAnonymous || false;
|
|
41
|
+
}
|
|
42
|
+
get metadata() {
|
|
43
|
+
const {
|
|
44
|
+
metadata
|
|
45
|
+
} = this._user;
|
|
46
|
+
return {
|
|
47
|
+
lastSignInTime: new Date(metadata.lastSignInTime).toISOString(),
|
|
48
|
+
creationTime: new Date(metadata.creationTime).toISOString()
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
get multiFactor() {
|
|
52
|
+
return this._user.multiFactor || null;
|
|
53
|
+
}
|
|
54
|
+
get phoneNumber() {
|
|
55
|
+
return this._user.phoneNumber || null;
|
|
56
|
+
}
|
|
57
|
+
get tenantId() {
|
|
58
|
+
return this._user.tenantId || null;
|
|
59
|
+
}
|
|
60
|
+
get photoURL() {
|
|
61
|
+
return this._user.photoURL || null;
|
|
62
|
+
}
|
|
63
|
+
get providerData() {
|
|
64
|
+
return this._user.providerData.map(provider => ({
|
|
65
|
+
displayName: provider.displayName ?? null,
|
|
66
|
+
email: provider.email ?? null,
|
|
67
|
+
phoneNumber: provider.phoneNumber ?? null,
|
|
68
|
+
photoURL: provider.photoURL ?? null,
|
|
69
|
+
providerId: provider.providerId,
|
|
70
|
+
uid: provider.uid
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
get providerId() {
|
|
74
|
+
return this._user.providerId;
|
|
75
|
+
}
|
|
76
|
+
get uid() {
|
|
77
|
+
return this._user.uid;
|
|
78
|
+
}
|
|
79
|
+
delete() {
|
|
80
|
+
return this._auth.native.delete().then(() => {
|
|
81
|
+
this._auth._setUser(null);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
getIdToken(forceRefresh = false) {
|
|
85
|
+
return this._auth.native.getIdToken(forceRefresh);
|
|
86
|
+
}
|
|
87
|
+
getIdTokenResult(forceRefresh = false) {
|
|
88
|
+
return this._auth.native.getIdTokenResult(forceRefresh);
|
|
89
|
+
}
|
|
90
|
+
linkWithCredential(credential) {
|
|
91
|
+
return this._auth.native.linkWithCredential(credential.providerId, credential.token, credential.secret).then(userCredential => this._auth._setUserCredential(userCredential));
|
|
92
|
+
}
|
|
93
|
+
linkWithPopup(provider) {
|
|
94
|
+
// call through to linkWithRedirect for shared implementation
|
|
95
|
+
return this.linkWithRedirect(provider);
|
|
96
|
+
}
|
|
97
|
+
linkWithRedirect(provider) {
|
|
98
|
+
return this._auth.native.linkWithProvider(provider.toObject()).then(userCredential => this._auth._setUserCredential(userCredential));
|
|
99
|
+
}
|
|
100
|
+
reauthenticateWithCredential(credential) {
|
|
101
|
+
return this._auth.native.reauthenticateWithCredential(credential.providerId, credential.token, credential.secret).then(userCredential => this._auth._setUserCredential(userCredential));
|
|
102
|
+
}
|
|
103
|
+
reauthenticateWithPopup(provider) {
|
|
104
|
+
// call through to reauthenticateWithRedirect for shared implementation
|
|
105
|
+
return this._auth.native.reauthenticateWithProvider(provider.toObject()).then(userCredential => this._auth._setUserCredential(userCredential));
|
|
106
|
+
}
|
|
107
|
+
reauthenticateWithRedirect(provider) {
|
|
108
|
+
return this._auth.native.reauthenticateWithProvider(provider.toObject()).then(userCredential => {
|
|
109
|
+
this._auth._setUserCredential(userCredential);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
reload() {
|
|
113
|
+
return this._auth.native.reload().then(user => {
|
|
114
|
+
this._auth._setUser(user);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
sendEmailVerification(actionCodeSettings) {
|
|
118
|
+
if (isObject(actionCodeSettings)) {
|
|
119
|
+
const settings = actionCodeSettings;
|
|
120
|
+
if (!isString(settings.url)) {
|
|
121
|
+
throw new Error("firebase.auth.User.sendEmailVerification(*) 'actionCodeSettings.url' expected a string value.");
|
|
122
|
+
}
|
|
123
|
+
if (!isUndefined(settings.linkDomain) && !isString(settings.linkDomain)) {
|
|
124
|
+
throw new Error("firebase.auth.User.sendEmailVerification(*) 'actionCodeSettings.linkDomain' expected a string value.");
|
|
125
|
+
}
|
|
126
|
+
if (!isUndefined(settings.handleCodeInApp) && !isBoolean(settings.handleCodeInApp)) {
|
|
127
|
+
throw new Error("firebase.auth.User.sendEmailVerification(*) 'actionCodeSettings.handleCodeInApp' expected a boolean value.");
|
|
128
|
+
}
|
|
129
|
+
if (!isUndefined(settings.iOS)) {
|
|
130
|
+
if (!isObject(settings.iOS)) {
|
|
131
|
+
throw new Error("firebase.auth.User.sendEmailVerification(*) 'actionCodeSettings.iOS' expected an object value.");
|
|
132
|
+
}
|
|
133
|
+
if (!isString(settings.iOS.bundleId)) {
|
|
134
|
+
throw new Error("firebase.auth.User.sendEmailVerification(*) 'actionCodeSettings.iOS.bundleId' expected a string value.");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (!isUndefined(settings.android)) {
|
|
138
|
+
if (!isObject(settings.android)) {
|
|
139
|
+
throw new Error("firebase.auth.User.sendEmailVerification(*) 'actionCodeSettings.android' expected an object value.");
|
|
140
|
+
}
|
|
141
|
+
if (!isString(settings.android.packageName)) {
|
|
142
|
+
throw new Error("firebase.auth.User.sendEmailVerification(*) 'actionCodeSettings.android.packageName' expected a string value.");
|
|
143
|
+
}
|
|
144
|
+
if (!isUndefined(settings.android.installApp) && !isBoolean(settings.android.installApp)) {
|
|
145
|
+
throw new Error("firebase.auth.User.sendEmailVerification(*) 'actionCodeSettings.android.installApp' expected a boolean value.");
|
|
146
|
+
}
|
|
147
|
+
if (!isUndefined(settings.android.minimumVersion) && !isString(settings.android.minimumVersion)) {
|
|
148
|
+
throw new Error("firebase.auth.User.sendEmailVerification(*) 'actionCodeSettings.android.minimumVersion' expected a string value.");
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return this._auth.native.sendEmailVerification(actionCodeSettings).then(user => {
|
|
153
|
+
this._auth._setUser(user);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
toJSON() {
|
|
157
|
+
return Object.assign({}, this._user);
|
|
158
|
+
}
|
|
159
|
+
unlink(providerId) {
|
|
160
|
+
return this._auth.native.unlink(providerId).then(user => {
|
|
161
|
+
const updatedUser = this._auth._setUser(user);
|
|
162
|
+
if (!updatedUser) {
|
|
163
|
+
throw new Error('firebase.auth.User.unlink() returned no user after unlinking provider.');
|
|
164
|
+
}
|
|
165
|
+
return updatedUser;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
updateEmail(email) {
|
|
169
|
+
return this._auth.native.updateEmail(email).then(user => {
|
|
170
|
+
this._auth._setUser(user);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
updatePassword(password) {
|
|
174
|
+
return this._auth.native.updatePassword(password).then(user => {
|
|
175
|
+
this._auth._setUser(user);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
updatePhoneNumber(credential) {
|
|
179
|
+
return this._auth.native.updatePhoneNumber(credential.providerId, credential.token, credential.secret).then(user => {
|
|
180
|
+
this._auth._setUser(user);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
updateProfile(updates) {
|
|
184
|
+
return this._auth.native.updateProfile(updates).then(user => {
|
|
185
|
+
this._auth._setUser(user);
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
verifyBeforeUpdateEmail(newEmail, actionCodeSettings) {
|
|
189
|
+
if (!isString(newEmail)) {
|
|
190
|
+
throw new Error("firebase.auth.User.verifyBeforeUpdateEmail(*) 'newEmail' expected a string value.");
|
|
191
|
+
}
|
|
192
|
+
if (isObject(actionCodeSettings)) {
|
|
193
|
+
const settings = actionCodeSettings;
|
|
194
|
+
if (!isString(settings.url)) {
|
|
195
|
+
throw new Error("firebase.auth.User.verifyBeforeUpdateEmail(_, *) 'actionCodeSettings.url' expected a string value.");
|
|
196
|
+
}
|
|
197
|
+
if (!isUndefined(settings.linkDomain) && !isString(settings.linkDomain)) {
|
|
198
|
+
throw new Error("firebase.auth.User.verifyBeforeUpdateEmail(_, *) 'actionCodeSettings.linkDomain' expected a string value.");
|
|
199
|
+
}
|
|
200
|
+
if (!isUndefined(settings.handleCodeInApp) && !isBoolean(settings.handleCodeInApp)) {
|
|
201
|
+
throw new Error("firebase.auth.User.verifyBeforeUpdateEmail(_, *) 'actionCodeSettings.handleCodeInApp' expected a boolean value.");
|
|
202
|
+
}
|
|
203
|
+
if (!isUndefined(settings.iOS)) {
|
|
204
|
+
if (!isObject(settings.iOS)) {
|
|
205
|
+
throw new Error("firebase.auth.User.verifyBeforeUpdateEmail(_, *) 'actionCodeSettings.iOS' expected an object value.");
|
|
206
|
+
}
|
|
207
|
+
if (!isString(settings.iOS.bundleId)) {
|
|
208
|
+
throw new Error("firebase.auth.User.verifyBeforeUpdateEmail(_, *) 'actionCodeSettings.iOS.bundleId' expected a string value.");
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (!isUndefined(settings.android)) {
|
|
212
|
+
if (!isObject(settings.android)) {
|
|
213
|
+
throw new Error("firebase.auth.User.verifyBeforeUpdateEmail(_, *) 'actionCodeSettings.android' expected an object value.");
|
|
214
|
+
}
|
|
215
|
+
if (!isString(settings.android.packageName)) {
|
|
216
|
+
throw new Error("firebase.auth.User.verifyBeforeUpdateEmail(_, *) 'actionCodeSettings.android.packageName' expected a string value.");
|
|
217
|
+
}
|
|
218
|
+
if (!isUndefined(settings.android.installApp) && !isBoolean(settings.android.installApp)) {
|
|
219
|
+
throw new Error("firebase.auth.User.verifyBeforeUpdateEmail(_, *) 'actionCodeSettings.android.installApp' expected a boolean value.");
|
|
220
|
+
}
|
|
221
|
+
if (!isUndefined(settings.android.minimumVersion) && !isString(settings.android.minimumVersion)) {
|
|
222
|
+
throw new Error("firebase.auth.User.verifyBeforeUpdateEmail(_, *) 'actionCodeSettings.android.minimumVersion' expected a string value.");
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return this._auth.native.verifyBeforeUpdateEmail(newEmail, actionCodeSettings).then(user => {
|
|
227
|
+
this._auth._setUser(user);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* KNOWN UNSUPPORTED METHODS
|
|
233
|
+
*/
|
|
234
|
+
|
|
235
|
+
linkWithPhoneNumber() {
|
|
236
|
+
throw new Error('firebase.auth.User.linkWithPhoneNumber() is unsupported by the native Firebase SDKs.');
|
|
237
|
+
}
|
|
238
|
+
reauthenticateWithPhoneNumber() {
|
|
239
|
+
throw new Error('firebase.auth.User.reauthenticateWithPhoneNumber() is unsupported by the native Firebase SDKs.');
|
|
240
|
+
}
|
|
241
|
+
get refreshToken() {
|
|
242
|
+
throw new Error('firebase.auth.User.refreshToken is unsupported by the native Firebase SDKs.');
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=User.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isObject","isString","isUndefined","isBoolean","User","constructor","auth","user","_auth","_user","displayName","email","emailVerified","isAnonymous","metadata","lastSignInTime","Date","toISOString","creationTime","multiFactor","phoneNumber","tenantId","photoURL","providerData","map","provider","providerId","uid","delete","native","then","_setUser","getIdToken","forceRefresh","getIdTokenResult","linkWithCredential","credential","token","secret","userCredential","_setUserCredential","linkWithPopup","linkWithRedirect","linkWithProvider","toObject","reauthenticateWithCredential","reauthenticateWithPopup","reauthenticateWithProvider","reauthenticateWithRedirect","reload","sendEmailVerification","actionCodeSettings","settings","url","Error","linkDomain","handleCodeInApp","iOS","bundleId","android","packageName","installApp","minimumVersion","toJSON","Object","assign","unlink","updatedUser","updateEmail","updatePassword","password","updatePhoneNumber","updateProfile","updates","verifyBeforeUpdateEmail","newEmail","linkWithPhoneNumber","reauthenticateWithPhoneNumber","refreshToken"],"sourceRoot":"../../lib","sources":["User.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,QAAQ,EACRC,QAAQ,EACRC,WAAW,EACXC,SAAS,QACJ,+CAA+C;AAStD,eAAe,MAAMC,IAAI,CAAC;EACxB;;EAEA;;EAGAC,WAAWA,CAACC,IAAkB,EAAEC,IAAwB,EAAE;IACxD,IAAI,CAACC,KAAK,GAAGF,IAAI;IACjB,IAAI,CAACG,KAAK,GAAGF,IAAI;EACnB;EAEA,IAAIG,WAAWA,CAAA,EAAkB;IAC/B,OAAO,IAAI,CAACD,KAAK,CAACC,WAAW,IAAI,IAAI;EACvC;EAEA,IAAIC,KAAKA,CAAA,EAAkB;IACzB,OAAO,IAAI,CAACF,KAAK,CAACE,KAAK,IAAI,IAAI;EACjC;EAEA,IAAIC,aAAaA,CAAA,EAAY;IAC3B,OAAO,IAAI,CAACH,KAAK,CAACG,aAAa,IAAI,KAAK;EAC1C;EAEA,IAAIC,WAAWA,CAAA,EAAY;IACzB,OAAO,IAAI,CAACJ,KAAK,CAACI,W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IvB,KAAK,CACb,gGACF,CAAC;EACH;EAEA,IAAIwB,YAAYA,CAAA,EAAU;IACxB,MAAM,IAAIxB,KAAK,CAAC,6EAA6E,CAAC;EAChG;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
|
|
20
|
+
export const ActionCodeOperation = {
|
|
21
|
+
EMAIL_SIGNIN: 'EMAIL_SIGNIN',
|
|
22
|
+
PASSWORD_RESET: 'PASSWORD_RESET',
|
|
23
|
+
RECOVER_EMAIL: 'RECOVER_EMAIL',
|
|
24
|
+
REVERT_SECOND_FACTOR_ADDITION: 'REVERT_SECOND_FACTOR_ADDITION',
|
|
25
|
+
VERIFY_AND_CHANGE_EMAIL: 'VERIFY_AND_CHANGE_EMAIL',
|
|
26
|
+
VERIFY_EMAIL: 'VERIFY_EMAIL'
|
|
27
|
+
};
|
|
28
|
+
export const FactorId = {
|
|
29
|
+
PHONE: 'phone',
|
|
30
|
+
TOTP: 'totp'
|
|
31
|
+
};
|
|
32
|
+
export const OperationType = {
|
|
33
|
+
LINK: 'link',
|
|
34
|
+
REAUTHENTICATE: 'reauthenticate',
|
|
35
|
+
SIGN_IN: 'signIn'
|
|
36
|
+
};
|
|
37
|
+
export const ProviderId = {
|
|
38
|
+
FACEBOOK: 'facebook.com',
|
|
39
|
+
GITHUB: 'github.com',
|
|
40
|
+
GOOGLE: 'google.com',
|
|
41
|
+
PASSWORD: 'password',
|
|
42
|
+
PHONE: 'phone',
|
|
43
|
+
TWITTER: 'twitter.com'
|
|
44
|
+
};
|
|
45
|
+
export const SignInMethod = {
|
|
46
|
+
EMAIL_LINK: 'emailLink',
|
|
47
|
+
EMAIL_PASSWORD: 'password',
|
|
48
|
+
FACEBOOK: 'facebook.com',
|
|
49
|
+
GITHUB: 'github.com',
|
|
50
|
+
GOOGLE: 'google.com',
|
|
51
|
+
PHONE: 'phone',
|
|
52
|
+
TWITTER: 'twitter.com'
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ActionCodeOperation","EMAIL_SIGNIN","PASSWORD_RESET","RECOVER_EMAIL","REVERT_SECOND_FACTOR_ADDITION","VERIFY_AND_CHANGE_EMAIL","VERIFY_EMAIL","FactorId","PHONE","TOTP","OperationType","LINK","REAUTHENTICATE","SIGN_IN","ProviderId","FACEBOOK","GITHUB","GOOGLE","PASSWORD","TWITTER","SignInMethod","EMAIL_LINK","EMAIL_PASSWORD"],"sourceRoot":"../../lib","sources":["constants.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,mBAAmB,GAAG;EACjCC,YAAY,EAAE,cAAc;EAC5BC,cAAc,EAAE,gBAAgB;EAChCC,aAAa,EAAE,eAAe;EAC9BC,6BAA6B,EAAE,+BAA+B;EAC9DC,uBAAuB,EAAE,yBAAyB;EAClDC,YAAY,EAAE;AAChB,CAAU;AAEV,OAAO,MAAMC,QAAQ,GAAG;EACtBC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE;AACR,CAAU;AAEV,OAAO,MAAMC,aAAa,GAAG;EAC3BC,IAAI,EAAE,MAAM;EACZC,cAAc,EAAE,gBAAgB;EAChCC,OAAO,EAAE;AACX,CAAU;AAEV,OAAO,MAAMC,UAAU,GAAG;EACxBC,QAAQ,EAAE,cAAc;EACxBC,MAAM,EAAE,YAAY;EACpBC,MAAM,EAAE,YAAY;EACpBC,QAAQ,EAAE,UAAU;EACpBV,KAAK,EAAE,OAAO;EACdW,OAAO,EAAE;AACX,CAAU;AAEV,OAAO,MAAMC,YAAY,GAAG;EAC1BC,UAAU,EAAE,WAAW;EACvBC,cAAc,EAAE,UAAU;EAC1BP,QAAQ,EAAE,cAAc;EACxBC,MAAM,EAAE,YAAY;EACpBC,MAAM,EAAE,YAAY;EACpBT,KAAK,EAAE,OAAO;EACdW,OAAO,EAAE;AACX,CAAU","ignoreList":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
|
|
20
|
+
export function parseCredentialJSON(json) {
|
|
21
|
+
if (typeof json === 'string') {
|
|
22
|
+
try {
|
|
23
|
+
return JSON.parse(json);
|
|
24
|
+
} catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (json === null || Array.isArray(json)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return json;
|
|
32
|
+
}
|
|
33
|
+
export class AuthCredential {
|
|
34
|
+
/** @internal RNFB native bridge token slot. */
|
|
35
|
+
|
|
36
|
+
/** @internal RNFB native bridge secret slot. */
|
|
37
|
+
|
|
38
|
+
constructor(providerId, signInMethod, token, secret) {
|
|
39
|
+
this.providerId = providerId;
|
|
40
|
+
this.signInMethod = signInMethod;
|
|
41
|
+
this.token = token;
|
|
42
|
+
this.secret = secret;
|
|
43
|
+
}
|
|
44
|
+
toJSON() {
|
|
45
|
+
return {
|
|
46
|
+
providerId: this.providerId,
|
|
47
|
+
signInMethod: this.signInMethod
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=AuthCredential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["parseCredentialJSON","json","JSON","parse","Array","isArray","AuthCredential","constructor","providerId","signInMethod","token","secret","toJSON"],"sourceRoot":"../../../lib","sources":["credentials/AuthCredential.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAASA,mBAAmBA,CAACC,IAAqB,EAAiB;EACxE,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC5B,IAAI;MACF,OAAOC,IAAI,CAACC,KAAK,CAACF,IAAI,CAAC;IACzB,CAAC,CAAC,MAAM;MACN,OAAO,IAAI;IACb;EACF;EAEA,IAAIA,IAAI,KAAK,IAAI,IAAIG,KAAK,CAACC,OAAO,CAACJ,IAAI,CAAC,EAAE;IACxC,OAAO,IAAI;EACb;EAEA,OAAOA,IAAI;AACb;AAEA,OAAO,MAAMK,cAAc,CAAC;EAG1B;;EAEA;;EAGAC,WAAWA,CAACC,UAAkB,EAAEC,YAAoB,EAAEC,KAAa,EAAEC,MAAc,EAAE;IACnF,IAAI,CAACH,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,YAAY,GAAGA,YAAY;IAChC,IAAI,CAACC,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,MAAM,GAAGA,MAAM;EACtB;EAEAC,MAAMA,CAAA,EAAW;IACf,OAAO;MACLJ,UAAU,EAAE,IAAI,CAACA,UAAU;MAC3BC,YAAY,EAAE,IAAI,CAACA;IACrB,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
|
|
20
|
+
import { AuthCredential, parseCredentialJSON } from "./AuthCredential.js";
|
|
21
|
+
export class EmailAuthCredential extends AuthCredential {
|
|
22
|
+
constructor(signInMethod, email, password) {
|
|
23
|
+
super(signInMethod, signInMethod, email, password);
|
|
24
|
+
}
|
|
25
|
+
toJSON() {
|
|
26
|
+
return {
|
|
27
|
+
email: this.token,
|
|
28
|
+
password: this.secret,
|
|
29
|
+
signInMethod: this.signInMethod,
|
|
30
|
+
tenantId: null
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
static fromJSON(json) {
|
|
34
|
+
const parsed = parseCredentialJSON(json);
|
|
35
|
+
if (!parsed) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const signInMethod = parsed.signInMethod;
|
|
39
|
+
if (signInMethod !== 'password' && signInMethod !== 'emailLink') {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
if (typeof parsed.email !== 'string' || typeof parsed.password !== 'string') {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return new EmailAuthCredential(signInMethod, parsed.email, parsed.password);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export function createEmailAuthCredential(email, password, signInMethod) {
|
|
49
|
+
return new EmailAuthCredential(signInMethod, email, password);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=EmailAuthCredential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AuthCredential","parseCredentialJSON","EmailAuthCredential","constructor","signInMethod","email","password","toJSON","token","secret","tenantId","fromJSON","json","parsed","createEmailAuthCredential"],"sourceRoot":"../../../lib","sources":["credentials/EmailAuthCredential.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,EAAEC,mBAAmB,QAAQ,qBAAkB;AAStE,OAAO,MAAMC,mBAAmB,SAASF,cAAc,CAAC;EACtDG,WAAWA,CACTC,YAAsC,EACtCC,KAAa,EACbC,QAAgB,EAChB;IACA,KAAK,CAACF,YAAY,EAAEA,YAAY,EAAEC,KAAK,EAAEC,QAAQ,CAAC;EACpD;EAEAC,MAAMA,CAAA,EAAW;IACf,OAAO;MACLF,KAAK,EAAE,IAAI,CAACG,KAAK;MACjBF,QAAQ,EAAE,IAAI,CAACG,MAAM;MACrBL,YAAY,EAAE,IAAI,CAACA,YAAY;MAC/BM,QAAQ,EAAE;IACZ,CAAC;EACH;EAEA,OAAOC,QAAQA,CAACC,IAAqB,EAA8B;IACjE,MAAMC,MAAM,GAAGZ,mBAAmB,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