Skip to content

Commit d64806f

Browse files
Merge master into release
2 parents 684c591 + 45a5533 commit d64806f

18 files changed

+59
-22
lines changed

.changeset/soft-zoos-listen.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/auth': patch
3+
---
4+
5+
Fix typings for `TotpMultiFactorGenerator`. This fixes a reversion in 9.19.0.

.github/CODEOWNERS

+1-1
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

common/api-review/auth.api.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -754,8 +754,7 @@ export interface TotpMultiFactorAssertion extends MultiFactorAssertion {
754754
export class TotpMultiFactorGenerator {
755755
static assertionForEnrollment(secret: TotpSecret, oneTimePassword: string): TotpMultiFactorAssertion;
756756
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;
757+
static FACTOR_ID: "totp";
759758
static generateSecret(session: MultiFactorSession): Promise<TotpSecret>;
760759
}
761760

docs-devsite/auth.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ export declare function onAuthStateChanged(auth: Auth, nextOrObserver: NextOrObs
536536

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

539-
This includes sign-in, sign-out, and token refresh events.
539+
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.
540540

541541
<b>Signature:</b>
542542

docs-devsite/auth.totpmultifactorgenerator.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export declare class TotpMultiFactorGenerator
2222

2323
| Property | Modifiers | Type | Description |
2424
| --- | --- | --- | --- |
25-
| [FACTOR\_ID](./auth.totpmultifactorgenerator.md#totpmultifactorgeneratorfactor_id) | <code>static</code> | FactorId | The identifier of the TOTP second factor: <code>totp</code>. |
25+
| [FACTOR\_ID](./auth.totpmultifactorgenerator.md#totpmultifactorgeneratorfactor_id) | <code>static</code> | 'totp' | The identifier of the TOTP second factor: <code>totp</code>. |
2626

2727
## Methods
2828

@@ -39,7 +39,7 @@ The identifier of the TOTP second factor: `totp`<!-- -->.
3939
<b>Signature:</b>
4040

4141
```typescript
42-
static FACTOR_ID: FactorId;
42+
static FACTOR_ID: 'totp';
4343
```
4444

4545
## TotpMultiFactorGenerator.assertionForEnrollment()

docs-devsite/firestore_.firestoresettings.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export declare interface FirestoreSettings
2727
| [experimentalForceLongPolling](./firestore_.firestoresettings.md#firestoresettingsexperimentalforcelongpolling) | boolean | Forces the SDKs underlying network transport (WebChannel) to use long-polling. Each response from the backend will be closed immediately after the backend sends data (by default responses are kept open in case the backend has more data to send). This avoids incompatibility issues with certain proxies, antivirus software, etc. that incorrectly buffer traffic indefinitely. Use of this option will cause some performance degradation though.<!-- -->This setting cannot be used with <code>experimentalAutoDetectLongPolling</code> and may be removed in a future release. If you find yourself using it to work around a specific network reliability issue, please tell us about it in https://github.com/firebase/firebase-js-sdk/issues/1674. |
2828
| [host](./firestore_.firestoresettings.md#firestoresettingshost) | string | The hostname to connect to. |
2929
| [ignoreUndefinedProperties](./firestore_.firestoresettings.md#firestoresettingsignoreundefinedproperties) | boolean | Whether to skip nested properties that are set to <code>undefined</code> during object serialization. If set to <code>true</code>, these properties are skipped and not written to Firestore. If set to <code>false</code> or omitted, the SDK throws an exception when it encounters properties of type <code>undefined</code>. |
30-
| [localCache](./firestore_.firestoresettings.md#firestoresettingslocalcache) | [FirestoreLocalCache](./firestore_.md#firestorelocalcache) | Specifies the cache used by the SDK. Availabe options are <code>MemoryLocalCache</code> and <code>IndexedDbLocalCache</code>, each with different configuration options.<!-- -->When unspecified, <code>MemoryLocalCache</code> will be used by default.<!-- -->NOTE: setting this field and <code>cacheSizeBytes</code> at the same time will throw exception during SDK initialization. Instead, using the configuration in the <code>FirestoreLocalCache</code> object to specify the cache size. |
30+
| [localCache](./firestore_.firestoresettings.md#firestoresettingslocalcache) | [FirestoreLocalCache](./firestore_.md#firestorelocalcache) | Specifies the cache used by the SDK. Available options are <code>MemoryLocalCache</code> and <code>IndexedDbLocalCache</code>, each with different configuration options.<!-- -->When unspecified, <code>MemoryLocalCache</code> will be used by default.<!-- -->NOTE: setting this field and <code>cacheSizeBytes</code> at the same time will throw exception during SDK initialization. Instead, using the configuration in the <code>FirestoreLocalCache</code> object to specify the cache size. |
3131
| [ssl](./firestore_.firestoresettings.md#firestoresettingsssl) | boolean | Whether to use SSL when connecting. |
3232

3333
## FirestoreSettings.cacheSizeBytes
@@ -90,7 +90,7 @@ ignoreUndefinedProperties?: boolean;
9090

9191
## FirestoreSettings.localCache
9292

93-
Specifies the cache used by the SDK. Availabe options are `MemoryLocalCache` and `IndexedDbLocalCache`<!-- -->, each with different configuration options.
93+
Specifies the cache used by the SDK. Available options are `MemoryLocalCache` and `IndexedDbLocalCache`<!-- -->, each with different configuration options.
9494

9595
When unspecified, `MemoryLocalCache` will be used by default.
9696

docs-devsite/firestore_.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ https://github.com/firebase/firebase-js-sdk
157157
| [PersistenceSettings](./firestore_.persistencesettings.md#persistencesettings_interface) | Settings that can be passed to <code>enableIndexedDbPersistence()</code> to configure Firestore persistence. |
158158
| [PersistentCacheSettings](./firestore_.persistentcachesettings.md#persistentcachesettings_interface) | An settings object to configure an <code>PersistentLocalCache</code> instance. |
159159
| [PersistentLocalCache](./firestore_.persistentlocalcache.md#persistentlocalcache_interface) | Provides a persistent cache backed by IndexedDb to the SDK.<!-- -->To use, create an instance using the factory function , then set the instance to <code>FirestoreSettings.cache</code> and call <code>initializeFirestore</code> using the settings object. |
160-
| [PersistentMultipleTabManager](./firestore_.persistentmultipletabmanager.md#persistentmultipletabmanager_interface) | A tab manager supportting multiple tabs. SDK will synchronize queries and mutations done across all tabs using the SDK. |
160+
| [PersistentMultipleTabManager](./firestore_.persistentmultipletabmanager.md#persistentmultipletabmanager_interface) | A tab manager supporting multiple tabs. SDK will synchronize queries and mutations done across all tabs using the SDK. |
161161
| [PersistentSingleTabManager](./firestore_.persistentsingletabmanager.md#persistentsingletabmanager_interface) | A tab manager supportting only one tab, no synchronization will be performed across tabs. |
162-
| [PersistentSingleTabManagerSettings](./firestore_.persistentsingletabmanagersettings.md#persistentsingletabmanagersettings_interface) | Type to configure an <code>PersistentSingleTabManager</code> instace. |
162+
| [PersistentSingleTabManagerSettings](./firestore_.persistentsingletabmanagersettings.md#persistentsingletabmanagersettings_interface) | Type to configure an <code>PersistentSingleTabManager</code> instance. |
163163
| [SnapshotListenOptions](./firestore_.snapshotlistenoptions.md#snapshotlistenoptions_interface) | An options object that can be passed to [onSnapshot()](./firestore_.md#onsnapshot) and [QuerySnapshot.docChanges()](./firestore_.querysnapshot.md#querysnapshotdocchanges) to control which types of changes to include in the result set. |
164164
| [SnapshotOptions](./firestore_.snapshotoptions.md#snapshotoptions_interface) | Options that configure how data is retrieved from a <code>DocumentSnapshot</code> (for example the desired behavior for server timestamps that have not yet been set to their final value). |
165165
| [TransactionOptions](./firestore_.transactionoptions.md#transactionoptions_interface) | Options to customize transaction behavior. |
@@ -185,7 +185,7 @@ https://github.com/firebase/firebase-js-sdk
185185
| [NestedUpdateFields](./firestore_.md#nestedupdatefields) | For each field (e.g. 'bar'), find all nested keys (e.g. {<!-- -->'bar.baz': T1, 'bar.qux': T2<!-- -->}<!-- -->). Intersect them together to make a single map containing all possible keys that are all marked as optional |
186186
| [OrderByDirection](./firestore_.md#orderbydirection) | The direction of a [orderBy()](./firestore_.md#orderby) clause is specified as 'desc' or 'asc' (descending or ascending). |
187187
| [PartialWithFieldValue](./firestore_.md#partialwithfieldvalue) | Similar to Typescript's <code>Partial&lt;T&gt;</code>, but allows nested fields to be omitted and FieldValues to be passed in as property values. |
188-
| [PersistentTabManager](./firestore_.md#persistenttabmanager) | A union of all avaialbe tab managers. |
188+
| [PersistentTabManager](./firestore_.md#persistenttabmanager) | A union of all available tab managers. |
189189
| [Primitive](./firestore_.md#primitive) | Primitive types. |
190190
| [QueryConstraintType](./firestore_.md#queryconstrainttype) | Describes the different query constraints available in this SDK. |
191191
| [QueryFilterConstraint](./firestore_.md#queryfilterconstraint) | <code>QueryFilterConstraint</code> is a helper union type that represents [QueryFieldFilterConstraint](./firestore_.queryfieldfilterconstraint.md#queryfieldfilterconstraint_class) and [QueryCompositeFilterConstraint](./firestore_.querycompositefilterconstraint.md#querycompositefilterconstraint_class)<!-- -->. |
@@ -2208,7 +2208,7 @@ export declare type PartialWithFieldValue<T> = Partial<T> | (T extends Primitive
22082208

22092209
## PersistentTabManager
22102210

2211-
A union of all avaialbe tab managers.
2211+
A union of all available tab managers.
22122212

22132213
<b>Signature:</b>
22142214

docs-devsite/firestore_.persistentmultipletabmanager.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# PersistentMultipleTabManager interface
13-
A tab manager supportting multiple tabs. SDK will synchronize queries and mutations done across all tabs using the SDK.
13+
A tab manager supporting multiple tabs. SDK will synchronize queries and mutations done across all tabs using the SDK.
1414

1515
<b>Signature:</b>
1616

docs-devsite/firestore_.persistentsingletabmanagersettings.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# PersistentSingleTabManagerSettings interface
13-
Type to configure an `PersistentSingleTabManager` instace.
13+
Type to configure an `PersistentSingleTabManager` instance.
1414

1515
<b>Signature:</b>
1616

packages/auth/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ commands also run various tests:
4040
* `yarn test:webdriver` — Executes only the Selenium WebDriver
4141
integration tests
4242

43+
Note - The webdriver tests require the Chrome webdriver to match the version of Chrome running locally.
44+
In the CI environment, this is ensured using the environment variable [here.](https://github.com/firebase/firebase-js-sdk/blob/6e80a678fe0c31046860554cec0459a2be34d22b/.github/workflows/test-changed-auth.yml#L7)
45+
When running locally, change the chromedriver version in [package.json](https://github.com/firebase/firebase-js-sdk/blob/6e80a678fe0c31046860554cec0459a2be34d22b/packages/auth/package.json#L124) to match your local Chrome version and run `yarn install`.
46+
47+
4348
For example, to run all integration and WebDriver tests against the emulator,
4449
you would simply execute the following command:
4550

packages/auth/api-extractor.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
"untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts",
77
"publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.ts"
88
}
9-
}
9+
}

packages/auth/src/api/authentication/email_and_password.test.ts

+26-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe('api/authentication/signInWithPassword', () => {
7676
);
7777
});
7878

79-
it('should handle errors', async () => {
79+
it('should handle errors for invalid password', async () => {
8080
const mock = mockEndpoint(
8181
Endpoint.SIGN_IN_WITH_PASSWORD,
8282
{
@@ -99,6 +99,31 @@ describe('api/authentication/signInWithPassword', () => {
9999
);
100100
expect(mock.calls[0].request).to.eql(request);
101101
});
102+
103+
it('should handle errors for missing password', async () => {
104+
request.password = '';
105+
const mock = mockEndpoint(
106+
Endpoint.SIGN_IN_WITH_PASSWORD,
107+
{
108+
error: {
109+
code: 400,
110+
message: ServerError.MISSING_PASSWORD,
111+
errors: [
112+
{
113+
message: ServerError.MISSING_PASSWORD
114+
}
115+
]
116+
}
117+
},
118+
400
119+
);
120+
121+
await expect(signInWithPassword(auth, request)).to.be.rejectedWith(
122+
FirebaseError,
123+
'Firebase: A non-empty password must be provided (auth/missing-password).'
124+
);
125+
expect(mock.calls[0].request).to.eql(request);
126+
});
102127
});
103128

104129
describe('api/authentication/sendEmailVerification', () => {

packages/auth/src/api/errors.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export const SERVER_ERROR_MAP: Partial<ServerErrorMap<ServerError>> = {
134134
// Sign in with email and password errors (some apply to sign up too).
135135
[ServerError.INVALID_PASSWORD]: AuthErrorCode.INVALID_PASSWORD,
136136
// This can only happen if the SDK sends a bad request.
137-
[ServerError.MISSING_PASSWORD]: AuthErrorCode.INTERNAL_ERROR,
137+
[ServerError.MISSING_PASSWORD]: AuthErrorCode.MISSING_PASSWORD,
138138

139139
// Sign up with email and password errors.
140140
[ServerError.EMAIL_EXISTS]: AuthErrorCode.EMAIL_EXISTS,

packages/auth/src/core/errors.ts

+2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export const enum AuthErrorCode {
8989
MISSING_MFA_INFO = 'missing-multi-factor-info',
9090
MISSING_MFA_SESSION = 'missing-multi-factor-session',
9191
MISSING_PHONE_NUMBER = 'missing-phone-number',
92+
MISSING_PASSWORD = 'missing-password',
9293
MISSING_SESSION_INFO = 'missing-verification-id',
9394
MODULE_DESTROYED = 'app-deleted',
9495
NEED_CONFIRMATION = 'account-exists-with-different-credential',
@@ -267,6 +268,7 @@ function _debugErrorMap(): ErrorMap<AuthErrorCode> {
267268
'The request does not contain a valid nonce. This can occur if the ' +
268269
'SHA-256 hash of the provided raw nonce does not match the hashed nonce ' +
269270
'in the ID token payload.',
271+
[AuthErrorCode.MISSING_PASSWORD]: 'A non-empty password must be provided',
270272
[AuthErrorCode.MISSING_MFA_INFO]:
271273
'No second factor identifier is provided.',
272274
[AuthErrorCode.MISSING_MFA_SESSION]:

packages/auth/src/core/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export function setPersistence(
6565
*
6666
* @remarks
6767
* This includes sign-in, sign-out, and token refresh events.
68+
* This will not be triggered automatically upon ID token expiration. Use {@link User.getIdToken} to refresh the ID token.
6869
*
6970
* @param auth - The {@link Auth} instance.
7071
* @param nextOrObserver - callback triggered on change.

packages/auth/src/mfa/assertions/totp.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export class TotpMultiFactorGenerator {
107107
/**
108108
* The identifier of the TOTP second factor: `totp`.
109109
*/
110-
static FACTOR_ID = FactorId.TOTP;
110+
static FACTOR_ID: 'totp' = FactorId.TOTP;
111111
}
112112

113113
export class TotpMultiFactorAssertionImpl

packages/firestore/src/api/cache_config.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class SingleTabManagerImpl implements PersistentSingleTabManager {
214214
}
215215

216216
/**
217-
* A tab manager supportting multiple tabs. SDK will synchronize queries and
217+
* A tab manager supporting multiple tabs. SDK will synchronize queries and
218218
* mutations done across all tabs using the SDK.
219219
*/
220220
export type PersistentMultipleTabManager = {
@@ -265,14 +265,14 @@ class MultiTabManagerImpl implements PersistentMultipleTabManager {
265265
}
266266

267267
/**
268-
* A union of all avaialbe tab managers.
268+
* A union of all available tab managers.
269269
*/
270270
export type PersistentTabManager =
271271
| PersistentSingleTabManager
272272
| PersistentMultipleTabManager;
273273

274274
/**
275-
* Type to configure an `PersistentSingleTabManager` instace.
275+
* Type to configure an `PersistentSingleTabManager` instance.
276276
*/
277277
export type PersistentSingleTabManagerSettings = {
278278
/**

packages/firestore/src/api/settings.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export interface FirestoreSettings extends LiteSettings {
5656
cacheSizeBytes?: number;
5757

5858
/**
59-
* Specifies the cache used by the SDK. Availabe options are `MemoryLocalCache`
59+
* Specifies the cache used by the SDK. Available options are `MemoryLocalCache`
6060
* and `IndexedDbLocalCache`, each with different configuration options.
6161
*
6262
* When unspecified, `MemoryLocalCache` will be used by default.

0 commit comments

Comments
 (0)