@firebase/auth 1.3.2-20231027003707 → 1.3.2-canary.5c7fa8491

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 (102) hide show
  1. package/dist/auth-public.d.ts +10 -0
  2. package/dist/auth.d.ts +11 -0
  3. package/dist/browser-cjs/{index-8c5a52a3.js → index-85a92bd1.js} +47 -5
  4. package/dist/browser-cjs/index-85a92bd1.js.map +1 -0
  5. package/dist/browser-cjs/index.js +2 -1
  6. package/dist/browser-cjs/index.js.map +1 -1
  7. package/dist/browser-cjs/internal.js +2 -1
  8. package/dist/browser-cjs/internal.js.map +1 -1
  9. package/dist/browser-cjs/src/api/account_management/email_and_password.d.ts +2 -0
  10. package/dist/browser-cjs/src/api/authentication/sign_up.d.ts +1 -0
  11. package/dist/browser-cjs/src/api/authentication/token.d.ts +13 -2
  12. package/dist/browser-cjs/src/api/index.d.ts +3 -1
  13. package/dist/browser-cjs/src/core/auth/auth_impl.d.ts +4 -0
  14. package/dist/browser-cjs/src/core/index.d.ts +9 -0
  15. package/dist/browser-cjs/src/model/auth.d.ts +1 -0
  16. package/dist/cordova/index.js +2 -2
  17. package/dist/cordova/internal.js +2 -2
  18. package/dist/cordova/{popup_redirect-ee25418c.js → popup_redirect-c478e975.js} +71 -9
  19. package/dist/cordova/popup_redirect-c478e975.js.map +1 -0
  20. package/dist/cordova/src/api/account_management/email_and_password.d.ts +2 -0
  21. package/dist/cordova/src/api/authentication/sign_up.d.ts +1 -0
  22. package/dist/cordova/src/api/authentication/token.d.ts +13 -2
  23. package/dist/cordova/src/api/index.d.ts +3 -1
  24. package/dist/cordova/src/core/auth/auth_impl.d.ts +4 -0
  25. package/dist/cordova/src/core/index.d.ts +9 -0
  26. package/dist/cordova/src/model/auth.d.ts +1 -0
  27. package/dist/esm2017/{index-5734e72a.js → index-c6f7c1bf.js} +47 -6
  28. package/dist/esm2017/index-c6f7c1bf.js.map +1 -0
  29. package/dist/esm2017/index.js +1 -1
  30. package/dist/esm2017/internal.js +2 -2
  31. package/dist/esm2017/src/api/account_management/email_and_password.d.ts +2 -0
  32. package/dist/esm2017/src/api/authentication/sign_up.d.ts +1 -0
  33. package/dist/esm2017/src/api/authentication/token.d.ts +13 -2
  34. package/dist/esm2017/src/api/index.d.ts +3 -1
  35. package/dist/esm2017/src/core/auth/auth_impl.d.ts +4 -0
  36. package/dist/esm2017/src/core/index.d.ts +9 -0
  37. package/dist/esm2017/src/model/auth.d.ts +1 -0
  38. package/dist/esm5/{index-3b219637.js → index-1fa3383f.js} +71 -9
  39. package/dist/esm5/index-1fa3383f.js.map +1 -0
  40. package/dist/esm5/index.js +1 -1
  41. package/dist/esm5/internal.js +2 -2
  42. package/dist/esm5/src/api/account_management/email_and_password.d.ts +2 -0
  43. package/dist/esm5/src/api/authentication/sign_up.d.ts +1 -0
  44. package/dist/esm5/src/api/authentication/token.d.ts +13 -2
  45. package/dist/esm5/src/api/index.d.ts +3 -1
  46. package/dist/esm5/src/core/auth/auth_impl.d.ts +4 -0
  47. package/dist/esm5/src/core/index.d.ts +9 -0
  48. package/dist/esm5/src/model/auth.d.ts +1 -0
  49. package/dist/index.webworker.esm5.js +70 -8
  50. package/dist/index.webworker.esm5.js.map +1 -1
  51. package/dist/node/index.js +2 -1
  52. package/dist/node/index.js.map +1 -1
  53. package/dist/node/internal.js +2 -1
  54. package/dist/node/internal.js.map +1 -1
  55. package/dist/node/src/api/account_management/email_and_password.d.ts +2 -0
  56. package/dist/node/src/api/authentication/sign_up.d.ts +1 -0
  57. package/dist/node/src/api/authentication/token.d.ts +13 -2
  58. package/dist/node/src/api/index.d.ts +3 -1
  59. package/dist/node/src/core/auth/auth_impl.d.ts +4 -0
  60. package/dist/node/src/core/index.d.ts +9 -0
  61. package/dist/node/src/model/auth.d.ts +1 -0
  62. package/dist/node/{totp-7121ebf6.js → totp-e4823b8c.js} +71 -8
  63. package/dist/node/totp-e4823b8c.js.map +1 -0
  64. package/dist/node-esm/index.js +1 -1
  65. package/dist/node-esm/internal.js +2 -2
  66. package/dist/node-esm/src/api/account_management/email_and_password.d.ts +2 -0
  67. package/dist/node-esm/src/api/authentication/sign_up.d.ts +1 -0
  68. package/dist/node-esm/src/api/authentication/token.d.ts +13 -2
  69. package/dist/node-esm/src/api/index.d.ts +3 -1
  70. package/dist/node-esm/src/core/auth/auth_impl.d.ts +4 -0
  71. package/dist/node-esm/src/core/index.d.ts +9 -0
  72. package/dist/node-esm/src/model/auth.d.ts +1 -0
  73. package/dist/node-esm/{totp-c8e91f71.js → totp-1379a26e.js} +47 -6
  74. package/dist/node-esm/totp-1379a26e.js.map +1 -0
  75. package/dist/rn/{index-5c316700.js → index-caba6e10.js} +71 -8
  76. package/dist/rn/index-caba6e10.js.map +1 -0
  77. package/dist/rn/index.js +2 -1
  78. package/dist/rn/index.js.map +1 -1
  79. package/dist/rn/internal.js +2 -1
  80. package/dist/rn/internal.js.map +1 -1
  81. package/dist/rn/src/api/account_management/email_and_password.d.ts +2 -0
  82. package/dist/rn/src/api/authentication/sign_up.d.ts +1 -0
  83. package/dist/rn/src/api/authentication/token.d.ts +13 -2
  84. package/dist/rn/src/api/index.d.ts +3 -1
  85. package/dist/rn/src/core/auth/auth_impl.d.ts +4 -0
  86. package/dist/rn/src/core/index.d.ts +9 -0
  87. package/dist/rn/src/model/auth.d.ts +1 -0
  88. package/dist/src/api/account_management/email_and_password.d.ts +2 -0
  89. package/dist/src/api/authentication/sign_up.d.ts +1 -0
  90. package/dist/src/api/authentication/token.d.ts +13 -2
  91. package/dist/src/api/index.d.ts +3 -1
  92. package/dist/src/core/auth/auth_impl.d.ts +4 -0
  93. package/dist/src/core/index.d.ts +9 -0
  94. package/dist/src/model/auth.d.ts +1 -0
  95. package/package.json +6 -6
  96. package/dist/browser-cjs/index-8c5a52a3.js.map +0 -1
  97. package/dist/cordova/popup_redirect-ee25418c.js.map +0 -1
  98. package/dist/esm2017/index-5734e72a.js.map +0 -1
  99. package/dist/esm5/index-3b219637.js.map +0 -1
  100. package/dist/node/totp-7121ebf6.js.map +0 -1
  101. package/dist/node-esm/totp-c8e91f71.js.map +0 -1
  102. package/dist/rn/index-5c316700.js.map +0 -1
@@ -2941,6 +2941,16 @@ export declare class RecaptchaVerifier implements ApplicationVerifierInternal {
2941
2941
  */
2942
2942
  export declare function reload(user: User): Promise<void>;
2943
2943
 
2944
+ /**
2945
+ * Revokes the given access token. Currently only supports Apple OAuth access tokens.
2946
+ *
2947
+ * @param auth - The {@link Auth} instance.
2948
+ * @param token - The Apple OAuth access token.
2949
+ *
2950
+ * @public
2951
+ */
2952
+ export declare function revokeAccessToken(auth: Auth, token: string): Promise<void>;
2953
+
2944
2954
  /**
2945
2955
  * An {@link AuthProvider} for SAML.
2946
2956
  *
package/dist/auth.d.ts CHANGED
@@ -888,6 +888,7 @@ declare interface AuthInternal extends Auth {
888
888
  useDeviceLanguage(): void;
889
889
  signOut(): Promise<void>;
890
890
  validatePassword(password: string): Promise<PasswordValidationStatus>;
891
+ revokeAccessToken(token: string): Promise<void>;
891
892
  }
892
893
 
893
894
  declare class AuthPopup {
@@ -3413,6 +3414,16 @@ export declare class RecaptchaVerifier implements ApplicationVerifierInternal {
3413
3414
  */
3414
3415
  export declare function reload(user: User): Promise<void>;
3415
3416
 
3417
+ /**
3418
+ * Revokes the given access token. Currently only supports Apple OAuth access tokens.
3419
+ *
3420
+ * @param auth - The {@link Auth} instance.
3421
+ * @param token - The Apple OAuth access token.
3422
+ *
3423
+ * @public
3424
+ */
3425
+ export declare function revokeAccessToken(auth: Auth, token: string): Promise<void>;
3426
+
3416
3427
  /**
3417
3428
  * An {@link AuthProvider} for SAML.
3418
3429
  *
@@ -1540,6 +1540,9 @@ async function requestStsToken(auth, refreshToken) {
1540
1540
  expiresIn: response.expires_in,
1541
1541
  refreshToken: response.refresh_token
1542
1542
  };
1543
+ }
1544
+ async function revokeToken(auth, request) {
1545
+ return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts:revokeToken" /* Endpoint.REVOKE_TOKEN */, _addTidIfNecessary(auth, request));
1543
1546
  }
1544
1547
 
1545
1548
  /**
@@ -2809,6 +2812,25 @@ class AuthImpl {
2809
2812
  }
2810
2813
  });
2811
2814
  }
2815
+ /**
2816
+ * Revokes the given access token. Currently only supports Apple OAuth access tokens.
2817
+ */
2818
+ async revokeAccessToken(token) {
2819
+ if (this.currentUser) {
2820
+ const idToken = await this.currentUser.getIdToken();
2821
+ // Generalize this to accept other providers once supported.
2822
+ const request = {
2823
+ providerId: 'apple.com',
2824
+ tokenType: "ACCESS_TOKEN" /* TokenType.ACCESS_TOKEN */,
2825
+ token,
2826
+ idToken
2827
+ };
2828
+ if (this.tenantId != null) {
2829
+ request.tenantId = this.tenantId;
2830
+ }
2831
+ await revokeToken(this, request);
2832
+ }
2833
+ }
2812
2834
  toJSON() {
2813
2835
  var _a;
2814
2836
  return {
@@ -3499,6 +3521,11 @@ async function resetPassword(auth, request) {
3499
3521
  async function updateEmailPassword(auth, request) {
3500
3522
  return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request);
3501
3523
  }
3524
+ // Used for linking an email/password account to an existing idToken. Uses the same request/response
3525
+ // format as updateEmailPassword.
3526
+ async function linkEmailPassword(auth, request) {
3527
+ return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signUp" /* Endpoint.SIGN_UP */, request);
3528
+ }
3502
3529
  async function applyActionCode$1(auth, request) {
3503
3530
  return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request));
3504
3531
  }
@@ -3662,12 +3689,14 @@ class EmailAuthCredential extends AuthCredential {
3662
3689
  async _linkToIdToken(auth, idToken) {
3663
3690
  switch (this.signInMethod) {
3664
3691
  case "password" /* SignInMethod.EMAIL_PASSWORD */:
3665
- return updateEmailPassword(auth, {
3692
+ const request = {
3666
3693
  idToken,
3667
3694
  returnSecureToken: true,
3668
3695
  email: this._email,
3669
- password: this._password
3670
- });
3696
+ password: this._password,
3697
+ clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
3698
+ };
3699
+ return handleRecaptchaFlow(auth, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, linkEmailPassword);
3671
3700
  case "emailLink" /* SignInMethod.EMAIL_LINK */:
3672
3701
  return signInWithEmailLinkForLinking(auth, {
3673
3702
  idToken,
@@ -6511,6 +6540,18 @@ function updateCurrentUser(auth, user) {
6511
6540
  function signOut(auth) {
6512
6541
  return util.getModularInstance(auth).signOut();
6513
6542
  }
6543
+ /**
6544
+ * Revokes the given access token. Currently only supports Apple OAuth access tokens.
6545
+ *
6546
+ * @param auth - The {@link Auth} instance.
6547
+ * @param token - The Apple OAuth access token.
6548
+ *
6549
+ * @public
6550
+ */
6551
+ function revokeAccessToken(auth, token) {
6552
+ const authInternal = _castAuth(auth);
6553
+ return authInternal.revokeAccessToken(token);
6554
+ }
6514
6555
  /**
6515
6556
  * Deletes and signs out the user.
6516
6557
  *
@@ -10226,7 +10267,7 @@ function _isEmptyString(input) {
10226
10267
  }
10227
10268
 
10228
10269
  var name = "@firebase/auth";
10229
- var version = "1.3.2-20231027003707";
10270
+ var version = "1.3.2-canary.5c7fa8491";
10230
10271
 
10231
10272
  /**
10232
10273
  * @license
@@ -10529,6 +10570,7 @@ exports.reauthenticateWithPhoneNumber = reauthenticateWithPhoneNumber;
10529
10570
  exports.reauthenticateWithPopup = reauthenticateWithPopup;
10530
10571
  exports.reauthenticateWithRedirect = reauthenticateWithRedirect;
10531
10572
  exports.reload = reload;
10573
+ exports.revokeAccessToken = revokeAccessToken;
10532
10574
  exports.sendEmailVerification = sendEmailVerification;
10533
10575
  exports.sendPasswordResetEmail = sendPasswordResetEmail;
10534
10576
  exports.sendSignInLinkToEmail = sendSignInLinkToEmail;
@@ -10552,4 +10594,4 @@ exports.useDeviceLanguage = useDeviceLanguage;
10552
10594
  exports.validatePassword = validatePassword;
10553
10595
  exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
10554
10596
  exports.verifyPasswordResetCode = verifyPasswordResetCode;
10555
- //# sourceMappingURL=index-8c5a52a3.js.map
10597
+ //# sourceMappingURL=index-85a92bd1.js.map