@firebase/auth 1.3.1-canary.6e4e475f6 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/browser-cjs/{index-e3e2566b.js → index-eb1e5841.js} +2 -2
  2. package/dist/browser-cjs/{index-e3e2566b.js.map → index-eb1e5841.js.map} +1 -1
  3. package/dist/browser-cjs/index.js +1 -1
  4. package/dist/browser-cjs/index.rn.d.ts +0 -1
  5. package/dist/browser-cjs/internal.js +1 -1
  6. package/dist/cordova/index.js +2 -2
  7. package/dist/cordova/index.rn.d.ts +0 -1
  8. package/dist/cordova/internal.js +2 -2
  9. package/dist/cordova/{popup_redirect-9973210d.js → popup_redirect-813a1061.js} +2 -2
  10. package/dist/cordova/{popup_redirect-9973210d.js.map → popup_redirect-813a1061.js.map} +1 -1
  11. package/dist/esm2017/{index-aaffd0fc.js → index-ff60bc4f.js} +2 -2
  12. package/dist/esm2017/{index-aaffd0fc.js.map → index-ff60bc4f.js.map} +1 -1
  13. package/dist/esm2017/index.js +1 -1
  14. package/dist/esm2017/index.rn.d.ts +0 -1
  15. package/dist/esm2017/internal.js +2 -2
  16. package/dist/esm5/{index-044bfa44.js → index-41b32683.js} +2 -2
  17. package/dist/esm5/{index-044bfa44.js.map → index-41b32683.js.map} +1 -1
  18. package/dist/esm5/index.js +1 -1
  19. package/dist/esm5/index.rn.d.ts +0 -1
  20. package/dist/esm5/internal.js +2 -2
  21. package/dist/index.rn.d.ts +0 -1
  22. package/dist/index.webworker.esm5.js +1 -1
  23. package/dist/node/index.js +1 -1
  24. package/dist/node/index.rn.d.ts +0 -1
  25. package/dist/node/internal.js +1 -1
  26. package/dist/node/{totp-c47e7a9e.js → totp-3322e904.js} +2 -2
  27. package/dist/node/{totp-c47e7a9e.js.map → totp-3322e904.js.map} +1 -1
  28. package/dist/node-esm/index.js +1 -1
  29. package/dist/node-esm/index.rn.d.ts +0 -1
  30. package/dist/node-esm/internal.js +2 -2
  31. package/dist/node-esm/{totp-898d4014.js → totp-36756419.js} +2 -2
  32. package/dist/node-esm/{totp-898d4014.js.map → totp-36756419.js.map} +1 -1
  33. package/dist/rn/{index-9dc6fdd2.js → index-97e8af35.js} +6 -178
  34. package/dist/rn/index-97e8af35.js.map +1 -0
  35. package/dist/rn/index.js +1 -3
  36. package/dist/rn/index.js.map +1 -1
  37. package/dist/rn/index.rn.d.ts +0 -1
  38. package/dist/rn/internal.js +177 -3
  39. package/dist/rn/internal.js.map +1 -1
  40. package/package.json +6 -6
  41. package/dist/rn/index-9dc6fdd2.js.map +0 -1
@@ -7882,7 +7882,7 @@ function multiFactor(user) {
7882
7882
  }
7883
7883
 
7884
7884
  var name = "@firebase/auth";
7885
- var version = "1.3.1-canary.6e4e475f6";
7885
+ var version = "1.3.1";
7886
7886
 
7887
7887
  /**
7888
7888
  * @license
@@ -9247,180 +9247,6 @@ var PhoneMultiFactorGenerator = /** @class */ (function () {
9247
9247
  return PhoneMultiFactorGenerator;
9248
9248
  }());
9249
9249
 
9250
- /**
9251
- * Provider for generating a {@link TotpMultiFactorAssertion}.
9252
- *
9253
- * @public
9254
- */
9255
- var TotpMultiFactorGenerator = /** @class */ (function () {
9256
- function TotpMultiFactorGenerator() {
9257
- }
9258
- /**
9259
- * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of
9260
- * the TOTP (time-based one-time password) second factor.
9261
- * This assertion is used to complete enrollment in TOTP second factor.
9262
- *
9263
- * @param secret A {@link TotpSecret} containing the shared secret key and other TOTP parameters.
9264
- * @param oneTimePassword One-time password from TOTP App.
9265
- * @returns A {@link TotpMultiFactorAssertion} which can be used with
9266
- * {@link MultiFactorUser.enroll}.
9267
- */
9268
- TotpMultiFactorGenerator.assertionForEnrollment = function (secret, oneTimePassword) {
9269
- return TotpMultiFactorAssertionImpl._fromSecret(secret, oneTimePassword);
9270
- };
9271
- /**
9272
- * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of the TOTP second factor.
9273
- * This assertion is used to complete signIn with TOTP as the second factor.
9274
- *
9275
- * @param enrollmentId identifies the enrolled TOTP second factor.
9276
- * @param oneTimePassword One-time password from TOTP App.
9277
- * @returns A {@link TotpMultiFactorAssertion} which can be used with
9278
- * {@link MultiFactorResolver.resolveSignIn}.
9279
- */
9280
- TotpMultiFactorGenerator.assertionForSignIn = function (enrollmentId, oneTimePassword) {
9281
- return TotpMultiFactorAssertionImpl._fromEnrollmentId(enrollmentId, oneTimePassword);
9282
- };
9283
- /**
9284
- * Returns a promise to {@link TotpSecret} which contains the TOTP shared secret key and other parameters.
9285
- * Creates a TOTP secret as part of enrolling a TOTP second factor.
9286
- * Used for generating a QR code URL or inputting into a TOTP app.
9287
- * This method uses the auth instance corresponding to the user in the multiFactorSession.
9288
- *
9289
- * @param session The {@link MultiFactorSession} that the user is part of.
9290
- * @returns A promise to {@link TotpSecret}.
9291
- */
9292
- TotpMultiFactorGenerator.generateSecret = function (session) {
9293
- var _a;
9294
- return tslib.__awaiter(this, void 0, void 0, function () {
9295
- var mfaSession, response;
9296
- return tslib.__generator(this, function (_b) {
9297
- switch (_b.label) {
9298
- case 0:
9299
- mfaSession = session;
9300
- _assert(typeof ((_a = mfaSession.user) === null || _a === void 0 ? void 0 : _a.auth) !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
9301
- return [4 /*yield*/, startEnrollTotpMfa(mfaSession.user.auth, {
9302
- idToken: mfaSession.credential,
9303
- totpEnrollmentInfo: {}
9304
- })];
9305
- case 1:
9306
- response = _b.sent();
9307
- return [2 /*return*/, TotpSecret._fromStartTotpMfaEnrollmentResponse(response, mfaSession.user.auth)];
9308
- }
9309
- });
9310
- });
9311
- };
9312
- /**
9313
- * The identifier of the TOTP second factor: `totp`.
9314
- */
9315
- TotpMultiFactorGenerator.FACTOR_ID = "totp" /* FactorId.TOTP */;
9316
- return TotpMultiFactorGenerator;
9317
- }());
9318
- var TotpMultiFactorAssertionImpl = /** @class */ (function (_super) {
9319
- tslib.__extends(TotpMultiFactorAssertionImpl, _super);
9320
- function TotpMultiFactorAssertionImpl(otp, enrollmentId, secret) {
9321
- var _this = _super.call(this, "totp" /* FactorId.TOTP */) || this;
9322
- _this.otp = otp;
9323
- _this.enrollmentId = enrollmentId;
9324
- _this.secret = secret;
9325
- return _this;
9326
- }
9327
- /** @internal */
9328
- TotpMultiFactorAssertionImpl._fromSecret = function (secret, otp) {
9329
- return new TotpMultiFactorAssertionImpl(otp, undefined, secret);
9330
- };
9331
- /** @internal */
9332
- TotpMultiFactorAssertionImpl._fromEnrollmentId = function (enrollmentId, otp) {
9333
- return new TotpMultiFactorAssertionImpl(otp, enrollmentId);
9334
- };
9335
- /** @internal */
9336
- TotpMultiFactorAssertionImpl.prototype._finalizeEnroll = function (auth, idToken, displayName) {
9337
- return tslib.__awaiter(this, void 0, void 0, function () {
9338
- return tslib.__generator(this, function (_a) {
9339
- _assert(typeof this.secret !== 'undefined', auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
9340
- return [2 /*return*/, finalizeEnrollTotpMfa(auth, {
9341
- idToken: idToken,
9342
- displayName: displayName,
9343
- totpVerificationInfo: this.secret._makeTotpVerificationInfo(this.otp)
9344
- })];
9345
- });
9346
- });
9347
- };
9348
- /** @internal */
9349
- TotpMultiFactorAssertionImpl.prototype._finalizeSignIn = function (auth, mfaPendingCredential) {
9350
- return tslib.__awaiter(this, void 0, void 0, function () {
9351
- var totpVerificationInfo;
9352
- return tslib.__generator(this, function (_a) {
9353
- _assert(this.enrollmentId !== undefined && this.otp !== undefined, auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
9354
- totpVerificationInfo = { verificationCode: this.otp };
9355
- return [2 /*return*/, finalizeSignInTotpMfa(auth, {
9356
- mfaPendingCredential: mfaPendingCredential,
9357
- mfaEnrollmentId: this.enrollmentId,
9358
- totpVerificationInfo: totpVerificationInfo
9359
- })];
9360
- });
9361
- });
9362
- };
9363
- return TotpMultiFactorAssertionImpl;
9364
- }(MultiFactorAssertionImpl));
9365
- /**
9366
- * Provider for generating a {@link TotpMultiFactorAssertion}.
9367
- *
9368
- * Stores the shared secret key and other parameters to generate time-based OTPs.
9369
- * Implements methods to retrieve the shared secret key and generate a QR code URL.
9370
- * @public
9371
- */
9372
- var TotpSecret = /** @class */ (function () {
9373
- // The public members are declared outside the constructor so the docs can be generated.
9374
- function TotpSecret(secretKey, hashingAlgorithm, codeLength, codeIntervalSeconds, enrollmentCompletionDeadline, sessionInfo, auth) {
9375
- this.sessionInfo = sessionInfo;
9376
- this.auth = auth;
9377
- this.secretKey = secretKey;
9378
- this.hashingAlgorithm = hashingAlgorithm;
9379
- this.codeLength = codeLength;
9380
- this.codeIntervalSeconds = codeIntervalSeconds;
9381
- this.enrollmentCompletionDeadline = enrollmentCompletionDeadline;
9382
- }
9383
- /** @internal */
9384
- TotpSecret._fromStartTotpMfaEnrollmentResponse = function (response, auth) {
9385
- 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);
9386
- };
9387
- /** @internal */
9388
- TotpSecret.prototype._makeTotpVerificationInfo = function (otp) {
9389
- return { sessionInfo: this.sessionInfo, verificationCode: otp };
9390
- };
9391
- /**
9392
- * Returns a QR code URL as described in
9393
- * https://github.com/google/google-authenticator/wiki/Key-Uri-Format
9394
- * This can be displayed to the user as a QR code to be scanned into a TOTP app like Google Authenticator.
9395
- * If the optional parameters are unspecified, an accountName of <userEmail> and issuer of <firebaseAppName> are used.
9396
- *
9397
- * @param accountName the name of the account/app along with a user identifier.
9398
- * @param issuer issuer of the TOTP (likely the app name).
9399
- * @returns A QR code URL string.
9400
- */
9401
- TotpSecret.prototype.generateQrCodeUrl = function (accountName, issuer) {
9402
- var _a;
9403
- var useDefaults = false;
9404
- if (_isEmptyString(accountName) || _isEmptyString(issuer)) {
9405
- useDefaults = true;
9406
- }
9407
- if (useDefaults) {
9408
- if (_isEmptyString(accountName)) {
9409
- accountName = ((_a = this.auth.currentUser) === null || _a === void 0 ? void 0 : _a.email) || 'unknownuser';
9410
- }
9411
- if (_isEmptyString(issuer)) {
9412
- issuer = this.auth.name;
9413
- }
9414
- }
9415
- return "otpauth://totp/".concat(issuer, ":").concat(accountName, "?secret=").concat(this.secretKey, "&issuer=").concat(issuer, "&algorithm=").concat(this.hashingAlgorithm, "&digits=").concat(this.codeLength);
9416
- };
9417
- return TotpSecret;
9418
- }());
9419
- /** @internal */
9420
- function _isEmptyString(input) {
9421
- return typeof input === 'undefined' || (input === null || input === void 0 ? void 0 : input.length) === 0;
9422
- }
9423
-
9424
9250
  var STORAGE_AVAILABLE_KEY = '__sak';
9425
9251
 
9426
9252
  exports.AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY = AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY;
@@ -9438,6 +9264,7 @@ exports.FederatedAuthProvider = FederatedAuthProvider;
9438
9264
  exports.FetchProvider = FetchProvider;
9439
9265
  exports.GithubAuthProvider = GithubAuthProvider;
9440
9266
  exports.GoogleAuthProvider = GoogleAuthProvider;
9267
+ exports.MultiFactorAssertionImpl = MultiFactorAssertionImpl;
9441
9268
  exports.OAuthCredential = OAuthCredential;
9442
9269
  exports.OAuthProvider = OAuthProvider;
9443
9270
  exports.OperationType = OperationType;
@@ -9450,8 +9277,6 @@ exports.SAMLAuthCredential = SAMLAuthCredential;
9450
9277
  exports.SAMLAuthProvider = SAMLAuthProvider;
9451
9278
  exports.STORAGE_AVAILABLE_KEY = STORAGE_AVAILABLE_KEY;
9452
9279
  exports.SignInMethod = SignInMethod;
9453
- exports.TotpMultiFactorGenerator = TotpMultiFactorGenerator;
9454
- exports.TotpSecret = TotpSecret;
9455
9280
  exports.TwitterAuthProvider = TwitterAuthProvider;
9456
9281
  exports.UserImpl = UserImpl;
9457
9282
  exports._assert = _assert;
@@ -9498,6 +9323,8 @@ exports.debugAssert = debugAssert;
9498
9323
  exports.debugErrorMap = debugErrorMap;
9499
9324
  exports.deleteUser = deleteUser;
9500
9325
  exports.fetchSignInMethodsForEmail = fetchSignInMethodsForEmail;
9326
+ exports.finalizeEnrollTotpMfa = finalizeEnrollTotpMfa;
9327
+ exports.finalizeSignInTotpMfa = finalizeSignInTotpMfa;
9501
9328
  exports.getAdditionalUserInfo = getAdditionalUserInfo;
9502
9329
  exports.getIdToken = getIdToken;
9503
9330
  exports.getIdTokenResult = getIdTokenResult;
@@ -9529,6 +9356,7 @@ exports.signInWithEmailLink = signInWithEmailLink;
9529
9356
  exports.signInWithIdp = signInWithIdp;
9530
9357
  exports.signInWithPhoneNumber = signInWithPhoneNumber;
9531
9358
  exports.signOut = signOut;
9359
+ exports.startEnrollTotpMfa = startEnrollTotpMfa;
9532
9360
  exports.unlink = unlink;
9533
9361
  exports.updateCurrentUser = updateCurrentUser;
9534
9362
  exports.updateEmail = updateEmail;
@@ -9539,4 +9367,4 @@ exports.useDeviceLanguage = useDeviceLanguage;
9539
9367
  exports.validatePassword = validatePassword;
9540
9368
  exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
9541
9369
  exports.verifyPasswordResetCode = verifyPasswordResetCode;
9542
- //# sourceMappingURL=index-9dc6fdd2.js.map
9370
+ //# sourceMappingURL=index-97e8af35.js.map