firebase-admin 11.5.0 → 11.6.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 +1 -1
- package/lib/auth/auth-config.d.ts +23 -13
- package/lib/auth/auth-config.js +65 -2
- 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 +16 -2
- package/lib/auth/project-config.js +31 -2
- package/lib/auth/tenant-manager.d.ts +1 -1
- package/lib/auth/tenant-manager.js +1 -1
- package/lib/auth/tenant.d.ts +1 -1
- package/lib/auth/tenant.js +1 -1
- 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/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 +1 -1
- 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 +1 -1
- package/lib/messaging/messaging-api.d.ts +10 -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 +5 -1
- package/lib/messaging/messaging.js +5 -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/index.d.ts +1 -1
- package/lib/remote-config/index.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/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 +5 -5
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 v11.
|
|
1
|
+
/*! firebase-admin v11.6.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2018 Google Inc.
|
|
4
4
|
*
|
|
@@ -386,6 +386,7 @@ declare type AuthFactorServerType = 'PHONE_SMS';
|
|
|
386
386
|
export interface MultiFactorAuthServerConfig {
|
|
387
387
|
state?: MultiFactorConfigState;
|
|
388
388
|
enabledProviders?: AuthFactorServerType[];
|
|
389
|
+
providerConfigs?: MultiFactorProviderConfig[];
|
|
389
390
|
}
|
|
390
391
|
/**
|
|
391
392
|
* Identifies a second factor type.
|
|
@@ -410,22 +411,31 @@ export interface MultiFactorConfig {
|
|
|
410
411
|
* Currently only ‘phone’ is supported.
|
|
411
412
|
*/
|
|
412
413
|
factorIds?: AuthFactorType[];
|
|
414
|
+
/**
|
|
415
|
+
* A list of multi-factor provider configurations.
|
|
416
|
+
* MFA providers (except phone) indicate whether they're enabled through this field. */
|
|
417
|
+
providerConfigs?: MultiFactorProviderConfig[];
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Interface representing a multi-factor auth provider configuration.
|
|
421
|
+
* This interface is used for second factor auth providers other than SMS.
|
|
422
|
+
* Currently, only TOTP is supported.
|
|
423
|
+
*/ export interface MultiFactorProviderConfig {
|
|
424
|
+
/**
|
|
425
|
+
* Indicates whether this multi-factor provider is enabled or disabled. */
|
|
426
|
+
state: MultiFactorConfigState;
|
|
427
|
+
/**
|
|
428
|
+
* TOTP multi-factor provider config. */
|
|
429
|
+
totpProviderConfig?: TotpMultiFactorProviderConfig;
|
|
413
430
|
}
|
|
414
431
|
/**
|
|
415
|
-
*
|
|
416
|
-
* to a format that is understood by the Auth server.
|
|
432
|
+
* Interface representing configuration settings for TOTP second factor auth.
|
|
417
433
|
*/
|
|
418
|
-
export
|
|
419
|
-
readonly state: MultiFactorConfigState;
|
|
420
|
-
readonly factorIds: AuthFactorType[];
|
|
434
|
+
export interface TotpMultiFactorProviderConfig {
|
|
421
435
|
/**
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
*/
|
|
426
|
-
private static validate;
|
|
427
|
-
/** @returns The plain object representation of the multi-factor config instance. */
|
|
428
|
-
toJSON(): object;
|
|
436
|
+
* The allowed number of adjacent intervals that will be used for verification
|
|
437
|
+
* to compensate for clock skew. */
|
|
438
|
+
adjacentIntervals?: number;
|
|
429
439
|
}
|
|
430
440
|
/**
|
|
431
441
|
* Validates the provided map of test phone number / code pairs.
|
package/lib/auth/auth-config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v11.
|
|
1
|
+
/*! firebase-admin v11.6.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2018 Google Inc.
|
|
@@ -35,6 +35,8 @@ const AUTH_FACTOR_SERVER_TO_CLIENT_TYPE = Object.keys(AUTH_FACTOR_CLIENT_TO_SERV
|
|
|
35
35
|
/**
|
|
36
36
|
* Defines the multi-factor config class used to convert client side MultiFactorConfig
|
|
37
37
|
* to a format that is understood by the Auth server.
|
|
38
|
+
*
|
|
39
|
+
* @internal
|
|
38
40
|
*/
|
|
39
41
|
class MultiFactorAuthConfig {
|
|
40
42
|
/**
|
|
@@ -58,6 +60,18 @@ class MultiFactorAuthConfig {
|
|
|
58
60
|
this.factorIds.push(AUTH_FACTOR_SERVER_TO_CLIENT_TYPE[enabledProvider]);
|
|
59
61
|
}
|
|
60
62
|
});
|
|
63
|
+
this.providerConfigs = [];
|
|
64
|
+
(response.providerConfigs || []).forEach((providerConfig) => {
|
|
65
|
+
if (typeof providerConfig !== 'undefined') {
|
|
66
|
+
if (typeof providerConfig.state === 'undefined' ||
|
|
67
|
+
typeof providerConfig.totpProviderConfig === 'undefined' ||
|
|
68
|
+
(typeof providerConfig.totpProviderConfig.adjacentIntervals !== 'undefined' &&
|
|
69
|
+
typeof providerConfig.totpProviderConfig.adjacentIntervals !== 'number')) {
|
|
70
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INTERNAL_ERROR, 'INTERNAL ASSERT FAILED: Invalid multi-factor configuration response');
|
|
71
|
+
}
|
|
72
|
+
this.providerConfigs.push(providerConfig);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
61
75
|
}
|
|
62
76
|
/**
|
|
63
77
|
* Static method to convert a client side request to a MultiFactorAuthServerConfig.
|
|
@@ -85,6 +99,9 @@ class MultiFactorAuthConfig {
|
|
|
85
99
|
request.enabledProviders = [];
|
|
86
100
|
}
|
|
87
101
|
}
|
|
102
|
+
if (Object.prototype.hasOwnProperty.call(options, 'providerConfigs')) {
|
|
103
|
+
request.providerConfigs = options.providerConfigs;
|
|
104
|
+
}
|
|
88
105
|
return request;
|
|
89
106
|
}
|
|
90
107
|
/**
|
|
@@ -96,6 +113,7 @@ class MultiFactorAuthConfig {
|
|
|
96
113
|
const validKeys = {
|
|
97
114
|
state: true,
|
|
98
115
|
factorIds: true,
|
|
116
|
+
providerConfigs: true,
|
|
99
117
|
};
|
|
100
118
|
if (!validator.isNonNullObject(options)) {
|
|
101
119
|
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"MultiFactorConfig" must be a non-null object.');
|
|
@@ -123,12 +141,57 @@ class MultiFactorAuthConfig {
|
|
|
123
141
|
}
|
|
124
142
|
});
|
|
125
143
|
}
|
|
144
|
+
if (typeof options.providerConfigs !== 'undefined') {
|
|
145
|
+
if (!validator.isArray(options.providerConfigs)) {
|
|
146
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"MultiFactorConfig.providerConfigs" must be an array of valid "MultiFactorProviderConfig."');
|
|
147
|
+
}
|
|
148
|
+
//Validate content of array.
|
|
149
|
+
options.providerConfigs.forEach((multiFactorProviderConfig) => {
|
|
150
|
+
if (typeof multiFactorProviderConfig === 'undefined' || !validator.isObject(multiFactorProviderConfig)) {
|
|
151
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, `"${multiFactorProviderConfig}" is not a valid "MultiFactorProviderConfig" type.`);
|
|
152
|
+
}
|
|
153
|
+
const validProviderConfigKeys = {
|
|
154
|
+
state: true,
|
|
155
|
+
totpProviderConfig: true,
|
|
156
|
+
};
|
|
157
|
+
for (const key in multiFactorProviderConfig) {
|
|
158
|
+
if (!(key in validProviderConfigKeys)) {
|
|
159
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, `"${key}" is not a valid ProviderConfig parameter.`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (typeof multiFactorProviderConfig.state === 'undefined' ||
|
|
163
|
+
(multiFactorProviderConfig.state !== 'ENABLED' &&
|
|
164
|
+
multiFactorProviderConfig.state !== 'DISABLED')) {
|
|
165
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"MultiFactorConfig.providerConfigs.state" must be either "ENABLED" or "DISABLED".');
|
|
166
|
+
}
|
|
167
|
+
// Since TOTP is the only provider config available right now, not defining it will lead into an error
|
|
168
|
+
if (typeof multiFactorProviderConfig.totpProviderConfig === 'undefined') {
|
|
169
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"MultiFactorConfig.providerConfigs.totpProviderConfig" must be defined.');
|
|
170
|
+
}
|
|
171
|
+
const validTotpProviderConfigKeys = {
|
|
172
|
+
adjacentIntervals: true,
|
|
173
|
+
};
|
|
174
|
+
for (const key in multiFactorProviderConfig.totpProviderConfig) {
|
|
175
|
+
if (!(key in validTotpProviderConfigKeys)) {
|
|
176
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, `"${key}" is not a valid TotpProviderConfig parameter.`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const adjIntervals = multiFactorProviderConfig.totpProviderConfig.adjacentIntervals;
|
|
180
|
+
if (typeof adjIntervals !== 'undefined' &&
|
|
181
|
+
(!Number.isInteger(adjIntervals) || adjIntervals < 0 || adjIntervals > 10)) {
|
|
182
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, '"MultiFactorConfig.providerConfigs.totpProviderConfig.adjacentIntervals" must' +
|
|
183
|
+
' be a valid number between 0 and 10 (both inclusive).');
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
126
187
|
}
|
|
127
|
-
/**
|
|
188
|
+
/** Converts MultiFactorConfig to JSON object
|
|
189
|
+
* @returns The plain object representation of the multi-factor config instance. */
|
|
128
190
|
toJSON() {
|
|
129
191
|
return {
|
|
130
192
|
state: this.state,
|
|
131
193
|
factorIds: this.factorIds,
|
|
194
|
+
providerConfigs: this.providerConfigs,
|
|
132
195
|
};
|
|
133
196
|
}
|
|
134
197
|
}
|
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 v11.
|
|
1
|
+
/*! firebase-admin v11.6.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, OAuthResponseType, OIDCAuthProviderConfig, OIDCUpdateAuthProviderRequest, SAMLAuthProviderConfig, SAMLUpdateAuthProviderRequest, SmsRegionConfig, UserProvider, UpdateAuthProviderRequest, UpdateMultiFactorInfoRequest, UpdatePhoneMultiFactorInfoRequest, UpdateRequest, } 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, SAMLAuthProviderConfig, SAMLUpdateAuthProviderRequest, SmsRegionConfig, UserProvider, UpdateAuthProviderRequest, UpdateMultiFactorInfoRequest, UpdatePhoneMultiFactorInfoRequest, UpdateRequest, TotpMultiFactorProviderConfig, } 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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! firebase-admin v11.
|
|
2
|
-
import { SmsRegionConfig } from './auth-config';
|
|
1
|
+
/*! firebase-admin v11.6.0 */
|
|
2
|
+
import { SmsRegionConfig, MultiFactorConfig, MultiFactorAuthServerConfig } from './auth-config';
|
|
3
3
|
/**
|
|
4
4
|
* Interface representing the properties to update on the provided project config.
|
|
5
5
|
*/
|
|
@@ -8,6 +8,10 @@ export interface UpdateProjectConfigRequest {
|
|
|
8
8
|
* The SMS configuration to update on the project.
|
|
9
9
|
*/
|
|
10
10
|
smsRegionConfig?: SmsRegionConfig;
|
|
11
|
+
/**
|
|
12
|
+
* The multi-factor auth configuration to update on the project.
|
|
13
|
+
*/
|
|
14
|
+
multiFactorConfig?: MultiFactorConfig;
|
|
11
15
|
}
|
|
12
16
|
/**
|
|
13
17
|
* Response received from getting or updating a project config.
|
|
@@ -15,6 +19,7 @@ export interface UpdateProjectConfigRequest {
|
|
|
15
19
|
*/
|
|
16
20
|
export interface ProjectConfigServerResponse {
|
|
17
21
|
smsRegionConfig?: SmsRegionConfig;
|
|
22
|
+
mfa?: MultiFactorAuthServerConfig;
|
|
18
23
|
}
|
|
19
24
|
/**
|
|
20
25
|
* Request sent to update project config.
|
|
@@ -22,6 +27,7 @@ export interface ProjectConfigServerResponse {
|
|
|
22
27
|
*/
|
|
23
28
|
export interface ProjectConfigClientRequest {
|
|
24
29
|
smsRegionConfig?: SmsRegionConfig;
|
|
30
|
+
mfa?: MultiFactorAuthServerConfig;
|
|
25
31
|
}
|
|
26
32
|
/**
|
|
27
33
|
* Represents a project configuration.
|
|
@@ -33,6 +39,14 @@ export declare class ProjectConfig {
|
|
|
33
39
|
* This is based on the calling code of the destination phone number.
|
|
34
40
|
*/
|
|
35
41
|
readonly smsRegionConfig?: SmsRegionConfig;
|
|
42
|
+
/**
|
|
43
|
+
* The project's multi-factor auth configuration.
|
|
44
|
+
* Supports only phone and TOTP.
|
|
45
|
+
*/ private readonly multiFactorConfig_?;
|
|
46
|
+
/**
|
|
47
|
+
* The multi-factor auth configuration.
|
|
48
|
+
*/
|
|
49
|
+
get multiFactorConfig(): MultiFactorConfig | undefined;
|
|
36
50
|
/**
|
|
37
51
|
* Validates a project config options object. Throws an error on failure.
|
|
38
52
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v11.
|
|
1
|
+
/*! firebase-admin v11.6.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.ProjectConfig = void 0;
|
|
@@ -36,6 +36,17 @@ class ProjectConfig {
|
|
|
36
36
|
if (typeof response.smsRegionConfig !== 'undefined') {
|
|
37
37
|
this.smsRegionConfig = response.smsRegionConfig;
|
|
38
38
|
}
|
|
39
|
+
//Backend API returns "mfa" in case of project config and "mfaConfig" in case of tenant config.
|
|
40
|
+
//The SDK exposes it as multiFactorConfig always.
|
|
41
|
+
if (typeof response.mfa !== 'undefined') {
|
|
42
|
+
this.multiFactorConfig_ = new auth_config_1.MultiFactorAuthConfig(response.mfa);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The multi-factor auth configuration.
|
|
47
|
+
*/
|
|
48
|
+
get multiFactorConfig() {
|
|
49
|
+
return this.multiFactorConfig_;
|
|
39
50
|
}
|
|
40
51
|
/**
|
|
41
52
|
* Validates a project config options object. Throws an error on failure.
|
|
@@ -48,6 +59,7 @@ class ProjectConfig {
|
|
|
48
59
|
}
|
|
49
60
|
const validKeys = {
|
|
50
61
|
smsRegionConfig: true,
|
|
62
|
+
multiFactorConfig: true,
|
|
51
63
|
};
|
|
52
64
|
// Check for unsupported top level attributes.
|
|
53
65
|
for (const key in request) {
|
|
@@ -59,6 +71,10 @@ class ProjectConfig {
|
|
|
59
71
|
if (typeof request.smsRegionConfig !== 'undefined') {
|
|
60
72
|
auth_config_1.SmsRegionsAuthConfig.validate(request.smsRegionConfig);
|
|
61
73
|
}
|
|
74
|
+
// Validate Multi Factor Config if provided
|
|
75
|
+
if (typeof request.multiFactorConfig !== 'undefined') {
|
|
76
|
+
auth_config_1.MultiFactorAuthConfig.validate(request.multiFactorConfig);
|
|
77
|
+
}
|
|
62
78
|
}
|
|
63
79
|
/**
|
|
64
80
|
* Build the corresponding server request for a UpdateProjectConfigRequest object.
|
|
@@ -69,7 +85,16 @@ class ProjectConfig {
|
|
|
69
85
|
*/
|
|
70
86
|
static buildServerRequest(configOptions) {
|
|
71
87
|
ProjectConfig.validate(configOptions);
|
|
72
|
-
|
|
88
|
+
const request = configOptions;
|
|
89
|
+
if (configOptions.multiFactorConfig !== undefined) {
|
|
90
|
+
request.mfa = auth_config_1.MultiFactorAuthConfig.buildServerRequest(configOptions.multiFactorConfig);
|
|
91
|
+
}
|
|
92
|
+
// Backend API returns "mfa" in case of project config and "mfaConfig" in case of tenant config.
|
|
93
|
+
// The SDK exposes it as multiFactorConfig always.
|
|
94
|
+
// See https://cloud.google.com/identity-platform/docs/reference/rest/v2/projects.tenants#resource:-tenant
|
|
95
|
+
// and https://cloud.google.com/identity-platform/docs/reference/rest/v2/Config
|
|
96
|
+
delete request.multiFactorConfig;
|
|
97
|
+
return request;
|
|
73
98
|
}
|
|
74
99
|
/**
|
|
75
100
|
* Returns a JSON-serializable representation of this object.
|
|
@@ -80,10 +105,14 @@ class ProjectConfig {
|
|
|
80
105
|
// JSON serialization
|
|
81
106
|
const json = {
|
|
82
107
|
smsRegionConfig: (0, deep_copy_1.deepCopy)(this.smsRegionConfig),
|
|
108
|
+
multiFactorConfig: (0, deep_copy_1.deepCopy)(this.multiFactorConfig),
|
|
83
109
|
};
|
|
84
110
|
if (typeof json.smsRegionConfig === 'undefined') {
|
|
85
111
|
delete json.smsRegionConfig;
|
|
86
112
|
}
|
|
113
|
+
if (typeof json.multiFactorConfig === 'undefined') {
|
|
114
|
+
delete json.multiFactorConfig;
|
|
115
|
+
}
|
|
87
116
|
return json;
|
|
88
117
|
}
|
|
89
118
|
}
|