Skip to content

Commit 21fe1d9

Browse files
Merge master into release
2 parents 568d34f + 58bae87 commit 21fe1d9

File tree

77 files changed

+3659
-651
lines changed

Some content is hidden

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

77 files changed

+3659
-651
lines changed

.changeset/brown-beers-tease.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@firebase/firestore": minor
3+
"firebase": minor
4+
---
5+
6+
Introduces a new way to config Firestore SDK Cache.

.changeset/friendly-ads-yell.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/firestore': patch
3+
'firebase': patch
4+
---
5+
6+
Check that DOMException exists before referencing it, to fix react-native, which was broken by https://github.com/firebase/firebase-js-sdk/pull/7019 in v9.17.2.

.changeset/hot-experts-talk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/auth': patch
3+
---
4+
5+
Support TOTP as a multi-factor option in Firebase Auth/GCIP.

.changeset/plenty-radios-look.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/firestore': patch
3+
'firebase': patch
4+
---
5+
6+
Remove the deprecated gapi.auth from FirstPartyToken.

.changeset/sixty-buckets-repeat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/auth': patch
3+
---
4+
5+
Modify \_fail to use AuthErrorCode.NETWORK_REQUEST_FAILED

.changeset/wet-cooks-doubt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/analytics': patch
3+
---
4+
5+
Use the Trusted Types API when composing the gtag URL.

.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:

.github/workflows/update-api-reports.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
run: yarn build
2828
id: update-api-reports
2929
- name: Commit & Push changes
30-
uses: EndBug/add-and-commit@v7
30+
uses: EndBug/add-and-commit@v9
3131
with:
3232
add: 'common/api-review/*'
3333
message: 'Update API reports'

common/api-review/auth.api.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ export class FacebookAuthProvider extends BaseOAuthProvider {
361361
// @public
362362
export const FactorId: {
363363
readonly PHONE: "phone";
364+
readonly TOTP: "totp";
364365
};
365366

366367
// @public
@@ -745,6 +746,41 @@ export function signInWithRedirect(auth: Auth, provider: AuthProvider, resolver?
745746
// @public
746747
export function signOut(auth: Auth): Promise<void>;
747748

749+
// @public
750+
export interface TotpMultiFactorAssertion extends MultiFactorAssertion {
751+
}
752+
753+
// @public
754+
export class TotpMultiFactorGenerator {
755+
static assertionForEnrollment(secret: TotpSecret, oneTimePassword: string): TotpMultiFactorAssertion;
756+
static assertionForSignIn(enrollmentId: string, oneTimePassword: string): TotpMultiFactorAssertion;
757+
// Warning: (ae-forgotten-export) The symbol "FactorId" needs to be exported by the entry point index.d.ts
758+
static FACTOR_ID: FactorId_2;
759+
static generateSecret(session: MultiFactorSession): Promise<TotpSecret>;
760+
}
761+
762+
// @public
763+
export interface TotpMultiFactorInfo extends MultiFactorInfo {
764+
}
765+
766+
// @public
767+
export class TotpSecret {
768+
readonly codeIntervalSeconds: number;
769+
readonly codeLength: number;
770+
readonly enrollmentCompletionDeadline: string;
771+
// Warning: (ae-forgotten-export) The symbol "StartTotpMfaEnrollmentResponse" needs to be exported by the entry point index.d.ts
772+
//
773+
// @internal (undocumented)
774+
static _fromStartTotpMfaEnrollmentResponse(response: StartTotpMfaEnrollmentResponse, auth: AuthInternal): TotpSecret;
775+
generateQrCodeUrl(accountName?: string, issuer?: string): string;
776+
readonly hashingAlgorithm: string;
777+
// Warning: (ae-forgotten-export) The symbol "TotpVerificationInfo" needs to be exported by the entry point index.d.ts
778+
//
779+
// @internal (undocumented)
780+
_makeTotpVerificationInfo(otp: string): TotpVerificationInfo;
781+
readonly secretKey: string;
782+
}
783+
748784
// @public
749785
export class TwitterAuthProvider extends BaseOAuthProvider {
750786
constructor();

common/api-review/firestore.api.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ export class DocumentSnapshot<T = DocumentData> {
163163

164164
export { EmulatorMockTokenOptions }
165165

166-
// @public
166+
// @public @deprecated
167167
export function enableIndexedDbPersistence(firestore: Firestore, persistenceSettings?: PersistenceSettings): Promise<void>;
168168

169-
// @public
169+
// @public @deprecated
170170
export function enableMultiTabIndexedDbPersistence(firestore: Firestore): Promise<void>;
171171

172172
// @public
@@ -219,13 +219,17 @@ export class FirestoreError extends FirebaseError {
219219
// @public
220220
export type FirestoreErrorCode = 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated';
221221

222+
// @public
223+
export type FirestoreLocalCache = MemoryLocalCache | PersistentLocalCache;
224+
222225
// @public
223226
export interface FirestoreSettings {
224227
cacheSizeBytes?: number;
225228
experimentalAutoDetectLongPolling?: boolean;
226229
experimentalForceLongPolling?: boolean;
227230
host?: string;
228231
ignoreUndefinedProperties?: boolean;
232+
localCache?: FirestoreLocalCache;
229233
ssl?: boolean;
230234
}
231235

@@ -327,6 +331,15 @@ export interface LoadBundleTaskProgress {
327331

328332
export { LogLevel }
329333

334+
// @public
335+
export interface MemoryLocalCache {
336+
// (undocumented)
337+
kind: 'memory';
338+
}
339+
340+
// @public
341+
export function memoryLocalCache(): MemoryLocalCache;
342+
330343
// @public
331344
export function namedQuery(firestore: Firestore, name: string): Promise<Query | null>;
332345

@@ -404,6 +417,47 @@ export interface PersistenceSettings {
404417
forceOwnership?: boolean;
405418
}
406419

420+
// @public
421+
export interface PersistentCacheSettings {
422+
cacheSizeBytes?: number;
423+
tabManager?: PersistentTabManager;
424+
}
425+
426+
// @public
427+
export interface PersistentLocalCache {
428+
// (undocumented)
429+
kind: 'persistent';
430+
}
431+
432+
// @public
433+
export function persistentLocalCache(settings?: PersistentCacheSettings): PersistentLocalCache;
434+
435+
// @public
436+
export interface PersistentMultipleTabManager {
437+
// (undocumented)
438+
kind: 'PersistentMultipleTab';
439+
}
440+
441+
// @public
442+
export function persistentMultipleTabManager(): PersistentMultipleTabManager;
443+
444+
// @public
445+
export interface PersistentSingleTabManager {
446+
// (undocumented)
447+
kind: 'persistentSingleTab';
448+
}
449+
450+
// @public
451+
export function persistentSingleTabManager(settings: PersistentSingleTabManagerSettings | undefined): PersistentSingleTabManager;
452+
453+
// @public
454+
export interface PersistentSingleTabManagerSettings {
455+
forceOwnership?: boolean;
456+
}
457+
458+
// @public
459+
export type PersistentTabManager = PersistentSingleTabManager | PersistentMultipleTabManager;
460+
407461
// @public
408462
export type Primitive = string | number | boolean | undefined | null;
409463

docs-devsite/auth.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ Firebase Authentication
9393
| [PhoneMultiFactorGenerator](./auth.phonemultifactorgenerator.md#phonemultifactorgenerator_class) | Provider for generating a [PhoneMultiFactorAssertion](./auth.phonemultifactorassertion.md#phonemultifactorassertion_interface)<!-- -->. |
9494
| [RecaptchaVerifier](./auth.recaptchaverifier.md#recaptchaverifier_class) | An [reCAPTCHA](https://www.google.com/recaptcha/)<!-- -->-based application verifier. |
9595
| [SAMLAuthProvider](./auth.samlauthprovider.md#samlauthprovider_class) | An [AuthProvider](./auth.authprovider.md#authprovider_interface) for SAML. |
96+
| [TotpMultiFactorGenerator](./auth.totpmultifactorgenerator.md#totpmultifactorgenerator_class) | Provider for generating a [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface)<!-- -->. |
97+
| [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. |
9698
| [TwitterAuthProvider](./auth.twitterauthprovider.md#twitterauthprovider_class) | Provider for generating an [OAuthCredential](./auth.oauthcredential.md#oauthcredential_class) for [ProviderId](./auth.md#providerid)<!-- -->.TWITTER. |
9799

98100
## Interfaces
@@ -130,6 +132,8 @@ Firebase Authentication
130132
| [PopupRedirectResolver](./auth.popupredirectresolver.md#popupredirectresolver_interface) | A resolver used for handling DOM specific operations like [signInWithPopup()](./auth.md#signinwithpopup) or [signInWithRedirect()](./auth.md#signinwithredirect)<!-- -->. |
131133
| [ReactNativeAsyncStorage](./auth.reactnativeasyncstorage.md#reactnativeasyncstorage_interface) | Interface for a supplied <code>AsyncStorage</code>. |
132134
| [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>. |
135+
| [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)<!-- -->. |
136+
| [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. |
133137
| [User](./auth.user.md#user_interface) | A user account. |
134138
| [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. |
135139
| [UserInfo](./auth.userinfo.md#userinfo_interface) | User profile information, visible only to the Firebase project's apps. |
@@ -1855,6 +1859,7 @@ An enum of factors that may be used for multifactor authentication.
18551859
```typescript
18561860
FactorId: {
18571861
readonly PHONE: "phone";
1862+
readonly TOTP: "totp";
18581863
}
18591864
```
18601865

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> | FactorId | 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: FactorId;
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)