@firebase/auth 0.21.5-canary.ce79f7fe2 → 0.21.5-canary.f8a2c5865
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/README.md +25 -0
- package/dist/auth-public.d.ts +137 -4
- package/dist/auth.d.ts +149 -4
- package/dist/browser-cjs/{index-da3cf52f.js → index-aeaeb040.js} +176 -4
- package/dist/browser-cjs/index-aeaeb040.js.map +1 -0
- package/dist/browser-cjs/index.d.ts +2 -1
- package/dist/browser-cjs/index.js +3 -1
- package/dist/browser-cjs/index.js.map +1 -1
- package/dist/browser-cjs/internal.js +3 -1
- package/dist/browser-cjs/internal.js.map +1 -1
- package/dist/browser-cjs/src/api/account_management/mfa.d.ts +38 -4
- package/dist/browser-cjs/src/api/authentication/mfa.d.ts +11 -0
- package/dist/browser-cjs/src/core/errors.d.ts +1 -0
- package/dist/browser-cjs/src/core/index.d.ts +1 -0
- package/dist/browser-cjs/src/mfa/assertions/totp.d.ts +124 -0
- package/dist/browser-cjs/src/mfa/assertions/totp.test.d.ts +17 -0
- package/dist/browser-cjs/src/mfa/mfa_info.d.ts +5 -1
- package/dist/browser-cjs/src/model/enum_maps.d.ts +1 -0
- package/dist/browser-cjs/src/model/public_types.d.ts +18 -1
- package/dist/browser-cjs/test/helpers/integration/helpers.d.ts +3 -0
- package/dist/browser-cjs/test/integration/flows/totp.test.d.ts +17 -0
- package/dist/cordova/index.d.ts +2 -1
- package/dist/cordova/index.js +2 -2
- package/dist/cordova/internal.js +179 -3
- package/dist/cordova/internal.js.map +1 -1
- package/dist/cordova/{popup_redirect-5b6894c2.js → popup_redirect-5d90c99d.js} +27 -5
- package/dist/cordova/popup_redirect-5d90c99d.js.map +1 -0
- package/dist/cordova/src/api/account_management/mfa.d.ts +38 -4
- package/dist/cordova/src/api/authentication/mfa.d.ts +11 -0
- package/dist/cordova/src/core/errors.d.ts +1 -0
- package/dist/cordova/src/core/index.d.ts +1 -0
- package/dist/cordova/src/mfa/assertions/totp.d.ts +124 -0
- package/dist/cordova/src/mfa/assertions/totp.test.d.ts +17 -0
- package/dist/cordova/src/mfa/mfa_info.d.ts +5 -1
- package/dist/cordova/src/model/enum_maps.d.ts +1 -0
- package/dist/cordova/src/model/public_types.d.ts +18 -1
- package/dist/cordova/test/helpers/integration/helpers.d.ts +3 -0
- package/dist/cordova/test/integration/flows/totp.test.d.ts +17 -0
- package/dist/esm2017/{index-c0585610.js → index-9467e58b.js} +175 -5
- package/dist/esm2017/index-9467e58b.js.map +1 -0
- package/dist/esm2017/index.d.ts +2 -1
- package/dist/esm2017/index.js +1 -1
- package/dist/esm2017/internal.js +2 -2
- package/dist/esm2017/src/api/account_management/mfa.d.ts +38 -4
- package/dist/esm2017/src/api/authentication/mfa.d.ts +11 -0
- package/dist/esm2017/src/core/errors.d.ts +1 -0
- package/dist/esm2017/src/core/index.d.ts +1 -0
- package/dist/esm2017/src/mfa/assertions/totp.d.ts +124 -0
- package/dist/esm2017/src/mfa/assertions/totp.test.d.ts +17 -0
- package/dist/esm2017/src/mfa/mfa_info.d.ts +5 -1
- package/dist/esm2017/src/model/enum_maps.d.ts +1 -0
- package/dist/esm2017/src/model/public_types.d.ts +18 -1
- package/dist/esm2017/test/helpers/integration/helpers.d.ts +3 -0
- package/dist/esm2017/test/integration/flows/totp.test.d.ts +17 -0
- package/dist/esm5/{index-281afa15.js → index-de7cac5b.js} +203 -5
- package/dist/esm5/index-de7cac5b.js.map +1 -0
- package/dist/esm5/index.d.ts +2 -1
- package/dist/esm5/index.js +1 -1
- package/dist/esm5/internal.js +2 -2
- package/dist/esm5/src/api/account_management/mfa.d.ts +38 -4
- package/dist/esm5/src/api/authentication/mfa.d.ts +11 -0
- package/dist/esm5/src/core/errors.d.ts +1 -0
- package/dist/esm5/src/core/index.d.ts +1 -0
- package/dist/esm5/src/mfa/assertions/totp.d.ts +124 -0
- package/dist/esm5/src/mfa/assertions/totp.test.d.ts +17 -0
- package/dist/esm5/src/mfa/mfa_info.d.ts +5 -1
- package/dist/esm5/src/model/enum_maps.d.ts +1 -0
- package/dist/esm5/src/model/public_types.d.ts +18 -1
- package/dist/esm5/test/helpers/integration/helpers.d.ts +3 -0
- package/dist/esm5/test/integration/flows/totp.test.d.ts +17 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.webworker.esm5.js +19 -3
- package/dist/index.webworker.esm5.js.map +1 -1
- package/dist/node/index.d.ts +2 -1
- package/dist/node/index.js +83 -81
- package/dist/node/index.js.map +1 -1
- package/dist/node/internal.js +144 -142
- package/dist/node/internal.js.map +1 -1
- package/dist/node/src/api/account_management/mfa.d.ts +38 -4
- package/dist/node/src/api/authentication/mfa.d.ts +11 -0
- package/dist/node/src/core/errors.d.ts +1 -0
- package/dist/node/src/core/index.d.ts +1 -0
- package/dist/node/src/mfa/assertions/totp.d.ts +124 -0
- package/dist/node/src/mfa/assertions/totp.test.d.ts +17 -0
- package/dist/node/src/mfa/mfa_info.d.ts +5 -1
- package/dist/node/src/model/enum_maps.d.ts +1 -0
- package/dist/node/src/model/public_types.d.ts +18 -1
- package/dist/node/test/helpers/integration/helpers.d.ts +3 -0
- package/dist/node/test/integration/flows/totp.test.d.ts +17 -0
- package/dist/node/{index-37042dd3.js → totp-bee43d8c.js} +239 -5
- package/dist/node/totp-bee43d8c.js.map +1 -0
- package/dist/node-esm/index.d.ts +2 -1
- package/dist/node-esm/index.js +2 -2
- package/dist/node-esm/internal.js +3 -3
- package/dist/node-esm/src/api/account_management/mfa.d.ts +38 -4
- package/dist/node-esm/src/api/authentication/mfa.d.ts +11 -0
- package/dist/node-esm/src/core/errors.d.ts +1 -0
- package/dist/node-esm/src/core/index.d.ts +1 -0
- package/dist/node-esm/src/mfa/assertions/totp.d.ts +124 -0
- package/dist/node-esm/src/mfa/assertions/totp.test.d.ts +17 -0
- package/dist/node-esm/src/mfa/mfa_info.d.ts +5 -1
- package/dist/node-esm/src/model/enum_maps.d.ts +1 -0
- package/dist/node-esm/src/model/public_types.d.ts +18 -1
- package/dist/node-esm/test/helpers/integration/helpers.d.ts +3 -0
- package/dist/node-esm/test/integration/flows/totp.test.d.ts +17 -0
- package/dist/node-esm/{index-1cab2ca1.js → totp-9075bbc1.js} +209 -6
- package/dist/node-esm/totp-9075bbc1.js.map +1 -0
- package/dist/rn/index.d.ts +2 -1
- package/dist/rn/index.js +1 -1
- package/dist/rn/internal.js +176 -1
- package/dist/rn/internal.js.map +1 -1
- package/dist/rn/{phone-2c66b31d.js → phone-4275321a.js} +33 -4
- package/dist/rn/phone-4275321a.js.map +1 -0
- package/dist/rn/src/api/account_management/mfa.d.ts +38 -4
- package/dist/rn/src/api/authentication/mfa.d.ts +11 -0
- package/dist/rn/src/core/errors.d.ts +1 -0
- package/dist/rn/src/core/index.d.ts +1 -0
- package/dist/rn/src/mfa/assertions/totp.d.ts +124 -0
- package/dist/rn/src/mfa/assertions/totp.test.d.ts +17 -0
- package/dist/rn/src/mfa/mfa_info.d.ts +5 -1
- package/dist/rn/src/model/enum_maps.d.ts +1 -0
- package/dist/rn/src/model/public_types.d.ts +18 -1
- package/dist/rn/test/helpers/integration/helpers.d.ts +3 -0
- package/dist/rn/test/integration/flows/totp.test.d.ts +17 -0
- package/dist/src/api/account_management/mfa.d.ts +38 -4
- package/dist/src/api/authentication/mfa.d.ts +11 -0
- package/dist/src/core/errors.d.ts +1 -0
- package/dist/src/core/index.d.ts +1 -0
- package/dist/src/mfa/assertions/totp.d.ts +124 -0
- package/dist/src/mfa/assertions/totp.test.d.ts +17 -0
- package/dist/src/mfa/mfa_info.d.ts +5 -1
- package/dist/src/model/enum_maps.d.ts +1 -0
- package/dist/src/model/public_types.d.ts +18 -1
- package/dist/test/helpers/integration/helpers.d.ts +3 -0
- package/dist/test/integration/flows/totp.test.d.ts +17 -0
- package/package.json +10 -8
- package/dist/browser-cjs/index-da3cf52f.js.map +0 -1
- package/dist/cordova/popup_redirect-5b6894c2.js.map +0 -1
- package/dist/esm2017/index-c0585610.js.map +0 -1
- package/dist/esm5/index-281afa15.js.map +0 -1
- package/dist/node/index-37042dd3.js.map +0 -1
- package/dist/node-esm/index-1cab2ca1.js.map +0 -1
- package/dist/rn/phone-2c66b31d.js.map +0 -1
|
@@ -27,7 +27,8 @@ import { Component } from '@firebase/component';
|
|
|
27
27
|
*/
|
|
28
28
|
var FactorId = {
|
|
29
29
|
/** Phone as second factor */
|
|
30
|
-
PHONE: 'phone'
|
|
30
|
+
PHONE: 'phone',
|
|
31
|
+
TOTP: 'totp'
|
|
31
32
|
};
|
|
32
33
|
/**
|
|
33
34
|
* Enumeration of supported providers.
|
|
@@ -212,6 +213,7 @@ function _debugErrorMap() {
|
|
|
212
213
|
_a["missing-or-invalid-nonce" /* AuthErrorCode.MISSING_OR_INVALID_NONCE */] = 'The request does not contain a valid nonce. This can occur if the ' +
|
|
213
214
|
'SHA-256 hash of the provided raw nonce does not match the hashed nonce ' +
|
|
214
215
|
'in the ID token payload.',
|
|
216
|
+
_a["missing-password" /* AuthErrorCode.MISSING_PASSWORD */] = 'A non-empty password must be provided',
|
|
215
217
|
_a["missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */] = 'No second factor identifier is provided.',
|
|
216
218
|
_a["missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */] = 'The request is missing proof of first factor successful sign-in.',
|
|
217
219
|
_a["missing-phone-number" /* AuthErrorCode.MISSING_PHONE_NUMBER */] = 'To send verification codes, provide a phone number for the recipient.',
|
|
@@ -866,7 +868,7 @@ var SERVER_ERROR_MAP = (_a$1 = {},
|
|
|
866
868
|
// Sign in with email and password errors (some apply to sign up too).
|
|
867
869
|
_a$1["INVALID_PASSWORD" /* ServerError.INVALID_PASSWORD */] = "wrong-password" /* AuthErrorCode.INVALID_PASSWORD */,
|
|
868
870
|
// This can only happen if the SDK sends a bad request.
|
|
869
|
-
_a$1["MISSING_PASSWORD" /* ServerError.MISSING_PASSWORD */] = "
|
|
871
|
+
_a$1["MISSING_PASSWORD" /* ServerError.MISSING_PASSWORD */] = "missing-password" /* AuthErrorCode.MISSING_PASSWORD */,
|
|
870
872
|
// Sign up with email and password errors.
|
|
871
873
|
_a$1["EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */] = "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */,
|
|
872
874
|
_a$1["PASSWORD_LOGIN_DISABLED" /* ServerError.PASSWORD_LOGIN_DISABLED */] = "operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */,
|
|
@@ -5701,6 +5703,9 @@ var MultiFactorInfoImpl = /** @class */ (function () {
|
|
|
5701
5703
|
if ('phoneInfo' in enrollment) {
|
|
5702
5704
|
return PhoneMultiFactorInfoImpl._fromServerResponse(auth, enrollment);
|
|
5703
5705
|
}
|
|
5706
|
+
else if ('totpInfo' in enrollment) {
|
|
5707
|
+
return TotpMultiFactorInfoImpl._fromServerResponse(auth, enrollment);
|
|
5708
|
+
}
|
|
5704
5709
|
return _fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5705
5710
|
};
|
|
5706
5711
|
return MultiFactorInfoImpl;
|
|
@@ -5716,6 +5721,16 @@ var PhoneMultiFactorInfoImpl = /** @class */ (function (_super) {
|
|
|
5716
5721
|
return new PhoneMultiFactorInfoImpl(enrollment);
|
|
5717
5722
|
};
|
|
5718
5723
|
return PhoneMultiFactorInfoImpl;
|
|
5724
|
+
}(MultiFactorInfoImpl));
|
|
5725
|
+
var TotpMultiFactorInfoImpl = /** @class */ (function (_super) {
|
|
5726
|
+
__extends(TotpMultiFactorInfoImpl, _super);
|
|
5727
|
+
function TotpMultiFactorInfoImpl(response) {
|
|
5728
|
+
return _super.call(this, "totp" /* FactorId.TOTP */, response) || this;
|
|
5729
|
+
}
|
|
5730
|
+
TotpMultiFactorInfoImpl._fromServerResponse = function (_auth, enrollment) {
|
|
5731
|
+
return new TotpMultiFactorInfoImpl(enrollment);
|
|
5732
|
+
};
|
|
5733
|
+
return TotpMultiFactorInfoImpl;
|
|
5719
5734
|
}(MultiFactorInfoImpl));
|
|
5720
5735
|
|
|
5721
5736
|
/**
|
|
@@ -6682,6 +6697,7 @@ function setPersistence(auth, persistence) {
|
|
|
6682
6697
|
*
|
|
6683
6698
|
* @remarks
|
|
6684
6699
|
* This includes sign-in, sign-out, and token refresh events.
|
|
6700
|
+
* This will not be triggered automatically upon ID token expiration. Use {@link User.getIdToken} to refresh the ID token.
|
|
6685
6701
|
*
|
|
6686
6702
|
* @param auth - The {@link Auth} instance.
|
|
6687
6703
|
* @param nextOrObserver - callback triggered on change.
|
|
@@ -6944,6 +6960,12 @@ function startEnrollPhoneMfa(auth, request) {
|
|
|
6944
6960
|
function finalizeEnrollPhoneMfa(auth, request) {
|
|
6945
6961
|
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:finalize" /* Endpoint.FINALIZE_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
6946
6962
|
}
|
|
6963
|
+
function startEnrollTotpMfa(auth, request) {
|
|
6964
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:start" /* Endpoint.START_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
6965
|
+
}
|
|
6966
|
+
function finalizeEnrollTotpMfa(auth, request) {
|
|
6967
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:finalize" /* Endpoint.FINALIZE_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
6968
|
+
}
|
|
6947
6969
|
function withdrawMfa(auth, request) {
|
|
6948
6970
|
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:withdraw" /* Endpoint.WITHDRAW_MFA */, _addTidIfNecessary(auth, request));
|
|
6949
6971
|
}
|
|
@@ -8351,6 +8373,9 @@ function startSignInPhoneMfa(auth, request) {
|
|
|
8351
8373
|
}
|
|
8352
8374
|
function finalizeSignInPhoneMfa(auth, request) {
|
|
8353
8375
|
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaSignIn:finalize" /* Endpoint.FINALIZE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
|
|
8376
|
+
}
|
|
8377
|
+
function finalizeSignInTotpMfa(auth, request) {
|
|
8378
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaSignIn:finalize" /* Endpoint.FINALIZE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
|
|
8354
8379
|
}
|
|
8355
8380
|
|
|
8356
8381
|
/**
|
|
@@ -11104,8 +11129,181 @@ var PhoneMultiFactorGenerator = /** @class */ (function () {
|
|
|
11104
11129
|
return PhoneMultiFactorGenerator;
|
|
11105
11130
|
}());
|
|
11106
11131
|
|
|
11132
|
+
/**
|
|
11133
|
+
* Provider for generating a {@link TotpMultiFactorAssertion}.
|
|
11134
|
+
*
|
|
11135
|
+
* @public
|
|
11136
|
+
*/
|
|
11137
|
+
var TotpMultiFactorGenerator = /** @class */ (function () {
|
|
11138
|
+
function TotpMultiFactorGenerator() {
|
|
11139
|
+
}
|
|
11140
|
+
/**
|
|
11141
|
+
* Provides a {@link TotpMultiFactorAssertion} to confirm ownership of
|
|
11142
|
+
* the TOTP (time-based one-time password) second factor.
|
|
11143
|
+
* This assertion is used to complete enrollment in TOTP second factor.
|
|
11144
|
+
*
|
|
11145
|
+
* @param secret A {@link TotpSecret} containing the shared secret key and other TOTP parameters.
|
|
11146
|
+
* @param oneTimePassword One-time password from TOTP App.
|
|
11147
|
+
* @returns A {@link TotpMultiFactorAssertion} which can be used with
|
|
11148
|
+
* {@link MultiFactorUser.enroll}.
|
|
11149
|
+
*/
|
|
11150
|
+
TotpMultiFactorGenerator.assertionForEnrollment = function (secret, oneTimePassword) {
|
|
11151
|
+
return TotpMultiFactorAssertionImpl._fromSecret(secret, oneTimePassword);
|
|
11152
|
+
};
|
|
11153
|
+
/**
|
|
11154
|
+
* Provides a {@link TotpMultiFactorAssertion} to confirm ownership of the TOTP second factor.
|
|
11155
|
+
* This assertion is used to complete signIn with TOTP as the second factor.
|
|
11156
|
+
*
|
|
11157
|
+
* @param enrollmentId identifies the enrolled TOTP second factor.
|
|
11158
|
+
* @param oneTimePassword One-time password from TOTP App.
|
|
11159
|
+
* @returns A {@link TotpMultiFactorAssertion} which can be used with
|
|
11160
|
+
* {@link MultiFactorResolver.resolveSignIn}.
|
|
11161
|
+
*/
|
|
11162
|
+
TotpMultiFactorGenerator.assertionForSignIn = function (enrollmentId, oneTimePassword) {
|
|
11163
|
+
return TotpMultiFactorAssertionImpl._fromEnrollmentId(enrollmentId, oneTimePassword);
|
|
11164
|
+
};
|
|
11165
|
+
/**
|
|
11166
|
+
* Returns a promise to {@link TotpSecret} which contains the TOTP shared secret key and other parameters.
|
|
11167
|
+
* Creates a TOTP secret as part of enrolling a TOTP second factor.
|
|
11168
|
+
* Used for generating a QR code URL or inputting into a TOTP app.
|
|
11169
|
+
* This method uses the auth instance corresponding to the user in the multiFactorSession.
|
|
11170
|
+
*
|
|
11171
|
+
* @param session The {@link MultiFactorSession} that the user is part of.
|
|
11172
|
+
* @returns A promise to {@link TotpSecret}.
|
|
11173
|
+
*/
|
|
11174
|
+
TotpMultiFactorGenerator.generateSecret = function (session) {
|
|
11175
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11176
|
+
var mfaSession, response;
|
|
11177
|
+
return __generator(this, function (_a) {
|
|
11178
|
+
switch (_a.label) {
|
|
11179
|
+
case 0:
|
|
11180
|
+
mfaSession = session;
|
|
11181
|
+
_assert(typeof mfaSession.auth !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
11182
|
+
return [4 /*yield*/, startEnrollTotpMfa(mfaSession.auth, {
|
|
11183
|
+
idToken: mfaSession.credential,
|
|
11184
|
+
totpEnrollmentInfo: {}
|
|
11185
|
+
})];
|
|
11186
|
+
case 1:
|
|
11187
|
+
response = _a.sent();
|
|
11188
|
+
return [2 /*return*/, TotpSecret._fromStartTotpMfaEnrollmentResponse(response, mfaSession.auth)];
|
|
11189
|
+
}
|
|
11190
|
+
});
|
|
11191
|
+
});
|
|
11192
|
+
};
|
|
11193
|
+
/**
|
|
11194
|
+
* The identifier of the TOTP second factor: `totp`.
|
|
11195
|
+
*/
|
|
11196
|
+
TotpMultiFactorGenerator.FACTOR_ID = "totp" /* FactorId.TOTP */;
|
|
11197
|
+
return TotpMultiFactorGenerator;
|
|
11198
|
+
}());
|
|
11199
|
+
var TotpMultiFactorAssertionImpl = /** @class */ (function (_super) {
|
|
11200
|
+
__extends(TotpMultiFactorAssertionImpl, _super);
|
|
11201
|
+
function TotpMultiFactorAssertionImpl(otp, enrollmentId, secret) {
|
|
11202
|
+
var _this = _super.call(this, "totp" /* FactorId.TOTP */) || this;
|
|
11203
|
+
_this.otp = otp;
|
|
11204
|
+
_this.enrollmentId = enrollmentId;
|
|
11205
|
+
_this.secret = secret;
|
|
11206
|
+
return _this;
|
|
11207
|
+
}
|
|
11208
|
+
/** @internal */
|
|
11209
|
+
TotpMultiFactorAssertionImpl._fromSecret = function (secret, otp) {
|
|
11210
|
+
return new TotpMultiFactorAssertionImpl(otp, undefined, secret);
|
|
11211
|
+
};
|
|
11212
|
+
/** @internal */
|
|
11213
|
+
TotpMultiFactorAssertionImpl._fromEnrollmentId = function (enrollmentId, otp) {
|
|
11214
|
+
return new TotpMultiFactorAssertionImpl(otp, enrollmentId);
|
|
11215
|
+
};
|
|
11216
|
+
/** @internal */
|
|
11217
|
+
TotpMultiFactorAssertionImpl.prototype._finalizeEnroll = function (auth, idToken, displayName) {
|
|
11218
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11219
|
+
return __generator(this, function (_a) {
|
|
11220
|
+
_assert(typeof this.secret !== 'undefined', auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
11221
|
+
return [2 /*return*/, finalizeEnrollTotpMfa(auth, {
|
|
11222
|
+
idToken: idToken,
|
|
11223
|
+
displayName: displayName,
|
|
11224
|
+
totpVerificationInfo: this.secret._makeTotpVerificationInfo(this.otp)
|
|
11225
|
+
})];
|
|
11226
|
+
});
|
|
11227
|
+
});
|
|
11228
|
+
};
|
|
11229
|
+
/** @internal */
|
|
11230
|
+
TotpMultiFactorAssertionImpl.prototype._finalizeSignIn = function (auth, mfaPendingCredential) {
|
|
11231
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11232
|
+
var totpVerificationInfo;
|
|
11233
|
+
return __generator(this, function (_a) {
|
|
11234
|
+
_assert(this.enrollmentId !== undefined && this.otp !== undefined, auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
11235
|
+
totpVerificationInfo = { verificationCode: this.otp };
|
|
11236
|
+
return [2 /*return*/, finalizeSignInTotpMfa(auth, {
|
|
11237
|
+
mfaPendingCredential: mfaPendingCredential,
|
|
11238
|
+
mfaEnrollmentId: this.enrollmentId,
|
|
11239
|
+
totpVerificationInfo: totpVerificationInfo
|
|
11240
|
+
})];
|
|
11241
|
+
});
|
|
11242
|
+
});
|
|
11243
|
+
};
|
|
11244
|
+
return TotpMultiFactorAssertionImpl;
|
|
11245
|
+
}(MultiFactorAssertionImpl));
|
|
11246
|
+
/**
|
|
11247
|
+
* Provider for generating a {@link TotpMultiFactorAssertion}.
|
|
11248
|
+
*
|
|
11249
|
+
* Stores the shared secret key and other parameters to generate time-based OTPs.
|
|
11250
|
+
* Implements methods to retrieve the shared secret key and generate a QR code URL.
|
|
11251
|
+
* @public
|
|
11252
|
+
*/
|
|
11253
|
+
var TotpSecret = /** @class */ (function () {
|
|
11254
|
+
// The public members are declared outside the constructor so the docs can be generated.
|
|
11255
|
+
function TotpSecret(secretKey, hashingAlgorithm, codeLength, codeIntervalSeconds, enrollmentCompletionDeadline, sessionInfo, auth) {
|
|
11256
|
+
this.sessionInfo = sessionInfo;
|
|
11257
|
+
this.auth = auth;
|
|
11258
|
+
this.secretKey = secretKey;
|
|
11259
|
+
this.hashingAlgorithm = hashingAlgorithm;
|
|
11260
|
+
this.codeLength = codeLength;
|
|
11261
|
+
this.codeIntervalSeconds = codeIntervalSeconds;
|
|
11262
|
+
this.enrollmentCompletionDeadline = enrollmentCompletionDeadline;
|
|
11263
|
+
}
|
|
11264
|
+
/** @internal */
|
|
11265
|
+
TotpSecret._fromStartTotpMfaEnrollmentResponse = function (response, auth) {
|
|
11266
|
+
return new TotpSecret(response.totpSessionInfo.sharedSecretKey, response.totpSessionInfo.hashingAlgorithm, response.totpSessionInfo.verificationCodeLength, response.totpSessionInfo.periodSec, new Date(response.totpSessionInfo.finalizeEnrollmentTime).toUTCString(), response.totpSessionInfo.sessionInfo, auth);
|
|
11267
|
+
};
|
|
11268
|
+
/** @internal */
|
|
11269
|
+
TotpSecret.prototype._makeTotpVerificationInfo = function (otp) {
|
|
11270
|
+
return { sessionInfo: this.sessionInfo, verificationCode: otp };
|
|
11271
|
+
};
|
|
11272
|
+
/**
|
|
11273
|
+
* Returns a QR code URL as described in
|
|
11274
|
+
* https://github.com/google/google-authenticator/wiki/Key-Uri-Format
|
|
11275
|
+
* This can be displayed to the user as a QR code to be scanned into a TOTP app like Google Authenticator.
|
|
11276
|
+
* If the optional parameters are unspecified, an accountName of <userEmail> and issuer of <firebaseAppName> are used.
|
|
11277
|
+
*
|
|
11278
|
+
* @param accountName the name of the account/app along with a user identifier.
|
|
11279
|
+
* @param issuer issuer of the TOTP (likely the app name).
|
|
11280
|
+
* @returns A QR code URL string.
|
|
11281
|
+
*/
|
|
11282
|
+
TotpSecret.prototype.generateQrCodeUrl = function (accountName, issuer) {
|
|
11283
|
+
var _a;
|
|
11284
|
+
var useDefaults = false;
|
|
11285
|
+
if (_isEmptyString(accountName) || _isEmptyString(issuer)) {
|
|
11286
|
+
useDefaults = true;
|
|
11287
|
+
}
|
|
11288
|
+
if (useDefaults) {
|
|
11289
|
+
if (_isEmptyString(accountName)) {
|
|
11290
|
+
accountName = ((_a = this.auth.currentUser) === null || _a === void 0 ? void 0 : _a.email) || 'unknownuser';
|
|
11291
|
+
}
|
|
11292
|
+
if (_isEmptyString(issuer)) {
|
|
11293
|
+
issuer = this.auth.name;
|
|
11294
|
+
}
|
|
11295
|
+
}
|
|
11296
|
+
return "otpauth://totp/".concat(issuer, ":").concat(accountName, "?secret=").concat(this.secretKey, "&issuer=").concat(issuer, "&algorithm=").concat(this.hashingAlgorithm, "&digits=").concat(this.codeLength);
|
|
11297
|
+
};
|
|
11298
|
+
return TotpSecret;
|
|
11299
|
+
}());
|
|
11300
|
+
/** @internal */
|
|
11301
|
+
function _isEmptyString(input) {
|
|
11302
|
+
return typeof input === 'undefined' || (input === null || input === void 0 ? void 0 : input.length) === 0;
|
|
11303
|
+
}
|
|
11304
|
+
|
|
11107
11305
|
var name = "@firebase/auth";
|
|
11108
|
-
var version = "0.21.5-canary.
|
|
11306
|
+
var version = "0.21.5-canary.f8a2c5865";
|
|
11109
11307
|
|
|
11110
11308
|
/**
|
|
11111
11309
|
* @license
|
|
@@ -11362,5 +11560,5 @@ function getAuth(app) {
|
|
|
11362
11560
|
}
|
|
11363
11561
|
registerAuth("Browser" /* ClientPlatform.BROWSER */);
|
|
11364
11562
|
|
|
11365
|
-
export {
|
|
11366
|
-
//# sourceMappingURL=index-
|
|
11563
|
+
export { linkWithCredential as $, ActionCodeOperation as A, deleteUser as B, debugErrorMap as C, prodErrorMap as D, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as E, FactorId as F, initializeAuth as G, connectAuthEmulator as H, AuthCredential as I, EmailAuthCredential as J, OAuthCredential as K, PhoneAuthCredential as L, inMemoryPersistence as M, EmailAuthProvider as N, OperationType as O, PhoneAuthProvider as P, FacebookAuthProvider as Q, RecaptchaVerifier as R, SignInMethod as S, TotpMultiFactorGenerator as T, GoogleAuthProvider as U, GithubAuthProvider as V, OAuthProvider as W, SAMLAuthProvider as X, TwitterAuthProvider as Y, signInAnonymously as Z, signInWithCredential as _, browserSessionPersistence as a, reauthenticateWithCredential as a0, signInWithCustomToken as a1, sendPasswordResetEmail as a2, confirmPasswordReset as a3, applyActionCode as a4, checkActionCode as a5, verifyPasswordResetCode as a6, createUserWithEmailAndPassword as a7, signInWithEmailAndPassword as a8, sendSignInLinkToEmail as a9, AuthEventManager as aA, _getInstance as aB, _persistenceKeyName as aC, _clearRedirectOutcomes as aD, _getRedirectResult as aE, _overrideRedirectResult as aF, _castAuth as aG, UserImpl as aH, AuthImpl as aI, _getClientVersion as aJ, _generateEventId as aK, AuthPopup as aL, FetchProvider as aM, SAMLAuthCredential as aN, isSignInWithEmailLink as aa, signInWithEmailLink as ab, fetchSignInMethodsForEmail as ac, sendEmailVerification as ad, verifyBeforeUpdateEmail as ae, ActionCodeURL as af, parseActionCodeURL as ag, updateProfile as ah, updateEmail as ai, updatePassword as aj, getIdToken as ak, getIdTokenResult as al, unlink as am, getAdditionalUserInfo as an, reload as ao, getMultiFactorResolver as ap, multiFactor as aq, _isIOS as ar, _isAndroid as as, _fail as at, _getRedirectUrl as au, debugAssert as av, _getProjectConfig as aw, _isIOS7Or8 as ax, _assert as ay, _createError as az, browserLocalPersistence as b, signInWithPopup as c, linkWithPopup as d, reauthenticateWithPopup as e, signInWithRedirect as f, linkWithRedirect as g, reauthenticateWithRedirect as h, indexedDBLocalPersistence as i, getRedirectResult as j, browserPopupRedirectResolver as k, linkWithPhoneNumber as l, PhoneMultiFactorGenerator as m, TotpSecret as n, getAuth as o, ProviderId as p, setPersistence as q, reauthenticateWithPhoneNumber as r, signInWithPhoneNumber as s, onIdTokenChanged as t, updatePhoneNumber as u, beforeAuthStateChanged as v, onAuthStateChanged as w, useDeviceLanguage as x, updateCurrentUser as y, signOut as z };
|
|
11564
|
+
//# sourceMappingURL=index-de7cac5b.js.map
|