firebase-admin 12.6.0 → 13.0.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/README.md +1 -2
- package/lib/app/core.d.ts +1 -2
- package/lib/app/core.js +1 -1
- package/lib/app/credential-factory.d.ts +1 -2
- package/lib/app/credential-factory.js +5 -6
- package/lib/app/credential-internal.d.ts +37 -35
- package/lib/app/credential-internal.js +194 -294
- 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 +6 -6
- 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 +3 -3
- package/lib/app-check/token-generator.d.ts +1 -1
- package/lib/app-check/token-generator.js +3 -3
- 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 +5 -5
- package/lib/auth/auth-config.d.ts +41 -17
- package/lib/auth/auth-config.js +114 -27
- 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 +3 -3
- package/lib/auth/identifier.d.ts +1 -1
- package/lib/auth/identifier.js +5 -6
- package/lib/auth/index.d.ts +2 -2
- package/lib/auth/index.js +3 -3
- 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 -2
- package/lib/auth/token-generator.js +3 -3
- package/lib/auth/token-verifier.d.ts +1 -1
- package/lib/auth/token-verifier.js +5 -5
- package/lib/auth/user-import-builder.d.ts +1 -2
- package/lib/auth/user-import-builder.js +3 -3
- 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 +3 -3
- package/lib/database/database-namespace.d.ts +1 -1
- package/lib/database/database-namespace.js +1 -1
- package/lib/database/database.d.ts +1 -2
- package/lib/database/database.js +1 -1
- package/lib/database/index.d.ts +1 -1
- package/lib/database/index.js +4 -4
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +4 -4
- package/lib/functions/functions-api-client-internal.d.ts +1 -1
- package/lib/functions/functions-api-client-internal.js +7 -6
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
- package/lib/machine-learning/machine-learning-api-client.js +3 -3
- 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/index.d.ts +2 -2
- package/lib/messaging/index.js +3 -3
- package/lib/messaging/messaging-api-request-internal.d.ts +2 -12
- package/lib/messaging/messaging-api-request-internal.js +4 -38
- package/lib/messaging/messaging-api.d.ts +8 -94
- 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 +3 -4
- package/lib/messaging/messaging-internal.d.ts +1 -1
- package/lib/messaging/messaging-internal.js +4 -3
- package/lib/messaging/messaging-namespace.d.ts +2 -22
- package/lib/messaging/messaging-namespace.js +1 -1
- package/lib/messaging/messaging.d.ts +3 -149
- package/lib/messaging/messaging.js +2 -539
- 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 +3 -3
- 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 +3 -3
- 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 +6 -14
- package/lib/remote-config/index.d.ts +1 -1
- package/lib/remote-config/index.js +3 -3
- 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 +3 -3
- 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 -2
- package/lib/security-rules/security-rules.js +1 -1
- package/lib/storage/index.d.ts +1 -1
- package/lib/storage/index.js +4 -4
- 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 +2 -3
- package/lib/utils/api-request.d.ts +1 -5
- package/lib/utils/api-request.js +23 -8
- package/lib/utils/crypto-signer.d.ts +1 -2
- package/lib/utils/crypto-signer.js +3 -3
- package/lib/utils/deep-copy.d.ts +1 -1
- package/lib/utils/deep-copy.js +3 -4
- package/lib/utils/error.d.ts +1 -1
- package/lib/utils/error.js +1 -1
- package/lib/utils/index.d.ts +2 -2
- package/lib/utils/index.js +19 -16
- package/lib/utils/jwt.d.ts +1 -2
- package/lib/utils/jwt.js +5 -5
- package/lib/utils/validator.d.ts +1 -2
- package/lib/utils/validator.js +20 -21
- package/package.json +14 -13
- package/CHANGELOG.md +0 -4
- package/lib/messaging/batch-request-internal.d.ts +0 -55
- package/lib/messaging/batch-request-internal.js +0 -127
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v13.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -17,7 +17,11 @@
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.FIREBASE_CONFIG_VAR = exports.
|
|
20
|
+
exports.FIREBASE_CONFIG_VAR = exports.defaultAppStore = exports.AppStore = void 0;
|
|
21
|
+
exports.initializeApp = initializeApp;
|
|
22
|
+
exports.getApp = getApp;
|
|
23
|
+
exports.getApps = getApps;
|
|
24
|
+
exports.deleteApp = deleteApp;
|
|
21
25
|
const fs = require("fs");
|
|
22
26
|
const validator = require("../utils/validator");
|
|
23
27
|
const error_1 = require("../utils/error");
|
|
@@ -101,15 +105,12 @@ exports.defaultAppStore = new AppStore();
|
|
|
101
105
|
function initializeApp(options, appName = DEFAULT_APP_NAME) {
|
|
102
106
|
return exports.defaultAppStore.initializeApp(options, appName);
|
|
103
107
|
}
|
|
104
|
-
exports.initializeApp = initializeApp;
|
|
105
108
|
function getApp(appName = DEFAULT_APP_NAME) {
|
|
106
109
|
return exports.defaultAppStore.getApp(appName);
|
|
107
110
|
}
|
|
108
|
-
exports.getApp = getApp;
|
|
109
111
|
function getApps() {
|
|
110
112
|
return exports.defaultAppStore.getApps();
|
|
111
113
|
}
|
|
112
|
-
exports.getApps = getApps;
|
|
113
114
|
/**
|
|
114
115
|
* Renders this given `App` unusable and frees the resources of
|
|
115
116
|
* all associated services (though it does *not* clean up any backend
|
|
@@ -130,7 +131,6 @@ exports.getApps = getApps;
|
|
|
130
131
|
function deleteApp(app) {
|
|
131
132
|
return exports.defaultAppStore.deleteApp(app);
|
|
132
133
|
}
|
|
133
|
-
exports.deleteApp = deleteApp;
|
|
134
134
|
/**
|
|
135
135
|
* Constant holding the environment variable name with the default config.
|
|
136
136
|
* If the environment variable contains a string that starts with '{' it will be parsed as JSON,
|
package/lib/app-check/index.d.ts
CHANGED
package/lib/app-check/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v13.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
20
|
+
exports.AppCheck = void 0;
|
|
21
|
+
exports.getAppCheck = getAppCheck;
|
|
21
22
|
/**
|
|
22
23
|
* Firebase App Check.
|
|
23
24
|
*
|
|
@@ -60,4 +61,3 @@ function getAppCheck(app) {
|
|
|
60
61
|
const firebaseApp = app;
|
|
61
62
|
return firebaseApp.getOrInitService('appCheck', (app) => new app_check_1.AppCheck(app));
|
|
62
63
|
}
|
|
63
|
-
exports.getAppCheck = getAppCheck;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v13.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
20
|
+
exports.AppCheckTokenGenerator = void 0;
|
|
21
|
+
exports.appCheckErrorFromCryptoSignerError = appCheckErrorFromCryptoSignerError;
|
|
21
22
|
const validator = require("../utils/validator");
|
|
22
23
|
const utils_1 = require("../utils");
|
|
23
24
|
const crypto_signer_1 = require("../utils/crypto-signer");
|
|
@@ -141,7 +142,6 @@ function appCheckErrorFromCryptoSignerError(err) {
|
|
|
141
142
|
}
|
|
142
143
|
return new app_check_api_client_internal_1.FirebaseAppCheckError(mapToAppCheckErrorCode(err.code), err.message);
|
|
143
144
|
}
|
|
144
|
-
exports.appCheckErrorFromCryptoSignerError = appCheckErrorFromCryptoSignerError;
|
|
145
145
|
function mapToAppCheckErrorCode(code) {
|
|
146
146
|
switch (code) {
|
|
147
147
|
case crypto_signer_1.CryptoSignerErrorCode.INVALID_CREDENTIAL:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v13.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
20
|
+
exports.TenantAwareAuthRequestHandler = exports.AuthRequestHandler = exports.AbstractAuthRequestHandler = exports.FIREBASE_AUTH_SIGN_UP_NEW_USER = exports.FIREBASE_AUTH_SET_ACCOUNT_INFO = exports.FIREBASE_AUTH_BATCH_DELETE_ACCOUNTS = exports.FIREBASE_AUTH_DELETE_ACCOUNT = exports.FIREBASE_AUTH_GET_ACCOUNTS_INFO = exports.FIREBASE_AUTH_GET_ACCOUNT_INFO = exports.FIREBASE_AUTH_DOWNLOAD_ACCOUNT = exports.FIREBASE_AUTH_UPLOAD_ACCOUNT = exports.FIREBASE_AUTH_CREATE_SESSION_COOKIE = exports.EMAIL_ACTION_REQUEST_TYPES = exports.RESERVED_CLAIMS = void 0;
|
|
21
|
+
exports.useEmulator = useEmulator;
|
|
21
22
|
const validator = require("../utils/validator");
|
|
22
23
|
const deep_copy_1 = require("../utils/deep-copy");
|
|
23
24
|
const error_1 = require("../utils/error");
|
|
@@ -30,7 +31,7 @@ const identifier_1 = require("./identifier");
|
|
|
30
31
|
const auth_config_1 = require("./auth-config");
|
|
31
32
|
const project_config_1 = require("./project-config");
|
|
32
33
|
/** Firebase Auth request header. */
|
|
33
|
-
const
|
|
34
|
+
const FIREBASE_AUTH_HEADERS = {
|
|
34
35
|
'X-Client-Version': `Node/Admin/${utils.getSdkVersion()}`,
|
|
35
36
|
};
|
|
36
37
|
/** Firebase Auth request timeout duration in milliseconds. */
|
|
@@ -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
|
};
|
|
@@ -1945,4 +1946,3 @@ function emulatorHost() {
|
|
|
1945
1946
|
function useEmulator() {
|
|
1946
1947
|
return !!emulatorHost();
|
|
1947
1948
|
}
|
|
1948
|
-
exports.useEmulator = useEmulator;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v13.0.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
|
|
1
|
+
/*! firebase-admin v13.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2018 Google Inc.
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.EmailPrivacyAuthConfig = exports.PasswordPolicyAuthConfig = exports.RecaptchaAuthConfig = exports.SmsRegionsAuthConfig = exports.OIDCConfig = exports.SAMLConfig = exports.EmailSignInConfig = exports.
|
|
19
|
+
exports.EmailPrivacyAuthConfig = exports.PasswordPolicyAuthConfig = exports.RecaptchaAuthConfig = exports.SmsRegionsAuthConfig = exports.OIDCConfig = exports.SAMLConfig = exports.EmailSignInConfig = exports.MultiFactorAuthConfig = exports.MAXIMUM_TEST_PHONE_NUMBERS = void 0;
|
|
20
|
+
exports.validateTestPhoneNumbers = validateTestPhoneNumbers;
|
|
20
21
|
const validator = require("../utils/validator");
|
|
21
22
|
const deep_copy_1 = require("../utils/deep-copy");
|
|
22
23
|
const error_1 = require("../utils/error");
|
|
@@ -219,7 +220,6 @@ function validateTestPhoneNumbers(testPhoneNumbers) {
|
|
|
219
220
|
}
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
|
-
exports.validateTestPhoneNumbers = validateTestPhoneNumbers;
|
|
223
223
|
/**
|
|
224
224
|
* Defines the email sign-in config class used to convert client side EmailSignInConfig
|
|
225
225
|
* to a format that is understood by the Auth server.
|
|
@@ -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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v13.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2021 Google Inc.
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.BaseAuth =
|
|
19
|
+
exports.BaseAuth = void 0;
|
|
20
|
+
exports.createFirebaseTokenGenerator = createFirebaseTokenGenerator;
|
|
20
21
|
const error_1 = require("../utils/error");
|
|
21
22
|
const deep_copy_1 = require("../utils/deep-copy");
|
|
22
23
|
const validator = require("../utils/validator");
|
|
@@ -39,7 +40,6 @@ function createFirebaseTokenGenerator(app, tenantId) {
|
|
|
39
40
|
throw (0, token_generator_1.handleCryptoSignerError)(err);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
exports.createFirebaseTokenGenerator = createFirebaseTokenGenerator;
|
|
43
43
|
/**
|
|
44
44
|
* Common parent interface for both `Auth` and `TenantAwareAuth` APIs.
|
|
45
45
|
*/
|
package/lib/auth/identifier.d.ts
CHANGED