@firebase/auth 1.3.1 → 1.3.2-canary.12ad9f181
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/dist/browser-cjs/{index-eb1e5841.js → index-c9d133f5.js} +2 -2
- package/dist/browser-cjs/{index-eb1e5841.js.map → index-c9d133f5.js.map} +1 -1
- package/dist/browser-cjs/index.js +1 -1
- package/dist/browser-cjs/index.rn.d.ts +1 -0
- package/dist/browser-cjs/internal.js +1 -1
- package/dist/cordova/index.js +2 -2
- package/dist/cordova/index.rn.d.ts +1 -0
- package/dist/cordova/internal.js +2 -2
- package/dist/cordova/{popup_redirect-813a1061.js → popup_redirect-42dd0787.js} +2 -2
- package/dist/cordova/{popup_redirect-813a1061.js.map → popup_redirect-42dd0787.js.map} +1 -1
- package/dist/esm2017/{index-ff60bc4f.js → index-ed2b0b3c.js} +2 -2
- package/dist/esm2017/{index-ff60bc4f.js.map → index-ed2b0b3c.js.map} +1 -1
- package/dist/esm2017/index.js +1 -1
- package/dist/esm2017/index.rn.d.ts +1 -0
- package/dist/esm2017/internal.js +2 -2
- package/dist/esm5/{index-41b32683.js → index-dd33e266.js} +2 -2
- package/dist/esm5/{index-41b32683.js.map → index-dd33e266.js.map} +1 -1
- package/dist/esm5/index.js +1 -1
- package/dist/esm5/index.rn.d.ts +1 -0
- package/dist/esm5/internal.js +2 -2
- package/dist/index.rn.d.ts +1 -0
- package/dist/index.webworker.esm5.js +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.rn.d.ts +1 -0
- package/dist/node/internal.js +1 -1
- package/dist/node/{totp-3322e904.js → totp-4adc6b62.js} +2 -2
- package/dist/node/{totp-3322e904.js.map → totp-4adc6b62.js.map} +1 -1
- package/dist/node-esm/index.js +1 -1
- package/dist/node-esm/index.rn.d.ts +1 -0
- package/dist/node-esm/internal.js +2 -2
- package/dist/node-esm/{totp-36756419.js → totp-37ceb8d8.js} +2 -2
- package/dist/node-esm/{totp-36756419.js.map → totp-37ceb8d8.js.map} +1 -1
- package/dist/rn/{index-97e8af35.js → index-961dd506.js} +178 -6
- package/dist/rn/index-961dd506.js.map +1 -0
- package/dist/rn/index.js +3 -1
- package/dist/rn/index.js.map +1 -1
- package/dist/rn/index.rn.d.ts +1 -0
- package/dist/rn/internal.js +3 -177
- package/dist/rn/internal.js.map +1 -1
- package/package.json +6 -6
- package/dist/rn/index-97e8af35.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.
|
|
7885
|
+
var version = "1.3.2-canary.12ad9f181";
|
|
7886
7886
|
|
|
7887
7887
|
/**
|
|
7888
7888
|
* @license
|
|
@@ -9247,6 +9247,180 @@ 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
|
+
|
|
9250
9424
|
var STORAGE_AVAILABLE_KEY = '__sak';
|
|
9251
9425
|
|
|
9252
9426
|
exports.AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY = AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY;
|
|
@@ -9264,7 +9438,6 @@ exports.FederatedAuthProvider = FederatedAuthProvider;
|
|
|
9264
9438
|
exports.FetchProvider = FetchProvider;
|
|
9265
9439
|
exports.GithubAuthProvider = GithubAuthProvider;
|
|
9266
9440
|
exports.GoogleAuthProvider = GoogleAuthProvider;
|
|
9267
|
-
exports.MultiFactorAssertionImpl = MultiFactorAssertionImpl;
|
|
9268
9441
|
exports.OAuthCredential = OAuthCredential;
|
|
9269
9442
|
exports.OAuthProvider = OAuthProvider;
|
|
9270
9443
|
exports.OperationType = OperationType;
|
|
@@ -9277,6 +9450,8 @@ exports.SAMLAuthCredential = SAMLAuthCredential;
|
|
|
9277
9450
|
exports.SAMLAuthProvider = SAMLAuthProvider;
|
|
9278
9451
|
exports.STORAGE_AVAILABLE_KEY = STORAGE_AVAILABLE_KEY;
|
|
9279
9452
|
exports.SignInMethod = SignInMethod;
|
|
9453
|
+
exports.TotpMultiFactorGenerator = TotpMultiFactorGenerator;
|
|
9454
|
+
exports.TotpSecret = TotpSecret;
|
|
9280
9455
|
exports.TwitterAuthProvider = TwitterAuthProvider;
|
|
9281
9456
|
exports.UserImpl = UserImpl;
|
|
9282
9457
|
exports._assert = _assert;
|
|
@@ -9323,8 +9498,6 @@ exports.debugAssert = debugAssert;
|
|
|
9323
9498
|
exports.debugErrorMap = debugErrorMap;
|
|
9324
9499
|
exports.deleteUser = deleteUser;
|
|
9325
9500
|
exports.fetchSignInMethodsForEmail = fetchSignInMethodsForEmail;
|
|
9326
|
-
exports.finalizeEnrollTotpMfa = finalizeEnrollTotpMfa;
|
|
9327
|
-
exports.finalizeSignInTotpMfa = finalizeSignInTotpMfa;
|
|
9328
9501
|
exports.getAdditionalUserInfo = getAdditionalUserInfo;
|
|
9329
9502
|
exports.getIdToken = getIdToken;
|
|
9330
9503
|
exports.getIdTokenResult = getIdTokenResult;
|
|
@@ -9356,7 +9529,6 @@ exports.signInWithEmailLink = signInWithEmailLink;
|
|
|
9356
9529
|
exports.signInWithIdp = signInWithIdp;
|
|
9357
9530
|
exports.signInWithPhoneNumber = signInWithPhoneNumber;
|
|
9358
9531
|
exports.signOut = signOut;
|
|
9359
|
-
exports.startEnrollTotpMfa = startEnrollTotpMfa;
|
|
9360
9532
|
exports.unlink = unlink;
|
|
9361
9533
|
exports.updateCurrentUser = updateCurrentUser;
|
|
9362
9534
|
exports.updateEmail = updateEmail;
|
|
@@ -9367,4 +9539,4 @@ exports.useDeviceLanguage = useDeviceLanguage;
|
|
|
9367
9539
|
exports.validatePassword = validatePassword;
|
|
9368
9540
|
exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
|
|
9369
9541
|
exports.verifyPasswordResetCode = verifyPasswordResetCode;
|
|
9370
|
-
//# sourceMappingURL=index-
|
|
9542
|
+
//# sourceMappingURL=index-961dd506.js.map
|