firebase-admin 12.6.0 → 12.7.0
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/lib/app/core.d.ts +1 -1
- package/lib/app/core.js +1 -1
- package/lib/app/credential-factory.d.ts +1 -1
- package/lib/app/credential-factory.js +1 -1
- package/lib/app/credential-internal.d.ts +1 -1
- package/lib/app/credential-internal.js +1 -1
- package/lib/app/credential.d.ts +1 -1
- package/lib/app/credential.js +1 -1
- package/lib/app/firebase-app.d.ts +1 -1
- package/lib/app/firebase-app.js +1 -1
- package/lib/app/firebase-namespace.d.ts +1 -1
- package/lib/app/firebase-namespace.js +1 -1
- package/lib/app/index.d.ts +1 -1
- package/lib/app/index.js +1 -1
- package/lib/app/lifecycle.d.ts +1 -1
- package/lib/app/lifecycle.js +1 -1
- package/lib/app-check/app-check-api-client-internal.d.ts +1 -1
- package/lib/app-check/app-check-api-client-internal.js +1 -1
- package/lib/app-check/app-check-api.d.ts +1 -1
- package/lib/app-check/app-check-api.js +1 -1
- package/lib/app-check/app-check-namespace.d.ts +1 -1
- package/lib/app-check/app-check-namespace.js +1 -1
- package/lib/app-check/app-check.d.ts +1 -1
- package/lib/app-check/app-check.js +1 -1
- package/lib/app-check/index.d.ts +1 -1
- package/lib/app-check/index.js +1 -1
- package/lib/app-check/token-generator.d.ts +1 -1
- package/lib/app-check/token-generator.js +1 -1
- package/lib/app-check/token-verifier.d.ts +1 -1
- package/lib/app-check/token-verifier.js +1 -1
- package/lib/auth/action-code-settings-builder.d.ts +1 -1
- package/lib/auth/action-code-settings-builder.js +1 -1
- package/lib/auth/auth-api-request.d.ts +1 -1
- package/lib/auth/auth-api-request.js +4 -3
- package/lib/auth/auth-config.d.ts +41 -17
- package/lib/auth/auth-config.js +112 -25
- package/lib/auth/auth-namespace.d.ts +1 -1
- package/lib/auth/auth-namespace.js +1 -1
- package/lib/auth/auth.d.ts +1 -1
- package/lib/auth/auth.js +1 -1
- package/lib/auth/base-auth.d.ts +1 -1
- package/lib/auth/base-auth.js +1 -1
- package/lib/auth/identifier.d.ts +1 -1
- package/lib/auth/identifier.js +1 -1
- package/lib/auth/index.d.ts +2 -2
- package/lib/auth/index.js +1 -1
- package/lib/auth/project-config-manager.d.ts +1 -1
- package/lib/auth/project-config-manager.js +1 -1
- package/lib/auth/project-config.d.ts +8 -8
- package/lib/auth/project-config.js +9 -9
- package/lib/auth/tenant-manager.d.ts +1 -1
- package/lib/auth/tenant-manager.js +1 -1
- package/lib/auth/tenant.d.ts +4 -4
- package/lib/auth/tenant.js +4 -4
- package/lib/auth/token-generator.d.ts +1 -1
- package/lib/auth/token-generator.js +1 -1
- package/lib/auth/token-verifier.d.ts +1 -1
- package/lib/auth/token-verifier.js +1 -1
- package/lib/auth/user-import-builder.d.ts +1 -1
- package/lib/auth/user-import-builder.js +1 -1
- package/lib/auth/user-record.d.ts +1 -1
- package/lib/auth/user-record.js +1 -1
- package/lib/credential/index.d.ts +1 -1
- package/lib/credential/index.js +1 -1
- package/lib/data-connect/data-connect-api-client-internal.d.ts +1 -1
- package/lib/data-connect/data-connect-api-client-internal.js +1 -1
- package/lib/data-connect/data-connect-api.d.ts +1 -1
- package/lib/data-connect/data-connect-api.js +1 -1
- package/lib/data-connect/data-connect.d.ts +1 -1
- package/lib/data-connect/data-connect.js +1 -1
- package/lib/data-connect/index.d.ts +1 -1
- package/lib/data-connect/index.js +1 -1
- package/lib/database/database-namespace.d.ts +1 -1
- package/lib/database/database-namespace.js +1 -1
- package/lib/database/database.d.ts +1 -1
- package/lib/database/database.js +1 -1
- package/lib/database/index.d.ts +1 -1
- package/lib/database/index.js +1 -1
- package/lib/default-namespace.d.ts +1 -1
- package/lib/default-namespace.js +1 -1
- package/lib/eventarc/cloudevent.d.ts +1 -1
- package/lib/eventarc/cloudevent.js +1 -1
- package/lib/eventarc/eventarc-client-internal.d.ts +1 -1
- package/lib/eventarc/eventarc-client-internal.js +1 -1
- package/lib/eventarc/eventarc-utils.d.ts +1 -1
- package/lib/eventarc/eventarc-utils.js +1 -1
- package/lib/eventarc/eventarc.d.ts +1 -1
- package/lib/eventarc/eventarc.js +1 -1
- package/lib/eventarc/index.d.ts +1 -1
- package/lib/eventarc/index.js +1 -1
- package/lib/extensions/extensions-api-client-internal.d.ts +1 -1
- package/lib/extensions/extensions-api-client-internal.js +1 -1
- package/lib/extensions/extensions-api.d.ts +1 -1
- package/lib/extensions/extensions-api.js +1 -1
- package/lib/extensions/extensions.d.ts +1 -1
- package/lib/extensions/extensions.js +1 -1
- package/lib/extensions/index.d.ts +1 -1
- package/lib/extensions/index.js +1 -1
- package/lib/firebase-namespace-api.d.ts +1 -1
- package/lib/firebase-namespace-api.js +1 -1
- package/lib/firestore/firestore-internal.d.ts +1 -1
- package/lib/firestore/firestore-internal.js +1 -1
- package/lib/firestore/firestore-namespace.d.ts +1 -1
- package/lib/firestore/firestore-namespace.js +1 -1
- package/lib/firestore/index.d.ts +1 -1
- package/lib/firestore/index.js +1 -1
- package/lib/functions/functions-api-client-internal.d.ts +1 -1
- package/lib/functions/functions-api-client-internal.js +5 -5
- package/lib/functions/functions-api.d.ts +1 -1
- package/lib/functions/functions-api.js +1 -1
- package/lib/functions/functions.d.ts +1 -1
- package/lib/functions/functions.js +1 -1
- package/lib/functions/index.d.ts +1 -1
- package/lib/functions/index.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/installations/index.d.ts +1 -1
- package/lib/installations/index.js +1 -1
- package/lib/installations/installations-namespace.d.ts +1 -1
- package/lib/installations/installations-namespace.js +1 -1
- package/lib/installations/installations-request-handler.d.ts +1 -1
- package/lib/installations/installations-request-handler.js +1 -1
- package/lib/installations/installations.d.ts +1 -1
- package/lib/installations/installations.js +1 -1
- package/lib/instance-id/index.d.ts +1 -1
- package/lib/instance-id/index.js +1 -1
- package/lib/instance-id/instance-id-namespace.d.ts +1 -1
- package/lib/instance-id/instance-id-namespace.js +1 -1
- package/lib/instance-id/instance-id.d.ts +1 -1
- package/lib/instance-id/instance-id.js +1 -1
- package/lib/machine-learning/index.d.ts +1 -1
- package/lib/machine-learning/index.js +1 -1
- package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
- package/lib/machine-learning/machine-learning-api-client.js +1 -1
- package/lib/machine-learning/machine-learning-namespace.d.ts +1 -1
- package/lib/machine-learning/machine-learning-namespace.js +1 -1
- package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
- package/lib/machine-learning/machine-learning-utils.js +1 -1
- package/lib/machine-learning/machine-learning.d.ts +1 -1
- package/lib/machine-learning/machine-learning.js +1 -1
- package/lib/messaging/batch-request-internal.d.ts +1 -1
- package/lib/messaging/batch-request-internal.js +1 -1
- package/lib/messaging/index.d.ts +1 -1
- package/lib/messaging/index.js +1 -1
- package/lib/messaging/messaging-api-request-internal.d.ts +1 -1
- package/lib/messaging/messaging-api-request-internal.js +3 -1
- package/lib/messaging/messaging-api.d.ts +1 -1
- package/lib/messaging/messaging-api.js +1 -1
- package/lib/messaging/messaging-errors-internal.d.ts +1 -1
- package/lib/messaging/messaging-errors-internal.js +1 -1
- package/lib/messaging/messaging-internal.d.ts +1 -1
- package/lib/messaging/messaging-internal.js +1 -1
- package/lib/messaging/messaging-namespace.d.ts +1 -1
- package/lib/messaging/messaging-namespace.js +1 -1
- package/lib/messaging/messaging.d.ts +1 -1
- package/lib/messaging/messaging.js +1 -1
- package/lib/project-management/android-app.d.ts +1 -1
- package/lib/project-management/android-app.js +1 -1
- package/lib/project-management/app-metadata.d.ts +1 -1
- package/lib/project-management/app-metadata.js +1 -1
- package/lib/project-management/index.d.ts +1 -1
- package/lib/project-management/index.js +1 -1
- package/lib/project-management/ios-app.d.ts +1 -1
- package/lib/project-management/ios-app.js +1 -1
- package/lib/project-management/project-management-api-request-internal.d.ts +1 -1
- package/lib/project-management/project-management-api-request-internal.js +1 -1
- package/lib/project-management/project-management-namespace.d.ts +1 -1
- package/lib/project-management/project-management-namespace.js +1 -1
- package/lib/project-management/project-management.d.ts +1 -1
- package/lib/project-management/project-management.js +1 -1
- package/lib/remote-config/condition-evaluator-internal.d.ts +1 -1
- package/lib/remote-config/condition-evaluator-internal.js +1 -1
- package/lib/remote-config/index.d.ts +1 -1
- package/lib/remote-config/index.js +1 -1
- package/lib/remote-config/internal/value-impl.d.ts +1 -1
- package/lib/remote-config/internal/value-impl.js +1 -1
- package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
- package/lib/remote-config/remote-config-api-client-internal.js +1 -1
- package/lib/remote-config/remote-config-api.d.ts +1 -1
- package/lib/remote-config/remote-config-api.js +1 -1
- package/lib/remote-config/remote-config-namespace.d.ts +1 -1
- package/lib/remote-config/remote-config-namespace.js +1 -1
- package/lib/remote-config/remote-config.d.ts +1 -1
- package/lib/remote-config/remote-config.js +1 -1
- package/lib/security-rules/index.d.ts +1 -1
- package/lib/security-rules/index.js +1 -1
- package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
- package/lib/security-rules/security-rules-api-client-internal.js +1 -1
- package/lib/security-rules/security-rules-internal.d.ts +1 -1
- package/lib/security-rules/security-rules-internal.js +1 -1
- package/lib/security-rules/security-rules-namespace.d.ts +1 -1
- package/lib/security-rules/security-rules-namespace.js +1 -1
- package/lib/security-rules/security-rules.d.ts +1 -1
- package/lib/security-rules/security-rules.js +1 -1
- package/lib/storage/index.d.ts +1 -1
- package/lib/storage/index.js +1 -1
- package/lib/storage/storage-namespace.d.ts +1 -1
- package/lib/storage/storage-namespace.js +1 -1
- package/lib/storage/storage.d.ts +1 -1
- package/lib/storage/storage.js +1 -1
- package/lib/storage/utils.d.ts +1 -1
- package/lib/storage/utils.js +1 -1
- package/lib/utils/api-request.d.ts +1 -1
- package/lib/utils/api-request.js +1 -1
- package/lib/utils/crypto-signer.d.ts +1 -1
- package/lib/utils/crypto-signer.js +1 -1
- package/lib/utils/deep-copy.d.ts +1 -1
- package/lib/utils/deep-copy.js +1 -1
- package/lib/utils/error.d.ts +1 -1
- package/lib/utils/error.js +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/jwt.d.ts +1 -1
- package/lib/utils/jwt.js +1 -1
- package/lib/utils/validator.d.ts +1 -1
- package/lib/utils/validator.js +1 -1
- package/package.json +3 -3
package/lib/app/core.d.ts
CHANGED
package/lib/app/core.js
CHANGED
package/lib/app/credential.d.ts
CHANGED
package/lib/app/credential.js
CHANGED
package/lib/app/firebase-app.js
CHANGED
package/lib/app/index.d.ts
CHANGED
package/lib/app/index.js
CHANGED
package/lib/app/lifecycle.d.ts
CHANGED
package/lib/app/lifecycle.js
CHANGED
package/lib/app-check/index.d.ts
CHANGED
package/lib/app-check/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v12.
|
|
1
|
+
/*! firebase-admin v12.7.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -30,8 +30,9 @@ const identifier_1 = require("./identifier");
|
|
|
30
30
|
const auth_config_1 = require("./auth-config");
|
|
31
31
|
const project_config_1 = require("./project-config");
|
|
32
32
|
/** Firebase Auth request header. */
|
|
33
|
-
const
|
|
33
|
+
const FIREBASE_AUTH_HEADERS = {
|
|
34
34
|
'X-Client-Version': `Node/Admin/${utils.getSdkVersion()}`,
|
|
35
|
+
'X-Goog-Api-Client': `gl-node/${process.versions.node} fire-admin/${utils.getSdkVersion()}`
|
|
35
36
|
};
|
|
36
37
|
/** Firebase Auth request timeout duration in milliseconds. */
|
|
37
38
|
const FIREBASE_AUTH_TIMEOUT = 25000;
|
|
@@ -1603,7 +1604,7 @@ class AbstractAuthRequestHandler {
|
|
|
1603
1604
|
const req = {
|
|
1604
1605
|
method: apiSettings.getHttpMethod(),
|
|
1605
1606
|
url,
|
|
1606
|
-
headers:
|
|
1607
|
+
headers: FIREBASE_AUTH_HEADERS,
|
|
1607
1608
|
data: requestData,
|
|
1608
1609
|
timeout: FIREBASE_AUTH_TIMEOUT,
|
|
1609
1610
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v12.
|
|
1
|
+
/*! firebase-admin v12.7.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2018 Google Inc.
|
|
4
4
|
*
|
|
@@ -662,6 +662,20 @@ export interface RecaptchaManagedRule {
|
|
|
662
662
|
*/
|
|
663
663
|
action?: RecaptchaAction;
|
|
664
664
|
}
|
|
665
|
+
/**
|
|
666
|
+
* The managed rules for toll fraud provider, containing the enforcement status.
|
|
667
|
+
* The toll fraud provider contains all SMS related user flows.
|
|
668
|
+
*/
|
|
669
|
+
export interface RecaptchaTollFraudManagedRule {
|
|
670
|
+
/**
|
|
671
|
+
* The action will be enforced if the reCAPTCHA score of a request is larger than startScore.
|
|
672
|
+
*/
|
|
673
|
+
startScore: number;
|
|
674
|
+
/**
|
|
675
|
+
* The action for reCAPTCHA-protected requests.
|
|
676
|
+
*/
|
|
677
|
+
action?: RecaptchaAction;
|
|
678
|
+
}
|
|
665
679
|
/**
|
|
666
680
|
* The key's platform type.
|
|
667
681
|
*/
|
|
@@ -690,6 +704,10 @@ export interface RecaptchaConfig {
|
|
|
690
704
|
* The enforcement state of the email password provider.
|
|
691
705
|
*/
|
|
692
706
|
emailPasswordEnforcementState?: RecaptchaProviderEnforcementState;
|
|
707
|
+
/**
|
|
708
|
+
* The enforcement state of the phone provider.
|
|
709
|
+
*/
|
|
710
|
+
phoneEnforcementState?: RecaptchaProviderEnforcementState;
|
|
693
711
|
/**
|
|
694
712
|
* The reCAPTCHA managed rules.
|
|
695
713
|
*/
|
|
@@ -703,28 +721,34 @@ export interface RecaptchaConfig {
|
|
|
703
721
|
* The default value is false.
|
|
704
722
|
*/
|
|
705
723
|
useAccountDefender?: boolean;
|
|
706
|
-
}
|
|
707
|
-
export declare class RecaptchaAuthConfig implements RecaptchaConfig {
|
|
708
|
-
readonly emailPasswordEnforcementState?: RecaptchaProviderEnforcementState;
|
|
709
|
-
readonly managedRules?: RecaptchaManagedRule[];
|
|
710
|
-
readonly recaptchaKeys?: RecaptchaKey[];
|
|
711
|
-
readonly useAccountDefender?: boolean;
|
|
712
|
-
constructor(recaptchaConfig: RecaptchaConfig);
|
|
713
724
|
/**
|
|
714
|
-
*
|
|
715
|
-
*
|
|
725
|
+
* Whether to use the rCE bot score for reCAPTCHA phone provider.
|
|
726
|
+
* Can only be true when the phone_enforcement_state is AUDIT or ENFORCE.
|
|
716
727
|
*/
|
|
717
|
-
|
|
728
|
+
useSmsBotScore?: boolean;
|
|
718
729
|
/**
|
|
719
|
-
*
|
|
720
|
-
*
|
|
730
|
+
* Whether to use the rCE SMS toll fraud protection risk score for reCAPTCHA phone provider.
|
|
731
|
+
* Can only be true when the phone_enforcement_state is AUDIT or ENFORCE.
|
|
721
732
|
*/
|
|
722
|
-
|
|
733
|
+
useSmsTollFraudProtection?: boolean;
|
|
723
734
|
/**
|
|
724
|
-
*
|
|
725
|
-
*
|
|
735
|
+
* The managed rules for toll fraud provider, containing the enforcement status.
|
|
736
|
+
* The toll fraud provider contains all SMS related user flows.
|
|
726
737
|
*/
|
|
727
|
-
|
|
738
|
+
smsTollFraudManagedRules?: RecaptchaTollFraudManagedRule[];
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Server side recaptcha configuration.
|
|
742
|
+
*/
|
|
743
|
+
export interface RecaptchaAuthServerConfig {
|
|
744
|
+
emailPasswordEnforcementState?: RecaptchaProviderEnforcementState;
|
|
745
|
+
phoneEnforcementState?: RecaptchaProviderEnforcementState;
|
|
746
|
+
managedRules?: RecaptchaManagedRule[];
|
|
747
|
+
recaptchaKeys?: RecaptchaKey[];
|
|
748
|
+
useAccountDefender?: boolean;
|
|
749
|
+
useSmsBotScore?: boolean;
|
|
750
|
+
useSmsTollFraudProtection?: boolean;
|
|
751
|
+
tollFraudManagedRules?: RecaptchaTollFraudManagedRule[];
|
|
728
752
|
}
|
|
729
753
|
/**
|
|
730
754
|
* A password policy configuration for a project or tenant
|
package/lib/auth/auth-config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v12.
|
|
1
|
+
/*! firebase-admin v12.7.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2018 Google Inc.
|
|
@@ -752,12 +752,66 @@ class SmsRegionsAuthConfig {
|
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
754
|
exports.SmsRegionsAuthConfig = SmsRegionsAuthConfig;
|
|
755
|
+
/**
|
|
756
|
+
* Defines the recaptcha config class used to convert client side RecaptchaConfig
|
|
757
|
+
* to a format that is understood by the Auth server.
|
|
758
|
+
*
|
|
759
|
+
* @internal
|
|
760
|
+
*/
|
|
755
761
|
class RecaptchaAuthConfig {
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
762
|
+
/**
|
|
763
|
+
* The RecaptchaAuthConfig constructor.
|
|
764
|
+
*
|
|
765
|
+
* @param response - The server side response used to initialize the
|
|
766
|
+
* RecaptchaAuthConfig object.
|
|
767
|
+
* @constructor
|
|
768
|
+
* @internal
|
|
769
|
+
*/
|
|
770
|
+
constructor(response) {
|
|
771
|
+
const filteredResponse = Object.fromEntries(Object.entries(response).filter(([, value]) => value !== undefined));
|
|
772
|
+
// Explicitly map the 'tollFraudManagedRules' to 'smsTollFraudManagedRules'
|
|
773
|
+
if (filteredResponse.tollFraudManagedRules !== undefined) {
|
|
774
|
+
this.smsTollFraudManagedRules = filteredResponse.tollFraudManagedRules;
|
|
775
|
+
delete filteredResponse.tollFraudManagedRules; // Remove it if necessary
|
|
776
|
+
}
|
|
777
|
+
// Assign the remaining properties directly
|
|
778
|
+
Object.assign(this, filteredResponse);
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Builds a server request object from the client-side RecaptchaConfig.
|
|
782
|
+
* Converts client-side fields to their server-side equivalents.
|
|
783
|
+
*
|
|
784
|
+
* @param options - The client-side RecaptchaConfig object.
|
|
785
|
+
* @returns The server-side RecaptchaAuthServerConfig object.
|
|
786
|
+
*/
|
|
787
|
+
static buildServerRequest(options) {
|
|
788
|
+
RecaptchaAuthConfig.validate(options); // Validate options before building request
|
|
789
|
+
const request = {};
|
|
790
|
+
if (typeof options.emailPasswordEnforcementState !== 'undefined') {
|
|
791
|
+
request.emailPasswordEnforcementState = options.emailPasswordEnforcementState;
|
|
792
|
+
}
|
|
793
|
+
if (typeof options.phoneEnforcementState !== 'undefined') {
|
|
794
|
+
request.phoneEnforcementState = options.phoneEnforcementState;
|
|
795
|
+
}
|
|
796
|
+
if (typeof options.managedRules !== 'undefined') {
|
|
797
|
+
request.managedRules = options.managedRules;
|
|
798
|
+
}
|
|
799
|
+
if (typeof options.recaptchaKeys !== 'undefined') {
|
|
800
|
+
request.recaptchaKeys = options.recaptchaKeys;
|
|
801
|
+
}
|
|
802
|
+
if (typeof options.useAccountDefender !== 'undefined') {
|
|
803
|
+
request.useAccountDefender = options.useAccountDefender;
|
|
804
|
+
}
|
|
805
|
+
if (typeof options.useSmsBotScore !== 'undefined') {
|
|
806
|
+
request.useSmsBotScore = options.useSmsBotScore;
|
|
807
|
+
}
|
|
808
|
+
if (typeof options.useSmsTollFraudProtection !== 'undefined') {
|
|
809
|
+
request.useSmsTollFraudProtection = options.useSmsTollFraudProtection;
|
|
810
|
+
}
|
|
811
|
+
if (typeof options.smsTollFraudManagedRules !== 'undefined') {
|
|
812
|
+
request.tollFraudManagedRules = options.smsTollFraudManagedRules; // Map client-side field to server-side
|
|
813
|
+
}
|
|
814
|
+
return request;
|
|
761
815
|
}
|
|
762
816
|
/**
|
|
763
817
|
* Validates the RecaptchaConfig options object. Throws an error on failure.
|
|
@@ -766,9 +820,13 @@ class RecaptchaAuthConfig {
|
|
|
766
820
|
static validate(options) {
|
|
767
821
|
const validKeys = {
|
|
768
822
|
emailPasswordEnforcementState: true,
|
|
823
|
+
phoneEnforcementState: true,
|
|
769
824
|
managedRules: true,
|
|
770
825
|
recaptchaKeys: true,
|
|
771
826
|
useAccountDefender: true,
|
|
827
|
+
useSmsBotScore: true,
|
|
828
|
+
useSmsTollFraudProtection: true,
|
|
829
|
+
smsTollFraudManagedRules: true,
|
|
772
830
|
};
|
|
773
831
|
if (!validator.isNonNullObject(options)) {
|
|
774
832
|
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaConfig" must be a non-null object.');
|
|
@@ -779,7 +837,7 @@ class RecaptchaAuthConfig {
|
|
|
779
837
|
}
|
|
780
838
|
}
|
|
781
839
|
// Validation
|
|
782
|
-
if (typeof options.emailPasswordEnforcementState !== undefined) {
|
|
840
|
+
if (typeof options.emailPasswordEnforcementState !== 'undefined') {
|
|
783
841
|
if (!validator.isNonEmptyString(options.emailPasswordEnforcementState)) {
|
|
784
842
|
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, '"RecaptchaConfig.emailPasswordEnforcementState" must be a valid non-empty string.');
|
|
785
843
|
}
|
|
@@ -789,6 +847,16 @@ class RecaptchaAuthConfig {
|
|
|
789
847
|
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaConfig.emailPasswordEnforcementState" must be either "OFF", "AUDIT" or "ENFORCE".');
|
|
790
848
|
}
|
|
791
849
|
}
|
|
850
|
+
if (typeof options.phoneEnforcementState !== 'undefined') {
|
|
851
|
+
if (!validator.isNonEmptyString(options.phoneEnforcementState)) {
|
|
852
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, '"RecaptchaConfig.phoneEnforcementState" must be a valid non-empty string.');
|
|
853
|
+
}
|
|
854
|
+
if (options.phoneEnforcementState !== 'OFF' &&
|
|
855
|
+
options.phoneEnforcementState !== 'AUDIT' &&
|
|
856
|
+
options.phoneEnforcementState !== 'ENFORCE') {
|
|
857
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaConfig.phoneEnforcementState" must be either "OFF", "AUDIT" or "ENFORCE".');
|
|
858
|
+
}
|
|
859
|
+
}
|
|
792
860
|
if (typeof options.managedRules !== 'undefined') {
|
|
793
861
|
// Validate array
|
|
794
862
|
if (!validator.isArray(options.managedRules)) {
|
|
@@ -804,6 +872,26 @@ class RecaptchaAuthConfig {
|
|
|
804
872
|
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaConfig.useAccountDefender" must be a boolean value".');
|
|
805
873
|
}
|
|
806
874
|
}
|
|
875
|
+
if (typeof options.useSmsBotScore !== 'undefined') {
|
|
876
|
+
if (!validator.isBoolean(options.useSmsBotScore)) {
|
|
877
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaConfig.useSmsBotScore" must be a boolean value".');
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
if (typeof options.useSmsTollFraudProtection !== 'undefined') {
|
|
881
|
+
if (!validator.isBoolean(options.useSmsTollFraudProtection)) {
|
|
882
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaConfig.useSmsTollFraudProtection" must be a boolean value".');
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
if (typeof options.smsTollFraudManagedRules !== 'undefined') {
|
|
886
|
+
// Validate array
|
|
887
|
+
if (!validator.isArray(options.smsTollFraudManagedRules)) {
|
|
888
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaConfig.smsTollFraudManagedRules" must be an array of valid "RecaptchaTollFraudManagedRule".');
|
|
889
|
+
}
|
|
890
|
+
// Validate each rule of the array
|
|
891
|
+
options.smsTollFraudManagedRules.forEach((tollFraudManagedRule) => {
|
|
892
|
+
RecaptchaAuthConfig.validateTollFraudManagedRule(tollFraudManagedRule);
|
|
893
|
+
});
|
|
894
|
+
}
|
|
807
895
|
}
|
|
808
896
|
/**
|
|
809
897
|
* Validate each element in ManagedRule array
|
|
@@ -830,29 +918,28 @@ class RecaptchaAuthConfig {
|
|
|
830
918
|
}
|
|
831
919
|
}
|
|
832
920
|
/**
|
|
833
|
-
*
|
|
834
|
-
* @
|
|
921
|
+
* Validate each element in TollFraudManagedRule array
|
|
922
|
+
* @param options - The options object to validate.
|
|
835
923
|
*/
|
|
836
|
-
|
|
837
|
-
const
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
recaptchaKeys: (0, deep_copy_1.deepCopy)(this.recaptchaKeys),
|
|
841
|
-
useAccountDefender: this.useAccountDefender,
|
|
924
|
+
static validateTollFraudManagedRule(options) {
|
|
925
|
+
const validKeys = {
|
|
926
|
+
startScore: true,
|
|
927
|
+
action: true,
|
|
842
928
|
};
|
|
843
|
-
if (
|
|
844
|
-
|
|
845
|
-
}
|
|
846
|
-
if (typeof json.managedRules === 'undefined') {
|
|
847
|
-
delete json.managedRules;
|
|
929
|
+
if (!validator.isNonNullObject(options)) {
|
|
930
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaTollFraudManagedRule" must be a non-null object.');
|
|
848
931
|
}
|
|
849
|
-
|
|
850
|
-
|
|
932
|
+
// Check for unsupported top level attributes.
|
|
933
|
+
for (const key in options) {
|
|
934
|
+
if (!(key in validKeys)) {
|
|
935
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, `"${key}" is not a valid RecaptchaTollFraudManagedRule parameter.`);
|
|
936
|
+
}
|
|
851
937
|
}
|
|
852
|
-
|
|
853
|
-
|
|
938
|
+
// Validate content.
|
|
939
|
+
if (typeof options.action !== 'undefined' &&
|
|
940
|
+
options.action !== 'BLOCK') {
|
|
941
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaTollFraudManagedRule.action" must be "BLOCK".');
|
|
854
942
|
}
|
|
855
|
-
return json;
|
|
856
943
|
}
|
|
857
944
|
}
|
|
858
945
|
exports.RecaptchaAuthConfig = RecaptchaAuthConfig;
|
package/lib/auth/auth.d.ts
CHANGED
package/lib/auth/auth.js
CHANGED
package/lib/auth/base-auth.d.ts
CHANGED
package/lib/auth/base-auth.js
CHANGED
package/lib/auth/identifier.d.ts
CHANGED
package/lib/auth/identifier.js
CHANGED
package/lib/auth/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v12.
|
|
1
|
+
/*! firebase-admin v12.7.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2020 Google Inc.
|
|
4
4
|
*
|
|
@@ -45,7 +45,7 @@ import { Auth } from './auth';
|
|
|
45
45
|
export declare function getAuth(app?: App): Auth;
|
|
46
46
|
export { ActionCodeSettings } from './action-code-settings-builder';
|
|
47
47
|
export { Auth, } from './auth';
|
|
48
|
-
export { AllowByDefault, AllowByDefaultWrap, AllowlistOnly, AllowlistOnlyWrap, AuthFactorType, AuthProviderConfig, AuthProviderConfigFilter, BaseAuthProviderConfig, BaseCreateMultiFactorInfoRequest, BaseUpdateMultiFactorInfoRequest, CreateMultiFactorInfoRequest, CreatePhoneMultiFactorInfoRequest, CreateRequest, EmailSignInProviderConfig, ListProviderConfigResults, MultiFactorConfig, MultiFactorConfigState, MultiFactorCreateSettings, MultiFactorUpdateSettings, MultiFactorProviderConfig, OAuthResponseType, OIDCAuthProviderConfig, OIDCUpdateAuthProviderRequest, RecaptchaAction, RecaptchaConfig, RecaptchaKey, RecaptchaKeyClientType, RecaptchaManagedRule, RecaptchaProviderEnforcementState, SAMLAuthProviderConfig, SAMLUpdateAuthProviderRequest, SmsRegionConfig, UserProvider, UpdateAuthProviderRequest, UpdateMultiFactorInfoRequest, UpdatePhoneMultiFactorInfoRequest, UpdateRequest, TotpMultiFactorProviderConfig, PasswordPolicyConfig, PasswordPolicyEnforcementState, CustomStrengthOptionsConfig, EmailPrivacyConfig, } from './auth-config';
|
|
48
|
+
export { AllowByDefault, AllowByDefaultWrap, AllowlistOnly, AllowlistOnlyWrap, AuthFactorType, AuthProviderConfig, AuthProviderConfigFilter, BaseAuthProviderConfig, BaseCreateMultiFactorInfoRequest, BaseUpdateMultiFactorInfoRequest, CreateMultiFactorInfoRequest, CreatePhoneMultiFactorInfoRequest, CreateRequest, EmailSignInProviderConfig, ListProviderConfigResults, MultiFactorConfig, MultiFactorConfigState, MultiFactorCreateSettings, MultiFactorUpdateSettings, MultiFactorProviderConfig, OAuthResponseType, OIDCAuthProviderConfig, OIDCUpdateAuthProviderRequest, RecaptchaAction, RecaptchaConfig, RecaptchaKey, RecaptchaKeyClientType, RecaptchaManagedRule, RecaptchaTollFraudManagedRule, RecaptchaProviderEnforcementState, SAMLAuthProviderConfig, SAMLUpdateAuthProviderRequest, SmsRegionConfig, UserProvider, UpdateAuthProviderRequest, UpdateMultiFactorInfoRequest, UpdatePhoneMultiFactorInfoRequest, UpdateRequest, TotpMultiFactorProviderConfig, PasswordPolicyConfig, PasswordPolicyEnforcementState, CustomStrengthOptionsConfig, EmailPrivacyConfig, } from './auth-config';
|
|
49
49
|
export { BaseAuth, DeleteUsersResult, GetUsersResult, ListUsersResult, SessionCookieOptions, } from './base-auth';
|
|
50
50
|
export { EmailIdentifier, PhoneIdentifier, ProviderIdentifier, UidIdentifier, UserIdentifier, } from './identifier';
|
|
51
51
|
export { CreateTenantRequest, Tenant, UpdateTenantRequest, } from './tenant';
|
package/lib/auth/index.js
CHANGED