Skip to content

Commit c51f120

Browse files
author
renkelvin
committed
Merge branch 'master' into recaptcha-public-preview
2 parents cf489e7 + 37de4d0 commit c51f120

File tree

94 files changed

+2349
-184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2349
-184
lines changed

.changeset/brown-beers-tease.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.changeset/friendly-ads-yell.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.changeset/plenty-radios-look.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.changeset/sixty-buckets-repeat.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ packages/app-check-interop-types @hsubox76 @firebase/jssdk-global-approvers
9696
# Documentation Changes
9797
packages/firebase/index.d.ts @egilmorez @firebase/jssdk-global-approvers
9898
scripts/docgen/content-sources/ @egilmorez @firebase/jssdk-global-approvers
99-
docs-devsite/ @egilmorez @markarndt
99+
docs-devsite/ @egilmorez @markarndt @kevinthecheung
100100

101101
# Changeset
102102
.changeset @firebase/jssdk-changeset-approvers @firebase/firestore-js-team @firebase/jssdk-global-approvers

.github/workflows/test-changed-auth.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ jobs:
1414
steps:
1515
# install Chrome first, so the correct version of webdriver can be installed by chromedriver when setting up the repo
1616
- name: install Chrome stable
17+
# Install Chrome version 110.0.5481.177-1 as test starts to fail on version 111.0.5563.64-1.
18+
# We will retry to use the latest, once Chrome releases stable version 112 (April 4 ETA).
1719
run: |
1820
sudo apt-get update
19-
sudo apt-get install google-chrome-stable
21+
sudo apt-get install wget
22+
sudo wget http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_110.0.5481.177-1_amd64.deb
23+
sudo apt-get install -f ./google-chrome-stable_110.0.5481.177-1_amd64.deb --allow-downgrades
2024
- name: Checkout Repo
2125
uses: actions/checkout@master
2226
with:

common/api-review/auth.api.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ export class FacebookAuthProvider extends BaseOAuthProvider {
364364
// @public
365365
export const FactorId: {
366366
readonly PHONE: "phone";
367+
readonly TOTP: "totp";
367368
};
368369

369370
// @public
@@ -756,6 +757,40 @@ export function signInWithRedirect(auth: Auth, provider: AuthProvider, resolver?
756757
// @public
757758
export function signOut(auth: Auth): Promise<void>;
758759

760+
// @public
761+
export interface TotpMultiFactorAssertion extends MultiFactorAssertion {
762+
}
763+
764+
// @public
765+
export class TotpMultiFactorGenerator {
766+
static assertionForEnrollment(secret: TotpSecret, oneTimePassword: string): TotpMultiFactorAssertion;
767+
static assertionForSignIn(enrollmentId: string, oneTimePassword: string): TotpMultiFactorAssertion;
768+
static FACTOR_ID: "totp";
769+
static generateSecret(session: MultiFactorSession): Promise<TotpSecret>;
770+
}
771+
772+
// @public
773+
export interface TotpMultiFactorInfo extends MultiFactorInfo {
774+
}
775+
776+
// @public
777+
export class TotpSecret {
778+
readonly codeIntervalSeconds: number;
779+
readonly codeLength: number;
780+
readonly enrollmentCompletionDeadline: string;
781+
// Warning: (ae-forgotten-export) The symbol "StartTotpMfaEnrollmentResponse" needs to be exported by the entry point index.d.ts
782+
//
783+
// @internal (undocumented)
784+
static _fromStartTotpMfaEnrollmentResponse(response: StartTotpMfaEnrollmentResponse, auth: AuthInternal): TotpSecret;
785+
generateQrCodeUrl(accountName?: string, issuer?: string): string;
786+
readonly hashingAlgorithm: string;
787+
// Warning: (ae-forgotten-export) The symbol "TotpVerificationInfo" needs to be exported by the entry point index.d.ts
788+
//
789+
// @internal (undocumented)
790+
_makeTotpVerificationInfo(otp: string): TotpVerificationInfo;
791+
readonly secretKey: string;
792+
}
793+
759794
// @public
760795
export class TwitterAuthProvider extends BaseOAuthProvider {
761796
constructor();

docs-devsite/auth.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ Firebase Authentication
9494
| [PhoneMultiFactorGenerator](./auth.phonemultifactorgenerator.md#phonemultifactorgenerator_class) | Provider for generating a [PhoneMultiFactorAssertion](./auth.phonemultifactorassertion.md#phonemultifactorassertion_interface)<!-- -->. |
9595
| [RecaptchaVerifier](./auth.recaptchaverifier.md#recaptchaverifier_class) | An [reCAPTCHA](https://www.google.com/recaptcha/)<!-- -->-based application verifier. |
9696
| [SAMLAuthProvider](./auth.samlauthprovider.md#samlauthprovider_class) | An [AuthProvider](./auth.authprovider.md#authprovider_interface) for SAML. |
97+
| [TotpMultiFactorGenerator](./auth.totpmultifactorgenerator.md#totpmultifactorgenerator_class) | Provider for generating a [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface)<!-- -->. |
98+
| [TotpSecret](./auth.totpsecret.md#totpsecret_class) | Provider for generating a [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface)<!-- -->.<!-- -->Stores the shared secret key and other parameters to generate time-based OTPs. Implements methods to retrieve the shared secret key and generate a QR code URL. |
9799
| [TwitterAuthProvider](./auth.twitterauthprovider.md#twitterauthprovider_class) | Provider for generating an [OAuthCredential](./auth.oauthcredential.md#oauthcredential_class) for [ProviderId](./auth.md#providerid)<!-- -->.TWITTER. |
98100

99101
## Interfaces
@@ -132,6 +134,8 @@ Firebase Authentication
132134
| [ReactNativeAsyncStorage](./auth.reactnativeasyncstorage.md#reactnativeasyncstorage_interface) | Interface for a supplied <code>AsyncStorage</code>. |
133135
| [RecaptchaConfig](./auth.recaptchaconfig.md#recaptchaconfig_interface) | |
134136
| [RecaptchaParameters](./auth.recaptchaparameters.md#recaptchaparameters_interface) | Interface representing reCAPTCHA parameters.<!-- -->See the \[reCAPTCHA docs\](https://developers.google.com/recaptcha/docs/display\#render\_param) for the list of accepted parameters. All parameters are accepted except for <code>sitekey</code>: Firebase Auth provisions a reCAPTCHA for each project and will configure the site key upon rendering.<!-- -->For an invisible reCAPTCHA, set the <code>size</code> key to <code>invisible</code>. |
137+
| [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface) | The class for asserting ownership of a TOTP second factor. Provided by [TotpMultiFactorGenerator.assertionForEnrollment()](./auth.totpmultifactorgenerator.md#totpmultifactorgeneratorassertionforenrollment) and [TotpMultiFactorGenerator.assertionForSignIn()](./auth.totpmultifactorgenerator.md#totpmultifactorgeneratorassertionforsignin)<!-- -->. |
138+
| [TotpMultiFactorInfo](./auth.totpmultifactorinfo.md#totpmultifactorinfo_interface) | The subclass of the [MultiFactorInfo](./auth.multifactorinfo.md#multifactorinfo_interface) interface for TOTP second factors. The <code>factorId</code> of this second factor is [FactorId](./auth.md#factorid)<!-- -->.TOTP. |
135139
| [User](./auth.user.md#user_interface) | A user account. |
136140
| [UserCredential](./auth.usercredential.md#usercredential_interface) | A structure containing a [User](./auth.user.md#user_interface)<!-- -->, the [OperationType](./auth.md#operationtype)<!-- -->, and the provider ID. |
137141
| [UserInfo](./auth.userinfo.md#userinfo_interface) | User profile information, visible only to the Firebase project's apps. |
@@ -564,7 +568,7 @@ export declare function onAuthStateChanged(auth: Auth, nextOrObserver: NextOrObs
564568

565569
Adds an observer for changes to the signed-in user's ID token.
566570

567-
This includes sign-in, sign-out, and token refresh events.
571+
This includes sign-in, sign-out, and token refresh events. This will not be triggered automatically upon ID token expiration. Use [User.getIdToken()](./auth.user.md#usergetidtoken) to refresh the ID token.
568572

569573
<b>Signature:</b>
570574

@@ -1889,6 +1893,7 @@ An enum of factors that may be used for multifactor authentication.
18891893
```typescript
18901894
FactorId: {
18911895
readonly PHONE: "phone";
1896+
readonly TOTP: "totp";
18921897
}
18931898
```
18941899

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Project: /docs/reference/js/_project.yaml
2+
Book: /docs/reference/_book.yaml
3+
page_type: reference
4+
5+
{% comment %}
6+
DO NOT EDIT THIS FILE!
7+
This is generated by the JS SDK team, and any local changes will be
8+
overwritten. Changes should be made in the source code at
9+
https://github.com/firebase/firebase-js-sdk
10+
{% endcomment %}
11+
12+
# TotpMultiFactorAssertion interface
13+
The class for asserting ownership of a TOTP second factor. Provided by [TotpMultiFactorGenerator.assertionForEnrollment()](./auth.totpmultifactorgenerator.md#totpmultifactorgeneratorassertionforenrollment) and [TotpMultiFactorGenerator.assertionForSignIn()](./auth.totpmultifactorgenerator.md#totpmultifactorgeneratorassertionforsignin)<!-- -->.
14+
15+
<b>Signature:</b>
16+
17+
```typescript
18+
export interface TotpMultiFactorAssertion extends MultiFactorAssertion
19+
```
20+
<b>Extends:</b> [MultiFactorAssertion](./auth.multifactorassertion.md#multifactorassertion_interface)
21+
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
Project: /docs/reference/js/_project.yaml
2+
Book: /docs/reference/_book.yaml
3+
page_type: reference
4+
5+
{% comment %}
6+
DO NOT EDIT THIS FILE!
7+
This is generated by the JS SDK team, and any local changes will be
8+
overwritten. Changes should be made in the source code at
9+
https://github.com/firebase/firebase-js-sdk
10+
{% endcomment %}
11+
12+
# TotpMultiFactorGenerator class
13+
Provider for generating a [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface)<!-- -->.
14+
15+
<b>Signature:</b>
16+
17+
```typescript
18+
export declare class TotpMultiFactorGenerator
19+
```
20+
21+
## Properties
22+
23+
| Property | Modifiers | Type | Description |
24+
| --- | --- | --- | --- |
25+
| [FACTOR\_ID](./auth.totpmultifactorgenerator.md#totpmultifactorgeneratorfactor_id) | <code>static</code> | 'totp' | The identifier of the TOTP second factor: <code>totp</code>. |
26+
27+
## Methods
28+
29+
| Method | Modifiers | Description |
30+
| --- | --- | --- |
31+
| [assertionForEnrollment(secret, oneTimePassword)](./auth.totpmultifactorgenerator.md#totpmultifactorgeneratorassertionforenrollment) | <code>static</code> | Provides a [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface) to confirm ownership of the TOTP (time-based one-time password) second factor. This assertion is used to complete enrollment in TOTP second factor. |
32+
| [assertionForSignIn(enrollmentId, oneTimePassword)](./auth.totpmultifactorgenerator.md#totpmultifactorgeneratorassertionforsignin) | <code>static</code> | Provides a [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface) to confirm ownership of the TOTP second factor. This assertion is used to complete signIn with TOTP as the second factor. |
33+
| [generateSecret(session)](./auth.totpmultifactorgenerator.md#totpmultifactorgeneratorgeneratesecret) | <code>static</code> | Returns a promise to [TotpSecret](./auth.totpsecret.md#totpsecret_class) which contains the TOTP shared secret key and other parameters. Creates a TOTP secret as part of enrolling a TOTP second factor. Used for generating a QR code URL or inputting into a TOTP app. This method uses the auth instance corresponding to the user in the multiFactorSession. |
34+
35+
## TotpMultiFactorGenerator.FACTOR\_ID
36+
37+
The identifier of the TOTP second factor: `totp`<!-- -->.
38+
39+
<b>Signature:</b>
40+
41+
```typescript
42+
static FACTOR_ID: 'totp';
43+
```
44+
45+
## TotpMultiFactorGenerator.assertionForEnrollment()
46+
47+
Provides a [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface) to confirm ownership of the TOTP (time-based one-time password) second factor. This assertion is used to complete enrollment in TOTP second factor.
48+
49+
<b>Signature:</b>
50+
51+
```typescript
52+
static assertionForEnrollment(secret: TotpSecret, oneTimePassword: string): TotpMultiFactorAssertion;
53+
```
54+
55+
### Parameters
56+
57+
| Parameter | Type | Description |
58+
| --- | --- | --- |
59+
| secret | [TotpSecret](./auth.totpsecret.md#totpsecret_class) | A [TotpSecret](./auth.totpsecret.md#totpsecret_class) containing the shared secret key and other TOTP parameters. |
60+
| oneTimePassword | string | One-time password from TOTP App. |
61+
62+
<b>Returns:</b>
63+
64+
[TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface)
65+
66+
A [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface) which can be used with [MultiFactorUser.enroll()](./auth.multifactoruser.md#multifactoruserenroll)<!-- -->.
67+
68+
## TotpMultiFactorGenerator.assertionForSignIn()
69+
70+
Provides a [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface) to confirm ownership of the TOTP second factor. This assertion is used to complete signIn with TOTP as the second factor.
71+
72+
<b>Signature:</b>
73+
74+
```typescript
75+
static assertionForSignIn(enrollmentId: string, oneTimePassword: string): TotpMultiFactorAssertion;
76+
```
77+
78+
### Parameters
79+
80+
| Parameter | Type | Description |
81+
| --- | --- | --- |
82+
| enrollmentId | string | identifies the enrolled TOTP second factor. |
83+
| oneTimePassword | string | One-time password from TOTP App. |
84+
85+
<b>Returns:</b>
86+
87+
[TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface)
88+
89+
A [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface) which can be used with [MultiFactorResolver.resolveSignIn()](./auth.multifactorresolver.md#multifactorresolverresolvesignin)<!-- -->.
90+
91+
## TotpMultiFactorGenerator.generateSecret()
92+
93+
Returns a promise to [TotpSecret](./auth.totpsecret.md#totpsecret_class) which contains the TOTP shared secret key and other parameters. Creates a TOTP secret as part of enrolling a TOTP second factor. Used for generating a QR code URL or inputting into a TOTP app. This method uses the auth instance corresponding to the user in the multiFactorSession.
94+
95+
<b>Signature:</b>
96+
97+
```typescript
98+
static generateSecret(session: MultiFactorSession): Promise<TotpSecret>;
99+
```
100+
101+
### Parameters
102+
103+
| Parameter | Type | Description |
104+
| --- | --- | --- |
105+
| session | [MultiFactorSession](./auth.multifactorsession.md#multifactorsession_interface) | The [MultiFactorSession](./auth.multifactorsession.md#multifactorsession_interface) that the user is part of. |
106+
107+
<b>Returns:</b>
108+
109+
Promise&lt;[TotpSecret](./auth.totpsecret.md#totpsecret_class)<!-- -->&gt;
110+
111+
A promise to [TotpSecret](./auth.totpsecret.md#totpsecret_class)<!-- -->.
112+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Project: /docs/reference/js/_project.yaml
2+
Book: /docs/reference/_book.yaml
3+
page_type: reference
4+
5+
{% comment %}
6+
DO NOT EDIT THIS FILE!
7+
This is generated by the JS SDK team, and any local changes will be
8+
overwritten. Changes should be made in the source code at
9+
https://github.com/firebase/firebase-js-sdk
10+
{% endcomment %}
11+
12+
# TotpMultiFactorInfo interface
13+
The subclass of the [MultiFactorInfo](./auth.multifactorinfo.md#multifactorinfo_interface) interface for TOTP second factors. The `factorId` of this second factor is [FactorId](./auth.md#factorid)<!-- -->.TOTP.
14+
15+
<b>Signature:</b>
16+
17+
```typescript
18+
export interface TotpMultiFactorInfo extends MultiFactorInfo
19+
```
20+
<b>Extends:</b> [MultiFactorInfo](./auth.multifactorinfo.md#multifactorinfo_interface)
21+

0 commit comments

Comments
 (0)