@firebase/auth 1.1.0-canary.223ac18f7 → 1.1.0-canary.43e402fb4
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/README.md +28 -1
- package/dist/auth-public.d.ts +119 -0
- package/dist/auth.d.ts +179 -2
- package/dist/browser-cjs/{index-31b2a53e.js → index-5d30ddb7.js} +548 -274
- package/dist/browser-cjs/index-5d30ddb7.js.map +1 -0
- package/dist/browser-cjs/index.js +3 -2
- package/dist/browser-cjs/index.js.map +1 -1
- package/dist/browser-cjs/internal.js +3 -2
- package/dist/browser-cjs/internal.js.map +1 -1
- package/dist/browser-cjs/src/api/errors.d.ts +2 -1
- package/dist/browser-cjs/src/api/index.d.ts +2 -1
- package/dist/browser-cjs/src/api/password_policy/get_password_policy.d.ts +48 -0
- package/dist/browser-cjs/src/api/password_policy/get_password_policy.test.d.ts +17 -0
- package/dist/browser-cjs/src/core/auth/auth_impl.d.ts +8 -2
- package/dist/browser-cjs/src/core/auth/password_policy_impl.d.ts +59 -0
- package/dist/browser-cjs/src/core/auth/password_policy_impl.test.d.ts +17 -0
- package/dist/browser-cjs/src/core/errors.d.ts +3 -1
- package/dist/browser-cjs/src/core/index.d.ts +25 -1
- package/dist/browser-cjs/src/model/auth.d.ts +7 -2
- package/dist/browser-cjs/src/model/password_policy.d.ts +111 -0
- package/dist/browser-cjs/src/model/public_types.d.ts +88 -0
- package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +1 -0
- package/dist/browser-cjs/test/helpers/integration/helpers.d.ts +6 -0
- package/dist/browser-cjs/test/integration/flows/password_policy.test.d.ts +17 -0
- package/dist/cordova/index.js +2 -2
- package/dist/cordova/internal.js +2 -2
- package/dist/cordova/{popup_redirect-bccc74fb.js → popup_redirect-4598dd56.js} +737 -413
- package/dist/cordova/popup_redirect-4598dd56.js.map +1 -0
- package/dist/cordova/src/api/errors.d.ts +2 -1
- package/dist/cordova/src/api/index.d.ts +2 -1
- package/dist/cordova/src/api/password_policy/get_password_policy.d.ts +48 -0
- package/dist/cordova/src/api/password_policy/get_password_policy.test.d.ts +17 -0
- package/dist/cordova/src/core/auth/auth_impl.d.ts +8 -2
- package/dist/cordova/src/core/auth/password_policy_impl.d.ts +59 -0
- package/dist/cordova/src/core/auth/password_policy_impl.test.d.ts +17 -0
- package/dist/cordova/src/core/errors.d.ts +3 -1
- package/dist/cordova/src/core/index.d.ts +25 -1
- package/dist/cordova/src/model/auth.d.ts +7 -2
- package/dist/cordova/src/model/password_policy.d.ts +111 -0
- package/dist/cordova/src/model/public_types.d.ts +88 -0
- package/dist/cordova/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +1 -0
- package/dist/cordova/test/helpers/integration/helpers.d.ts +6 -0
- package/dist/cordova/test/integration/flows/password_policy.test.d.ts +17 -0
- package/dist/esm2017/{index-16baa9d6.js → index-2294ce52.js} +548 -275
- package/dist/esm2017/index-2294ce52.js.map +1 -0
- package/dist/esm2017/index.js +2 -2
- package/dist/esm2017/internal.js +3 -3
- package/dist/esm2017/src/api/errors.d.ts +2 -1
- package/dist/esm2017/src/api/index.d.ts +2 -1
- package/dist/esm2017/src/api/password_policy/get_password_policy.d.ts +48 -0
- package/dist/esm2017/src/api/password_policy/get_password_policy.test.d.ts +17 -0
- package/dist/esm2017/src/core/auth/auth_impl.d.ts +8 -2
- package/dist/esm2017/src/core/auth/password_policy_impl.d.ts +59 -0
- package/dist/esm2017/src/core/auth/password_policy_impl.test.d.ts +17 -0
- package/dist/esm2017/src/core/errors.d.ts +3 -1
- package/dist/esm2017/src/core/index.d.ts +25 -1
- package/dist/esm2017/src/model/auth.d.ts +7 -2
- package/dist/esm2017/src/model/password_policy.d.ts +111 -0
- package/dist/esm2017/src/model/public_types.d.ts +88 -0
- package/dist/esm2017/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +1 -0
- package/dist/esm2017/test/helpers/integration/helpers.d.ts +6 -0
- package/dist/esm2017/test/integration/flows/password_policy.test.d.ts +17 -0
- package/dist/esm5/{index-0314ed4f.js → index-ee38001e.js} +737 -413
- package/dist/esm5/index-ee38001e.js.map +1 -0
- package/dist/esm5/index.js +1 -1
- package/dist/esm5/internal.js +2 -2
- package/dist/esm5/src/api/errors.d.ts +2 -1
- package/dist/esm5/src/api/index.d.ts +2 -1
- package/dist/esm5/src/api/password_policy/get_password_policy.d.ts +48 -0
- package/dist/esm5/src/api/password_policy/get_password_policy.test.d.ts +17 -0
- package/dist/esm5/src/core/auth/auth_impl.d.ts +8 -2
- package/dist/esm5/src/core/auth/password_policy_impl.d.ts +59 -0
- package/dist/esm5/src/core/auth/password_policy_impl.test.d.ts +17 -0
- package/dist/esm5/src/core/errors.d.ts +3 -1
- package/dist/esm5/src/core/index.d.ts +25 -1
- package/dist/esm5/src/model/auth.d.ts +7 -2
- package/dist/esm5/src/model/password_policy.d.ts +111 -0
- package/dist/esm5/src/model/public_types.d.ts +88 -0
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +1 -0
- package/dist/esm5/test/helpers/integration/helpers.d.ts +6 -0
- package/dist/esm5/test/integration/flows/password_policy.test.d.ts +17 -0
- package/dist/index.webworker.esm5.js +811 -487
- package/dist/index.webworker.esm5.js.map +1 -1
- package/dist/node/index.js +2 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/internal.js +2 -1
- package/dist/node/internal.js.map +1 -1
- package/dist/node/src/api/errors.d.ts +2 -1
- package/dist/node/src/api/index.d.ts +2 -1
- package/dist/node/src/api/password_policy/get_password_policy.d.ts +48 -0
- package/dist/node/src/api/password_policy/get_password_policy.test.d.ts +17 -0
- package/dist/node/src/core/auth/auth_impl.d.ts +8 -2
- package/dist/node/src/core/auth/password_policy_impl.d.ts +59 -0
- package/dist/node/src/core/auth/password_policy_impl.test.d.ts +17 -0
- package/dist/node/src/core/errors.d.ts +3 -1
- package/dist/node/src/core/index.d.ts +25 -1
- package/dist/node/src/model/auth.d.ts +7 -2
- package/dist/node/src/model/password_policy.d.ts +111 -0
- package/dist/node/src/model/public_types.d.ts +88 -0
- package/dist/node/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +1 -0
- package/dist/node/test/helpers/integration/helpers.d.ts +6 -0
- package/dist/node/test/integration/flows/password_policy.test.d.ts +17 -0
- package/dist/node/{totp-c151a9c0.js → totp-7310c4a7.js} +700 -375
- package/dist/node/totp-7310c4a7.js.map +1 -0
- package/dist/node-esm/index.js +1 -1
- package/dist/node-esm/internal.js +2 -2
- package/dist/node-esm/src/api/errors.d.ts +2 -1
- package/dist/node-esm/src/api/index.d.ts +2 -1
- package/dist/node-esm/src/api/password_policy/get_password_policy.d.ts +48 -0
- package/dist/node-esm/src/api/password_policy/get_password_policy.test.d.ts +17 -0
- package/dist/node-esm/src/core/auth/auth_impl.d.ts +8 -2
- package/dist/node-esm/src/core/auth/password_policy_impl.d.ts +59 -0
- package/dist/node-esm/src/core/auth/password_policy_impl.test.d.ts +17 -0
- package/dist/node-esm/src/core/errors.d.ts +3 -1
- package/dist/node-esm/src/core/index.d.ts +25 -1
- package/dist/node-esm/src/model/auth.d.ts +7 -2
- package/dist/node-esm/src/model/password_policy.d.ts +111 -0
- package/dist/node-esm/src/model/public_types.d.ts +88 -0
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +1 -0
- package/dist/node-esm/test/helpers/integration/helpers.d.ts +6 -0
- package/dist/node-esm/test/integration/flows/password_policy.test.d.ts +17 -0
- package/dist/node-esm/{totp-6e12cca6.js → totp-7ceda43e.js} +540 -267
- package/dist/node-esm/totp-7ceda43e.js.map +1 -0
- package/dist/rn/index.js +2 -1
- package/dist/rn/index.js.map +1 -1
- package/dist/rn/internal.js +2 -1
- package/dist/rn/internal.js.map +1 -1
- package/dist/rn/{phone-5ff0818b.js → phone-04dbe0a4.js} +717 -392
- package/dist/rn/phone-04dbe0a4.js.map +1 -0
- package/dist/rn/src/api/errors.d.ts +2 -1
- package/dist/rn/src/api/index.d.ts +2 -1
- package/dist/rn/src/api/password_policy/get_password_policy.d.ts +48 -0
- package/dist/rn/src/api/password_policy/get_password_policy.test.d.ts +17 -0
- package/dist/rn/src/core/auth/auth_impl.d.ts +8 -2
- package/dist/rn/src/core/auth/password_policy_impl.d.ts +59 -0
- package/dist/rn/src/core/auth/password_policy_impl.test.d.ts +17 -0
- package/dist/rn/src/core/errors.d.ts +3 -1
- package/dist/rn/src/core/index.d.ts +25 -1
- package/dist/rn/src/model/auth.d.ts +7 -2
- package/dist/rn/src/model/password_policy.d.ts +111 -0
- package/dist/rn/src/model/public_types.d.ts +88 -0
- package/dist/rn/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +1 -0
- package/dist/rn/test/helpers/integration/helpers.d.ts +6 -0
- package/dist/rn/test/integration/flows/password_policy.test.d.ts +17 -0
- package/dist/src/api/errors.d.ts +2 -1
- package/dist/src/api/index.d.ts +2 -1
- package/dist/src/api/password_policy/get_password_policy.d.ts +48 -0
- package/dist/src/api/password_policy/get_password_policy.test.d.ts +17 -0
- package/dist/src/core/auth/auth_impl.d.ts +8 -2
- package/dist/src/core/auth/password_policy_impl.d.ts +59 -0
- package/dist/src/core/auth/password_policy_impl.test.d.ts +17 -0
- package/dist/src/core/errors.d.ts +3 -1
- package/dist/src/core/index.d.ts +25 -1
- package/dist/src/model/auth.d.ts +7 -2
- package/dist/src/model/password_policy.d.ts +111 -0
- package/dist/src/model/public_types.d.ts +88 -0
- package/dist/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +1 -0
- package/dist/test/helpers/integration/helpers.d.ts +6 -0
- package/dist/test/integration/flows/password_policy.test.d.ts +17 -0
- package/package.json +6 -6
- package/dist/browser-cjs/index-31b2a53e.js.map +0 -1
- package/dist/cordova/popup_redirect-bccc74fb.js.map +0 -1
- package/dist/esm2017/index-16baa9d6.js.map +0 -1
- package/dist/esm5/index-0314ed4f.js.map +0 -1
- package/dist/node/totp-c151a9c0.js.map +0 -1
- package/dist/node-esm/totp-6e12cca6.js.map +0 -1
- package/dist/rn/phone-5ff0818b.js.map +0 -1
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ firebase emulators:exec --project foo-bar --only auth "yarn test:integration:loc
|
|
|
54
54
|
|
|
55
55
|
### Integration testing with the production backend
|
|
56
56
|
|
|
57
|
-
Currently, MFA TOTP tests only run against the production backend (since they are not supported on the emulator yet).
|
|
57
|
+
Currently, MFA TOTP and password policy tests only run against the production backend (since they are not supported on the emulator yet).
|
|
58
58
|
Running against the backend also makes it a more reliable end-to-end test.
|
|
59
59
|
|
|
60
60
|
The TOTP tests require the following email/password combination to exist in the project, so if you are running this test against your test project, please create this user:
|
|
@@ -71,6 +71,33 @@ curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Conten
|
|
|
71
71
|
}'
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
+
The password policy tests require a tenant configured with a password policy that requires all options to exist in the project.
|
|
75
|
+
|
|
76
|
+
If you are running this test against your test project, please create the tenant and configure the policy with the following curl command:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" -H "X-Goog-User-Project: ${PROJECT_ID}" -X POST https://identitytoolkit.googleapis.com/v2/projects/${PROJECT_ID}/tenants -d '{
|
|
80
|
+
"displayName": "passpol-tenant",
|
|
81
|
+
"passwordPolicyConfig": {
|
|
82
|
+
"passwordPolicyEnforcementState": "ENFORCE",
|
|
83
|
+
"passwordPolicyVersions": [
|
|
84
|
+
{
|
|
85
|
+
"customStrengthOptions": {
|
|
86
|
+
"minPasswordLength": 8,
|
|
87
|
+
"maxPasswordLength": 24,
|
|
88
|
+
"containsLowercaseCharacter": true,
|
|
89
|
+
"containsUppercaseCharacter": true,
|
|
90
|
+
"containsNumericCharacter": true,
|
|
91
|
+
"containsNonAlphanumericCharacter": true
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
}'
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Replace the tenant ID `passpol-tenant-d7hha` in [test/integration/flows/password_policy.test.ts](https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth/test/integration/flows/password_policy.test.ts) with the ID for the newly created tenant. The tenant ID can be found at the end of the `name` property in the response and is in the format `passpol-tenant-xxxxx`.
|
|
100
|
+
|
|
74
101
|
### Selenium Webdriver tests
|
|
75
102
|
|
|
76
103
|
These tests assume that you have both Firefox and Chrome installed on your
|
package/dist/auth-public.d.ts
CHANGED
|
@@ -2254,6 +2254,100 @@ export declare interface ParsedToken {
|
|
|
2254
2254
|
[key: string]: unknown;
|
|
2255
2255
|
}
|
|
2256
2256
|
|
|
2257
|
+
/**
|
|
2258
|
+
* A structure specifying password policy requirements.
|
|
2259
|
+
*
|
|
2260
|
+
* @public
|
|
2261
|
+
*/
|
|
2262
|
+
export declare interface PasswordPolicy {
|
|
2263
|
+
/**
|
|
2264
|
+
* Requirements enforced by this password policy.
|
|
2265
|
+
*/
|
|
2266
|
+
readonly customStrengthOptions: {
|
|
2267
|
+
/**
|
|
2268
|
+
* Minimum password length, or undefined if not configured.
|
|
2269
|
+
*/
|
|
2270
|
+
readonly minPasswordLength?: number;
|
|
2271
|
+
/**
|
|
2272
|
+
* Maximum password length, or undefined if not configured.
|
|
2273
|
+
*/
|
|
2274
|
+
readonly maxPasswordLength?: number;
|
|
2275
|
+
/**
|
|
2276
|
+
* Whether the password should contain a lowercase letter, or undefined if not configured.
|
|
2277
|
+
*/
|
|
2278
|
+
readonly containsLowercaseLetter?: boolean;
|
|
2279
|
+
/**
|
|
2280
|
+
* Whether the password should contain an uppercase letter, or undefined if not configured.
|
|
2281
|
+
*/
|
|
2282
|
+
readonly containsUppercaseLetter?: boolean;
|
|
2283
|
+
/**
|
|
2284
|
+
* Whether the password should contain a numeric character, or undefined if not configured.
|
|
2285
|
+
*/
|
|
2286
|
+
readonly containsNumericCharacter?: boolean;
|
|
2287
|
+
/**
|
|
2288
|
+
* Whether the password should contain a non-alphanumeric character, or undefined if not configured.
|
|
2289
|
+
*/
|
|
2290
|
+
readonly containsNonAlphanumericCharacter?: boolean;
|
|
2291
|
+
};
|
|
2292
|
+
/**
|
|
2293
|
+
* List of characters that are considered non-alphanumeric during validation.
|
|
2294
|
+
*/
|
|
2295
|
+
readonly allowedNonAlphanumericCharacters: string;
|
|
2296
|
+
/**
|
|
2297
|
+
* The enforcement state of the policy. Can be 'OFF' or 'ENFORCE'.
|
|
2298
|
+
*/
|
|
2299
|
+
readonly enforcementState: string;
|
|
2300
|
+
/**
|
|
2301
|
+
* Whether existing passwords must meet the policy.
|
|
2302
|
+
*/
|
|
2303
|
+
readonly forceUpgradeOnSignin: boolean;
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
/* Excluded from this release type: PasswordPolicyCustomStrengthOptions */
|
|
2307
|
+
|
|
2308
|
+
/* Excluded from this release type: PasswordPolicyInternal */
|
|
2309
|
+
|
|
2310
|
+
/**
|
|
2311
|
+
* A structure indicating which password policy requirements were met or violated and what the
|
|
2312
|
+
* requirements are.
|
|
2313
|
+
*
|
|
2314
|
+
* @public
|
|
2315
|
+
*/
|
|
2316
|
+
export declare interface PasswordValidationStatus {
|
|
2317
|
+
/**
|
|
2318
|
+
* Whether the password meets all requirements.
|
|
2319
|
+
*/
|
|
2320
|
+
readonly isValid: boolean;
|
|
2321
|
+
/**
|
|
2322
|
+
* Whether the password meets the minimum password length, or undefined if not required.
|
|
2323
|
+
*/
|
|
2324
|
+
readonly meetsMinPasswordLength?: boolean;
|
|
2325
|
+
/**
|
|
2326
|
+
* Whether the password meets the maximum password length, or undefined if not required.
|
|
2327
|
+
*/
|
|
2328
|
+
readonly meetsMaxPasswordLength?: boolean;
|
|
2329
|
+
/**
|
|
2330
|
+
* Whether the password contains a lowercase letter, or undefined if not required.
|
|
2331
|
+
*/
|
|
2332
|
+
readonly containsLowercaseLetter?: boolean;
|
|
2333
|
+
/**
|
|
2334
|
+
* Whether the password contains an uppercase letter, or undefined if not required.
|
|
2335
|
+
*/
|
|
2336
|
+
readonly containsUppercaseLetter?: boolean;
|
|
2337
|
+
/**
|
|
2338
|
+
* Whether the password contains a numeric character, or undefined if not required.
|
|
2339
|
+
*/
|
|
2340
|
+
readonly containsNumericCharacter?: boolean;
|
|
2341
|
+
/**
|
|
2342
|
+
* Whether the password contains a non-alphanumeric character, or undefined if not required.
|
|
2343
|
+
*/
|
|
2344
|
+
readonly containsNonAlphanumericCharacter?: boolean;
|
|
2345
|
+
/**
|
|
2346
|
+
* The policy used to validate the password.
|
|
2347
|
+
*/
|
|
2348
|
+
readonly passwordPolicy: PasswordPolicy;
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2257
2351
|
declare type PersistedBlob = Record<string, unknown>;
|
|
2258
2352
|
|
|
2259
2353
|
/**
|
|
@@ -3743,6 +3837,31 @@ declare class UserMetadata_2 implements UserMetadata {
|
|
|
3743
3837
|
*/
|
|
3744
3838
|
export declare type UserProfile = Record<string, unknown>;
|
|
3745
3839
|
|
|
3840
|
+
/**
|
|
3841
|
+
* Validates the password against the password policy configured for the project or tenant.
|
|
3842
|
+
*
|
|
3843
|
+
* @remarks
|
|
3844
|
+
* If no tenant ID is set on the `Auth` instance, then this method will use the password
|
|
3845
|
+
* policy configured for the project. Otherwise, this method will use the policy configured
|
|
3846
|
+
* for the tenant. If a password policy has not been configured, then the default policy
|
|
3847
|
+
* configured for all projects will be used.
|
|
3848
|
+
*
|
|
3849
|
+
* If an auth flow fails because a submitted password does not meet the password policy
|
|
3850
|
+
* requirements and this method has previously been called, then this method will use the
|
|
3851
|
+
* most recent policy available when called again.
|
|
3852
|
+
*
|
|
3853
|
+
* @example
|
|
3854
|
+
* ```javascript
|
|
3855
|
+
* validatePassword(auth, 'some-password');
|
|
3856
|
+
* ```
|
|
3857
|
+
*
|
|
3858
|
+
* @param auth The {@link Auth} instance.
|
|
3859
|
+
* @param password The password to validate.
|
|
3860
|
+
*
|
|
3861
|
+
* @public
|
|
3862
|
+
*/
|
|
3863
|
+
export declare function validatePassword(auth: Auth, password: string): Promise<PasswordValidationStatus>;
|
|
3864
|
+
|
|
3746
3865
|
/**
|
|
3747
3866
|
* Sends a verification email to a new email address.
|
|
3748
3867
|
*
|
package/dist/auth.d.ts
CHANGED
|
@@ -626,7 +626,9 @@ declare const enum AuthErrorCode {
|
|
|
626
626
|
MISSING_CLIENT_TYPE = "missing-client-type",
|
|
627
627
|
MISSING_RECAPTCHA_VERSION = "missing-recaptcha-version",
|
|
628
628
|
INVALID_RECAPTCHA_VERSION = "invalid-recaptcha-version",
|
|
629
|
-
INVALID_REQ_TYPE = "invalid-req-type"
|
|
629
|
+
INVALID_REQ_TYPE = "invalid-req-type",
|
|
630
|
+
UNSUPPORTED_PASSWORD_POLICY_SCHEMA_VERSION = "unsupported-password-policy-schema-version",
|
|
631
|
+
PASSWORD_DOES_NOT_MEET_REQUIREMENTS = "password-does-not-meet-requirements"
|
|
630
632
|
}
|
|
631
633
|
|
|
632
634
|
/**
|
|
@@ -854,6 +856,8 @@ declare interface AuthInternal extends Auth {
|
|
|
854
856
|
emulatorConfig: EmulatorConfig | null;
|
|
855
857
|
_agentRecaptchaConfig: RecaptchaConfig | null;
|
|
856
858
|
_tenantRecaptchaConfigs: Record<string, RecaptchaConfig>;
|
|
859
|
+
_projectPasswordPolicy: PasswordPolicy | null;
|
|
860
|
+
_tenantPasswordPolicies: Record<string, PasswordPolicy>;
|
|
857
861
|
_canInitEmulator: boolean;
|
|
858
862
|
_isInitialized: boolean;
|
|
859
863
|
_initializationPromise: Promise<void> | null;
|
|
@@ -869,6 +873,8 @@ declare interface AuthInternal extends Auth {
|
|
|
869
873
|
_stopProactiveRefresh(): void;
|
|
870
874
|
_getPersistence(): string;
|
|
871
875
|
_getRecaptchaConfig(): RecaptchaConfig | null;
|
|
876
|
+
_getPasswordPolicyInternal(): PasswordPolicyInternal | null;
|
|
877
|
+
_updatePasswordPolicy(): Promise<void>;
|
|
872
878
|
_logFramework(framework: string): void;
|
|
873
879
|
_getFrameworks(): readonly string[];
|
|
874
880
|
_getAdditionalHeaders(): Promise<Record<string, string>>;
|
|
@@ -881,7 +887,7 @@ declare interface AuthInternal extends Auth {
|
|
|
881
887
|
_errorFactory: ErrorFactory<AuthErrorCode, AuthErrorParams>;
|
|
882
888
|
useDeviceLanguage(): void;
|
|
883
889
|
signOut(): Promise<void>;
|
|
884
|
-
|
|
890
|
+
validatePassword(password: string): Promise<PasswordValidationStatus>;
|
|
885
891
|
}
|
|
886
892
|
|
|
887
893
|
declare class AuthPopup {
|
|
@@ -2593,6 +2599,152 @@ export declare interface ParsedToken {
|
|
|
2593
2599
|
[key: string]: unknown;
|
|
2594
2600
|
}
|
|
2595
2601
|
|
|
2602
|
+
/**
|
|
2603
|
+
* A structure specifying password policy requirements.
|
|
2604
|
+
*
|
|
2605
|
+
* @public
|
|
2606
|
+
*/
|
|
2607
|
+
export declare interface PasswordPolicy {
|
|
2608
|
+
/**
|
|
2609
|
+
* Requirements enforced by this password policy.
|
|
2610
|
+
*/
|
|
2611
|
+
readonly customStrengthOptions: {
|
|
2612
|
+
/**
|
|
2613
|
+
* Minimum password length, or undefined if not configured.
|
|
2614
|
+
*/
|
|
2615
|
+
readonly minPasswordLength?: number;
|
|
2616
|
+
/**
|
|
2617
|
+
* Maximum password length, or undefined if not configured.
|
|
2618
|
+
*/
|
|
2619
|
+
readonly maxPasswordLength?: number;
|
|
2620
|
+
/**
|
|
2621
|
+
* Whether the password should contain a lowercase letter, or undefined if not configured.
|
|
2622
|
+
*/
|
|
2623
|
+
readonly containsLowercaseLetter?: boolean;
|
|
2624
|
+
/**
|
|
2625
|
+
* Whether the password should contain an uppercase letter, or undefined if not configured.
|
|
2626
|
+
*/
|
|
2627
|
+
readonly containsUppercaseLetter?: boolean;
|
|
2628
|
+
/**
|
|
2629
|
+
* Whether the password should contain a numeric character, or undefined if not configured.
|
|
2630
|
+
*/
|
|
2631
|
+
readonly containsNumericCharacter?: boolean;
|
|
2632
|
+
/**
|
|
2633
|
+
* Whether the password should contain a non-alphanumeric character, or undefined if not configured.
|
|
2634
|
+
*/
|
|
2635
|
+
readonly containsNonAlphanumericCharacter?: boolean;
|
|
2636
|
+
};
|
|
2637
|
+
/**
|
|
2638
|
+
* List of characters that are considered non-alphanumeric during validation.
|
|
2639
|
+
*/
|
|
2640
|
+
readonly allowedNonAlphanumericCharacters: string;
|
|
2641
|
+
/**
|
|
2642
|
+
* The enforcement state of the policy. Can be 'OFF' or 'ENFORCE'.
|
|
2643
|
+
*/
|
|
2644
|
+
readonly enforcementState: string;
|
|
2645
|
+
/**
|
|
2646
|
+
* Whether existing passwords must meet the policy.
|
|
2647
|
+
*/
|
|
2648
|
+
readonly forceUpgradeOnSignin: boolean;
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
/**
|
|
2652
|
+
* Internal typing of the password policy custom strength options that is modifiable. This
|
|
2653
|
+
* allows us to construct the strength options before storing them in the policy.
|
|
2654
|
+
*
|
|
2655
|
+
* @internal
|
|
2656
|
+
*/
|
|
2657
|
+
declare interface PasswordPolicyCustomStrengthOptions {
|
|
2658
|
+
/**
|
|
2659
|
+
* Minimum password length.
|
|
2660
|
+
*/
|
|
2661
|
+
minPasswordLength?: number;
|
|
2662
|
+
/**
|
|
2663
|
+
* Maximum password length.
|
|
2664
|
+
*/
|
|
2665
|
+
maxPasswordLength?: number;
|
|
2666
|
+
/**
|
|
2667
|
+
* Whether the password should contain a lowercase letter.
|
|
2668
|
+
*/
|
|
2669
|
+
containsLowercaseLetter?: boolean;
|
|
2670
|
+
/**
|
|
2671
|
+
* Whether the password should contain an uppercase letter.
|
|
2672
|
+
*/
|
|
2673
|
+
containsUppercaseLetter?: boolean;
|
|
2674
|
+
/**
|
|
2675
|
+
* Whether the password should contain a numeric character.
|
|
2676
|
+
*/
|
|
2677
|
+
containsNumericCharacter?: boolean;
|
|
2678
|
+
/**
|
|
2679
|
+
* Whether the password should contain a non-alphanumeric character.
|
|
2680
|
+
*/
|
|
2681
|
+
containsNonAlphanumericCharacter?: boolean;
|
|
2682
|
+
}
|
|
2683
|
+
|
|
2684
|
+
/**
|
|
2685
|
+
* Internal typing of password policy that includes the schema version and methods for
|
|
2686
|
+
* validating that a password meets the policy. The developer does not need access to
|
|
2687
|
+
* these properties and methods, so they are excluded from the public typing.
|
|
2688
|
+
*
|
|
2689
|
+
* @internal
|
|
2690
|
+
*/
|
|
2691
|
+
declare interface PasswordPolicyInternal extends PasswordPolicy {
|
|
2692
|
+
/**
|
|
2693
|
+
* Requirements enforced by the password policy.
|
|
2694
|
+
*/
|
|
2695
|
+
readonly customStrengthOptions: PasswordPolicyCustomStrengthOptions;
|
|
2696
|
+
/**
|
|
2697
|
+
* Schema version of the password policy.
|
|
2698
|
+
*/
|
|
2699
|
+
readonly schemaVersion: number;
|
|
2700
|
+
/**
|
|
2701
|
+
* Validates the password against the policy.
|
|
2702
|
+
* @param password Password to validate.
|
|
2703
|
+
*/
|
|
2704
|
+
validatePassword(password: string): PasswordValidationStatus;
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2707
|
+
/**
|
|
2708
|
+
* A structure indicating which password policy requirements were met or violated and what the
|
|
2709
|
+
* requirements are.
|
|
2710
|
+
*
|
|
2711
|
+
* @public
|
|
2712
|
+
*/
|
|
2713
|
+
export declare interface PasswordValidationStatus {
|
|
2714
|
+
/**
|
|
2715
|
+
* Whether the password meets all requirements.
|
|
2716
|
+
*/
|
|
2717
|
+
readonly isValid: boolean;
|
|
2718
|
+
/**
|
|
2719
|
+
* Whether the password meets the minimum password length, or undefined if not required.
|
|
2720
|
+
*/
|
|
2721
|
+
readonly meetsMinPasswordLength?: boolean;
|
|
2722
|
+
/**
|
|
2723
|
+
* Whether the password meets the maximum password length, or undefined if not required.
|
|
2724
|
+
*/
|
|
2725
|
+
readonly meetsMaxPasswordLength?: boolean;
|
|
2726
|
+
/**
|
|
2727
|
+
* Whether the password contains a lowercase letter, or undefined if not required.
|
|
2728
|
+
*/
|
|
2729
|
+
readonly containsLowercaseLetter?: boolean;
|
|
2730
|
+
/**
|
|
2731
|
+
* Whether the password contains an uppercase letter, or undefined if not required.
|
|
2732
|
+
*/
|
|
2733
|
+
readonly containsUppercaseLetter?: boolean;
|
|
2734
|
+
/**
|
|
2735
|
+
* Whether the password contains a numeric character, or undefined if not required.
|
|
2736
|
+
*/
|
|
2737
|
+
readonly containsNumericCharacter?: boolean;
|
|
2738
|
+
/**
|
|
2739
|
+
* Whether the password contains a non-alphanumeric character, or undefined if not required.
|
|
2740
|
+
*/
|
|
2741
|
+
readonly containsNonAlphanumericCharacter?: boolean;
|
|
2742
|
+
/**
|
|
2743
|
+
* The policy used to validate the password.
|
|
2744
|
+
*/
|
|
2745
|
+
readonly passwordPolicy: PasswordPolicy;
|
|
2746
|
+
}
|
|
2747
|
+
|
|
2596
2748
|
declare type PersistedBlob = Record<string, unknown>;
|
|
2597
2749
|
|
|
2598
2750
|
/**
|
|
@@ -4246,6 +4398,31 @@ declare class UserMetadata_2 implements UserMetadata {
|
|
|
4246
4398
|
*/
|
|
4247
4399
|
export declare type UserProfile = Record<string, unknown>;
|
|
4248
4400
|
|
|
4401
|
+
/**
|
|
4402
|
+
* Validates the password against the password policy configured for the project or tenant.
|
|
4403
|
+
*
|
|
4404
|
+
* @remarks
|
|
4405
|
+
* If no tenant ID is set on the `Auth` instance, then this method will use the password
|
|
4406
|
+
* policy configured for the project. Otherwise, this method will use the policy configured
|
|
4407
|
+
* for the tenant. If a password policy has not been configured, then the default policy
|
|
4408
|
+
* configured for all projects will be used.
|
|
4409
|
+
*
|
|
4410
|
+
* If an auth flow fails because a submitted password does not meet the password policy
|
|
4411
|
+
* requirements and this method has previously been called, then this method will use the
|
|
4412
|
+
* most recent policy available when called again.
|
|
4413
|
+
*
|
|
4414
|
+
* @example
|
|
4415
|
+
* ```javascript
|
|
4416
|
+
* validatePassword(auth, 'some-password');
|
|
4417
|
+
* ```
|
|
4418
|
+
*
|
|
4419
|
+
* @param auth The {@link Auth} instance.
|
|
4420
|
+
* @param password The password to validate.
|
|
4421
|
+
*
|
|
4422
|
+
* @public
|
|
4423
|
+
*/
|
|
4424
|
+
export declare function validatePassword(auth: Auth, password: string): Promise<PasswordValidationStatus>;
|
|
4425
|
+
|
|
4249
4426
|
/**
|
|
4250
4427
|
* Sends a verification email to a new email address.
|
|
4251
4428
|
*
|